[GRASS-user] d.mon and monitor frames

I am experimenting with a very simple Python script that uses frames in a PNG
monitor. Does d.barscale at=xy describe the xy from top-left in percent
distance from the monitor or the frame? The verbiage in the documentation
uses "frame," but I can't seem to make it behave the way I would expect it
to given that.

Frames are as follows:

    # create a title frame
    grass.run_command("d.frame", frame="title", at="90,100,0,100",
flags="c")

# create a map frame
    grass.run_command("d.frame", frame="map", at="7,90,0,100", flags="c")

  # create a legend frame
    grass.run_command("d.frame", frame="legend", at="0,7,0,100", flags="c")

I can place a barscale at the very bottom left of the map frame with

#110 works, but I thought it was only 1-100?!
grass.run_command("d.barscale", bcolor="white", tcolor="black", at="2,110")

but I cannot successfully place a barscale in the legend frame.

The complete script section is as follows:

-------------------------------------------------------------------
    # create a title frame
    grass.run_command("d.frame", frame="title", at="90,100,0,100",
flags="c")
    
## grass.run_command("d.text", text=mapName, align="uc", size="60",
color="black",flags="b")
    grass.run_command("d.text", text=mapName, at="30,30", size="40",
color="black",flags="b")

    # create a map frame
    grass.run_command("d.frame", frame="map", at="7,90,0,100", flags="c")
    grass.run_command("d.vect", map="parcelBoundaries",
type="boundary",col="black", fcolor="gray", width="2")
    grass.run_command("d.vect", map="digitizedLagoons",
type="boundary,area",col="black", fcolor="gray", width="1")
    grass.run_command("d.vect", map="digitizedStructures",
type="boundary,area",col="black", fcolor="gray", width="1")
    grass.run_command("d.vect", map="trees_all",
type="point",icon="basic/triangle",color="black", fcolor="gray", size="10")
    grass.run_command("d.vect", map="seep",
type="point",icon="basic/cross2",color="black", fcolor="black", size="10")
    grass.run_command("d.vect", map="wells",
type="point",icon="basic/circle",color="black", fcolor="black", size="15")
    grass.run_command("d.vect", map="weatherStation",
type="point",icon="basic/box",color="black", fcolor="black", size="10")
##THIS WORKS
    grass.run_command("d.barscale", bcolor="white", tcolor="black",
at="2,110")
    
    # create a legend frame
    grass.run_command("d.frame", frame="legend", at="0,7,0,100", flags="c")
    grass.run_command("d.text", text="some text", size="20", at="85,50",
color="black")
    grass.run_command("d.text", text="some more text", size="20",
at="85,30", color="black")

   #THIS DOES NOT WORK..played with several "at=xy settings.
    grass.run_command("d.barscale", bcolor="white", tcolor="black",
at="2,10)

------------------------------------------------------------------------------------------

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/d-mon-and-monitor-frames-tp5496890p5496890.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Damian M wrote:

I am experimenting with a very simple Python script that uses frames in a PNG
monitor. Does d.barscale at=xy describe the xy from top-left in percent
distance from the monitor or the frame? The verbiage in the documentation
uses "frame," but I can't seem to make it behave the way I would expect it
to given that.

It should be the frame.

Are you using a PNG monitor (d.mon start=PNG), or immediate rendering
(GRASS_RENDER_IMMEDIATE=TRUE; enabled by default on Windows)?

If it's the latter, commands which rely upon persistent state (e.g.
d.frame, d.font) don't work; the driver is re-initialised for each
command. In 7.0, you can use the GRASS_FRAME environment variable to
specify the frame for a command, but there isn't any equivalent in
6.x.

--
Glynn Clements <glynn@gclements.plus.com>

On Sat, Sep 4, 2010 at 5:28 PM, Glynn Clements <glynn@gclements.plus.com> wrote:

In 7.0, you can use the GRASS_FRAME environment variable to
specify the frame for a command, but there isn't any equivalent in
6.x.

Please suggest a text snippet for
lib/init/variables.html

Markus

Thank you for your reply.

I am using the PNG monitor as follows:

--------------------------------------------------

    os.environ['GRASS_WIDTH'] = '2000'
    os.environ['GRASS_HEIGHT'] = '1600'
    os.environ["GRASS_TRUECOLOR"] = "TRUE"

    os.putenv('GRASS_PNGFILE', outFileName+".png")
    grass.run_command("d.mon", start="PNG")

...
...
...

   grass.run_command("d.mon", stop="PNG")

------------------

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/d-mon-and-monitor-frames-tp5496890p5498901.html
Sent from the Grass - Users mailing list archive at Nabble.com.

Markus Neteler wrote:

> In 7.0, you can use the GRASS_FRAME environment variable to
> specify the frame for a command, but there isn't any equivalent in
> 6.x.

Please suggest a text snippet for
lib/init/variables.html

It's actually documented for the individual drivers, although it's
implemented by the display library rather than any driver (or the
driver library).

--
Glynn Clements <glynn@gclements.plus.com>

Damian M wrote:

Thank you for your reply.

I am using the PNG monitor as follows:

--------------------------------------------------

    os.environ['GRASS_WIDTH'] = '2000'
    os.environ['GRASS_HEIGHT'] = '1600'
    os.environ["GRASS_TRUECOLOR"] = "TRUE"

    os.putenv('GRASS_PNGFILE', outFileName+".png")
    grass.run_command("d.mon", start="PNG")

In which case, it ought to work. d.barscale explicitly reads the
bounds of the current frame when calculating the coordinates.

--
Glynn Clements <glynn@gclements.plus.com>