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


Python KML_ElementMaker.listItemType方法代码示例

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


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

示例1: gmaps

# 需要导入模块: from pykml.factory import KML_ElementMaker [as 别名]
# 或者: from pykml.factory.KML_ElementMaker import listItemType [as 别名]
def gmaps(input, configFile):
    """
       Check and deal with command line agruments.
    """

    if NOKMLLIB:
        print("\nOoops! 'gmaps' needs KML_ElementMaker from pykml.factory")
        print("       Try: pip install pykml\n")
    else:
        # # Check input arguments
        # if len(sys.argv) < 2 or len(sys.argv) > 3:
        #     # ... show usage hint...
        #     _gmapsusage(sys.argv[0])
        #     # ... exit!
        #     raise SystemExit(1)

        # input = sys.argv[1]
        # if sys.argv[2]:
        #     configFile = sys.argv[2]
        # else:
        #     configFile = False

        # create containers
        experiments = {}
        filters = {}
        currents = {}
        styles = []

        # Open input file for reading.
        infile = open(input, 'r')

        # Scan through the file line-by-line.
        # TODO: look into moving this for loop into a function
        for line in infile.readlines():
            if line.startswith('Trail'):
                break

            # TODO: Replace the crude pattern matching below with RegEx...
            if line.startswith('Experiment:'):
                expr = line.split(': ')[1].strip()
                if expr not in experiments:
                    experiments[expr] = KML.Folder(KML.name(expr.replace('_',
                                                                         ' ')),
                                                   KML.open('1'),
                                                   id='expr_{}'.format(expr))
                currents['experiment'] = expr

            if line.startswith('Swath:'):
                fltr = line.split(': ')[1].strip()
                if fltr not in filters:
                    filters[fltr] = KML.Folder(KML.name(fltr.replace('_', ' ')),
                                               KML.open('0'),
                                               KML.visibility('1'),
                                               KML.Style(KML.ListStyle(KML.listItemType('checkHideChildren')), id='check-hide-children'),
                                               KML.styleUrl('#check-hide-children'),
                                               id='fltr_{}'.format(fltr))
                    experiments[currents['experiment']].append(filters[fltr])
                currents['filter'] = fltr

            if line.startswith('Orbit:'):
                orbit = line.split()[1].strip()
                currents['orbit'] = orbit

            if line.startswith('Pericenter time (UTC):'):
                peric_time = line.split(': ')[1].strip()
                currents['pericenter time'] = peric_time

            if line.startswith('First image time (UTC):'):
                first_image_t = line.split(': ')[1].strip()
                currents['first image time'] = first_image_t

            if line.startswith('First image time (from pericenter):'):
                first_image_t_frm_peric = line.split(': ')[1].strip()
                currents['first image time from pericenter'] = first_image_t_frm_peric

            if line.startswith('Last image time (UTC):'):
                last_image_t = line.split(': ')[1].strip()
                currents['last image time'] = last_image_t

            if line.startswith('Last image time (from pericenter):'):
                last_image_t_frm_peric = line.split(': ')[1].strip()
                currents['last image time from pericenter'] = last_image_t_frm_peric

            # build an 'image' placemark element
            if line.startswith(' '):
                image = _buildSwath(line, currents)
                filters[currents['filter']].append(image)

        infile.close()

        # the styles for the different swaths
        colors = {}

        # if the MAPPS ini has been provided get colours from it.
        if configFile:
            inifile = open(configFile, 'r')
            for line in inifile.readlines():
                if '\swathColorName=' in line:
                    cHTML = line.rsplit("=#", 1)[1].strip()
                    cKML = '{}{}{}'.format(cHTML[4:6], cHTML[2:4], cHTML[0:2])
#.........这里部分代码省略.........
开发者ID:johnnycakes79,项目名称:pyops,代码行数:103,代码来源:maps.py


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