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 java.util.List;
035 import org.opengis.annotation.Extension;
036 import org.opengis.filter.expression.Expression;
037 import org.opengis.annotation.XmlElement;
038 import org.opengis.annotation.XmlParameter;
039
040
041 /**
042 * A Graphic is a "graphic symbol" with an inherent shape, color(s), and possibly size. A
043 * "graphic" can be very informally defined as "a little picture" and can be of either a raster
044 * or vector-graphic source type. The term "graphic" is used since the term "symbol" is
045 * similar to "Symbolizer" which is used in a different context in SE.
046 *
047 * @version <A HREF="http://www.opengeospatial.org/standards/symbol">Symbology Encoding Implementation Specification 1.1.0</A>
048 * @author Open Geospatial Consortium
049 * @author Johann Sorel (Geomatys)
050 * @author Chris Dillard (SYS Technologies)
051 * @since GeoAPI 2.2
052 */
053 @XmlElement("Graphic")
054 public interface Graphic {
055
056 /**
057 * Returns the list of external image files or marks that comprise this graphic.
058 * All elements of the list must be instances of either {@link Mark} or {@link ExternalGraphic}.
059 * <p>
060 * @return List of Marks or ExternalGraphics; if empty it is to be treated a single default Mark.
061 */
062 @XmlElement("ExternalGraphic,Mark")
063 List<GraphicalSymbol> graphicalSymbols();
064
065 //*************************************************************
066 // SVG PARAMETERS
067 //*************************************************************
068
069 /**
070 * Indicates the level of translucency as a floating point number whose value is between 0.0
071 * and 1.0 (inclusive). A value of zero means completely transparent. A value of 1.0 means
072 * completely opaque. If null, the default value is 1.0, totally opaque.
073 * @return expression
074 */
075 @XmlParameter("stroke-opacity")
076 Expression getOpacity();
077
078 /**
079 * The Size element gives the absolute size of the graphic in uoms encoded as a floating-
080 * point number. The default size for an object is context-dependent. Negative values are
081 * not allowed.
082 * The default size of an image format (such as GIF) is the inherent size of the image. The
083 * default size of a format without an inherent size (such as SVG which are not specially
084 * marked) is defined to be 16 pixels in height and the corresponding aspect in width. If a
085 * size is specified, the height of the graphic will be scaled to that size and the
086 * corresponding aspect will be used for the width. An expected common use case will be
087 * for image graphics to be on the order of 200 pixels in linear size and to be scaled to lower
088 * sizes. On systems that can resample these graphic images "smoothly," the results will be
089 * visually pleasing.
090 *
091 * @return Expression
092 */
093 @XmlParameter("Size")
094 Expression getSize();
095
096 /**
097 * Returns the expression that will be used to calculate the rotation of the
098 * graphic when it is drawn.
099 *
100 * The Rotation element gives the rotation of a graphic in the clockwise direction about its
101 * center point in decimal degrees, encoded as a floating-point number. Negative values
102 * mean counter-clockwise rotation. The default value is 0.0 (no rotation). Note that there is
103 * no connection between source geometry types and rotations; the point used for plotting
104 * has no inherent direction. Also, the point within the graphic about which it is rotated is
105 * format dependent. If a format does not include an inherent rotation point, then the point
106 * of rotation should be the centroid.
107 *
108 * @return Expression
109 */
110 @XmlParameter("Rotation")
111 Expression getRotation();
112
113 /**
114 * The AnchorPoint element of a PointSymbolizer gives the location inside of a Graphic
115 * (or label - see 11.4.4) to use for anchoring the graphic to the main-geometry point. The
116 * coordinates are given as two floating-point numbers in the AnchorPointX and
117 * AnchorPointY elements each with values between 0.0 and 1.0 inclusive. The bounding
118 * box of the graphic/label to be rendered is considered to be in a coordinate space from 0.0
119 * (lower-left corner) to 1.0 (upper-right corner), and the anchor position is specified as a
120 * point in this space. The default point is X=0.5, Y=0.5, which is at the middle height and
121 * middle length of the graphic/label text. A system may choose different anchor points to
122 * de-conflict graphics/labels.
123 *
124 * @return AnchorPoint , if null should use a default point X=0.5 Y=0.5
125 */
126 @XmlParameter("AnchorPoint")
127 AnchorPoint getAnchorPoint();
128
129 /**
130 * The Displacement gives the X and Y displacements from the "hot-spot" point. This
131 * element may be used to avoid over-plotting of multiple graphic symbols used as part of
132 * the same point symbol. The displacements are in units of measure above and to the right
133 * of the point. The default displacement is X=0, Y=0.
134 *
135 * If Displacement is used in conjunction with Size and/or Rotation then the graphic
136 * symbol shall be scaled and/or rotated before it is displaced.s
137 *
138 * @return Displacement
139 */
140 @XmlParameter("Displacement")
141 Displacement getDisplacement();
142
143 /**
144 * Calls the visit method of a StyleVisitor
145 * <p>
146 * Please note StlyeVisitor has methods to directly visit a Graphic, GraphicLegend, or GraphicFill or GraphicStroke; please
147 * call the most appropriate method.
148 *
149 * @param visitor the style visitor
150 */
151 @Extension
152 Object accept(StyleVisitor visitor, Object extraData);
153
154 }