org.geotools.styling.TextSymbolizer Java Examples
The following examples show how to use
org.geotools.styling.TextSymbolizer.
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: SLDTreeLeafFactoryTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Test method for {@link * com.sldeditor.common.tree.leaf.SLDTreeLeafFactory#hasStroke(org.opengis.style.Symbolizer)}. */ @Test public void testHasStroke() { PolygonSymbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer(); PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer(); // CHECKSTYLE:OFF LineSymbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer(); TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer(); // CHECKSTYLE:ON assertFalse(SLDTreeLeafFactory.getInstance().hasStroke(null)); assertTrue(SLDTreeLeafFactory.getInstance().hasStroke(polygonSymbolizer)); assertFalse(SLDTreeLeafFactory.getInstance().hasStroke(pointSymbolizer)); assertTrue(SLDTreeLeafFactory.getInstance().hasStroke(lineSymbolizer)); assertFalse(SLDTreeLeafFactory.getInstance().hasStroke(textSymbolizer)); }
Example #2
Source File: TextSymbolizerDetails.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** @param textSymbolizer */ private void populateHalo(TextSymbolizer textSymbolizer) { GroupConfigInterface group; Halo halo = textSymbolizer.getHalo(); group = getGroup(GroupIdEnum.HALO); group.enable(halo != null); if (halo != null) { Fill haloFill = halo.getFill(); fieldConfigVisitor.populateField(FieldIdEnum.HALO_COLOUR, haloFill.getColor()); fieldConfigVisitor.populateField(FieldIdEnum.HALO_RADIUS, halo.getRadius()); } else { fieldConfigVisitor.populateField(FieldIdEnum.HALO_COLOUR, (Expression) null); fieldConfigVisitor.populateField(FieldIdEnum.HALO_RADIUS, (Expression) null); } }
Example #3
Source File: SymbolizerFilterVisitorTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 6 votes |
@Test public void testLabelsAndGeometries() throws IOException{ SymbolizerFilterVisitor visitor = new SymbolizerFilterVisitor(); visitor.setIncludeGeometry(true); visitor.setIncludeText(true); SLDParser parser = new SLDParser(styleFactory); parser.setInput(getClass().getResource("point_pointwithdefaultlabel.sld")); Style[] styles = parser.readXML(); Assert.assertEquals(1, styles.length); visitor.visit(styles[0]); Style copy = (Style) visitor.getCopy(); FeatureTypeStyle featureTypeStyle = copy.featureTypeStyles().iterator().next(); Rule rule = featureTypeStyle.rules().iterator().next(); Iterator<Symbolizer> it = rule.symbolizers().iterator(); Assert.assertTrue(it.next() instanceof PointSymbolizer); Assert.assertTrue(it.next() instanceof TextSymbolizer); Assert.assertFalse(it.hasNext()); }
Example #4
Source File: TextSymbolizerDetails.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** @param textSymbolizer */ private void populateFont(TextSymbolizer textSymbolizer) { Font font = textSymbolizer.getFont(); GroupConfigInterface group = getGroup(GroupIdEnum.FONT); group.enable(font != null); if (font != null) { fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_FAMILY, font); fieldConfigVisitor.populateField(FieldIdEnum.FONT_WEIGHT, font.getWeight()); fieldConfigVisitor.populateField(FieldIdEnum.FONT_STYLE, font.getStyle()); fieldConfigVisitor.populateField(FieldIdEnum.FONT_SIZE, font.getSize()); } fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_PREVIEW, font); }
Example #5
Source File: SymbolizerTreeItem.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Default string. * * @param symbol the symbol * @return the string */ private String defaultString(Symbolizer symbol) { String name = ""; if (symbol instanceof PointSymbolizer) { name = DEFAULT_MARKER_NAME; } else if (symbol instanceof TextSymbolizer) { name = DEFAULT_TEXT_NAME; } else if (symbol instanceof LineSymbolizer) { name = DEFAULT_LINE_NAME; } else if (symbol instanceof PolygonSymbolizer) { name = DEFAULT_POLYGON_NAME; } else if (symbol instanceof RasterSymbolizer) { name = DEFAULT_RASTER_NAME; } return name; }
Example #6
Source File: SymbolManager.java From sldeditor with GNU General Public License v3.0 | 6 votes |
public void convertTextSymbols(TextSymbolizer textSymbolizer, int transparency, JsonElement jsonElement) { if (jsonElement == null) return; JsonObject jsonSymbol = jsonElement.getAsJsonObject(); boolean found = false; for(String symbolType : textSymbolMap.keySet()) { JsonElement obj = jsonSymbol.get(symbolType); if(obj != null) { EsriTextSymbolInterface esriTextSymbol = textSymbolMap.get(symbolType); esriTextSymbol.convert(textSymbolizer, obj, transparency); found = true; break; } } if(!found) { ConsoleManager.getInstance().error(this, "Unsupported text symbol : " + SymbolUtils.extractName(jsonElement)); } }
Example #7
Source File: SymbolizerFilterVisitorTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 6 votes |
@Test public void testLabels() throws IOException { SymbolizerFilterVisitor visitor = new SymbolizerFilterVisitor(); visitor.setIncludeGeometry(false); visitor.setIncludeText(true); SLDParser parser = new SLDParser(styleFactory); parser.setInput(getClass().getResource("point_pointwithdefaultlabel.sld")); Style[] styles = parser.readXML(); Assert.assertEquals(1, styles.length); visitor.visit(styles[0]); Style copy = (Style) visitor.getCopy(); FeatureTypeStyle featureTypeStyle = copy.featureTypeStyles().iterator().next(); Rule rule = featureTypeStyle.rules().iterator().next(); Iterator<Symbolizer> it = rule.symbolizers().iterator(); Assert.assertTrue(it.next() instanceof TextSymbolizer); Assert.assertFalse(it.hasNext()); }
Example #8
Source File: RuleWrapper.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
private SymbolizerWrapper getWrapper( Symbolizer symbolizer ) { SymbolizerWrapper symbolizerWrapper = null; if (symbolizer instanceof PointSymbolizer) { symbolizerWrapper = new PointSymbolizerWrapper(symbolizer, this); } else if (symbolizer instanceof LineSymbolizer) { symbolizerWrapper = new LineSymbolizerWrapper(symbolizer, this); } else if (symbolizer instanceof PolygonSymbolizer) { symbolizerWrapper = new PolygonSymbolizerWrapper(symbolizer, this); } else if (symbolizer instanceof TextSymbolizer) { symbolizerWrapper = new TextSymbolizerWrapper(symbolizer, this, getType()); } else if (symbolizer instanceof RasterSymbolizer) { symbolizerWrapper = new RasterSymbolizerWrapper(symbolizer, this); } return symbolizerWrapper; }
Example #9
Source File: VOGeoServerLabellingUnderline.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Populate. * * @param textSymbolizer the text symbolizer */ /* * (non-Javadoc) * * @see * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#populate(org.geotools.styling. * TextSymbolizer) */ @Override public void populate(TextSymbolizer textSymbolizer) { if (textSymbolizer != null) { Map<String, String> options = textSymbolizer.getOptions(); for (Entry<FieldIdEnum, String> entry : fieldMap.entrySet()) { internalPopulate(options, entry.getKey(), entry.getValue()); } } }
Example #10
Source File: VOGeoServerLabellingUnderline.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Update symbol. * * @param textSymbolizer the text symbolizer */ /* * (non-Javadoc) * * @see * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools. * styling.TextSymbolizer) */ @Override public void updateSymbol(TextSymbolizer textSymbolizer) { if (textSymbolizer != null) { Map<String, String> options = textSymbolizer.getOptions(); for (Entry<FieldIdEnum, String> entry : fieldMap.entrySet()) { internalUpdateSymbol(options, entry.getKey(), entry.getValue()); } } }
Example #11
Source File: VOGeoServerLabellingUnderline.java From sldeditor with GNU General Public License v3.0 | 6 votes |
@Override public void getMinimumVersion( Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) { if (sldObj instanceof TextSymbolizer) { TextSymbolizer textSymbolizer = (TextSymbolizer) sldObj; Map<String, String> options = textSymbolizer.getOptions(); for (Entry<FieldIdEnum, String> entry : fieldMap.entrySet()) { String vendorOptionAttributeKey = entry.getValue(); if (options.containsKey(vendorOptionAttributeKey)) { VendorOptionPresent voPresent = new VendorOptionPresent(sldObj, getVendorOptionInfo()); if (vendorOptionsPresentList != null) { vendorOptionsPresentList.add(voPresent); } } } } }
Example #12
Source File: VOGeoServerTextSpacing.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Populate. * * @param textSymbolizer the text symbolizer */ /* * (non-Javadoc) * * @see * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#populate(org.geotools.styling. * TextSymbolizer) */ @Override public void populate(TextSymbolizer textSymbolizer) { if (textSymbolizer != null) { Map<String, String> options = textSymbolizer.getOptions(); for (Entry<FieldIdEnum, String> entry : fieldMap.entrySet()) { internalPopulate(options, entry.getKey(), entry.getValue()); } } }
Example #13
Source File: VOGeoServerTextSpacing.java From sldeditor with GNU General Public License v3.0 | 6 votes |
@Override public void getMinimumVersion( Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) { if (sldObj instanceof TextSymbolizer) { TextSymbolizer textSymbolizer = (TextSymbolizer) sldObj; Map<String, String> options = textSymbolizer.getOptions(); for (Entry<FieldIdEnum, String> entry : fieldMap.entrySet()) { String vendorOptionAttributeKey = entry.getValue(); if (options.containsKey(vendorOptionAttributeKey)) { VendorOptionPresent voPresent = new VendorOptionPresent(sldObj, getVendorOptionInfo()); if (vendorOptionsPresentList != null) { vendorOptionsPresentList.add(voPresent); } } } } }
Example #14
Source File: StyleConverterServiceImpl.java From geomajas-project-server with GNU Affero General Public License v3.0 | 6 votes |
private TextSymbolizer createTextSymbolizer(LabelStyleInfo labelStyle, LayerType layerType) { Fill fontFill = styleBuilder.createFill(styleBuilder.literalExpression(labelStyle.getFontStyle().getColor()), styleBuilder.literalExpression(labelStyle.getFontStyle().getOpacity())); TextSymbolizer symbolizer = styleBuilder.createTextSymbolizer(); symbolizer.setFill(fontFill); FontStyleInfo fontInfo = labelStyle.getFontStyle(); symbolizer.setFont(styleBuilder.createFont(styleBuilder.literalExpression(fontInfo.getFamily()), styleBuilder.literalExpression(fontInfo.getStyle()), styleBuilder.literalExpression(fontInfo.getWeight()), styleBuilder.literalExpression(fontInfo.getSize()))); symbolizer.setLabel(styleBuilder.attributeExpression(labelStyle.getLabelAttributeName())); Fill haloFill = styleBuilder.createFill( styleBuilder.literalExpression(labelStyle.getBackgroundStyle().getFillColor()), styleBuilder.literalExpression(labelStyle.getBackgroundStyle().getFillOpacity())); symbolizer.setHalo(styleBuilder.createHalo(haloFill, 1)); // label placement : point at bottom-center of label (same as vectorized) switch (layerType) { case MULTIPOINT: case POINT: symbolizer.setLabelPlacement(styleBuilder.createPointPlacement(0.5, 0, 0)); break; default: break; } return symbolizer; }
Example #15
Source File: SLDTreeLeafFactoryTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Test method for {@link * com.sldeditor.common.tree.leaf.SLDTreeLeafFactory#getFill(org.opengis.style.Symbolizer)}. */ @Test public void testGetFill() { PolygonSymbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer(); PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer(); // CHECKSTYLE:OFF LineSymbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer(); TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer(); // CHECKSTYLE:ON assertNull(SLDTreeLeafFactory.getInstance().getFill(null)); assertTrue(SLDTreeLeafFactory.getInstance().getFill(polygonSymbolizer) != null); assertTrue(SLDTreeLeafFactory.getInstance().getFill(pointSymbolizer) != null); // Returns default fill assertTrue(SLDTreeLeafFactory.getInstance().getFill(lineSymbolizer) != null); assertTrue(SLDTreeLeafFactory.getInstance().getFill(textSymbolizer) != null); }
Example #16
Source File: BatchUpdateFontPanelTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
private Double getFontSize(SLDDataInterface sldData) { StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData); NamedLayer namedLayer = (NamedLayer) sld.layers().get(0); TextSymbolizer text = (TextSymbolizer) namedLayer .styles() .get(0) .featureTypeStyles() .get(0) .rules() .get(0) .symbolizers() .get(2); return Double.valueOf(text.getFont().getSize().toString()); }
Example #17
Source File: BatchUpdateFontPanelTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
private String getFontName(SLDDataInterface sldData) { StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData); NamedLayer namedLayer = (NamedLayer) sld.layers().get(0); TextSymbolizer text = (TextSymbolizer) namedLayer .styles() .get(0) .featureTypeStyles() .get(0) .rules() .get(0) .symbolizers() .get(2); return text.getFont().getFamily().get(0).toString(); }
Example #18
Source File: GetMinimumVersionTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** Test method for TextSymbolizerDetails */ @Test public void testTextSymbolizer2GetMinimumVersion() { TextSymbolizerDetails details = new TextSymbolizerDetails(); details.getMinimumVersion(null, null, null); TextSymbolizer text = styleFactory.createTextSymbolizer(); text.getOptions().put(TextSymbolizer2.MAX_DISPLACEMENT_KEY, "4.2"); text.getOptions().put(TextSymbolizer2.UNDERLINE_TEXT_KEY, "true"); text.getOptions().put(TextSymbolizer.WORD_SPACING_KEY, "true"); List<VendorOptionPresent> vendorOptionsPresentList = null; Object parentObj = null; details.getMinimumVersion(parentObj, text, vendorOptionsPresentList); vendorOptionsPresentList = new ArrayList<VendorOptionPresent>(); details.getMinimumVersion(parentObj, text, vendorOptionsPresentList); assertTrue(vendorOptionsPresentList.size() == 3); }
Example #19
Source File: VOGeoServerTextSpacing.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Update symbol. * * @param textSymbolizer the text symbolizer */ /* * (non-Javadoc) * * @see * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools. * styling.TextSymbolizer) */ @Override public void updateSymbol(TextSymbolizer textSymbolizer) { if (textSymbolizer != null) { Map<String, String> options = textSymbolizer.getOptions(); for (Entry<FieldIdEnum, String> entry : fieldMap.entrySet()) { internalPopulate(options, entry.getKey(), entry.getValue()); } } }
Example #20
Source File: VOGeoServerLabellingUnderlineTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.vendor.geoserver.text.VOGeoServerLabellingUnderline#updateSymbol(org.geotools.styling.TextSymbolizer)}. */ @Test void testUpdateSymbolTextSymbolizer() { VOGeoServerLabellingUnderline testObj = new VOGeoServerLabellingUnderline(TextSymbolizerDetails.class); TextSymbolizer symbolizer = null; testObj.updateSymbol(symbolizer); symbolizer = DefaultSymbols.createDefaultTextSymbolizer(); symbolizer.getOptions().put(TextSymbolizer2.UNDERLINE_TEXT_KEY, "true"); testObj.populate(symbolizer); TextSymbolizer newSymbolizer = DefaultSymbols.createDefaultTextSymbolizer(); testObj.updateSymbol(newSymbolizer); assertEquals(symbolizer.getOptions().size(), newSymbolizer.getOptions().size()); for (String key : symbolizer.getOptions().keySet()) { assertEquals(symbolizer.getOptions().get(key), newSymbolizer.getOptions().get(key)); } }
Example #21
Source File: VOGeoServerLabellingUnderlineTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.vendor.geoserver.text.VOGeoServerLabellingUnderline#getMinimumVersion(java.lang.Object, * java.lang.Object, java.util.List)}. */ @Test void testGetMinimumVersion() { VOGeoServerLabellingUnderline testObj = new VOGeoServerLabellingUnderline(TextSymbolizerDetails.class); TextSymbolizer symbolizer = null; testObj.updateSymbol(symbolizer); symbolizer = DefaultSymbols.createDefaultTextSymbolizer(); symbolizer.getOptions().put(TextSymbolizer2.UNDERLINE_TEXT_KEY, "true"); List<VendorOptionPresent> vendorOptionsPresentList = null; testObj.getMinimumVersion(symbolizer, "", vendorOptionsPresentList); vendorOptionsPresentList = new ArrayList<VendorOptionPresent>(); testObj.getMinimumVersion(symbolizer, "", vendorOptionsPresentList); }
Example #22
Source File: SymbolizerFilterVisitor.java From geomajas-project-server with GNU Affero General Public License v3.0 | 6 votes |
protected boolean skipSymbolizer(Symbolizer symbolizer) { if (symbolizer instanceof TextSymbolizer) { if (!isIncludeText()) { return true; } } else if (symbolizer instanceof LineSymbolizer) { if (!isIncludeGeometry()) { return true; } } else if (symbolizer instanceof PointSymbolizer) { if (!isIncludeGeometry()) { return true; } } else if (symbolizer instanceof PolygonSymbolizer) { if (!isIncludeGeometry()) { return true; } } else if (symbolizer instanceof RasterSymbolizer) { if (!isIncludeGeometry()) { return true; } } return false; }
Example #23
Source File: SLDTreeLeafFactoryTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Test method for {@link * com.sldeditor.common.tree.leaf.SLDTreeLeafFactory#hasFill(org.opengis.style.Symbolizer)}. */ @Test public void testHasFill() { PolygonSymbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer(); PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer(); // CHECKSTYLE:OFF LineSymbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer(); TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer(); // CHECKSTYLE:ON assertFalse(SLDTreeLeafFactory.getInstance().hasFill(null)); assertTrue(SLDTreeLeafFactory.getInstance().hasFill(polygonSymbolizer)); assertTrue(SLDTreeLeafFactory.getInstance().hasFill(pointSymbolizer)); assertFalse(SLDTreeLeafFactory.getInstance().hasFill(lineSymbolizer)); assertFalse(SLDTreeLeafFactory.getInstance().hasFill(textSymbolizer)); }
Example #24
Source File: SLDTreeLeafFactoryTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Test method for {@link * com.sldeditor.common.tree.leaf.SLDTreeLeafFactory#getStroke(org.opengis.style.Symbolizer)}. */ @Test public void testGetStroke() { PolygonSymbolizer polygonSymbolizer = DefaultSymbols.createDefaultPolygonSymbolizer(); // CHECKSTYLE:OFF PointSymbolizer pointSymbolizer = DefaultSymbols.createDefaultPointSymbolizer(); LineSymbolizer lineSymbolizer = DefaultSymbols.createDefaultLineSymbolizer(); TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer(); // CHECKSTYLE:ON assertNull(SLDTreeLeafFactory.getInstance().getStroke(null)); assertTrue(SLDTreeLeafFactory.getInstance().getStroke(polygonSymbolizer) != null); assertTrue(SLDTreeLeafFactory.getInstance().getStroke(lineSymbolizer) != null); // Returns default stroke assertTrue(SLDTreeLeafFactory.getInstance().getStroke(pointSymbolizer) != null); assertTrue(SLDTreeLeafFactory.getInstance().getStroke(textSymbolizer) != null); }
Example #25
Source File: SLDTreeItemWrapperTest.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Test method for {@link * com.sldeditor.ui.tree.SLDTreeItemWrapper#SLDTreeItemWrapper(java.lang.Object)}. */ @Test public void testSLDTreeItemWrapper() { // Try with null objects first String testObj1 = SLDTreeItemWrapper.generateKey(null); String testObj2 = SLDTreeItemWrapper.generateKey(null); assertTrue(testObj1.equals(testObj1)); assertTrue(testObj1.equals(testObj2)); // Try with 2 different text symbolizers instances but the same contents, hash codes should // be different String testObj3 = SLDTreeItemWrapper.generateKey(DefaultSymbols.createDefaultTextSymbolizer()); String testObj4 = SLDTreeItemWrapper.generateKey(DefaultSymbols.createDefaultTextSymbolizer()); assertTrue(testObj3.equals(testObj3)); assertFalse(testObj3.equals(testObj4)); // Try with one text symbolizer instances the same contents, hash codes should be the same TextSymbolizer textSymbolizer = DefaultSymbols.createDefaultTextSymbolizer(); textSymbolizer.setHalo(new HaloImpl()); String testObj5 = SLDTreeItemWrapper.generateKey(textSymbolizer); String testObj6 = SLDTreeItemWrapper.generateKey(textSymbolizer); assertTrue(testObj5.equals(testObj5)); assertTrue(testObj5.equals(testObj6)); }
Example #26
Source File: VOGeoServerFTSRuleEvaluation.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Populate. * * @param textSymbolizer the text symbolizer */ /* * (non-Javadoc) * * @see * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#populate(org.geotools.styling. * TextSymbolizer) */ @Override public void populate(TextSymbolizer textSymbolizer) { // Do nothing }
Example #27
Source File: RuleRenderVisitor.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * (non-Javadoc) * * @see * org.geotools.styling.visitor.DuplicatingStyleVisitor#visit(org.geotools.styling.TextSymbolizer) */ public void visit(TextSymbolizer text) { TextSymbolizer copy = sf.createTextSymbolizer(); copy.setFill(copy(text.getFill())); copy.fonts().clear(); copy.fonts().addAll(copyFonts(text.fonts())); // Ignore geometry field so that symbol is rendered copy.setGeometry(copy(text.getGeometry())); copy.setUnitOfMeasure(text.getUnitOfMeasure()); copy.setHalo(copy(text.getHalo())); copy.setLabel(copy(text.getLabel())); copy.setLabelPlacement(copy(text.getLabelPlacement())); copy.setPriority(copy(text.getPriority())); copy.getOptions().putAll(text.getOptions()); if (text instanceof TextSymbolizer2) { TextSymbolizer2 text2 = (TextSymbolizer2) text; TextSymbolizer2 copy2 = (TextSymbolizer2) copy; copy2.setGraphic(copy(text2.getGraphic())); copy2.setSnippet(copy(text2.getSnippet())); copy2.setFeatureDescription(copy(text2.getFeatureDescription())); copy2.setOtherText(copyOtherText(text2.getOtherText())); } if (STRICT && !copy.equals(text)) { throw new IllegalStateException( "Was unable to duplicate provided TextSymbolizer:" + text); } pages.push(copy); }
Example #28
Source File: VOGeoServerTextSymbolizer2Test.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.vendor.geoserver.text.VOGeoServerTextSymbolizer2#updateSymbol(org.geotools.styling.TextSymbolizer)}. */ @Test public void testUpdateSymbolTextSymbolizer() { TextSymbolizerDetails panel = new TextSymbolizerDetails(); VOGeoServerTextSymbolizer2 testObj = new VOGeoServerTextSymbolizer2(panel.getClass()); TextSymbolizer symbolizer = null; testObj.updateSymbol(symbolizer); }
Example #29
Source File: DefaultSymbols.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Creates the default text symbolizer. * * @return the text symbolizer */ public static TextSymbolizer createDefaultTextSymbolizer() { Expression fontFamily = ff.literal("Serif"); Expression fontSize = ff.literal(10.0); Expression fontStyle = ff.literal("normal"); Expression fontWeight = ff.literal("normal"); Expression rotation = ff.literal(0.0); Expression label = ff.literal("Test"); String geometryFieldName = null; Expression geometryField = ff.property(geometryFieldName); String name = Localisation.getString(SLDTreeTools.class, "TreeItem.newText"); AnchorPoint anchor = null; Displacement displacement = null; PointPlacement pointPlacement = styleFactory.pointPlacement(anchor, displacement, rotation); Expression fillColour = ff.literal(DEFAULT_COLOUR); Expression fillColourOpacity = ff.literal(1.0); Fill fill = styleFactory.fill(null, fillColour, fillColourOpacity); Halo halo = null; List<Expression> fontFamilyList = new ArrayList<>(); fontFamilyList.add(fontFamily); Font font = styleFactory.font(fontFamilyList, fontStyle, fontWeight, fontSize); Description description = null; Unit<?> unit = null; return styleFactory.textSymbolizer( name, geometryField, description, unit, label, font, pointPlacement, halo, fill); }
Example #30
Source File: VOGeoServerLabellingUnderlineTest.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.vendor.geoserver.text.VOGeoServerLabellingUnderline#populate(org.geotools.styling.TextSymbolizer)}. */ @Test void testPopulateTextSymbolizer() { VOGeoServerLabellingUnderline testObj = new VOGeoServerLabellingUnderline(TextSymbolizerDetails.class); TextSymbolizer symbolizer = null; testObj.populate(symbolizer); }