public class DuplicatingStyleVisitor extends Object implements StyleVisitor
This class makes use of an internal stack to story the copied result, retrieve with a call to getCopy() after visiting:
DuplicatingStyleVisitor copyStyle = new DuplicatingStyleVisitor();
rule.accepts( copyStyle );
Rule rule = (Rule) copyStyle.getCopy();
This class is often used as a base for an anoymous subclass where a style transformation is needed (such as removing PointSymbolizers or changing the scale - see RescaleStyleVisitor for an example).
| Modifier and Type | Field and Description |
|---|---|
protected DuplicatingFilterVisitor |
copyFilter
We are using aggregation here to contain our DuplicatingFilterVisitor.
|
protected FilterFactory2 |
ff |
protected Stack<Object> |
pages
This is our internal stack; used to maintain state as we copy sub elements.
|
protected StyleFactory |
sf |
protected boolean |
STRICT |
| Constructor and Description |
|---|
DuplicatingStyleVisitor() |
DuplicatingStyleVisitor(StyleFactory styleFactory) |
DuplicatingStyleVisitor(StyleFactory styleFactory,
FilterFactory2 filterFactory) |
DuplicatingStyleVisitor(StyleFactory styleFactory,
FilterFactory2 filterFactory,
DuplicatingFilterVisitor filterCloner)
Builds a new duplicating style visitor using a custom
DuplicatingStyleVisitor |
| Modifier and Type | Method and Description |
|---|---|
protected AnchorPoint |
copy(AnchorPoint anchorPoint)
Null safe copy of anchor point.
|
protected ChannelSelection |
copy(ChannelSelection channelSelection) |
protected ColorMap |
copy(ColorMap colorMap) |
protected ColorMapEntry |
copy(ColorMapEntry entry) |
protected ContrastEnhancement |
copy(ContrastEnhancement contrast) |
protected Description |
copy(Description desc)
Null safe copy of description
|
protected Displacement |
copy(Displacement displacement)
Null safe copy of displacement.
|
protected Expression |
copy(Expression expression)
Null safe expression copy.
|
protected Extent[] |
copy(Extent... extents) |
protected Extent |
copy(Extent extent) |
protected ExternalGraphic |
copy(ExternalGraphic externalGraphic) |
protected Fill |
copy(Fill fill)
Null safe fill copy
|
protected Filter |
copy(Filter filter)
Null safe copy of filter.
|
protected float[] |
copy(float[] array)
Null safe copy of float array.
|
protected Font |
copy(Font font)
Null safe copy of a single font
|
protected Graphic |
copy(Graphic graphic)
Null safe graphic copy
|
protected Halo |
copy(Halo halo)
Null safe copy of halo.
|
protected LabelPlacement |
copy(LabelPlacement placement) |
protected <K,V> Map<K,V> |
copy(Map<K,V> customProperties)
Null safe map copy, used for external graphic custom properties.
|
protected Mark |
copy(Mark mark) |
protected OverlapBehavior |
copy(OverlapBehavior ob) |
protected SelectedChannelType[] |
copy(SelectedChannelType... channels) |
protected SelectedChannelType |
copy(SelectedChannelType selectedChannelType) |
protected ShadedRelief |
copy(ShadedRelief shaded)
Null safe copy of shaded relief.
|
protected Stroke |
copy(Stroke stroke)
Null safe copy of stroke.
|
protected Symbol |
copy(Symbol symbol) |
protected Symbolizer |
copy(Symbolizer symbolizer) |
protected List<Expression> |
copyExpressions(List<Expression> expressions)
Copy list of expressions.
|
protected List<Font> |
copyFonts(List<Font> fonts)
Null safe copy of font list.
|
Object |
getCopy() |
void |
setStrict(boolean strict)
True if we should enforce equality after a copy.
|
void |
visit(AnchorPoint ap)
Called when accept is called on a anchor point
|
void |
visit(ChannelSelection cs)
Called when accept is called on a raster
ChannelSelection element |
void |
visit(ColorMap colorMap)
Called when accept is called on a raster color map
|
void |
visit(ColorMapEntry colorMapEntry)
Called when accept is called on a raster color map entry
|
void |
visit(ContrastEnhancement contrastEnhancement)
Called when accept is called on a raster ContrastEnhancement element
|
void |
visit(Displacement dis)
Called when accept is called on a displacement
|
void |
visit(ExternalGraphic exgr)
Called when accept is called on a external graphic
|
void |
visit(FeatureTypeConstraint ftc)
Called when accept is called on a FeatureTypeConstraint.
|
void |
visit(FeatureTypeStyle fts)
Called when accept is called on a fetauretypestyle
|
void |
visit(Fill fill)
Called when accept is called on a fill
|
void |
visit(Graphic gr)
Called when accept is called on a graphic
|
void |
visit(Halo halo)
Called when accept is called on a halo
|
void |
visit(ImageOutline outline)
Called when accept is called on a raster
ImageOutline element |
void |
visit(LinePlacement lp)
Called when accept is called on a Line Placement
|
void |
visit(LineSymbolizer line)
Called when accept is called on a linesymbolizer
|
void |
visit(Mark mark)
Called when accept is called on a mark
|
void |
visit(NamedLayer layer)
Called when accept is called on a NamedLayer.
|
void |
visit(OverlapBehavior ob)
Called when accept is called on a raster
OverlapBehavior element |
void |
visit(PointPlacement pp)
Called when accept is called on a Point Placement
|
void |
visit(PointSymbolizer ps)
Called when accept is called on a pointsymbolizer
|
void |
visit(PolygonSymbolizer poly)
Called when accept is called on a polygon symbolizer
|
void |
visit(RasterSymbolizer raster)
Called when accept is called on a rastersymbolizer
|
void |
visit(Rule rule)
Called when accept is called on a rule
|
void |
visit(SelectedChannelType sct)
Called when accept is called on a raster
SelectedChannelType element |
void |
visit(ShadedRelief sr)
Called when accept is called on a raster
ShadedRelief element |
void |
visit(Stroke stroke)
Called when accept is called on a stroke
|
void |
visit(Style style)
Called when accept is called on a Style.
|
void |
visit(StyledLayerDescriptor sld)
Called when accept is called on a StyledLayerDescriptor.
|
void |
visit(Symbolizer sym)
since it is impossible to create a Symbolizer this method should generate an exception or
warning.
|
void |
visit(TextSymbolizer text)
Called when accept is called on a textsymbolizer
|
void |
visit(UserLayer layer)
Called when accept is called on a UserLayer.
|
protected final StyleFactory sf
protected final FilterFactory2 ff
protected boolean STRICT
protected final DuplicatingFilterVisitor copyFilter
public DuplicatingStyleVisitor()
public DuplicatingStyleVisitor(StyleFactory styleFactory)
public DuplicatingStyleVisitor(StyleFactory styleFactory, FilterFactory2 filterFactory)
public DuplicatingStyleVisitor(StyleFactory styleFactory, FilterFactory2 filterFactory, DuplicatingFilterVisitor filterCloner)
DuplicatingStyleVisitorstyleFactory - Creates new style objects during style duplicationfilterFactory - Creates new filters and expressions during style duplicationfilterCloner - Copies filters during style duplicationpublic void setStrict(boolean strict)
public Object getCopy()
public void visit(StyledLayerDescriptor sld)
StyleVisitorvisit in interface StyleVisitorsld - The StyledLayerDescriptor to visitpublic void visit(NamedLayer layer)
StyleVisitorvisit in interface StyleVisitorlayer - The NamedLayer to visitpublic void visit(UserLayer layer)
StyleVisitorvisit in interface StyleVisitorlayer - The UserLayer to visitpublic void visit(Style style)
StyleVisitorvisit in interface StyleVisitorstyle - The style to visitpublic void visit(Rule rule)
StyleVisitorvisit in interface StyleVisitorrule - the rule to visitpublic void visit(FeatureTypeStyle fts)
StyleVisitorvisit in interface StyleVisitorfts - the feature type styler to visitprotected List<Expression> copyExpressions(List<Expression> expressions)
protected Expression copy(Expression expression)
This method will perform a null check, and save you some lines of code:
copy.setBackgroundColor( copyExpr( fill.getColor()) );
protected Graphic copy(Graphic graphic)
protected Fill copy(Fill fill)
protected float[] copy(float[] array)
protected <K,V> Map<K,V> copy(Map<K,V> customProperties)
protected Stroke copy(Stroke stroke)
protected ShadedRelief copy(ShadedRelief shaded)
protected Description copy(Description desc)
protected ExternalGraphic copy(ExternalGraphic externalGraphic)
protected ColorMapEntry copy(ColorMapEntry entry)
protected Symbolizer copy(Symbolizer symbolizer)
protected OverlapBehavior copy(OverlapBehavior ob)
protected ContrastEnhancement copy(ContrastEnhancement contrast)
protected SelectedChannelType[] copy(SelectedChannelType... channels)
protected SelectedChannelType copy(SelectedChannelType selectedChannelType)
protected ChannelSelection copy(ChannelSelection channelSelection)
protected List<Font> copyFonts(List<Font> fonts)
Right now style visitor does not let us visit fonts!
protected Displacement copy(Displacement displacement)
protected LabelPlacement copy(LabelPlacement placement)
protected AnchorPoint copy(AnchorPoint anchorPoint)
public void visit(Fill fill)
StyleVisitorvisit in interface StyleVisitorfill - the fill to be visitedpublic void visit(Stroke stroke)
StyleVisitorvisit in interface StyleVisitorstroke - the stroke to visitpublic void visit(Symbolizer sym)
StyleVisitorvisit in interface StyleVisitorsym - the symbolizer to visitpublic void visit(PointSymbolizer ps)
StyleVisitorvisit in interface StyleVisitorps - the point symbolizer to visitpublic void visit(LineSymbolizer line)
StyleVisitorvisit in interface StyleVisitorline - the line symbolizer to visitpublic void visit(PolygonSymbolizer poly)
StyleVisitorvisit in interface StyleVisitorpoly - the polygon symbolizer to visitpublic void visit(TextSymbolizer text)
StyleVisitorvisit in interface StyleVisitortext - the text symbolizer to visitpublic void visit(RasterSymbolizer raster)
StyleVisitorvisit in interface StyleVisitorraster - the raster symbolizer to visitpublic void visit(Graphic gr)
StyleVisitorvisit in interface StyleVisitorgr - the graphic to visitpublic void visit(Mark mark)
StyleVisitorvisit in interface StyleVisitormark - the mark to visitpublic void visit(ExternalGraphic exgr)
StyleVisitorvisit in interface StyleVisitorexgr - the external graphic to visitpublic void visit(PointPlacement pp)
StyleVisitorvisit in interface StyleVisitorpp - the point placement to visitpublic void visit(AnchorPoint ap)
StyleVisitorvisit in interface StyleVisitorap - the anchor point to visitpublic void visit(Displacement dis)
StyleVisitorvisit in interface StyleVisitordis - the displacement to visitpublic void visit(LinePlacement lp)
StyleVisitorvisit in interface StyleVisitorlp - the line placement to visitpublic void visit(Halo halo)
StyleVisitorvisit in interface StyleVisitorhalo - the halo to visitpublic void visit(FeatureTypeConstraint ftc)
StyleVisitorvisit in interface StyleVisitorftc - The FeatureTypeConstraint to visitpublic void visit(ColorMap colorMap)
StyleVisitorvisit in interface StyleVisitorcolorMap - the color map to visitpublic void visit(ColorMapEntry colorMapEntry)
StyleVisitorvisit in interface StyleVisitorcolorMapEntry - the color map to visitpublic void visit(ContrastEnhancement contrastEnhancement)
StyleVisitorvisit in interface StyleVisitorcontrastEnhancement - the ContrastEnhancement to visit.public void visit(ImageOutline outline)
StyleVisitorImageOutline elementvisit in interface StyleVisitoroutline - the ImageOutline to visit.public void visit(ChannelSelection cs)
StyleVisitorChannelSelection elementvisit in interface StyleVisitorcs - the ChannelSelection to visit.public void visit(OverlapBehavior ob)
StyleVisitorOverlapBehavior elementvisit in interface StyleVisitorob - the OverlapBehavior to visit.public void visit(SelectedChannelType sct)
StyleVisitorSelectedChannelType elementvisit in interface StyleVisitorsct - the SelectedChannelType to visit.public void visit(ShadedRelief sr)
StyleVisitorShadedRelief elementvisit in interface StyleVisitorsr - the ShadedRelief to visit.Copyright © 1996–2021 Geotools. All rights reserved.