/** 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(); } }
/** * 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()); }
@Override public Component getComponent() { JPanel glob = new JPanel(new MigLayout("wrap 1")); // Update only a local preview until the changes are applied. // About #497 CanvasSE localPreview = new CanvasSE(usp.getSymbolizer()); glob.add(new LinePanel(usp, localPreview, I18N.tr(BORDER_SETTINGS), true, true)); glob.add(new AreaPanel(usp, localPreview, I18N.tr(FILL_SETTINGS), true)); glob.add(new PreviewPanel(localPreview)); return glob; }