Skip to content

Commit 21c9816

Browse files
update geometryAnalysis doc and example
1 parent 0158577 commit 21c9816

12 files changed

+105
-116
lines changed

examples/leaflet/ugc_computeGeodesicArea.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ <h5 class="panel-title text-center">计算经纬度面积</h5>
9393
clearPopup();
9494
var geometryAnalysis = new L.supermap.GeometryAnalysis();
9595
var area;
96-
area = geometryAnalysis.computeGeodesicArea(polygon, 4326);
96+
area = geometryAnalysis.computeGeodesicArea(polygon);
9797
marker.bindPopup('面积为: ' + area).openPopup();
9898
}
9999

examples/leaflet/ugc_pointPositon.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,13 @@ <h5 class="panel-title text-center">点线关系</h5>
191191
}
192192
};
193193
const result = geometryAnalysis[positonFun](px, py, line);
194-
if (result.find) {
195-
pointResults.push({
196-
geometry: {
197-
type: 'Point',
198-
coordinates: result.values
199-
},
200-
type: 'Feature'
201-
});
202-
}
194+
pointResults.push({
195+
geometry: {
196+
type: 'Point',
197+
coordinates: result
198+
},
199+
type: 'Feature'
200+
});
203201
} else {
204202
pointLists.forEach((point) => {
205203
const [px, py] = point.geometry.coordinates;

examples/mapboxgl/ugc_computeGeodesicArea.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ <h5 class="panel-title text-center">计算经纬度面积</h5>
105105
clearPopup();
106106
var geometryAnalysis = new mapboxgl.supermap.GeometryAnalysis();
107107
var area;
108-
area = geometryAnalysis.computeGeodesicArea(polygon, 4326);
108+
area = geometryAnalysis.computeGeodesicArea(polygon);
109109
popup = new mapboxgl.Popup()
110110
.setLngLat([121, 31])
111111
.setHTML('面积为: ' + area)

examples/mapboxgl/ugc_pointPositon.html

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,7 @@ <h5 class="panel-title text-center">点线关系</h5>
161161
for (let j = i + 1; j < pointLists.length; j++) {
162162
const [px1, py1] = pointLists[i].geometry.coordinates;
163163
const [px2, py2] = pointLists[j].geometry.coordinates;
164-
const booleanResult = geometryAnalysis['isOnSameSide'](
165-
px1,
166-
py1,
167-
px2,
168-
py2,
169-
spx,
170-
spy,
171-
epx,
172-
epy
173-
);
164+
const booleanResult = geometryAnalysis['isOnSameSide'](px1, py1, px2, py2, spx, spy, epx, epy);
174165
if (booleanResult) {
175166
pointResults.push(pointLists[i], pointLists[j]);
176167
}
@@ -203,18 +194,23 @@ <h5 class="panel-title text-center">点线关系</h5>
203194
}
204195
};
205196
const result = geometryAnalysis[positonFun](px, py, line);
206-
if (result.find) {
207-
addLayer('nearestPoint', 'circle', [{
208-
type: 'Feature',
209-
geometry: {
210-
type: 'Point',
211-
coordinates: result.values
197+
addLayer(
198+
'nearestPoint',
199+
'circle',
200+
[
201+
{
202+
type: 'Feature',
203+
geometry: {
204+
type: 'Point',
205+
coordinates: result
206+
}
207+
}
208+
],
209+
{
210+
'circle-radius': 6,
211+
'circle-color': 'green'
212212
}
213-
}], {
214-
'circle-radius': 6,
215-
'circle-color': 'green'
216-
});
217-
}
213+
);
218214
} else {
219215
pointLists.forEach((point) => {
220216
const [px, py] = point.geometry.coordinates;

examples/maplibregl/ugc_computeGeodesicArea.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ <h5 class="panel-title text-center">计算经纬度面积</h5>
105105
clearPopup();
106106
var geometryAnalysis = new maplibregl.supermap.GeometryAnalysis();
107107
var area;
108-
area = geometryAnalysis.computeGeodesicArea(polygon, 4326);
108+
area = geometryAnalysis.computeGeodesicArea(polygon);
109109
popup = new maplibregl.Popup()
110110
.setLngLat([121, 31])
111111
.setHTML('面积为: ' + area)

examples/maplibregl/ugc_pointPositon.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,16 @@ <h5 class="panel-title text-center">点线关系</h5>
203203
}
204204
};
205205
const result = geometryAnalysis[positonFun](px, py, line);
206-
if (result.find) {
207206
addLayer('nearestPoint', 'circle', [{
208207
type: 'Feature',
209208
geometry: {
210209
type: 'Point',
211-
coordinates: result.values
210+
coordinates: result
212211
}
213212
}], {
214213
'circle-radius': 6,
215214
'circle-color': 'green'
216215
});
217-
}
218216
} else {
219217
pointLists.forEach((point) => {
220218
const [px, py] = point.geometry.coordinates;

examples/openlayers/ugc_computeGeodesicArea.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ <h5 class="panel-title text-center">计算经纬度面积</h5>
152152
function search() {
153153
var geometryAnalysis = new ol.supermap.GeometryAnalysis();
154154
var area;
155-
area = geometryAnalysis.computeGeodesicArea(polygon, 4326);
155+
area = geometryAnalysis.computeGeodesicArea(polygon);
156156
var innerHTML = '面积为: ' + area;
157157
content.innerHTML = innerHTML;
158158
overlay.setPosition([121, 31]);

examples/openlayers/ugc_pointPositon.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,13 @@ <h5 class="panel-title text-center">点线关系</h5>
172172
}
173173
};
174174
const result = geometryAnalysis[positonFun](px, py, line);
175-
if (result.find) {
176-
pointResults.push({
177-
geometry: {
178-
type: 'Point',
179-
coordinates: result.values
180-
},
181-
type: 'Feature'
182-
});
183-
}
175+
pointResults.push({
176+
geometry: {
177+
type: 'Point',
178+
coordinates: result
179+
},
180+
type: 'Feature'
181+
});
184182
} else {
185183
pointLists.forEach((point) => {
186184
const [px, py] = point.geometry.coordinates;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy