File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 5353 map . addControl ( draw , "top-left" ) ;
5454
5555 function updateArea ( e ) {
56- var data = draw . getAll ( ) ;
57- var current = data . features [ data . features . length - 1 ] ;
56+ var data = new SuperMap . MeasureParameters ( draw . getAll ( ) ) ;
57+ //获取当前画的图形的数据
58+ var current = data . geometry . features [ data . geometry . features . length - 1 ] ;
5859 new mapboxgl . supermap . MeasureService ( url ) . measureArea ( current , function ( serviceResult ) {
5960 var area = serviceResult . result . area ;
6061 var rounded_area = Math . round ( area * 100 ) / 100 ;
Original file line number Diff line number Diff line change 1111< script type ="text/javascript ">
1212 mapboxgl . accessToken = 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA' ;
1313 var alertDiv ,
14- host = window . isLocal ? document . location . protocol + "//" + document . location . host : "http://117.122.248.69 :8090" ;
14+ host = window . isLocal ? document . location . protocol + "//" + document . location . host : "http://support.supermap.com.cn :8090" ;
1515 var url = host + "/iserver/services/map-world/rest/maps/World" ;
1616 var attribution = "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
1717 "| Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> " + " with <span>© <a href='http://iclient.supermapol.com' target='_blank'>SuperMap iClient</a></span>" ;
5555 map . addControl ( draw , "top-left" ) ;
5656
5757 function updateArea ( e ) {
58- var data = draw . getAll ( ) ;
59- var current = data . features [ data . features . length - 1 ] ;
58+
59+ var data = new SuperMap . MeasureParameters ( draw . getAll ( ) ) ;
60+ //获取当前画的图形的数据
61+ var current = data . geometry . features [ data . geometry . features . length - 1 ] ;
6062 new mapboxgl . supermap . MeasureService ( url ) . measureDistance ( current , function ( serviceResult ) {
6163 var distance = serviceResult . result . distance ;
6264 showAlert ( distance + "米" ) ;
You can’t perform that action at this time.
0 commit comments