Skip to content

Commit 3079a68

Browse files
更新10.1.0标绘demo
1 parent ade5911 commit 3079a68

File tree

7 files changed

+167
-8
lines changed

7 files changed

+167
-8
lines changed

dist/leaflet/include-leaflet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@
133133
inputCSS("../../dist/leaflet/iclient-leaflet.min.css");
134134
}
135135
if (inArray(includes, 'iclient-plot-leaflet')) {
136-
inputCSS("https://iclient.supermap.io/web/libs/plotting/leaflet/10.0.1/iclient-plot-leaflet.css");
136+
inputCSS("https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.0/iclient-plot-leaflet.css");
137137
if (supportES6()) {
138-
inputScript("https://iclient.supermap.io/web/libs/plotting/leaflet/10.0.1/iclient-plot-leaflet-es6.min.js");
138+
inputScript("https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.0/iclient-plot-leaflet-es6.min.js");
139139
} else {
140-
inputScript("https://iclient.supermap.io/web/libs/plotting/leaflet/10.0.1/iclient-plot-leaflet.min.js");
140+
inputScript("https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.0/iclient-plot-leaflet.min.js");
141141
}
142142
}
143143
if (inArray(includes, 'ant-design-vue')) {

examples/leaflet/config.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,12 @@ var exampleConfig = {
11401140
version: "9.1.0",
11411141
thumbnail: "plot_symbolAvoid.png",
11421142
fileName: "plot_symbolAvoid"
1143+
}, {
1144+
name: "动目标图层",
1145+
name_en: "moving target layer",
1146+
version: "10.1.0",
1147+
thumbnail: "plot_movingTarget.gif",
1148+
fileName: "plot_movingTarget"
11431149
}]
11441150
}
11451151
}
@@ -1301,8 +1307,8 @@ var exampleConfig = {
13011307
version: "9.1.2",
13021308
thumbnail: "components_chart_iptl.png",
13031309
fileName: "components_chart_iptl"
1304-
}
1305-
1310+
}
1311+
13061312
]
13071313
},
13081314
"componentsAdvanced": {
@@ -1437,4 +1443,4 @@ var exampleIconConfig = {
14371443
"OGC": "fa-globe",
14381444
"mapping": "fa-send"
14391445
};
1440-
window.leafletExampleConfig = exampleConfig;
1446+
window.leafletExampleConfig = exampleConfig;
170 KB
Loading

examples/leaflet/plot_drawGeoGraphicObject.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ <h5 class='panel-title text-center' data-i18n="resources.title_drawGeoGraphicObj
1616
<input type="button" class="btn btn-default" data-i18n="[value]resources.text_input_value_drawLine" onclick="draw_line()"/>
1717
<input type="button" class="btn btn-default" data-i18n="[value]resources.text_input_value_drawPolygon" onclick="draw_polygon()"/>
1818
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_drawText" onclick="draw_text()"/>
19+
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_drawImage" onclick="draw_Image()"/>
1920
<input type="button" class="btn btn-default" data-i18n="[value]resources.text_input_value_clear" onclick="clearLayers()"/>
2021
</div>
2122
</div>
@@ -47,7 +48,7 @@ <h5 class='panel-title text-center' data-i18n="resources.title_drawGeoGraphicObj
4748
function draw_dot(){
4849
clearLayers();
4950
var latlngs = [new L.latLng(34,105)];
50-
plottingLayer.createSymbol(421, 10100,latlngs,{symbolType:SuperMap.Plot.SymbolType.DOTSYMBOL,dScale:3});
51+
plottingLayer.createSymbol(421, 10100, latlngs);
5152
}
5253

5354
function draw_line() {
@@ -73,8 +74,17 @@ <h5 class='panel-title text-center' data-i18n="resources.title_drawGeoGraphicObj
7374
function draw_text() {
7475
clearLayers();
7576
var latlngs = [new L.latLng(34,105)];
76-
plottingLayer.createSymbol(0, SuperMap.Plot.SymbolType.TEXTSYMBOL,latlngs,null,{fontSize:30});
77+
plottingLayer.createSymbol(0, SuperMap.Plot.SymbolType.TEXTSYMBOL, latlngs, null, {fontSize:30});
7778
}
79+
80+
function draw_Image(){
81+
clearLayers();
82+
var latlngs = [new L.latLng(34,105)];
83+
//var path ="https://www.supermap.com/cn/cn2019/images/logo.png";
84+
var path ="../img/marker.png";
85+
plottingLayer.createSymbol(0, SuperMap.Plot.SymbolType.PICTURE,latlngs,null,{graphicWidth:44,graphicHeight:33},{path:path}, function(evt){},{});
86+
}
87+
7888
$(document).ready(function(){
7989
$('#panelheading').click(function(){
8090
$('#panelbodycontent').toggle();
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<!--********************************************************************
2+
* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
3+
*********************************************************************-->
4+
<!DOCTYPE html>
5+
<html>
6+
<head>
7+
<meta charset="UTF-8">
8+
<title data-i18n="resources.title_plotMovingTarget"></title>
9+
</head>
10+
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
11+
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
12+
<script type="text/javascript" include="bootstrap-css" src="../js/include-web.js"></script>
13+
<script type="text/javascript" include="iclient-plot-leaflet" src="../../dist/leaflet/include-leaflet.js"></script>
14+
<script type="text/javascript">
15+
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
16+
var url = host + "/iserver/services/map-world/rest/maps/World";
17+
var serverUrl = host + "/iserver/services/plot-jingyong/rest/plot/";
18+
var features = [];
19+
var trackingDirs = {};
20+
var e = 60;
21+
map = L.map('map', {
22+
crs: L.CRS.EPSG4326,
23+
center: [0, 0],
24+
maxZoom: 18,
25+
zoom: 2
26+
});
27+
28+
L.supermap.tiledMapLayer(url).addTo(map);
29+
//L.supermap.plotting.editControl().addTo(map);
30+
var movingTargetLayer = L.supermap.plotting.movingTargetLayer("Moving-Target", serverUrl).addTo(map);
31+
32+
map.on("zoomstart", function(){
33+
movingTargetLayer.setVisibility(false);
34+
});
35+
map.on("zoomend", function(){
36+
movingTargetLayer.setVisibility(true);
37+
});
38+
map.on("movestart", function(){
39+
movingTargetLayer.setVisibility(false);
40+
});
41+
map.on("moveend", function(){
42+
movingTargetLayer.setVisibility(true);
43+
});
44+
45+
drawGraphics();
46+
window.setInterval(updateInterval, 1000);
47+
48+
function updateInterval() {
49+
var bounds = map.get
50+
var features = movingTargetLayer.features;
51+
for(var i = 0; i < features.length; i++) {
52+
if(features[i].symbolType === SuperMap.Plot.SymbolType.DOTSYMBOL){
53+
// var latlng = features[i].getLatLngs()[0];
54+
55+
// var x = latlng.lat;
56+
// var y = latlng.lng;
57+
// if(x >= e || x <= ((-1)*e)){
58+
// trackingDirs[features[i].uuid][0] *= (-1);
59+
// }
60+
// if(y >= e || y <= ((-1)*e)){
61+
// trackingDirs[features[i].uuid][1] *= (-1);
62+
// }
63+
64+
var trackingDir = trackingDirs[features[i].uuid];
65+
66+
features[i].move(trackingDir[0] * 1, trackingDir[1] * 1);
67+
}
68+
}
69+
70+
movingTargetLayer.update();
71+
}
72+
73+
function drawGraphics() {
74+
var count = 2000;
75+
var randomCode = [9, 80101, 80102, 80103, 80104, 80105, 80106, 80107, 80108, 80109];
76+
var randomDir = [[0, 1], [0, -1], [-1, 0], [1, 0], [1, 1], [-1, -1], [1, -1], [-1, 1]];
77+
var randomSymbolData = [];
78+
var symbolDataIndex = 0;
79+
80+
function getSymbolInfoSuccess(result) {
81+
randomSymbolData.push(result.result);
82+
symbolDataIndex++;
83+
if(symbolDataIndex < randomCode.length) {
84+
var params = new SuperMap.GetSymbolInfoParameters({
85+
libID: 421,
86+
code: randomCode[symbolDataIndex]
87+
});
88+
L.supermap.symbolInfoService(serverUrl).getSymbolInfo(params, getSymbolInfoSuccess, null);
89+
} else {
90+
for(var i = 0; i < count; ++i) {
91+
var coordinates = [2 * e * Math.random() - e, 2 * e * Math.random() - e];
92+
var randomIndex = Math.floor(10 * Math.random());
93+
var dotSymbol = L.supermap.plotting.PlottingObject.createSymbol(
94+
421, randomCode[randomIndex], L.latLng(
95+
coordinates[0], coordinates[1]), {
96+
serverUrl: serverUrl,
97+
symbolData: randomSymbolData[randomIndex],
98+
symbolSize: new SuperMap.Size(20, 20),
99+
symbolTexts: [new SuperMap.Plot.SymbolText("速度_米 每秒:500", SuperMap.Plot.AnnoPosition.ANCHOR, {
100+
fontSize: 15,
101+
fillSymbolID: 0,
102+
fillColor: "#00ff00",
103+
fillOpacity: 0.8,
104+
color: "#ffffff"
105+
106+
}, {
107+
border: true,
108+
offsetX: 20,
109+
offsetY: -30,
110+
paddingX: 5,
111+
paddingY: 7,
112+
lineStyle: {
113+
color: "#00ff00"
114+
}
115+
})],
116+
// bloodVolumes:[ new SuperMap.Plot.BloodVolume(0.5, SuperMap.Plot.Position.TOP, {remainingVolumeColor: "#ff0000", consumeVolumeColor:"#ffffff"}), new SuperMap.Plot.BloodVolume(0.5, SuperMap.Plot.Position.BOTTOM),
117+
// new SuperMap.Plot.BloodVolume(0.5, SuperMap.Plot.Position.LEFT, null, {offsetX: -20, width: 80, height: 15}), new SuperMap.Plot.BloodVolume(0.5, SuperMap.Plot.Position.RIGHT, null, {offsetX:20})
118+
// ],
119+
120+
//pictureFrames:[ new SuperMap.Plot.PictureFrame("../img/marker.png", SuperMap.Plot.AnnoPosition.RIGHT, {width:32, height:32, offsetY: 0, offsetX: 0})],
121+
trajectory: new SuperMap.Plot.Trajectory(10, true, false, {color: "#00ff00"}, {saveTrackingPoint: true})
122+
}, null, null);
123+
features.push(dotSymbol);
124+
125+
var randomDirIndex = Math.floor(8 * Math.random());
126+
trackingDirs[dotSymbol.uuid] = randomDir[randomDirIndex];
127+
}
128+
movingTargetLayer.addFeatures(features);
129+
}
130+
}
131+
var params = new SuperMap.GetSymbolInfoParameters({
132+
libID: 421,
133+
code: randomCode[symbolDataIndex]
134+
});
135+
L.supermap.symbolInfoService(serverUrl).getSymbolInfo(params, getSymbolInfoSuccess, null);
136+
}
137+
</script>
138+
</body>
139+
</html>

examples/locales/en-US/resources.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ window.examplesResources = {
265265
"title_symbolAvoid": "Avoided Area",
266266
"title_symbolExtendProperty": "Custom Properties",
267267
"title_symbolGeometricQuery": "Geometry Query",
268+
"title_plotMovingTarget": "Moving Target Layer",
268269
"title_anchored": "Anchored Popup",
269270
"title_customPopup": "Custom Popup",
270271
"title_infoWindow": "Third Party Information Window",
@@ -1436,6 +1437,7 @@ window.examplesResources = {
14361437
"btn_drawMarker": "Draw marker",
14371438
"btn_cancelMarker": "Cancel",
14381439
"btn_drawText": "Draw text",
1440+
"btn_drawImage": "Draw image",
14391441
"btn_route1": "Route1",
14401442
"btn_route2": "Route2",
14411443
"btn_route3": "Route3",

examples/locales/zh-CN/resources.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ window.examplesResources = {
204204
"title_querySymbolLib": "查询标号",
205205
"title_saveload": "保存和加载",
206206
"title_symbolAvoid": "避让区域",
207+
"title_plotMovingTarget": "动目标图层",
207208
"title_symbolExtendProperty": "自定义属性",
208209
"title_symbolGeometricQuery": "几何查询",
209210
"title_anchored": "自适应信息框",
@@ -1382,6 +1383,7 @@ window.examplesResources = {
13821383
"btn_drawMarker": "绘制标号",
13831384
"btn_cancelMarker": "取消标绘",
13841385
"btn_drawText": "绘文字",
1386+
"btn_drawImage": "绘图片",
13851387
"btn_route1": "航线1",
13861388
"btn_route2": "航线2",
13871389
"btn_route3": "航线3",

0 commit comments

Comments
 (0)