Revision 42192
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/test/java/org/gvsig/fmap/mapcontext/ExtentHistoryTest.java | ||
---|---|---|
58 | 58 |
history.put(rectangle2); |
59 | 59 |
history.put(rectangle); |
60 | 60 |
|
61 |
assertEquals(rectangle, history.get()); |
|
61 |
assertEquals(rectangle, history.getPrev());
|
|
62 | 62 |
|
63 | 63 |
history = new ExtentHistory(2); |
64 | 64 |
|
... | ... | |
66 | 66 |
history.put(rectangle2); |
67 | 67 |
history.put(rectangle3); |
68 | 68 |
|
69 |
assertEquals(rectangle3, history.get()); |
|
69 |
assertEquals(rectangle3, history.getPrev());
|
|
70 | 70 |
} |
71 | 71 |
|
72 | 72 |
/** |
... | ... | |
83 | 83 |
|
84 | 84 |
assertTrue(history.hasPrevious()); |
85 | 85 |
|
86 |
history.removePrev(); |
|
86 |
history.setPreviousExtent(); //.getPrev();//.removePrev();
|
|
87 | 87 |
assertFalse(history.hasPrevious()); |
88 | 88 |
} |
89 | 89 |
|
90 |
/** |
|
91 |
* Test method for |
|
92 |
* {@link org.gvsig.fmap.mapcontext.ExtentHistory#hasNext()}. |
|
93 |
*/ |
|
94 |
public void testHasNext() { |
|
95 |
ExtentHistory history = new ExtentHistory(); |
|
96 |
|
|
97 |
assertFalse(history.hasNext()); |
|
98 |
|
|
99 |
Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2); |
|
100 |
history.put(rectangle); |
|
101 |
|
|
102 |
assertTrue(history.hasPrevious()); |
|
103 |
|
|
104 |
history.setPreviousExtent(); |
|
105 |
assertTrue(history.hasNext()); |
|
106 |
} |
|
107 |
|
|
90 | 108 |
/** |
91 |
* Test method for {@link org.gvsig.fmap.mapcontext.ExtentHistory#get()}. |
|
109 |
* Test method for {@link org.gvsig.fmap.mapcontext.ExtentHistory#getPrev()}.
|
|
92 | 110 |
*/ |
93 | 111 |
public void testGet() { |
94 | 112 |
ExtentHistory history = new ExtentHistory(); |
95 | 113 |
|
96 | 114 |
assertNull("The ExtentHistory has got an element without adding one", |
97 |
history.get()); |
|
115 |
history.getPrev());
|
|
98 | 116 |
|
99 | 117 |
Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2); |
100 | 118 |
Rectangle2D rectangle2 = new Rectangle2D.Double(2, 2, 3, 3); |
101 | 119 |
|
102 | 120 |
history.put(rectangle); |
103 |
assertEquals(rectangle, history.get()); |
|
121 |
assertEquals(rectangle, history.getPrev());
|
|
104 | 122 |
|
105 | 123 |
history.put(rectangle2); |
106 |
assertEquals(rectangle2, history.get()); |
|
124 |
assertEquals(rectangle2, history.getPrev());
|
|
107 | 125 |
|
108 |
history.removePrev(); |
|
109 |
assertEquals(rectangle, history.get()); |
|
126 |
assertEquals(rectangle, history.setPreviousExtent()); |
|
110 | 127 |
|
111 |
history.removePrev(); |
|
112 |
assertNull("The ExtentHistory has got an element, " |
|
113 |
+ "but all have been previously removed", history.get()); |
|
128 |
assertNull("The ExtentHistory hasn't got a previous element", history.setPreviousExtent()); |
|
114 | 129 |
} |
115 | 130 |
|
116 | 131 |
/** |
... | ... | |
121 | 136 |
ExtentHistory history = new ExtentHistory(); |
122 | 137 |
|
123 | 138 |
assertNull( |
124 |
"The ExtentHistory allows removing an element without adding "
|
|
125 |
+ "at least one", history.removePrev());
|
|
139 |
"The ExtentHistory allows setting an element without adding "
|
|
140 |
+ "at least one", history.setPreviousExtent());
|
|
126 | 141 |
|
127 | 142 |
Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2); |
128 | 143 |
Rectangle2D rectangle2 = new Rectangle2D.Double(2, 2, 3, 3); |
... | ... | |
130 | 145 |
history.put(rectangle); |
131 | 146 |
history.put(rectangle2); |
132 | 147 |
|
133 |
history.removePrev(); |
|
134 |
assertEquals(rectangle, history.get()); |
|
148 |
assertEquals(rectangle, history.setPreviousExtent()); |
|
135 | 149 |
|
136 |
history.removePrev(); |
|
137 |
assertNull("The ExtentHistory allows to remove the last element, " |
|
138 |
+ "but all have been previously removed", history.removePrev()); |
|
150 |
assertNull("The ExtentHistory allows to set the last element, " |
|
151 |
+ "but all have been previously removed", history.setPreviousExtent()); |
|
139 | 152 |
} |
140 | 153 |
} |
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 | ||
---|---|---|
33 | 33 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
34 | 34 |
import org.gvsig.tools.util.Callable; |
35 | 35 |
|
36 |
|
|
36 | 37 |
/** |
37 | 38 |
* <p> |
38 | 39 |
* <code>ExtentHistory</code> is designed for managing a history of extents. |
... | ... | |
46 | 47 |
*/ |
47 | 48 |
public class ExtentHistory implements Persistent { |
48 | 49 |
|
50 |
private static final String FIELD_CURRENT_EXTENT = "current"; |
|
51 |
private static final String FIELD_NUM_PREVIOUS = "num"; |
|
52 |
private static final String FIELD_NUM_NEXT = "numnext"; |
|
53 |
private static final String FIELD_NUM_RECORDS = "numrec"; |
|
54 |
private static final String FIELD_PREVIOUS_EXTENTS = "extents"; |
|
55 |
private static final String FIELD_NEXT_EXTENTS = "extentsNext"; |
|
56 |
|
|
49 | 57 |
/** |
50 | 58 |
* <p> |
51 | 59 |
* Maximum number of extents that can store. |
... | ... | |
55 | 63 |
|
56 | 64 |
/** |
57 | 65 |
* <p> |
58 |
* Array with the extents. |
|
66 |
* Array with the previous extents.
|
|
59 | 67 |
* </p> |
60 | 68 |
* |
61 | 69 |
* @see #hasPrevious() |
62 | 70 |
* @see #put(Rectangle2D) |
63 |
* @see #get() |
|
64 |
* @see #removePrev()
|
|
71 |
* @see #getPrev()
|
|
72 |
* @see #popPrev()
|
|
65 | 73 |
*/ |
66 |
private Rectangle2D[] extents; |
|
74 |
private Rectangle2D[] extentsPrev;
|
|
67 | 75 |
|
76 |
/** |
|
77 |
* <p> |
|
78 |
* Array with the next extents. |
|
79 |
* </p> |
|
80 |
* |
|
81 |
* @see #hasNext() |
|
82 |
* @see #putNext(Rectangle2D) |
|
83 |
* @see #getNext() |
|
84 |
* @see #popNext() |
|
85 |
*/ |
|
68 | 86 |
private Rectangle2D[] extentsNext; |
69 | 87 |
|
70 | 88 |
/** |
71 | 89 |
* <p> |
90 |
* The current extent of the viewport. |
|
91 |
* </p> |
|
92 |
*/ |
|
93 |
private Rectangle2D currentExtent; |
|
94 |
|
|
95 |
/** |
|
96 |
* <p> |
|
72 | 97 |
* Number of previous extents stored. |
73 | 98 |
* </p> |
74 | 99 |
* |
75 | 100 |
* @see #hasPrevious() |
76 | 101 |
* @see #put(Rectangle2D) |
77 |
* @see #get() |
|
78 |
* @see #removePrev()
|
|
102 |
* @see #getPrev()
|
|
103 |
* @see #popPrev()
|
|
79 | 104 |
*/ |
80 |
private int num = 0; |
|
105 |
private int numPrev = 0;
|
|
81 | 106 |
|
82 | 107 |
/** |
83 | 108 |
* <p> |
... | ... | |
87 | 112 |
* @see #hasNext() |
88 | 113 |
* @see #putNext(Rectangle2D) |
89 | 114 |
* @see #getNext() |
90 |
* @see #removeNext()
|
|
115 |
* @see #popNext()
|
|
91 | 116 |
*/ |
92 | 117 |
private int numNext = 0; |
93 | 118 |
|
... | ... | |
112 | 137 |
*/ |
113 | 138 |
public ExtentHistory(int numEntries) { |
114 | 139 |
NUMREC = numEntries; |
115 |
extents = new Rectangle2D[NUMREC]; |
|
140 |
extentsPrev = new Rectangle2D[NUMREC];
|
|
116 | 141 |
extentsNext = new Rectangle2D[NUMREC]; |
117 | 142 |
} |
118 | 143 |
|
... | ... | |
122 | 147 |
* </p> |
123 | 148 |
* |
124 | 149 |
* @param ext the new extent |
125 |
* @see #get() |
|
126 |
* @see #hasPrevious() |
|
127 | 150 |
*/ |
128 | 151 |
public void put(Rectangle2D ext) { |
129 |
if ((ext != null) && ((num < 1) || (ext != extents[num - 1]))) { |
|
130 |
if (num < (NUMREC)) { |
|
131 |
extents[num] = ext; |
|
132 |
num = num + 1; |
|
133 |
} |
|
134 |
else { |
|
135 |
for (int i = 0; i < (NUMREC - 1); i++) { |
|
136 |
extents[i] = extents[i + 1]; |
|
137 |
} |
|
138 |
extents[num - 1] = ext; |
|
139 |
} |
|
152 |
|
|
153 |
// Si al cargar de la persistencia currentExtent es null ViewPort nos dar? su extent |
|
154 |
if(currentExtent == null) { |
|
155 |
this.currentExtent = ext; |
|
156 |
return; |
|
140 | 157 |
} |
141 |
} |
|
158 |
|
|
159 |
if ( !ext.equals(getPrev()) && !ext.equals(getNext()) ) { |
|
160 |
clearNumNext(); |
|
161 |
} |
|
142 | 162 |
|
143 |
/** |
|
144 |
* <p> |
|
145 |
* Appends the specified extent at the end of the array of next zooms. |
|
146 |
* </p> |
|
147 |
* |
|
148 |
* @param ext the new extent |
|
149 |
* @see #getNext() |
|
150 |
* @see #hasNext() |
|
151 |
*/ |
|
152 |
public void putNext(Rectangle2D ext) { |
|
153 |
if ((ext != null) && ((numNext < 1) || (ext != extentsNext[numNext - 1]))) { |
|
154 |
if (numNext < (NUMREC)) { |
|
155 |
extentsNext[numNext] = ext; |
|
156 |
numNext++; |
|
157 |
} |
|
158 |
else { |
|
159 |
for (int i = 0; i < (NUMREC - 1); i++) { |
|
160 |
extentsNext[i] = extentsNext[i + 1]; |
|
161 |
} |
|
162 |
extentsNext[numNext - 1] = ext; |
|
163 |
} |
|
164 |
} |
|
163 |
pushPrevious(currentExtent); |
|
164 |
|
|
165 |
this.currentExtent = ext; |
|
165 | 166 |
} |
166 | 167 |
|
167 | 168 |
/** |
... | ... | |
171 | 172 |
* |
172 | 173 |
* @return <code>true</code> if there are previous extents registered; |
173 | 174 |
* <code>false</code> otherwise |
174 |
* @see #put(Rectangle2D) |
|
175 |
* @see #removePrev() |
|
176 |
* @see #get() |
|
177 | 175 |
*/ |
178 | 176 |
public boolean hasPrevious() { |
179 |
return num > 0; |
|
177 |
return numPrev > 0;
|
|
180 | 178 |
} |
181 | 179 |
|
182 | 180 |
/** |
... | ... | |
186 | 184 |
* |
187 | 185 |
* @return <code>true</code> if there are next extents registered; |
188 | 186 |
* <code>false</code> otherwise |
189 |
* @see #putNext(Rectangle2D) |
|
190 |
* @see #removeNext() |
|
191 |
* @see #getNext() |
|
192 | 187 |
*/ |
193 | 188 |
public boolean hasNext() { |
194 | 189 |
return numNext > 0; |
... | ... | |
200 | 195 |
* </p> |
201 | 196 |
* |
202 | 197 |
* @return the last previous extent in the history |
203 |
* @see #put(Rectangle2D) |
|
204 |
* @see #getXMLEntity() |
|
205 | 198 |
*/ |
206 |
public Rectangle2D get() { |
|
207 |
if (num <= 0) { |
|
199 |
public Rectangle2D getPrev() {
|
|
200 |
if (numPrev <= 0) {
|
|
208 | 201 |
return null; |
209 | 202 |
} |
210 |
Rectangle2D ext = extents[num - 1];
|
|
203 |
Rectangle2D ext = extentsPrev[numPrev - 1];
|
|
211 | 204 |
|
212 | 205 |
return ext; |
213 | 206 |
} |
... | ... | |
218 | 211 |
* </p> |
219 | 212 |
* |
220 | 213 |
* @return the last next extent in the history |
221 |
* @see #putNext(Rectangle2D) |
|
222 |
* @see #getXMLEntity() |
|
223 | 214 |
*/ |
224 | 215 |
public Rectangle2D getNext() { |
225 | 216 |
if (numNext <= 0) { |
... | ... | |
227 | 218 |
} |
228 | 219 |
|
229 | 220 |
Rectangle2D ext = extentsNext[numNext - 1]; |
230 |
|
|
231 | 221 |
return ext; |
232 | 222 |
} |
233 | 223 |
|
... | ... | |
237 | 227 |
* </p> |
238 | 228 |
* |
239 | 229 |
* @return last previous extent in the history |
240 |
* @see #hasPrevious() |
|
241 | 230 |
*/ |
242 |
public Rectangle2D removePrev() {
|
|
243 |
if (num <= 0) { |
|
231 |
private Rectangle2D popPrev() {
|
|
232 |
if (numPrev <= 0) {
|
|
244 | 233 |
return null; |
245 | 234 |
} |
246 | 235 |
|
247 |
Rectangle2D ext = extents[--num];
|
|
236 |
Rectangle2D ext = extentsPrev[--numPrev];
|
|
248 | 237 |
return ext; |
249 | 238 |
} |
250 | 239 |
|
... | ... | |
254 | 243 |
* </p> |
255 | 244 |
* |
256 | 245 |
* @return last next extent in the history |
257 |
* @see #hasNext() |
|
258 | 246 |
*/ |
259 |
public Rectangle2D removeNext() {
|
|
247 |
private Rectangle2D popNext() {
|
|
260 | 248 |
if (numNext <= 0) { |
261 | 249 |
return null; |
262 | 250 |
} |
... | ... | |
267 | 255 |
|
268 | 256 |
/** |
269 | 257 |
* <p> |
258 |
* Sets to zero the number of previous extents from the history. |
|
259 |
* </p> |
|
260 |
*/ |
|
261 |
private void clearNumPrev() { |
|
262 |
numPrev = 0; |
|
263 |
} |
|
264 |
|
|
265 |
/** |
|
266 |
* <p> |
|
270 | 267 |
* Sets to zero the number of next extents from the history. |
271 | 268 |
* </p> |
272 |
* |
|
273 |
* @see #getNext() |
|
274 |
* @see #hasNext() |
|
275 | 269 |
*/ |
276 |
public void clear() {
|
|
270 |
private void clearNumNext() {
|
|
277 | 271 |
numNext = 0; |
278 | 272 |
} |
279 | 273 |
|
274 |
/** |
|
275 |
* <p> |
|
276 |
* Adds the current extent to the next extents history and sets the last |
|
277 |
* previous extent as the new current extent. |
|
278 |
* </p> |
|
279 |
* |
|
280 |
* @return the last previous extent as the new current extent |
|
281 |
*/ |
|
282 |
public Rectangle2D setPreviousExtent() { |
|
283 |
|
|
284 |
if (currentExtent != null) { |
|
285 |
pushNext(currentExtent); |
|
286 |
} |
|
287 |
currentExtent = popPrev(); |
|
288 |
return currentExtent; |
|
289 |
} |
|
290 |
|
|
291 |
private void pushNext(Rectangle2D ext) { |
|
292 |
if (numNext < (NUMREC)) { |
|
293 |
extentsNext[numNext] = ext; |
|
294 |
numNext = numNext + 1; |
|
295 |
} |
|
296 |
else { |
|
297 |
for (int i = 0; i < (NUMREC - 1); i++) { |
|
298 |
extentsNext[i] = extentsNext[i + 1]; |
|
299 |
} |
|
300 |
extentsNext[numNext - 1] = ext; |
|
301 |
} |
|
302 |
} |
|
303 |
|
|
304 |
/** |
|
305 |
* <p> |
|
306 |
* Adds the current extent to the previous extents history and sets the last |
|
307 |
* next extent as the new current extent. |
|
308 |
* </p> |
|
309 |
* |
|
310 |
* @return the last next extent as the new current extent |
|
311 |
*/ |
|
312 |
public Rectangle2D setNextExtent() { |
|
313 |
|
|
314 |
if (currentExtent != null) { |
|
315 |
pushPrevious(currentExtent); |
|
316 |
|
|
317 |
} |
|
318 |
currentExtent = popNext(); |
|
319 |
return currentExtent; |
|
320 |
} |
|
321 |
|
|
322 |
private void pushPrevious(Rectangle2D ext) { |
|
323 |
if (numPrev < (NUMREC)) { |
|
324 |
extentsPrev[numPrev] = ext; |
|
325 |
numPrev++; |
|
326 |
} else { |
|
327 |
for (int i = 0; i < (NUMREC - 1); i++) { |
|
328 |
extentsPrev[i] = extentsPrev[i + 1]; |
|
329 |
} |
|
330 |
extentsPrev[numPrev - 1] = ext; |
|
331 |
} |
|
332 |
} |
|
333 |
|
|
334 |
public Rectangle2D getCurrent() { |
|
335 |
return currentExtent; |
|
336 |
} |
|
337 |
|
|
280 | 338 |
public void loadFromState(PersistentState state) throws PersistenceException { |
281 | 339 |
|
282 |
num = state.getInt("num"); |
|
283 |
NUMREC = state.getInt("numrec"); |
|
284 |
extents = (Rectangle2D[]) state.getArray("extents", Rectangle2D.class); |
|
285 |
extentsNext = (Rectangle2D[]) state.getArray("extentsNext", |
|
286 |
Rectangle2D.class); |
|
340 |
if (state.hasValue("num")) { |
|
341 |
numPrev = state.getInt("num"); |
|
342 |
} |
|
343 |
else { |
|
344 |
clearNumPrev(); |
|
345 |
} |
|
346 |
|
|
347 |
if (state.hasValue("numnext")) { |
|
348 |
numNext = state.getInt("numnext"); |
|
349 |
} |
|
350 |
else { |
|
351 |
clearNumNext(); |
|
352 |
} |
|
353 |
|
|
354 |
if (state.hasValue("numrec")) { |
|
355 |
NUMREC = state.getInt("numrec"); |
|
356 |
} |
|
357 |
else { |
|
358 |
NUMREC = 10; |
|
359 |
} |
|
360 |
|
|
361 |
if (state.hasValue("extents")) { |
|
362 |
extentsPrev = (Rectangle2D[]) state |
|
363 |
.getArray("extents", Rectangle2D.class); |
|
364 |
} |
|
365 |
else { |
|
366 |
extentsPrev = new Rectangle2D[NUMREC]; |
|
367 |
clearNumPrev(); |
|
368 |
} |
|
369 |
|
|
370 |
if (state.hasValue("extentsNext")) { |
|
371 |
extentsNext = (Rectangle2D[]) state.getArray("extentsNext", |
|
372 |
Rectangle2D.class); |
|
373 |
} |
|
374 |
else { |
|
375 |
extentsNext = new Rectangle2D[NUMREC]; |
|
376 |
clearNumNext(); |
|
377 |
} |
|
378 |
|
|
379 |
if (state.hasValue("current")) { |
|
380 |
currentExtent = (Rectangle2D) state.get("current"); |
|
381 |
} |
|
382 |
else { |
|
383 |
currentExtent = null; |
|
384 |
} |
|
287 | 385 |
} |
288 | 386 |
|
289 | 387 |
/** |
... | ... | |
303 | 401 |
*/ |
304 | 402 |
public void saveToState(PersistentState state) throws PersistenceException { |
305 | 403 |
|
306 |
state.set("num", num); |
|
307 |
state.set("numrec", NUMREC); |
|
308 |
state.set("extents", extents); |
|
309 |
state.set("extentsNext", extentsNext); |
|
404 |
state.set(FIELD_NUM_PREVIOUS, numPrev); |
|
405 |
state.set(FIELD_NUM_NEXT, numNext); |
|
406 |
state.set(FIELD_NUM_RECORDS, NUMREC); |
|
407 |
state.set(FIELD_PREVIOUS_EXTENTS, extentsPrev); |
|
408 |
state.set(FIELD_NEXT_EXTENTS, extentsNext); |
|
409 |
state.set(FIELD_CURRENT_EXTENT, currentExtent); |
|
310 | 410 |
} |
311 | 411 |
|
312 | 412 |
public static class RegisterPersistence implements Callable { |
... | ... | |
315 | 415 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
316 | 416 |
DynStruct definition = manager.addDefinition(ExtentHistory.class, |
317 | 417 |
"ExtentHistory", "ExtentHistory Persistence definition", null, null); |
318 |
definition.addDynFieldInt("num").setMandatory(true); |
|
319 |
definition.addDynFieldInt("numrec").setMandatory(true); |
|
320 |
definition.addDynFieldArray("extents").setClassOfItems(Rectangle2D.class) |
|
418 |
definition.addDynFieldInt(FIELD_NUM_PREVIOUS).setMandatory(true); |
|
419 |
definition.addDynFieldInt(FIELD_NUM_NEXT).setMandatory(true); |
|
420 |
definition.addDynFieldInt(FIELD_NUM_RECORDS).setMandatory(true); |
|
421 |
definition.addDynFieldArray(FIELD_PREVIOUS_EXTENTS).setClassOfItems(Rectangle2D.class) |
|
321 | 422 |
.setMandatory(true); |
322 |
definition.addDynFieldArray("extentsNext")
|
|
423 |
definition.addDynFieldArray(FIELD_NEXT_EXTENTS)
|
|
323 | 424 |
.setClassOfItems(Rectangle2D.class).setMandatory(true); |
425 |
definition.addDynFieldObject(FIELD_CURRENT_EXTENT) |
|
426 |
.setClassOfValue(Rectangle2D.class).setMandatory(false); |
|
427 |
|
|
324 | 428 |
return Boolean.TRUE; |
325 | 429 |
} |
326 | 430 |
} |
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 | ||
---|---|---|
703 | 703 |
*/ |
704 | 704 |
public void setPreviousEnvelope() { |
705 | 705 |
this.updateDrawVersion(); |
706 |
extentsHistory.putNext(extent); |
|
707 |
extent = extentsHistory.removePrev(); |
|
706 |
|
|
707 |
// extentsHistory.putNext(extent); |
|
708 |
// extent = extentsHistory.removePrev(); |
|
709 |
extent = extentsHistory.setPreviousExtent(); |
|
708 | 710 |
|
709 | 711 |
// Calcula la transformaci�n af�n |
710 | 712 |
calculateAffineTransform(); |
... | ... | |
725 | 727 |
*/ |
726 | 728 |
public void setNextEnvelope() { |
727 | 729 |
this.updateDrawVersion(); |
728 |
extentsHistory.put(extent); |
|
729 |
extent = extentsHistory.removeNext();
|
|
730 |
|
|
730 |
|
|
731 |
extent = extentsHistory.setNextExtent();
|
|
732 |
|
|
731 | 733 |
// Calcula la transformaci�n af�n |
732 | 734 |
calculateAffineTransform(); |
733 | 735 |
|
... | ... | |
832 | 834 |
public void setEnvelope(Envelope r) { |
833 | 835 |
Rectangle2D newExtent = null; |
834 | 836 |
// Esto comprueba que el extent no es de anchura o altura = "0" |
835 |
// y si es as� lo redimensiona.
|
|
837 |
// y si es as? lo redimensiona.
|
|
836 | 838 |
if (r != null) { |
837 | 839 |
if ((r.getMaximum(0) - r.getMinimum(0) == 0) |
838 | 840 |
|| (r.getMaximum(1) - r.getMinimum(1) == 0)) { |
... | ... | |
851 | 853 |
return; |
852 | 854 |
} |
853 | 855 |
|
854 |
if (extent != null) { |
|
855 |
if (!extent.equals(extentsHistory.get()) |
|
856 |
&& !extent.equals(extentsHistory.getNext())) { |
|
857 |
extentsHistory.clear(); |
|
858 |
} |
|
859 |
extentsHistory.put(extent); |
|
860 |
} |
|
861 |
|
|
862 | 856 |
this.updateDrawVersion(); |
863 | 857 |
this.extent = newExtent; |
858 |
extentsHistory.put(extent); |
|
864 | 859 |
|
865 | 860 |
// Calcula la transformaci�n af�n |
866 | 861 |
calculateAffineTransform(); |
... | ... | |
887 | 882 |
* @see #calculateAffineTransform() |
888 | 883 |
*/ |
889 | 884 |
public void refreshExtent() { |
890 |
// this.scale = scale; |
|
885 |
//Por compatibilidad con versiones anteriores a la introducci?n de las lista de zooms siguientes |
|
886 |
if (extentsHistory.getCurrent() == null) { |
|
887 |
extentsHistory.put(extent); |
|
888 |
} else { |
|
889 |
extent = extentsHistory.getCurrent(); |
|
890 |
} |
|
891 | 891 |
|
892 |
// Calcula la transformaci�n af�n
|
|
892 |
// Calcula la transformaci?n af?n
|
|
893 | 893 |
calculateAffineTransform(); |
894 | 894 |
|
895 | 895 |
// Lanzamos los eventos de extent cambiado |
... | ... | |
1524 | 1524 |
} |
1525 | 1525 |
|
1526 | 1526 |
// ----------------------------------------------------------------------------------------------------------- |
1527 |
// NOTA PARA DESARROLLADORES SOBRE EL M�TODO
|
|
1527 |
// NOTA PARA DESARROLLADORES SOBRE EL M?TODO
|
|
1528 | 1528 |
// "public void setAffineTransform(AffineTransform at)" |
1529 | 1529 |
// ============================================================================================== |
1530 | 1530 |
// Only used for print, should be removed, redefining the {@link |
Also available in: Unified diff