svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap / src-test / org / gvsig / fmap / mapcontext / rendering / TestAbstractIntervalLegend.java @ 21156
History | View | Annotate | Download (19.3 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package org.gvsig.fmap.mapcontext.rendering; |
42 |
|
43 |
import java.awt.Dimension; |
44 |
import java.awt.Rectangle; |
45 |
import java.io.IOException; |
46 |
import java.sql.Types; |
47 |
import java.util.ArrayList; |
48 |
import java.util.Hashtable; |
49 |
import java.util.Iterator; |
50 |
import java.util.List; |
51 |
|
52 |
import org.gvsig.data.CloseException; |
53 |
import org.gvsig.data.DataCollection; |
54 |
import org.gvsig.data.DataException; |
55 |
import org.gvsig.data.DataExplorer; |
56 |
import org.gvsig.data.DataStoreParameters; |
57 |
import org.gvsig.data.InitializeException; |
58 |
import org.gvsig.data.OpenException; |
59 |
import org.gvsig.data.ReadException; |
60 |
import org.gvsig.data.WriteException; |
61 |
import org.gvsig.data.commands.CommandsRecord; |
62 |
import org.gvsig.data.vectorial.Feature; |
63 |
import org.gvsig.data.vectorial.FeatureAttributeDescriptor; |
64 |
import org.gvsig.data.vectorial.FeatureID; |
65 |
import org.gvsig.data.vectorial.FeatureStore; |
66 |
import org.gvsig.data.vectorial.FeatureType; |
67 |
import org.gvsig.data.vectorial.MemoryFeature; |
68 |
import org.gvsig.exceptions.BaseException; |
69 |
import org.gvsig.fmap.geom.Geometry; |
70 |
import org.gvsig.fmap.geom.GeometryFactory; |
71 |
import org.gvsig.fmap.geom.GeometryManager; |
72 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
73 |
import org.gvsig.fmap.mapcontext.rendering.legend.AbstractIntervalLegend; |
74 |
import org.gvsig.fmap.mapcontext.rendering.legend.FInterval; |
75 |
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedVectorLegend; |
76 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
77 |
import org.gvsig.fmap.mapcontext.rendering.symbol.TestISymbol; |
78 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
79 |
import org.gvsig.metadata.IMetadata; |
80 |
import org.gvsig.util.observer.Observer; |
81 |
|
82 |
import junit.framework.TestCase; |
83 |
|
84 |
/**
|
85 |
* Integration test to ensure that the legends which implements the
|
86 |
* IVectorialIntervalLegend interface follow the rules that follow the managing
|
87 |
* of them by the application.
|
88 |
*
|
89 |
* @author pepe vidal salvador - jose.vidal.salvador@iver.es
|
90 |
*/
|
91 |
public class TestAbstractIntervalLegend extends TestCase { |
92 |
|
93 |
private static final Integer v0 = new Integer(0); |
94 |
private static final Integer v1 = new Integer(1); |
95 |
private static final Integer v2 = new Integer(2); |
96 |
private static final Integer v3 = new Integer(3); |
97 |
|
98 |
private static final String FIELD3 = "field3"; |
99 |
private static final String FIELD2 = "field2"; |
100 |
private static final String FIELD1 = "field1"; |
101 |
private static final String FIELD0 = "field0"; |
102 |
private static final int FIELDID = 0; |
103 |
|
104 |
private static final Integer[] feature0Values = new Integer[] { v0, v1, v2, v3, }; |
105 |
private static final Integer[] feature1Values = new Integer[] { v3, v0, v1, v2, }; |
106 |
private static final Integer[] feature2Values = new Integer[] { v2, v3, v0, v1, }; |
107 |
private static final Integer[] feature3Values = new Integer[] { v1, v2, v3, v0, }; |
108 |
|
109 |
private static final Integer[][] featureValues = new Integer[][] { |
110 |
feature0Values, |
111 |
feature1Values, |
112 |
feature2Values, |
113 |
feature3Values,}; |
114 |
|
115 |
private static String[] fieldNames = new String[] {FIELD0,FIELD1,FIELD2,FIELD3,}; |
116 |
|
117 |
|
118 |
// private static final Value v4 = (Value)ValueFactory.createValue(4);
|
119 |
// private static final Value v5 = (Value)ValueFactory.createValue(5);
|
120 |
// private static final Value v6 = (Value)ValueFactory.createValue(6);
|
121 |
// private static final Value v7 = (Value)ValueFactory.createValue(7);
|
122 |
// private static final Value v8 = (Value)ValueFactory.createValue(8);
|
123 |
// private static final Value v9 = (Value)ValueFactory.createValue(9);
|
124 |
|
125 |
private AbstractIntervalLegend[] intervalLegends; |
126 |
private MockDataSource mockDataSource = new MockDataSource(); |
127 |
|
128 |
/**
|
129 |
* To avoid duplicated validation logic in the test a mock object is created
|
130 |
* to use a DataSource for this test.
|
131 |
*
|
132 |
*/
|
133 |
private class MockDataSource implements FeatureStore { |
134 |
|
135 |
public DataCollection getDataCollection(FeatureType type, String filter, String order) throws ReadException { |
136 |
// TODO Auto-generated method stub
|
137 |
return null; |
138 |
} |
139 |
|
140 |
public DataCollection getDataCollection(String[] fields, String filter, String order) throws ReadException { |
141 |
// TODO Auto-generated method stub
|
142 |
return null; |
143 |
} |
144 |
|
145 |
public void getDataCollection(FeatureType type, String filter, String order, Observer observer) throws DataException { |
146 |
// TODO Auto-generated method stub
|
147 |
|
148 |
} |
149 |
|
150 |
public void getDataCollection(String[] fields, String filter, String order, Observer observer) throws DataException { |
151 |
// TODO Auto-generated method stub
|
152 |
|
153 |
} |
154 |
|
155 |
public void getDataCollection(Observer observer) { |
156 |
// TODO Auto-generated method stub
|
157 |
|
158 |
} |
159 |
|
160 |
public Feature getFeatureByID(FeatureID id) throws ReadException { |
161 |
// TODO Auto-generated method stub
|
162 |
return null; |
163 |
} |
164 |
|
165 |
public Feature getFeatureByID(FeatureID id, FeatureType featureType) throws ReadException { |
166 |
// TODO Auto-generated method stub
|
167 |
return null; |
168 |
} |
169 |
|
170 |
public FeatureType getDefaultFeatureType() {
|
171 |
// TODO Auto-generated method stub
|
172 |
return null; |
173 |
} |
174 |
|
175 |
public List getFeatureTypes() { |
176 |
// TODO Auto-generated method stub
|
177 |
return null; |
178 |
} |
179 |
|
180 |
public Feature createFeature(FeatureType type, boolean defaultValues) throws InitializeException { |
181 |
// TODO Auto-generated method stub
|
182 |
return null; |
183 |
} |
184 |
|
185 |
public Feature createDefaultFeature(boolean defaultValues) throws InitializeException { |
186 |
// TODO Auto-generated method stub
|
187 |
return null; |
188 |
} |
189 |
|
190 |
public void update(Feature feature) throws DataException { |
191 |
// TODO Auto-generated method stub
|
192 |
|
193 |
} |
194 |
|
195 |
public void delete(Feature feature) throws DataException { |
196 |
// TODO Auto-generated method stub
|
197 |
|
198 |
} |
199 |
|
200 |
public void insert(Feature feature) throws DataException { |
201 |
// TODO Auto-generated method stub
|
202 |
|
203 |
} |
204 |
|
205 |
public void update(FeatureAttributeDescriptor attributeDescriptor) throws DataException { |
206 |
// TODO Auto-generated method stub
|
207 |
|
208 |
} |
209 |
|
210 |
public void delete(FeatureAttributeDescriptor attributeDescriptor) throws DataException { |
211 |
// TODO Auto-generated method stub
|
212 |
|
213 |
} |
214 |
|
215 |
public void insert(FeatureAttributeDescriptor attributeDescriptor) throws DataException { |
216 |
// TODO Auto-generated method stub
|
217 |
|
218 |
} |
219 |
|
220 |
public void disableNotifications() { |
221 |
// TODO Auto-generated method stub
|
222 |
|
223 |
} |
224 |
|
225 |
public void enableNotifications() { |
226 |
// TODO Auto-generated method stub
|
227 |
|
228 |
} |
229 |
|
230 |
public boolean isLocked(FeatureID id) { |
231 |
// TODO Auto-generated method stub
|
232 |
return false; |
233 |
} |
234 |
|
235 |
public boolean lock(FeatureID id) { |
236 |
// TODO Auto-generated method stub
|
237 |
return false; |
238 |
} |
239 |
|
240 |
public boolean isWithDefaultLegend() { |
241 |
// TODO Auto-generated method stub
|
242 |
return false; |
243 |
} |
244 |
|
245 |
public Object getDefaultLegend() throws ReadException { |
246 |
// TODO Auto-generated method stub
|
247 |
return null; |
248 |
} |
249 |
|
250 |
public Object getDefaultLabelingStrategy() { |
251 |
// TODO Auto-generated method stub
|
252 |
return null; |
253 |
} |
254 |
|
255 |
public boolean canAlterFeatureType() { |
256 |
// TODO Auto-generated method stub
|
257 |
return false; |
258 |
} |
259 |
|
260 |
public DataStoreParameters getParameters() {
|
261 |
// TODO Auto-generated method stub
|
262 |
return null; |
263 |
} |
264 |
|
265 |
public String getName() { |
266 |
// TODO Auto-generated method stub
|
267 |
return null; |
268 |
} |
269 |
|
270 |
public void init(DataStoreParameters parameters) throws InitializeException { |
271 |
// TODO Auto-generated method stub
|
272 |
|
273 |
} |
274 |
|
275 |
public void open() throws OpenException { |
276 |
// TODO Auto-generated method stub
|
277 |
|
278 |
} |
279 |
|
280 |
public void refresh() throws OpenException, InitializeException { |
281 |
// TODO Auto-generated method stub
|
282 |
|
283 |
} |
284 |
|
285 |
public void close() throws CloseException { |
286 |
// TODO Auto-generated method stub
|
287 |
|
288 |
} |
289 |
|
290 |
public void dispose() throws CloseException { |
291 |
// TODO Auto-generated method stub
|
292 |
|
293 |
} |
294 |
|
295 |
public DataCollection getDataCollection() throws ReadException { |
296 |
// TODO Auto-generated method stub
|
297 |
return null; |
298 |
} |
299 |
|
300 |
public DataCollection getSelection() {
|
301 |
// TODO Auto-generated method stub
|
302 |
return null; |
303 |
} |
304 |
|
305 |
public void setSelection(DataCollection selection) { |
306 |
// TODO Auto-generated method stub
|
307 |
|
308 |
} |
309 |
|
310 |
public DataCollection createSelection() {
|
311 |
// TODO Auto-generated method stub
|
312 |
return null; |
313 |
} |
314 |
|
315 |
public Iterator getChilds() { |
316 |
// TODO Auto-generated method stub
|
317 |
return null; |
318 |
} |
319 |
|
320 |
public boolean isEditable() { |
321 |
// TODO Auto-generated method stub
|
322 |
return false; |
323 |
} |
324 |
|
325 |
public void startEditing() throws ReadException { |
326 |
// TODO Auto-generated method stub
|
327 |
|
328 |
} |
329 |
|
330 |
public void cancelEditing() { |
331 |
// TODO Auto-generated method stub
|
332 |
|
333 |
} |
334 |
|
335 |
public void finishEditing() throws WriteException, ReadException { |
336 |
// TODO Auto-generated method stub
|
337 |
|
338 |
} |
339 |
|
340 |
public boolean isEditing() { |
341 |
// TODO Auto-generated method stub
|
342 |
return false; |
343 |
} |
344 |
|
345 |
public void undo() { |
346 |
// TODO Auto-generated method stub
|
347 |
|
348 |
} |
349 |
|
350 |
public void redo() { |
351 |
// TODO Auto-generated method stub
|
352 |
|
353 |
} |
354 |
|
355 |
public CommandsRecord getCommandsRecord() {
|
356 |
// TODO Auto-generated method stub
|
357 |
return null; |
358 |
} |
359 |
|
360 |
public void beginComplexNotification() { |
361 |
// TODO Auto-generated method stub
|
362 |
|
363 |
} |
364 |
|
365 |
public void endComplexNotification() { |
366 |
// TODO Auto-generated method stub
|
367 |
|
368 |
} |
369 |
|
370 |
public DataCollection getLocked() {
|
371 |
// TODO Auto-generated method stub
|
372 |
return null; |
373 |
} |
374 |
|
375 |
public void setLocked(DataCollection locked) { |
376 |
// TODO Auto-generated method stub
|
377 |
|
378 |
} |
379 |
|
380 |
public DataCollection createLocked() {
|
381 |
// TODO Auto-generated method stub
|
382 |
return null; |
383 |
} |
384 |
|
385 |
public DataExplorer getExplorer() throws ReadException { |
386 |
// TODO Auto-generated method stub
|
387 |
return null; |
388 |
} |
389 |
|
390 |
public void addObserver(Observer o) { |
391 |
// TODO Auto-generated method stub
|
392 |
|
393 |
} |
394 |
|
395 |
public void deleteObserver(Observer o) { |
396 |
// TODO Auto-generated method stub
|
397 |
|
398 |
} |
399 |
|
400 |
public void deleteObservers() { |
401 |
// TODO Auto-generated method stub
|
402 |
|
403 |
} |
404 |
|
405 |
public IMetadata getMetadata() throws BaseException { |
406 |
// TODO Auto-generated method stub
|
407 |
return null; |
408 |
} |
409 |
// public void start() throws ReadDriverException { }
|
410 |
// public void stop() throws ReadDriverException { }
|
411 |
// public long[] getWhereFilter() throws IOException {return null;}
|
412 |
// public DataSourceFactory getDataSourceFactory() {return null;}
|
413 |
// public Memento getMemento() throws MementoException {return null;}
|
414 |
// public void setDataSourceFactory(DataSourceFactory dsf) { }
|
415 |
// public void setSourceInfo(SourceInfo sourceInfo) { }
|
416 |
// public SourceInfo getSourceInfo() {return null;}
|
417 |
// public String getAsString() throws ReadDriverException {return null;}
|
418 |
// public void remove() throws WriteDriverException { }
|
419 |
// public int[] getPrimaryKeys() throws ReadDriverException {return null;}
|
420 |
// public ValueCollection getPKValue(long rowIndex)throws ReadDriverException {return null;}
|
421 |
// public String getPKName(int fieldId) throws ReadDriverException {return null;}
|
422 |
// public String[] getPKNames() throws ReadDriverException {return null;}
|
423 |
// public int getPKType(int i) throws ReadDriverException {return 0;}
|
424 |
// public int getPKCardinality() throws ReadDriverException {return 0;}
|
425 |
// public Value[] getRow(long rowIndex) throws ReadDriverException {return null;}
|
426 |
// public DataWare getDataWare(int mode) throws ReadDriverException {return null;}
|
427 |
// public boolean isVirtualField(int fieldId) throws ReadDriverException {return false;}
|
428 |
// public Driver getDriver() {return null;}
|
429 |
// public void reload() throws ReloadDriverException { }
|
430 |
// public void addDataSourceListener(IDataSourceListener listener) { }
|
431 |
// public void removeDataSourceListener(IDataSourceListener listener) { }
|
432 |
// public Value getFieldValue(long rowIndex, int fieldId)throws ReadDriverException {return null;}
|
433 |
// public int getFieldCount() throws ReadDriverException {return 0;}
|
434 |
// public long getRowCount() throws ReadDriverException {return 0;}
|
435 |
// public int getFieldWidth(int i) throws ReadDriverException {return 0;}
|
436 |
//
|
437 |
// public String getFieldName(int fieldId) throws ReadDriverException {
|
438 |
// return fieldNames[fieldId];
|
439 |
// }
|
440 |
//
|
441 |
// public String getName(){
|
442 |
// return "Mock datasource used for testing only";
|
443 |
// }
|
444 |
//
|
445 |
// public String[] getFieldNames() throws ReadDriverException {
|
446 |
// return fieldNames;
|
447 |
// }
|
448 |
//
|
449 |
// public int getFieldIndexByName(String fieldName)throws ReadDriverException {
|
450 |
// for (int i = 0; i < fieldNames.length; i++) {
|
451 |
// if (fieldNames[i].equals(fieldName))
|
452 |
// return i;
|
453 |
// }
|
454 |
// return -1;
|
455 |
// }
|
456 |
//
|
457 |
// public int getFieldType(int i) throws ReadDriverException {
|
458 |
// return Types.INTEGER;
|
459 |
// }
|
460 |
|
461 |
} |
462 |
|
463 |
private static final FInterval interval0=new FInterval(0,2); |
464 |
private static final FInterval interval1=new FInterval(3,5); |
465 |
private static final FInterval interval2=new FInterval(6,8); |
466 |
private static final FInterval interval3=new FInterval(9,11); |
467 |
// private static final Value interval4;
|
468 |
// private static final Value interval5;
|
469 |
// private static final Value interval6;
|
470 |
// private static final Value interval7;
|
471 |
// private static final Value interval8;
|
472 |
// private static final Value interval9;
|
473 |
|
474 |
Hashtable symTable;
|
475 |
|
476 |
private ISymbol[] symbols; |
477 |
private FInterval[] sampleIntervals = new FInterval[] { interval0, interval1, interval2, interval3, }; |
478 |
private Feature[] features; |
479 |
|
480 |
// private FInterval[] intervals = new FInterval[] {
|
481 |
// interval0,
|
482 |
// interval1,
|
483 |
// interval2,
|
484 |
// interval3,
|
485 |
// interval4,
|
486 |
// interval5,
|
487 |
// interval6,
|
488 |
// interval7,
|
489 |
// interval8,
|
490 |
// interval9,
|
491 |
// };
|
492 |
|
493 |
protected void setUp() throws Exception { |
494 |
super.setUp();
|
495 |
features = new Feature[4]; |
496 |
|
497 |
// initialize test values
|
498 |
for (int i = 0; i < features.length; i++) { |
499 |
|
500 |
// create the geometry associated to the feature
|
501 |
int size = 200; |
502 |
Dimension d = new Dimension(size, size); |
503 |
Rectangle aShape = new Rectangle(i * size, i * size, d.width, |
504 |
d.height); |
505 |
GeometryFactory geomFactory=GeometryManager.getInstance().getGeometryFactory(); |
506 |
Geometry geom = geomFactory.createPolyline2D(new GeneralPathX(
|
507 |
aShape)); |
508 |
|
509 |
/*
|
510 |
* create a full-featured Feature with randomed values at its fields
|
511 |
* to avoid testing over the same values each time
|
512 |
*/
|
513 |
//TODO
|
514 |
// features[i] = new MemoryFeature(geom, featureValues[i], "[" + i
|
515 |
// + "]");
|
516 |
} |
517 |
|
518 |
// initialize the symbol subset for this test
|
519 |
symbols = TestISymbol.getNewSymbolInstances(); |
520 |
|
521 |
// initialize the legends for this test
|
522 |
ILegend[] allLegends = TestILegend.getNewLegendInstances();
|
523 |
ArrayList intervalLegends = new ArrayList(); |
524 |
for (int i = 0; i < allLegends.length; i++) { |
525 |
|
526 |
if (allLegends[i] instanceof AbstractIntervalLegend) |
527 |
intervalLegends.add(allLegends[i]); |
528 |
|
529 |
if (allLegends[i] instanceof IClassifiedVectorLegend) { |
530 |
IClassifiedVectorLegend cvl = (IClassifiedVectorLegend) allLegends[i]; |
531 |
cvl.setClassifyingFieldNames(new String[] { fieldNames[FIELDID] }); |
532 |
cvl.setFeatureStore(mockDataSource); |
533 |
|
534 |
} |
535 |
} |
536 |
|
537 |
this.intervalLegends = (AbstractIntervalLegend[]) intervalLegends |
538 |
.toArray(new AbstractIntervalLegend[intervalLegends.size()]);
|
539 |
} |
540 |
|
541 |
/**
|
542 |
* This method is used to add symbols to a legend.That is, it takes an array
|
543 |
* of AbstractIntervalLegend which is empty and, using a second array
|
544 |
* of FIntervals(values), the first one is filled.Also, a hash table is filled
|
545 |
* using the array of FIntervals (it will be useful in some tests to check
|
546 |
* that a symbol can be taken using a feature) .
|
547 |
*
|
548 |
* @param legend
|
549 |
* @return
|
550 |
*/
|
551 |
private void fillClassifiedLegend(AbstractIntervalLegend legend, |
552 |
FInterval[] values) {
|
553 |
// initialize the hash table
|
554 |
symTable = new Hashtable(); |
555 |
|
556 |
// to add symbols to the legend and the hash table
|
557 |
for (int j = 0; j < values.length; j++) { |
558 |
|
559 |
ISymbol sym = symbols[j % symbols.length]; |
560 |
legend.addSymbol(values[j], sym); |
561 |
symTable.put(values[j], sym); |
562 |
} |
563 |
} |
564 |
|
565 |
/**
|
566 |
* This test ensures that when a legend is filled, the number of symbols
|
567 |
* added is correct. To do it, is checked that the number of symbols of a
|
568 |
* legend is the same as the length of the array of example values that we
|
569 |
* have.
|
570 |
*
|
571 |
* @throws ReadDriverException
|
572 |
*/
|
573 |
public void testICLAdittion() throws ReadException { |
574 |
|
575 |
// Fills the legend
|
576 |
for (int i = 0; i < intervalLegends.length; i++) { |
577 |
fillClassifiedLegend(intervalLegends[i], sampleIntervals); |
578 |
} |
579 |
|
580 |
for (int i = 0; i < intervalLegends.length; i++) |
581 |
assertEquals(intervalLegends[i].getClassName() |
582 |
+ " fails with the comparation of the number of symbols",
|
583 |
intervalLegends[i].getSymbols().length, |
584 |
sampleIntervals.length); |
585 |
|
586 |
} |
587 |
|
588 |
/**
|
589 |
* This test ensures that the symbols that we have previously added to a
|
590 |
* legend are accessible using its features.To do it, this test compares the
|
591 |
* symbol taken from the legend with the symbol taken from the hashTable
|
592 |
* (using the same feature).
|
593 |
*
|
594 |
* @throws ReadDriverException
|
595 |
*/
|
596 |
|
597 |
public void testICLCheckValueSymbols() throws ReadException { |
598 |
|
599 |
ISymbol tableSym =null;
|
600 |
|
601 |
// fills the legends
|
602 |
for (int i = 0; i < intervalLegends.length; i++) { |
603 |
fillClassifiedLegend(intervalLegends[i], sampleIntervals); |
604 |
} |
605 |
|
606 |
for (int i = 0; i < intervalLegends.length; i++) { |
607 |
// For each feature
|
608 |
for (int j = 0; j < features.length; j++) { |
609 |
Feature myFeature = features[i]; |
610 |
// takes the value of the field that identifies the feature
|
611 |
Object val = myFeature.get(FIELDID);
|
612 |
// the last value is used to access to the hash table to obtain
|
613 |
// a symbol
|
614 |
|
615 |
if(interval0.isInInterval(val))
|
616 |
tableSym = (ISymbol) symTable.get(interval0); |
617 |
else if(interval1.isInInterval(val)) |
618 |
tableSym = (ISymbol) symTable.get(interval1); |
619 |
else if(interval2.isInInterval(val)) |
620 |
tableSym = (ISymbol) symTable.get(interval2); |
621 |
else if(interval3.isInInterval(val)) |
622 |
tableSym = (ISymbol) symTable.get(interval3); |
623 |
|
624 |
AbstractIntervalLegend leg = (AbstractIntervalLegend) intervalLegends[i]; |
625 |
// takes the symbol from a legend using the feature
|
626 |
ISymbol legendSym = leg.getSymbolByFeature(myFeature); |
627 |
// compares that both symbols are the same
|
628 |
assertEquals(legendSym.getClassName() |
629 |
+ " fails with the comparation of the class symbols",
|
630 |
legendSym, tableSym); |
631 |
} |
632 |
} |
633 |
} |
634 |
|
635 |
} |
636 |
|
637 |
|