001 /*
002 * GeoAPI - Java interfaces for OGC/ISO standards
003 * http://www.geoapi.org
004 *
005 * Copyright (C) 2008-2013 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.Collection;
035 import java.util.List;
036 import java.util.Map;
037 import java.util.Set;
038
039 import javax.measure.unit.Unit;
040 import javax.swing.Icon;
041
042 import org.opengis.feature.type.Name;
043 import org.opengis.filter.Filter;
044 import org.opengis.filter.Id;
045 import org.opengis.filter.expression.Expression;
046 import org.opengis.metadata.citation.OnlineResource;
047 import org.opengis.util.InternationalString;
048
049 /**
050 * Factory used in the production of style objects.
051 * <p>
052 * This factory is responsible for the production of style objects; where noted
053 * these create methods are in agreement with the Symbology Encoding 1.1
054 * specification.
055 *
056 * @author Open Geospatial Consortium
057 * @author Johann Sorel (Geomatys)
058 * @since GeoAPI 2.2
059 */
060 public interface StyleFactory {
061 /**
062 *
063 * @param x
064 * @param y
065 * @return
066 */
067 AnchorPoint anchorPoint(Expression x, Expression y);
068 /**
069 *
070 * @param gray
071 * @return
072 */
073 ChannelSelection channelSelection(SelectedChannelType gray);
074 /**
075 *
076 * @param red
077 * @param green
078 * @param blue
079 * @return
080 */
081 ChannelSelection channelSelection(SelectedChannelType red,
082 SelectedChannelType green, SelectedChannelType blue);
083
084 /**
085 * Wrap up a "Categorize" function using the provided expressions.
086 * <p>
087 * The function will be created based on:
088 * <ol>
089 * <li>PropertyName; use "Rasterdata" to indicate this is a color map
090 * <li>Literal: lookup value
091 * <li>Literal: threshold 1
092 * <li>Literal: value 1
093 * <li>Literal: threshold 2
094 * <li>Literal: value 2
095 * <li>Literal: (Optional) succeeding or preceding
096 * </ol>
097 * @param propertyName
098 * Property name to categorize, or use "Raster"
099 * @param mapping
100 * Defined as a series of Expressions
101 * @return ColorMap wrapped around the "Cateogize" function
102 */
103 ColorMap colorMap(Expression propertyName, Expression... mapping);
104
105 /**
106 * Wrap up a replacement function using the provided expressions.
107 *
108 * @param propertyName
109 * Property name to categorize, or use "Raster"
110 * @param mapping
111 * Defined as a series of Expressions
112 * @return ColorReplacement wrapped around a Function
113 */
114 ColorReplacement colorReplacement(Expression propertyName,
115 Expression... mapping);
116 /**
117 *
118 * @param gamma
119 * @param method
120 * @return
121 */
122 ContrastEnhancement contrastEnhancement(Expression gamma,
123 ContrastMethod method);
124
125 /**
126 *
127 * @param title
128 * @param description
129 * @return
130 */
131 Description description(InternationalString title,
132 InternationalString description);
133
134 /**
135 *
136 * @param dx
137 * @param dy
138 * @return
139 */
140 Displacement displacement(Expression dx, Expression dy);
141
142 /**
143 *
144 * @param resource
145 * @param format
146 * @param replacements
147 * @return
148 */
149 ExternalGraphic externalGraphic(OnlineResource resource,
150 String format, Collection<ColorReplacement> replacements);
151
152 /**
153 *
154 * @param inline
155 * @param replacements
156 * @return
157 */
158 ExternalGraphic externalGraphic(Icon inline,
159 Collection<ColorReplacement> replacements);
160
161 /**
162 *
163 * @param resource
164 * @param format
165 * @param markIndex
166 * @return
167 */
168 ExternalMark externalMark(OnlineResource resource, String format,
169 int markIndex);
170
171 /**
172 *
173 * @param inline
174 * @return
175 */
176 ExternalMark externalMark(Icon inline);
177
178 /**
179 *
180 * @param name
181 * @param description
182 * @param definedFor
183 * @param featureTypeNames
184 * @param types
185 * @param rules
186 * May not be null or empty
187 * @return
188 */
189 FeatureTypeStyle featureTypeStyle(String name,
190 Description description, Id definedFor, Set<Name> featureTypeNames,
191 Set<SemanticType> types, List<Rule> rules);
192
193 /**
194 *
195 * @param fill
196 * @param color
197 * @param opacity
198 * @return
199 */
200 Fill fill(GraphicFill fill, Expression color, Expression opacity);
201
202 /**
203 *
204 * @param family
205 * @param style
206 * @param weight
207 * @param size
208 * @return
209 */
210 Font font(List<Expression> family, Expression style,
211 Expression weight, Expression size);
212
213 Graphic graphic(List<GraphicalSymbol> symbols,
214 Expression opacity, Expression size, Expression rotation,
215 AnchorPoint anchor, Displacement disp);
216
217 /**
218 *
219 * @param symbols
220 * @param opacity
221 * @param size
222 * @param anchorPoint
223 * @param displacement
224 * @return
225 */
226 GraphicFill graphicFill(List<GraphicalSymbol> symbols,
227 Expression opacity, Expression size, Expression rotation,
228 AnchorPoint anchorPoint, Displacement displacement);
229
230 /**
231 *
232 * @param symbols
233 * @param opacity
234 * @param size
235 * @param anchorPoint
236 * @param displacement
237 * @return
238 */
239 GraphicLegend graphicLegend(List<GraphicalSymbol> symbols,
240 Expression opacity, Expression size, Expression rotation,
241 AnchorPoint anchorPoint, Displacement displacement);
242 /**
243 *
244 * @param symbols
245 * @param opacity
246 * @param size
247 * @param anchorPoint
248 * @param displacement
249 * @param initialGap
250 * @param gap
251 * @return
252 */
253 GraphicStroke graphicStroke(List<GraphicalSymbol> symbols,
254 Expression opacity, Expression size, Expression rotation,
255 AnchorPoint anchorPoint, Displacement displacement,
256 Expression initialGap, Expression gap);
257
258 /**
259 *
260 * @param fill
261 * @param radius
262 * @return
263 */
264 Halo halo(Fill fill, Expression radius);
265
266 /**
267 *
268 * @param offset
269 * @param initialGap
270 * @param gap
271 * @param repeated
272 * @param aligned
273 * @param generalizedLine
274 * @return
275 */
276 LinePlacement linePlacement(Expression offset, Expression initialGap,
277 Expression gap, boolean repeated, boolean aligned,
278 boolean generalizedLine);
279 /**
280 * @param name handle used to refer to this symbolizer (machine readible)
281 * @param geometry Expression used to produce the Geometry to renderer; often a PropertyName
282 * @param description
283 * @param unit Unit of measure used to define this symbolizer
284 * @param stroke Definition of how to stroke linework
285 * @param offset Offset used to position line relative to origional
286 * @return Newly created Line Symbolizer
287 */
288 LineSymbolizer lineSymbolizer(String name, Expression geometry,
289 Description description, Unit<?> unit, Stroke stroke, Expression offset);
290
291 /**
292 *
293 * @param wellKnownName
294 * @param fill
295 * @param stroke
296 * @return
297 */
298 Mark mark(Expression wellKnownName, Fill fill, Stroke stroke);
299 /**
300 *
301 * @param externalMark
302 * @param fill
303 * @param stroke
304 * @return
305 */
306 Mark mark(ExternalMark externalMark, Fill fill, Stroke stroke);
307 /**
308 *
309 * @param anchor
310 * @param displacement
311 * @param rotation
312 * @return
313 */
314 PointPlacement pointPlacement(AnchorPoint anchor,
315 Displacement displacement, Expression rotation);
316 /**
317 * Creation of a PointSymbolizer to describe how geometry can be rendered as a point.
318 *
319 * @param name handle used to refer to this symbolizer (machine readable)
320 * @param geometry Expression used to extract the Geometry rendered; usually a PropertyName
321 * @param description Human readable description of symboizer
322 * @param unit Unit of Measure used to interpret symbolizer distances
323 * @param graphic Graphic used to represent the geometry when rendering
324 * @return Newly created PointSymbolizer
325 */
326 PointSymbolizer pointSymbolizer(String name, Expression geometry,
327 Description description, Unit<?> unit, Graphic graphic);
328 /**
329 *
330 * @param name handle used to refer to this symbolizer (machine readable)
331 * @param geometry Expression used to extract the Geometry rendered; usually a PropertyName
332 * @param description Human readable description of symboizer
333 * @param unit Unit of Measure used to interpret symbolizer distances
334 * @param stroke
335 * @param fill
336 * @param displacement
337 * @param offset
338 * @return
339 */
340 PolygonSymbolizer polygonSymbolizer(String name, Expression geometry,
341 Description description, Unit<?> unit, Stroke stroke, Fill fill,
342 Displacement displacement, Expression offset);
343 /**
344 *
345 * @param name handle used to refer to this symbolizer (machine readable)
346 * @param geometry Expression used to extract the Geometry rendered; usually a PropertyName
347 * @param description Human readable description of symboizer
348 * @param unit Unit of Measure used to interpret symbolizer distances
349 * @param opacity
350 * @param channelSelection
351 * @param overlapsBehaviour
352 * @param colorMap
353 * @param contrast
354 * @param shaded
355 * @param outline
356 * @return RasterSymbolizer
357 */
358 RasterSymbolizer rasterSymbolizer(String name, Expression geometry,
359 Description description, Unit<?> unit, Expression opacity,
360 ChannelSelection channelSelection,
361 OverlapBehavior overlapsBehaviour, ColorMap colorMap,
362 ContrastEnhancement contrast, ShadedRelief shaded,
363 Symbolizer outline);
364 /**
365 * Used to represent a symbolizer intended for a vendor specific rendering process. This
366 * facility should be used to control subject matter that is beyond the scope of the traditional
367 * symbology encoding data structure (subject matter like wind barbs or extra deegrees of
368 * freedom like temporal symbolizers are good examples of the use of this facility).
369 *
370 * @param name
371 * handle used to refer to this symbolizer (machine readible)
372 * @param geometry
373 * Geometry expression to renderer; formally a PropertyName
374 * @param description
375 * Description of this symbolizer; human readable
376 * @param unit
377 * Unit of measure to use when interpretting this symbolizer
378 * @param extensionName
379 * Extension name used to identify the vendor specific extension being controlled
380 * @param parameters
381 * Named expressions used to configure the vendor specific rendering process
382 * @return newly created ExtensionSymbolizer
383 */
384 ExtensionSymbolizer extensionSymbolizer(String name, String geometry, Description description,
385 Unit<?> unit, String extensionName, Map<String, Expression> parameters);
386
387 /**
388 * Create a rule from the provided definition.
389 *
390 * @param name handle used to refer to this rule (machine readable)
391 * @param description Human readable description of this rule
392 * @param legend Graphic used to indicate this rule in a legend or user interface
393 * @param min minimum scale denominator used to control when this rule is applied
394 * @param max maximum scale denominator used to control when this rule is applied
395 * @param symbolizers
396 * @param filter
397 * @return Newly created Rule
398 */
399 Rule rule(String name, Description description, GraphicLegend legend,
400 double min, double max, List<Symbolizer> symbolizers, Filter filter);
401
402 /**
403 *
404 * @param channelName
405 * @param contrastEnhancement
406 * @return SelectedChannelType
407 */
408 SelectedChannelType selectedChannelType(String channelName, ContrastEnhancement contrastEnhancement);
409 /**
410 *
411 * @param reliefFactor
412 * @param brightnessOnly
413 * @return ShadedRelief
414 */
415 ShadedRelief shadedRelief(Expression reliefFactor,
416 boolean brightnessOnly);
417
418 Stroke stroke(
419 Expression color,
420 Expression opacity,
421 Expression width,
422 Expression join,
423 Expression cap,
424 float[] dashes,
425 Expression offset);
426
427 Stroke stroke(
428 GraphicFill fill,
429 Expression color,
430 Expression opacity,
431 Expression width,
432 Expression join,
433 Expression cap,
434 float[] dashes,
435 Expression offset);
436
437 Stroke stroke(
438 GraphicStroke stroke,
439 Expression color,
440 Expression opacity,
441 Expression width,
442 Expression join,
443 Expression cap,
444 float[] dashes,
445 Expression offset);
446
447 /**
448 *
449 * @param name
450 * @param description
451 * @param isDefault
452 * @param featureTypeStyles
453 * @param defaultSymbolizer
454 * @return
455 */
456 Style style(String name, Description description, boolean isDefault,
457 List<FeatureTypeStyle> featureTypeStyles,
458 Symbolizer defaultSymbolizer);
459 /**
460 * Creation of a TextSymbolizer defining how labels are portrayed.
461 *
462 * @param name Handle used to refer to this symbolizer (machine readable)
463 * @param geometry Geometry to be rendered
464 * @param description Human readable description
465 * @param unit Unit of measure used to interpret symbolizer sizes
466 * @param label Text displayed for this symbolizer
467 * @param font Font selected to renderer this symbolizer
468 * @param placement Placement information relative to orgiginal geometry
469 * @param halo definition of a halo or outline surrounding the symbolizer
470 * @param fill definition of fill used
471 * @return newly created TextSymbolizer
472 */
473 TextSymbolizer textSymbolizer(String name, Expression geometry,
474 Description description, Unit<?> unit, Expression label, Font font,
475 LabelPlacement placement, Halo halo, Fill fill);
476 }