|
GRASS Programmer's Manual
6.5.svn(2012)-r51648
|
Data Structures | |
| class | Rect2D |
| Class representing rectangle with floating point values. More... | |
| class | Rect2DPP |
| Rectangle specified by 2 points (with floating point values). More... | |
| class | Rect2DPS |
| Rectangle specified by point and size (with floating point values). More... | |
| class | UnitConversion |
| Class for converting units. More... | |
Functions | |
| def | normalize_whitespace |
| Remove redundant whitespace from a string. | |
| def | split |
| Platform spefic shlex.split. | |
| def | GetTempfile |
| Creates GRASS temporary file using defined prefix. | |
| def | GetLayerNameFromCmd |
| Get map name from GRASS command. | |
| def | GetValidLayerName |
| Make layer name SQL compliant, based on G_str_to_sql() | |
| def | ListOfCatsToRange |
| Convert list of category number to range(s) | |
| def | ListOfMapsets |
| Get list of available/accessible mapsets. | |
| def | ListSortLower |
| Sort list items (not case-sensitive) | |
| def | GetVectorNumberOfLayers |
| Get list of vector layers. | |
| def | Deg2DMS |
| Convert deg value to dms string. | |
| def | DMS2Deg |
| Convert dms value to deg. | |
| def | GetCmdString |
| def | CmdToTuple |
| Convert command list to tuple for gcmd.RunCommand() | |
| def | PathJoin |
| Check path created by os.path.join. | |
| def | ReadEpsgCodes |
| Read EPSG code from the file. | |
| def | ReprojectCoordinates |
| Reproject coordinates. | |
| def | GetListOfLocations |
| Get list of GRASS locations in given dbase. | |
| def | GetListOfMapsets |
| Get list of mapsets in given GRASS location. | |
| def | GetColorTables |
| Get list of color tables. | |
| def | DecodeString |
| Decode string using system encoding. | |
| def | EncodeString |
| Return encoded string using system locales. | |
| def | GetFormats |
| Get GDAL/OGR formats. | |
| def | GetSettingsPath |
| Get full path to the settings directory. | |
| def | convertRGB |
| Converts wx.Colour(r,g,b,a) to string 'r:g:b' or named color, or named color/r:g:b string to wx.Colour, depending on input. | |
| def | PaperMapCoordinates |
| Converts paper (inch) coordinates <-> map coordinates. | |
| def | AutoAdjust |
| Computes map scale, center and map frame rectangle to fit region (scale is not fixed) | |
| def | SetResolution |
| If resolution is too high, lower it. | |
| def | ComputeSetRegion |
| Computes and sets region from current scale, map center coordinates and map rectangle. | |
| def | projInfo |
| Return region projection and map units information, taken from render.py. | |
| def | GetMapBounds |
| Run ps.map -b to get information about map bounding box. | |
| def | getRasterType |
| Returns type of raster map (CELL, FCELL, DCELL) | |
| def | PilImageToWxImage |
| Convert PIL image to wx.Image. | |
| def | BBoxAfterRotation |
| Compute bounding box or rotated rectangle. | |
Variables | |
| formats = None | |
| havePILImage = True | |
| unitConv | |
| def utils.AutoAdjust | ( | self, | |
| scaleType, | |||
| rect, | |||
map = None, |
|||
mapType = None, |
|||
region = None |
|||
| ) |
Computes map scale, center and map frame rectangle to fit region (scale is not fixed)
Definition at line 195 of file psmap/utils.py.
Referenced by frame.PsMapBufferedWindow.OnLeftUp().
| def utils.BBoxAfterRotation | ( | w, | |
| h, | |||
| angle | |||
| ) |
Compute bounding box or rotated rectangle.
| w | rectangle width |
| h | rectangle height |
| angle | angle (0, 360) in degrees |
Definition at line 382 of file psmap/utils.py.
Referenced by instructions.Image.Read(), and dialogs.ImageDialog.update().
| def utils.CmdToTuple | ( | cmd | ) |
Convert command list to tuple for gcmd.RunCommand()
Definition at line 481 of file core/utils.py.
Referenced by colorrules.VectorColorTable.CreateAttrTable(), colorrules.ColorTable.CreateColorTable(), colorrules.ColorTable.LoadTable(), model.Model.Run(), render.Layer.SetCmd(), and instructions.Instruction.SetRegion().
| def utils.ComputeSetRegion | ( | self, | |
| mapDict | |||
| ) |
Computes and sets region from current scale, map center coordinates and map rectangle.
Definition at line 271 of file psmap/utils.py.
References projInfo(), and gcmd.RunCommand().
Referenced by frame.PsMapBufferedWindow.OnLeftUp().
| def utils.convertRGB | ( | rgb | ) |
Converts wx.Colour(r,g,b,a) to string 'r:g:b' or named color, or named color/r:g:b string to wx.Colour, depending on input.
Definition at line 135 of file psmap/utils.py.
References dialogs.type.
Referenced by frame.PsMapBufferedWindow.DrawGraphics(), frame.PsMapBufferedWindow.DrawRotText(), dialogs.update(), dialogs.MapinfoDialog.update(), dialogs.TextDialog.update(), dialogs.PointDialog.update(), and dialogs.updateRasterLegend().
| def utils.DecodeString | ( | string | ) |
Decode string using system encoding.
| string | string to be decoded |
Definition at line 656 of file core/utils.py.
| def utils.Deg2DMS | ( | lon, | |
| lat, | |||
string = True, |
|||
hemisphere = True, |
|||
precision = 3 |
|||
| ) |
Convert deg value to dms string.
| lon | longitude (x) |
| lat | latitude (y) |
| string | True to return string otherwise tuple |
| hemisphere | print hemisphere |
| precision | seconds precision |
Definition at line 321 of file core/utils.py.
Referenced by statusbar.SbGoTo.GetCenterString(), statusbar.SbGoTo.OnGoTo(), statusbar.SbCoordinates.ReprojectENFromMap(), and statusbar.SbRegionExtent.ReprojectRegionFromMap().
| def utils.DMS2Deg | ( | lon, | |
| lat | |||
| ) |
Convert dms value to deg.
| lon | longitude (x) |
| lat | latitude (y) |
Definition at line 375 of file core/utils.py.
Referenced by statusbar.SbGoTo.ReprojectENToMap().
| def utils.EncodeString | ( | string | ) |
Return encoded string using system locales.
| string | string to be encoded |
Definition at line 673 of file core/utils.py.
Referenced by dialogs.ModelSearchDialog.GetCmd().
| def utils.GetCmdString | ( | cmd | ) |
Get GRASS command as string. @param cmd GRASS command given as dictionary @return command string
Definition at line 453 of file core/utils.py.
Referenced by render.Layer.GetCmd(), and instructions.Instruction.SetRegion().
| def utils.GetColorTables | ( | ) |
Get list of color tables.
Definition at line 646 of file core/utils.py.
References gcmd.RunCommand().
Referenced by preferences.PreferencesDialog.__init__().
| def utils.GetFormats | ( | ) |
Get GDAL/OGR formats.
Definition at line 739 of file core/utils.py.
Referenced by gselect.FormatSelect.__init__().
| def utils.GetLayerNameFromCmd | ( | dcmd, | |
fullyQualified = False, |
|||
param = None, |
|||
layerType = None |
|||
| ) |
Get map name from GRASS command.
Parameter dcmd can be modified when first parameter is not defined.
| dcmd | GRASS command (given as list) |
| fullyQualified | change map name to be fully qualified |
| param | params directory |
| layerType | check also layer type ('raster', 'vector', '3d-raster', ...) |
Definition at line 75 of file core/utils.py.
References tools.range, and split().
Referenced by layertree.LayerTree.AddLayer(), layertree.LayerTree.ChangeLayer(), histogram.HistogramFrame.GetOptData(), layertree.LayerTree.GetOptData(), GetTempfile(), goutput.GMConsole.OnCmdDone(), frame.MapFrame.QueryMap(), layertree.LayerTree.RecreateItem(), goutput.GMConsole.RunCmd(), and manager.GrSettingsDialog.UpdateSettings().
| def utils.GetListOfLocations | ( | dbase | ) |
Get list of GRASS locations in given dbase.
| dbase | GRASS database path |
Definition at line 591 of file core/utils.py.
References ListSortLower().
Referenced by gselect.LocationSelect.UpdateItems(), and gis_set.GRASSStartup.UpdateLocations().
| def utils.GetListOfMapsets | ( | dbase, | |
| location, | |||
selectable = False |
|||
| ) |
Get list of mapsets in given GRASS location.
| dbase | GRASS database path |
| location | GRASS location |
| selectable | True to get list of selectable mapsets, otherwise all |
Definition at line 614 of file core/utils.py.
References ListSortLower(), and gcmd.RunCommand().
Referenced by gselect.MapsetSelect.UpdateItems().
| def utils.GetMapBounds | ( | filename, | |
portrait = True |
|||
| ) |
Run ps.map -b to get information about map bounding box.
| filename | psmap input file |
| portrait | page orientation |
Definition at line 330 of file psmap/utils.py.
References split().
Referenced by frame.getInitMap().
| def utils.getRasterType | ( | map | ) |
Returns type of raster map (CELL, FCELL, DCELL)
Definition at line 348 of file psmap/utils.py.
Referenced by dialogs.OnRaster(), instructions.RasterLegend.Read(), and dialogs.updateRasterLegend().
| def utils.GetSettingsPath | ( | ) |
Get full path to the settings directory.
Definition at line 750 of file core/utils.py.
References split().
Referenced by settings.Settings.SaveToFile().
| def utils.GetTempfile | ( | pref = None | ) |
Creates GRASS temporary file using defined prefix.
| pref | prefer the given path |
Definition at line 46 of file core/utils.py.
References GetLayerNameFromCmd(), and gcmd.RunCommand().
Referenced by colorrules.ColorTable.CreateColorTable(), manager.GCP.GetNewExtent(), colorrules.RasterColorTable.OnPreview(), colorrules.VectorColorTable.OnTablePreview(), manager.GCPWizard.SetSrcEnv(), and colorrules.VectorColorTable.UpdateColorColumn().
| def utils.GetValidLayerName | ( | name | ) |
Make layer name SQL compliant, based on G_str_to_sql()
Definition at line 164 of file core/utils.py.
Referenced by gselect.GdalSelect.OnSetDsn(), and dialogs.DxfImportDialog.OnSetDsn().
| def utils.GetVectorNumberOfLayers | ( | vector, | |
parent = None |
|||
| ) |
Get list of vector layers.
| vector | name of vector map |
| parent | parent window (to show dialog) or None |
Definition at line 280 of file core/utils.py.
References gcmd.RunCommand().
Referenced by gselect.LayerSelect.InsertLayers().
| def utils.ListOfCatsToRange | ( | cats | ) |
Convert list of category number to range(s)
Used for example for d.vect cats=[range]
| cats | category list |
Definition at line 196 of file core/utils.py.
Referenced by frame.MapFrame.AddTmpVectorMapLayer(), manager.AttributeManager.OnDataItemDeleteAll(), manager.AttributeManager.OnDeleteSelected(), manager.AttributeManager.OnExtractSelected(), and mapwindow.VDigitWindow.OnLeftUpCopyLine().
| def utils.ListOfMapsets | ( | get = 'ordered' | ) |
Get list of available/accessible mapsets.
| get | method ('all', 'accessible', 'ordered') |
Definition at line 234 of file core/utils.py.
References ListSortLower(), and gcmd.RunCommand().
| def utils.ListSortLower | ( | list | ) |
Sort list items (not case-sensitive)
Definition at line 276 of file core/utils.py.
Referenced by GetListOfLocations(), GetListOfMapsets(), ListOfMapsets(), manager.GroupPage.OnEnterPage(), prompt.TextCtrlAutoComplete.SetChoices(), and gselect.ProjSelect.UpdateItems().
| def utils.normalize_whitespace | ( | text | ) |
Remove redundant whitespace from a string.
Definition at line 33 of file core/utils.py.
Referenced by forms.text_beautify().
| def utils.PaperMapCoordinates | ( | mapInstr, | |
| x, | |||
| y, | |||
paperToMap = True |
|||
| ) |
Converts paper (inch) coordinates <-> map coordinates.
| mapInstr | map frame instruction |
| x,y | paper coords in inches or mapcoords in map units |
| paperToMap | specify conversion direction |
Definition at line 158 of file psmap/utils.py.
References projInfo().
Referenced by instructions.Image.ChangeRefPoint(), instructions.Text.Read(), instructions.Image.Read(), instructions.Point.Read(), instructions.Line.Read(), instructions.Rectangle.Read(), frame.PsMapBufferedWindow.RecalculateEN(), dialogs.TextDialog.update(), dialogs.ImageDialog.update(), and dialogs.PointDialog.update().
| def utils.PathJoin | ( | args | ) |
Check path created by os.path.join.
Definition at line 503 of file core/utils.py.
| def utils.PilImageToWxImage | ( | pilImage, | |
copyAlpha = True |
|||
| ) |
Convert PIL image to wx.Image.
Based on http://wiki.wxpython.org/WorkingWithImages
Definition at line 359 of file psmap/utils.py.
Referenced by frame.PsMapBufferedWindow.DrawBitmap().
| def utils.projInfo | ( | ) |
Return region projection and map units information, taken from render.py.
Definition at line 308 of file psmap/utils.py.
References gcmd.RunCommand().
Referenced by ComputeSetRegion(), instructions.Scalebar.EstimateSize(), frame.OnAddScalebar(), and PaperMapCoordinates().
| def utils.ReadEpsgCodes | ( | path | ) |
Read EPSG code from the file.
| path | full path to the file with EPSG codes |
Definition at line 512 of file core/utils.py.
Referenced by wizard.EPSGPage.OnBrowseCodes(), and preferences.PreferencesDialog.OnLoadEpsgCodes().
| def utils.ReprojectCoordinates | ( | coord, | |
| projOut, | |||
projIn = None, |
|||
flags = '' |
|||
| ) |
Reproject coordinates.
| coord | coordinates given as tuple |
| projOut | output projection |
| projIn | input projection (use location projection settings) |
Definition at line 554 of file core/utils.py.
References gcmd.RunCommand(), and split().
Referenced by statusbar.SbGoTo.GetCenterString(), statusbar.SbCoordinates.ReprojectENFromMap(), statusbar.SbGoTo.ReprojectENToMap(), and statusbar.SbRegionExtent.ReprojectRegionFromMap().
| def utils.SetResolution | ( | dpi, | |
| width, | |||
| height | |||
| ) |
If resolution is too high, lower it.
| dpi | max DPI |
| width | map frame width |
| height | map frame height |
Definition at line 258 of file psmap/utils.py.
References gcmd.RunCommand().
Referenced by frame.DialogDataChanged(), frame.PsMapBufferedWindow.OnLeftUp(), and frame.PsMapFrame.PSFile().
| def utils.split | ( | s | ) |
Platform spefic shlex.split.
Definition at line 37 of file core/utils.py.
Referenced by gcmd.GError.__init__(), ghelp.AboutWindow.__init__(), instructions.Text.__str__(), instructions.VProperties.__str__(), colorrules.VectorColorTable.AddTemporaryColumn(), layertree.LayerTree.ChangeLayer(), globalvar.CheckForWx(), globalvar.CheckWxVersion(), render.Map.Clean(), profile.ProfileFrame.CreateDatalist(), frame.DialogDataChanged(), prompt.GPromptSTC.EntityToComplete(), instructions.RasterLegend.EstimateHeight(), dialogs.ModelSearchDialog.GetCmd(), dialogs.PageSetupDialog.getCtrl(), frame.getFile(), globalvar.GetGRASSCommands(), GetLayerNameFromCmd(), mapwindow.GLWindow.GetLegendRect(), GetMapBounds(), manager.GCP.GetNewExtent(), dialogs.GroupDialog.GetSelectedGroup(), GetSettingsPath(), widgets.GetValue(), base.BasePlotFrame.InitRasterPairs(), colorrules.RulesPanel.LoadRules(), frame.makePSFont(), dialogs.NorthArrowDialog.OnConvergence(), manager.AttributeManager.OnDataItemDeleteAll(), prompt.TextCtrlAutoComplete.OnEnteredText(), statusbar.SbGoTo.OnGoTo(), prompt.GPromptSTC.OnItemSelected(), gselect.TreeCtrlComboPopup.OnKeyUp(), gselect.TreeCtrlComboPopup.OnLeftDown(), ghelp.MenuTreeWindow.OnRun(), prompt.GPrompt.OnRunCmd(), dialogs.ProfileRasterDialog.OnSelection(), ghelp.SearchModuleWindow.OnSelectModule(), gselect.GdalSelect.OnSetDsn(), dialogs.DxfImportDialog.OnSetDsn(), gselect.GdalSelect.OnSettingsDelete(), tools.OnSurfaceModeAll(), menudata.MenuData.PrintStrings(), instructions.MapFrame.Read(), instructions.Mapinfo.Read(), instructions.VProperties.Read(), frame.PsMapBufferedWindow.RecalculatePosition(), ReprojectCoordinates(), statusbar.SbGoTo.ReprojectENToMap(), manager.GCP.RMSError(), goutput.CmdThread.run(), model.Model.Run(), instructions.Instruction.SetRegion(), profile.ProfileFrame.SetupProfile(), dialogs.MapFramePanel.update(), frame.UpdateMapLabel(), tools.UpdateVectorPage(), python.vector.vector_db(), and python.vector.vector_db_select().
| utils.formats = None |
Definition at line 737 of file core/utils.py.
| utils.havePILImage = True |
Definition at line 24 of file psmap/utils.py.
Definition at line 233 of file psmap/utils.py.