Revision 42173
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/ViewPort.java | ||
---|---|---|
190 | 190 |
* @see #getExtents() |
191 | 191 |
*/ |
192 | 192 |
protected ExtentHistory extentsHistory = new ExtentHistory(); |
193 |
|
|
193 |
|
|
194 | 194 |
/** |
195 | 195 |
* <p> |
196 | 196 |
* Size in <i>screen coordinates</i> of the rectangle where the image is |
... | ... | |
702 | 702 |
*/ |
703 | 703 |
public void setPreviousEnvelope() { |
704 | 704 |
this.updateDrawVersion(); |
705 |
extentsHistory.putNext(extent); |
|
705 | 706 |
extent = extentsHistory.removePrev(); |
706 | 707 |
|
707 | 708 |
// Calcula la transformaci�n af�n |
... | ... | |
722 | 723 |
*/ |
723 | 724 |
public void setNextEnvelope() { |
724 | 725 |
this.updateDrawVersion(); |
726 |
extentsHistory.put(extent); |
|
725 | 727 |
extent = extentsHistory.removeNext(); |
726 | 728 |
|
727 | 729 |
// Calcula la transformaci�n af�n |
... | ... | |
845 | 847 |
if (this.extent != null && this.extent.equals(newExtent)) { |
846 | 848 |
return; |
847 | 849 |
} |
850 |
|
|
848 | 851 |
if (extent != null) { |
849 |
// if (!extent.equals(extentsHistory.get()) && !extent.equals(extentsHistory.getNext()) ) { |
|
850 |
// extentsHistory.clear(); |
|
851 |
// } |
|
852 |
if (!extent.equals(extentsHistory.get()) |
|
853 |
&& !extent.equals(extentsHistory.getNext())) { |
|
854 |
extentsHistory.clear(); |
|
855 |
} |
|
852 | 856 |
extentsHistory.put(extent); |
853 | 857 |
} |
858 |
|
|
854 | 859 |
this.updateDrawVersion(); |
855 | 860 |
this.extent = newExtent; |
856 | 861 |
|
857 | 862 |
// Calcula la transformaci�n af�n |
858 | 863 |
calculateAffineTransform(); |
864 |
|
|
859 | 865 |
|
860 | 866 |
// Lanzamos los eventos de extent cambiado |
861 | 867 |
callExtentChanged(getAdjustedExtent()); |
... | ... | |
1485 | 1491 |
public ExtentHistory getEnvelopes() { |
1486 | 1492 |
return extentsHistory; |
1487 | 1493 |
} |
1488 |
|
|
1489 | 1494 |
|
1490 | 1495 |
/** |
1491 | 1496 |
* <p> |
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/ExtentHistory.java | ||
---|---|---|
129 | 129 |
} |
130 | 130 |
} |
131 | 131 |
} |
132 |
|
|
133 |
public void putNext(Rectangle2D ext) { |
|
134 |
if ((ext != null) && ((numNext < 1) || (ext != extentsNext[numNext - 1])) ) { |
|
135 |
if (numNext < (NUMREC)) { |
|
136 |
extentsNext[numNext] = ext; |
|
137 |
numNext++; |
|
138 |
} else { |
|
139 |
for (int i = 0; i < (NUMREC - 1); i++) { |
|
140 |
extentsNext[i] = extentsNext[i+1]; |
|
141 |
} |
|
142 |
extentsNext[numNext - 1] = ext; |
|
143 |
} |
|
144 |
} |
|
145 |
} |
|
132 | 146 |
|
133 | 147 |
/** |
134 | 148 |
* <p> |
... | ... | |
166 | 180 |
|
167 | 181 |
return ext; |
168 | 182 |
} |
169 |
|
|
183 |
|
|
170 | 184 |
public Rectangle2D getNext() { |
171 | 185 |
if (numNext <= 0) { |
172 | 186 |
return null; |
173 | 187 |
} |
174 |
|
|
188 |
|
|
175 | 189 |
Rectangle2D ext = extentsNext[numNext - 1]; |
176 |
|
|
190 |
|
|
177 | 191 |
return ext; |
178 | 192 |
} |
179 | 193 |
|
... | ... | |
189 | 203 |
if (num <= 0) { |
190 | 204 |
return null; |
191 | 205 |
} |
192 |
if (numNext < (NUMREC)) { |
|
193 |
extentsNext[numNext] = extents[num - 1]; |
|
194 |
numNext++; |
|
195 |
} |
|
196 |
else { |
|
197 |
for (int i = 0; i < (NUMREC - 1); i++) { |
|
198 |
extentsNext[i] = extentsNext[i + 1]; |
|
199 |
} |
|
200 |
extentsNext[numNext - 1] = extents[num - 1]; |
|
201 |
} |
|
202 | 206 |
|
203 | 207 |
Rectangle2D ext = extents[--num]; |
204 | 208 |
return ext; |
... | ... | |
217 | 221 |
return null; |
218 | 222 |
} |
219 | 223 |
|
220 |
if (num < (NUMREC)) { |
|
221 |
extents[num] = extentsNext[numNext - 1]; |
|
222 |
} |
|
223 |
else { |
|
224 |
for (int i = 0; i < (NUMREC - 1); i++) { |
|
225 |
extents[i] = extents[i + 1]; |
|
226 |
} |
|
227 |
extents[num - 1] = extentsNext[numNext - 1]; |
|
228 |
} |
|
229 |
|
|
230 | 224 |
Rectangle2D ext = extentsNext[--numNext]; |
231 | 225 |
return ext; |
232 | 226 |
} |
233 | 227 |
|
234 |
|
|
235 | 228 |
public void clear() { |
236 |
num = 0; |
|
237 | 229 |
numNext = 0; |
238 | 230 |
} |
239 | 231 |
|
240 |
|
|
241 | 232 |
public void loadFromState(PersistentState state) throws PersistenceException { |
242 | 233 |
|
243 | 234 |
num = state.getInt("num"); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ZoomNext.java | ||
---|---|---|
36 | 36 |
public class ZoomNext extends Extension { |
37 | 37 |
|
38 | 38 |
public void initialize() { |
39 |
IconThemeHelper.registerIcon("action", "view-navigation-zoom-next", this);
|
|
39 |
IconThemeHelper.registerIcon("action", "view-navigation-zoom-next", this); |
|
40 | 40 |
} |
41 |
|
|
41 |
|
|
42 | 42 |
public boolean isEnabled() { |
43 | 43 |
ApplicationManager application = ApplicationLocator.getManager(); |
44 | 44 |
|
... | ... | |
46 | 46 |
if (view == null) { |
47 | 47 |
return false; |
48 | 48 |
} |
49 |
|
|
49 | 50 |
ViewDocument document = view.getViewDocument(); |
50 | 51 |
ViewPort vp = document.getMapContext().getViewPort(); |
51 | 52 |
return vp.getEnvelopes().hasNext(); |
... | ... | |
74 | 75 |
|
75 | 76 |
vp.setNextEnvelope(); |
76 | 77 |
document.setModified(true); |
78 |
|
|
77 | 79 |
ApplicationLocator.getManager().refreshMenusAndToolBars(); |
78 | 80 |
} |
79 | 81 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ZoomPrev.java | ||
---|---|---|
32 | 32 |
|
33 | 33 |
/** |
34 | 34 |
* Extensi?n que cambia el extent de la vista al extent anterior. |
35 |
* |
|
36 | 35 |
*/ |
37 | 36 |
public class ZoomPrev extends Extension { |
38 | 37 |
|
39 |
public void postInitialize() { |
|
40 |
} |
|
38 |
public void postInitialize() {} |
|
41 | 39 |
|
42 |
public void initialize() {
|
|
43 |
IconThemeHelper.registerIcon("action", "view-navigation-zoom-back", this);
|
|
44 |
}
|
|
40 |
public void initialize() { |
|
41 |
IconThemeHelper.registerIcon("action", "view-navigation-zoom-back", this); |
|
42 |
} |
|
45 | 43 |
|
46 |
public boolean isEnabled() {
|
|
47 |
ApplicationManager application = ApplicationLocator.getManager();
|
|
44 |
public boolean isEnabled() { |
|
45 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
48 | 46 |
|
49 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
50 |
if (view == null) { |
|
51 |
return false; |
|
52 |
} |
|
53 |
ViewDocument document = view.getViewDocument(); |
|
54 |
ViewPort vp = document.getMapContext().getViewPort(); |
|
55 |
return vp.getEnvelopes().hasPrevious(); |
|
47 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
48 |
if (view == null) { |
|
49 |
return false; |
|
56 | 50 |
} |
51 |
ViewDocument document = view.getViewDocument(); |
|
52 |
ViewPort vp = document.getMapContext().getViewPort(); |
|
53 |
return vp.getEnvelopes().hasPrevious(); |
|
54 |
} |
|
57 | 55 |
|
58 |
public boolean isVisible() {
|
|
59 |
ApplicationManager application = ApplicationLocator.getManager();
|
|
56 |
public boolean isVisible() { |
|
57 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
60 | 58 |
|
61 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
62 |
if (view == null) { |
|
63 |
return false; |
|
64 |
} |
|
65 |
ViewDocument document = view.getViewDocument(); |
|
66 |
return document.getMapContext().getLayers().getLayersCount() > 0; |
|
59 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
60 |
if (view == null) { |
|
61 |
return false; |
|
67 | 62 |
} |
63 |
ViewDocument document = view.getViewDocument(); |
|
64 |
return document.getMapContext().getLayers().getLayersCount() > 0; |
|
65 |
} |
|
68 | 66 |
|
69 |
public void execute(String arg0) {
|
|
70 |
ApplicationManager application = ApplicationLocator.getManager();
|
|
67 |
public void execute(String arg0) { |
|
68 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
71 | 69 |
|
72 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
73 |
if (view == null) { |
|
74 |
return; |
|
75 |
} |
|
76 |
ViewDocument document = view.getViewDocument(); |
|
77 |
ViewPort vp = document.getMapContext().getViewPort(); |
|
78 |
|
|
79 |
vp.setPreviousEnvelope(); |
|
80 |
document.setModified(true); |
|
81 |
ApplicationLocator.getManager().refreshMenusAndToolBars(); |
|
70 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
71 |
if (view == null) { |
|
72 |
return; |
|
82 | 73 |
} |
74 |
ViewDocument document = view.getViewDocument(); |
|
75 |
ViewPort vp = document.getMapContext().getViewPort(); |
|
83 | 76 |
|
77 |
vp.setPreviousEnvelope(); |
|
78 |
document.setModified(true); |
|
79 |
|
|
80 |
ApplicationLocator.getManager().refreshMenusAndToolBars(); |
|
81 |
} |
|
82 |
|
|
84 | 83 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
266 | 266 |
</tool-bar> |
267 | 267 |
</extension> |
268 | 268 |
|
269 |
<!-- |
|
270 | 269 |
<extension class-name="org.gvsig.app.extension.ZoomNext" |
271 | 270 |
description="Extensi?n encargada de gestionar los zooms siguientes al actual." |
272 | 271 |
active="true"> |
... | ... | |
288 | 287 |
<action-tool name="view-navigation-zoom-next"/> |
289 | 288 |
</tool-bar> |
290 | 289 |
</extension> |
291 |
--> |
|
292 | 290 |
|
293 | 291 |
<extension class-name="org.gvsig.app.extension.InfoToolExtension" |
294 | 292 |
description="Extensi?n encargada de gestionar la herramienta de info." |
Also available in: Unified diff