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


Python Map.setOverlayContent方法代码示例

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


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

示例1: get

# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import setOverlayContent [as 别名]
    def get(self, id):
        response = self.post_data_url(hard_url="/api/sdk/map/get.php",
                                      data_query={'apikey': self.__apiKey, 'id': id})

        if response in [None, '']:
            raise Exception("Invalid Data Received")

        response_dict = response.json()
        if response_dict.get('success') is False:
            raise Exception(response_dict.get('message'))

        # Creating Map from response
        rMap = json.loads(response_dict.get('message'))
        map_instance = Map(name=rMap.get('name'),
                           height=rMap.get('height'),
                           width=rMap.get('width'),
                           zoom=rMap.get('zoom'),
                           center=Point(rMap.get('centerLatitude'), rMap.get('centerLongitude')))

        map_instance.setId(rMap.get("id"))
        map_instance.setLayerId(rMap.get("layerId"))
        map_instance.setGroupId(rMap.get("groupId"))
        map_instance.setButtonStyle(rMap.get("buttonStyle"))
        map_instance.setPassword(rMap.get("password"))
        map_instance.setUseCluster(rMap.get("useCluster"))
        map_instance.setOverlayEnable(rMap.get("overlayEnable"))
        map_instance.setOverlayTitle(rMap.get("overlayTitle"))
        map_instance.setOverlayContent(rMap.get("overlayContent"))
        map_instance.setOverlayBlurb(rMap.get("overlayBlurb"))
        map_instance.setLegendEnable(rMap.get("legendEnable"))
        map_instance.setLegendContent(rMap.get("legendContent"))
        map_instance.setProjectId(int(rMap.get("projectId")))
        map_instance.setShowSidebar(rMap.get("showSidebar"))
        map_instance.setShowExport(rMap.get("showExport"))
        map_instance.setShowMeasure(rMap.get("showMeasure"))
        map_instance.setShowMinimap(rMap.get("showMinimap"))
        map_instance.setShowSearch(rMap.get("showSearch"))
        map_instance.setShowFilelayer(rMap.get("showFilelayer"))
        map_instance.setShowSvg(rMap.get("showSvg"))
        map_instance.setShowStaticSidebar(rMap.get("showStaticSidebar"))
        map_instance.setStaticSidebarContent(rMap.get("staticSidebarContent"))

        # Creating Markers from response
        markers_list = rMap.get("markers")

        for marker in markers_list:
            marker_instance = Marker(marker.get('latitude'), marker.get('longitude'))
            marker_instance.setLocation(marker.get("location"))
            marker_instance.setDescription(marker.get("description"))
            marker_instance.setShowGetDirection(marker.get("showGetDirection"))
            marker_instance.setShowInfoBox(marker.get("showInfoBox"))
            marker_instance.setShowLocationOnPopup(marker.get("showLocationOnPopup"))
            marker_instance.setHideLabel(marker.get("hideLabel"))
            marker_instance.setMarkerStyle(marker.get("markerStyle"))
            marker_instance.setMarkerColor(marker.get("markerColor"))

            map_instance.addShape(marker_instance)


        image_overlays_list = json.loads(rMap.get("imageOverlays"))

        for imageOverlay in image_overlays_list:
            bounds = json.loads(imageOverlay.get("bounds"))
            boundA = bounds[0]
            boundB = bounds[1]

            p1 = Point(boundA[0], boundA[1])
            p2 = Point(boundB[0], boundB[1])

            image_overlay_instance = ImageOverlay(imageOverlay.get("name"),
                                                  p1,
                                                  p2,
                                                  imageOverlay.get("src"),
                                                  imageOverlay.get("popupcontent"))

            map_instance.addImageOverlay(image_overlay_instance)

        return map_instance
开发者ID:MapFig,项目名称:mapfig-Python-SDK-Version-2.0.1,代码行数:80,代码来源:MapFigApplication.py


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