def getKml(self, request=None): if self.longitude == None: return '' if self.yaw == None: headingStr = '' else: headingStr = '<heading>%s</heading>' % self.yaw relIconUrl = getIconUrl(self.icon + 'Point') iconUrl = request.build_absolute_uri(relIconUrl) return (""" <Placemark> <name>%(name)s</name> <description><![CDATA[%(balloonHtml)s]]></description> <Style> <IconStyle> <Icon> <href>%(iconUrl)s</href> </Icon> %(headingStr)s </IconStyle> </Style> <Point> <coordinates>%(lon)s,%(lat)s</coordinates> </Point> </Placemark> """ % dict(name=self.name, balloonHtml=self.getBalloonHtml(request), iconUrl=iconUrl, headingStr=headingStr, lon=self.longitude, lat=self.latitude))
def getRotatedIconDict(self): if self.yaw == None: rot = 0 else: rot = self.yaw rotRounded = 10 * int(0.1 * rot + 0.5) if rotRounded == 360: rotRounded = 0 name = self.icon rotName = '%s%03d' % (name, rotRounded) return dict(url=getIconUrl(rotName), size=getIconSize(rotName))
def getIconDict(self, kind=''): return dict(url=getIconUrl(self.icon + kind), size=getIconSize(self.icon + kind))