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 @ 298

History | View | Annotate | Download (8.83 KB)

1 5 jldominguez
/* 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 176 cmartinez
/**
33
 * FFrame which uses a MapContext object, usually because their content is
34
 * dependent on the MapContext properties
35
 */
36 147 cmartinez
public interface IFFrameUseFMap extends IFFrame {
37 5 jldominguez
    public AffineTransform getATMap();
38
39
    public void setATMap(AffineTransform at);
40
41 176 cmartinez
    /**
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 5 jldominguez
    public MapContext getMapContext();
50
51 250 cmartinez
    /**
52
     * Invalidates the FFrameView cache, which will cause the
53
     * FFrame to be repainted on the next drawing cycle.
54
     */
55 5 jldominguez
    public void refresh();
56
57 176 cmartinez
    /**
58 250 cmartinez
     * 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 176 cmartinez
     *
62
     * @param r Envelope to be set
63
     */
64 5 jldominguez
    public void setNewEnvelope(Envelope r);
65
66 181 cmartinez
    /**
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 5 jldominguez
    public BufferedImage getBufferedImage();
75
76 219 cmartinez
    /**
77
     * Zooms to the extent containing all the layers loaded in the map.
78
     *
79
     * @throws ReadException
80
     */
81 5 jldominguez
    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 219 cmartinez
    public void refreshOriginalExtent();
88
89 176 cmartinez
    /**
90 219 cmartinez
     * 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 176 cmartinez
     */
99 219 cmartinez
    public boolean getLayerSynced();
100 5 jldominguez
101 51 jldominguez
    /**
102 219 cmartinez
     * 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 51 jldominguez
     *
108 219 cmartinez
     * @param synced <code>true</code> to enable layers synchronization
109
     * between the FFrameView and the View, <code>false</code> otherwise.
110 51 jldominguez
     */
111 219 cmartinez
    public void setLayerSynced(boolean synced);
112 51 jldominguez
113
    /**
114 219 cmartinez
     * 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 51 jldominguez
     *
119 219 cmartinez
     * @return <code>true</code> if the map extent is synchronized between the
120
     * FFrameView and the View, <code>false</code> otherwise.
121 51 jldominguez
     */
122 219 cmartinez
    public boolean getExtentSynced();
123 176 cmartinez
124
    /**
125 219 cmartinez
     * 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 250 cmartinez
     * 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 176 cmartinez
     *
140
     * @param d Scale to be set
141
     */
142
    public void setScale(double d);
143 250 cmartinez
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 5 jldominguez
}