您好,新版本的iMobile是有量算高度的方法的,sceneControl.addTrackingListener(Tracking3DListener listener),通过监听事件获取高度值
可以走addTrackingListener 回调呢,在回调里面写获取高度的方法:
if(m_sceneControl.getAction() == Action3D.MEASUREALTITUDE3D){ Point3D point3d = new Point3D(event.getX(), event.getY(), event.getZ()); double length = event.getCurrentHeight(); Point3D point3d1 = new Point3D(point3d.getX(), point3d.getY(), point3d.getZ() + event.getCurrentHeight()); Point3D[] p = {point3d, point3d1}; Point3Ds point3Ds = new Point3Ds(p); GeoLine3D geoLine3D = new GeoLine3D(point3Ds); GeoStyle3D geoStyle3D = new GeoStyle3D(); geoStyle3D.setLineWidth(15); geoStyle3D.setFillForeColor(new Color(255, 125, 0)); geoStyle3D.setLineColor(new Color(255, 125, 0)); geoStyle3D.setAltitudeMode(AltitudeMode.ABSOLUTE); geoLine3D.setStyle3D(geoStyle3D); double totalaltitude = event.getCurrentHeight(); m_sceneControl.getScene().getTrackingLayer().add(geoLine3D, "高度"); Toast.makeText(MainActivity.this, "共计" + totalaltitude + "米", Toast.LENGTH_LONG).show(); }
我这真不走 回调 啊 断点都不进 版本是 com.supermap.realspace_v1012.jar apk也卸载了 缓存也清了 什么原因
// 开启距离测量分析 public void startMeasureAnalysis() { dataBinding.SceneControl.setAction(Action3D.MEASUREDISTANCE3D); } // 开启高度测量分析 public void startMeasureHeight() { dataBinding.SceneControl.setAction(Action3D.MEASUREALTITUDE3D); } // 开启测量面积分析 public void startSurearea() { dataBinding.SceneControl.setAction(Action3D.MEASUREAREA3D); }
/** * 事件交互监听 */ public void initAnalySis(SceneControl sceneControl, Tracking3DEvent event) { mData.myMesurePoint.add(new Point3D(event.getX(), event.getY(), event.getZ())); if (sceneControl.getAction() == Action3D.MEASUREDISTANCE3D) { //测量距离 measureDistance(event); } else if (sceneControl.getAction() == Action3D.MEASUREALTITUDE3D) { Point3D point3d = new Point3D(event.getX(), event.getY(), event.getZ()); double length = event.getCurrentHeight(); Point3D point3d1 = new Point3D(point3d.getX(), point3d.getY(), point3d.getZ() + event.getCurrentHeight()); Point3D[] p = {point3d, point3d1}; Point3Ds point3Ds = new Point3Ds(p); GeoLine3D geoLine3D = new GeoLine3D(point3Ds); GeoStyle3D geoStyle3D = new GeoStyle3D(); geoStyle3D.setLineWidth(15); geoStyle3D.setFillForeColor(new Color(255, 125, 0)); geoStyle3D.setLineColor(new Color(255, 125, 0)); geoStyle3D.setAltitudeMode(AltitudeMode.ABSOLUTE); geoLine3D.setStyle3D(geoStyle3D); double totalaltitude = event.getCurrentHeight(); sceneControl.getScene().getTrackingLayer().add(geoLine3D, "高度"); Toast.makeText(MainActivity.this, "共计" + totalaltitude + "米", Toast.LENGTH_LONG).show(); // measureHeight(event); } else if (sceneControl.getAction() == Action3D.MEASUREAREA3D) { //测量面积 measureSurearea(event); } }