/** * Uses the configuration found in the given {@link UniqueSymbolPoint} to configure the Stroke, * Fill and WKN of the attached ProportionalPoint. * * @param usp The input {@link UniqueSymbolPoint}. */ private void affectValues(UniqueSymbolPoint usp) { boolean strokeNotNull = !(usp.getPenStroke() instanceof NullPenStrokeLegend); boolean fillNotNull = !(usp.getFillLegend() instanceof NullSolidFillLegend); if (strokeNotNull) { if (proportionalPoint.getPenStroke() instanceof NullPenStrokeLegend) { proportionalPoint.setPenStroke(new ConstantPenStrokeLegend()); } proportionalPoint.getPenStroke().setLineColor(usp.getPenStroke().getLineColor()); proportionalPoint.getPenStroke().setLineOpacity(usp.getPenStroke().getLineOpacity()); proportionalPoint.getPenStroke().setLineWidth(usp.getPenStroke().getLineWidth()); proportionalPoint.getPenStroke().setDashArray(usp.getPenStroke().getDashArray()); } else { proportionalPoint.setPenStroke(new NullPenStrokeLegend()); } if (fillNotNull) { if (proportionalPoint.getFillLegend() instanceof NullSolidFillLegend) { proportionalPoint.setFillLegend(new ConstantSolidFillLegend(new SolidFill())); } proportionalPoint.getFillLegend().setColor(usp.getFillLegend().getColor()); proportionalPoint.getFillLegend().setOpacity(usp.getFillLegend().getOpacity()); } else { proportionalPoint.setFillLegend(new NullSolidFillLegend()); } proportionalPoint.setWellKnownName(usp.getWellKnownName()); }
/** Opens a OK - Cancel window used to edit the symbol configuration, size excepted. */ public void onClickOnPreview(MouseEvent mouseEvent) { // We create a copy of the constant part of the symbol PointParameters pp = new PointParameters( proportionalPoint.getPenStroke().getLineColor(), proportionalPoint.getPenStroke().getLineOpacity(), proportionalPoint.getPenStroke().getLineWidth(), proportionalPoint.getPenStroke().getDashArray(), proportionalPoint.getFillLegend().getColor(), proportionalPoint.getFillLegend().getOpacity(), 3.0, 3.0, proportionalPoint.getWellKnownName()); UniqueSymbolPoint usp = new UniqueSymbolPoint(pp); if (proportionalPoint.getPenStroke() instanceof NullPenStrokeLegend) { usp.setPenStroke(new NullPenStrokeLegend()); } if (proportionalPoint.getFillLegend() instanceof NullSolidFillLegend) { usp.setFillLegend(new NullSolidFillLegend()); } usp.setStrokeUom(proportionalPoint.getStrokeUom()); usp.setSymbolUom(proportionalPoint.getSymbolUom()); ConfigPanel cp = new ConfigPanel(usp); if (UIFactory.showDialog(cp)) { affectValues(usp); getPreview().imageChanged(); } }