示例#1
0
def TrackStyle(Ddeploy):
    # create the style for the drifter's trackline.
    # using ElementMaker because pykml doesn't seem to do attributes
    # make the style - no balloon, white line, no labels
    style = E.Style(
        E.LabelStyle(E.scale('0.0')),
        E.LineStyle(E.color(Ddeploy['color']), E.colorMode('normal'),
                    E.width('2.0')), E.BalloonStyle(E.displaymode('hide')),
        {"id": "trackline"})
    return style
示例#2
0
def SurfaceStyle():
    # create the style for placemarks marking drifter surfacing events.
    # using ElementMaker because pykml doesn't seem to do attributes, or CDATA

    # prep the balloon contents
    balloon = etree.Element('text')
    balloon.text = etree.CDATA('\n\
                    <table width="300"><tr><td>\n\
                    <h2>$[name]</h2>\n\
                    <p>\n\
                    $[description]\n\
                    </td></tr></table>\n\t\t')

    # make the style.  Note use double quotes in attribute definition (id) or hash will disappear
    style = E.Style(
        E.IconStyle(
            E.Icon(
                E.href(
                    'http://maps.google.com/mapfiles/kml/pal4/icon25.png'))),
        E.BalloonStyle(balloon), {"id": "drifter_info"})
    return style