还是在绘制第四个点的时候,sceneControl.getScene().getTrackingLayer().remove(index); 这句有问题,还是没有解决。
之前用的Tracking3DEvent,就只能绘制三个点,后续无响应,按照你们的解决办法换成了Tracked3DEvent
但是用Tracked3DEvent的时候,运行在这里就出问题了,断点测试在这断了,不走这里,不知道运行后不显示标注是不是和这个也有关系
private Tracked3DListener mTracked3dListener = new Tracked3DListener() {
@Override
public void tracked(Tracked3DEvent tracked3DEvent) {
initAnalySis1(sceneControl, tracked3DEvent);
Log.i("绘制完成", "监听结束");
}
};
这是Tracked3DEvent的测面代码
private void measureSurearea(Tracked3DEvent tracked3DEvent) {
// 加点
// 更新测量面积
double TotalArea = tracked3DEvent.getArea();
double totalcurrentlength = tracked3DEvent.getLength();
Message msg = new Message();
Bundle bundle = new Bundle();
bundle.putDouble("Area", Double.parseDouble(new DecimalFormat("############.##").format(TotalArea)));
msg.setData(bundle);
totalLengthHandler.sendMessage(msg);
Log.v("lzw", "TotalArea=" + TotalArea + ";" + "totalcurrentlength=" + totalcurrentlength);
//1.12
TextStyle textStyle = new TextStyle();
textStyle.setAlignment(TextAlignment.MIDDLECENTER);
textStyle.setFontScale(1);
if(TotalArea > 0.0) {
Point3D innerPoint3D = tracked3DEvent.getGeometry().getInnerPoint3D();
TextPart3D textPart3D2 = new TextPart3D();
textPart3D2.setX(innerPoint3D.getX());
textPart3D2.setY(innerPoint3D.getY());
textPart3D2.setZ(innerPoint3D.getZ());
textPart3D2.setText("共" + msg.getData().getDouble("Area") + "平方米");
Log.i("测试2", "textPart3D=" + textPart3D2.getText());
GeoText3D geoText3D = new GeoText3D(textPart3D2);
geoText3D.setTextStyle(textStyle);
GeoPlacemark geoPlacemark = new GeoPlacemark("3D", geoText3D);
sceneControl.getScene().getTrackingLayer().add(geoPlacemark, "面积");
}
}
想问一下还有什么解决办法