Revision 47646 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/gml/virtualrows/GfsFile.java
GfsFile.java | ||
---|---|---|
20 | 20 |
import org.apache.commons.io.FilenameUtils; |
21 | 21 |
import org.apache.commons.io.IOUtils; |
22 | 22 |
import org.apache.commons.lang3.StringUtils; |
23 |
import org.gvsig.fmap.dal.store.gml.virtualrows.GfsFile.PropertyDefn; |
|
23 | 24 |
import org.gvsig.fmap.dal.store.gml.virtualrows.xmlinfo.XMLAttributeInfoImpl; |
24 | 25 |
import org.gvsig.fmap.dal.store.gml.virtualrows.xmlinfo.XMLInfoImpl; |
25 |
import org.gvsig.fmap.dal.store.gml.virtualrows.GfsFile.PropertyDefn; |
|
26 | 26 |
import org.gvsig.tools.ToolsLocator; |
27 | 27 |
import org.gvsig.tools.dataTypes.DataTypes; |
28 | 28 |
import org.gvsig.tools.dataTypes.DataTypesManager; |
... | ... | |
138 | 138 |
private String baseElementPath; |
139 | 139 |
private Map<String, PropertyDefn> properties; |
140 | 140 |
private int gmlVersion; |
141 |
private List<String> geometryElementSrss; |
|
141 | 142 |
|
142 | 143 |
public String getName() { |
143 | 144 |
return name; |
... | ... | |
147 | 148 |
this.name = name; |
148 | 149 |
} |
149 | 150 |
|
151 |
public List<String> getGeometryElementSrss() { |
|
152 |
return geometryElementSrss; |
|
153 |
} |
|
154 |
|
|
150 | 155 |
public List<String> getGeometryElementPaths() { |
151 | 156 |
return geometryElementPaths; |
152 | 157 |
} |
... | ... | |
165 | 170 |
this.geometryElementPaths.add(geometryElementPath); |
166 | 171 |
} |
167 | 172 |
|
173 |
public void addGeometryElementSrs(String geometryElementSrs) { |
|
174 |
if(StringUtils.isBlank(geometryElementSrs)){ |
|
175 |
return; |
|
176 |
} |
|
177 |
if(this.geometryElementSrss == null){ |
|
178 |
this.geometryElementSrss = new ArrayList<>(); |
|
179 |
} |
|
180 |
if(StringUtils.equalsIgnoreCase("null", geometryElementSrs)){ |
|
181 |
this.geometryElementSrss.add(null); |
|
182 |
} else { |
|
183 |
this.geometryElementSrss.add(geometryElementSrs); |
|
184 |
} |
|
185 |
} |
|
186 |
|
|
168 | 187 |
public String getBaseElementPath() { |
169 | 188 |
return baseElementPath; |
170 | 189 |
} |
... | ... | |
198 | 217 |
return possibleMemberPath; |
199 | 218 |
} |
200 | 219 |
|
220 |
private List<String> findGeometryElementSrss(XMLInfoImpl xmlinfo, List<String> elementPaths) { |
|
221 |
List<String> result = new ArrayList<>(); |
|
222 |
for (String elementPath : elementPaths) { |
|
223 |
XMLAttributeInfoImpl x = xmlinfo.getTag(elementPath); |
|
224 |
if(x==null){ |
|
225 |
result.add(null); |
|
226 |
} else { |
|
227 |
result.add(x.getSrs()); |
|
228 |
} |
|
229 |
} |
|
230 |
return result; |
|
231 |
} |
|
232 |
|
|
201 | 233 |
private List<String> findGeometryElementPaths(XMLInfoImpl xmlinfo) { |
202 | 234 |
List<String> result = new ArrayList<>(); |
203 | 235 |
List<String> paths = new ArrayList<>(); |
... | ... | |
247 | 279 |
} |
248 | 280 |
if (p != null) { |
249 | 281 |
result.add(p); |
282 |
// tag.setSrs(nextTag.getSrs()); |
|
250 | 283 |
} |
251 | 284 |
} |
252 | 285 |
} |
... | ... | |
272 | 305 |
for (String geometryElementPath : getGeometryElementPaths()) { |
273 | 306 |
builder.append(" <GeometryElementPath>"+geometryElementPath+"</GeometryElementPath>\n"); |
274 | 307 |
} |
308 |
for (String geometryElementSrs : getGeometryElementSrss()) { |
|
309 |
builder.append(" <GeometryElementSrs>"+geometryElementSrs+"</GeometryElementSrs>\n"); |
|
310 |
} |
|
275 | 311 |
for (PropertyDefn property : properties.values()) { |
276 | 312 |
int type = property.getType(); |
277 | 313 |
String propertyType = datatypesManager.getTypeName(type); |
... | ... | |
342 | 378 |
|
343 | 379 |
this.baseElementPath = findBaseElementPath(xmlinfo); |
344 | 380 |
this.geometryElementPaths = findGeometryElementPaths(xmlinfo); |
381 |
this.geometryElementSrss = findGeometryElementSrss(xmlinfo,this.geometryElementPaths); |
|
345 | 382 |
|
346 | 383 |
removeBaseInGeometryPaths(); |
347 | 384 |
|
... | ... | |
501 | 538 |
} else if(StringUtils.equals(localName, "GeometryElementPath")){ |
502 | 539 |
String value = this.chars.toString(); |
503 | 540 |
addGeometryElementPath(value); |
541 |
} else if(StringUtils.equals(localName, "GeometryElementSrs")){ |
|
542 |
String value = this.chars.toString(); |
|
543 |
addGeometryElementSrs(value); |
|
504 | 544 |
} |
505 | 545 |
} |
506 | 546 |
|
Also available in: Unified diff