Revision 42928 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/test/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/TestAbstractIntervalLegend.java
TestAbstractIntervalLegend.java | ||
---|---|---|
26 | 26 |
import java.awt.Dimension; |
27 | 27 |
import java.awt.Rectangle; |
28 | 28 |
import java.util.ArrayList; |
29 |
import java.util.Collection; |
|
30 | 29 |
import java.util.Hashtable; |
31 |
import java.util.Iterator; |
|
32 |
import java.util.List; |
|
33 |
import java.util.Set; |
|
34 |
|
|
35 |
import org.cresques.cts.IProjection; |
|
36 |
|
|
37 |
import org.gvsig.fmap.dal.DataQuery; |
|
38 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
39 |
import org.gvsig.fmap.dal.DataSet; |
|
40 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
41 |
import org.gvsig.fmap.dal.exception.DataException; |
|
42 | 30 |
import org.gvsig.fmap.dal.exception.ReadException; |
43 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
44 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
31 |
import org.gvsig.fmap.dal.feature.DummyFetureStore; |
|
45 | 32 |
import org.gvsig.fmap.dal.feature.Feature; |
46 |
import org.gvsig.fmap.dal.feature.FeatureCache; |
|
47 |
import org.gvsig.fmap.dal.feature.FeatureIndex; |
|
48 |
import org.gvsig.fmap.dal.feature.FeatureIndexes; |
|
49 |
import org.gvsig.fmap.dal.feature.FeatureLocks; |
|
50 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
|
51 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
|
52 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
53 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
54 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
55 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms; |
|
56 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
57 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
58 |
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException; |
|
59 | 33 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
60 | 34 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
61 | 35 |
import org.gvsig.fmap.geom.GeometryLocator; |
62 | 36 |
import org.gvsig.fmap.geom.GeometryManager; |
63 | 37 |
import org.gvsig.fmap.geom.primitive.Curve; |
64 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
65 | 38 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
66 | 39 |
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedVectorLegend; |
67 | 40 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
... | ... | |
69 | 42 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractIntervalLegend; |
70 | 43 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.FInterval; |
71 | 44 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.TestISymbol; |
72 |
import org.gvsig.timesupport.Interval; |
|
73 |
import org.gvsig.tools.dynobject.DynClass; |
|
74 |
import org.gvsig.tools.dynobject.DynObject; |
|
75 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
|
76 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
77 |
import org.gvsig.tools.exception.BaseException; |
|
78 | 45 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
79 |
import org.gvsig.tools.observer.Observer; |
|
80 |
import org.gvsig.tools.persistence.PersistentState; |
|
81 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
82 |
import org.gvsig.tools.undo.RedoException; |
|
83 |
import org.gvsig.tools.undo.UndoException; |
|
84 |
import org.gvsig.tools.visitor.Visitor; |
|
85 | 46 |
|
86 | 47 |
|
87 | 48 |
/** |
... | ... | |
126 | 87 |
// private static final Value v9 = (Value)ValueFactory.createValue(9); |
127 | 88 |
|
128 | 89 |
private AbstractIntervalLegend[] intervalLegends; |
129 |
private MockDataSource mockDataSource = new MockDataSource();
|
|
90 |
private DummyFetureStore mockDataSource = new DummyFetureStore();
|
|
130 | 91 |
|
131 |
/** |
|
132 |
* To avoid duplicated validation logic in the test a mock object is created |
|
133 |
* to use a DataSource for this test. |
|
134 |
* |
|
135 |
*/ |
|
136 |
private class MockDataSource implements FeatureStore { |
|
137 |
|
|
138 |
public boolean allowWrite() { |
|
139 |
|
|
140 |
return false; |
|
141 |
} |
|
142 |
|
|
143 |
public void beginEditingGroup(String description) |
|
144 |
throws NeedEditingModeException { |
|
145 |
|
|
146 |
|
|
147 |
} |
|
148 |
|
|
149 |
public boolean canWriteGeometry(int gvSIGgeometryType) |
|
150 |
throws DataException { |
|
151 |
|
|
152 |
return false; |
|
153 |
} |
|
154 |
|
|
155 |
public void cancelEditing() throws DataException { |
|
156 |
|
|
157 |
|
|
158 |
} |
|
159 |
|
|
160 |
public FeatureSelection createFeatureSelection() throws DataException { |
|
161 |
|
|
162 |
return null; |
|
163 |
} |
|
164 |
|
|
165 |
public FeatureIndex createIndex(FeatureType featureType, |
|
166 |
String attributeName, String indexName) throws DataException { |
|
167 |
|
|
168 |
return null; |
|
169 |
} |
|
170 |
|
|
171 |
public EditableFeature createNewFeature() throws DataException { |
|
172 |
|
|
173 |
return null; |
|
174 |
} |
|
175 |
|
|
176 |
public EditableFeature createNewFeature(FeatureType type, |
|
177 |
Feature defaultValues) throws DataException { |
|
178 |
|
|
179 |
return null; |
|
180 |
} |
|
181 |
|
|
182 |
public EditableFeature createNewFeature(FeatureType type, |
|
183 |
boolean defaultValues) throws DataException { |
|
184 |
|
|
185 |
return null; |
|
186 |
} |
|
187 |
|
|
188 |
public EditableFeature createNewFeature(boolean defaultValues) |
|
189 |
throws DataException { |
|
190 |
|
|
191 |
return null; |
|
192 |
} |
|
193 |
|
|
194 |
public void delete(Feature feature) throws DataException { |
|
195 |
|
|
196 |
|
|
197 |
} |
|
198 |
|
|
199 |
public void edit() throws DataException { |
|
200 |
|
|
201 |
|
|
202 |
} |
|
203 |
|
|
204 |
public void edit(int mode) throws DataException { |
|
205 |
|
|
206 |
|
|
207 |
} |
|
208 |
|
|
209 |
public void endEditingGroup() throws NeedEditingModeException { |
|
210 |
|
|
211 |
|
|
212 |
} |
|
213 |
|
|
214 |
public void finishEditing() throws DataException { |
|
215 |
|
|
216 |
|
|
217 |
} |
|
218 |
|
|
219 |
public FeatureType getDefaultFeatureType() throws DataException { |
|
220 |
|
|
221 |
return null; |
|
222 |
} |
|
223 |
|
|
224 |
public Envelope getEnvelope() { |
|
225 |
|
|
226 |
return null; |
|
227 |
} |
|
228 |
|
|
229 |
public Feature getFeatureByReference(FeatureReference reference) |
|
230 |
throws DataException { |
|
231 |
|
|
232 |
return null; |
|
233 |
} |
|
234 |
|
|
235 |
public Feature getFeatureByReference(FeatureReference reference, |
|
236 |
FeatureType featureType) throws DataException { |
|
237 |
|
|
238 |
return null; |
|
239 |
} |
|
240 |
|
|
241 |
public FeatureSelection getFeatureSelection() throws DataException { |
|
242 |
|
|
243 |
return null; |
|
244 |
} |
|
245 |
|
|
246 |
public FeatureSet getFeatureSet() throws DataException { |
|
247 |
|
|
248 |
return null; |
|
249 |
} |
|
250 |
|
|
251 |
public FeatureSet getFeatureSet(FeatureQuery featureQuery) |
|
252 |
throws DataException { |
|
253 |
|
|
254 |
return null; |
|
255 |
} |
|
256 |
|
|
257 |
public void getFeatureSet(FeatureQuery featureQuery, Observer observer) |
|
258 |
throws DataException { |
|
259 |
|
|
260 |
|
|
261 |
} |
|
262 |
|
|
263 |
public void getFeatureSet(Observer observer) throws DataException { |
|
264 |
|
|
265 |
|
|
266 |
} |
|
267 |
|
|
268 |
public List getFeatureTypes() throws DataException { |
|
269 |
|
|
270 |
return null; |
|
271 |
} |
|
272 |
|
|
273 |
public FeatureIndexes getIndexes() { |
|
274 |
|
|
275 |
return null; |
|
276 |
} |
|
277 |
|
|
278 |
public FeatureLocks getLocks() throws DataException { |
|
279 |
|
|
280 |
return null; |
|
281 |
} |
|
282 |
|
|
283 |
public DataStoreParameters getParameters() { |
|
284 |
|
|
285 |
return null; |
|
286 |
} |
|
287 |
|
|
288 |
public IProjection getSRSDefaultGeometry() throws DataException { |
|
289 |
|
|
290 |
return null; |
|
291 |
} |
|
292 |
|
|
293 |
public FeatureStoreTransforms getTransforms() { |
|
294 |
|
|
295 |
return null; |
|
296 |
} |
|
297 |
|
|
298 |
public void insert(EditableFeature feature) throws DataException { |
|
299 |
|
|
300 |
|
|
301 |
} |
|
302 |
|
|
303 |
public boolean isAppendModeSupported() { |
|
304 |
|
|
305 |
return false; |
|
306 |
} |
|
307 |
|
|
308 |
public boolean isAppending() { |
|
309 |
|
|
310 |
return false; |
|
311 |
} |
|
312 |
|
|
313 |
public boolean isEditing() { |
|
314 |
|
|
315 |
return false; |
|
316 |
} |
|
317 |
|
|
318 |
public boolean isLocksSupported() { |
|
319 |
|
|
320 |
return false; |
|
321 |
} |
|
322 |
|
|
323 |
|
|
324 |
public void setSelection(FeatureSet selection) throws DataException { |
|
325 |
|
|
326 |
|
|
327 |
} |
|
328 |
public void update(EditableFeatureType featureType) |
|
329 |
throws DataException { |
|
330 |
|
|
331 |
|
|
332 |
} |
|
333 |
|
|
334 |
public void update(EditableFeature feature) throws DataException { |
|
335 |
|
|
336 |
|
|
337 |
} |
|
338 |
|
|
339 |
public void validateFeatures(int mode) throws DataException { |
|
340 |
|
|
341 |
|
|
342 |
} |
|
343 |
|
|
344 |
public DataSet createSelection() throws DataException { |
|
345 |
|
|
346 |
return null; |
|
347 |
} |
|
348 |
|
|
349 |
public void dispose() { |
|
350 |
|
|
351 |
|
|
352 |
} |
|
353 |
|
|
354 |
public Iterator getChildren() { |
|
355 |
|
|
356 |
return null; |
|
357 |
} |
|
358 |
|
|
359 |
public DataSet getDataSet() throws DataException { |
|
360 |
|
|
361 |
return null; |
|
362 |
} |
|
363 |
|
|
364 |
public DataSet getDataSet(DataQuery dataQuery) throws DataException { |
|
365 |
|
|
366 |
return null; |
|
367 |
} |
|
368 |
|
|
369 |
public void getDataSet(Observer observer) throws DataException { |
|
370 |
|
|
371 |
|
|
372 |
} |
|
373 |
|
|
374 |
public void getDataSet(DataQuery dataQuery, Observer observer) |
|
375 |
throws DataException { |
|
376 |
|
|
377 |
|
|
378 |
} |
|
379 |
|
|
380 |
public DataServerExplorer getExplorer() throws DataException { |
|
381 |
|
|
382 |
return null; |
|
383 |
} |
|
384 |
|
|
385 |
public String getName() { |
|
386 |
|
|
387 |
return null; |
|
388 |
} |
|
389 |
|
|
390 |
public DataSet getSelection() throws DataException { |
|
391 |
|
|
392 |
return null; |
|
393 |
} |
|
394 |
|
|
395 |
public void refresh() throws DataException { |
|
396 |
|
|
397 |
|
|
398 |
} |
|
399 |
|
|
400 |
public void setSelection(DataSet selection) throws DataException { |
|
401 |
|
|
402 |
|
|
403 |
} |
|
404 |
|
|
405 |
public void beginComplexNotification() { |
|
406 |
|
|
407 |
|
|
408 |
} |
|
409 |
|
|
410 |
public void disableNotifications() { |
|
411 |
|
|
412 |
|
|
413 |
} |
|
414 |
|
|
415 |
public void enableNotifications() { |
|
416 |
|
|
417 |
|
|
418 |
} |
|
419 |
|
|
420 |
public void endComplexNotification() { |
|
421 |
|
|
422 |
|
|
423 |
} |
|
424 |
|
|
425 |
public void addObserver(Observer o) { |
|
426 |
|
|
427 |
|
|
428 |
} |
|
429 |
|
|
430 |
public void deleteObserver(Observer o) { |
|
431 |
|
|
432 |
|
|
433 |
} |
|
434 |
|
|
435 |
public void deleteObservers() { |
|
436 |
|
|
437 |
|
|
438 |
} |
|
439 |
|
|
440 |
public void saveToState(PersistentState state) |
|
441 |
throws PersistenceException { |
|
442 |
|
|
443 |
|
|
444 |
} |
|
445 |
|
|
446 |
public void loadFromState(PersistentState state) throws PersistenceException { |
|
447 |
|
|
448 |
|
|
449 |
} |
|
450 |
|
|
451 |
public FeatureQuery createFeatureQuery() { |
|
452 |
|
|
453 |
return null; |
|
454 |
} |
|
455 |
|
|
456 |
public boolean canRedo() { |
|
457 |
|
|
458 |
return false; |
|
459 |
} |
|
460 |
|
|
461 |
public boolean canUndo() { |
|
462 |
|
|
463 |
return false; |
|
464 |
} |
|
465 |
|
|
466 |
public List getRedoInfos() { |
|
467 |
|
|
468 |
return null; |
|
469 |
} |
|
470 |
|
|
471 |
public List getUndoInfos() { |
|
472 |
|
|
473 |
return null; |
|
474 |
} |
|
475 |
|
|
476 |
public void redo() throws RedoException { |
|
477 |
|
|
478 |
|
|
479 |
} |
|
480 |
|
|
481 |
public void redo(int num) throws RedoException { |
|
482 |
|
|
483 |
|
|
484 |
} |
|
485 |
|
|
486 |
public void undo() throws UndoException { |
|
487 |
|
|
488 |
|
|
489 |
} |
|
490 |
|
|
491 |
public void undo(int num) throws UndoException { |
|
492 |
|
|
493 |
|
|
494 |
} |
|
495 |
|
|
496 |
public FeatureIndex createIndex(FeatureType featureType, |
|
497 |
String attributeName, String indexName, Observer observer) |
|
498 |
throws DataException { |
|
499 |
|
|
500 |
return null; |
|
501 |
} |
|
502 |
|
|
503 |
public Object getMetadataID() { |
|
504 |
|
|
505 |
return null; |
|
506 |
} |
|
507 |
|
|
508 |
public void delegate(DynObject dynObject) { |
|
509 |
|
|
510 |
|
|
511 |
} |
|
512 |
|
|
513 |
public DynClass getDynClass() { |
|
514 |
|
|
515 |
return null; |
|
516 |
} |
|
517 |
|
|
518 |
public Object getDynValue(String name) throws DynFieldNotFoundException { |
|
519 |
|
|
520 |
return null; |
|
521 |
} |
|
522 |
|
|
523 |
public boolean hasDynValue(String name) { |
|
524 |
|
|
525 |
return false; |
|
526 |
} |
|
527 |
|
|
528 |
public void implement(DynClass dynClass) { |
|
529 |
|
|
530 |
|
|
531 |
} |
|
532 |
|
|
533 |
public Object invokeDynMethod(String name, DynObject context) |
|
534 |
throws DynMethodException { |
|
535 |
|
|
536 |
return null; |
|
537 |
} |
|
538 |
|
|
539 |
public Object invokeDynMethod(int code, DynObject context) |
|
540 |
throws DynMethodException { |
|
541 |
|
|
542 |
return null; |
|
543 |
} |
|
544 |
|
|
545 |
public void setDynValue(String name, Object value) |
|
546 |
throws DynFieldNotFoundException { |
|
547 |
|
|
548 |
|
|
549 |
} |
|
550 |
|
|
551 |
/* |
|
552 |
* (non-Javadoc) |
|
553 |
* |
|
554 |
* @see org.gvsig.metadata.Metadata#getMetadataChildren() |
|
555 |
*/ |
|
556 |
public Set getMetadataChildren() { |
|
557 |
|
|
558 |
return null; |
|
559 |
} |
|
560 |
|
|
561 |
/* |
|
562 |
* (non-Javadoc) |
|
563 |
* |
|
564 |
* @see org.gvsig.metadata.Metadata#getMetadataName() |
|
565 |
*/ |
|
566 |
public String getMetadataName() { |
|
567 |
|
|
568 |
return null; |
|
569 |
} |
|
570 |
|
|
571 |
public FeatureType getFeatureType(String featureTypeId) |
|
572 |
throws DataException { |
|
573 |
|
|
574 |
return null; |
|
575 |
} |
|
576 |
|
|
577 |
public DataQuery createQuery() { |
|
578 |
|
|
579 |
return null; |
|
580 |
} |
|
581 |
|
|
582 |
public long getFeatureCount() throws DataException { |
|
583 |
|
|
584 |
return 0; |
|
585 |
} |
|
586 |
|
|
587 |
public void accept(Visitor visitor, DataQuery dataQuery) |
|
588 |
throws BaseException { |
|
589 |
} |
|
590 |
|
|
591 |
public void accept(Visitor visitor) throws BaseException { |
|
592 |
} |
|
593 |
|
|
594 |
public void createCache(String name, |
|
595 |
DynObject parameters) throws DataException { |
|
596 |
// Do nothing |
|
597 |
} |
|
598 |
|
|
599 |
public FeatureCache getCache() { |
|
600 |
return null; |
|
601 |
} |
|
602 |
|
|
603 |
public void clear() { |
|
604 |
// Nothing to do |
|
605 |
} |
|
606 |
|
|
607 |
public void export(DataServerExplorer explorer, String provider, |
|
608 |
NewFeatureStoreParameters params) throws DataException { |
|
609 |
// Nothing to do |
|
610 |
} |
|
611 |
|
|
612 |
public String getProviderName() { |
|
613 |
return null; |
|
614 |
} |
|
615 |
|
|
616 |
public String getFullName() { |
|
617 |
// TODO Auto-generated method stub |
|
618 |
return null; |
|
619 |
} |
|
620 |
|
|
621 |
public boolean isKnownEnvelope() { |
|
622 |
// TODO Auto-generated method stub |
|
623 |
return false; |
|
624 |
} |
|
625 |
|
|
626 |
public boolean hasRetrievedFeaturesLimit() { |
|
627 |
// TODO Auto-generated method stub |
|
628 |
return false; |
|
629 |
} |
|
630 |
|
|
631 |
public int getRetrievedFeaturesLimit() { |
|
632 |
// TODO Auto-generated method stub |
|
633 |
return 0; |
|
634 |
} |
|
635 |
|
|
636 |
public FeatureIndex createIndex(String indexTypeName, |
|
637 |
FeatureType featureType, String attributeName, String indexName) |
|
638 |
throws DataException { |
|
639 |
// TODO Auto-generated method stub |
|
640 |
return null; |
|
641 |
} |
|
642 |
|
|
643 |
public FeatureIndex createIndex(String indexTypeName, |
|
644 |
FeatureType featureType, String attributeName, String indexName, |
|
645 |
Observer observer) throws DataException { |
|
646 |
// TODO Auto-generated method stub |
|
647 |
return null; |
|
648 |
} |
|
649 |
|
|
650 |
public Interval getInterval() { |
|
651 |
// TODO Auto-generated method stub |
|
652 |
return null; |
|
653 |
} |
|
654 |
|
|
655 |
public Collection getTimes() { |
|
656 |
// TODO Auto-generated method stub |
|
657 |
return null; |
|
658 |
} |
|
659 |
|
|
660 |
public Collection getTimes(Interval interval) { |
|
661 |
// TODO Auto-generated method stub |
|
662 |
return null; |
|
663 |
} |
|
664 |
|
|
665 |
public Object clone() throws CloneNotSupportedException { |
|
666 |
// TODO Auto-generated method stub |
|
667 |
return super.clone(); |
|
668 |
} |
|
669 |
|
|
670 |
/* (non-Javadoc) |
|
671 |
* @see org.gvsig.fmap.dal.feature.FeatureStore#commitChanges() |
|
672 |
*/ |
|
673 |
public void commitChanges() throws DataException { |
|
674 |
// TODO Auto-generated method stub |
|
675 |
|
|
676 |
} |
|
677 |
|
|
678 |
/* (non-Javadoc) |
|
679 |
* @see org.gvsig.fmap.dal.feature.FeatureStore#canCommitChanges() |
|
680 |
*/ |
|
681 |
public boolean canCommitChanges() throws DataException { |
|
682 |
// TODO Auto-generated method stub |
|
683 |
return false; |
|
684 |
} |
|
685 |
|
|
686 |
public Feature getFeature(DynObject dynobject) { |
|
687 |
// TODO Auto-generated method stub |
|
688 |
return null; |
|
689 |
} |
|
690 |
|
|
691 |
@Override |
|
692 |
public EditableFeature createNewFeature(Feature defaultValues) throws DataException { |
|
693 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
|
694 |
} |
|
695 |
|
|
696 |
@Override |
|
697 |
public Iterator iterator() { |
|
698 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
|
699 |
} |
|
700 |
} |
|
701 |
|
|
702 | 92 |
private static final FInterval interval0=new FInterval(0,2); |
703 | 93 |
private static final FInterval interval1=new FInterval(3,5); |
704 | 94 |
private static final FInterval interval2=new FInterval(6,8); |
Also available in: Unified diff