首页 / 浏览问题 / 移动GIS / 问题详情
android 三维地图 绘制图形 过多导致卡顿问题
22EXP 2022年02月09日

android 在跟踪层绘制 点、线、面 过多导致卡顿  绘制了800条 就很卡了 平板配置是最新的 华为平板  以下是绘制代码 问下是代码问题 还是其他原因

if (point3Ds.getCount() > 1) {
            GeoStyle3D lineStyle3D = new GeoStyle3D();
            lineStyle3D.setLineColor(strokeColor);
            lineStyle3D.setAltitudeMode(AltitudeMode.ABSOLUTE);
            lineStyle3D.setLineWidth(Integer.parseInt(strokewidth));
            int r = 0, b = 0, g = 0, a;
            if (fillcolor != null) {
                r = fillcolor.getR();
                b = fillcolor.getB();
                g = fillcolor.getG();
            }
            a = (int) (256 * Double.parseDouble(fillopacity));
            lineStyle3D.setFillForeColor(new Color(0, 0, 0, 0));
//            lineStyle3D.setFillForeColor(new Color(r, g, b, a));
            GeoRegion3D geoRegion3D = new GeoRegion3D();
            geoRegion3D.addPart(point3Ds);
            geoRegion3D.setStyle3D(lineStyle3D);
            GeoPlacemark geoPlacemark = new GeoPlacemark("UntitledFeature3D", geoRegion3D);
            Point3D innerPoint3D = geoRegion3D.getInnerPoint3D();
            drawText(name, innerPoint3D);
            if (isOne) {
                innerPoint3D.setZ(dataBinding.SceneControl.getScene().getCamera().getAltitude());
                dataBinding.SceneControl.getScene().flyToPoint(innerPoint3D, 500);
            }

            dataBinding.SceneControl.getScene().getTrackingLayer().add(geoPlacemark, "geoline");
//            //添加临时 kml图层数据
//            features.add(geoPlacemark);

            lineStyle3D.dispose();
            geoRegion3D.dispose();
            geoPlacemark.dispose();
        }
/**
     * 画文字
     */
    private void drawText(String text, Point3D point3D) {
        TextStyle textStyle = new TextStyle();
        textStyle.setForeColor(ColorUtil.html2Rgb("#ffffff"));
        textStyle.setAlignment(TextAlignment.MIDDLECENTER);
        textStyle.setFontScale(0.75);
        textStyle.setOutline(true);
        textStyle.setSizeFixed(false);
        textStyle.setBackColor(ColorUtil.html2Rgb("#29FF3E"));
        textStyle.getFontWidth();
        TextPart3D textPart3D = new TextPart3D();
        textPart3D.setText(text);
//        textPart3D.setAnchorPoint(point3D);
        textPart3D.setX(point3D.getX());
        textPart3D.setY(point3D.getY());
        textPart3D.setZ(point3D.getZ());

        GeoText3D geoText3D = new GeoText3D(textPart3D);
        geoText3D.setTextStyle(textStyle);

        GeoPlacemark geoPlacemark = new GeoPlacemark("UntitledFeature3D", geoText3D);
        GeoStyle3D geoStyle3D = new GeoStyle3D();
        geoStyle3D.setAltitudeMode(AltitudeMode.RELATIVE_TO_GROUND);
        geoPlacemark.setStyle3D(geoStyle3D);
        dataBinding.SceneControl.getScene().getTrackingLayer().add(geoPlacemark, "geoText");

        textStyle.dispose();
        textPart3D.dispose();
        geoText3D.dispose();
        geoStyle3D.dispose();
        geoPlacemark.dispose();
    }

1个回答

你好,请问只是绘制了三维点、线、面吗?有没有添加模型呢?渲染完最后 获取下跟踪图层里面的总要素有多少呢(getCount() )?然后还请提供一下您的imb for Android的版本
2,842EXP 2022年02月09日
版本用的v1020   getCount() 方法获取到 3050个  目前没有添加模型
...