private void render(Feature f) { VectorObject shape = gfxUtil.toShape(f.getGeometry()); String type = f.getGeometry().getGeometryType(); if (Geometry.POINT.equals(type) || Geometry.MULTI_POINT.equals(type)) { gfxUtil.applyStroke(shape, pointStyle.getStrokeColor(), pointStyle.getStrokeOpacity(), pointStyle.getStrokeWidth(), pointStyle.getDashArray()); gfxUtil.applyFill(shape, pointStyle.getFillColor(), pointStyle.getFillOpacity()); } else if (Geometry.LINE_STRING.equals(type) || Geometry.MULTI_LINE_STRING.equals(type)) { gfxUtil.applyStroke(shape, lineStyle.getStrokeColor(), lineStyle.getStrokeOpacity(), lineStyle.getStrokeWidth(), lineStyle.getDashArray()); } else { gfxUtil.applyStroke(shape, ringStyle.getStrokeColor(), ringStyle.getStrokeOpacity(), ringStyle.getStrokeWidth(), ringStyle.getDashArray()); gfxUtil.applyFill(shape, ringStyle.getFillColor(), ringStyle.getFillOpacity()); } container.add(shape); shapes.put(f.getId(), shape); }
private void update(GeometryIndex index, boolean moveToBack) { try { VectorObject shape = null; if (index == null) { shape = nullShape; } else { shape = shapes.get(index); } if (shape != null) { // We don't consider position at this point. Just style: FeatureStyleInfo style = styleFactory.create(editService, index); gfxUtil.applyStroke(shape, style.getStrokeColor(), style.getStrokeOpacity(), style.getStrokeWidth(), style.getDashArray()); gfxUtil.applyFill(shape, style.getFillColor(), style.getFillOpacity()); // Now update the location: shapeFactory.update(shape, editService, index); // Move to the front if requested: if (moveToBack) { container.moveToBack(shape); } } } catch (GeometryIndexNotFoundException e) { throw new IllegalStateException(e); } }
private FeatureStyleInfo mergeStyle(FeatureStyleInfo base, FeatureStyleInfo extension) { FeatureStyleInfo merged = new FeatureStyleInfo(); merged.setDashArray(extension.getDashArray() != null ? extension.getDashArray() : base.getDashArray()); merged.setFillColor(extension.getFillColor() != null ? extension.getFillColor() : base.getFillColor()); merged.setFillOpacity(extension.getFillOpacity() != -1 ? extension.getFillOpacity() : base.getFillOpacity()); merged.setStrokeColor(extension.getStrokeColor() != null ? extension.getStrokeColor() : base.getStrokeColor()); merged.setStrokeOpacity(extension.getStrokeOpacity() != -1 ? extension.getStrokeOpacity() : base .getStrokeOpacity()); merged.setSymbol(extension.getSymbol() != null ? extension.getSymbol() : base.getSymbol()); merged.setStrokeWidth(extension.getStrokeWidth() != -1 ? extension.getStrokeWidth() : base.getStrokeWidth()); return merged; }
private void drawIndex(GeometryIndex index) throws GeometryIndexNotFoundException { VectorObject shape = shapeFactory.create(editService, index); if (shape == null) { return; } // Apply style: FeatureStyleInfo style = styleFactory.create(editService, index); gfxUtil.applyStroke(shape, style.getStrokeColor(), style.getStrokeOpacity(), style.getStrokeWidth(), style.getDashArray()); gfxUtil.applyFill(shape, style.getFillColor(), style.getFillOpacity()); // Apply controller: MapController controller = controllerFactory.create(editService, index); if (controller != null) { controller.onActivate(mapPresenter); gfxUtil.applyController(shape, controller); } container.add(shape); if (index == null) { nullShape = shape; } else { shapes.put(index, shape); } }
Color strokeColor = context.getColor(style.getStrokeColor(), style.getStrokeOpacity()); float[] dashArray = context.getDashArray(style.getDashArray()); style = mergeStyle(style, map.getPolygonSelectStyle()); fillColor = context.getColor(style.getFillColor(), style.getFillOpacity()); strokeColor = context.getColor(style.getStrokeColor(), style.getStrokeOpacity()); } else if (f.getGeometry() instanceof MultiLineString || f.getGeometry() instanceof LineString) { style = mergeStyle(style, map.getLineSelectStyle()); strokeColor = context.getColor(style.getStrokeColor(), style.getStrokeOpacity()); } else if (f.getGeometry() instanceof MultiPoint || f.getGeometry() instanceof Point) { style = mergeStyle(style, map.getPointSelectStyle()); strokeColor = context.getColor(style.getStrokeColor(), style.getStrokeOpacity());
/** Clear everything and completely redraw the edited geometry. */ public void redraw() { previousDx = mapPresenter.getViewPort().getTransformationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN).getDx(); previousDy = mapPresenter.getViewPort().getTransformationMatrix(RenderSpace.WORLD, RenderSpace.SCREEN).getDy(); shapes.clear(); if (container != null) { container.setTranslation(0, 0); container.clear(); try { tentativeMoveLine = new Path(-5, -5); tentativeMoveLine.lineTo(-5, -5); FeatureStyleInfo style = styleProvider.getEdgeTentativeMoveStyle(); gfxUtil.applyStroke(tentativeMoveLine, style.getStrokeColor(), style.getStrokeOpacity(), style.getStrokeWidth(), style.getDashArray()); container.add(tentativeMoveLine); draw(); } catch (GeometryIndexNotFoundException e) { // Happens when creating new geometries...can't render points that don't exist yet. } } }
gfxUtil.applyStroke(top, style.getStrokeColor(), style.getStrokeOpacity(), style.getStrokeWidth(), style.getDashArray()); container.add(top); gfxUtil.applyStroke(right, style.getStrokeColor(), style.getStrokeOpacity(), style.getStrokeWidth(), style.getDashArray()); container.add(right); gfxUtil.applyStroke(bottom, style.getStrokeColor(), style.getStrokeOpacity(), style.getStrokeWidth(), style.getDashArray()); container.add(bottom); gfxUtil.applyStroke(left, style.getStrokeColor(), style.getStrokeOpacity(), style.getStrokeWidth(), style.getDashArray()); container.add(left);
if (styleInfo != null) { fillColor = context.getColor(styleInfo.getFillColor(), styleInfo.getFillOpacity(), Color.white); strokeColor = context.getColor(styleInfo.getStrokeColor(), styleInfo.getStrokeOpacity(), Color.black); dashArray = context.getDashArray(styleInfo.getDashArray());
/** * Copy constructor. Creates a deep copy of the specified {@link FeatureStyleInfo} object. * * @param other the feature style to copy * @since 1.10.0 */ public FeatureStyleInfo(FeatureStyleInfo other) { setDashArray(other.getDashArray()); setFillColor(other.getFillColor()); setFillOpacity(other.getFillOpacity()); setFormula(other.getFormula()); setLayerType(other.getLayerType()); setName(other.getName()); setStrokeColor(other.getStrokeColor()); setStrokeOpacity(other.getStrokeOpacity()); setStrokeWidth(other.getStrokeWidth()); setSymbol(new SymbolInfo(other.getSymbol())); }
SymbolizerTypeInfo symbolizer = null; StrokeInfo stroke = createStroke(featureStyle.getStrokeColor(), featureStyle.getStrokeWidth(), featureStyle.getStrokeOpacity(), featureStyle.getDashArray()); FillInfo fill = createFill(featureStyle.getFillColor(), featureStyle.getFillOpacity()); switch (type) {
if (labelType.getBackgroundStyle() != null) { borderColor = context.getColor(labelType.getBackgroundStyle().getStrokeColor(), labelType .getBackgroundStyle().getStrokeOpacity());