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 / rendering / legend / IVectorLegend.java @ 40559

History | View | Annotate | Download (5.92 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.rendering.legend;
25

    
26
import java.awt.Graphics2D;
27
import java.awt.image.BufferedImage;
28
import java.util.Map;
29

    
30
import org.cresques.cts.ICoordTrans;
31

    
32
import org.gvsig.compat.print.PrintAttributes;
33
import org.gvsig.fmap.dal.feature.Feature;
34
import org.gvsig.fmap.dal.feature.FeatureQuery;
35
import org.gvsig.fmap.dal.feature.FeatureStore;
36
import org.gvsig.fmap.mapcontext.MapContextException;
37
import org.gvsig.fmap.mapcontext.ViewPort;
38
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
39
import org.gvsig.tools.task.Cancellable;
40

    
41

    
42

    
43
/**
44
 * Interface of a vectorial legend.
45
 *
46
 * @author Vicente Caballero Navarro
47
 */
48
public interface IVectorLegend extends ILegend, DrawingObservable {
49
        /**
50
         * Inserts the DataSource.
51
         *
52
         * @param ds DataSource.
53
         * @throws DataException TODO
54
         * @throws FieldNotFoundException when the field is not found.
55
         */
56
//        void setFeatureStore(FeatureStore fs)
57
//                throws DataException;
58

    
59
        /**
60
         * Returns the symbol to be used to represent the feature in the i-th
61
         * record in the DataSource
62
         * @param i, the record index
63
         *
64
         * @return ISymbol.
65
         */
66
//        ISymbol getSymbol(int i) throws ReadException;
67
        /**
68
     * Returns a symbol starting from an IFeature.
69
         *
70
         * TAKE CARE!! When we are using a feature iterator as a database
71
         * the only field that will be filled is the fieldID.
72
         * The rest of fields will be null to reduce the time of creation
73
         *
74
         * @param feat IFeature.
75
         *
76
         * @return S?mbolo.
77
         * @throws MapContextException 
78
         */
79
    ISymbol getSymbolByFeature(Feature feat) throws MapContextException;
80

    
81
        /**
82
         * Returns the type of the shape.
83
         *
84
         * @return Returns the type of the shapes that the legend is ready to use.
85
         *
86
         */
87
        int getShapeType();
88

    
89
        /**
90
         * Defines the type of the shape.
91
         *
92
         * @param shapeType type of the shape.
93
         */
94
        void setShapeType(int shapeType);
95

    
96
        /**
97
         * Establishes the default symbol of a legend. In a SingleSymbolLegend the symbol
98
         * is established by calling this method.
99
         *
100
         * @param s default symbol.
101
         */
102
        void setDefaultSymbol(ISymbol s);
103

    
104
        /**
105
     * Returns true or false depending on if the rest of values are used.
106
         *
107
         * @return  True if the rest of values are used.
108
         */
109
    public boolean isUseDefaultSymbol();
110

    
111
    void useDefaultSymbol(boolean b);
112

    
113
//   jjdc los eliminamos, y debe quedar dependiente de la implementacion y n de api
114
//   public ZSort getZSort();
115
//
116
//        public void setZSort(ZSort zSort);
117
//
118
        public boolean isSuitableForShapeType(int shapeType);
119

    
120
        /**
121
         * Draws the {@link FeatureStore} data using this legend simbology.
122
         * 
123
         * @param image
124
         *            the base image to draw over
125
         * @param graphics2D
126
         *            the {@link Graphics2D} to draw to
127
         * @param viewPort
128
         *            the ViewPort to use
129
         * @param cancel
130
         *            the {@link Cancellable} delegate object
131
         * @param scale
132
         *            the scale of the view
133
         * @param queryParameters
134
         *            the query parameters
135
         * @param coordTrans
136
         *            the transformation coordinates to use for reprojection
137
         * @param featureStore
138
         *                           {@link FeatureStore} to load the data to draw from
139
         * @throws LegendException
140
         */
141
        void draw(BufferedImage image, Graphics2D graphics2D, ViewPort viewPort,
142
                        Cancellable cancel, double scale, Map queryParameters,
143
                        ICoordTrans coordTrans, FeatureStore featureStore)
144
                        throws LegendException;
145
        
146
         /**
147
     * Draws the {@link FeatureStore} data using this legend simbology.
148
     * 
149
     * @param image
150
     *            the base image to draw over
151
     * @param graphics2D
152
     *            the {@link Graphics2D} to draw to
153
     * @param viewPort
154
     *            the ViewPort to use
155
     * @param cancel
156
     *            the {@link Cancellable} delegate object
157
     * @param scale
158
     *            the scale of the view
159
     * @param queryParameters
160
     *            the query parameters
161
     * @param coordTrans
162
     *            the transformation coordinates to use for reprojection
163
     * @param featureStore
164
     *            {@link FeatureStore} to load the data to draw from
165
     * @param featureQuery 
166
     *            the query used to filter the features.
167
     * @throws LegendException
168
     */
169
    void draw(BufferedImage image, Graphics2D graphics2D, ViewPort viewPort,
170
            Cancellable cancel, double scale, Map queryParameters,
171
            ICoordTrans coordTrans, FeatureStore featureStore, FeatureQuery featureQuery)
172
            throws LegendException;
173

    
174
        void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
175
                        double scale, Map queryParameters, ICoordTrans coordTrans,
176
                        FeatureStore featureStore, PrintAttributes properties) throws LegendException;
177
        
178
        void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
179
        double scale, Map queryParameters, ICoordTrans coordTrans,
180
        FeatureStore featureStore, FeatureQuery featureQuery, PrintAttributes properties) throws LegendException;
181

    
182
}