浏览代码

Merge remote-tracking branch 'origin/master'

s9th 4 年之前
父节点
当前提交
f3ab634e77

+ 5 - 0
mybusiness/src/main/java/com/business/slfh/visualization/event/controller/Visualization_Event_Controller.java

@@ -469,6 +469,11 @@ public class Visualization_Event_Controller extends AppBaseController {
 
         return prefix + "/measure";
     }
+    @RequestMapping("getmeasure_size")
+    public String getmeasure_size(ModelMap map){
+
+        return prefix + "/measure_size";
+    }
 
 
 

+ 6 - 0
mybusiness/src/main/resources/templates/business/visualization/event.html

@@ -276,6 +276,12 @@
             <a class="a_txt">测量</a>
         </div>
     </div>
+    <div class="nav lz">
+        <div class="n_div" onclick="window.open('getmeasure_size')">
+            <a class="a_img"></a>
+            <a class="a_txt">测量面积</a>
+        </div>
+    </div>
     <!--<div class="nav lz">-->
     <!--<div class="n_div" url="getVisualizationFrame_LZ">-->
     <!--<a class="a_img"></a>-->

+ 56 - 0
mybusiness/src/main/resources/templates/business/visualization/measure_size.html

@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<!--<html lang="en" xmlns:th="http://www.thymeleaf.org">-->
+<html xmlns:th="http://www.w3.org/1999/xhtml">
+<head>
+    <meta charset="UTF-8">
+    <title data-i18n="resources.title_measureDistance"></title>
+    <script th:src="@{/visualization/superMap/examples/js/include-web.js}"></script>
+    <script type="text/javascript" th:src="@{/dist/ol/include-ol.js}"></script>
+</head>
+<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%; position: absolute;top: 0;">
+<div id="map" style="width: 100%;height:100%"></div>
+<script type="text/javascript">
+    var map, interaction, vectorLayer, feature,
+        url = "http://218.27.1.157:8090/iserver/services/map-SiPingLinYe4326/rest/maps/1%E6%9E%97%E5%9C%BA%E5%BD%B1%E5%83%8F";
+    map = new ol.Map({
+        target: 'map',
+        controls: ol.control.defaults({attributionOptions: {collapsed: false}})
+            .extend([new ol.supermap.control.Logo()]),
+        view: new ol.View({
+            center: [43.15, 124.78],
+            zoom: 10,
+            projection: 'EPSG:4326',
+            multiWorld: true
+        })
+    });
+    var layer = new ol.layer.Tile({
+        source: new ol.source.TileSuperMapRest({
+            url: url
+        }),
+        projection: 'EPSG:4326'
+    });
+    map.addLayer(layer);
+    var source = new ol.source.Vector({wrapX: false});
+    vectorLayer = new ol.layer.Vector({
+        source: source
+    });
+    map.addLayer(vectorLayer);
+    interaction = new ol.interaction.Draw({
+        source: source,
+        type: "Polygon",
+    });
+    interaction.on('drawstart', function (evt) {
+        feature = evt.feature;
+    });
+    interaction.on('drawend', function () {
+        var areaMeasureParam = new SuperMap.MeasureParameters(feature.getGeometry());
+        new ol.supermap.MeasureService(url).measureArea(areaMeasureParam, function (serviceResult) {
+            widgets.alert.showAlert(serviceResult.result.area + resources.msg_sqm, true);
+        });
+    });
+
+    map.addInteraction(interaction);
+
+</script>
+</body>
+</html>