當前位置: 首頁>>代碼示例>>Python>>正文


Python Theme.ui_metadatas方法代碼示例

本文整理匯總了Python中c2cgeoportal.models.Theme.ui_metadatas方法的典型用法代碼示例。如果您正苦於以下問題:Python Theme.ui_metadatas方法的具體用法?Python Theme.ui_metadatas怎麽用?Python Theme.ui_metadatas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在c2cgeoportal.models.Theme的用法示例。


在下文中一共展示了Theme.ui_metadatas方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from c2cgeoportal.models import Theme [as 別名]
# 或者: from c2cgeoportal.models.Theme import ui_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, ServerOGC, LayerWMS, LayerWMTS, \
            UIMetadata, WMTSDimension

        main = Interface(name=u"main")
        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.ui_metadatas = [UIMetadata("test", "v1")]

        server_ogc_internal = ServerOGC(name="__test_server_ogc_internal", type="mapserver", image_type="image/jpeg")
        server_ogc_external = ServerOGC(name="__test_server_ogc_external", url="internal_url", image_type="image/jpeg")

        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.ui_metadatas = [UIMetadata("test", "internal_wms")]
        layer_internal_wms.server_ogc = server_ogc_internal

        layer_external_wms = LayerWMS(name=u"__test_layer_external_wms", public=True)
        layer_external_wms.interfaces = [main]
        layer_external_wms.ui_metadatas = [UIMetadata("test", "external_wms")]
        layer_external_wms.server_ogc = server_ogc_external

        layer_wmts = LayerWMTS(name=u"__test_layer_wmts", public=True)
        layer_wmts.interfaces = [main, mobile]
        layer_wmts.ui_metadatas = [UIMetadata("test", "wmts")]
        layer_wmts.dimensions = [WMTSDimension("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.ui_metadatas = [UIMetadata("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.ui_metadatas = [UIMetadata("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:craxxkid,項目名稱:c2cgeoportal,代碼行數:71,代碼來源:test_themes.py


注:本文中的c2cgeoportal.models.Theme.ui_metadatas方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。