clickedPointsArr = []; draw_mapOnClick = map.on("click", getmappoints); totalsegmentlength = 0; linelenMouseEvt = dojo.connect(map, "onMouseMove", function (evt) { if (clickedPointsArr.length > 0) { var distParams = new esri.tasks.DistanceParameters(); distParams.distanceUnit = esri.tasks.GeometryService[dojo.byId("draw_PerimeterUnitDrpDwn").value]; distParams.geometry1 = clickedPointsArr[clickedPointsArr.length - 1]; distParams.geometry2 = mp; distParams.geodesic = true; gsvc.distance(distParams, function (distance) { dojo.byId("draw_AreaTxtBx").value = parseFloat(distance).toFixed(2); //last drawn segment length lastdrawnsegmentlength = distance; totalsegmentlength = previousSegmentLength; totalsegmentlength = totalsegmentlength + lastdrawnsegmentlength; dojo.byId("draw_PerimeterTxtBx").value = parseFloat(totalsegmentlength).toFixed(2); //total segment length }); function getmappoints(evt) { try { clickedPointsArr.push(evt.mapPoint); if (clickedPointsArr.length > 1) { previousSegmentLength = totalsegmentlength; } } catch (e) { var err = e; } }
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.