本文整理汇总了Java中org.geotools.styling.Fill类的典型用法代码示例。如果您正苦于以下问题:Java Fill类的具体用法?Java Fill怎么用?Java Fill使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Fill类属于org.geotools.styling包,在下文中一共展示了Fill类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToFill
import org.geotools.styling.Fill; //导入依赖的package包/类
@Override
public List<Symbolizer> convertToFill(String layerName, JsonElement element, int transparency) {
if(element == null) return null;
JsonObject obj = element.getAsJsonObject();
List<Symbolizer> symbolizerList = new ArrayList<Symbolizer>();
Fill fill = getFill(layerName, obj, transparency);
PolygonSymbolizer polygon = styleFactory.createPolygonSymbolizer();
polygon.setStroke(null);
polygon.setFill(fill);
symbolizerList.add(polygon);
return symbolizerList;
}
示例2: convertToFill
import org.geotools.styling.Fill; //导入依赖的package包/类
@Override
public List<Symbolizer> convertToFill(String layerName, JsonElement element, int transparency) {
if(element == null) return null;
JsonObject obj = element.getAsJsonObject();
List<Symbolizer> symbolizerList = new ArrayList<Symbolizer>();
Expression fillColour = getColour(obj.get(SimpleFillSymbolKeys.FILL_COLOUR));
Expression transparencyExpression = getTransparency(transparency);
Fill fill = null;
if(fillColour != null)
{
fill = styleFactory.createFill(fillColour, transparencyExpression);
}
PolygonSymbolizer polygon = styleFactory.createPolygonSymbolizer();
polygon.setStroke(null);
polygon.setFill(fill);
symbolizerList.add(polygon);
return symbolizerList;
}
示例3: getFill
import org.geotools.styling.Fill; //导入依赖的package包/类
/**
* 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;
}
Fill fill = null;
FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
if (fieldConfig != null) {
Expression fillColour = null;
Expression fillColourOpacity = null;
if (fieldConfig instanceof FieldConfigColour) {
fillColourOpacity = ((FieldConfigColour) fieldConfig).getColourOpacityExpression();
} else {
fillColourOpacity = fieldConfig.getExpression();
}
fill = getStyleFactory().fill(graphicFill, fillColour, fillColourOpacity);
}
return fill;
}
示例4: getFill
import org.geotools.styling.Fill; //导入依赖的package包/类
/**
* Gets the fill for the selected value.
*
* @param graphicFill the graphic fill
* @param fieldConfigManager the field config manager
* @return the fill
*/
public Fill getFill(GraphicFill graphicFill, GraphicPanelFieldManager fieldConfigManager) {
Fill fill = null;
ValueComboBoxData obj = symbolTypeField.getSelectedValueObj();
if (obj != null) {
if (!isNone(obj.getKey())) {
FieldState panel = classMap.get(obj.getPanelId());
if (panel != null) {
fill = panel.getFill(graphicFill, fieldConfigManager);
}
}
}
return fill;
}
示例5: createDefaultPointSymbolizer
import org.geotools.styling.Fill; //导入依赖的package包/类
/**
* 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<GraphicalSymbol>();
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);
PointSymbolizer newPointSymbolizer = (PointSymbolizer) styleFactory.pointSymbolizer(
Localisation.getString(SLDTreeTools.class, "TreeItem.newMarker"), geometryField,
null, null, graphic);
return newPointSymbolizer;
}
示例6: updateFill
import org.geotools.styling.Fill; //导入依赖的package包/类
/**
* Update fill.
*
* @param selected the selected
* @param symbolizer the symbolizer
* @return the fill
*/
public Fill updateFill(boolean selected, Symbolizer symbolizer) {
if (symbolizer == null) {
return null;
}
boolean currentValue = hasFill(symbolizer);
if (currentValue != selected) {
SLDTreeLeafInterface obj = map.get(symbolizer.getClass());
if (obj != null) {
if (selected) {
logger.debug("Set fill");
obj.createFill(symbolizer);
} else {
logger.debug("Clear fill");
obj.removeFill(symbolizer);
}
}
}
return getFill(symbolizer);
}
示例7: getFill
import org.geotools.styling.Fill; //导入依赖的package包/类
@Override
public Fill getFill(Symbolizer symbolizer) {
if (symbolizer instanceof PointSymbolizer) {
PointSymbolizer point = (PointSymbolizer) symbolizer;
if (point != null) {
Graphic graphic = point.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;
return mark.getFill();
}
}
}
}
}
}
return null;
}
示例8: testGetTreeString
import org.geotools.styling.Fill; //导入依赖的package包/类
/**
* Test method for {@link com.sldeditor.ui.tree.item.FillTreeItem#getTreeString(java.lang.Object)}.
*/
@Test
public void testGetTreeString() {
FillTreeItem item = new FillTreeItem();
String actualValue = item.getTreeString(null, null);
String expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.fill");
assertTrue(actualValue.compareTo(expectedValue) == 0);
Fill fill = DefaultSymbols.createDefaultGraphicFill();
actualValue = item.getTreeString(null, fill);
assertTrue(actualValue.compareTo(expectedValue) == 0);
actualValue = item.getTreeString(null, fill);
assertTrue(actualValue.compareTo(expectedValue) == 0);
}
示例9: testGetSymbolList
import org.geotools.styling.Fill; //导入依赖的package包/类
/**
* 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));
}
示例10: getGraphic
import org.geotools.styling.Fill; //导入依赖的package包/类
/**
* Gets the graphic.
*
* @param symbolizer the symbolizer
* @return the graphic
*/
private Graphic getGraphic(Symbolizer symbolizer) {
Graphic graphic = null;
if (symbolizer instanceof PointSymbolizerImpl) {
PointSymbolizer pointSymbolizer = (PointSymbolizer) symbolizer;
graphic = pointSymbolizer.getGraphic();
} else if (symbolizer instanceof PolygonSymbolizerImpl) {
PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer) symbolizer;
if (polygonSymbolizer != null) {
Fill fill = polygonSymbolizer.getFill();
if (fill != null) {
graphic = fill.getGraphicFill();
}
}
}
return graphic;
}
示例11: createRule
import org.geotools.styling.Fill; //导入依赖的package包/类
private Rule createRule(Color outlineColor, Color fillColor) {
Symbolizer symbolizer = null;
Fill fill = null;
Stroke stroke = sf.createStroke(
ff.literal(outlineColor),
ff.literal(OUTLINE_WIDTH));
fill = sf.createFill(ff.literal(fillColor),
ff.literal(FILL_TRANSPARACY));
symbolizer = sf.createPolygonSymbolizer(stroke, fill,
geometryAttributeName);
Rule rule = sf.createRule();
rule.symbolizers().add(symbolizer);
return rule;
}
示例12: createPolygonStyle
import org.geotools.styling.Fill; //导入依赖的package包/类
/**
* Create a default polygon style.
*
* @return the created style.
*/
public static Style createPolygonStyle() {
// create a partially opaque outline stroke
final Stroke stroke = styleFactory.createStroke(filterFactory.literal(Color.BLUE), filterFactory.literal(1),
filterFactory.literal(0.5));
// create a partial opaque fill
final Fill fill = styleFactory.createFill(filterFactory.literal(Color.CYAN), filterFactory.literal(0.5));
/*
* Setting the geometryPropertyName arg to null signals that we want to draw the default geomettry of features
*/
final PolygonSymbolizer sym = styleFactory.createPolygonSymbolizer(stroke, fill, null);
final Rule rule = styleFactory.createRule();
rule.symbolizers().add(sym);
final FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle(new Rule[] { rule });
final Style style = styleFactory.createStyle();
style.featureTypeStyles().add(fts);
return style;
}
示例13: createDefaultPolygonFeatureTypeStyle
import org.geotools.styling.Fill; //导入依赖的package包/类
private FeatureTypeStyle createDefaultPolygonFeatureTypeStyle(String strokeColor, String strokeWidth, String fillColor, String opacity){
Stroke polygonStroke = sf.getDefaultStroke();
polygonStroke.setWidth(filterFactory.literal(new Integer(strokeWidth)));
polygonStroke.setColor(filterFactory.literal(strokeColor));
polygonStroke.setOpacity(filterFactory.literal(opacity));
Fill polygonFill = sf.getDefaultFill();
polygonFill.setColor(filterFactory.literal(fillColor));
polygonFill.setOpacity(filterFactory.literal(opacity));
PolygonSymbolizer polySym = sf.createPolygonSymbolizer();
polySym.setFill(polygonFill);
polySym.setStroke(polygonStroke);
Rule polygonRule = sf.createRule();
polygonRule.symbolizers().add(polySym);
FeatureTypeStyle polygonFeatureTypeStyle = sf.createFeatureTypeStyle(new Rule[]{polygonRule});
return polygonFeatureTypeStyle;
}
示例14: createDefaultPointFeatureTypeStyle
import org.geotools.styling.Fill; //导入依赖的package包/类
private FeatureTypeStyle createDefaultPointFeatureTypeStyle(String radius, String color, String opacity){
Fill pointFill = sf.getDefaultFill();
pointFill.setColor(filterFactory.literal(color));
pointFill.setOpacity(filterFactory.literal(opacity));
Stroke pointStroke = sf.getDefaultStroke();
pointStroke.setWidth(filterFactory.literal(new Integer(DEFAULT_STROKE_WIDTH)));
pointStroke.setColor(filterFactory.literal(DEFAULT_COLOR));
pointStroke.setOpacity(filterFactory.literal(opacity));
StyleBuilder sb = new StyleBuilder();
Mark circle = sb.createMark(StyleBuilder.MARK_CIRCLE, pointFill,pointStroke);
Graphic graph = sb.createGraphic(null, circle, null, Double.parseDouble(opacity), Double.parseDouble(radius) , DEFAULT_POINT_ROTATION);
PointSymbolizer pointSymbolizer = sb.createPointSymbolizer(graph);
Rule pointRule = sf.createRule();
pointRule.symbolizers().add(pointSymbolizer);
FeatureTypeStyle pointFeatureTypeStyle = sf.createFeatureTypeStyle(new Rule[]{pointRule});
return pointFeatureTypeStyle;
}
示例15: createPolygonStyle
import org.geotools.styling.Fill; //导入依赖的package包/类
private static Style createPolygonStyle() {
PolygonSymbolizer symbolizer = styleFactory.createPolygonSymbolizer();
Fill fill = styleFactory.createFill(
filterFactory.literal("#FFAA00"),
filterFactory.literal(0.5)
);
final Stroke stroke = styleFactory.createStroke(filterFactory.literal(Color.BLACK),
filterFactory.literal(1));
symbolizer.setFill(fill);
symbolizer.setStroke(stroke);
Rule rule = styleFactory.createRule();
rule.symbolizers().add(symbolizer);
FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
fts.rules().add(rule);
Style style = styleFactory.createStyle();
style.featureTypeStyles().add(fts);
return style;
}