当前位置: 首页>>代码示例>>Python>>正文


Python KML_ElementMaker.roll方法代码示例

本文整理汇总了Python中pykml.factory.KML_ElementMaker.roll方法的典型用法代码示例。如果您正苦于以下问题:Python KML_ElementMaker.roll方法的具体用法?Python KML_ElementMaker.roll怎么用?Python KML_ElementMaker.roll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pykml.factory.KML_ElementMaker的用法示例。


在下文中一共展示了KML_ElementMaker.roll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_flyto_camera

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import roll [as 别名]
def create_flyto_camera(location):
    
    flyto = GX.FlyTo(
        GX.duration(0.5),
        GX.flyToMode('smooth'),
    )
    flyto.append(
        KML.Camera(
            KML.longitude(location['loc'].longitude),
            KML.latitude(location['loc'].latitude),
            KML.altitude(location['loc'].altitude),
            KML.heading(location['loc'].heading),
            KML.tilt(location['loc'].tilt),
            KML.roll(location['loc'].roll),
            KML.altitudeMode('relativeToGround'),
        )
    )
    return flyto
开发者ID:123abcde,项目名称:pykml,代码行数:20,代码来源:example_spline_camera.py

示例2: create_camera_model_placemark

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import roll [as 别名]
def create_camera_model_placemark(location):
    
    pm = KML.Placemark(
        KML.description(
            '<table border="1">'
            '<tr><th>latitude</th><td>{lat}</td>'
            '<tr><th>longitude</th><td>{lon}</td>'
            '<tr><th>altitude</th><td>{alt}</td>'
            '<tr><th>heading</th><td>{head}</td>'
            '<tr><th>tilt</th><td>{tilt}</td>'
            '<tr><th>roll</th><td>{roll}</td>'
            '</table>'.format(
                lat=location['loc'].latitude,
                lon=location['loc'].longitude,
                alt=location['loc'].altitude,
                head=location['loc'].heading,
                tilt=location['loc'].tilt,
                roll=location['loc'].roll,
            )
        ),
        KML.Model(
            KML.altitudeMode('relativeToGround'),
            KML.Location(
              KML.latitude(location['loc'].latitude),
              KML.longitude(location['loc'].longitude),
              KML.altitude(location['loc'].altitude),
            ),
            KML.Orientation(
              KML.heading(location['loc'].heading),
              KML.tilt(-location['loc'].tilt),
              KML.roll(location['loc'].roll),
            ),
            KML.Scale(
              KML.x(10),
              KML.y(10),
              KML.z(-10),
            ),
            KML.Link(
              KML.href('models/three_unit_lines.dae'),
            )
        )
    )
    return pm
开发者ID:123abcde,项目名称:pykml,代码行数:45,代码来源:example_spline_camera.py

示例3: point_placemark

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import roll [as 别名]
def point_placemark(origin, name, x, y):
    point = srr.util.local_to_global(origin, x, y)

    return KML.Placemark(
        KML.name(name),
        KML.LookAt(
            KML.longitude(point[0]),
            KML.latitude(point[1]),
            KML.altitude(0),
            KML.heading(origin[2]),
            KML.tilt(0),
            KML.roll(0),
            KML.altitudeMode("relativeToGround"),
            KML.range(DEFAULT_HEIGHT)
        ),
        KML.Point(
            KML.coordinates("{lon},{lat},{alt}".format(
                lon=point[0], lat=point[1], alt=0)),
            )
        )
开发者ID:cephalsystems,项目名称:srr,代码行数:22,代码来源:viewer.py

示例4: frame_placemark

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import roll [as 别名]
def frame_placemark(origin, name, x, y, theta=0.0,
                    marker='axes.png', scale=1.0, color='ffffffff'):
    frame = srr.util.local_to_global(origin, x, y, theta)

    return KML.Placemark(
        KML.name(name),
        KML.Point(
            KML.coordinates("{lon},{lat},{alt}".format(
                lon=frame[0], lat=frame[1], alt=0)),
            ),
        KML.LookAt(
            KML.longitude(frame[0]),
            KML.latitude(frame[1]),
            KML.altitude(0),
            KML.heading(frame[2]),
            KML.tilt(0),
            KML.roll(0),
            KML.altitudeMode("relativeToGround"),
            KML.range(DEFAULT_HEIGHT)
        ),
        KML.Style(
            KML.IconStyle(
                KML.scale(scale),
                KML.heading(frame[2]),
                KML.color(color),
                KML.Icon(
                    KML.href(flask.url_for('static',
                                           filename=marker,
                                           _external=True)),
                    ),
                KML.hotSpot(x="0.5", y="0.5",
                            xunits="fraction",
                            yunits="fraction")
                ),
            )
        )
开发者ID:cephalsystems,项目名称:srr,代码行数:38,代码来源:viewer.py

示例5: _buildSwath

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import roll [as 别名]
def _buildSwath(line, data, polyalt=5000):
    """
    So far, an ugly hack on building the KML elements
    """

    # split input line
    line = line.split()

    # add polygon altitude to end of line tuple
    line.append(polyalt)

    # parse the time element of the line
    dt = _makeTime(line[1])
    date = dt.date()
    time = dt.time()

    # define time format string
    format = "%Y-%m-%dT%H:%M:%SZ"

    # ensure longitude is between -/+ 180 degrees
    for i in [4, 6, 8, 10]:
        if float(line[i]) > 180.0:
            val = float(line[i]) - 360.0
            line[i] = str(val)

    # build the vertices of the swath (remember the first vertex has to
    # repeat at the end.
    vertices = []
    for c in [3, 5, 7, 9, 3, 5]:
        vertices.append(",".join([line[i] for i in [c + 1, c, -1]]))

    # get center of swath
    clat, clng = _swathCenter(line)

    # create an image placemark for the kml
    image = KML.Placemark(
        # define name based on experiment and filter/channel
        KML.name('{}: {}'.format(data['experiment'], data['filter'])),
        # define description
        # TODO: come up with a more flexible way of doing this...
        KML.description(
            'Orbit no.:                          {}\n'.format(
                data['orbit']),
            'Pericenter time (UTC):              {}\n'.format(
                data['pericenter time'].replace('_', ' ')),
            'First image time (UTC):             {}\n'.format(
                data['first image time'].replace('_', ' ')),
            'First image time (from pericenter): {}\n'.format(
                data['first image time from pericenter'].replace('_',
                                                                 ' ')),
            'Last image time (UTC):              {}\n'.format(
                data['last image time'].replace('_', ' ')),
            'Last image time (from pericenter):  {}\n\n'.format(
                data['last image time from pericenter'].replace('_', ' ')),
            'Image sequence:                     {}\n'.format(line[0]),
            'Image date:                         {}\n'.format(date),
            'Image time:                         {}\n'.format(time),
            'Orbit no.:                          {}\n\n'.format(
                data['orbit']),
            'Pericentre relative time:           {}\n'.format(
                line[2].replace('_', ' ')),
            'Duration:                           {}\n\n'.format(line[20]),
            'S/C altitude:                       {}\n'.format(line[21]),
            'S/C latitude:                       {}\n'.format(line[22]),
            'S/C longitude:                      {}\n'.format(line[23]),
            'S/C target elevation:               {}\n'.format(line[24]),
            'S/C target azimuth:                 {}\n\n'.format(line[25]),
            'Reflection Angle:                   {}\n'.format(line[27]),
            'Sun target elevation:               {}\n'.format(line[28]),
            'Sun target azimuth:                 {}\n'.format(line[29]),
            'Target phase:                       {}\n'.format(line[30]),
            'Target elongation:                  {}\n'.format(line[31]),
            'Local Time:                         {}\n'.format(line[32]),
            'Image smear:                        {}\n'.format(line[33]),
            'Mercury True Anomaly:               {}\n'.format(line[35])
        ),
        # specify appearance time
        KML.TimeSpan(
            #KML.begin(str(tempTime))
            KML.begin(dt.strftime(format))
        ),
        # the style for this swath has been mapped in <swath>stylemap
        KML.styleUrl('#{}stylemap'.format(data['filter'])),
        #KML.styleUrl('#{}1'.format(data['filter'])),
        # define where the 'eye' looks when this swath is double clicked
        KML.LookAt(
            KML.longitude(clng),
            KML.latitude(clat),
            KML.altitude('5000'),
            KML.heading('0'),
            KML.tilt('30'),
            KML.roll('0'),
            KML.altitudeMode('relativeToGround'),
            KML.range('1500000')
        ),
        # defined the geometry object that will hold the swath polygon
        KML.MultiGeometry(
            # defined the swath polygon
            KML.Polygon(
                #KML.tessellate('1'),
#.........这里部分代码省略.........
开发者ID:johnnycakes79,项目名称:pyops,代码行数:103,代码来源:maps.py

示例6: main

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import roll [as 别名]
def main():
    # iterate through 24 hours, adding ephemeris data to a list
    data = []
    for hour in range(0, 24):
        obs.date = date = datetime(year, month, day) + timedelta(hours=hour)
        sun.compute(obs)
        data.append({
            'datetime UTC': date,
            'azimuth_angle': sun.az.real,
            'altitude_angle': sun.alt.real,
        })

    # create a KML file skeleton
    stylename = "sn_shaded_dot"
    doc = KML.kml(
        KML.Document(
            KML.name("Sun Position"),
            KML.Style(
                KML.IconStyle(
                    KML.scale(1.2),
                    KML.Icon(
                        KML.href("http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png")
                    ),
                ),
                id=stylename,
            )
        )
    )
    # create placemark for the observer, and add it to the KML document
    pm_observer = KML.Placemark(
        KML.name('Observer'),
        KML.styleUrl('#{0}'.format(stylename)),
        KML.Point(
            KML.extrude(True),
            KML.altitudeMode('relativeToGround'),
            KML.coordinates("{0},{1},{2}".format(longitude, latitude, height)),
        ),
    )
    doc.Document.append(pm_observer)
    # iterate through the ephemeris data
    for i in data:
        timestamp = i['datetime UTC']
        azimuth_rad = i['azimuth_angle']
        azimuth_deg = degrees(azimuth_rad)
        altitude_rad = i['altitude_angle']
        altitude_deg = degrees(altitude_rad)
        if altitude_deg > 0:
            # define a placemark along the ephemeris vector for labeling
            delta_lat_rad, delta_lon_rad, delta_alt = calculate_geographic_offset(
                azimuth_angle=radians(adjust_heading_degrees(degrees(azimuth_rad))),
                altitude_angle=altitude_rad,
                distance=label_distance,
            )
            pm1 = KML.Placemark(
                KML.name((timestamp + timedelta(timezone_offset)).strftime('%H:%M')),
                KML.styleUrl('#{0}'.format(stylename)),
                KML.LookAt(
                    KML.longitude(longitude),
                    KML.latitude(latitude),
                    KML.altitude(height),
                    KML.heading(adjust_heading_degrees(azimuth_deg)),
                    KML.tilt(90),
                    # KML.roll(0),
                    KML.altitudeMode("relativeToGround"),
                    KML.range(50),
                ),
                KML.Point(
                    KML.altitudeMode("relativeToGround"),
                    KML.coordinates("{lon},{lat},{alt}".format(
                        lon=longitude + degrees(delta_lon_rad),
                        lat=latitude + degrees(delta_lat_rad),
                        alt=height + delta_alt,
                    )),
                ),
            )
            pm2 = KML.Placemark(
                KML.name('Sun View'),
                KML.LookAt(
                    KML.longitude(longitude),
                    KML.latitude(latitude),
                    KML.altitude(height),
                    KML.heading(adjust_heading_degrees(180 + azimuth_deg)),
                    KML.tilt(90 - altitude_deg - 0.2),
                    # KML.roll(0),
                    KML.altitudeMode("relativeToGround"),
                    KML.range(2 * label_distance),
                ),
                KML.Model(
                    KML.altitudeMode('relativeToGround'),
                    KML.Location(
                        KML.longitude(longitude),
                        KML.latitude(latitude),
                        KML.altitude(height),
                    ),
                    KML.Orientation(
                        KML.heading(adjust_heading_degrees(azimuth_deg)),
                        KML.tilt(90 - altitude_deg),
                        KML.roll(0),
                    ),
                    KML.Scale(
#.........这里部分代码省略.........
开发者ID:recombinant,项目名称:pykml,代码行数:103,代码来源:pyephem_example.py

示例7: calculate_geographic_offset

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import roll [as 别名]
 # define a placemark along the ephemeris vector for labeling
 delta_lat_rad, delta_lon_rad, delta_alt = calculate_geographic_offset(
     azimuth_angle=radians(adjust_heading_degrees(degrees(azimuth_rad))),
     altitude_angle=altitude_rad,
     distance=label_distance,
 )
 pm1 = KML.Placemark(
     KML.name((timestamp+timedelta(timezone_offset)).strftime('%H:%M')),
     KML.styleUrl('#{0}'.format(stylename)),
     KML.LookAt(
         KML.longitude(longitude),
         KML.latitude(latitude),
         KML.altitude(height),
         KML.heading(adjust_heading_degrees(azimuth_deg)),
         KML.tilt(90),
         KML.roll(0),
         KML.altitudeMode("relativeToGround"),
         KML.range(50),
     ),
     KML.Point(
         KML.altitudeMode("relativeToGround"),
         KML.coordinates("{lon},{lat},{alt}".format(
             lon = longitude + degrees(delta_lon_rad),
             lat = latitude + degrees(delta_lat_rad),
             alt = height + delta_alt,
         )),
     ),
 )
 pm2 = KML.Placemark(
     KML.name('Sun View'),
     KML.LookAt(
开发者ID:123abcde,项目名称:pykml,代码行数:33,代码来源:pyephem_example.py


注:本文中的pykml.factory.KML_ElementMaker.roll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。