Revision 22691 branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ExtentHistory.java
ExtentHistory.java | ||
---|---|---|
47 | 47 |
|
48 | 48 |
/** |
49 | 49 |
* <p><code>ExtentHistory</code> is designed for managing a history of extents.</p> |
50 |
*
|
|
50 |
* |
|
51 | 51 |
* <p>Note: An <i>extent</i> is a rectangular area, with information of its top-left 2D corner.</p> |
52 | 52 |
* |
53 | 53 |
* @author Vicente Caballero Navarro |
... | ... | |
57 | 57 |
* <p>Maximum number of extents that can store.</p> |
58 | 58 |
*/ |
59 | 59 |
private int NUMREC; |
60 |
|
|
60 |
|
|
61 | 61 |
/** |
62 | 62 |
* <p>Array with the extents.</p> |
63 |
*
|
|
63 |
* |
|
64 | 64 |
* @see #hasPrevious() |
65 | 65 |
* @see #put(Rectangle2D) |
66 | 66 |
* @see #get() |
67 | 67 |
* @see #removePrev() |
68 | 68 |
*/ |
69 | 69 |
private Rectangle2D[] extents; |
70 |
|
|
70 |
|
|
71 | 71 |
/** |
72 | 72 |
* <p>Number of extents stored.</p> |
73 |
*
|
|
73 |
* |
|
74 | 74 |
* @see #hasPrevious() |
75 | 75 |
* @see #put(Rectangle2D) |
76 | 76 |
* @see #get() |
... | ... | |
99 | 99 |
* <p>Appends the specified extent to the end of this history.</p> |
100 | 100 |
* |
101 | 101 |
* @param ext the new extent |
102 |
*
|
|
102 |
* |
|
103 | 103 |
* @see #get() |
104 | 104 |
* @see #hasPrevious() |
105 | 105 |
*/ |
... | ... | |
122 | 122 |
* <p>Returns <code>true</code> if there are extents registered.</p> |
123 | 123 |
* |
124 | 124 |
* @return <code>true</code> if there are extents registered; <code>false</code> otherwise |
125 |
*
|
|
125 |
* |
|
126 | 126 |
* @see #put(Rectangle2D) |
127 | 127 |
* @see #removePrev() |
128 | 128 |
* @see #get() |
... | ... | |
135 | 135 |
* <p>Returns the last extent in the history.</p> |
136 | 136 |
* |
137 | 137 |
* @return the last extent in the history |
138 |
*
|
|
138 |
* |
|
139 | 139 |
* @see #put(Rectangle2D) |
140 | 140 |
* @see #getXMLEntity() |
141 | 141 |
*/ |
... | ... | |
149 | 149 |
* <p>Extracts (removing) the last extent from the history.</p> |
150 | 150 |
* |
151 | 151 |
* @return last extent in the history |
152 |
*
|
|
152 |
* |
|
153 | 153 |
* @see #hasPrevious() |
154 | 154 |
*/ |
155 | 155 |
public Rectangle2D removePrev() { |
... | ... | |
172 | 172 |
* </p> |
173 | 173 |
* |
174 | 174 |
* @return XML entity that represents this object |
175 |
*
|
|
175 |
* |
|
176 | 176 |
* @see #createFromXML(XMLEntity) |
177 | 177 |
* @see #get() |
178 | 178 |
* @see #put(Rectangle2D) |
... | ... | |
196 | 196 |
} |
197 | 197 |
|
198 | 198 |
/** |
199 |
* @see #createFromXML(XMLEntity) |
|
200 |
*/ |
|
201 |
public static ExtentHistory createFromXML03(XMLEntity xml) { |
|
202 |
ExtentHistory eh = new ExtentHistory(); |
|
203 |
eh.num = xml.getIntProperty("num"); |
|
204 |
eh.NUMREC = xml.getIntProperty("numrec"); |
|
205 |
|
|
206 |
for (int i = 0; i < eh.NUMREC; i++) { |
|
207 |
try { |
|
208 |
eh.extents[i] = new Rectangle2D.Double(xml.getDoubleProperty( |
|
209 |
"extent" + i + "X"), |
|
210 |
xml.getDoubleProperty("extent" + i + "Y"), |
|
211 |
xml.getDoubleProperty("extent" + i + "W"), |
|
212 |
xml.getDoubleProperty("extent" + i + "H")); |
|
213 |
} catch (Exception e) { |
|
214 |
///System.out.println("En las ExtentHistory =" + e); //TODO o se captura de alguna forma o se mete un nuevo parametro en el xml para saber exactamente cuantos rect?gulos se han a?adido. |
|
215 |
} |
|
216 |
} |
|
217 |
|
|
218 |
return eh; |
|
219 |
} |
|
220 |
|
|
221 |
/** |
|
222 | 199 |
* <p>Binds the information in the XML entity argument to create and return an <code>ExtentHistory</code> |
223 | 200 |
* object.</p> |
224 | 201 |
* |
225 | 202 |
* @param xml an XML entity of a <code>ExtentHistory</code> |
226 | 203 |
* |
227 | 204 |
* @return an <code>ExtentHistory</code> object with the information of the <code>xml</code> argument |
228 |
*
|
|
205 |
* |
|
229 | 206 |
* @see #getXMLEntity() |
230 | 207 |
*/ |
231 | 208 |
public static ExtentHistory createFromXML(XMLEntity xml) { |
Also available in: Unified diff