Revision 37298
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ViewPort.java | ||
---|---|---|
52 | 52 |
import org.cresques.cts.GeoCalc; |
53 | 53 |
import org.cresques.cts.IProjection; |
54 | 54 |
import org.cresques.cts.UTM; |
55 |
import org.slf4j.Logger; |
|
56 |
import org.slf4j.LoggerFactory; |
|
57 |
|
|
55 | 58 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
56 | 59 |
import org.gvsig.fmap.geom.Geometry; |
57 | 60 |
import org.gvsig.fmap.geom.GeometryLocator; |
... | ... | |
64 | 67 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
65 | 68 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
66 | 69 |
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener; |
70 |
import org.gvsig.timesupport.Time; |
|
67 | 71 |
import org.gvsig.tools.ToolsLocator; |
68 | 72 |
import org.gvsig.tools.dynobject.DynStruct; |
69 | 73 |
import org.gvsig.tools.lang.Cloneable; |
... | ... | |
72 | 76 |
import org.gvsig.tools.persistence.PersistentState; |
73 | 77 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
74 | 78 |
import org.gvsig.tools.util.Callable; |
75 |
import org.slf4j.Logger; |
|
76 |
import org.slf4j.LoggerFactory; |
|
77 | 79 |
|
78 | 80 |
/** |
79 | 81 |
* <p> |
... | ... | |
178 | 180 |
* @see #setEnvelope(Envelope) |
179 | 181 |
*/ |
180 | 182 |
protected Rectangle2D extent; |
183 |
|
|
184 |
protected Time time; |
|
181 | 185 |
|
182 | 186 |
/** |
183 | 187 |
* <p> |
... | ... | |
1016 | 1020 |
listener.extentChanged(ev); |
1017 | 1021 |
} |
1018 | 1022 |
} |
1023 |
|
|
1024 |
/** |
|
1025 |
* <p> |
|
1026 |
* Notifies to all view port listeners registered, that the time |
|
1027 |
* of this view port has changed. |
|
1028 |
* </p> |
|
1029 |
* |
|
1030 |
* @param newTime |
|
1031 |
* the new time |
|
1032 |
* |
|
1033 |
* @see #refreshExtent() |
|
1034 |
* @see #setTime(Time) |
|
1035 |
* @see ExtentEvent |
|
1036 |
* @see ViewPortListener |
|
1037 |
*/ |
|
1038 |
protected void callTimeChanged(Time newTime) { |
|
1039 |
ExtentEvent viewPortEvent = new ExtentEvent(newTime); |
|
1019 | 1040 |
|
1041 |
for (int i = 0; i < listeners.size(); i++) { |
|
1042 |
ViewPortListener listener = (ViewPortListener) listeners.get(i); |
|
1043 |
listener.extentChanged(viewPortEvent); |
|
1044 |
} |
|
1045 |
} |
|
1046 |
|
|
1020 | 1047 |
/** |
1021 | 1048 |
* <p> |
1022 | 1049 |
* Notifies to all view port listeners registered, that the background color |
... | ... | |
1882 | 1909 |
this.drawVersion++; |
1883 | 1910 |
} |
1884 | 1911 |
|
1885 |
// /** |
|
1886 |
// * Obtiene la representaci?n de un color como String |
|
1887 |
// * |
|
1888 |
// * @param c |
|
1889 |
// * Color |
|
1890 |
// * |
|
1891 |
// * @return String |
|
1892 |
// */ |
|
1893 |
// public static String color2String(Color c) { |
|
1894 |
// if (c == null) |
|
1895 |
// return null; |
|
1896 |
// return c.getRed() + "," + c.getGreen() + "," + c.getBlue() + "," |
|
1897 |
// + c.getAlpha(); |
|
1898 |
// } |
|
1899 |
// |
|
1900 |
// /** |
|
1901 |
// * Obtiene el color de un string generado con color2String |
|
1902 |
// * |
|
1903 |
// * @param stringColor |
|
1904 |
// * string |
|
1905 |
// * |
|
1906 |
// * @return Color |
|
1907 |
// */ |
|
1908 |
// public static Color string2Color(String stringColor) { |
|
1909 |
// if (stringColor == null || stringColor.equals("null")) |
|
1910 |
// return null; |
|
1911 |
// String[] ints = new String[4]; |
|
1912 |
// |
|
1913 |
// ints = CompatLocator.getStringUtils().split(stringColor, ","); |
|
1914 |
// |
|
1915 |
// int[] ret = new int[4]; |
|
1916 |
// |
|
1917 |
// for (int i = 0; i < ret.length; i++) { |
|
1918 |
// ret[i] = new Integer(ints[i]).intValue(); |
|
1919 |
// } |
|
1920 |
// |
|
1921 |
// return new Color(ret[0], ret[1], ret[2], ret[3]); |
|
1922 |
// } |
|
1923 |
|
|
1912 |
public Time getTime() { |
|
1913 |
return time; |
|
1914 |
} |
|
1915 |
|
|
1916 |
public void setTime(Time time) { |
|
1917 |
this.time = time; |
|
1918 |
this.updateDrawVersion(); |
|
1919 |
callTimeChanged(time); |
|
1920 |
} |
|
1924 | 1921 |
} |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java | ||
---|---|---|
284 | 284 |
featureStore = (FeatureStore) dataStore; |
285 | 285 |
|
286 | 286 |
IVectorLegend legend = |
287 |
(IVectorLegend) MapContextLocator.getMapContextManager().getLegend(dataStore);
|
|
287 |
(IVectorLegend) MapContextLocator.getMapContextManager().getLegend(dataStore);
|
|
288 | 288 |
|
289 | 289 |
if (legend == null) { |
290 | 290 |
throw new LegendLayerException(this.getName()); |
... | ... | |
403 | 403 |
legend.addDrawingObserver(this); |
404 | 404 |
} |
405 | 405 |
|
406 |
FeatureQuery featureQuery = null; |
|
406 | 407 |
try { |
408 |
FeatureAttributeDescriptor featureAttributeDescriptor = |
|
409 |
getFeatureStore().getDefaultFeatureType().getDefaultTimeAttribute(); |
|
410 |
|
|
411 |
if ((viewPort.getTime() != null) && (featureAttributeDescriptor != null)){ |
|
412 |
featureQuery = getFeatureStore().createFeatureQuery(); |
|
413 |
IntersectsTimeEvaluator intersectsTimeEvaluator = |
|
414 |
new IntersectsTimeEvaluator(viewPort.getTime(), featureAttributeDescriptor.getName()); |
|
415 |
featureQuery.addFilter(intersectsTimeEvaluator); |
|
416 |
} |
|
417 |
} catch (DataException e1) { |
|
418 |
logger.error("Impossible to get the temporal filter", e1); |
|
419 |
} |
|
420 |
|
|
421 |
try { |
|
407 | 422 |
legend.draw(image, |
408 | 423 |
g, |
409 | 424 |
viewPort, |
... | ... | |
1327 | 1342 |
featureQuery.setFeatureTypeId(featureType.getId()); |
1328 | 1343 |
} |
1329 | 1344 |
String geomName = |
1330 |
featureStore.getDefaultFeatureType()
|
|
1345 |
featureStore.getDefaultFeatureType() |
|
1331 | 1346 |
.getDefaultGeometryAttributeName(); |
1332 | 1347 |
IntersectsGeometryEvaluator iee = |
1333 | 1348 |
new IntersectsGeometryEvaluator(envelope.getGeometry(), |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsTimeEvaluator.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.fmap.mapcontext.layers.vectorial; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.feature.Feature; |
|
25 |
import org.gvsig.timesupport.Time; |
|
26 |
import org.gvsig.tools.evaluator.AbstractEvaluator; |
|
27 |
import org.gvsig.tools.evaluator.EvaluatorData; |
|
28 |
import org.gvsig.tools.evaluator.EvaluatorException; |
|
29 |
|
|
30 |
|
|
31 |
/** |
|
32 |
* @author gvSIG Team |
|
33 |
* @version $Id$ |
|
34 |
* |
|
35 |
*/ |
|
36 |
public class IntersectsTimeEvaluator extends AbstractEvaluator { |
|
37 |
private Time time; |
|
38 |
private String timeAttributeName; |
|
39 |
|
|
40 |
public IntersectsTimeEvaluator(Time time, String timeAttributeName) { |
|
41 |
super(); |
|
42 |
this.time = time; |
|
43 |
this.timeAttributeName = timeAttributeName; |
|
44 |
this.getFieldsInfo().addMatchFieldValue(timeAttributeName, time); |
|
45 |
} |
|
46 |
|
|
47 |
public Object evaluate(EvaluatorData data) throws EvaluatorException { |
|
48 |
Feature feature = ((Feature) data.getContextValue("feature")); |
|
49 |
return new Boolean(time.intersects((Time)feature.get(timeAttributeName))); |
|
50 |
} |
|
51 |
|
|
52 |
public String getName() { |
|
53 |
return "intersets with time"; |
|
54 |
} |
|
55 |
|
|
56 |
public String getSQL() { |
|
57 |
// TODO add the time filter!!! |
|
58 |
return super.getSQL(); |
|
59 |
} |
|
60 |
} |
|
0 | 61 |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManager.java | ||
---|---|---|
275 | 275 |
return null; |
276 | 276 |
} |
277 | 277 |
|
278 |
public IVectorLegend createDefaultVectorLegend(int shapeType)
|
|
279 |
throws MapContextRuntimeException {
|
|
280 |
try {
|
|
278 |
public IVectorLegend createDefaultVectorLegend(int shapeType)
|
|
279 |
throws MapContextRuntimeException {
|
|
280 |
try {
|
|
281 | 281 |
// Create legend |
282 | 282 |
IVectorLegend legend = |
283 | 283 |
(IVectorLegend) createLegend(getDefaultVectorLegend()); |
... | ... | |
285 | 285 |
return null; |
286 | 286 |
} |
287 | 287 |
// Set legend values |
288 |
legend.setShapeType(shapeType);
|
|
288 |
legend.setShapeType(shapeType);
|
|
289 | 289 |
legend.setDefaultSymbol(getSymbolManager().createSymbol(shapeType)); |
290 |
return legend;
|
|
291 |
} catch(Exception e) {
|
|
292 |
throw new MapContextRuntimeException(e);
|
|
293 |
}
|
|
294 |
}
|
|
290 |
return legend;
|
|
291 |
} catch(Exception e) {
|
|
292 |
throw new MapContextRuntimeException(e);
|
|
293 |
}
|
|
294 |
}
|
|
295 | 295 |
|
296 | 296 |
public void registerLegendReader(String format, Class readerClass) |
297 | 297 |
throws MapContextRuntimeException { |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ExtentEvent.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
|
44 | 44 |
import org.gvsig.fmap.geom.primitive.Envelope; |
45 |
import org.gvsig.timesupport.Time; |
|
45 | 46 |
|
46 | 47 |
|
47 | 48 |
|
48 | 49 |
/** |
49 |
* <p>Event produced when the adjusted extent of the view port has changed.</p> |
|
50 |
* <p>Event produced when the adjusted extent or the time |
|
51 |
* of the view port have changed.</p> |
|
52 |
* <p> |
|
53 |
* TODO: This class has to be renamed to ViewPortEvent. |
|
54 |
* </p> |
|
50 | 55 |
* |
51 | 56 |
* @author Vicente Caballero Navarro |
52 | 57 |
*/ |
... | ... | |
55 | 60 |
* <p>Reference to the new adjusted extent.</p> |
56 | 61 |
*/ |
57 | 62 |
private Envelope newExtent; |
63 |
|
|
64 |
/** |
|
65 |
* <p>Reference to the new time.</p> |
|
66 |
*/ |
|
67 |
private Time newTime; |
|
58 | 68 |
|
59 | 69 |
/** |
60 | 70 |
* <p>Identifier of this kind of event.</p> |
61 | 71 |
*/ |
62 | 72 |
private static final int EXTENT_EVENT = 0; |
73 |
private static final int TIME_EVENT = 1; |
|
63 | 74 |
|
64 | 75 |
/** |
65 | 76 |
* <p>Returns a new extent event.</p> |
... | ... | |
67 | 78 |
* @param c the new adjusted extent |
68 | 79 |
* |
69 | 80 |
* @return a new extent event |
81 |
* @deprecated |
|
82 |
* use the constructor |
|
70 | 83 |
*/ |
71 | 84 |
public static ExtentEvent createExtentEvent(Envelope r){ |
72 | 85 |
return new ExtentEvent(r, EXTENT_EVENT); |
... | ... | |
82 | 95 |
setEventType(eventType); |
83 | 96 |
newExtent = r; |
84 | 97 |
} |
98 |
|
|
99 |
/** |
|
100 |
* <p>Creates a new extent event.</p> |
|
101 |
* |
|
102 |
* @param c the new adjusted extent |
|
103 |
*/ |
|
104 |
public ExtentEvent(Envelope envelope) { |
|
105 |
this(envelope, EXTENT_EVENT); |
|
106 |
} |
|
107 |
|
|
108 |
/** |
|
109 |
* <p>Creates a new time event.</p> |
|
110 |
* @param time |
|
111 |
* the new time |
|
112 |
*/ |
|
113 |
public ExtentEvent(Time time) { |
|
114 |
setEventType(TIME_EVENT); |
|
115 |
newTime = time; |
|
116 |
} |
|
85 | 117 |
|
86 | 118 |
/** |
87 | 119 |
* <p>Gets the new adjusted event.</p> |
... | ... | |
91 | 123 |
public Envelope getNewExtent() { |
92 | 124 |
return newExtent; |
93 | 125 |
} |
126 |
|
|
127 |
/** |
|
128 |
* <p>Gets the new time event.</p> |
|
129 |
* |
|
130 |
* @return the new time extent |
|
131 |
*/ |
|
132 |
public Time getNewTime() { |
|
133 |
return newTime; |
|
134 |
} |
|
94 | 135 |
} |
95 | 136 |
|
96 | 137 |
|
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.mapcontext.persistence; |
2 | 2 |
|
3 |
import java.util.Collection; |
|
3 | 4 |
import java.util.Iterator; |
4 | 5 |
import java.util.List; |
5 | 6 |
import java.util.Set; |
... | ... | |
28 | 29 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
29 | 30 |
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException; |
30 | 31 |
import org.gvsig.fmap.geom.primitive.Envelope; |
32 |
import org.gvsig.timesupport.Interval; |
|
31 | 33 |
import org.gvsig.tools.ToolsLocator; |
32 | 34 |
import org.gvsig.tools.dynobject.DynClass; |
33 | 35 |
import org.gvsig.tools.dynobject.DynObject; |
... | ... | |
560 | 562 |
return 0; |
561 | 563 |
} |
562 | 564 |
|
565 |
public Interval getInterval() { |
|
566 |
// TODO Auto-generated method stub |
|
567 |
return null; |
|
568 |
} |
|
569 |
|
|
570 |
public Collection getTimes() { |
|
571 |
// TODO Auto-generated method stub |
|
572 |
return null; |
|
573 |
} |
|
574 |
|
|
575 |
public Collection getTimes(Interval interval) { |
|
576 |
// TODO Auto-generated method stub |
|
577 |
return null; |
|
578 |
} |
|
579 |
|
|
563 | 580 |
public FeatureIndex createIndex(String indexTypeName, |
564 | 581 |
FeatureType featureType, String attributeName, String indexName) |
565 | 582 |
throws DataException { |
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.mapcontext.persistence; |
2 | 2 |
|
3 | 3 |
import java.text.DateFormat; |
4 |
import java.util.Collection; |
|
4 | 5 |
import java.util.Iterator; |
5 | 6 |
import java.util.List; |
6 | 7 |
import java.util.Set; |
... | ... | |
17 | 18 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
18 | 19 |
import org.gvsig.fmap.dal.feature.Feature; |
19 | 20 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
21 |
import org.gvsig.fmap.dal.feature.FeatureAttributeGetter; |
|
20 | 22 |
import org.gvsig.fmap.dal.feature.FeatureCache; |
21 | 23 |
import org.gvsig.fmap.dal.feature.FeatureIndex; |
22 | 24 |
import org.gvsig.fmap.dal.feature.FeatureIndexes; |
... | ... | |
33 | 35 |
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException; |
34 | 36 |
import org.gvsig.fmap.geom.Geometry; |
35 | 37 |
import org.gvsig.fmap.geom.primitive.Envelope; |
38 |
import org.gvsig.timesupport.Interval; |
|
36 | 39 |
import org.gvsig.tools.ToolsLocator; |
37 | 40 |
import org.gvsig.tools.dataTypes.CoercionException; |
38 | 41 |
import org.gvsig.tools.dataTypes.DataType; |
... | ... | |
365 | 368 |
return 0; |
366 | 369 |
} |
367 | 370 |
|
371 |
public boolean isTime() { |
|
372 |
// TODO Auto-generated method stub |
|
373 |
return false; |
|
374 |
} |
|
375 |
|
|
376 |
public FeatureAttributeGetter getFeatureAttributeGetter() { |
|
377 |
// TODO Auto-generated method stub |
|
378 |
return null; |
|
379 |
} |
|
380 |
|
|
381 |
public void setFeatureAttributeGetter( |
|
382 |
FeatureAttributeGetter featureAttributeGetter) { |
|
383 |
// TODO Auto-generated method stub |
|
384 |
|
|
385 |
} |
|
386 |
|
|
368 | 387 |
} |
369 | 388 |
|
370 | 389 |
public static class DummyFeatureType implements FeatureType { |
... | ... | |
747 | 766 |
|
748 | 767 |
} |
749 | 768 |
|
769 |
public FeatureAttributeDescriptor getDefaultTimeAttribute() { |
|
770 |
// TODO Auto-generated method stub |
|
771 |
return null; |
|
772 |
} |
|
773 |
|
|
750 | 774 |
} |
751 | 775 |
|
752 | 776 |
private String name = "[empty]"; |
... | ... | |
1265 | 1289 |
return 0; |
1266 | 1290 |
} |
1267 | 1291 |
|
1292 |
public Interval getInterval() { |
|
1293 |
// TODO Auto-generated method stub |
|
1294 |
return null; |
|
1295 |
} |
|
1296 |
|
|
1297 |
public Collection getTimes() { |
|
1298 |
// TODO Auto-generated method stub |
|
1299 |
return null; |
|
1300 |
} |
|
1301 |
|
|
1302 |
public Collection getTimes(Interval interval) { |
|
1303 |
// TODO Auto-generated method stub |
|
1304 |
return null; |
|
1305 |
} |
|
1306 |
|
|
1268 | 1307 |
public FeatureIndex createIndex(String indexTypeName, |
1269 | 1308 |
FeatureType featureType, String attributeName, String indexName) |
1270 | 1309 |
throws DataException { |
Also available in: Unified diff