本文整理汇总了Java中org.geotools.styling.Mark类的典型用法代码示例。如果您正苦于以下问题:Java Mark类的具体用法?Java Mark怎么用?Java Mark使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Mark类属于org.geotools.styling包,在下文中一共展示了Mark类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setValue
import org.geotools.styling.Mark; //导入依赖的package包/类
/**
* 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);
}
}
}
}
示例2: createFill
import org.geotools.styling.Mark; //导入依赖的package包/类
@Override
public void createFill(Symbolizer symbolizer) {
if (symbolizer instanceof PointSymbolizer) {
PointSymbolizer point = (PointSymbolizer) symbolizer;
if (point != null) {
Graphic graphic = point.getGraphic();
if (graphic == null) {
graphic = styleFactory.createDefaultGraphic();
point.setGraphic(graphic);
}
if (graphic != null) {
if (graphic.graphicalSymbols().isEmpty()) {
Mark mark = styleFactory.getDefaultMark();
graphic.graphicalSymbols().add(mark);
}
}
}
}
}
示例3: testAccept
import org.geotools.styling.Mark; //导入依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename#accept(org.opengis.style.GraphicalSymbol)}.
*/
@Test
public void testAccept() {
boolean valueOnly = true;
FieldConfigFilename field = new FieldConfigFilename(
new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
null, null, null);
assertFalse(field.accept(null));
StyleBuilder styleBuilder = new StyleBuilder();
ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
.createExternalGraphic("test.tmp", "png");
assertTrue(field.accept(externalGraphic));
Mark marker = styleBuilder.createMark("triangle");
assertFalse(field.accept(marker));
}
示例4: testAccept
import org.geotools.styling.Mark; //导入依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#accept(org.opengis.style.GraphicalSymbol)}.
*/
@Test
public void testAccept() {
boolean valueOnly = true;
FieldConfigTTF field = new FieldConfigTTF(
new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
null, null, null);
assertFalse(field.accept(null));
StyleBuilder styleBuilder = new StyleBuilder();
ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
.createExternalGraphic("test.tmp", "png");
assertFalse(field.accept(externalGraphic));
Mark marker1 = styleBuilder.createMark("triangle");
assertFalse(field.accept(marker1));
Mark marker2 = styleBuilder.createMark("ttf://Arial");
assertTrue(field.accept(marker2));
}
示例5: testAccept
import org.geotools.styling.Mark; //导入依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT#accept(org.opengis.style.GraphicalSymbol)}.
*/
@Test
public void testAccept() {
boolean valueOnly = true;
FieldConfigWKT field = new FieldConfigWKT(
new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
null, null, null);
assertFalse(field.accept(null));
StyleBuilder styleBuilder = new StyleBuilder();
ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
.createExternalGraphic("test.tmp", "png");
assertFalse(field.accept(externalGraphic));
Mark marker1 = styleBuilder.createMark("star");
assertFalse(field.accept(marker1));
//CHECKSTYLE:OFF
Mark marker2 = styleBuilder.createMark(
"wkt://MULTILINESTRING((-0.25 -0.25, -0.125 -0.25), (0.125 -0.25, 0.25 -0.25), (-0.25 0.25, -0.125 0.25), (0.125 0.25, 0.25 0.25))");
//CHECKSTYLE:ON
assertTrue(field.accept(marker2));
}
示例6: testAccept
import org.geotools.styling.Mark; //导入依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.marker.arrow.FieldConfigArrow#accept(org.opengis.style.GraphicalSymbol)}.
*/
@Test
public void testAccept() {
boolean valueOnly = true;
FieldConfigArrow field = new FieldConfigArrow(
new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
null, null, null);
assertFalse(field.accept(null));
StyleBuilder styleBuilder = new StyleBuilder();
Mark marker1 = styleBuilder.createMark("star");
assertFalse(field.accept(marker1));
Mark marker2 = styleBuilder.createMark("extshape://arrow?hr=1.2&t=0.34&ab=0.56");
assertTrue(field.accept(marker2));
}
示例7: testAccept
import org.geotools.styling.Mark; //导入依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs#accept(org.opengis.style.GraphicalSymbol)}.
*/
@Test
public void testAccept() {
boolean valueOnly = true;
FieldConfigWindBarbs field = new FieldConfigWindBarbs(
new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly),
null, null, null);
assertFalse(field.accept(null));
StyleBuilder styleBuilder = new StyleBuilder();
ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder
.createExternalGraphic("test.tmp", "png");
assertFalse(field.accept(externalGraphic));
Mark marker1 = styleBuilder.createMark("triangle");
assertFalse(field.accept(marker1));
Mark marker2 = styleBuilder.createMark("windbarbs://default(15)[kts]");
assertTrue(field.accept(marker2));
}
示例8: setMark
import org.geotools.styling.Mark; //导入依赖的package包/类
private void setMark(final Mark mark, final Mode mode) {
listen(false);
try {
this.enabled = mode == Mode.POINT && mark != null;
this.type = SLD.wellKnownName(mark);
// Stroke is used in line, point and polygon
this.on.setEnabled(mode == Mode.POINT || mode == Mode.ALL);
if ( this.type != null ) {
this.name.setText(this.type);
this.name.select(this.name.indexOf(this.type));
}
this.on.setSelection(this.enabled);
this.size.setEnabled(this.enabled);
this.name.setEnabled(this.enabled);
} finally {
listen(true); // listen to user now
}
}
示例9: initEndPointSymbolizers
import org.geotools.styling.Mark; //导入依赖的package包/类
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 (Utilities.lineEndStyles.values().contains(name)) {
if (endpnt) {
endPointStyle = new PointSymbolizerWrapper(pnt, super.getParent());
} else if (startpnt) {
startPointStyle = new PointSymbolizerWrapper(pnt, super.getParent());
}
}
}
}
}
}
}
示例10: createDefaultPointRule
import org.geotools.styling.Mark; //导入依赖的package包/类
/**
* Creates a default {@link Rule} for a point.
*
* @return the default rule.
*/
public static Rule createDefaultPointRule() {
Graphic graphic = sf.createDefaultGraphic();
Mark circleMark = sf.getCircleMark();
circleMark.setFill(sf.createFill(ff.literal("#" + Integer.toHexString(Color.RED.getRGB() & 0xffffff))));
circleMark.setStroke(sf.createStroke(ff.literal("#" + Integer.toHexString(Color.BLACK.getRGB() & 0xffffff)),
ff.literal(DEFAULT_WIDTH)));
graphic.graphicalSymbols().clear();
graphic.graphicalSymbols().add(circleMark);
graphic.setSize(ff.literal(DEFAULT_SIZE));
PointSymbolizer pointSymbolizer = sf.createPointSymbolizer();
Rule rule = sf.createRule();
rule.setName("New rule");
rule.symbolizers().add(pointSymbolizer);
pointSymbolizer.setGraphic(graphic);
return rule;
}
示例11: createDefaultPointFeatureTypeStyle
import org.geotools.styling.Mark; //导入依赖的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;
}
示例12: quickPointSymbolizer
import org.geotools.styling.Mark; //导入依赖的package包/类
private void quickPointSymbolizer() {
// quickPointSymbolizer start
// "testPoint" feature type style
StyleBuilder sb = new StyleBuilder();
FilterFactory2 ff = sb.getFilterFactory();
Mark testMark = sb.createMark(sb.attributeExpression("name"), sb.createFill(Color.RED, 0.5),
null);
Graphic graph = sb.createGraphic(null, // An external graphics if needed
new Mark[] { testMark }, // a Mark if not an external graphics
null, // aSymbol
ff.literal(1), // opacity
ff.property("size"), // read from feature "size" attribute
ff.property("rotation")); // rotation, here read into the feature
PointSymbolizer aPointSymbolizer = sb.createPointSymbolizer(graph);
// creation of the style
Style style = sb.createStyle(aPointSymbolizer);
// quickPointSymbolizer end
}
示例13: createSymbol
import org.geotools.styling.Mark; //导入依赖的package包/类
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;
}
}
示例14: getFill
import org.geotools.styling.Mark; //导入依赖的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;
}
Expression fillColour = null;
FieldConfigBase field = fieldConfigManager.get(fillFieldConfig.getColour());
if (field != null) {
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 _graphicFill = null;
Expression _fillColour = fillColour;
Expression _fillColourOpacity = 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) {
_graphicFill = graphicFill;
_fillColour = null;
_fillColourOpacity = null;
}
}
}
Fill fill = getStyleFactory().fill(_graphicFill, _fillColour, _fillColourOpacity);
return fill;
}
示例15: setValue
import org.geotools.styling.Mark; //导入依赖的package包/类
/**
* 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) && (fieldConfigManager != null)) {
if (symbol instanceof Mark) {
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);
}
}
}
}