Revision 19440
trunk/libraries/libDataSource/src/org/gvsig/data/IDataStore.java | ||
---|---|---|
5 | 5 |
import java.util.List; |
6 | 6 |
|
7 | 7 |
import org.gvsig.data.commands.ICommandsRecord; |
8 |
import org.gvsig.metadata.IMetadatable; |
|
8 | 9 |
|
9 |
public interface IDataStore extends IObservable{ |
|
10 |
public interface IDataStore extends IObservable, IMetadatable{
|
|
10 | 11 |
|
11 | 12 |
public String getName(); |
12 | 13 |
|
... | ... | |
55 | 56 |
public void redo(); |
56 | 57 |
public ICommandsRecord getCommandsRecord(); |
57 | 58 |
|
58 |
|
|
59 |
|
|
60 |
|
|
61 | 59 |
public void beginComplexNotification(); |
62 | 60 |
public void endComplexNotification(); |
63 | 61 |
|
... | ... | |
66 | 64 |
public IDataCollection getLocked(); |
67 | 65 |
public void setLocked(IDataCollection locked); |
68 | 66 |
public IDataCollection createLocked(); |
69 |
|
|
70 |
public Rectangle2D getFullExtent2D(); |
|
71 |
|
|
72 |
public Object getFullExtent(); |
|
73 |
|
|
74 |
List getAllSRS(); |
|
75 |
String getDefaultSRS(); |
|
76 | 67 |
} |
77 | 68 |
|
trunk/libraries/libDataSource/src/org/gvsig/data/spatialprovisional/IExtent.java | ||
---|---|---|
1 |
package org.gvsig.data.spatialprovisional; |
|
2 |
|
|
3 |
|
|
4 |
public interface IExtent { |
|
5 |
void add(IExtent extent); |
|
6 |
boolean contains(Object geometry); |
|
7 |
} |
trunk/libraries/libDataSource/src/org/gvsig/data/spatialprovisional/Extent.java | ||
---|---|---|
1 |
package org.gvsig.data.spatialprovisional; |
|
2 |
|
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 |
|
|
5 |
public class Extent implements IExtent{ |
|
6 |
|
|
7 |
private double x1=0; |
|
8 |
private double y1=0; |
|
9 |
private double x2=0; |
|
10 |
private double y2=0; |
|
11 |
private double x3=0; |
|
12 |
private double y3=0; |
|
13 |
|
|
14 |
public Extent(double x1,double y1,double x2,double y2){ |
|
15 |
this.x1=x1; |
|
16 |
this.y1=y1; |
|
17 |
this.x2=x2; |
|
18 |
this.y2=y2; |
|
19 |
} |
|
20 |
public Extent(double x1,double y1,double x2,double y2,double x3,double y3){ |
|
21 |
this.x1=x1; |
|
22 |
this.y1=y1; |
|
23 |
this.x2=x2; |
|
24 |
this.y2=y2; |
|
25 |
this.x3=x3; |
|
26 |
this.y3=y3; |
|
27 |
} |
|
28 |
public Extent(Rectangle2D bounds2D) { |
|
29 |
this.x1=bounds2D.getX(); |
|
30 |
this.y1=bounds2D.getY(); |
|
31 |
this.x2=bounds2D.getMaxX(); |
|
32 |
this.y2=bounds2D.getMaxY(); |
|
33 |
} |
|
34 |
public void add(IExtent extent) { |
|
35 |
Extent auxExtent=(Extent)extent; |
|
36 |
this.x1 = Math.min(this.x1, auxExtent.x1); |
|
37 |
this.x2 = Math.max(this.x2, auxExtent.x2); |
|
38 |
this.x3 = Math.max(this.x3, auxExtent.x3); |
|
39 |
this.y1 = Math.min(this.y1, auxExtent.y1); |
|
40 |
this.y2 = Math.max(this.y2, auxExtent.y2); |
|
41 |
this.y3 = Math.max(this.y3, auxExtent.y3); |
|
42 |
} |
|
43 |
|
|
44 |
public boolean contains(Object geometry) { |
|
45 |
// Extent bounds=new Extent(geometry.getBounds2D()); |
|
46 |
// if (bounds.x1 == bounds.x2 || bounds.y1 == bounds.y2) { |
|
47 |
// return false; |
|
48 |
// } |
|
49 |
// double x0 = x1; |
|
50 |
// double y0 = y1; |
|
51 |
// return (bounds.x1 >= x0 && |
|
52 |
// bounds.y1 >= y0 && |
|
53 |
// (bounds.x2) <= x2 && |
|
54 |
// (bounds.y2) <= y2); |
|
55 |
return false; |
|
56 |
} |
|
57 |
|
|
58 |
} |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/IFeature.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.vectorial; |
2 | 2 |
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 | 3 |
import java.util.Date; |
5 | 4 |
import java.util.List; |
6 | 5 |
import java.util.Map; |
7 | 6 |
|
7 |
import org.gvsig.data.spatialprovisional.IExtent; |
|
8 | 8 |
|
9 |
|
|
9 | 10 |
public interface IFeature extends Map { |
10 | 11 |
|
11 | 12 |
public IFeatureID getID(); |
... | ... | |
52 | 53 |
* |
53 | 54 |
* @return Rectangle2D |
54 | 55 |
*/ |
55 |
public Rectangle2D getBoundingBox2D();
|
|
56 |
public IExtent getExtent();
|
|
56 | 57 |
|
57 |
/** |
|
58 |
* |
|
59 |
* @return |
|
60 |
*/ |
|
61 |
public Object getBoundingBox(); |
|
62 | 58 |
|
63 | 59 |
// FIXME: Fechas, horas ¿que mas? |
64 | 60 |
|
... | ... | |
73 | 69 |
|
74 | 70 |
public List getAllSRS(); |
75 | 71 |
public String getDefaultSRS(); |
76 |
public int[] getGeometryTypes(); |
|
77 | 72 |
public IFeature getFeature(String name); |
78 | 73 |
|
79 | 74 |
public Object getGeometry(int index); |
trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/MemoryFeature.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.vectorial; |
2 | 2 |
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 | 3 |
import java.text.ParseException; |
5 | 4 |
import java.util.Iterator; |
6 | 5 |
import java.util.List; |
7 | 6 |
|
7 |
import org.gvsig.data.spatialprovisional.IExtent; |
|
8 |
|
|
8 | 9 |
public class MemoryFeature extends Feature implements IFeature { |
9 | 10 |
public MemoryFeature(IFeatureType type,boolean defaultValues) { |
10 | 11 |
super(type); |
... | ... | |
48 | 49 |
return new MemoryFeatureID(this); |
49 | 50 |
} |
50 | 51 |
|
51 |
public Rectangle2D getBoundingBox2D() { |
|
52 |
// TODO Auto-generated method stub |
|
52 |
public IExtent getExtent() { |
|
53 |
String geomColumn=featureType.getDefaultGeometry(); |
|
54 |
Object geometry=getGeometry(geomColumn); |
|
55 |
// return geometry.getExtent(); |
|
53 | 56 |
return null; |
54 | 57 |
} |
55 | 58 |
|
56 |
public Object getBoundingBox() { |
|
57 |
// TODO Auto-generated method stub |
|
58 |
return null; |
|
59 |
} |
|
60 |
|
|
61 | 59 |
public List getAllSRS() { |
62 | 60 |
// TODO Auto-generated method stub |
63 | 61 |
return null; |
... | ... | |
67 | 65 |
// TODO Auto-generated method stub |
68 | 66 |
return null; |
69 | 67 |
} |
70 |
|
|
71 |
public int[] getGeometryTypes() { |
|
72 |
// TODO Auto-generated method stub |
|
73 |
return null; |
|
74 |
} |
|
75 |
|
|
76 | 68 |
} |
trunk/libraries/libDataSource/src/org/gvsig/data/datastores/vectorial/driver/IDriver.java | ||
---|---|---|
1 | 1 |
package org.gvsig.data.datastores.vectorial.driver; |
2 | 2 |
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 | 3 |
import org.gvsig.data.vectorial.IFeature; |
7 | 4 |
import org.gvsig.data.vectorial.IFeatureCollection; |
8 | 5 |
import org.gvsig.data.vectorial.IFeatureID; |
9 | 6 |
import org.gvsig.data.vectorial.IFeatureType; |
10 | 7 |
import org.gvsig.data.vectorial.expansionadapter.FeatureManager; |
8 |
import org.gvsig.metadata.IMetadata; |
|
9 |
import org.gvsig.metadata.IMetadatable; |
|
11 | 10 |
; |
12 | 11 |
|
13 |
public interface IDriver { |
|
12 |
public interface IDriver extends IMetadatable {
|
|
14 | 13 |
|
15 | 14 |
public String getName(); |
16 | 15 |
|
... | ... | |
30 | 29 |
public IFeaturesReader getFeatutesReader(); |
31 | 30 |
public IFeaturesWriter getFeaturesWriter(); |
32 | 31 |
|
33 |
public Rectangle2D getFullExtent(); |
|
34 |
|
|
35 | 32 |
public boolean isEditable(); |
36 | 33 |
|
37 | 34 |
public boolean canAlterFeatureType(); |
38 | 35 |
|
39 | 36 |
public IDriverParameters getParameters(); |
40 | 37 |
|
41 |
public List getAllSRS(); |
|
42 |
|
|
43 | 38 |
public long getFeatureCount(); |
44 | 39 |
|
40 |
public IMetadata getMetadata(); |
|
41 |
|
|
45 | 42 |
} |
trunk/libraries/libDataSource/src/org/gvsig/data/datastores/vectorial/driver/DriverStore.java | ||
---|---|---|
9 | 9 |
import org.gvsig.data.IDataCollection; |
10 | 10 |
import org.gvsig.data.IDataStoreParameters; |
11 | 11 |
import org.gvsig.data.commands.implementation.AbstractFeatureCommand; |
12 |
import org.gvsig.data.spatialprovisional.IExtent; |
|
12 | 13 |
import org.gvsig.data.vectorial.AbstractFeatureStore; |
13 | 14 |
import org.gvsig.data.vectorial.FeatureStoreNotification; |
14 | 15 |
import org.gvsig.data.vectorial.IFeature; |
15 | 16 |
import org.gvsig.data.vectorial.IFeatureCollection; |
16 | 17 |
import org.gvsig.data.vectorial.IFeatureID; |
17 | 18 |
import org.gvsig.data.vectorial.IFeatureType; |
19 |
import org.gvsig.metadata.IMetadata; |
|
20 |
import org.gvsig.metadata.IMetadataManager; |
|
21 |
import org.gvsig.metadata.Metadata; |
|
22 |
import org.gvsig.metadata.MetadataManager; |
|
18 | 23 |
|
19 | 24 |
/** |
20 | 25 |
* |
... | ... | |
32 | 37 |
|
33 | 38 |
private Rectangle2D fullExtent; |
34 | 39 |
|
35 |
public void init(IDataStoreParameters parameters) {
|
|
40 |
public void init(IDataStoreParameters parameters) {
|
|
36 | 41 |
super.init(parameters); |
37 | 42 |
IDriverStoreParameters driverStoreParameters=(IDriverStoreParameters)parameters; |
38 | 43 |
DataSourceManager dsm = DataSourceManager.getManager(); |
... | ... | |
164 | 169 |
return driver.isEditable(); |
165 | 170 |
} |
166 | 171 |
|
167 |
public Object getFullExtent() { |
|
168 |
//TODO este m?todo est? para poder calcular un extent en m?s de 2 dimensiones si hace falta. |
|
169 |
return getFullExtent2D(); |
|
170 |
} |
|
171 |
|
|
172 |
public Rectangle2D getFullExtent2D() { |
|
173 |
IFeatureCollection featureCollection=(IFeatureCollection)getDataCollection(); |
|
174 |
if (spatialManager.isFullExtentDirty()){ |
|
175 |
if (!featureCollection.isEmpty()){ |
|
176 |
Iterator featureIterator=featureCollection.iterator(); |
|
177 |
fullExtent = ((IFeature)featureIterator.next()).getBoundingBox2D(); |
|
178 |
while(featureIterator.hasNext()){ |
|
179 |
IFeature feature=(IFeature)featureIterator.next(); |
|
180 |
Rectangle2D bound=feature.getBoundingBox2D(); |
|
181 |
if (bound!=null) |
|
182 |
fullExtent.add(bound); |
|
183 |
} |
|
184 |
} else { |
|
185 |
fullExtent = driver.getFullExtent(); |
|
186 |
} |
|
187 |
} |
|
188 |
return fullExtent; |
|
189 |
} |
|
190 |
|
|
191 |
public List getAllSRS() { |
|
192 |
return driver.getAllSRS(); |
|
193 |
} |
|
194 |
|
|
195 |
public String getDefaultSRS() { |
|
196 |
List listProjections=driver.getAllSRS(); |
|
197 |
if (!listProjections.isEmpty()) |
|
198 |
return (String)listProjections.get(0); |
|
199 |
return null; |
|
200 |
} |
|
201 |
|
|
202 |
public boolean isWithDefaultLegend() { |
|
172 |
public boolean isWithDefaultLegend() { |
|
203 | 173 |
return (driver instanceof IDefaultLegend); |
204 | 174 |
} |
205 | 175 |
|
... | ... | |
218 | 188 |
public boolean canAlterFeatureType() { |
219 | 189 |
return driver.canAlterFeatureType(); |
220 | 190 |
} |
191 |
|
|
192 |
public IMetadata getMetadata() { |
|
193 |
IMetadata metadata=driver.getMetadata(); |
|
194 |
if (this.alterMode){ |
|
195 |
IExtent extent=(IExtent)metadata.get("extent"); |
|
196 |
IFeatureCollection featureCollection=(IFeatureCollection)getDataCollection(); |
|
197 |
if (spatialManager.isFullExtentDirty()){ |
|
198 |
if (!featureCollection.isEmpty()){ |
|
199 |
Iterator featureIterator=featureCollection.iterator(); |
|
200 |
extent = ((IFeature)featureIterator.next()).getExtent(); |
|
201 |
while(featureIterator.hasNext()){ |
|
202 |
IFeature feature=(IFeature)featureIterator.next(); |
|
203 |
IExtent boundExtent=feature.getExtent(); |
|
204 |
if (boundExtent!=null) |
|
205 |
extent.add(boundExtent); |
|
206 |
} |
|
207 |
} |
|
208 |
} |
|
209 |
metadata.set("extent",extent); |
|
210 |
} |
|
211 |
return metadata; |
|
212 |
} |
|
221 | 213 |
} |
222 | 214 |
|
trunk/libraries/libDataSource/src/org/gvsig/data/datastores/gml/GMLDataStore.java | ||
---|---|---|
8 | 8 |
import org.gvsig.data.vectorial.IFeature; |
9 | 9 |
import org.gvsig.data.vectorial.IFeatureID; |
10 | 10 |
import org.gvsig.data.vectorial.IFeatureType; |
11 |
import org.gvsig.metadata.IMetadata; |
|
11 | 12 |
|
12 | 13 |
public class GMLDataStore extends AbstractFeatureStore { |
13 | 14 |
public static String DATASTORE_NAME = "GMLDataStore"; |
... | ... | |
103 | 104 |
// TODO Auto-generated method stub |
104 | 105 |
return false; |
105 | 106 |
} |
107 |
|
|
108 |
public IMetadata getMetadata() { |
|
109 |
// TODO Auto-generated method stub |
|
110 |
return null; |
|
111 |
} |
|
106 | 112 |
} |
Also available in: Unified diff