Revision 103 org.gvsig.gazetteer/trunk/org.gvsig.gazetteer/org.gvsig.gazetteer.lib/src/main/java/org/gvsig/gazetteer/wfs/drivers/WFSGPEContentHandler.java
WFSGPEContentHandler.java | ||
---|---|---|
3 | 3 |
import java.awt.geom.Point2D; |
4 | 4 |
import java.util.ArrayList; |
5 | 5 |
|
6 |
import org.gvsig.fmap.geom.primitive.Point; |
|
6 | 7 |
import org.gvsig.gazetteer.querys.Feature; |
7 | 8 |
import org.gvsig.gpe.lib.impl.parser.GPEContentHandler; |
8 | 9 |
|
... | ... | |
58 | 59 |
* @author Jorge Piera Llodr? (jorge.piera@iver.es) |
59 | 60 |
*/ |
60 | 61 |
public class WFSGPEContentHandler extends GPEContentHandler{ |
61 |
private ArrayList features = null;
|
|
62 |
private ArrayList features = null; |
|
62 | 63 |
private String searchField = null; |
63 | 64 |
|
64 | 65 |
public WFSGPEContentHandler(String searchField) { |
... | ... | |
83 | 84 |
* @see org.gvsig.gpe.GPEContentHandler#addGeometryToFeature(java.lang.Object, java.lang.Object) |
84 | 85 |
*/ |
85 | 86 |
public void addGeometryToFeature(Object geometry, Object feature) { |
86 |
((Feature)feature).setCoordinates((Point2D)geometry);
|
|
87 |
((Feature)feature).setCoordinates((Point)geometry); |
|
87 | 88 |
} |
88 | 89 |
|
89 | 90 |
/* |
... | ... | |
109 | 110 |
*/ |
110 | 111 |
public Object startFeature(String id, String name, String xsElementName, |
111 | 112 |
Object layer) { |
112 |
return new Feature(id, name, name, null);
|
|
113 |
return new Feature(id, name, name, null); |
|
113 | 114 |
} |
114 | 115 |
|
115 | 116 |
/* |
... | ... | |
118 | 119 |
*/ |
119 | 120 |
public Object startPoint(String id, double x, double y, double z, String srs) { |
120 | 121 |
return new Point2D.Double(x, y); |
121 |
}
|
|
122 |
} |
|
122 | 123 |
|
123 | 124 |
/* (non-Javadoc) |
124 | 125 |
* @see org.gvsig.gpe.GPEContentHandler#startLineString(java.lang.String, double[], double[], double[], java.lang.String) |
... | ... | |
135 | 136 |
String srs) { |
136 | 137 |
return getPoint(x, y); |
137 | 138 |
} |
138 |
|
|
139 |
private Point2D getPoint(double[] x, double y[]) {
|
|
139 |
|
|
140 |
private Point2D getPoint(double[] x, double y[]) { |
|
140 | 141 |
double xs = 0.0; |
141 | 142 |
double ys = 0.0; |
142 | 143 |
for (int i=0 ; i<x.length ; i++){ |
... | ... | |
148 | 149 |
}else{ |
149 | 150 |
return new Point2D.Double(xs/x.length,ys/x.length); |
150 | 151 |
} |
151 |
}
|
|
152 |
|
|
152 |
} |
|
153 |
|
|
153 | 154 |
/** |
154 | 155 |
* @author Jorge Piera Llodr? (jorge.piera@iver.es) |
155 | 156 |
*/ |
156 | 157 |
private class Element{ |
157 | 158 |
private String name = null; |
158 | 159 |
private Object value = null; |
159 |
|
|
160 |
|
|
160 | 161 |
public Element(String name, Object value) { |
161 | 162 |
super(); |
162 | 163 |
this.name = name; |
163 | 164 |
this.value = value; |
164 | 165 |
} |
165 |
|
|
166 |
|
|
166 | 167 |
/** |
167 | 168 |
* @return the name |
168 | 169 |
*/ |
169 | 170 |
public String getName() { |
170 | 171 |
return name; |
171 | 172 |
} |
172 |
|
|
173 |
|
|
173 | 174 |
/** |
174 | 175 |
* @param name the name to set |
175 | 176 |
*/ |
176 | 177 |
public void setName(String name) { |
177 | 178 |
this.name = name; |
178 | 179 |
} |
179 |
|
|
180 |
|
|
180 | 181 |
/** |
181 | 182 |
* @return the value |
182 | 183 |
*/ |
183 | 184 |
public Object getValue() { |
184 | 185 |
return value; |
185 | 186 |
} |
186 |
|
|
187 |
|
|
187 | 188 |
/** |
188 | 189 |
* @param value the value to set |
189 | 190 |
*/ |
190 | 191 |
public void setValue(Object value) { |
191 | 192 |
this.value = value; |
192 |
}
|
|
193 |
} |
|
193 | 194 |
} |
194 | 195 |
|
195 | 196 |
/** |
Also available in: Unified diff