GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
Map composition (stack of map layers and overlays) More...
Public Member Functions | |
def | __init__ |
def | GetProjInfo |
Get projection info. More... | |
def | GetWindow |
Read WIND file and set up self.wind dictionary. More... | |
def | AdjustRegion |
Adjusts display resolution to match monitor size in pixels. More... | |
def | AlignResolution |
Sets display extents to even multiple of current resolution defined in WIND file from SW corner. More... | |
def | AlignExtentFromDisplay |
Align region extent based on display size from center point. More... | |
def | ChangeMapSize |
Change size of rendered map. More... | |
def | GetRegion |
Get region settings (g.region -upgc) More... | |
def | GetCurrentRegion |
Get current display region settings. More... | |
def | SetRegion |
Render string for GRASS_REGION env. More... | |
def | GetListOfLayers |
Returns list of layers of selected properties or list of all layers. More... | |
def | Render |
Creates final image composite. More... | |
def | AddLayer |
Adds generic map layer to list of layers. More... | |
def | DeleteLayer |
Removes layer from list of layers. More... | |
def | ReorderLayers |
Reorder list to match layer tree. More... | |
def | ChangeLayer |
Change map layer properties. More... | |
def | ChangeOpacity |
Changes opacity value of map layer. More... | |
def | ChangeLayerActive |
Enable or disable map layer. More... | |
def | ChangeLayerName |
Change name of the layer. More... | |
def | RemoveLayer |
Removes layer from layer list. More... | |
def | GetLayerIndex |
Get index of layer in layer list. More... | |
def | AddOverlay |
Adds overlay (grid, barscale, legend, etc.) to list of overlays. More... | |
def | ChangeOverlay |
Change overlay properities. More... | |
def | GetOverlay |
Return overlay(s) with 'id'. More... | |
def | DeleteOverlay |
Delete overlay. More... | |
def | Clean |
Clean layer stack - go trough all layers and remove them from layer list. More... | |
def | ReverseListOfLayers |
Reverse list of layers. More... | |
def | RenderOverlays |
Render overlays only (for nviz) More... | |
Data Fields | |
wind | |
region | |
width | |
height | |
layers | |
overlays | |
ovlookup | |
env | |
gisrc | |
mapfile | |
projinfo | |
def render.Map.AddLayer | ( | self, | |
type, | |||
command, | |||
name = None , |
|||
l_active = True , |
|||
l_hidden = False , |
|||
l_opacity = 1.0 , |
|||
l_render = False , |
|||
pos = -1 |
|||
) |
Adds generic map layer to list of layers.
type | layer type ('raster', 'vector', etc.) |
command | GRASS command given as list |
name | layer name |
l_active | layer render only if True |
l_hidden | layer not displayed in layer tree if True |
l_opacity | opacity level range from 0(transparent) - 1(not transparent) |
l_render | render an image if True |
pos | position in layer list (-1 for append) |
Definition at line 958 of file render.py.
Referenced by render.Map.Render().
def render.Map.AddOverlay | ( | self, | |
id, | |||
type, | |||
command, | |||
l_active = True , |
|||
l_hidden = True , |
|||
l_opacity = 1.0 , |
|||
l_render = False |
|||
) |
Adds overlay (grid, barscale, legend, etc.) to list of overlays.
id | overlay id (PseudoDC) |
type | overlay type (barscale, legend) |
command | GRASS command to render overlay |
l_active | overlay activated (True) or disabled (False) |
l_hidden | overlay is not shown in layer tree (if True) |
l_render | render an image (if True) |
Definition at line 1160 of file render.py.
References render.Map.overlays.
Referenced by render.Map.GetLayerIndex().
def render.Map.AdjustRegion | ( | self | ) |
Adjusts display resolution to match monitor size in pixels.
Maintains constant display resolution, not related to computational region. Do NOT use the display resolution to set computational resolution. Set computational resolution through g.region.
Definition at line 484 of file render.py.
References render.Map.height, render.Map.region, round, and render.Map.width.
Referenced by render.Map.SetRegion().
def render.Map.AlignExtentFromDisplay | ( | self | ) |
Align region extent based on display size from center point.
Definition at line 537 of file render.py.
References render.Map.height, max, min, render.Map.projinfo, render.Map.region, and render.Map.width.
def render.Map.AlignResolution | ( | self | ) |
Sets display extents to even multiple of current resolution defined in WIND file from SW corner.
This must be done manually as using the -a flag can produce incorrect extents.
Definition at line 504 of file render.py.
References render.Map.GetRegion(), render.Map.region, and round.
def render.Map.ChangeLayer | ( | self, | |
layer, | |||
render = False , |
|||
kargs | |||
) |
Change map layer properties.
layer | map layer instance |
type | layer type ('raster', 'vector', etc.) |
command | GRASS command given as list |
name | layer name |
active | layer render only if True |
hidden | layer not displayed in layer tree if True |
opacity | opacity level range from 0(transparent) - 1(not transparent) |
render | render an image if True |
Definition at line 1040 of file render.py.
Referenced by layertree.LayerTree.GetOptData(), and layertree.LayerTree.OnCmdChanged().
def render.Map.ChangeLayerActive | ( | self, | |
layer, | |||
active | |||
) |
def render.Map.ChangeLayerName | ( | self, | |
layer, | |||
name | |||
) |
def render.Map.ChangeMapSize | ( | self, | |
width, | |||
height | |||
) |
Change size of rendered map.
width,height | map size given as tuple |
Definition at line 563 of file render.py.
References render.Map.GetRegion(), render.Map.height, and render.Map.width.
def render.Map.ChangeOpacity | ( | self, | |
layer, | |||
l_opacity | |||
) |
def render.Map.ChangeOverlay | ( | self, | |
id, | |||
render = False , |
|||
kargs | |||
) |
Change overlay properities.
Add new overlay if overlay with 'id' doesn't exist.
id | overlay id (PseudoDC) |
type | overlay type (barscale, legend) |
command | GRASS command to render overlay |
l_active | overlay activated (True) or disabled (False) |
l_hidden | overlay is not shown in layer tree (if True) |
l_render | render an image (if True) |
Definition at line 1187 of file render.py.
References render.Map.GetOverlay().
def render.Map.Clean | ( | self | ) |
Clean layer stack - go trough all layers and remove them from layer list.
Removes also l_mapfile and l_maskfile
Definition at line 1259 of file render.py.
References render.Map.layers, render.Layer.mapfile, render.Map.mapfile, render.Map.overlays, and utils.split().
def render.Map.DeleteLayer | ( | self, | |
layer, | |||
overlay = False |
|||
) |
Removes layer from list of layers.
layer | layer instance in layer tree |
overlay | delete overlay (use self.DeleteOverlay() instead) |
Definition at line 995 of file render.py.
References render.Map.layers, and render.Map.overlays.
Referenced by render.Map.DeleteOverlay().
def render.Map.DeleteOverlay | ( | self, | |
overlay | |||
) |
Delete overlay.
overlay | overlay layer |
Definition at line 1250 of file render.py.
References render.Map.DeleteLayer().
def render.Map.GetCurrentRegion | ( | self | ) |
Get current display region settings.
Definition at line 685 of file render.py.
References render.Map.region.
def render.Map.GetLayerIndex | ( | self, | |
layer, | |||
overlay = False |
|||
) |
Get index of layer in layer list.
layer | layer instace in layer tree |
overlay | use list of overlays instead |
Definition at line 1140 of file render.py.
References render.Map.AddOverlay(), render.Map.layers, and mapwindow.GLWindow.overlay.
def render.Map.GetListOfLayers | ( | self, | |
l_type = None , |
|||
l_mapset = None , |
|||
l_name = None , |
|||
l_active = None , |
|||
l_hidden = None |
|||
) |
Returns list of layers of selected properties or list of all layers.
l_type | layer type, e.g. raster/vector/wms/overlay (value or tuple of values) |
l_mapset | all layers from given mapset (only for maplayers) |
l_name | all layers with given name |
l_active | only layers with 'active' attribute set to True or False |
l_hidden | only layers with 'hidden' attribute set to True or False |
Definition at line 763 of file render.py.
References render.Map.layers, render.Map.overlays, and dialogs.type.
Referenced by render.Map.SetRegion().
def render.Map.GetOverlay | ( | self, | |
id, | |||
list = False |
|||
) |
Return overlay(s) with 'id'.
id | overlay id |
list | return list of overlays of True otherwise suppose 'id' to be unique |
Definition at line 1226 of file render.py.
References render.Map.overlays.
Referenced by render.Map.ChangeOverlay(), mapwindow.BufferedWindow.SaveToFile(), and mapwindow.BufferedWindow.UpdateMap().
def render.Map.GetProjInfo | ( | self | ) |
Get projection info.
Definition at line 431 of file render.py.
References render.Map._runCommand(), and render.Map.projinfo.
def render.Map.GetRegion | ( | self, | |
rast = [] , |
|||
zoom = False , |
|||
vect = [] , |
|||
regionName = None , |
|||
n = None , |
|||
s = None , |
|||
e = None , |
|||
w = None , |
|||
default = False , |
|||
update = False |
|||
) |
Get region settings (g.region -upgc)
Optionally extent, raster or vector map layer can be given.
rast | list of raster maps |
zoom | zoom to raster map (ignore NULLs) |
vect | list of vector maps |
regionName | named region or None |
n,s,e,w | force extent |
default | force default region settings |
update | if True update current display region settings |
Definition at line 587 of file render.py.
References render.Map.gisrc, render.Map.region, and gcmd.RunCommand().
Referenced by render.Map.AlignResolution(), render.Map.ChangeMapSize(), and render.Map.SetRegion().
def render.Map.GetWindow | ( | self | ) |
Read WIND file and set up self.wind dictionary.
Definition at line 462 of file render.py.
References render.Map.env, gcmd.CommandThread.env, and render.Map.wind.
Referenced by mapdisp.MapFrameBase.OnPan(), mapdisp.MapFrameBase.OnZoomIn(), mapdisp.MapFrameBase.OnZoomOut(), mapdisp.MapFrameBase.SetMapScale(), dialogs.TCValidator.Validate(), widgets.BaseValidator.Validate(), and widgets.GenericValidator.Validate().
def render.Map.RemoveLayer | ( | self, | |
name = None , |
|||
id = None |
|||
) |
Removes layer from layer list.
Layer is defined by name or id.
name | layer name (must be unique) |
id | layer index in layer list |
Definition at line 1113 of file render.py.
References render.Map.layers.
def render.Map.Render | ( | self, | |
force = False , |
|||
mapWindow = None , |
|||
windres = False |
|||
) |
Creates final image composite.
This function can conditionaly use high-level tools, which should be avaliable in wxPython library
force | force rendering |
reference | for MapFrame instance (for progress bar) |
windres | use region resolution (True) otherwise display resolution |
Definition at line 861 of file render.py.
References render.Map._renderLayers(), render.Map.AddLayer(), render.Map.gisrc, render.Map.height, render.Layer.mapfile, render.Map.mapfile, gcmd.RunCommand(), render.Map.SetRegion(), and render.Map.width.
def render.Map.RenderOverlays | ( | self, | |
force | |||
) |
Render overlays only (for nviz)
Definition at line 1300 of file render.py.
References render.Map.overlays.
def render.Map.ReorderLayers | ( | self, | |
layerList | |||
) |
Reorder list to match layer tree.
layerList | list of layers |
Definition at line 1026 of file render.py.
References render.Map.layers.
def render.Map.ReverseListOfLayers | ( | self | ) |
def render.Map.SetRegion | ( | self, | |
windres = False |
|||
) |
Render string for GRASS_REGION env.
variable, so that the images will be rendered from desired zoom level.
windres | uses resolution from WIND file rather than display (for modules that require set resolution like d.rast.num) |
Definition at line 692 of file render.py.
References render.Map.AdjustRegion(), render.Map.GetListOfLayers(), render.Map.GetRegion(), render.Map.region, and render.Map.wind.
Referenced by render.Map.Render().
render.Map.env |
Definition at line 387 of file render.py.
Referenced by render.Map.GetWindow().
render.Map.gisrc |
Definition at line 389 of file render.py.
Referenced by render.Map.GetRegion(), and render.Map.Render().
render.Map.height |
Definition at line 377 of file render.py.
Referenced by render.Map.AdjustRegion(), render.Map.AlignExtentFromDisplay(), render.Map.ChangeMapSize(), wxnviz.Texture.Draw(), utils.Rect2D.GetHeight(), model.ModelCondition.GetHeight(), wxnviz.Texture.Load(), render.Map.Render(), wxnviz.Texture.Resize(), wxnviz.Nviz.ResizeWindow(), wxnviz.Nviz.SaveToFile(), and wxnviz.Nviz.Start2D().
render.Map.layers |
Definition at line 380 of file render.py.
Referenced by render.Map.Clean(), render.Map.DeleteLayer(), gselect.VectorDBInfo.GetDbSettings(), gselect.VectorDBInfo.GetKeyColumn(), mapwindow.GLWindow.GetLayerId(), render.Map.GetLayerIndex(), mapwindow.GLWindow.GetLayerNames(), render.Map.GetListOfLayers(), gselect.VectorDBInfo.GetTable(), mapwindow.GLWindow.HorizontalPanning(), mapwindow.GLWindow.LoadDataLayers(), mapwindow.GLWindow.NvizCmdCommand(), toolbars.VDigitToolbar.OnSelectMap(), manager.LayerListCtrl.Populate(), mapwindow.GLWindow.QuerySurface(), workspace.ProcessGrcFile.read(), mapwindow.GLWindow.ReloadLayersData(), render.Map.RemoveLayer(), render.Map.ReorderLayers(), gselect.VectorDBInfo.Reset(), vinfo.VectorDBInfo.SelectFromTable(), mapwindow.GLWindow.UnloadDataLayers(), mapwindow.GLWindow.UnloadVector(), manager.LayerListCtrl.Update(), and toolbars.VDigitToolbar.UpdateListOfLayers().
render.Map.mapfile |
Definition at line 394 of file render.py.
Referenced by render.Map.Clean(), mapwindow.BufferedWindow.GetImage(), render.Map.Render(), histogram.BufferedWindow.UpdateHist(), mapwindow.BufferedWindow.UpdateMap(), and colorrules.BufferedWindow.UpdatePreview().
render.Map.overlays |
Definition at line 382 of file render.py.
Referenced by render.Map.AddOverlay(), render.Map.Clean(), mapwindow.GLWindow.CreateTexture(), render.Map.DeleteLayer(), mapwindow.GLWindow.GetLegendRect(), render.Map.GetListOfLayers(), render.Map.GetOverlay(), mapwindow.GLWindow.OnLeftUp(), mapwindow.BufferedWindow.OnLeftUp(), render.Map.RenderOverlays(), mapwindow.BufferedWindow.ResizeLegend(), mapwindow.BufferedWindow.SaveToFile(), mapwindow.BufferedWindow.UpdateMap(), and mapwindow.GLWindow.UpdateOverlays().
render.Map.projinfo |
Definition at line 405 of file render.py.
Referenced by render.Map.AlignExtentFromDisplay(), and render.Map.GetProjInfo().
render.Map.region |
Definition at line 375 of file render.py.
Referenced by render.Map.AdjustRegion(), render.Map.AlignExtentFromDisplay(), render.Map.AlignResolution(), wxdisplay.DisplayDriver.DrawMap(), render.Map.GetCurrentRegion(), render.Map.GetRegion(), wxdisplay.DisplayDriver.GetThreshold(), render.Map.SetRegion(), and wxdisplay.DisplayDriver.UpdateRegion().
render.Map.width |
Definition at line 376 of file render.py.
Referenced by render.Map.AdjustRegion(), render.Map.AlignExtentFromDisplay(), render.Map.ChangeMapSize(), wxnviz.Texture.Draw(), wxnviz.Nviz.GetRotationParameters(), utils.Rect2D.GetWidth(), model.ModelCondition.GetWidth(), wxnviz.Texture.Load(), render.Map.Render(), wxnviz.Texture.Resize(), wxnviz.Nviz.ResizeWindow(), wxnviz.Nviz.SaveToFile(), and wxnviz.Nviz.Start2D().
render.Map.wind |
Definition at line 374 of file render.py.
Referenced by dialogs.SavedRegion.GetName(), render.Map.GetWindow(), dialogs.SavedRegion.OnRegion(), and render.Map.SetRegion().