Revision 3412
trunk/extensions/extWFS/src/com/iver/cit/gvsig/fmap/drivers/wfs/WFSFeatureIterator.java | ||
---|---|---|
110 | 110 |
Object[] attr=null; |
111 | 111 |
attr=feature.getAttributes(attr); |
112 | 112 |
Value[] values=getValues(attr); |
113 |
|
|
113 | 114 |
|
114 | 115 |
IGeometry g=ShapeFactory.createGeometry(FConverter.jts_to_java2d(feature.getDefaultGeometry())); |
115 | 116 |
return new com.iver.cit.gvsig.fmap.core.DefaultFeature(g,values,feature.getID()); |
trunk/extensions/extWFS/src/com/iver/cit/gvsig/fmap/drivers/wfs/WFSDriver.java | ||
---|---|---|
50 | 50 |
import java.util.Hashtable; |
51 | 51 |
import java.util.Map; |
52 | 52 |
|
53 |
import org.cresques.cts.IProjection; |
|
54 |
import org.cresques.cts.ProjectionPool; |
|
53 | 55 |
import org.geotools.data.DataStore; |
54 | 56 |
import org.geotools.data.DefaultQuery; |
55 | 57 |
import org.geotools.data.FeatureReader; |
56 |
import org.geotools.data.Query; |
|
57 | 58 |
import org.geotools.data.Transaction; |
58 | 59 |
import org.geotools.data.wfs.WFSDataStoreFactory; |
59 | 60 |
import org.geotools.feature.AttributeType; |
61 |
import org.geotools.feature.FeatureType; |
|
60 | 62 |
import org.geotools.filter.FidFilter; |
61 | 63 |
import org.geotools.filter.Filter; |
62 | 64 |
import org.geotools.filter.FilterFactory; |
... | ... | |
103 | 105 |
private int numReg = -1; |
104 | 106 |
private int numField = -1; |
105 | 107 |
private AttributeType[] attributes; |
108 |
|
|
109 |
private String strOriginalSRID; |
|
106 | 110 |
|
107 | 111 |
//private FeatureReader fr; |
108 | 112 |
///private ArrayList typeNames=new ArrayList(); |
... | ... | |
202 | 206 |
e2.printStackTrace(); |
203 | 207 |
} |
204 | 208 |
*/ |
205 |
Query query = new DefaultQuery(layersS[0]); |
|
206 |
FeatureReader fr = null; |
|
207 |
|
|
209 |
DefaultQuery query = new DefaultQuery(layersS[0]);
|
|
210 |
|
|
211 |
FeatureReader fr = null; |
|
208 | 212 |
|
209 |
fr = ds.getFeatureReader(query, Transaction.AUTO_COMMIT); |
|
213 |
fr = ds.getFeatureReader(query, Transaction.AUTO_COMMIT); |
|
214 |
|
|
210 | 215 |
|
211 |
if (numField == -1) { |
|
212 |
numField = fr.getFeatureType().getAttributeCount(); |
|
213 |
attributes = fr.getFeatureType().getAttributeTypes(); |
|
214 |
} |
|
216 |
if (numField == -1) { |
|
217 |
numField = fr.getFeatureType().getAttributeCount(); |
|
218 |
attributes = fr.getFeatureType().getAttributeTypes(); |
|
219 |
} |
|
220 |
int SRID = fr.getFeatureType().getDefaultGeometry().getGeometryFactory().getSRID(); |
|
221 |
String auxStrEPSG = "EPSG:" + SRID; |
|
222 |
IProjection prj = ProjectionPool.get(auxStrEPSG); |
|
215 | 223 |
|
216 | 224 |
geomIterator = new WFSFeatureIterator(fr); |
217 | 225 |
return geomIterator; |
... | ... | |
304 | 312 |
|
305 | 313 |
try { |
306 | 314 |
ds = (new WFSDataStoreFactory()).createNewDataStore(m); |
315 |
|
|
316 |
FeatureType ft = ds.getSchema(layersS[0]); |
|
317 |
|
|
318 |
int SRID = ft.getDefaultGeometry().getGeometryFactory().getSRID(); |
|
319 |
// String auxStrEPSG = "EPSG:" + SRID; |
|
320 |
// IProjection prj = ProjectionPool.get(auxStrEPSG); |
|
321 |
strOriginalSRID = "" + SRID; |
|
322 |
|
|
323 |
|
|
307 | 324 |
} catch (IOException e) { |
308 | 325 |
e.printStackTrace(); |
309 | 326 |
} |
... | ... | |
547 | 564 |
// TODO Auto-generated method stub |
548 | 565 |
|
549 | 566 |
} |
567 |
|
|
568 |
/** |
|
569 |
* @return return SRID string. |
|
570 |
*/ |
|
571 |
public String getProjection() |
|
572 |
{ |
|
573 |
return strOriginalSRID; |
|
574 |
} |
|
550 | 575 |
} |
trunk/extensions/extWFS/src/com/iver/cit/gvsig/fmap/layers/FLyrWFS.java | ||
---|---|---|
131 | 131 |
|
132 | 132 |
//layer.setName(name); |
133 | 133 |
VectorialAdapter adapter = new WFSAdapter(); |
134 |
WFSDriver driver = new WFSDriver();
|
|
134 |
wfsDriver = new WFSDriver();
|
|
135 | 135 |
|
136 | 136 |
try { |
137 |
driver.setData(url, user, pwd, layers, protocol, numfeatures,
|
|
137 |
wfsDriver.setData(url, user, pwd, layers, protocol, numfeatures,
|
|
138 | 138 |
timeout, 2); |
139 | 139 |
} catch (IOException e) { |
140 | 140 |
JOptionPane.showMessageDialog((Component) PluginServices.getMainFrame(), |
... | ... | |
142 | 142 |
throw new Exception(e); |
143 | 143 |
} |
144 | 144 |
|
145 |
adapter.setDriver(driver);
|
|
145 |
adapter.setDriver(wfsDriver);
|
|
146 | 146 |
|
147 | 147 |
//WithDefaultLegend aux=(WithDefaultLegend)driver; |
148 | 148 |
setName(layerName); |
149 | 149 |
setSource(adapter); |
150 |
setProjection(proj); |
|
150 |
IProjection prj = ProjectionPool.get("EPSG:" + wfsDriver.getProjection()); |
|
151 |
setProjection(prj); // En el cuadro de dialogo de AddLayer se hace |
|
152 |
// un chequeo de esto y se aplica una transformaci?n de coordenadas si es necesario. |
|
151 | 153 |
|
152 | 154 |
try { |
153 | 155 |
setLegend(LegendFactory.createSingleSymbolLegend( |
Also available in: Unified diff