首页 / 浏览问题 / 移动GIS / 问题详情
测面绘制三个点后无法继续
29EXP 2022年02月17日

运行绘制时,绘制了三个点后,再无法添加点,并程序就开始无响应,其他功能也无法使用,想问一下是不是哪里有问题

    private int index = -1;
    private void measureSurearea(Tracking3DEvent tracking3DEvent) {

        double TotalArea = tracking3DEvent.getTotalArea();
        double totalcurrentlength = tracking3DEvent.getCurrentLength();


        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 = tracking3DEvent.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());
            if(index >= 0) {
                sceneControl.getScene().getTrackingLayer().remove(index);
            }

            GeoText3D geoText3D = new GeoText3D(textPart3D2);
            geoText3D.setTextStyle(textStyle);
            GeoPlacemark geoPlacemark = new GeoPlacemark("3D", geoText3D);

            index = sceneControl.getScene().getTrackingLayer().add(geoPlacemark, "面积");

        }

    }

1个回答

您好,您可以整理一个简单复现demo发到我的邮箱,我本地重现看下呢。邮箱 zhangliang@supermap.com
2,842EXP 2022年02月17日
好的,已经发过去了

代码在绘制第四个点时

if(index >= 0) {

    sceneControl.getScene().getTrackingLayer().remove(index);//断点终止
}

这个地方没出来,建议用tracked3DEcent,绘制完成时计算面积


那如果不用tracked3DEcent的话,就没办法了吗
...