Ejemplo n.º 1
0
def make_banner(options):
    leonardo_url = options.url + '/modules.php?name=leonardo'
    icon_url = options.url + options.icon
    icon = kml.Icon(href=icon_url)
    overlay_xy = kml.overlayXY(x=0.5,
                               y=1,
                               xunits='fraction',
                               yunits='fraction')
    screen_xy = kml.screenXY(x=0.5, y=1, xunits='fraction', yunits='fraction')
    size = kml.size(x=0, y=0, xunits='fraction', yunits='fraction')
    d = {'name': options.name, 'icon': icon_url, 'url': leonardo_url}
    ps = []
    ps.append('<a href="%(url)s"><img alt="%(name)s" src="%(icon)s" /></a>' %
              d)
    ps.append('<a href="%(url)s">%(name)s</a>' % d)
    ps.append('Created by <a href="http://github.com/twpayne/igc2kmz">'
              'igc2kmz</a><br/>Copyright &copy; Tom Payne, 2008')
    html = '<center>%s</center>' % ''.join('<p>%s</p>' % p for p in ps)
    description = kml.CDATA(html)
    balloon_style = kml.BalloonStyle(text=kml.CDATA('$[description]'))
    style = kml.Style(balloon_style)
    return kml.ScreenOverlay(icon,
                             overlay_xy,
                             screen_xy,
                             size,
                             style,
                             Snippet=None,
                             name=options.name,
                             description=description)
Ejemplo n.º 2
0
def main(argv):
    parser = optparse.OptionParser(usage='Usage; %prog [options]')
    parser.add_option('-o', '--output', metavar='FILENAME')
    parser.add_option('-n', '--name', metavar='STRING')
    parser.add_option('-i', '--icon', metavar='STRING')
    parser.add_option('-u', '--url', metavar='STRING')
    parser.set_defaults(name=DEFAULT_NAME)
    parser.set_defaults(icon=DEFAULT_ICON)
    parser.set_defaults(url=DEFAULT_URL)
    options, args = parser.parse_args(argv)
    icon = kml.Icon(href=options.icon)
    overlay_xy = kml.overlayXY(x=0.5, y=1, xunits='fraction', yunits='fraction')
    screen_xy = kml.screenXY(x=0.5, y=1, xunits='fraction', yunits='fraction')
    size = kml.size(x=0, y=0, xunits='fraction', yunits='fraction')
    d = {'name': options.name, 'icon': options.icon, 'url': options.url}
    ps = []
    ps.append('<a href="%(url)s"><img alt="%(name)s" src="%(icon)s" /></a>' % d)
    ps.append('<a href="%(url)s">%(name)s</a>' % d)
    ps.append('Created by <a href="http://github.com/twpayne/igc2kmz">'
              'igc2kmz</a><br/>Copyright &copy; Tom Payne, 2008')
    html = '<center>%s</center' % ''.join('<p>%s</p>' % p for p in ps)
    description = kml.CDATA(html)
    snippet = kml.Snippet()
    balloon_style = kml.BalloonStyle(text=kml.CDATA('$[description]'))
    style = kml.Style(balloon_style)
    screen_overlay = kml.ScreenOverlay(icon, overlay_xy, screen_xy, size,
            snippet, style, name=options.name, description=description)
    output = open(options.output, 'w') if options.output else sys.stdout
    screen_overlay.pretty_write(output)
Ejemplo n.º 3
0
def make_banner(options):
    leonardo_url = options.url + '/modules.php?name=leonardo'
    icon_url = options.url + options.icon
    icon = kml.Icon(href=icon_url)
    overlay_xy = kml.overlayXY(x=0.5, y=1, xunits='fraction', yunits='fraction')
    screen_xy = kml.screenXY(x=0.5, y=1, xunits='fraction', yunits='fraction')
    size = kml.size(x=0, y=0, xunits='fraction', yunits='fraction')
    d = {'name': options.name, 'icon': icon_url, 'url': leonardo_url}
    ps = []
    ps.append('<a href="%(url)s"><img alt="%(name)s" src="%(icon)s" /></a>' % d)
    ps.append('<a href="%(url)s">%(name)s</a>' % d)
    ps.append('Created by <a href="http://github.com/twpayne/igc2kmz">'
              'igc2kmz</a><br/>Copyright &copy; Tom Payne, 2008')
    html = '<center>%s</center>' % ''.join('<p>%s</p>' % p for p in ps)
    description = kml.CDATA(html)
    balloon_style = kml.BalloonStyle(text=kml.CDATA('$[description]'))
    style = kml.Style(balloon_style)
    return kml.ScreenOverlay(icon, overlay_xy, screen_xy, size, style,
                             Snippet=None, name=options.name,
                             description=description)
Ejemplo n.º 4
0
def main(argv):
    parser = optparse.OptionParser(usage='Usage; %prog [options]')
    parser.add_option('-o', '--output', metavar='FILENAME')
    parser.add_option('-n', '--name', metavar='STRING')
    parser.add_option('-i', '--icon', metavar='STRING')
    parser.add_option('-u', '--url', metavar='STRING')
    parser.set_defaults(name=DEFAULT_NAME)
    parser.set_defaults(icon=DEFAULT_ICON)
    parser.set_defaults(url=DEFAULT_URL)
    options, args = parser.parse_args(argv)
    icon = kml.Icon(href=options.icon)
    overlay_xy = kml.overlayXY(x=0.5,
                               y=1,
                               xunits='fraction',
                               yunits='fraction')
    screen_xy = kml.screenXY(x=0.5, y=1, xunits='fraction', yunits='fraction')
    size = kml.size(x=0, y=0, xunits='fraction', yunits='fraction')
    d = {'name': options.name, 'icon': options.icon, 'url': options.url}
    ps = []
    ps.append('<a href="%(url)s"><img alt="%(name)s" src="%(icon)s" /></a>' %
              d)
    ps.append('<a href="%(url)s">%(name)s</a>' % d)
    ps.append('Created by <a href="http://github.com/twpayne/igc2kmz">'
              'igc2kmz</a><br/>Copyright &copy; Tom Payne, 2008')
    html = '<center>%s</center' % ''.join('<p>%s</p>' % p for p in ps)
    description = kml.CDATA(html)
    snippet = kml.Snippet()
    balloon_style = kml.BalloonStyle(text=kml.CDATA('$[description]'))
    style = kml.Style(balloon_style)
    screen_overlay = kml.ScreenOverlay(icon,
                                       overlay_xy,
                                       screen_xy,
                                       size,
                                       snippet,
                                       style,
                                       name=options.name,
                                       description=description)
    output = open(options.output, 'w') if options.output else sys.stdout
    screen_overlay.pretty_write(output)