本文整理汇总了Java中org.geotools.styling.TextSymbolizer类的典型用法代码示例。如果您正苦于以下问题:Java TextSymbolizer类的具体用法?Java TextSymbolizer怎么用?Java TextSymbolizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextSymbolizer类属于org.geotools.styling包,在下文中一共展示了TextSymbolizer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convertTextSymbols
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
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));
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:26,代码来源:SymbolManager.java
示例2: defaultString
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* 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;
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:23,代码来源:SymbolizerTreeItem.java
示例3: internal_updateSymbolEnumField
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* Internal_update symbol enum field.
*
* @param options the options
* @param field the field
* @param key the key
*/
private void internal_updateSymbolEnumField(Map<String, String> options, FieldIdEnum field,
String key) {
ValueComboBoxData value = fieldConfigVisitor.getComboBox(field);
Object object = getDefaultFieldValue(field);
String defaultValue = null;
if (object instanceof TextSymbolizer.PolygonAlignOptions) {
TextSymbolizer.PolygonAlignOptions option = (PolygonAlignOptions) object;
defaultValue = option.toString();
} else {
defaultValue = (String) object;
}
if (defaultValue == null) {
ConsoleManager.getInstance().error(this, "Failed to find default for field : " + field);
} else if ((value.getKey().compareToIgnoreCase(defaultValue) != 0) || includeValue(field)) {
options.put(key, value.getKey());
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:28,代码来源:VOGeoServerLabelling.java
示例4: getMinimumVersion
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
@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 (FieldIdEnum key : fieldMap.keySet()) {
String vendorOptionAttributeKey = fieldMap.get(key);
if (options.containsKey(vendorOptionAttributeKey)) {
VendorOptionPresent voPresent = new VendorOptionPresent(sldObj,
getVendorOptionInfo());
if (!vendorOptionsPresentList.contains(voPresent)) {
vendorOptionsPresentList.add(voPresent);
}
}
}
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:VOGeoServerLabelling.java
示例5: internal_updateSymbolEnumField
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* Internal_update symbol enum field.
*
* @param options the options
* @param field the field
* @param key the key
*/
private void internal_updateSymbolEnumField(Map<String, String> options, FieldIdEnum field,
String key) {
ValueComboBoxData value = fieldConfigVisitor.getComboBox(field);
Object object = getDefaultFieldValue(field);
String defaultValue = null;
if (object instanceof TextSymbolizer.PolygonAlignOptions) {
TextSymbolizer.PolygonAlignOptions option = (PolygonAlignOptions) object;
defaultValue = option.toString();
} else {
defaultValue = (String) object;
}
if (defaultValue == null) {
ConsoleManager.getInstance().error(this, "Failed to find default for field : " + field);
} else if (value.getKey().compareToIgnoreCase(defaultValue) != 0) {
options.put(key, value.getKey());
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:28,代码来源:VOGeoServerLabellingUnderline.java
示例6: getMinimumVersion
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
@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 (FieldIdEnum key : fieldMap.keySet()) {
String vendorOptionAttributeKey = fieldMap.get(key);
if (options.containsKey(vendorOptionAttributeKey)) {
VendorOptionPresent voPresent = new VendorOptionPresent(sldObj,
getVendorOptionInfo());
vendorOptionsPresentList.add(voPresent);
}
}
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:20,代码来源:VOGeoServerLabellingUnderline.java
示例7: populate
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* 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 (FieldIdEnum key : fieldMap.keySet()) {
internalPopulate(options, key, fieldMap.get(key));
}
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:21,代码来源:VOGeoServerTextSpacing.java
示例8: updateSymbol
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* 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 (FieldIdEnum key : fieldMap.keySet()) {
internalUpdateSymbol(options, key, fieldMap.get(key));
}
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:21,代码来源:VOGeoServerTextSpacing.java
示例9: testHasFill
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* 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));
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:20,代码来源:SLDTreeLeafFactoryTest.java
示例10: testHasStroke
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* 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));
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:20,代码来源:SLDTreeLeafFactoryTest.java
示例11: testGetFill
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* 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);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:SLDTreeLeafFactoryTest.java
示例12: testGetStroke
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* 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);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:22,代码来源:SLDTreeLeafFactoryTest.java
示例13: textFont
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* Grabs the font from the first TextSymbolizer.
* <p>
* If you are using something fun like symbols you will need to do your own
* thing.
* </p>
*
* @param symbolizer
* Text symbolizer information.
* @return FontData[] of the font's fill, or null if unavailable.
*/
public static FontData[] textFont(final TextSymbolizer symbolizer) {
final Font font = font(symbolizer);
if (font == null)
return null;
final FontData[] tempFD = new FontData[1];
final Expression fontFamilyExpression = font.getFamily().get(0);
final Expression sizeExpression = font.getSize();
if (sizeExpression == null || fontFamilyExpression == null)
return null;
final Double size = sizeExpression.evaluate(null, Double.class);
try {
final String fontFamily = fontFamilyExpression.evaluate(null, String.class);
tempFD[0] = new FontData(fontFamily, size.intValue(), 1);
} catch (final NullPointerException ignore) {
return null;
}
if (tempFD[0] != null)
return tempFD;
return null;
}
开发者ID:gama-platform,项目名称:gama,代码行数:36,代码来源:SLDs.java
示例14: getWrapper
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
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) {
return null;
}
return symbolizerWrapper;
}
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:17,代码来源:RuleWrapper.java
示例15: skipSymbolizer
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
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;
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:25,代码来源:SymbolizerFilterVisitor.java
示例16: testLabels
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
@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());
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:18,代码来源:SymbolizerFilterVisitorTest.java
示例17: testLabelsAndGeometries
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
@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());
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:19,代码来源:SymbolizerFilterVisitorTest.java
示例18: createTextSymbolizer
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
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;
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:27,代码来源:StyleConverterServiceImpl.java
示例19: visit
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* (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(copy(text2.getOtherText()));
}
if (STRICT && !copy.equals(text)) {
throw new IllegalStateException(
"Was unable to duplicate provided TextSymbolizer:" + text);
}
pages.push(copy);
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:39,代码来源:RuleRenderVisitor.java
示例20: addNewText
import org.geotools.styling.TextSymbolizer; //导入依赖的package包/类
/**
* Adds the new text symbolizer.
*/
public void addNewText() {
if (symbolTree == null) {
return;
}
// Store current state of the SLD before the add
Object oldValueObj = sldWriter.encodeSLD(null, SelectedSymbol.getInstance().getSld());
TextSymbolizer newTextSymbolizer = DefaultSymbols.createDefaultTextSymbolizer();
DefaultMutableTreeNode ruleNode = getRuleTreeNode();
SelectedSymbol.getInstance().addSymbolizerToRule(newTextSymbolizer);
DefaultMutableTreeNode newNode = sldTree.addObject(ruleNode, newTextSymbolizer, true);
// Select the item just added
if (newNode != null) {
SLDTreeManager.getInstance().rebuildTree((SLDTree) sldTree);
TreePath newPath = getPath(newNode);
symbolTree.setSelectionPath(newPath);
// Store current state of the SLD after the add
Object newValueObj = sldWriter.encodeSLD(null, SelectedSymbol.getInstance().getSld());
UndoManager.getInstance().addUndoEvent(new UndoEvent(sldTree.getUndoObject(),
getClass().getName(), oldValueObj, newValueObj));
}
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:33,代码来源:SLDTreeTools.java
注:本文中的org.geotools.styling.TextSymbolizer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论