/** * Adds or substitutes a named polygonal surface shape. * * @param coords the points of the polygon outer boundary * @param id the shape identifier */ public void addSurfPoly(List<LatLon> coords, String id) { SurfacePolygon shape = new SurfacePolygon(coords); shape.setAttributes(attr); shape.setHighlightAttributes(attrHigh); if (id != null) { shape.setValue(AVKey.HOVER_TEXT, id); } // set this layer as custom property of the shape shape.setValue(AVKey.LAYER, this); SurfaceShape old = shapesById.put(id, shape); if (old != null) { removeRenderable(old); } addRenderable(shape); }
/** * 根据顶点集合来生成多边形 * * @param flag 为true时去掉外围的边框,为false时显示外围的边框 */ public void buildPolygon(boolean flag) { ArrayList<Position> pathPositions = new ArrayList<Position>(); for (Position pos : this.positions) { pathPositions.add(pos); } polygon.setOuterBoundary(pathPositions); this.addRenderable(polygon); if (!flag) { line.setPositions(this.positions); this.addRenderable(line); } }
@Override public void onMessage(Message message) { super.onMessage(message); if (KMLAbstractObject.MSG_STYLE_CHANGED.equals(message.getName())) { this.normalAttributesResolved = false; this.highlightAttributesResolved = false; if (this.getAttributes() != null) this.getAttributes().setUnresolved(true); if (this.getHighlightAttributes() != null) this.getHighlightAttributes().setUnresolved(true); } }
protected SurfacePolygon createPolygon(List<? extends LatLon> positions) { SurfacePolygon polygon = new SurfacePolygon(positions); polygon.setAttributes(this.getActiveShapeAttributes()); return polygon; }