|
25 | 25 | } |
26 | 26 | function initFeature() { |
27 | 27 | var polygon = L.polygon([[10, 100], [10, 124], [40, 124], [40, 100], [10, 100]]); |
28 | | - L.supermap.getFeaturesService(url).getFeaturesByGeometry({ |
| 28 | + var getFeatureParams = new GetFeaturesByGeometryParameters({ |
29 | 29 | datasetNames: ["World:Capitals"], |
30 | 30 | geometry: polygon, |
31 | 31 | spatialQueryMode: "INTERSECT" |
32 | | - }).on("complete", function (serviceResult) { |
| 32 | + }); |
| 33 | + L.supermap.getFeaturesService(url).getFeaturesByGeometry(getFeatureParams).on("complete", function (serviceResult) { |
33 | 34 | resultLayer = L.geoJSON(serviceResult.result, { |
34 | 35 | onEachFeature: function (feature, layer) { |
35 | 36 | layer.bindPopup("首都:" + feature.properties.CAPITAL); |
|
53 | 54 | function commit() { |
54 | 55 | var me = this; |
55 | 56 | if (featureGroup.hasLayer(marker)) { |
56 | | - L.supermap.editFeaturesService(urlCapital).editFeatures({ |
| 57 | + var addFeatureParams = new EditFeaturesParameters({ |
57 | 58 | features: marker, |
58 | 59 | editType: "add", |
59 | 60 | returnContent: true |
60 | | - }).on("complete", function (serviceResult) { |
| 61 | + }); |
| 62 | + L.supermap.editFeaturesService(urlCapital).editFeatures(addFeatureParams).on("complete", function (serviceResult) { |
61 | 63 | if (serviceResult.result.succeed) { |
62 | 64 | id = serviceResult.result[0]; |
63 | 65 | featureGroup.removeFrom(map); |
|
75 | 77 | return; |
76 | 78 | } |
77 | 79 | if (id) { |
78 | | - L.supermap.editFeaturesService(urlCapital).editFeatures({ |
| 80 | + var deleteParams = new EditFeaturesParameters({ |
79 | 81 | IDs: [id], |
80 | 82 | editType: "delete" |
81 | | - }).on("complete", function (serviceResult) { |
| 83 | + }); |
| 84 | + L.supermap.editFeaturesService(urlCapital).editFeatures(deleteParams).on("complete", function (serviceResult) { |
82 | 85 | if (serviceResult.result.succeed) { |
83 | 86 | resultLayer.removeFrom(map); |
84 | 87 | me.initFeature(); |
|
89 | 92 | } |
90 | 93 | if (featureGroup && featureGroup.hasLayer(marker)) { |
91 | 94 | featureGroup.removeLayer(marker); |
92 | | - marker=null; |
| 95 | + marker = null; |
93 | 96 | } |
94 | 97 | } |
95 | 98 | </script> |
|
0 commit comments