Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / layers / vectorial / GraphicLayer.java @ 38605

History | View | Annotate | Download (7.59 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.fmap.mapcontext.layers.vectorial;
23

    
24
import java.util.Iterator;
25

    
26
import org.gvsig.fmap.geom.Geometry;
27
import org.gvsig.fmap.mapcontext.MapContext;
28
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
29
import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol;
30

    
31
/**
32
 * Utility layer to be able to draw graphics in a {@link MapContext}. Those
33
 * graphics won't be stored and will be rendered on top of all the other
34
 * MapContext's layers.
35
 * 
36
 * @author gvSIG team
37
 * @version $Id$
38
 */
39
public interface GraphicLayer extends VectorLayer {
40

    
41
        public static final int DEFAULT_PRIORITY = 100;
42

    
43
        public static final String FEATURE_ATTR_FEATUREID = "featureId";
44
        public static final String FEATURE_ATTR_GROUPID = "groupId";
45
        public static final String FEATURE_ATTR_GEOMETRY = "geom";
46
        public static final String FEATURE_ATTR_IDSYMBOL = "idsym";
47
        public static final String FEATURE_ATTR_LABEL = "label";
48
        public static final String FEATURE_ATTR_TAG = "tag";
49
        public static final String FEATURE_ATTR_PRIORITY = "priority";
50

    
51
        /**
52
         * Adds a new {@link ISymbol} to the layer to be used to render the
53
         * {@link Geometry} objects. The symbol will be added to the legend of the
54
         * layer.
55
         * 
56
         * @param newSymbol
57
         *            the {@link ISymbol} to add
58
         * @return an identifier of the symbol to be used when adding geometries
59
         */
60
        public int addSymbol(ISymbol newSymbol);
61

    
62
        /**
63
         * Returns the {@link ISymbol} of the layer with the given identifier.
64
         * 
65
         * @param symbolId
66
         *            the symbol identifier
67
         * @return the symbol with the given id or null if there is not any symbol
68
         *         registered with that id
69
         */
70
        public ISymbol getSymbol(int symbolId);
71

    
72
        /**
73
         * Returns the identifier of the symbol into the layer.
74
         * 
75
         * @param symbol
76
         *            the symbol to look for
77
         * @return the symbol identifier or -1 if it is not registered into the
78
         *         layer
79
         */
80
        public int getSymbolId(ISymbol symbol);
81

    
82
        /**
83
         * @deprecated @see
84
         *             {@link #addGraphic(String, Geometry, int, String, Object, int)
85

86
         */
87
        public void addGraphic(Geometry geom, int idsym);
88

    
89
        /**
90
         * @deprecated @see
91
         *             {@link #addGraphic(String, Geometry, int, String, Object, int)
92

93
         */
94
        public void addGraphic(Geometry geom, int idsym, String label);
95

    
96
    /**
97
     * Adds a new {@link Geometry} to be rendered into the layer.
98
     * 
99
     * @param groupId
100
     *            group identifier. Allows to identify a group of
101
     *            {@link Geometry} added to the layer
102
     * @param geom
103
     *            the {@link Geometry} to add
104
     * @param idsym
105
     *            the {@link ISymbol} identifier to apply to render the
106
     *            {@link Geometry}
107
     */
108
    public void addGraphic(String groupId, Geometry geom, int idsym);
109

    
110
        /**
111
         * Adds a new {@link Geometry} to be rendered into the layer.
112
         * 
113
         * @param groupId
114
         *            group identifier. Allows to identify a group of
115
         *            {@link Geometry} added to the layer
116
         * @param geom
117
         *            the {@link Geometry} to add
118
         * @param idsym
119
         *            the {@link ISymbol} identifier to apply to render the
120
         *            {@link Geometry}
121
         * @param label
122
         *            the text to show if the {@link ISymbol} is a
123
         *            {@link ITextSymbol}. Set null otherwise.
124
         */
125
        public void addGraphic(String groupId, Geometry geom, int idsym,
126
                        String label);
127

    
128
        /**
129
         * Adds a new {@link Geometry} to be rendered into the layer.
130
         * 
131
         * @param groupId
132
         *            group identifier. Allows to identify a group of
133
         *            {@link Geometry} added to the layer
134
         * @param geom
135
         *            the {@link Geometry} to add
136
         * @param idsym
137
         *            the {@link ISymbol} identifier to apply to render the
138
         *            {@link Geometry}
139
         * @param label
140
         *            the text to show if the {@link ISymbol} is a
141
         *            {@link ITextSymbol}. Set null otherwise.
142
         * @param tag
143
         *            an object to classify, identify or add related information to
144
         *            the {@link Geometry}
145
         * @param priority
146
         *            to apply while rendering the {@link Geometry}. Values with
147
         *            lower priority will be rendered first.
148
         */
149
        public void addGraphic(String groupId, Geometry geom, int idsym,
150
                        String label, Object tag, int priority);
151

    
152
    /**
153
     * Adds a new {@link Geometry} to be rendered into the layer.
154
     * 
155
     * @param groupId
156
     *            group identifier. Allows to identify a group of
157
     *            {@link Geometry} added to the layer
158
     * @param geoms
159
     *            the {@link Geometry}s to add
160
     * @param idsym
161
     *            the {@link ISymbol} identifier to apply to render the
162
     *            {@link Geometry}
163
     */
164
    public void addGraphics(String groupId, Iterator geoms, int idsym);
165

    
166
    /**
167
     * Adds a new {@link Geometry} to be rendered into the layer.
168
     * 
169
     * @param groupId
170
     *            group identifier. Allows to identify a group of
171
     *            {@link Geometry} added to the layer
172
     * @param geoms
173
     *            the {@link Geometry}s to add
174
     * @param idsym
175
     *            the {@link ISymbol} identifier to apply to render the
176
     *            {@link Geometry}
177
     * @param label
178
     *            the text to show if the {@link ISymbol} is a
179
     *            {@link ITextSymbol}. Set null otherwise.
180
     */
181
    public void addGraphics(String groupId, Iterator geoms, int idsym,
182
        String label);
183

    
184
    /**
185
     * Adds a new {@link Geometry} to be rendered into the layer.
186
     * 
187
     * @param groupId
188
     *            group identifier. Allows to identify a group of
189
     *            {@link Geometry} added to the layer
190
     * @param geoms
191
     *            the {@link Geometry}s to add
192
     * @param idsym
193
     *            the {@link ISymbol} identifier to apply to render the
194
     *            {@link Geometry}
195
     * @param label
196
     *            the text to show if the {@link ISymbol} is a
197
     *            {@link ITextSymbol}. Set null otherwise.
198
     * @param tag
199
     *            an object to classify, identify or add related information to
200
     *            the {@link Geometry}
201
     * @param priority
202
     *            to apply while rendering the {@link Geometry}. Values with
203
     *            lower priority will be rendered first.
204
     */
205
    public void addGraphics(String groupId, Iterator geoms, int idsym,
206
        String label, Object tag, int priority);
207

    
208
        /**
209
         * Removes all previously registered {@link Geometry} objects from the layer
210
         * with the given groupId.
211
         * 
212
         * @param groupId
213
         *            of the geometries to remove
214
         */
215
        public void removeGraphics(String groupId);
216

    
217
        /**
218
         * Removes all registered {@link Geometry} objects.
219
         */
220
        public void clearAllGraphics();
221

    
222
        /**
223
         * Removes all registered {@link ISymbol} objects.
224
         */
225
        public int clearAllSymbols();
226

    
227
}