本文整理匯總了Python中c2cgeoportal.models.Theme.metadatas方法的典型用法代碼示例。如果您正苦於以下問題:Python Theme.metadatas方法的具體用法?Python Theme.metadatas怎麽用?Python Theme.metadatas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類c2cgeoportal.models.Theme
的用法示例。
在下文中一共展示了Theme.metadatas方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setUp
# 需要導入模塊: from c2cgeoportal.models import Theme [as 別名]
# 或者: from c2cgeoportal.models.Theme 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()