001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2003-2006, Geotools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * Created on 7 giugno 2003, 19.08
017: */
018: package org.geotools.renderer.style;
019:
020: // J2SE dependencies
021: import java.awt.Composite;
022: import java.awt.Paint;
023: import java.awt.Stroke;
024: import java.awt.image.BufferedImage;
025:
026: import org.geotools.resources.Utilities;
027:
028: /**
029: * A rendered style to draw the contour of shapes TODO: add support for Graphic rendering (that
030: * is, an image painted along the contour)
031: *
032: * @author aaime
033: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/render/src/main/java/org/geotools/renderer/style/LineStyle2D.java $
034: */
035: public class LineStyle2D extends Style2D {
036: protected Paint contour;
037: protected Stroke stroke;
038: protected Composite contourComposite;
039:
040: /** Holds value of property graphicStroke. */
041: private BufferedImage graphicStroke;
042:
043: /**
044: * Returns the stroke for the {@linkplain org.geotools.renderer.geom.Polyline polyline} to be
045: * rendered, or <code>null</code> if none.
046: *
047: * @return the current stroke or null if none
048: */
049: public Stroke getStroke() {
050: return this .stroke;
051: }
052:
053: /**
054: * Sets the stroke for the {@linkplain org.geotools.renderer.geom.Polyline polyline} to be
055: * rendered
056: *
057: * @param stroke The stroke, or null if the contour doesn't need to be stroked
058: */
059: public void setStroke(Stroke stroke) {
060: this .stroke = stroke;
061: }
062:
063: /**
064: * Returns the contour color for the {@linkplain org.geotools.renderer.geom.Polyline polyline}
065: * to be rendered, or <code>null</code> if none.
066: *
067: * @return the current contour, or null if none
068: */
069: public Paint getContour() {
070: return this .contour;
071: }
072:
073: /**
074: * Sets the contour color for the {@linkplain org.geotools.renderer.geom.Polyline polyline} to
075: * be rendered
076: *
077: * @param contour
078: */
079: public void setContour(Paint contour) {
080: this .contour = contour;
081: }
082:
083: /**
084: * Returns the contour Composite for the {@linkplain org.geotools.renderer.geom.Polyline
085: * polyline} to be rendered, or <code>null</code> if the contour is to be opaque
086: *
087: * @return the current contour composite, or null if opaque
088: */
089: public Composite getContourComposite() {
090: return this .contourComposite;
091: }
092:
093: /**
094: * Sets the contour Composite for the {@linkplain org.geotools.renderer.geom.Polyline polyline}
095: * to be rendered. Set it to <code>null</code> if the contour is to be opaque
096: *
097: * @param contourComposite
098: */
099: public void setContourComposite(Composite contourComposite) {
100: this .contourComposite = contourComposite;
101: }
102:
103: /** Getter for property graphicStroke.
104: * @return Value of property graphicStroke.
105: *
106: */
107: public BufferedImage getGraphicStroke() {
108: return this .graphicStroke;
109: }
110:
111: /** Setter for property graphicStroke.
112: * @param graphicStroke New value of property graphicStroke.
113: *
114: */
115: public void setGraphicStroke(BufferedImage graphicStroke) {
116: this .graphicStroke = graphicStroke;
117: }
118:
119: /**
120: * Returns a string representation of this style.
121: */
122: public String toString() {
123: return Utilities.getShortClassName(this ) + '[' + contour + ']';
124: }
125: }
|