def makeStyles(self): waypointStyle = KmlUtil.makeStyle( "station", "http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png", 0.85) directionStyle = KmlUtil.makeStyle( "heading", iconUrl= "http://earth.google.com/images/kml-icons/track-directional/track-0.png" ) segmentStyle = KmlUtil.makeStyle("segment", lineWidth=2) return waypointStyle + directionStyle + segmentStyle
def transformStation(self, station, tsequence, context): lon, lat = station.geometry['coordinates'] name = station.name if not name: # use the number from the id sindex = station.id.find('STN') if sindex >=0: name = station.id[sindex+3:] else: name = station.id name = "__" + name directionStyle = None styleUrl = 'station' result = "" try: if station.isDirectional: if station.headingDegrees: headingDegrees = float(station.headingDegrees) styleUrl = 'heading' directionStyle = KmlUtil.makeStyle(iconHeading=headingDegrees) except AttributeError: pass result = result + (''' <Placemark> <name>%s</name> <styleUrl>%s</styleUrl>''' % (escape(name), styleUrl)) if directionStyle: result = result + directionStyle result = result + (''' <Point> <coordinates>%(lon)s,%(lat)s</coordinates> </Point> </Placemark>''' % {'lon': lon, 'lat': lat}) return result
def makeStyles(request, mapLayer): style = KmlUtil.makeStyle("xgds", iconUrl=request.build_absolute_uri(static('xgds_map_server/icons/point.png')), iconScale=0.5, lineColor='FFFF0000', lineWidth=4, polyColor='44FF0000') return style
def createBoundaryStyle(feature): if feature.style: style = feature.style[1:] else: style = "0000ff" color = getKmlColor(style, "ff") styleName = "boundary" + style style = KmlUtil.makeStyle(styleName, lineWidth=3, lineColor=color) return style
def createToleranceStyle(feature): if feature.style: style = feature.style[1:] else: style = "0000ff" color = getKmlColor(style, "80") styleName = "tolerance" + style style = KmlUtil.makeStyle(styleName, lineWidth=3, lineColor=color) return style
def makeStyles(self): if self.request: placemark_url = self.getFullUrl( 'xgds_planner2/images/placemark_circle.png') placemark_directional_url = self.getFullUrl( 'xgds_planner2/images/placemark_directional.png') waypointStyle = KmlUtil.makeStyle("station", placemark_url, 0.85) directionStyle = KmlUtil.makeStyle( "heading", iconUrl=placemark_directional_url) else: waypointStyle = KmlUtil.makeStyle( "station", "https://maps.google.com/mapfiles/kml/shapes/placemark_circle.png", 0.85) directionStyle = KmlUtil.makeStyle( "heading", iconUrl= "https://earth.google.com/images/kml-icons/track-directional/track-0.png" ) segmentStyle = KmlUtil.makeStyle("segment", lineWidth=2) return waypointStyle + directionStyle + segmentStyle
def makeStyles(self): waypointStyle = KmlUtil.makeStyle( "station", "http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png", 0.85) directionStyle = KmlUtil.makeStyle( "heading", iconUrl= "http://earth.google.com/images/kml-icons/track-directional/track-0.png" ) segmentStyle = KmlUtil.makeStyle("segment", lineWidth=3, lineColor="FF00FFFF") boundaryStyle = KmlUtil.makeStyle("boundary", lineWidth=3, lineColor="FF0099FF") toleranceStyle = KmlUtil.makeStyle( "tolerance", lineWidth=3, lineColor="FF00FFFF", ) return waypointStyle + directionStyle + segmentStyle + boundaryStyle + toleranceStyle
def createStyle(request, feature): if feature.style: style = feature.style[1:] else: style = "0000ff" styleName = style + feature.type color = getKmlColor(style, "ff") iconLink = "" if (feature.type == "Point"): if hasattr(feature, 'shape'): styleName = style + feature.type + "_" + feature.shape if (feature.shape == "Triangle"): iconLink = request.build_absolute_uri( static('rest/xgds_map_server/icons/triangle-point.png')) elif (feature.shape == "Square"): iconLink = request.build_absolute_uri( static('rest/xgds_map_server/icons/square-point.png')) elif (feature.shape == "Star"): iconLink = request.build_absolute_uri( static('rest/xgds_map_server/icons/star-point.png')) else: iconLink = request.build_absolute_uri( static('rest/xgds_map_server/icons/point.png')) else: iconLink = request.build_absolute_uri( static('rest/xgds_map_server/icons/point.png')) elif (feature.type == "Station"): request.build_absolute_uri( static('rest/xgds_map_server/icons/placemark_circle.png')) else: iconLink = request.build_absolute_uri( static('rest/xgds_map_server/icons/point.png')) style = KmlUtil.makeStyle(styleName, iconUrl=iconLink, iconColor=color, iconScale=0.5, lineColor=color, lineWidth=4, polyColor=color, polyFill=0) return style
def makeStyles(self): waypointStyle = KmlUtil.makeStyle("station", "http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png", 0.85) directionStyle = KmlUtil.makeStyle("heading", iconUrl="http://earth.google.com/images/kml-icons/track-directional/track-0.png") segmentStyle = KmlUtil.makeStyle("segment", lineWidth=2) return waypointStyle + directionStyle + segmentStyle
def transformStation(self, station, tsequence, context): lon, lat = station.geometry['coordinates'] name = station.name if not name: # use the number from the id sindex = station.id.find('STN') if sindex >= 0: name = station.id[sindex + 3:] else: name = station.id name = "__" + name directionStyle = None styleUrl = 'station' result = "" try: if station.isDirectional: if station.headingDegrees: headingDegrees = float(station.headingDegrees) styleUrl = 'heading' directionStyle = KmlUtil.makeStyle( iconHeading=headingDegrees) except AttributeError: pass result = result + (''' <Placemark> <name>%s</name> <styleUrl>%s</styleUrl>''' % (escape(name), styleUrl)) if directionStyle: result = result + directionStyle result = result + (''' <Point> <coordinates>%(lon)s,%(lat)s</coordinates> </Point> </Placemark>''' % { 'lon': lon, 'lat': lat }) if station.boundary: boundaryCircle = polycircles.Polycircle(latitude=lat, longitude=lon, radius=station.boundary, number_of_vertices=36) result += ''' <Placemark> <name>%(name)s</name> <styleUrl>#boundary</styleUrl> <MultiGeometry> <LineString> <tessellate>1</tessellate> <coordinates> ''' % { 'name': escape(name) + ' boundary' } for coord in boundaryCircle.vertices: result = result + str(coord[1]) + ',' + str(coord[0]) + '\n' result = result + str(boundaryCircle.vertices[0][1]) + ',' + str( boundaryCircle.vertices[0][0]) + '\n' result = result + ''' </coordinates> </LineString> </MultiGeometry> </Placemark> ''' if station.tolerance: toleranceCircle = polycircles.Polycircle(latitude=lat, longitude=lon, radius=station.tolerance, number_of_vertices=36) result += ''' <Placemark> <name>%(name)s</name> <styleUrl>#tolerance</styleUrl> <LineString> <tessellate>1</tessellate> <coordinates> ''' % { 'name': escape(name) + ' tolerance' } for coord in toleranceCircle.vertices: result = result + str(coord[1]) + ',' + str(coord[0]) + '\n' result = result + str(toleranceCircle.vertices[0][1]) + ',' + str( toleranceCircle.vertices[0][0]) + '\n' result = result + ''' </coordinates> </LineString> </Placemark> ''' return result