* @return GmlEnvironment
*/
@SuppressWarnings("unchecked")
private static GmlEnvironment getGmlEnvironment(List<Element> elements) {
GmlEnvironment environment = new GmlEnvironment(new Vec3D(1, 1, 1));
// TODO GmlGenericContainer
// loop through environment nodes
for (Element e: elements) {
String name = e.getName();
if (e.getChildren().size() == 1) {
String value = e.getValue();
environment.set(name, value);
LOGGER.log(Level.FINEST, name+"="+ value);
}
// loop through sub nodes to create vectors
else if (e.getChildren().size() >= 3) {
Vec3D v = getGmlVec3D(e.getChildren());
environment.set(name, v);
LOGGER.log(Level.FINEST, name+"="+ v);
// Specific case for realScale "unit" subnode
if (e.getName().equalsIgnoreCase("realScale")) {
String realScaleUnit;
try {
realScaleUnit = e.getChild("unit").getValue();
}
catch (Exception ex) {
realScaleUnit = "";
}
environment.set("realScaleUnit", realScaleUnit);
LOGGER.log(Level.FINEST, "realScaleUnit"+"="+ realScaleUnit);
}
}
}