org.opengis.style.GraphicalSymbol Java Examples

The following examples show how to use org.opengis.style.GraphicalSymbol. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StyleConverterServiceImpl.java    From geomajas-project-server with GNU Affero General Public License v3.0 6 votes vote down vote up
private GraphicalSymbol createSymbol(FeatureStyleInfo featureStyle) throws LayerException {
	SymbolInfo info = featureStyle.getSymbol();
	if (info.getImage() != null) {

		return styleBuilder.createExternalGraphic(getUrl(info.getImage().getHref()), getFormat(info.getImage()
				.getHref()));
	} else {
		Mark mark;
		if (info.getRect() != null) {
			// TODO: do rectangles by adding custom factory ?
			mark = styleBuilder.createMark(MARK_SQUARE);
		} else if (info.getCircle() != null) {
			mark = styleBuilder.createMark(MARK_CIRCLE);
		} else {
			throw new IllegalArgumentException(
					"Feature style should have either an image, a circle or a rectangle defined. Style name: " +
							featureStyle.getName() + ", index: " + featureStyle.getIndex());
		}
		mark.setFill(createFill(featureStyle));
		mark.setStroke(createStroke(featureStyle));
		return mark;
	}
}
 
Example #2
Source File: FieldConfigWKT.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Accept.
 *
 * @param symbol the symbol
 * @return true, if successful
 */
@Override
public boolean accept(GraphicalSymbol symbol) {
    if (symbol != null) {
        if (symbol instanceof MarkImpl) {
            MarkImpl marker = (MarkImpl) symbol;

            Expression expression = marker.getWellKnownName();

            if (expression instanceof LiteralExpressionImpl) {
                LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression;

                Object value = lExpression.getValue();
                if (value instanceof String) {
                    String valueString = (String) value;

                    if (valueString.startsWith(WKT_PREFIX)) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
 
Example #3
Source File: FieldConfigArrow.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Accept.
 *
 * @param symbol the symbol
 * @return true, if successful
 */
@Override
public boolean accept(GraphicalSymbol symbol) {
    if (symbol instanceof MarkImpl) {
        MarkImpl marker = (MarkImpl) symbol;

        Expression expression = marker.getWellKnownName();

        if (expression instanceof LiteralExpressionImpl) {
            LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression;

            Object value = lExpression.getValue();
            if (value instanceof String) {
                String valueString = (String) value;

                if (valueString.startsWith(ArrowUtils.getArrowPrefix())) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #4
Source File: WindBarbDetails.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Gets the well known name.
 *
 * @param symbolizer the symbolizer
 * @return the well known name
 */
private Expression getWellKnownName(Symbolizer symbolizer) {
    Expression wellKnownName = null;
    if (symbolizer instanceof PointSymbolizerImpl) {
        PointSymbolizerImpl point = (PointSymbolizerImpl) symbolizer;

        List<GraphicalSymbol> graphicalSymbolList = point.getGraphic().graphicalSymbols();
        if ((graphicalSymbolList != null) && !graphicalSymbolList.isEmpty()) {
            GraphicalSymbol graphicalSymbol = graphicalSymbolList.get(0);

            if (graphicalSymbol instanceof MarkImpl) {
                MarkImpl mark = (MarkImpl) graphicalSymbol;

                wellKnownName = mark.getWellKnownName();
            }
        }
    }
    return wellKnownName;
}
 
Example #5
Source File: FieldConfigWindBarbs.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the value.
 *
 * @param symbolizerType the symbolizer type
 * @param fieldConfigManager the field config manager
 * @param multiOptionPanel the multi option panel
 * @param graphic the graphic
 * @param symbol the symbol
 */
@Override
public void setValue(
        Class<?> symbolizerType,
        GraphicPanelFieldManager fieldConfigManager,
        FieldConfigSymbolType multiOptionPanel,
        Graphic graphic,
        GraphicalSymbol symbol) {
    if (symbol != null) {
        if (symbol instanceof Mark) {
            MarkImpl markerSymbol = (MarkImpl) symbol;

            if (getConfigField() != null) {
                getConfigField().populate(markerSymbol.getWellKnownName());
            }

            if (multiOptionPanel != null) {
                multiOptionPanel.setSelectedItem(WINDBARB_SYMBOL_KEY);
            }
        }
    }
}
 
Example #6
Source File: FieldConfigWindBarbs.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Accept.
 *
 * @param symbol the symbol
 * @return true, if successful
 */
@Override
public boolean accept(GraphicalSymbol symbol) {
    if (symbol != null) {
        if (symbol instanceof MarkImpl) {
            MarkImpl marker = (MarkImpl) symbol;

            Expression expression = marker.getWellKnownName();

            if (expression instanceof LiteralExpressionImpl) {
                LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression;

                Object value = lExpression.getValue();
                if (value instanceof String) {
                    String valueString = (String) value;

                    if (valueString.startsWith(WINDBARBS_PREFIX)) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
 
Example #7
Source File: FieldConfigTTF.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Accept.
 *
 * @param symbol the symbol
 * @return true, if successful
 */
@Override
public boolean accept(GraphicalSymbol symbol) {
    if (symbol != null) {
        if (symbol instanceof MarkImpl) {
            MarkImpl marker = (MarkImpl) symbol;

            Expression expression = marker.getWellKnownName();

            if (expression instanceof LiteralExpressionImpl) {
                LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression;

                Object value = lExpression.getValue();
                if (value instanceof String) {
                    String valueString = (String) value;

                    if (valueString.startsWith(TTF_PREFIX)) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
 
Example #8
Source File: SLDTreeLeafPoint.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Fill getFill(Symbolizer symbolizer) {
    if (symbolizer instanceof PointSymbolizer) {
        PointSymbolizer point = (PointSymbolizer) symbolizer;
        Graphic graphic = point.getGraphic();

        if (graphic != null) {
            List<GraphicalSymbol> symbolList = graphic.graphicalSymbols();

            if ((symbolList != null) && !symbolList.isEmpty()) {
                GraphicalSymbol obj = symbolList.get(0);

                if (obj instanceof MarkImpl) {
                    MarkImpl mark = (MarkImpl) obj;

                    return mark.getFill();
                }
            }
        }
    }
    return null;
}
 
Example #9
Source File: FieldConfigMarker.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Accept.
 *
 * @param symbol the symbol
 * @return true, if successful
 */
@Override
public boolean accept(GraphicalSymbol symbol) {
    if (symbol instanceof MarkImpl) {
        MarkImpl marker = (MarkImpl) symbol;

        Expression expression = marker.getWellKnownName();

        if (expression instanceof LiteralExpressionImpl) {
            LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression;

            Object value = lExpression.getValue();
            if (value instanceof String) {
                String valueString = (String) value;

                List<ValueComboBoxData> localSymbolList = getLocalSymbolList();
                for (ValueComboBoxData data : localSymbolList) {
                    if (data.getKey().compareTo(valueString) == 0) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
 
Example #10
Source File: FieldConfigFilenameTest.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Test method for {@link
 * com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#getValue(com.sldeditor.ui.detail.GraphicPanelFieldManager,
 * org.opengis.filter.expression.Expression, boolean, boolean)}.
 */
@Test
public void testGetValue() {
    boolean valueOnly = true;
    FieldConfigFilename field =
            new FieldConfigFilename(
                    new FieldConfigCommonData(
                            String.class, FieldIdEnum.NAME, "test label", valueOnly, false),
                    null,
                    null,
                    null);

    assertNull(field.getValue(null, null, false, false));

    field.createUI();
    List<GraphicalSymbol> actualValue = field.getValue(null, null, false, false);
    assertFalse(actualValue.isEmpty());
}
 
Example #11
Source File: FieldConfigFilename.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sets the value.
 *
 * @param symbolizerType the symbolizer type
 * @param fieldConfigManager the field config manager
 * @param multiOptionPanel the multi option panel
 * @param graphic the graphic
 * @param symbol the symbol
 */
@Override
public void setValue(
        Class<?> symbolizerType,
        GraphicPanelFieldManager fieldConfigManager,
        FieldConfigSymbolType multiOptionPanel,
        Graphic graphic,
        GraphicalSymbol symbol) {
    if (symbol instanceof ExternalGraphicImpl) {
        ExternalGraphicImpl markerSymbol = (ExternalGraphicImpl) symbol;

        if (externalGraphicPanel != null) {
            externalGraphicPanel.setValue(markerSymbol);
        }

        if (multiOptionPanel != null) {
            multiOptionPanel.setSelectedItem(EXTERNAL_SYMBOL_KEY);
        }

        FieldConfigBase opacity = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
        if (opacity != null) {
            opacity.populate(graphic.getOpacity());
        }
    }
}
 
Example #12
Source File: SelectedSymbolTest.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Test method for {@link
 * com.sldeditor.common.data.SelectedSymbol#getSymbolList(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testGetSymbolList() {

    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    FilterFactory ff = CommonFactoryFinder.getFilterFactory();

    Stroke stroke = null;
    Fill fill = styleFactory.createFill(ff.literal(DefaultSymbols.defaultColour()));
    GraphicalSymbol symbolToAdd = styleFactory.mark(ff.literal("circle"), fill, stroke);

    List<GraphicalSymbol> symbolList = SelectedSymbol.getInstance().getSymbolList(symbolToAdd);

    assertEquals(1, symbolList.size());

    assertEquals(symbolToAdd, symbolList.get(0));
}
 
Example #13
Source File: LineSymbolizerWrapper.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
private void initEndPointSymbolizers() {
    for( Symbolizer x : super.getParent().getRule().getSymbolizers() ) {
        if (x instanceof PointSymbolizer) {
            PointSymbolizer pnt = (PointSymbolizer) x;
            Expression ex = pnt.getGeometry();
            boolean endpnt = ex instanceof FilterFunction_endPoint;
            boolean startpnt = ex instanceof FilterFunction_startPoint;
            if (endpnt || startpnt) {
                GraphicalSymbol gs = pnt.getGraphic().graphicalSymbols().get(0);
                if (gs instanceof Mark) {
                    String name = ((Mark) gs).getWellKnownName().evaluate(null, String.class);
                    if (StyleUtilities.lineEndStyles.values().contains(name)) {
                        if (endpnt) {
                            endPointStyle = new PointSymbolizerWrapper(pnt, super.getParent());
                        } else if (startpnt) {
                            startPointStyle = new PointSymbolizerWrapper(pnt, super.getParent());
                        }
                    }
                }
            }
        }
    }
}
 
Example #14
Source File: RuleDetails.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param existingRule
 * @return
 */
private Graphic[] updateLegend(org.geotools.styling.Rule existingRule) {
    int index;
    GraphicLegend existingLegend = existingRule.getLegend();
    Graphic[] legendGraphics = null;

    if (existingLegend != null) {
        int legendGraphicCount = existingLegend.graphicalSymbols().size();
        legendGraphics = new Graphic[legendGraphicCount];

        index = 0;
        for (GraphicalSymbol graphicalSymbol : existingLegend.graphicalSymbols()) {
            legendGraphics[index] = (Graphic) graphicalSymbol;
            index++;
        }
    } else {
        legendGraphics = new Graphic[0];
    }
    return legendGraphics;
}
 
Example #15
Source File: SLDTreeLeafPointTest.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Test method for {@link
 * com.sldeditor.common.tree.leaf.SLDTreeLeafPoint#getFill(org.opengis.style.Symbolizer)}.
 */
@Test
public void testGetFill() {
    SLDTreeLeafPoint leaf = new SLDTreeLeafPoint();
    assertNull(leaf.getFill(null));
    assertNull(leaf.getFill(DefaultSymbols.createDefaultPolygonSymbolizer()));

    PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer();

    Fill expectedFill = null;
    Graphic graphic = pointSymbolizer.getGraphic();

    if (graphic != null) {
        List<GraphicalSymbol> symbolList = graphic.graphicalSymbols();

        if ((symbolList != null) && !symbolList.isEmpty()) {
            GraphicalSymbol obj = symbolList.get(0);

            if (obj != null) {
                if (obj instanceof MarkImpl) {
                    MarkImpl mark = (MarkImpl) obj;

                    expectedFill = mark.getFill();
                }
            }
        }
    }

    assertEquals(expectedFill, leaf.getFill(pointSymbolizer));
}
 
Example #16
Source File: UpdateGraphicalSymbol.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void processGraphicalSymbol(
        URL resourceLocator,
        List<GraphicalSymbol> graphicalSymbolList,
        List<String> externalImageList) {
    for (GraphicalSymbol symbol : graphicalSymbolList) {
        if (symbol instanceof ExternalGraphic) {
            ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) symbol;
            OnLineResourceImpl onlineResource =
                    (OnLineResourceImpl) externalGraphic.getOnlineResource();

            String currentValue = null;
            URL currentValueURL = null;
            try {
                currentValueURL = onlineResource.getLinkage().toURL();
                currentValue = currentValueURL.toExternalForm();
            } catch (MalformedURLException e) {
                ConsoleManager.getInstance().exception(SLDExternalImages.class, e);
            }

            if (currentValueURL != null) {
                processExternalImage(
                        resourceLocator,
                        externalImageList,
                        externalGraphic,
                        currentValue,
                        currentValueURL);
            }
        }
    }
}
 
Example #17
Source File: SelectedSymbol.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the symbol list.
 *
 * @param symbolToAdd the symbol to add
 * @return the symbol list
 */
public List<GraphicalSymbol> getSymbolList(GraphicalSymbol symbolToAdd) {
    List<GraphicalSymbol> symbolList = new ArrayList<>();

    symbolList.add(symbolToAdd);

    return symbolList;
}
 
Example #18
Source File: SLDExternalImagesTest.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the graphic.
 *
 * @param url the url
 * @param styleFactory the style factory
 * @return the graphic
 */
private Graphic createGraphic(URL url, StyleFactory styleFactory) {
    List<GraphicalSymbol> symbolList = new ArrayList<GraphicalSymbol>();
    ExternalGraphic externalGraphic = styleFactory.createExternalGraphic(url, "image/png");
    symbolList.add(externalGraphic);
    Graphic graphicFill = styleFactory.graphicFill(symbolList, null, null, null, null, null);
    return graphicFill;
}
 
Example #19
Source File: DefaultSymbols.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the default point symbolizer.
 *
 * @return the point symbolizer
 */
public static PointSymbolizer createDefaultPointSymbolizer() {
    String geometryFieldName = null;
    Expression geometryField = ff.property(geometryFieldName);

    List<GraphicalSymbol> symbolList = new ArrayList<>();

    Stroke stroke = null;
    AnchorPoint anchorPoint = null;
    Displacement displacement = null;
    Fill fill = styleFactory.createFill(ff.literal(DEFAULT_MARKER_COLOUR));
    GraphicalSymbol symbol = styleFactory.mark(ff.literal(DEFAULT_MARKER_SYMBOL), fill, stroke);

    symbolList.add(symbol);
    Graphic graphic =
            styleFactory.graphic(
                    symbolList,
                    ff.literal(DEFAULT_COLOUR_OPACITY),
                    ff.literal(DEFAULT_MARKER_SYMBOL_SIZE),
                    ff.literal(0.0),
                    anchorPoint,
                    displacement);
    return styleFactory.pointSymbolizer(
            Localisation.getString(SLDTreeTools.class, "TreeItem.newMarker"),
            geometryField,
            null,
            null,
            graphic);
}
 
Example #20
Source File: GraphicViewer.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * TODO summary sentence for setGraphic ...
 *
 * @param graphic
 * @param mode
 * @param enabled
 */
public void setGraphic(final Graphic g, final Mode mode, final Color defaultColor) {
	Graphic graphic = g;
	boolean enabled = true;
	if (graphic == null) {
		final StyleBuilder builder = new StyleBuilder();
		graphic = builder.createGraphic(null, builder.createMark(StyleBuilder.MARK_SQUARE, defaultColor), null);
		enabled = true;
	}
	this.width = SLDs.size(graphic);
	final String text = MessageFormat.format("{0,number,#0}", this.width); //$NON-NLS-1$
	if (text != null) {
		this.size.setText(text);
		this.size.select(this.size.indexOf(text));
	}

	boolean marked = false;
	if (graphic != null && graphic.graphicalSymbols() != null && !graphic.graphicalSymbols().isEmpty()) {

		for (final GraphicalSymbol symbol : graphic.graphicalSymbols()) {
			if (symbol instanceof Mark) {
				final Mark mark = (Mark) symbol;
				setMark(mark, mode);
				marked = true;
				break;
			}
		}
	}
	if (!marked) {
		setMark(null, mode);
	}
	this.enabled = this.enabled && enabled;
}
 
Example #21
Source File: FieldConfigWindBarbs.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the value.
 *
 * @param fieldConfigManager the field config manager
 * @param symbolType the symbol type
 * @param fillEnabled the fill enabled
 * @param strokeEnabled the stroke enabled
 * @return the value
 */
@Override
public List<GraphicalSymbol> getValue(
        GraphicPanelFieldManager fieldConfigManager,
        Expression symbolType,
        boolean fillEnabled,
        boolean strokeEnabled) {
    List<GraphicalSymbol> symbolList = new ArrayList<>();

    Expression wellKnownName = null;
    if ((getConfigField() != null) && (fieldConfigManager != null)) {
        wellKnownName = getConfigField().getExpression();
        if (wellKnownName != null) {
            Expression expFillColour = null;
            Expression expFillColourOpacity = null;

            FieldConfigBase field = fieldConfigManager.get(FieldIdEnum.FILL_COLOUR);
            if (field != null) {
                FieldConfigColour colourField = (FieldConfigColour) field;

                expFillColour = colourField.getColourExpression();
            }

            Stroke stroke = null;
            Fill fill = getStyleFactory().createFill(expFillColour, expFillColourOpacity);
            Expression size = null;
            Expression rotation = null;
            Mark mark =
                    getStyleFactory().createMark(wellKnownName, stroke, fill, size, rotation);

            symbolList.add(mark);
        }
    }
    return symbolList;
}
 
Example #22
Source File: StyleUtilities.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Collect all {@link ExternalGraphic}s from the given {@link Graphic}.
 * 
 * @param graphic the graphic to check.
 * @return the extracted {@link ExternalGraphic}s.
 */
public static List<ExternalGraphic> externalGraphicsFromGraphic( Graphic graphic ) {
    List<ExternalGraphic> gList = new ArrayList<ExternalGraphic>();
    for( GraphicalSymbol gs : graphic.graphicalSymbols() ) {
        if ((gs != null) && (gs instanceof ExternalGraphic)) {
            ExternalGraphic externalGraphic = (ExternalGraphic) gs;
            gList.add(externalGraphic);
        }
    }
    return gList;
}
 
Example #23
Source File: StyleConverterServiceImpl.java    From geomajas-project-server with GNU Affero General Public License v3.0 5 votes vote down vote up
private Symbolizer createGeometrySymbolizer(FeatureStyleInfo featureStyle) throws LayerException {
	Symbolizer symbolizer;
	switch (featureStyle.getLayerType()) {
		case MULTIPOLYGON:
		case POLYGON:
			symbolizer = styleBuilder.createPolygonSymbolizer(createStroke(featureStyle), createFill(featureStyle));
			break;
		case MULTILINESTRING:
		case LINESTRING:
			symbolizer = styleBuilder.createLineSymbolizer(createStroke(featureStyle));
			break;
		case POINT:
		case MULTIPOINT:
			PointSymbolizer ps = styleBuilder.createPointSymbolizer();
			GraphicalSymbol symbol = createSymbol(featureStyle);
			Expression size = null;
			if (symbol instanceof Mark) {
				SymbolInfo info = featureStyle.getSymbol();
				if (info.getRect() != null) {
					size = styleBuilder.literalExpression((int) info.getRect().getW());
				} else if (info.getCircle() != null) {
					size = styleBuilder.literalExpression(2 * (int) info.getCircle().getR());
				} // else {} already handled by createSymbol()
			} else {
				size = styleBuilder.literalExpression(featureStyle.getSymbol().getImage().getHeight());
			}
			ps.getGraphic().setSize(size);
			ps.getGraphic().graphicalSymbols().clear();
			ps.getGraphic().graphicalSymbols().add(createSymbol(featureStyle));
			symbolizer = ps;
			break;
		default:
			throw new IllegalArgumentException("Unsupported geometry type " + featureStyle.getLayerType());
	}
	return symbolizer;
}
 
Example #24
Source File: PictureFillSymbol.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the symbol list.
 *
 * @param symbolToAdd the symbol to add
 * @return the symbol list
 */
private List<GraphicalSymbol> getSymbolList(GraphicalSymbol symbolToAdd)
{
    List<GraphicalSymbol> symbolList = new ArrayList<GraphicalSymbol>();

    symbolList.add(symbolToAdd);

    return symbolList;
}
 
Example #25
Source File: FieldConfigArrow.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the value.
 *
 * @param symbolizerType the symbolizer type
 * @param fieldConfigManager the field config manager
 * @param multiOptionPanel the multi option panel
 * @param graphic the graphic
 * @param symbol the symbol
 */
@Override
public void setValue(
        Class<?> symbolizerType,
        GraphicPanelFieldManager fieldConfigManager,
        FieldConfigSymbolType multiOptionPanel,
        Graphic graphic,
        GraphicalSymbol symbol) {
    if ((symbol instanceof Mark) && (fieldConfigManager != null)) {
        MarkImpl markerSymbol = (MarkImpl) symbol;

        FillImpl fill = markerSymbol.getFill();

        if (fill != null) {
            Expression expFillColour = fill.getColor();
            Expression expFillColourOpacity = fill.getOpacity();

            FieldConfigBase field = fieldConfigManager.get(FieldIdEnum.FILL_COLOUR);
            if (field != null) {
                field.populate(expFillColour);
            }
            field = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
            if (field != null) {
                field.populate(expFillColourOpacity);
            }
        }

        if (arrowPanel != null) {
            arrowPanel.populateExpression(markerSymbol.getWellKnownName().toString());
        }

        if (multiOptionPanel != null) {
            multiOptionPanel.setSelectedItem(ARROW_SYMBOL_KEY);
        }
    }
}
 
Example #26
Source File: SymbolTypeFactory.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the symbol value.
 *
 * @param fieldConfigManager the field config manager
 * @param symbolType the symbol type
 * @param fillEnabled the fill enabled
 * @param strokeEnabled the stroke enabled
 * @param selectedPanelId the selected panel id
 * @return the value
 */
public List<GraphicalSymbol> getValue(
        GraphicPanelFieldManager fieldConfigManager,
        Expression symbolType,
        boolean fillEnabled,
        boolean strokeEnabled,
        Class<?> selectedPanelId) {
    FieldState panel = classMap.get(selectedPanelId);
    if (panel != null) {
        return panel.getValue(fieldConfigManager, symbolType, fillEnabled, strokeEnabled);
    }

    return null;
}
 
Example #27
Source File: SymbolTypeFactory.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the symbol value.
 *
 * @param symbolizerType the symbolizer type
 * @param fieldConfigManager the field config manager
 * @param graphic the graphic
 * @param symbol the new value
 */
public void setValue(
        Class<?> symbolizerType,
        GraphicPanelFieldManager fieldConfigManager,
        Graphic graphic,
        GraphicalSymbol symbol) {

    for (FieldState panel : classMap.values()) {
        if ((panel != null) && panel.accept(symbol)) {
            panel.setValue(
                    symbolizerType, fieldConfigManager, symbolTypeField, graphic, symbol);
        }
    }
}
 
Example #28
Source File: FieldConfigFilename.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the value.
 *
 * @param fieldConfigManager the field config manager
 * @param symbolType the symbol type
 * @param fillEnabled the fill enabled
 * @param strokeEnabled the stroke enabled
 * @return the value
 */
@Override
public List<GraphicalSymbol> getValue(
        GraphicPanelFieldManager fieldConfigManager,
        Expression symbolType,
        boolean fillEnabled,
        boolean strokeEnabled) {
    List<GraphicalSymbol> symbols = null;
    if (externalGraphicPanel != null) {
        ExternalGraphic extGraphic = externalGraphicPanel.getSymbol();

        symbols = SelectedSymbol.getInstance().getSymbolList(extGraphic);
    }
    return symbols;
}
 
Example #29
Source File: FieldConfigMarker.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the fill.
 *
 * @param graphicFill the graphic fill
 * @param fieldConfigManager the field config manager
 * @return the fill
 */
@Override
public Fill getFill(GraphicFill graphicFill, GraphicPanelFieldManager fieldConfigManager) {
    if (fieldConfigManager == null) {
        return null;
    }
    Expression fillColour = null;
    FieldConfigBase field = fieldConfigManager.get(fillFieldConfig.getColour());
    if ((field instanceof FieldConfigColour) && field.isEnabled()) {
        fillColour = ((FieldConfigColour) field).getColourExpression();
    }

    Expression fillColourOpacity = null;
    field = fieldConfigManager.get(fillFieldConfig.getOpacity());
    if (field != null) {
        fillColourOpacity = field.getExpression();
    }

    GraphicFill localGraphicFill = null;
    Expression localFillColour = fillColour;
    Expression localFillColourOpacity = fillColourOpacity;
    if (graphicFill != null) {
        List<GraphicalSymbol> symbolList = graphicFill.graphicalSymbols();

        if ((symbolList != null) && (!symbolList.isEmpty())) {
            GraphicalSymbol symbol = symbolList.get(0);
            Mark mark = (Mark) symbol;
            if (mark.getWellKnownName() != null) {
                localGraphicFill = graphicFill;
                localFillColour = null;
                localFillColourOpacity = null;
            }
        }
    }
    return getStyleFactory().fill(localGraphicFill, localFillColour, localFillColourOpacity);
}
 
Example #30
Source File: FieldConfigFilename.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Accept.
 *
 * @param symbol the symbol
 * @return true, if successful
 */
@Override
public boolean accept(GraphicalSymbol symbol) {
    if (symbol != null) {
        if (symbol instanceof ExternalGraphicImpl) {
            return true;
        }
    }
    return false;
}