Public Member Functions | |
| def | __init__ |
| def | createMap |
| Creates a new map object. | |
| def | clearAllMapElements |
| Clear all Endpoints from the map. | |
| def | draw |
| Map Draw Cycles. | |
Public Attributes | |
| fig_axes | |
| main_map | |
Contains all relevant code needed to create and draw the actual map
Definition at line 30 of file mainFrameMap.py.
| def objects.gui.mainFrameMap.mainFrameMap.__init__ | ( | self, | ||
| figAxesWrapper | ||||
| ) |
| def objects.gui.mainFrameMap.mainFrameMap.clearAllMapElements | ( | self | ) |
Clear all Endpoints from the map.
Essentially clears all circles and lines.
Definition at line 72 of file mainFrameMap.py.
00072 : 00073 # erase map points 00074 self.fig_axes.axes.lines = [] 00075 # erase text 00076 self.fig_axes.axes.texts = [] 00077 00078 ## Map Draw Cycles. Essentially updates all the graphical Endpoints onto the map.
| def objects.gui.mainFrameMap.mainFrameMap.createMap | ( | self, | ||
| mapDetail, | ||||
| drawCSBorders, | ||||
| drawRivers | ||||
| ) |
Creates a new map object.
| mapDetail | Map Detail Level | |
| drawCSBorders | True if the map should display country and state borders | |
| drawRivers | True if the map should display rivers |
Definition at line 39 of file mainFrameMap.py.
00039 : 00040 00041 if mapDetail == True: 00042 res = 'l' 00043 else: 00044 res = 'c' 00045 00046 try: 00047 self.main_map = Basemap(-180.,-80.,180.,80.,\ 00048 resolution=res,area_thresh=10000.,projection='merc',\ 00049 lon_0=0.,lat_ts=20.,\ 00050 ax=self.fig_axes.axes) 00051 00052 00053 00054 except IOError, mapCreationError: 00055 e = exception(str(mapCreationError ), True) 00056 raise e 00057 00058 # draw coastlines, country boundaries, fill continents. 00059 self.main_map.drawcoastlines(linewidth=0.5) 00060 if drawCSBorders == True: 00061 self.main_map.drawcountries() 00062 self.main_map.drawstates(linewidth=0.1) 00063 00064 if drawRivers == True: 00065 self.main_map.drawrivers(color='b',linewidth=0.05) 00066 00067 self.main_map.fillcontinents(color='beige') 00068 self.main_map.drawmapboundary() 00069 00070 ## Clear all Endpoints from the map. Essentially clears all circles and lines.
| def objects.gui.mainFrameMap.mainFrameMap.draw | ( | self, | ||
| entityDict, | ||||
| displayer, | ||||
| showLines, | ||||
| showLabels, | ||||
| homeLon, | ||||
| homeLat | ||||
| ) |
Map Draw Cycles.
Essentially updates all the graphical Endpoints onto the map.
| entityDict | Dictionary of Endpoints to be displayed onto the Map | |
| displayer | entityDisplayer derived object which knows how to draw the Endpoints onto the screen | |
| showLines | True if this redraw cycle should include lines | |
| showLabels | True if this redraw cycle should include labels | |
| homeLon | Longitude of the home location marker | |
| homeLat | Latitude of the home location marker |
Definition at line 86 of file mainFrameMap.py.
00088 : 00089 00090 lonList = list() 00091 latList = list() 00092 00093 markerList = list() 00094 lineList = list() 00095 00096 self.clearAllMapElements() 00097 00098 # this is a little hoakey... but it works. 00099 textYOffsetMagicNum = int(self.fig_axes.getZoomFactor() / 100) 00100 00101 displayedItems = 0 00102 00103 for key, entList in entityDict.iteritems(): 00104 00105 # markers 00106 if len(entList) > 1: 00107 displayedItems += len(entList) 00108 displayAttributes = displayer.getAttrFromList(entList) 00109 else: 00110 displayedItems += 1 00111 displayAttributes = displayer.getAttrFromEntity(entList[0]) 00112 00113 longitude = key[0] 00114 latitude = key[1] 00115 00116 lonList.append(longitude) 00117 latList.append(latitude) 00118 00119 xMap,yMap = self.main_map((lonList), (latList)) 00120 x,y = self.main_map((longitude), (latitude)) 00121 00122 markerList.append(xMap) 00123 markerList.append(yMap) 00124 00125 markerList.append(displayAttributes["marker"]) 00126 00127 lonList = list() 00128 latList = list() 00129 00130 if showLines == True: 00131 #draw lines 00132 line_x,line_y = self.main_map.gcpoints(homeLon, homeLat,longitude,latitude,2) 00133 00134 self.main_map.plot(line_x,line_y, "k" + displayAttributes["lineStyle"], linewidth=displayAttributes["lineWidth"],antialiased=True, alpha=displayAttributes["lineAlpha"]) 00135 00136 #draw text 00137 if showLabels == True: 00138 self.fig_axes.axes.text(x, y + textYOffsetMagicNum, displayAttributes["label"], fontsize=10, 00139 horizontalalignment='center') 00140 00141 self.main_map.plot(xMap, yMap, displayAttributes["marker"], markersize=displayAttributes["markerSize"], color=displayAttributes["markerColor"] ) 00142 00143 #draw markers 00144 #self.main_map.plot(*markerList) 00145 00146 # draw self -- surely this can be done better 00147 selfX, selfY = self.main_map(homeLon, homeLat) 00148 00149 selfXLst= [] 00150 selfYLst = [] 00151 selfXLst.append(selfX) 00152 selfYLst.append(selfY) 00153 self.main_map.plot(selfXLst,selfYLst,'b^',label='', markersize=8) 00154 00155 00156 self.fig_axes.resetCurrentZoom() 00157 00158 return displayedItems 00159 00160 00161 00162
Definition at line 32 of file mainFrameMap.py.
Definition at line 47 of file mainFrameMap.py.
1.5.8