private ExternalGraphic[] copy(ExternalGraphic[] externalGraphics) { if (externalGraphics == null) return null; ExternalGraphic[] copy = new ExternalGraphic[externalGraphics.length]; for (int i = 0; i < externalGraphics.length; i++) { copy[i] = copy(externalGraphics[i]); } return copy; }
public void visit(AnchorPoint ap) { Expression x = copy(ap.getAnchorPointX()); Expression y = copy(ap.getAnchorPointY()); AnchorPoint copy = sf.createAnchorPoint(x, y); if (STRICT && !copy.equals(ap)) { throw new IllegalStateException("Was unable to duplicate provided AnchorPoint:" + ap); } pages.push(copy); }
public void visit(ChannelSelection cs) { // get the channels final SelectedChannelType sct[] = copy(cs.getSelectedChannels()); final ChannelSelection copy = sf.createChannelSelection(sct); if (STRICT && !copy.equals(cs)) { throw new IllegalStateException( "Was unable to duplicate provided ChannelSelection:" + cs); } pages.push(copy); }
public void visit(FeatureTypeConstraint ftc) { String typeName = ftc.getFeatureTypeName(); Filter filter = copy(ftc.getFilter()); Extent[] extents = copy(ftc.getExtents()); FeatureTypeConstraint copy = sf.createFeatureTypeConstraint(typeName, filter, extents); if (STRICT && !copy.equals(ftc)) { throw new IllegalStateException( "Was unable to duplicate provided FeatureTypeConstraint:" + ftc); } pages.push(copy); }
public void visit(ImageOutline outline) { // copy the symbolizer final Symbolizer symb = outline.getSymbolizer(); final Symbolizer copySymb = copy(symb); final ImageOutline copy = sf.createImageOutline(copySymb); copy.setSymbolizer(copySymb); if (STRICT && !copy.equals(outline)) { throw new IllegalStateException( "Was unable to duplicate provided ImageOutline:" + outline); } pages.push(copy); }
public void visit(Mark mark) { Mark copy = null; copy = sf.createMark(); copy.setFill(copy(mark.getFill())); copy.setStroke(copy(mark.getStroke())); copy.setWellKnownName(copy(mark.getWellKnownName())); copy.setExternalMark(copy(mark.getExternalMark())); if (STRICT && !copy.equals(mark)) { throw new IllegalStateException("Was unable to duplicate provided Mark:" + mark); } pages.push(copy); }
public void visit(PointPlacement pp) { PointPlacement copy = sf.getDefaultPointPlacement(); copy.setAnchorPoint(copy(pp.getAnchorPoint())); copy.setDisplacement(copy(pp.getDisplacement())); copy.setRotation(copy(pp.getRotation())); if (STRICT && !copy.equals(pp)) { throw new IllegalStateException( "Was unable to duplicate provided PointPlacement:" + pp); } pages.push(copy); }
public void visit(Fill fill) { Fill copy = sf.getDefaultFill(); copy.setBackgroundColor(copy(fill.getBackgroundColor())); copy.setColor(copy(fill.getColor())); copy.setGraphicFill(copy(fill.getGraphicFill())); copy.setOpacity(copy(fill.getOpacity())); if (STRICT && !copy.equals(fill)) { throw new IllegalStateException("Was unable to duplicate provided Fill:" + fill); } pages.push(copy); }
protected ChannelSelection copy(ChannelSelection channelSelection) { if (channelSelection == null) return null; SelectedChannelType[] channels = copy(channelSelection.getSelectedChannels()); ChannelSelection copy = sf.createChannelSelection(channels); copy.setGrayChannel(copy(channelSelection.getGrayChannel())); copy.setRGBChannels(copy(channelSelection.getRGBChannels())); return copy; }
public void visit(ShadedRelief sr) { final ShadedRelief copy = sf.createShadedRelief(copy(sr.getReliefFactor())); copy.setBrightnessOnly(sr.isBrightnessOnly()); if (STRICT && !copy.equals(sr)) { throw new IllegalStateException("Was unable to duplicate provided ShadedRelief:" + sr); } pages.push(copy); } }
protected SelectedChannelType copy(SelectedChannelType selectedChannelType) { if (selectedChannelType == null) return null; ContrastEnhancement enhancement = copy(selectedChannelType.getContrastEnhancement()); Expression name = (Expression) selectedChannelType.getChannelName().accept(copyFilter, null); SelectedChannelType copy = sf.createSelectedChannelType(name, enhancement); return copy; }
private OtherText copy(OtherText otherText) { if (otherText == null) return null; // TODO: add methods to the factory to create OtherText instances // sf.createOtherText(); OtherTextImpl copy = new OtherTextImpl(); copy.setTarget(otherText.getTarget()); copy.setText(copy(otherText.getText())); return copy; }
public void testExternalGraphic() { ExternalGraphic exGraphic = sf.createExternalGraphic("http://somewhere", "image/png"); ExternalGraphic clone = visitor.copy(exGraphic); assertCopy(exGraphic, clone); ExternalGraphic notEq = sf.createExternalGraphic("http://somewhereelse", "image/jpeg"); assertEqualsContract(clone, notEq, exGraphic); // make sure it works for different format, same url ExternalGraphic notEq2 = visitor.copy(clone); notEq2.setFormat("image/jpeg"); assertEqualsContract(clone, notEq2, exGraphic); }
protected ContrastEnhancement copy(ContrastEnhancement contrast) { if (contrast == null) return null; ContrastEnhancement copy = sf.createContrastEnhancement(); copy.setGammaValue(copy(contrast.getGammaValue())); copy.setMethod(contrast.getMethod()); copy.setOptions(contrast.getOptions()); return copy; }
public void testLineSymbolizerWithUOM() { LineSymbolizer lineSymb = sf.createLineSymbolizer(); LineSymbolizer clone = (LineSymbolizer) visitor.copy(lineSymb); assertCopy(lineSymb, clone); LineSymbolizer notEq = sf.getDefaultLineSymbolizer(); notEq.setUnitOfMeasure(UomOgcMapping.METRE.getUnit()); assertEqualsContract(clone, notEq, lineSymb); }
public void testLineSymbolizerWithGeometryFunction() { LineSymbolizer lineSymb = sf.createLineSymbolizer(); // Set a function as geometry Function geomFunc = ff.function("centroid", ff.property("thr_geom")); lineSymb.setGeometry(geomFunc); LineSymbolizer copy = (LineSymbolizer) visitor.copy(lineSymb); // compare it assertEquals( "Any Expression set as Geometry must be correctly replicated", geomFunc, copy.getGeometry()); }
public void testPointPlacement() { PointPlacement pointPl = sf.getDefaultPointPlacement(); PointPlacement clone = (PointPlacement) visitor.copy(pointPl); assertCopy(pointPl, clone); PointPlacement other = (PointPlacement) ((Cloneable) pointPl).clone(); other.setRotation(ff.literal(274.0)); assertEqualsContract(clone, other, pointPl); }
public void testLineSymbolizerWithPerpendicularOffset() { LineSymbolizer ls = sf.createLineSymbolizer(); ls.setPerpendicularOffset(ff.literal(0.88)); // copy LineSymbolizer copy = (LineSymbolizer) visitor.copy(ls); // compare assertEquals( "PerpendicularOffset of LineSymbolizer has not been correctly duplicated", ls.getPerpendicularOffset(), copy.getPerpendicularOffset()); }
public void testTextSymbolizerWithGeometryFunction() { TextSymbolizer symb = sf.createTextSymbolizer(); // Set a function as geometry Function geomFunc = ff.function("centroid", ff.property("the_geom")); symb.setGeometry(geomFunc); TextSymbolizer copy = (TextSymbolizer) visitor.copy(symb); // compare it assertEquals( "Any Expression set as Geometry must be correctly replicated", geomFunc, copy.getGeometry()); }
public void testGraphic() { Graphic graphic = sf.getDefaultGraphic(); graphic.addMark(sf.getDefaultMark()); Graphic clone = (Graphic) visitor.copy(graphic); assertCopy(graphic, clone); assertEqualsContract(clone, graphic); assertEquals(clone.getSymbols().length, graphic.getSymbols().length); Graphic notEq = sf.getDefaultGraphic(); assertEqualsContract(clone, notEq, graphic); }