本文整理汇总了Java中org.geotools.styling.TextSymbolizer类的典型用法代码示例。如果您正苦于以下问题:Java TextSymbolizer类的具体用法?Java TextSymbolizer怎么用?Java TextSymbolizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextSymbolizer类属于org.geotools.styling包,在下文中一共展示了TextSymbolizer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
}
示例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;
}
示例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());
}
}
示例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);
}
}
}
}
}
示例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());
}
}
示例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);
}
}
}
}
示例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));
}
}
}
示例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));
}
}
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}