Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.api / src / main / java / org / gvsig / fmap / mapcontext / layers / vectorial / GraphicLayer.java @ 40559

History | View | Annotate | Download (7.64 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.fmap.mapcontext.layers.vectorial;
25

    
26
import java.util.Iterator;
27

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

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

    
43
        public static final int DEFAULT_PRIORITY = 100;
44

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

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

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

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

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

88
         */
89
        public void addGraphic(Geometry geom, int idsym);
90

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

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

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

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

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

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

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

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

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

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

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

    
229
}