Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / org.gvsig.symbology / org.gvsig.symbology.lib / org.gvsig.symbology.lib.impl / src / test / java / org / gvsig / symbology / fmap / mapcontext / rendering / legend / TestIClassifiedLegend.java @ 39406

History | View | Annotate | Download (20.9 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.symbology.fmap.mapcontext.rendering.legend;
42

    
43
import java.awt.Dimension;
44
import java.awt.Rectangle;
45
import java.util.ArrayList;
46
import java.util.Collection;
47
import java.util.Hashtable;
48
import java.util.Iterator;
49
import java.util.List;
50
import java.util.Set;
51

    
52
import org.cresques.cts.IProjection;
53

    
54
import org.gvsig.fmap.dal.DataQuery;
55
import org.gvsig.fmap.dal.DataServerExplorer;
56
import org.gvsig.fmap.dal.DataSet;
57
import org.gvsig.fmap.dal.DataStoreParameters;
58
import org.gvsig.fmap.dal.exception.DataException;
59
import org.gvsig.fmap.dal.exception.ReadException;
60
import org.gvsig.fmap.dal.feature.EditableFeature;
61
import org.gvsig.fmap.dal.feature.EditableFeatureType;
62
import org.gvsig.fmap.dal.feature.Feature;
63
import org.gvsig.fmap.dal.feature.FeatureCache;
64
import org.gvsig.fmap.dal.feature.FeatureIndex;
65
import org.gvsig.fmap.dal.feature.FeatureIndexes;
66
import org.gvsig.fmap.dal.feature.FeatureLocks;
67
import org.gvsig.fmap.dal.feature.FeatureQuery;
68
import org.gvsig.fmap.dal.feature.FeatureReference;
69
import org.gvsig.fmap.dal.feature.FeatureSelection;
70
import org.gvsig.fmap.dal.feature.FeatureSet;
71
import org.gvsig.fmap.dal.feature.FeatureStore;
72
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms;
73
import org.gvsig.fmap.dal.feature.FeatureType;
74
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
75
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
76
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
77
import org.gvsig.fmap.geom.Geometry.TYPES;
78
import org.gvsig.fmap.geom.GeometryLocator;
79
import org.gvsig.fmap.geom.GeometryManager;
80
import org.gvsig.fmap.geom.primitive.Curve;
81
import org.gvsig.fmap.geom.primitive.Envelope;
82
import org.gvsig.fmap.geom.primitive.GeneralPathX;
83
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedLegend;
84
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedVectorLegend;
85
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
86
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
87
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractIntervalLegend;
88
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.TestISymbol;
89
import org.gvsig.timesupport.Interval;
90
import org.gvsig.tools.dynobject.DynClass;
91
import org.gvsig.tools.dynobject.DynObject;
92
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
93
import org.gvsig.tools.dynobject.exception.DynMethodException;
94
import org.gvsig.tools.exception.BaseException;
95
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
96
import org.gvsig.tools.observer.Observer;
97
import org.gvsig.tools.persistence.PersistentState;
98
import org.gvsig.tools.persistence.exception.PersistenceException;
99
import org.gvsig.tools.undo.RedoException;
100
import org.gvsig.tools.undo.UndoException;
101
import org.gvsig.tools.visitor.Visitor;
102

    
103

    
104
/**
105
 * Integration test to ensure that the legends which implements the
106
 * IClassifiedLegend interface follow the rules that follow the managing of them
107
 * by the application.
108
 *
109
 * @author jaume dominguez faus - jaume.dominguez@iver.es
110
 * @author pepe vidal salvador - jose.vidal.salvador@iver.es
111
 */
112
public class TestIClassifiedLegend extends AbstractLibraryAutoInitTestCase {
113

    
114
        private static final Integer v0 = new Integer(0);
115
        private static final Integer v1 = new Integer(1);
116
        private static final Integer v2 = new Integer(2);
117
        private static final Integer v3 = new Integer(3);
118

    
119
        private static final String FIELD3 = "field3";
120
        private static final String FIELD2 = "field2";
121
        private static final String FIELD1 = "field1";
122
        private static final String FIELD0 = "field0";
123
        private static final int FIELDID = 0;
124

    
125
//        private static final Integer[] feature0Values = new Integer[] { v0, v1, v2, v3, };
126
//        private static final Integer[] feature1Values = new Integer[] { v3, v0, v1, v2, };
127
//        private static final Integer[] feature2Values = new Integer[] { v2, v3, v0, v1, };
128
//        private static final Integer[] feature3Values = new Integer[] { v1, v2, v3, v0, };
129
//
130
//        private static final Integer[][] featureValues = new Integer[][] {
131
//                feature0Values,
132
//                feature1Values,
133
//                feature2Values,
134
//                feature3Values,};
135

    
136
        private static String[] fieldNames = new String[] {FIELD0,FIELD1,FIELD2,FIELD3,};
137

    
138

    
139
        // private static final Value v4 = (Value)ValueFactory.createValue(4);
140
        // private static final Value v5 = (Value)ValueFactory.createValue(5);
141
        // private static final Value v6 = (Value)ValueFactory.createValue(6);
142
        // private static final Value v7 = (Value)ValueFactory.createValue(7);
143
        // private static final Value v8 = (Value)ValueFactory.createValue(8);
144
        // private static final Value v9 = (Value)ValueFactory.createValue(9);
145

    
146
        private AbstractIntervalLegend[] intervalLegends;
147
//        private MockDataSource mockDataSource = new MockDataSource();
148

    
149
        /**
150
         * To avoid duplicated validation logic in the test a mock object is created
151
         * to use a DataSource for this test.
152
         *
153
         */
154
        private class MockDataSource implements FeatureStore {
155

    
156
                public boolean allowWrite() {
157

    
158
                        return false;
159
                }
160

    
161
                public void beginEditingGroup(String description)
162
                                throws NeedEditingModeException {
163

    
164

    
165
                }
166

    
167
                public boolean canWriteGeometry(int gvSIGgeometryType)
168
                                throws DataException {
169

    
170
                        return false;
171
                }
172

    
173
                public void cancelEditing() throws DataException {
174

    
175

    
176
                }
177

    
178
                public FeatureSelection createFeatureSelection() throws DataException {
179

    
180
                        return null;
181
                }
182

    
183
                public FeatureIndex createIndex(FeatureType featureType,
184
                                String attributeName, String indexName) throws DataException {
185

    
186
                        return null;
187
                }
188

    
189
                public EditableFeature createNewFeature() throws DataException {
190

    
191
                        return null;
192
                }
193

    
194
                public EditableFeature createNewFeature(FeatureType type,
195
                                Feature defaultValues) throws DataException {
196

    
197
                        return null;
198
                }
199

    
200
                public EditableFeature createNewFeature(FeatureType type,
201
                                boolean defaultValues) throws DataException {
202

    
203
                        return null;
204
                }
205

    
206
                public EditableFeature createNewFeature(boolean defaultValues)
207
                                throws DataException {
208

    
209
                        return null;
210
                }
211

    
212
                public void delete(Feature feature) throws DataException {
213

    
214

    
215
                }
216

    
217
                public void edit() throws DataException {
218

    
219

    
220
                }
221

    
222
                public void edit(int mode) throws DataException {
223

    
224

    
225
                }
226

    
227
                public void endEditingGroup() throws NeedEditingModeException {
228

    
229

    
230
                }
231

    
232
                public void finishEditing() throws DataException {
233

    
234

    
235
                }
236

    
237
                public FeatureType getDefaultFeatureType() throws DataException {
238

    
239
                        return null;
240
                }
241

    
242
                public Envelope getEnvelope() {
243

    
244
                        return null;
245
                }
246

    
247
                public Feature getFeatureByReference(FeatureReference reference)
248
                                throws DataException {
249

    
250
                        return null;
251
                }
252

    
253
                public Feature getFeatureByReference(FeatureReference reference,
254
                                FeatureType featureType) throws DataException {
255

    
256
                        return null;
257
                }
258

    
259
                public FeatureSelection getFeatureSelection() throws DataException {
260

    
261
                        return null;
262
                }
263

    
264
                public FeatureSet getFeatureSet() throws DataException {
265

    
266
                        return null;
267
                }
268

    
269
                public FeatureSet getFeatureSet(FeatureQuery featureQuery)
270
                                throws DataException {
271

    
272
                        return null;
273
                }
274

    
275
                public void getFeatureSet(FeatureQuery featureQuery, Observer observer)
276
                                throws DataException {
277

    
278

    
279
                }
280

    
281
                public void getFeatureSet(Observer observer) throws DataException {
282

    
283

    
284
                }
285

    
286
                public List getFeatureTypes() throws DataException {
287

    
288
                        return null;
289
                }
290

    
291
                public FeatureIndexes getIndexes() {
292

    
293
                        return null;
294
                }
295

    
296
                public FeatureLocks getLocks() throws DataException {
297

    
298
                        return null;
299
                }
300

    
301
                public DataStoreParameters getParameters() {
302

    
303
                        return null;
304
                }
305

    
306
                public IProjection getSRSDefaultGeometry() throws DataException {
307

    
308
                        return null;
309
                }
310

    
311
                public FeatureStoreTransforms getTransforms() {
312

    
313
                        return null;
314
                }
315

    
316
                public void insert(EditableFeature feature) throws DataException {
317

    
318

    
319
                }
320

    
321
                public boolean isAppendModeSupported() {
322

    
323
                        return false;
324
                }
325

    
326
                public boolean isAppending() {
327

    
328
                        return false;
329
                }
330

    
331
                public boolean isEditing() {
332

    
333
                        return false;
334
                }
335

    
336
                public boolean isLocksSupported() {
337

    
338
                        return false;
339
                }
340

    
341
                public void setSelection(FeatureSet selection) throws DataException {
342

    
343

    
344
                }
345

    
346
                public void update(EditableFeatureType featureType)
347
                                throws DataException {
348

    
349

    
350
                }
351

    
352
                public void update(EditableFeature feature) throws DataException {
353

    
354

    
355
                }
356

    
357
                public void validateFeatures(int mode) throws DataException {
358

    
359

    
360
                }
361

    
362
                public DataSet createSelection() throws DataException {
363

    
364
                        return null;
365
                }
366

    
367
                public void dispose() {
368

    
369

    
370
                }
371

    
372
                public Iterator getChildren() {
373

    
374
                        return null;
375
                }
376

    
377
                public DataSet getDataSet() throws DataException {
378

    
379
                        return null;
380
                }
381

    
382
                public DataSet getDataSet(DataQuery dataQuery) throws DataException {
383

    
384
                        return null;
385
                }
386

    
387
                public void getDataSet(Observer observer) throws DataException {
388

    
389

    
390
                }
391

    
392
                public void getDataSet(DataQuery dataQuery, Observer observer)
393
                                throws DataException {
394

    
395

    
396
                }
397

    
398
                public DataServerExplorer getExplorer() throws DataException {
399

    
400
                        return null;
401
                }
402

    
403
                public String getName() {
404

    
405
                        return null;
406
                }
407

    
408
                public DataSet getSelection() throws DataException {
409

    
410
                        return null;
411
                }
412

    
413
                public void refresh() throws DataException {
414

    
415

    
416
                }
417

    
418
                public void setSelection(DataSet selection) throws DataException {
419

    
420

    
421
                }
422

    
423
                public void beginComplexNotification() {
424

    
425

    
426
                }
427

    
428
                public void disableNotifications() {
429

    
430

    
431
                }
432

    
433
                public void enableNotifications() {
434

    
435

    
436
                }
437

    
438
                public void endComplexNotification() {
439

    
440

    
441
                }
442

    
443
                public void addObserver(Observer o) {
444

    
445

    
446
                }
447

    
448
                public void deleteObserver(Observer o) {
449

    
450

    
451
                }
452

    
453
                public void deleteObservers() {
454

    
455

    
456
                }
457

    
458
                public void saveToState(PersistentState state)
459
                                throws PersistenceException {
460

    
461

    
462
                }
463

    
464
                public void loadFromState(PersistentState state) throws PersistenceException {
465

    
466

    
467
                }
468

    
469
                public FeatureQuery createFeatureQuery() {
470

    
471
                        return null;
472
                }
473

    
474
                public boolean canRedo() {
475

    
476
                        return false;
477
                }
478

    
479
                public boolean canUndo() {
480

    
481
                        return false;
482
                }
483

    
484
                public List getRedoInfos() {
485

    
486
                        return null;
487
                }
488

    
489
                public List getUndoInfos() {
490

    
491
                        return null;
492
                }
493

    
494
                public void redo() throws RedoException {
495

    
496

    
497
                }
498

    
499
                public void redo(int num) throws RedoException {
500

    
501

    
502
                }
503

    
504
                public void undo() throws UndoException {
505

    
506

    
507
                }
508

    
509
                public void undo(int num) throws UndoException {
510

    
511

    
512
                }
513

    
514
                public FeatureIndex createIndex(FeatureType featureType,
515
                                String attributeName, String indexName, Observer observer)
516
                                throws DataException {
517

    
518
                        return null;
519
                }
520

    
521
                public Object getMetadataID() {
522

    
523
                        return null;
524
                }
525

    
526
                public void delegate(DynObject dynObject) {
527

    
528

    
529
                }
530

    
531
                public DynClass getDynClass() {
532

    
533
                        return null;
534
                }
535

    
536
                public Object getDynValue(String name) throws DynFieldNotFoundException {
537

    
538
                        return null;
539
                }
540

    
541
                public boolean hasDynValue(String name) {
542

    
543
                        return false;
544
                }
545

    
546
                public void implement(DynClass dynClass) {
547

    
548

    
549
                }
550

    
551
                public Object invokeDynMethod(String name, DynObject context)
552
                                throws DynMethodException {
553

    
554
                        return null;
555
                }
556

    
557
                public Object invokeDynMethod(int code, DynObject context)
558
                                throws DynMethodException {
559

    
560
                        return null;
561
                }
562

    
563
                public void setDynValue(String name, Object value)
564
                                throws DynFieldNotFoundException {
565

    
566

    
567
                }
568

    
569
                /*
570
                 * (non-Javadoc)
571
                 *
572
                 * @see org.gvsig.metadata.Metadata#getMetadataChildren()
573
                 */
574
                public Set getMetadataChildren() {
575

    
576
                        return null;
577
                }
578

    
579
                /*
580
                 * (non-Javadoc)
581
                 *
582
                 * @see org.gvsig.metadata.Metadata#getMetadataName()
583
                 */
584
                public String getMetadataName() {
585

    
586
                        return null;
587
                }
588

    
589
                public FeatureType getFeatureType(String featureTypeId)
590
                                throws DataException {
591

    
592
                        return null;
593
                }
594

    
595
                public DataQuery createQuery() {
596

    
597
                        return null;
598
                }
599

    
600
                public long getFeatureCount() throws DataException {
601

    
602
                        return 0;
603
                }
604

    
605
                public void accept(Visitor visitor, DataQuery dataQuery)
606
                                throws BaseException {
607
                }
608

    
609
                public void accept(Visitor visitor) throws BaseException {
610
                }
611

    
612
                public void createCache(String name,
613
                                DynObject parameters) throws DataException {
614
                        // Do nothing
615
                }
616

    
617
                public FeatureCache getCache() {
618
                        return null;
619
                }
620

    
621
                public void clear() {
622
                        // Nothing to do
623
                }
624

    
625
                public void export(DataServerExplorer explorer, String provider,
626
                                NewFeatureStoreParameters params) throws DataException {
627
                        
628
                }
629

    
630
                public String getProviderName() {
631
                        return null;
632
                }
633

    
634
                public String getFullName() {
635
                        // TODO Auto-generated method stub
636
                        return null;
637
                }
638

    
639
        public boolean isKnownEnvelope() {
640
            // TODO Auto-generated method stub
641
            return false;
642
        }
643

    
644
        public boolean hasRetrievedFeaturesLimit() {
645
            // TODO Auto-generated method stub
646
            return false;
647
        }
648

    
649
        public int getRetrievedFeaturesLimit() {
650
            // TODO Auto-generated method stub
651
            return 0;
652
        }
653

    
654
        public FeatureIndex createIndex(String indexTypeName,
655
            FeatureType featureType, String attributeName, String indexName)
656
            throws DataException {
657
            // TODO Auto-generated method stub
658
            return null;
659
        }
660

    
661
        public FeatureIndex createIndex(String indexTypeName,
662
            FeatureType featureType, String attributeName, String indexName,
663
            Observer observer) throws DataException {
664
            // TODO Auto-generated method stub
665
            return null;
666
        }
667

    
668
        public Interval getInterval() {
669
            // TODO Auto-generated method stub
670
            return null;
671
        }
672

    
673
        public Collection getTimes() {
674
            // TODO Auto-generated method stub
675
            return null;
676
        }
677

    
678
        public Collection getTimes(Interval interval) {
679
            // TODO Auto-generated method stub
680
            return null;
681
        }
682
        
683
        public Object clone() throws CloneNotSupportedException {
684
            // TODO Auto-generated method stub
685
            return super.clone();
686
        }
687

    
688
        }
689

    
690
        //private static final FInterval interval0=new FInterval(0,2);
691
        //private static final FInterval interval1=new FInterval(3,5);
692
        //private static final FInterval interval2=new FInterval(6,2);
693
        //private static final FInterval interval3=new FInterval(9,2);
694
        // private static final Value interval4;
695
        // private static final Value interval5;
696
        // private static final Value interval6;
697
        // private static final Value interval7;
698
        // private static final Value interval8;
699
        // private static final Value interval9;
700

    
701
        Hashtable symTable;
702

    
703
        private IClassifiedVectorLegend[] classifiedLegends;
704
        private ISymbol[] symbols;
705
        private Object[] sampleValues = new Object[] { v0, v1, v2, v3, };
706
        private Feature[] features;
707

    
708
        // private FInterval[] intervals = new FInterval[] {
709
        // interval0,
710
        // interval1,
711
        // interval2,
712
        // interval3,
713
        // interval4,
714
        // interval5,
715
        // interval6,
716
        // interval7,
717
        // interval8,
718
        // interval9,
719
        // };
720

    
721
        protected void doSetUp() throws Exception {
722
                
723
                features = new Feature[4];
724

    
725
//                //Initializes the geometries library
726
//                DefaultGeometryLibrary lib = new DefaultGeometryLibrary();
727
//                lib.initialize();
728
//                lib.postInitialize();
729

    
730
                // initialize test values
731
                for (int i = 0; i < features.length; i++) {
732
                        // create the geometry associated to the feature
733
                        int size = 200;
734
                        Dimension d = new Dimension(size, size);
735
                        Rectangle aShape = new Rectangle(i * size, i * size, d.width,
736
                                        d.height);
737
                        GeometryManager geomManager = GeometryLocator.getGeometryManager();
738
                        Curve curve = (Curve)geomManager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
739
                        curve.setGeneralPath(new GeneralPathX(aShape.getPathIterator(null)));
740

    
741
                        /*
742
                         * create a full-featured Feature with randomed values at its fields
743
                         * to avoid testing over the same values each time
744
                         */
745
//                        features[i] = new DefaultFeature(geom, featureValues[i], "[" + i
746
//                                        + "]");
747
                }
748

    
749
                // initialize the symbol subset for this test
750
                symbols = TestISymbol.getNewSymbolInstances();
751

    
752
                // initialize the legends for this test
753
                ILegend[] allLegends = TestILegend.getNewLegendInstances();
754
                ArrayList clegends = new ArrayList();
755
                ArrayList intervalLegends = new ArrayList();
756
                for (int i = 0; i < allLegends.length; i++) {
757
                        if (allLegends[i] instanceof AbstractIntervalLegend) {
758
                                intervalLegends.add(allLegends[i]);
759
                        } else if (allLegends[i] instanceof IClassifiedLegend) {
760
                                clegends.add(allLegends[i]);
761
                        }
762

    
763
                        if (allLegends[i] instanceof IClassifiedVectorLegend) {
764
                                IClassifiedVectorLegend cvl = (IClassifiedVectorLegend) allLegends[i];
765
                                cvl.setClassifyingFieldNames(new String[] { fieldNames[FIELDID] });
766
//                                cvl.setFeatureStore(mockDataSource);
767

    
768
                        }
769
                }
770

    
771
                this.classifiedLegends = (IClassifiedVectorLegend[]) clegends
772
                                .toArray(new IClassifiedVectorLegend[clegends.size()]);
773
                this.intervalLegends =
774
                                (AbstractIntervalLegend[]) intervalLegends
775
                                .toArray(new AbstractIntervalLegend[intervalLegends.size()]);
776
        }
777

    
778
        /**
779
         * This method is used to add symbols to a legend.That is, it takes an array
780
         * of IClassifiedVectorialLegend which is empty andm, using a second array
781
         * of objects (values), the first one is filled.Also, a hash table is filled
782
         * too using the array of objects (it will be useful in some tests to check
783
         * that a symbol can be taken using a feature) .
784
         *
785
         * @param legend
786
         * @return
787
         */
788
        private void fillClassifiedLegend(IClassifiedVectorLegend legend,
789
                        Object[] values) {
790
                // initialize the hash table
791
                symTable = new Hashtable();
792

    
793
                // to add symbols to the legend and the hash table
794
                for (int j = 0; j < values.length; j++) {
795

    
796
                        ISymbol sym = symbols[j % symbols.length];
797
                        legend.addSymbol(values[j], sym);
798
                        symTable.put(values[j], sym);
799
                }
800
        }
801

    
802
        /**
803
         * This test ensures that when a legend is filled, the number of symbols
804
         * added is correct. To do it, is checked that the number of symbols of a
805
         * legend is the same as the length of the array of example values that we
806
         * have.
807
         *
808
         * @throws ReadDriverException
809
         */
810
        public void testICLAdittion() throws ReadException {
811

    
812
                // Fills the legend
813
                for (int i = 0; i < classifiedLegends.length; i++) {
814
                        fillClassifiedLegend(classifiedLegends[i], sampleValues);
815
                }
816

    
817
                for (int i = 0; i < classifiedLegends.length; i++) {
818
                        assertEquals(classifiedLegends[i].getClass().getName()
819
                                        + " fails with the comparation of the number of symbols",
820
                                        classifiedLegends[i].getSymbols().length,
821
                                        sampleValues.length);
822
                }
823

    
824
        }
825

    
826
        /**
827
         * This test ensures that the symbols that we have previously added to a
828
         * legend are accessible using its features.To do it, this test compares the
829
         * symbol taken from the legend with the symbol taken from the hashTable
830
         * (using the same feature).
831
         * @throws Exception 
832
         */
833
        public void testICLCheckValueSymbols() throws Exception {
834
                // fills the legends
835
                for (int i = 0; i < classifiedLegends.length; i++) {
836
                        fillClassifiedLegend(classifiedLegends[i], sampleValues);
837
                }
838

    
839
                for (int i = 0; i < classifiedLegends.length; i++) {
840
                        // For each feature
841
                        for (int j = 0; j < features.length; j++) {
842
                                Feature myFeature = features[i];
843
                                // takes the value of the field that identifies the feature
844
                                Object val = myFeature.get(FIELDID);
845
                                // the last value is used to access to the hash table to obtain
846
                                // a symbol
847
                                ISymbol tableSym = (ISymbol) symTable.get(val);
848

    
849
                                IClassifiedVectorLegend leg = classifiedLegends[i];
850
                                // takes the symbol from a legend using the feature
851
                                ISymbol legendSym = leg.getSymbolByFeature(myFeature);
852
                                // compares that both symbols are the same
853
                                assertEquals(legendSym.getClass().getName()
854
                                                + " fails with the comparation of the class symbols",
855
                                                legendSym, tableSym);
856
                        }
857
                }
858
        }
859

    
860
}