Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_mapcontext / src-test / org / gvsig / fmap / mapcontext / rendering / TestIClassifiedLegend.java @ 28076

History | View | Annotate | Download (23.2 KB)

1 21200 vcaballero
 /* 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.util.ArrayList;
46
import java.util.Hashtable;
47
import java.util.Iterator;
48
import java.util.List;
49 25795 jmvivo
import java.util.Set;
50 21200 vcaballero
51 23010 jmvivo
import junit.framework.TestCase;
52
53 26717 jmvivo
import org.cresques.cts.IProjection;
54 25053 jmvivo
import org.gvsig.fmap.dal.DataQuery;
55 24879 jmvivo
import org.gvsig.fmap.dal.DataServerExplorer;
56 24494 jmvivo
import org.gvsig.fmap.dal.DataSet;
57
import org.gvsig.fmap.dal.DataStoreParameters;
58 24504 jmvivo
import org.gvsig.fmap.dal.exception.DataException;
59
import org.gvsig.fmap.dal.exception.ReadException;
60 24691 vcaballero
import org.gvsig.fmap.dal.feature.EditableFeature;
61
import org.gvsig.fmap.dal.feature.EditableFeatureType;
62 24494 jmvivo
import org.gvsig.fmap.dal.feature.Feature;
63 24691 vcaballero
import org.gvsig.fmap.dal.feature.FeatureIndex;
64
import org.gvsig.fmap.dal.feature.FeatureIndexes;
65 25586 vcaballero
import org.gvsig.fmap.dal.feature.FeatureLocks;
66 24494 jmvivo
import org.gvsig.fmap.dal.feature.FeatureQuery;
67
import org.gvsig.fmap.dal.feature.FeatureReference;
68 24691 vcaballero
import org.gvsig.fmap.dal.feature.FeatureSelection;
69 24494 jmvivo
import org.gvsig.fmap.dal.feature.FeatureSet;
70
import org.gvsig.fmap.dal.feature.FeatureStore;
71 24691 vcaballero
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms;
72 24494 jmvivo
import org.gvsig.fmap.dal.feature.FeatureType;
73 24691 vcaballero
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
74
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
75 26333 jpiera
import org.gvsig.fmap.geom.GeometryLocator;
76 26904 jpiera
import org.gvsig.fmap.geom.GeometryManager;
77
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
78
import org.gvsig.fmap.geom.Geometry.TYPES;
79 27042 jpiera
import org.gvsig.fmap.geom.impl.DefaultGeometryLibrary;
80 26904 jpiera
import org.gvsig.fmap.geom.primitive.Curve;
81 24691 vcaballero
import org.gvsig.fmap.geom.primitive.Envelope;
82 21200 vcaballero
import org.gvsig.fmap.geom.primitive.GeneralPathX;
83
import org.gvsig.fmap.mapcontext.rendering.legend.AbstractIntervalLegend;
84
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedLegend;
85
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedVectorLegend;
86
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
87
import org.gvsig.fmap.mapcontext.rendering.symbol.TestISymbol;
88
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
89 23748 jjdelcerro
import org.gvsig.metadata.Metadata;
90 25469 jmvivo
import org.gvsig.metadata.exceptions.MetadataNotFoundException;
91 25795 jmvivo
import org.gvsig.tools.dynobject.DynClass;
92
import org.gvsig.tools.dynobject.DynObject;
93
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
94
import org.gvsig.tools.dynobject.exception.DynMethodException;
95 23066 jmvivo
import org.gvsig.tools.observer.Observer;
96 24691 vcaballero
import org.gvsig.tools.operations.OperationContext;
97
import org.gvsig.tools.operations.OperationException;
98
import org.gvsig.tools.operations.OperationNotSupportedException;
99
import org.gvsig.tools.persistence.PersistenceException;
100
import org.gvsig.tools.persistence.PersistentState;
101 25053 jmvivo
import org.gvsig.tools.undo.RedoException;
102
import org.gvsig.tools.undo.UndoException;
103 21200 vcaballero
104
105
/**
106
 * Integration test to ensure that the legends which implements the
107
 * IClassifiedLegend interface follow the rules that follow the managing of them
108
 * by the application.
109
 *
110
 * @author jaume dominguez faus - jaume.dominguez@iver.es
111
 * @author pepe vidal salvador - jose.vidal.salvador@iver.es
112
 */
113
public class TestIClassifiedLegend extends TestCase {
114
115
        private static final Integer v0 = new Integer(0);
116
        private static final Integer v1 = new Integer(1);
117
        private static final Integer v2 = new Integer(2);
118
        private static final Integer v3 = new Integer(3);
119
120
        private static final String FIELD3 = "field3";
121
        private static final String FIELD2 = "field2";
122
        private static final String FIELD1 = "field1";
123
        private static final String FIELD0 = "field0";
124
        private static final int FIELDID = 0;
125
126
        private static final Integer[] feature0Values = new Integer[] { v0, v1, v2, v3, };
127
        private static final Integer[] feature1Values = new Integer[] { v3, v0, v1, v2, };
128
        private static final Integer[] feature2Values = new Integer[] { v2, v3, v0, v1, };
129
        private static final Integer[] feature3Values = new Integer[] { v1, v2, v3, v0, };
130
131
        private static final Integer[][] featureValues = new Integer[][] {
132
                feature0Values,
133
                feature1Values,
134
                feature2Values,
135
                feature3Values,};
136
137
        private static String[] fieldNames = new String[] {FIELD0,FIELD1,FIELD2,FIELD3,};
138
139
140
        // private static final Value v4 = (Value)ValueFactory.createValue(4);
141
        // private static final Value v5 = (Value)ValueFactory.createValue(5);
142
        // private static final Value v6 = (Value)ValueFactory.createValue(6);
143
        // private static final Value v7 = (Value)ValueFactory.createValue(7);
144
        // private static final Value v8 = (Value)ValueFactory.createValue(8);
145
        // private static final Value v9 = (Value)ValueFactory.createValue(9);
146
147
        private AbstractIntervalLegend[] intervalLegends;
148
        private MockDataSource mockDataSource = new MockDataSource();
149
150
        /**
151
         * To avoid duplicated validation logic in the test a mock object is created
152
         * to use a DataSource for this test.
153
         *
154
         */
155
        private class MockDataSource implements FeatureStore {
156
157 24691 vcaballero
                public boolean allowWrite() {
158 21200 vcaballero
                        // TODO Auto-generated method stub
159 24691 vcaballero
                        return false;
160 21200 vcaballero
                }
161
162 24691 vcaballero
                public void beginEditingGroup(String description)
163
                                throws NeedEditingModeException {
164 21200 vcaballero
                        // TODO Auto-generated method stub
165
166
                }
167
168 24691 vcaballero
                public boolean canWriteGeometry(int gvSIGgeometryType)
169
                                throws DataException {
170 21200 vcaballero
                        // TODO Auto-generated method stub
171 24691 vcaballero
                        return false;
172 21200 vcaballero
                }
173
174 24691 vcaballero
                public void cancelEditing() throws DataException {
175 21200 vcaballero
                        // TODO Auto-generated method stub
176
177
                }
178
179 24691 vcaballero
                public FeatureSelection createFeatureSelection() throws DataException {
180 21200 vcaballero
                        // TODO Auto-generated method stub
181
                        return null;
182
                }
183
184 24691 vcaballero
                public FeatureIndex createIndex(FeatureType featureType,
185
                                String attributeName, String indexName) throws DataException {
186 21200 vcaballero
                        // TODO Auto-generated method stub
187
                        return null;
188
                }
189
190 24691 vcaballero
                public EditableFeature createNewFeature() throws DataException {
191 21200 vcaballero
                        // TODO Auto-generated method stub
192
                        return null;
193
                }
194
195 24691 vcaballero
                public EditableFeature createNewFeature(FeatureType type,
196
                                Feature defaultValues) throws DataException {
197 21200 vcaballero
                        // TODO Auto-generated method stub
198
                        return null;
199
                }
200
201 24691 vcaballero
                public EditableFeature createNewFeature(FeatureType type,
202
                                boolean defaultValues) throws DataException {
203 21200 vcaballero
                        // TODO Auto-generated method stub
204
                        return null;
205
                }
206
207 24691 vcaballero
                public EditableFeature createNewFeature(boolean defaultValues)
208
                                throws DataException {
209 21200 vcaballero
                        // TODO Auto-generated method stub
210
                        return null;
211
                }
212
213 23748 jjdelcerro
                public void delete(Feature feature) throws DataException {
214 21200 vcaballero
                        // TODO Auto-generated method stub
215
216
                }
217
218 24691 vcaballero
                public void edit() throws DataException {
219 21200 vcaballero
                        // TODO Auto-generated method stub
220
221
                }
222
223 24691 vcaballero
                public void edit(int mode) throws DataException {
224 21200 vcaballero
                        // TODO Auto-generated method stub
225 23748 jjdelcerro
226 21200 vcaballero
                }
227
228 24691 vcaballero
                public void endEditingGroup() throws NeedEditingModeException {
229 21200 vcaballero
                        // TODO Auto-generated method stub
230 23748 jjdelcerro
231 21200 vcaballero
                }
232
233 24879 jmvivo
                public void export(DataServerExplorer explorer,
234 24691 vcaballero
                                NewFeatureStoreParameters params) throws DataException {
235 21200 vcaballero
                        // TODO Auto-generated method stub
236 23748 jjdelcerro
237 21200 vcaballero
                }
238
239 24691 vcaballero
                public void finishEditing() throws DataException {
240 21200 vcaballero
                        // TODO Auto-generated method stub
241
242
                }
243
244 24691 vcaballero
                public FeatureType getDefaultFeatureType() throws DataException {
245 21200 vcaballero
                        // TODO Auto-generated method stub
246 24691 vcaballero
                        return null;
247 21200 vcaballero
                }
248
249 24691 vcaballero
                public Envelope getEnvelope() {
250 21200 vcaballero
                        // TODO Auto-generated method stub
251 24691 vcaballero
                        return null;
252 21200 vcaballero
                }
253
254 24691 vcaballero
                public Feature getFeatureByReference(FeatureReference reference)
255
                                throws DataException {
256 21200 vcaballero
                        // TODO Auto-generated method stub
257 24691 vcaballero
                        return null;
258 21200 vcaballero
                }
259
260 24691 vcaballero
                public Feature getFeatureByReference(FeatureReference reference,
261
                                FeatureType featureType) throws DataException {
262 21200 vcaballero
                        // TODO Auto-generated method stub
263 23748 jjdelcerro
                        return null;
264 21200 vcaballero
                }
265
266 24691 vcaballero
                public FeatureSelection getFeatureSelection() throws DataException {
267 21200 vcaballero
                        // TODO Auto-generated method stub
268 23748 jjdelcerro
                        return null;
269 21200 vcaballero
                }
270
271 24691 vcaballero
                public FeatureSet getFeatureSet() throws DataException {
272 21200 vcaballero
                        // TODO Auto-generated method stub
273 23748 jjdelcerro
                        return null;
274 21200 vcaballero
                }
275
276 24691 vcaballero
                public FeatureSet getFeatureSet(FeatureQuery featureQuery)
277
                                throws DataException {
278 21200 vcaballero
                        // TODO Auto-generated method stub
279
                        return null;
280
                }
281
282 24691 vcaballero
                public void getFeatureSet(FeatureQuery featureQuery, Observer observer)
283
                                throws DataException {
284 21200 vcaballero
                        // TODO Auto-generated method stub
285 23748 jjdelcerro
286 21200 vcaballero
                }
287
288 24691 vcaballero
                public void getFeatureSet(Observer observer) throws DataException {
289 21200 vcaballero
                        // TODO Auto-generated method stub
290
291
                }
292
293 24691 vcaballero
                public List getFeatureTypes() throws DataException {
294 21200 vcaballero
                        // TODO Auto-generated method stub
295 24691 vcaballero
                        return null;
296 21200 vcaballero
                }
297
298 24691 vcaballero
                public FeatureIndexes getIndexes() {
299 21200 vcaballero
                        // TODO Auto-generated method stub
300 24691 vcaballero
                        return null;
301 21200 vcaballero
                }
302
303 25586 vcaballero
                public FeatureLocks getLocks() throws DataException {
304 21200 vcaballero
                        // TODO Auto-generated method stub
305 24691 vcaballero
                        return null;
306
                }
307 21200 vcaballero
308 24691 vcaballero
                public DataStoreParameters getParameters() {
309
                        // TODO Auto-generated method stub
310
                        return null;
311 21200 vcaballero
                }
312
313 26717 jmvivo
                public IProjection getSRSDefaultGeometry() throws DataException {
314 21200 vcaballero
                        // TODO Auto-generated method stub
315
                        return null;
316
                }
317
318 24691 vcaballero
                public FeatureStoreTransforms getTransforms() {
319 21200 vcaballero
                        // TODO Auto-generated method stub
320
                        return null;
321
                }
322
323 24691 vcaballero
                public void insert(EditableFeature feature) throws DataException {
324 21200 vcaballero
                        // TODO Auto-generated method stub
325
326
                }
327
328 24691 vcaballero
                public boolean isAppendModeSupported() {
329 21200 vcaballero
                        // TODO Auto-generated method stub
330 24691 vcaballero
                        return false;
331 21200 vcaballero
                }
332
333 24691 vcaballero
                public boolean isAppending() {
334 21200 vcaballero
                        // TODO Auto-generated method stub
335 24691 vcaballero
                        return false;
336 21200 vcaballero
                }
337
338 24691 vcaballero
                public boolean isEditing() {
339 21200 vcaballero
                        // TODO Auto-generated method stub
340 23748 jjdelcerro
                        return false;
341 21200 vcaballero
                }
342
343 24691 vcaballero
                public boolean isLocksSupported() {
344 21200 vcaballero
                        // TODO Auto-generated method stub
345 24691 vcaballero
                        return false;
346 21200 vcaballero
                }
347
348 24691 vcaballero
                public void setSelection(FeatureSet selection) throws DataException {
349 21200 vcaballero
                        // TODO Auto-generated method stub
350
351
                }
352
353 24691 vcaballero
                public void update(EditableFeatureType featureType)
354
                                throws DataException {
355 21200 vcaballero
                        // TODO Auto-generated method stub
356 23748 jjdelcerro
357 21200 vcaballero
                }
358
359 24691 vcaballero
                public void update(EditableFeature feature) throws DataException {
360 21200 vcaballero
                        // TODO Auto-generated method stub
361
362
                }
363
364 24691 vcaballero
                public void validateFeatures(int mode) throws DataException {
365 21200 vcaballero
                        // TODO Auto-generated method stub
366 24691 vcaballero
367 21200 vcaballero
                }
368
369 24691 vcaballero
                public DataSet createSelection() throws DataException {
370 21200 vcaballero
                        // TODO Auto-generated method stub
371 24691 vcaballero
                        return null;
372 21200 vcaballero
                }
373
374 24691 vcaballero
                public void dispose() throws DataException {
375 21200 vcaballero
                        // TODO Auto-generated method stub
376
377
                }
378
379 24691 vcaballero
                public Iterator getChildren() {
380 21200 vcaballero
                        // TODO Auto-generated method stub
381 23748 jjdelcerro
                        return null;
382 21200 vcaballero
                }
383
384 24691 vcaballero
                public DataSet getDataSet() throws DataException {
385 21200 vcaballero
                        // TODO Auto-generated method stub
386 23748 jjdelcerro
                        return null;
387 21200 vcaballero
                }
388
389 24691 vcaballero
                public DataSet getDataSet(DataQuery dataQuery) throws DataException {
390 21200 vcaballero
                        // TODO Auto-generated method stub
391 23748 jjdelcerro
                        return null;
392 21200 vcaballero
                }
393
394 24691 vcaballero
                public void getDataSet(Observer observer) throws DataException {
395 21200 vcaballero
                        // TODO Auto-generated method stub
396
397
                }
398
399 24691 vcaballero
                public void getDataSet(DataQuery dataQuery, Observer observer)
400
                                throws DataException {
401 21200 vcaballero
                        // TODO Auto-generated method stub
402
403
                }
404
405 24879 jmvivo
                public DataServerExplorer getExplorer() throws DataException {
406 21200 vcaballero
                        // TODO Auto-generated method stub
407 24691 vcaballero
                        return null;
408 23721 jmvivo
                }
409
410 24691 vcaballero
                public String getName() {
411 23721 jmvivo
                        // TODO Auto-generated method stub
412
                        return null;
413
                }
414 21200 vcaballero
415 24691 vcaballero
                public DataSet getSelection() throws DataException {
416 23748 jjdelcerro
                        // TODO Auto-generated method stub
417 24691 vcaballero
                        return null;
418 23748 jjdelcerro
                }
419 21704 jmvivo
420 24691 vcaballero
                public void refresh() throws DataException {
421 23748 jjdelcerro
                        // TODO Auto-generated method stub
422 24691 vcaballero
423 23748 jjdelcerro
                }
424
425 24691 vcaballero
                public void setSelection(DataSet selection) throws DataException {
426 23748 jjdelcerro
                        // TODO Auto-generated method stub
427 24691 vcaballero
428 23748 jjdelcerro
                }
429
430 24691 vcaballero
                public void beginComplexNotification() {
431 23748 jjdelcerro
                        // TODO Auto-generated method stub
432 24691 vcaballero
433 23748 jjdelcerro
                }
434
435 24691 vcaballero
                public void disableNotifications() {
436 23748 jjdelcerro
                        // TODO Auto-generated method stub
437 24691 vcaballero
438 23748 jjdelcerro
                }
439
440 24691 vcaballero
                public void enableNotifications() {
441 23748 jjdelcerro
                        // TODO Auto-generated method stub
442 24691 vcaballero
443 23748 jjdelcerro
                }
444
445 24691 vcaballero
                public void endComplexNotification() {
446 23748 jjdelcerro
                        // TODO Auto-generated method stub
447
448
                }
449
450 24691 vcaballero
                public void addObserver(Observer o) {
451 23748 jjdelcerro
                        // TODO Auto-generated method stub
452 24691 vcaballero
453 23748 jjdelcerro
                }
454
455 24691 vcaballero
                public void deleteObserver(Observer o) {
456 23748 jjdelcerro
                        // TODO Auto-generated method stub
457 24691 vcaballero
458 23748 jjdelcerro
                }
459
460 24691 vcaballero
                public void deleteObservers() {
461 23748 jjdelcerro
                        // TODO Auto-generated method stub
462
463
                }
464
465 24691 vcaballero
                public PersistentState getState() throws PersistenceException {
466 23748 jjdelcerro
                        // TODO Auto-generated method stub
467
                        return null;
468
                }
469
470 28076 cmartinez
                public void saveToState(PersistentState state)
471 24691 vcaballero
                                throws PersistenceException {
472 23748 jjdelcerro
                        // TODO Auto-generated method stub
473
474
                }
475
476 24691 vcaballero
                public void setState(PersistentState state) throws PersistenceException {
477 23748 jjdelcerro
                        // TODO Auto-generated method stub
478
479
                }
480
481 24691 vcaballero
                public Object getOperation(int code) throws OperationException,
482
                                OperationNotSupportedException {
483 23748 jjdelcerro
                        // TODO Auto-generated method stub
484
                        return null;
485
                }
486
487 24691 vcaballero
                public Object getOperation(String name) throws OperationException,
488
                                OperationNotSupportedException {
489 23748 jjdelcerro
                        // TODO Auto-generated method stub
490
                        return null;
491
                }
492
493 24691 vcaballero
                public boolean hasOperation(int code) {
494 23748 jjdelcerro
                        // TODO Auto-generated method stub
495 24691 vcaballero
                        return false;
496 23748 jjdelcerro
                }
497
498 24691 vcaballero
                public boolean hasOperation(String name) {
499 23748 jjdelcerro
                        // TODO Auto-generated method stub
500 24691 vcaballero
                        return false;
501 23748 jjdelcerro
                }
502
503 24691 vcaballero
                public Object invokeOperation(int code, OperationContext context)
504
                                throws OperationException, OperationNotSupportedException {
505 23748 jjdelcerro
                        // TODO Auto-generated method stub
506
                        return null;
507
                }
508
509 24691 vcaballero
                public Object invokeOperation(String name, OperationContext context)
510
                                throws OperationException, OperationNotSupportedException {
511 23748 jjdelcerro
                        // TODO Auto-generated method stub
512
                        return null;
513
                }
514
515 24691 vcaballero
                public FeatureQuery createFeatureQuery() {
516
                        // TODO Auto-generated method stub
517 23748 jjdelcerro
                        return null;
518
                }
519
520 25053 jmvivo
                public boolean canRedo() {
521
                        // TODO Auto-generated method stub
522
                        return false;
523
                }
524
525
                public boolean canUndo() {
526
                        // TODO Auto-generated method stub
527
                        return false;
528
                }
529
530
                public List getRedoInfos() {
531
                        // TODO Auto-generated method stub
532
                        return null;
533
                }
534
535
                public List getUndoInfos() {
536
                        // TODO Auto-generated method stub
537
                        return null;
538
                }
539
540
                public void redo() throws RedoException {
541
                        // TODO Auto-generated method stub
542
543
                }
544
545
                public void redo(int num) throws RedoException {
546
                        // TODO Auto-generated method stub
547
548
                }
549
550
                public void undo() throws UndoException {
551
                        // TODO Auto-generated method stub
552
553
                }
554
555
                public void undo(int num) throws UndoException {
556
                        // TODO Auto-generated method stub
557
558
                }
559
560 25178 jmvivo
                public FeatureIndex createIndex(FeatureType featureType,
561
                                String attributeName, String indexName, Observer observer)
562
                                throws DataException {
563
                        // TODO Auto-generated method stub
564
                        return null;
565
                }
566
567 25469 jmvivo
                public Metadata getMetadata() throws MetadataNotFoundException {
568
                        // TODO Auto-generated method stub
569
                        return null;
570
                }
571
572 25795 jmvivo
                public Object getMetadataID() {
573
                        // TODO Auto-generated method stub
574
                        return null;
575
                }
576
577
                public void delegate(DynObject dynObject) {
578
                        // TODO Auto-generated method stub
579
580
                }
581
582
                public DynClass getDynClass() {
583
                        // TODO Auto-generated method stub
584
                        return null;
585
                }
586
587
                public Object getDynValue(String name) throws DynFieldNotFoundException {
588
                        // TODO Auto-generated method stub
589
                        return null;
590
                }
591
592
                public boolean hasDynValue(String name) {
593
                        // TODO Auto-generated method stub
594
                        return false;
595
                }
596
597
                public void implement(DynClass dynClass) {
598
                        // TODO Auto-generated method stub
599
600
                }
601
602
                public Object invokeDynMethod(String name, DynObject context)
603
                                throws DynMethodException {
604
                        // TODO Auto-generated method stub
605
                        return null;
606
                }
607
608
                public Object invokeDynMethod(int code, DynObject context)
609
                                throws DynMethodException {
610
                        // TODO Auto-generated method stub
611
                        return null;
612
                }
613
614
                public void setDynValue(String name, Object value)
615
                                throws DynFieldNotFoundException {
616
                        // TODO Auto-generated method stub
617
618
                }
619
620
                /*
621
                 * (non-Javadoc)
622 27234 jmvivo
                 *
623 25795 jmvivo
                 * @see org.gvsig.metadata.Metadata#getMetadataChildren()
624
                 */
625
                public Set getMetadataChildren() {
626
                        // TODO Auto-generated method stub
627
                        return null;
628
                }
629
630
                /*
631
                 * (non-Javadoc)
632 27234 jmvivo
                 *
633 25795 jmvivo
                 * @see org.gvsig.metadata.Metadata#getMetadataName()
634
                 */
635
                public String getMetadataName() {
636
                        // TODO Auto-generated method stub
637
                        return null;
638
                }
639
640 27234 jmvivo
                public FeatureType getFeatureType(String featureTypeId)
641
                                throws DataException {
642
                        // TODO Auto-generated method stub
643
                        return null;
644
                }
645
646 27596 jmvivo
                public DataQuery createQuery() {
647
                        // TODO Auto-generated method stub
648
                        return null;
649
                }
650
651 28032 jmvivo
                public long getFeatureCount() throws DataException {
652
                        // TODO Auto-generated method stub
653
                        return 0;
654
                }
655
656 21200 vcaballero
        }
657
658
        //private static final FInterval interval0=new FInterval(0,2);
659
        //private static final FInterval interval1=new FInterval(3,5);
660
        //private static final FInterval interval2=new FInterval(6,2);
661
        //private static final FInterval interval3=new FInterval(9,2);
662
        // private static final Value interval4;
663
        // private static final Value interval5;
664
        // private static final Value interval6;
665
        // private static final Value interval7;
666
        // private static final Value interval8;
667
        // private static final Value interval9;
668
669
        Hashtable symTable;
670
671
        private IClassifiedVectorLegend[] classifiedLegends;
672
        private ISymbol[] symbols;
673
        private Object[] sampleValues = new Object[] { v0, v1, v2, v3, };
674
        private Feature[] features;
675
676
        // private FInterval[] intervals = new FInterval[] {
677
        // interval0,
678
        // interval1,
679
        // interval2,
680
        // interval3,
681
        // interval4,
682
        // interval5,
683
        // interval6,
684
        // interval7,
685
        // interval8,
686
        // interval9,
687
        // };
688
689
        protected void setUp() throws Exception {
690
                super.setUp();
691
                features = new Feature[4];
692 27234 jmvivo
693 26333 jpiera
                //Initializes the geometries library
694 27234 jmvivo
                DefaultGeometryLibrary lib = new DefaultGeometryLibrary();
695 26333 jpiera
                lib.initialize();
696 27234 jmvivo
                lib.postInitialize();
697 21200 vcaballero
698
                // initialize test values
699
                for (int i = 0; i < features.length; i++) {
700
                        // create the geometry associated to the feature
701
                        int size = 200;
702
                        Dimension d = new Dimension(size, size);
703
                        Rectangle aShape = new Rectangle(i * size, i * size, d.width,
704
                                        d.height);
705 26904 jpiera
                        GeometryManager geomManager = GeometryLocator.getGeometryManager();
706
                        Curve curve = (Curve)geomManager.create(TYPES.CURVE, SUBTYPES.GEOM2D);
707
                        curve.setGeneralPath(new GeneralPathX(aShape));
708 27234 jmvivo
709 21200 vcaballero
                        /*
710
                         * create a full-featured Feature with randomed values at its fields
711
                         * to avoid testing over the same values each time
712
                         */
713
//                        features[i] = new DefaultFeature(geom, featureValues[i], "[" + i
714
//                                        + "]");
715
                }
716
717
                // initialize the symbol subset for this test
718
                symbols = TestISymbol.getNewSymbolInstances();
719
720
                // initialize the legends for this test
721
                ILegend[] allLegends = TestILegend.getNewLegendInstances();
722
                ArrayList clegends = new ArrayList();
723
                ArrayList intervalLegends = new ArrayList();
724
                for (int i = 0; i < allLegends.length; i++) {
725 23010 jmvivo
                        if (allLegends[i] instanceof AbstractIntervalLegend) {
726 21200 vcaballero
                                intervalLegends.add(allLegends[i]);
727 23010 jmvivo
                        } else if (allLegends[i] instanceof IClassifiedLegend) {
728 21200 vcaballero
                                clegends.add(allLegends[i]);
729
                        }
730
731
                        if (allLegends[i] instanceof IClassifiedVectorLegend) {
732
                                IClassifiedVectorLegend cvl = (IClassifiedVectorLegend) allLegends[i];
733
                                cvl.setClassifyingFieldNames(new String[] { fieldNames[FIELDID] });
734
                                cvl.setFeatureStore(mockDataSource);
735
736
                        }
737
                }
738
739
                this.classifiedLegends = (IClassifiedVectorLegend[]) clegends
740
                                .toArray(new IClassifiedVectorLegend[clegends.size()]);
741
                this.intervalLegends = (AbstractIntervalLegend[]) intervalLegends
742
                                .toArray(new AbstractIntervalLegend[intervalLegends.size()]);
743
        }
744
745
        /**
746
         * This method is used to add symbols to a legend.That is, it takes an array
747
         * of IClassifiedVectorialLegend which is empty andm, using a second array
748
         * of objects (values), the first one is filled.Also, a hash table is filled
749
         * too using the array of objects (it will be useful in some tests to check
750
         * that a symbol can be taken using a feature) .
751
         *
752
         * @param legend
753
         * @return
754
         */
755
        private void fillClassifiedLegend(IClassifiedVectorLegend legend,
756
                        Object[] values) {
757
                // initialize the hash table
758
                symTable = new Hashtable();
759
760
                // to add symbols to the legend and the hash table
761
                for (int j = 0; j < values.length; j++) {
762
763
                        ISymbol sym = symbols[j % symbols.length];
764
                        legend.addSymbol(values[j], sym);
765
                        symTable.put(values[j], sym);
766
                }
767
        }
768
769
        /**
770
         * This test ensures that when a legend is filled, the number of symbols
771
         * added is correct. To do it, is checked that the number of symbols of a
772
         * legend is the same as the length of the array of example values that we
773
         * have.
774
         *
775
         * @throws ReadDriverException
776
         */
777
        public void testICLAdittion() throws ReadException {
778
779
                // Fills the legend
780
                for (int i = 0; i < classifiedLegends.length; i++) {
781
                        fillClassifiedLegend(classifiedLegends[i], sampleValues);
782
                }
783
784 23010 jmvivo
                for (int i = 0; i < classifiedLegends.length; i++) {
785 21200 vcaballero
                        assertEquals(classifiedLegends[i].getClassName()
786
                                        + " fails with the comparation of the number of symbols",
787
                                        classifiedLegends[i].getSymbols().length,
788
                                        sampleValues.length);
789 23010 jmvivo
                }
790 21200 vcaballero
791
        }
792
793
        /**
794
         * This test ensures that the symbols that we have previously added to a
795
         * legend are accessible using its features.To do it, this test compares the
796
         * symbol taken from the legend with the symbol taken from the hashTable
797
         * (using the same feature).
798
         *
799
         * @throws ReadDriverException
800
         */
801
802
        public void testICLCheckValueSymbols() throws ReadException {
803
                // fills the legends
804
                for (int i = 0; i < classifiedLegends.length; i++) {
805
                        fillClassifiedLegend(classifiedLegends[i], sampleValues);
806
                }
807
808
                for (int i = 0; i < classifiedLegends.length; i++) {
809
                        // For each feature
810
                        for (int j = 0; j < features.length; j++) {
811
                                Feature myFeature = features[i];
812
                                // takes the value of the field that identifies the feature
813
                                Object val = myFeature.get(FIELDID);
814
                                // the last value is used to access to the hash table to obtain
815
                                // a symbol
816
                                ISymbol tableSym = (ISymbol) symTable.get(val);
817
818 23010 jmvivo
                                IClassifiedVectorLegend leg = classifiedLegends[i];
819 21200 vcaballero
                                // takes the symbol from a legend using the feature
820
                                ISymbol legendSym = leg.getSymbolByFeature(myFeature);
821
                                // compares that both symbols are the same
822
                                assertEquals(legendSym.getClassName()
823
                                                + " fails with the comparation of the class symbols",
824
                                                legendSym, tableSym);
825
                        }
826
                }
827
        }
828
829
}