1 package nl.tudelft.simulation.dsol.animation.gis;
2
3 import java.awt.Color;
4 import java.io.Serializable;
5 import java.util.List;
6
7 import org.djutils.draw.bounds.Bounds2d;
8
9 /**
10 * Feature contains an element of a layer, defined by a key value combination, with its own colors.<br>
11 * TODO: minimum scale and maximum scale to draw features has to be added again, but first, scale needs to be defined properly.
12 * <p>
13 * Copyright (c) 2021-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
14 * for project information <a href="https://simulation.tudelft.nl/dsol/manual/" target="_blank">DSOL Manual</a>. The DSOL
15 * project is distributed under a three-clause BSD-style license, which can be found at
16 * <a href="https://https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">DSOL License</a>.
17 * </p>
18 * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
19 */
20 public interface FeatureInterface extends Serializable
21 {
22 /**
23 * Return the key that defines a feature in a layer, can be "*" if no features are defined.
24 * @return String; the key that defines a feature in a layer, can be "*" if no features are defined
25 */
26 String getKey();
27
28 /**
29 * Set the key that defines a feature in a layer, can be "*" if no features are defined.
30 * @param key String; the key that defines a feature in a layer, can be "*" if no features are defined.
31 */
32 void setKey(String key);
33
34 /**
35 * Return the value belonging to the key that defines the feature in a layer, can be "*" if all elements in the data source
36 * that have the correct key have to be drawn.
37 * @return String; the value belonging to the key that defines the feature in a layer, can be "*" if all elements in the
38 * data source that have the correct key have to be drawn.
39 */
40 String getValue();
41 //
42 // /**
43 // * Return the data source, which contains the location of the GIS datasource.
44 // * @return DataSourceInterface the data source, contains the location of the GIS datasource
45 // */
46 // DataSourceInterface getDataSource();
47
48 /**
49 * Return whether the data has been initialized for this feature.
50 * @return boolean; whether the data has been initialized for this feature
51 */
52 boolean isInitialized();
53
54 /**
55 * Set whether the data has been initialized for this feature.
56 * @param initialized boolean; whether the data has been initialized for this feature
57 */
58 void setInitialized(boolean initialized);
59
60 /**
61 * Return the number of shapes for this feature at this moment.
62 * @return int; the number of shapes in the data source
63 */
64 int getNumShapes();
65
66 /**
67 * Return a GisObject.
68 * @param index int; the number of the shape to be returned for this feature
69 * @return GisObject returns a <code>nl.tudelft.simulation.dsol.animation.gis.GisObject</code>
70 * @throws IndexOutOfBoundsException whenever index > numShapes or index < 0
71 */
72 GisObject getShape(int index) throws IndexOutOfBoundsException;
73
74 /**
75 * Return all the shapes of the particular data source for this feature.
76 * @return List the resulting List of <code>nl.tudelft.simulation.dsol.animation.gis.GisObject</code>
77 */
78 List<GisObject> getShapes();
79
80 /**
81 * Return the shapes of the particular data source for this feature, bound to a particular extent.
82 * @param rectangle Bounds2d; the extent of the box (in geo-coordinates)
83 * @return List the resulting List of <code>nl.tudelft.simulation.dsol.animation.gis.GisObject</code>
84 */
85 List<GisObject> getShapes(Bounds2d rectangle);
86
87 // /**
88 // * Set the data source, which contains the location of the GIS data.
89 // * @param dataSource DataSourceInterface; the data source, contains the location of the GIS data
90 // */
91 // void setDataSource(DataSourceInterface dataSource);
92
93 /**
94 * Set the value belonging to the key that defines the feature in a layer, can be "*" if all elements in the data source
95 * that have the correct key have to be drawn.
96 * @param value String; the value belonging to the key that defines the feature in a layer, can be "*" if all elements in
97 * the data source that have the correct key have to be drawn.
98 */
99 void setValue(String value);
100
101 /**
102 * Return the fill color for the layer.
103 * @return Color; the rgb(a) fill color for the layer
104 */
105 Color getFillColor();
106
107 /**
108 * Set the fill color for the layer.
109 * @param fillColor Color; the rgb(a) fill color for the layer
110 */
111 void setFillColor(Color fillColor);
112
113 /**
114 * Return the outline (line) color for the layer.
115 * @return Color; the rgb(a) outline (line) color for the layer
116 */
117 Color getOutlineColor();
118
119 /**
120 * Set the outline (line) color for the layer.
121 * @param outlineColor Color; the rgb(a) outline (line) color for the layer
122 */
123 void setOutlineColor(Color outlineColor);
124
125 }