Skip to content

Commit cb87789

Browse files
author
caoxinke@supermap.com
committed
fix 区域汇总分析的例子。
1 parent ea13701 commit cb87789

File tree

3 files changed

+85
-31
lines changed

3 files changed

+85
-31
lines changed

examples/classic/SummaryRegionJobService.html

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,20 @@ <h3 class="panel-title">区域汇总分析</h3>
4040
</div>
4141
</div>
4242
<p>
43-
<div class="input-group">
43+
<div id="meshTypeS" class="input-group">
4444
<span class="input-group-addon">网格面汇总类型<span title="必填字段" style="color: red;"> * </span>  </span>
4545
<select class="form-control" id="meshType" name="clientType">
4646
<option value="0" selected="selected">四边形网格</option>
4747
<option value="1">六边形网格</option>
4848
</select>
4949
</div>
5050
<p>
51+
<div id="regionDatasetS" class="input-group">
52+
<span class="input-group-addon">汇总数据集<span title="必填字段" style="color: red;"> * </span>  </span>
53+
<input id="regionDataset" type="text" class="form-control"
54+
value="samples_processing_newyorkZone_R"/>
55+
</div>
56+
<p>
5157
<div class="input-group">
5258
<span class="input-group-addon">分析范围     </span>
5359
<input id="query" type="text" class="form-control" value="-74.050,40.650,-73.850,40.850"/>
@@ -95,12 +101,12 @@ <h3 class="panel-title">区域汇总分析</h3>
95101
<p>
96102
</div>
97103

98-
<div class="input-group">
104+
<div id="resolutionS" class="input-group">
99105
<span class="input-group-addon">网格大小     </span>
100106
<input id="resolution" type="text" class="form-control" value="100"/>
101107
</div>
102108
<p>
103-
<div class="input-group">
109+
<div id="meshSizeUnitS" class="input-group">
104110
<span class="input-group-addon">网格大小单位   </span>
105111
<select class="form-control" id="meshSizeUnit" name="clientType">
106112
<option value="Meter" selected="selected">Meter</option>
@@ -127,17 +133,17 @@ <h3 class="panel-title">区域汇总分析</h3>
127133
<script type="text/javascript">
128134
var host = window.isLocal ? document.location.protocol + "//" + document.location.host : "http://117.122.248.69:8090";
129135
var resultLayer,
130-
processingsUrl = host + "/iserver/services/distributedanalyst/rest/v1/jobs",
131-
mapURL = host + "/iserver/services/map-world/rest/maps/World",
132-
token = 'yurnlSeWak-vh77nAh73yrW_cHDTDJrfZxCVl7-h3GhMSMSNTPjvH7ykQviXfH1tOQ2ckJtUt6J9RY32GFNa6Q..',
133-
map = new SuperMap.Map("map", {
134-
controls: [
135-
new SuperMap.Control.Navigation(),
136-
new SuperMap.Control.Zoom(),
137-
new SuperMap.Control.LayerSwitcher()
136+
processingsUrl = host + "/iserver/services/distributedanalyst/rest/v1/jobs",
137+
mapURL = host + "/iserver/services/map-world/rest/maps/World",
138+
token = 'yurnlSeWak-vh77nAh73yrW_cHDTDJrfZxCVl7-h3GhMSMSNTPjvH7ykQviXfH1tOQ2ckJtUt6J9RY32GFNa6Q..',
139+
map = new SuperMap.Map("map", {
140+
controls: [
141+
new SuperMap.Control.Navigation(),
142+
new SuperMap.Control.Zoom(),
143+
new SuperMap.Control.LayerSwitcher()
138144

139-
], allOverlays: true
140-
});
145+
], allOverlays: true
146+
});
141147
map.addControl(new SuperMap.Control.MousePosition());
142148
var layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", mapURL, null, {maxResolution: "auto"});
143149
layer.events.on({"layerInitialized": addLayer});
@@ -166,7 +172,19 @@ <h3 class="panel-title">区域汇总分析</h3>
166172
}
167173
$("#weightS").hide();
168174
});
169-
175+
$("#type").change(function (e) {
176+
if (e.target.selectedIndex === 0) {
177+
$("#meshTypeS").show();
178+
$("#resolutionS").show();
179+
$("#meshSizeUnitS").show();
180+
$("#regionDatasetS").hide();
181+
return;
182+
}
183+
$("#meshTypeS").hide();
184+
$("#resolutionS").hide();
185+
$("#meshSizeUnitS").hide();
186+
$("#regionDatasetS").show();
187+
});
170188
function getQuery() {
171189
if ($('#query').val() === "") {
172190
return "";
@@ -176,10 +194,10 @@ <h3 class="panel-title">区域汇总分析</h3>
176194
query.push(parseFloat(el));
177195
});
178196
return new SuperMap.Bounds(
179-
query[0],
180-
query[1],
181-
query[2],
182-
query[3]
197+
query[0],
198+
query[1],
199+
query[2],
200+
query[3]
183201
);
184202
}
185203

@@ -193,7 +211,7 @@ <h3 class="panel-title">区域汇总分析</h3>
193211
}
194212
var summaryRegionJobParameter = new SuperMap.SummaryRegionJobParameter({
195213
datasetName: $('#datasetName').val(),
196-
regionDataset: $('#type option:selected').attr('value') === 'SUMMARYREGION' ? $('#datasetName').val() : undefined,
214+
regionDataset: $('#regionDataset').val(),
197215
type: $('#type option:selected').attr('value'),
198216
meshType: $('#meshType option:selected').attr('value'),
199217
query: getQuery(),
@@ -238,9 +256,9 @@ <h3 class="panel-title">区域汇总分析</h3>
238256
className += state ? "success" : "danger";
239257
if (!$('#msg_container')[0]) {
240258
var alertDiv = $("<div class='alert alert-dismissible' id='msg_container' role='alert' " +
241-
"style='z-index:800;position: absolute;top: 20px;margin:auto;left: 40%;width:400px;display: none'>" +
242-
"<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>&times;</span></button>" +
243-
"<strong><p id='msg'></p></strong></div>");
259+
"style='z-index:800;position: absolute;top: 20px;margin:auto;left: 40%;width:400px;display: none'>" +
260+
"<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>&times;</span></button>" +
261+
"<strong><p id='msg'></p></strong></div>");
244262
$('body').append(alertDiv)
245263
}
246264
$('#msg_container').addClass(className);

examples/leaflet/SummaryRegionJobService.html

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,16 @@
3939
"<option value='SUMMARYMESH' selected='selected'>网格面汇总</option>" +
4040
"<option value='SUMMARYREGION'>多边形汇总</option>" +
4141
"</select></div></div><p>" +
42-
"<div class='input-group'>" +
42+
"<div id='meshTypeS' class='input-group'>" +
4343
"<span class='input-group-addon'>网格面汇总类型<span title='必填字段' style='color: red;'> * </span>  </span>" +
4444
"<select class='form-control' id='meshType' name='clientType'>" +
4545
"<option value='0' selected='selected'>四边形网格</option>" +
4646
"<option value='1'>六边形网格</option>" +
47-
"</select></div><p><div class='input-group'>" +
47+
"</select></div><p>" +
48+
"<div id='regionDatasetS'' class='input-group'>" +
49+
"<span class='input-group-addon'>汇总数据集<span title='必填字段' style='color: red;'> * </span>  </span>" +
50+
"<input id='regionDataset' type='text' class='form-control' value='samples_processing_newyorkZone_R'/>" +
51+
"</div><p><div class='input-group'>" +
4852
"<span class='input-group-addon'>分析范围     </span>" +
4953
"<input id='query' type='text' class='form-control' value='-74.050,40.650,-73.850,40.850'/>" +
5054
"</div><p><p><div class='input-group'>" +
@@ -64,10 +68,10 @@
6468
"<input id='weightedStatisticModes' type='text' class='form-control' value='max'/>" +
6569
"</div><p><div class='input-group'><span class='input-group-addon'>权重字段名<span title='必填字段' style='color: red;'> * </span>    </span>" +
6670
"<input id='weightedFields' type='text' class='form-control' value='LocationID'/>" +
67-
"</div><p></div><div class='input-group'>" +
71+
"</div><p></div><div id='resolutionS' class='input-group'>" +
6872
"<span class='input-group-addon'>网格大小     </span>" +
6973
"<input id='resolution' type='text' class='form-control' value='100'/>" +
70-
"</div><p><div class='input-group'><span class='input-group-addon'>网格大小单位   </span>" +
74+
"</div><p><div id='meshSizeUnitS' class='input-group'><span class='input-group-addon'>网格大小单位   </span>" +
7175
"<select class='form-control' id='meshSizeUnit' name='clientType'>" +
7276
"<option value='Meter' selected='selected'>Meter</option>" +
7377
"<option value='Kilometer'>Kilometer</option>" +
@@ -98,6 +102,19 @@
98102
}
99103
$("#weightS").hide();
100104
});
105+
$("#type").change(function (e) {
106+
if (e.target.selectedIndex === 0) {
107+
$("#meshTypeS").show();
108+
$("#resolutionS").show();
109+
$("#meshSizeUnitS").show();
110+
$("#regionDatasetS").hide();
111+
return;
112+
}
113+
$("#meshTypeS").hide();
114+
$("#resolutionS").hide();
115+
$("#meshSizeUnitS").hide();
116+
$("#regionDatasetS").show();
117+
});
101118
var processingService = new L.supermap.processingService(processingUrl);
102119
if (!window.isLocal) {
103120
SuperMap.SecurityManager.registerToken('http://117.122.248.69:8090/iserver', token);
@@ -125,7 +142,7 @@
125142
}
126143
var summaryRegionJobParameter = new SuperMap.SummaryRegionJobParameter({
127144
datasetName: $('#datasetName').val(),
128-
regionDataset: $('#type option:selected').attr('value') === 'SUMMARYREGION' ? $('#datasetName').val() : undefined,
145+
regionDataset: $('#regionDataset').val(),
129146
type: $('#type option:selected').attr('value'),
130147
meshType: $('#meshType option:selected').attr('value'),
131148
query: getQuery(),

examples/openlayers/SummaryRegionJobService.html

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,20 @@ <h3 class="panel-title">区域汇总分析</h3>
3737
</div>
3838
</div>
3939
<p>
40-
<div class="input-group">
40+
<div id="meshTypeS" class="input-group">
4141
<span class="input-group-addon">网格面汇总类型<span title="必填字段" style="color: red;"> * </span>  </span>
4242
<select class="form-control" id="meshType" name="clientType">
4343
<option value="0" selected="selected">四边形网格</option>
4444
<option value="1">六边形网格</option>
4545
</select>
4646
</div>
4747
<p>
48+
<div id="regionDatasetS" class="input-group">
49+
<span class="input-group-addon">汇总数据集<span title="必填字段" style="color: red;"> * </span>  </span>
50+
<input id="regionDataset" type="text" class="form-control"
51+
value="samples_processing_newyorkZone_R"/>
52+
</div>
53+
<p>
4854
<div class="input-group">
4955
<span class="input-group-addon">分析范围     </span>
5056
<input id="query" type="text" class="form-control" value="-74.050,40.650,-73.850,40.850"/>
@@ -92,12 +98,12 @@ <h3 class="panel-title">区域汇总分析</h3>
9298
<p>
9399
</div>
94100

95-
<div class="input-group">
101+
<div id="resolutionS" class="input-group">
96102
<span class="input-group-addon">网格大小     </span>
97103
<input id="resolution" type="text" class="form-control" value="100"/>
98104
</div>
99105
<p>
100-
<div class="input-group">
106+
<div id="meshSizeUnitS" class="input-group">
101107
<span class="input-group-addon">网格大小单位   </span>
102108
<select class="form-control" id="meshSizeUnit" name="clientType">
103109
<option value="Meter" selected="selected">Meter</option>
@@ -156,6 +162,19 @@ <h3 class="panel-title">区域汇总分析</h3>
156162
}
157163
$("#weightS").hide();
158164
});
165+
$("#type").change(function (e) {
166+
if (e.target.selectedIndex === 0) {
167+
$("#meshTypeS").show();
168+
$("#resolutionS").show();
169+
$("#meshSizeUnitS").show();
170+
$("#regionDatasetS").hide();
171+
return;
172+
}
173+
$("#meshTypeS").hide();
174+
$("#resolutionS").hide();
175+
$("#meshSizeUnitS").hide();
176+
$("#regionDatasetS").show();
177+
});
159178
var processingService = new ol.supermap.ProcessingService(processingsUrl);
160179
var info = new ol.control.Control({element: popup});
161180
info.setMap(map);
@@ -185,7 +204,7 @@ <h3 class="panel-title">区域汇总分析</h3>
185204
}
186205
var summaryRegionJobParameter = new SuperMap.SummaryRegionJobParameter({
187206
datasetName: $('#datasetName').val(),
188-
regionDataset: $('#type option:selected').attr('value') === 'SUMMARYREGION' ? $('#datasetName').val() : undefined,
207+
regionDataset: $('#regionDataset').val(),
189208
type: $('#type option:selected').attr('value'),
190209
meshType: $('#meshType option:selected').attr('value'),
191210
query: getQuery(),

0 commit comments

Comments
 (0)