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();
}