001 /*
002 * GeoAPI - Java interfaces for OGC/ISO standards
003 * http://www.geoapi.org
004 *
005 * Copyright (C) 2004-2012 Open Geospatial Consortium, Inc.
006 * All Rights Reserved. http://www.opengeospatial.org/ogc/legal
007 *
008 * Permission to use, copy, and modify this software and its documentation, with
009 * or without modification, for any purpose and without fee or royalty is hereby
010 * granted, provided that you include the following on ALL copies of the software
011 * and documentation or portions thereof, including modifications, that you make:
012 *
013 * 1. The full text of this NOTICE in a location viewable to users of the
014 * redistributed or derivative work.
015 * 2. Notice of any changes or modifications to the OGC files, including the
016 * date changes were made.
017 *
018 * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
019 * NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020 * TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
021 * THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
022 * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
023 *
024 * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
025 * CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
026 *
027 * The name and trademarks of copyright holders may NOT be used in advertising or
028 * publicity pertaining to the software without specific, written prior permission.
029 * Title to copyright in this software and any associated documentation will at all
030 * times remain with copyright holders.
031 */
032 package org.opengis.style;
033
034 import org.opengis.annotation.Extension;
035 import org.opengis.filter.expression.Expression;
036 import org.opengis.annotation.XmlElement;
037 import org.opengis.annotation.XmlParameter;
038
039
040 /**
041 * Contains all the information needed to draw styled lines. Stroke objects are contained
042 * by {@link LineSymbol}s and {@link PolygonSymbol}s. There are three basic types of strokes:
043 * solid-color, {@code GraphicFill} (stipple), and repeated linear {@code GraphicStroke}. A
044 * repeated linear graphic is plotted linearly and has its graphic symbol bent around the curves
045 * of the line string, and a graphic fill has the pixels of the line rendered with a repeating
046 * area-fill pattern. If neither a {@link #getGraphicFill GraphicFill} nor {@link #getGraphicStroke
047 * GraphicStroke} element is given, then the line symbolizer will render a solid color.
048 *
049 * @version <A HREF="http://www.opengeospatial.org/standards/symbol">Symbology Encoding Implementation Specification 1.1.0</A>
050 * @author Open Geospatial Consortium
051 * @author Johann Sorel (Geomatys)
052 * @author Chris Dillard (SYS Technologies)
053 * @since GeoAPI 2.2
054 */
055 @XmlElement("Stroke")
056 public interface Stroke {
057
058 /**
059 * If non-null, indicates that line should be drawn by tiling the (thin) area of the line with
060 * the given graphic. Between {@code getGraphicFill()} and {@link #getGraphicStroke()}, only one
061 * may return a non-null value since a {@code Stroke} can have a {@code GraphicFill} or a
062 * {@code GraphicStroke}, but not both.
063 * @return Graphic
064 */
065 @XmlElement("GraphicFill")
066 GraphicFill getGraphicFill();
067
068 /**
069 * If non-null, indicates that lines should be drawn by repeatedly plotting the given graphic
070 * along the path of the lines, rotating it according to the orientation of the line.
071 * Between {@link #getGraphicFill()} and {@code getGraphicStroke}, only one may return a
072 * non-null value since a {@code Stroke} can have a {@code GraphicFill} or a {@code GraphicStroke},
073 * but not both.
074 * @return Graphic
075 */
076 @XmlElement("GraphicStroke")
077 GraphicStroke getGraphicStroke();
078
079 //*************************************************************
080 // SVG PARAMETERS
081 //*************************************************************
082
083 /**
084 * Indicates the color of the line if it is to be solid-color filled. The format of color
085 * values is {@code "#rrggbb"} where {@code rr}, {@code gg}, and {@code bb}, are red, green,
086 * and blue intensity values, respectively, represented as two digit hexadecimal integers.
087 * The hexadecimal digits between {@code A} and {@code F} may be in either uppercase or lowercase.
088 * If null, the default color is {@code "#000000"}, black.
089 * @return Expression
090 */
091 @XmlParameter("stroke")
092 Expression getColor();
093
094 /**
095 * Indicates the level of translucency as a floating point number whose value is between 0.0
096 * and 1.0 (inclusive). A value of zero means completely transparent. A value of 1.0 means
097 * completely opaque. If null, the default value is 1.0, totally opaque.
098 * @return expression
099 */
100 @XmlParameter("stroke-opacity")
101 Expression getOpacity();
102
103 /**
104 * Gives the absolute width in uoms of the line stroke as a floating point number.
105 * Fractional numbers are allowed (with system-dependent interpretation), but negative
106 * numbers are not. If null, the default value is 1.0.
107 * @return expression
108 */
109 @XmlParameter("stroke-width")
110 Expression getWidth();
111
112 /**
113 * Indicates how the various segments of a (thick) line string should be joined.
114 * Valid values are "miter", "round", and "bevel". If null, the default value is
115 * system dependent (probably whichever one is fastest to render).
116 * @return expression
117 */
118 @XmlParameter("stroke-linejoin")
119 Expression getLineJoin();
120
121 /**
122 * Indicates how the beginning and ending segments of a line string will be terminated.
123 * Valid values are "butt", "round", and "square". If null, the default value is system
124 * dependent.
125 * @return expression
126 */
127 @XmlParameter("stroke-linecap")
128 Expression getLineCap();
129
130 /**
131 * If present, indicates the dash pattern as a space-separated sequence of floating point numbers.
132 * The first number represents the length of the first dash to draw. The second number
133 * represents the length of space to leave. This continues to the end of the list then
134 * repeats. If the list contains an odd number of values, then before
135 * rendering the list is enlarged by repeating the last value. If this
136 * parameter is omitted, lines will be drawn as solid and unbroken.
137 * @return expression
138 */
139 @XmlParameter("stroke-dasharray")
140 float[] getDashArray();
141
142 /**
143 * Indicates the distance offset into the dash array to begin drawing.
144 * If null, the default value is zero.
145 * @return expression
146 */
147 @XmlParameter("stroke-dashoffset")
148 Expression getDashOffset();
149
150 /**
151 * calls the visit method of a StyleVisitor
152 *
153 * @param visitor the style visitor
154 */
155 @Extension
156 Object accept(StyleVisitor visitor, Object extraData);
157
158 }