Statistics
| Revision:

svn-document-layout / trunk / org.gvsig.app.document.layout2.app / org.gvsig.app.document.layout2.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / fframes / IFFrameUseFMap.java @ 324

History | View | Annotate | Download (8.83 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.app.project.documents.layout.fframes;
23

    
24
import java.awt.geom.AffineTransform;
25
import java.awt.geom.Point2D;
26
import java.awt.image.BufferedImage;
27

    
28
import org.gvsig.fmap.dal.exception.ReadException;
29
import org.gvsig.fmap.geom.primitive.Envelope;
30
import org.gvsig.fmap.mapcontext.MapContext;
31

    
32
/**
33
 * FFrame which uses a MapContext object, usually because their content is
34
 * dependent on the MapContext properties
35
 */
36
public interface IFFrameUseFMap extends IFFrame {
37
    public AffineTransform getATMap();
38

    
39
    public void setATMap(AffineTransform at);
40

    
41
    /**
42
     * Returns the MapContext contained in this FFrameView, which is
43
     * usually a clone of the associated View. This MapContext
44
     * may be synchronized with the View one, depending on the
45
     * scale type that has been set (see {{@link #getTypeScale()}.
46
     * 
47
     * @return The mapContext object
48
     */
49
    public MapContext getMapContext();
50

    
51
    /**
52
     * Invalidates the FFrameView cache, which will cause the
53
     * FFrame to be repainted on the next drawing cycle.
54
     */
55
    public void refresh();
56

    
57
    /**
58
     * Sets the extent of the MapContext contained in this FFrameView. It will
59
     * be ignored if {@link #getScaleType()} equals to
60
     * {@link SCALE_TYPE#FIXED_SCALE} or {@link SCALE_TYPE#FIXED_EXTENT}
61
     * 
62
     * @param r Envelope to be set
63
     */
64
    public void setNewEnvelope(Envelope r);
65

    
66
    /**
67
     * Gets a buffered image containing a cached version of the
68
     * painted result of this FFrame. The size of the buffered image
69
     * will match only the visible area of the component, not the full
70
     * size of it. 
71
     * 
72
     * @return The cached image or null if the image is not available
73
     */
74
    public BufferedImage getBufferedImage();
75

    
76
    /**
77
     * Zooms to the extent containing all the layers loaded in the map. 
78
     * 
79
     * @throws ReadException
80
     */
81
    public void fullExtent() throws ReadException;
82

    
83
    public void setPointsToZoom(Point2D px1, Point2D px2);
84

    
85
    public void movePoints(Point2D px1, Point2D px2);
86

    
87
    public void refreshOriginalExtent();    
88
    
89
    /**
90
     * Gets the synchronization mode for layers. If <code>true</code>, layers
91
     * will be synchronized between the FFrameView and the associated View, so
92
     * any change in the FFrameView (layer added or removed, visibility changed,
93
     * symbology change, etc) will be propagated to the associated View, and
94
     * vice versa.
95
     * 
96
     * @return <code>true</code> if the layers are synchronized between the 
97
     * FFrameView and the View, <code>false</code> otherwise.
98
     */
99
    public boolean getLayerSynced();
100

    
101
    /**
102
     * Sets the synchronization mode for map layers. If <code>true</code>,
103
     * layers will be synchronized between the FFrameView and the associated
104
     * View, so any change in the FFrameView (layer added or removed,
105
     * visibility changed, symbology change, etc) will be propagated to the
106
     * associated View, and vice versa.
107
     * 
108
     * @param synced <code>true</code> to enable layers synchronization
109
     * between the FFrameView and the View, <code>false</code> otherwise.
110
     */
111
    public void setLayerSynced(boolean synced);
112

    
113
    /**
114
     * Gets the synchronization mode for the map extent. If <code>true</code>,
115
     * the map extent will be synchronized between the FFrameView and the
116
     * associated View, so any change in the FFrameView (pan, zoom in, zoom
117
     * out...) will be propagated to the associated View, and vice versa.
118
     * 
119
     * @return <code>true</code> if the map extent is synchronized between the 
120
     * FFrameView and the View, <code>false</code> otherwise.
121
     */
122
    public boolean getExtentSynced();
123
    
124
    /**
125
     * Sets the synchronization mode for the map extent. If <code>true</code>,
126
     * the map extent will be synchronized between the FFrameView and the
127
     * associated View, so any change in the FFrameView (pan, zoom in, zoom
128
     * out...) will be propagated to the associated View, and vice versa.
129
     * 
130
     * @param synced <code>true</code> to enable extent synchronization
131
     * between the FFrameView and the View, <code>false</code> otherwise.
132
     */
133
    public void setExtentSynced(boolean synced);
134
    
135
    /**
136
     * Sets the scale of the MapContext contained in this FFrameView. It will
137
     * be ignored if {@link #getScaleType()} equals to
138
     * {@link SCALE_TYPE#FIXED_SCALE} or {@link SCALE_TYPE#FIXED_EXTENT} 
139
     * 
140
     * @param d Scale to be set
141
     */
142
    public void setScale(double d);
143
    
144
    public static enum SCALE_TYPE {
145
            /**
146
             * The scale and extent can be changed without restrictions 
147
             */
148
            NORMAL,
149
            /**
150
             * The scale has been fixed, so pans are enabled but the scale
151
             * can't be changed and the zoom in/out tools also behave as
152
             * pans. 
153
             */
154
            FIXED_SCALE,
155
            /**
156
             * The extent has been fixed, so the scale can't be changed and
157
             * the pan and zoom tools will not produce any change 
158
             */
159
            FIXED_EXTENT
160
    };
161
    
162
    /**
163
     * Gets the scale and extent types. It can be one of the following:
164
     * {@link SCALE_TYPE#NORMAL}, {@link SCALE_TYPE#FIXED_SCALE}
165
     * or {@link SCALE_TYPE#FIXED_EXTENT}
166
     * 
167
     * @return The scale type
168
     */
169
    public SCALE_TYPE getScaleType();
170
    
171

    
172
    /**
173
     * Sets the scale and extent types. It can be one of the following:
174
     * {@link SCALE_TYPE#NORMAL}, {@link SCALE_TYPE#FIXED_SCALE}
175
     * or {@link SCALE_TYPE#FIXED_EXTENT}
176
     * 
177
     * @return The scale type
178
     */
179
    public void setScaleType(SCALE_TYPE scaleType);
180
    
181
    /*    
182
    DEPRECATED METHODS AND CONSTANTS, KEPT FOR THE MOMENT FOR
183
    BACKWARD-COMPATIBILITY. THEY SHOULD BE REMOVED ON FUTURE RELEASES
184
     */
185
    /**
186
     * Kept for the moment for backward-compatibility, it will be
187
     * removed on the future.
188
     * 
189
     * @Deprecated Replaced by {@link #getExtentSynced()},
190
     * {@link #setExtentSynced(boolean)}, {@link #getLayerSynced()},
191
     * {@link #setLayerSynced(boolean)}, {@link #getScaleType()}
192
     * and {@link #setScaleType(SCALE_TYPE)}.
193
     */
194
    @Deprecated
195
    public static final int AUTOMATICO = 0;
196
    /**
197
     * Kept for the moment for backward-compatibility, it will be
198
     * removed on the future.
199
     * 
200
     * @Deprecated Replaced by {@link #getExtentSynced()},
201
     * {@link #setExtentSynced(boolean)}, {@link #getLayerSynced()},
202
     * {@link #setLayerSynced(boolean)}, {@link #getScaleType()}
203
     * and {@link #setScaleType(SCALE_TYPE)}.
204
     */
205
    @Deprecated
206
    public static final int CONSTANTE = 1;
207
    /**
208
     * @Deprecated Replaced by {@link #getExtentSynced()},
209
     * {@link #setExtentSynced(boolean)}, {@link #getLayerSynced()},
210
     * {@link #setLayerSynced(boolean)}, {@link #getScaleType()}
211
     * and {@link #setScaleType(SCALE_TYPE)}.
212
     */
213
    @Deprecated
214
    public static final int MANUAL = 2;
215

    
216
    /**
217
     * Kept for the moment for backward-compatibility, it will be
218
     * removed on the future.
219
     * @Deprecated Replaced by {@link #getExtentSynced()},
220
     * {@link #setExtentSynced(boolean)}, {@link #getLayerSynced()},
221
     * {@link #setLayerSynced(boolean)}, {@link #getScaleType()}
222
     * and {@link #setScaleType(SCALE_TYPE)}.
223
     */
224
    @Deprecated
225
    public int getTypeScale();
226

    
227
    
228
    /**
229
     * Kept for the moment for backward-compatibility, it will be
230
     * removed on the future.
231
     * 
232
     * @Deprecated Replaced by {@link #getExtentSynced()},
233
     * {@link #setExtentSynced(boolean)}, {@link #getLayerSynced()},
234
     * {@link #setLayerSynced(boolean)}, {@link #getScaleType()}
235
     * and {@link #setScaleType(SCALE_TYPE)}.
236
     */
237
    @Deprecated
238
    public void setLinked(boolean b);
239

    
240
    /**
241
     * Kept for the moment for backward-compatibility, it will be
242
     * removed on the future.
243
     * 
244
     * @Deprecated Replaced by {@link #getExtentSynced()},
245
     * {@link #setExtentSynced(boolean)}, {@link #getLayerSynced()},
246
     * {@link #setLayerSynced(boolean)}, {@link #getScaleType()}
247
     * and {@link #setScaleType(SCALE_TYPE)}.
248
     */
249
    @Deprecated
250
    public boolean getLinked();
251
}