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


Python LayerGroup.metadatas方法代码示例

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


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

示例1: setUp

# 需要导入模块: from c2cgeoportal.models import LayerGroup [as 别名]
# 或者: from c2cgeoportal.models.LayerGroup import metadatas [as 别名]
    def setUp(self):  # noqa
        # Always see the diff
        # https://docs.python.org/2/library/unittest.html#unittest.TestCase.maxDiff
        self.maxDiff = None

        from c2cgeoportal.models import DBSession, \
            Theme, LayerGroup, Functionality, Interface, \
            LayerV1, OGCServer, LayerWMS, LayerWMTS, \
            Metadata, Dimension, OGCSERVER_AUTH_NOAUTH

        main = Interface(name=u"desktop")
        mobile = Interface(name=u"mobile")
        min_levels = Interface(name=u"min_levels")

        layer_v1 = LayerV1(name=u"__test_layer_v1", public=True)
        layer_v1.interfaces = [main]
        layer_v1.metadatas = [Metadata("test", "v1")]

        ogc_server_internal, _ = create_default_ogcserver()
        ogc_server_external = OGCServer(
            name="__test_ogc_server_chtopo", url="http://wms.geo.admin.ch/",
            image_type="image/jpeg", auth=OGCSERVER_AUTH_NOAUTH
        )
        ogc_server_external.wfs_support = False

        layer_internal_wms = LayerWMS(name=u"__test_layer_internal_wms", public=True)
        layer_internal_wms.layer = "__test_layer_internal_wms"
        layer_internal_wms.interfaces = [main, min_levels]
        layer_internal_wms.metadatas = [Metadata("test", "internal_wms")]
        layer_internal_wms.ogc_server = ogc_server_internal

        layer_external_wms = LayerWMS(name=u"__test_layer_external_wms", layer="ch.swisstopo.dreiecksvermaschung", public=True)
        layer_external_wms.interfaces = [main]
        layer_external_wms.metadatas = [Metadata("test", "external_wms")]
        layer_external_wms.ogc_server = ogc_server_external

        layer_wmts = LayerWMTS(name=u"__test_layer_wmts", public=True)
        layer_wmts.url = "http://example.com/1.0.0/WMTSCapabilities.xml"
        layer_wmts.layer = "map"
        layer_wmts.interfaces = [main, mobile]
        layer_wmts.metadatas = [Metadata("test", "wmts")]
        layer_wmts.dimensions = [Dimension("year", "2015")]

        layer_group_1 = LayerGroup(name=u"__test_layer_group_1")
        layer_group_1.children = [layer_v1, layer_internal_wms, layer_external_wms, layer_wmts]
        layer_group_1.metadatas = [Metadata("test", "group_1")]

        layer_group_2 = LayerGroup(name=u"__test_layer_group_2")
        layer_group_2.children = [layer_wmts, layer_internal_wms, layer_external_wms]

        layer_group_3 = LayerGroup(name=u"__test_layer_group_3")
        layer_group_3.children = [layer_wmts, layer_internal_wms, layer_external_wms]

        layer_group_4 = LayerGroup(name=u"__test_layer_group_4")
        layer_group_4.children = [layer_group_2]

        theme = Theme(name=u"__test_theme")
        theme.interfaces = [main, mobile]
        theme.metadatas = [Metadata("test", "theme")]
        theme.children = [
            layer_group_1, layer_group_2
        ]
        theme_layer = Theme(name=u"__test_theme_layer")
        theme_layer.interfaces = [min_levels]
        theme_layer.children = [
            layer_internal_wms
        ]

        functionality1 = Functionality(name=u"test_name", value=u"test_value_1")
        functionality2 = Functionality(name=u"test_name", value=u"test_value_2")
        theme.functionalities = [functionality1, functionality2]

        DBSession.add_all([theme, theme_layer])

        transaction.commit()
开发者ID:camptocamp,项目名称:c2cgeoportal,代码行数:77,代码来源:test_themes.py


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