diff --git a/database/bin/pom.xml b/database/bin/pom.xml deleted file mode 100644 index 7f27ddd..0000000 --- a/database/bin/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - 4.0.0 - - edu.pnu.stem.igml - indoorgml-factory - 0.0.1-SNAPSHOT - - edu.pnu.stem.igml - database - 0.0.1-SNAPSHOT - database - http://maven.apache.org - - UTF-8 - - - - edu.pnu.stem.igml - feature - 0.0.1-SNAPSHOT - - - org.springframework - spring-jdbc - ${spring.version} - - - junit - junit - 3.8.1 - test - - - - org.orbisgis - h2gis-ext - 1.3.2 - - - org.jvnet.ogc - gml-v_3_2_1 - 2.6.1 - - - - org.slf4j - slf4j-simple - 1.7.25 - - - org.jvnet.ogc - indoorgml-v_1_0 - ${ogc-schemas.version} - system - ${project.basedir}/../lib/indoorgml-v_1_0-2.6.2-SNAPSHOT.jar - - - org.locationtech.jts - jts-core - ${jts.version} - - - diff --git a/database/bin/src/main/java/database/Connector.class b/database/bin/src/main/java/database/Connector.class deleted file mode 100644 index 9a54ae2..0000000 Binary files a/database/bin/src/main/java/database/Connector.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/database/Connector.class b/database/bin/src/main/java/edu/pnu/stem/database/Connector.class deleted file mode 100644 index 9bea9f8..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/database/Connector.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/database/DeleteMap.class b/database/bin/src/main/java/edu/pnu/stem/database/DeleteMap.class deleted file mode 100644 index 31f5ec8..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/database/DeleteMap.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/database/InsertMap.class b/database/bin/src/main/java/edu/pnu/stem/database/InsertMap.class deleted file mode 100644 index f170e9a..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/database/InsertMap.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/database/SearchMap.class b/database/bin/src/main/java/edu/pnu/stem/database/SearchMap.class deleted file mode 100644 index 10fd84e..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/database/SearchMap.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/database/SqlUtil.class b/database/bin/src/main/java/edu/pnu/stem/database/SqlUtil.class deleted file mode 100644 index e38b6c8..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/database/SqlUtil.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceBoundaryDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceBoundaryDAO.class deleted file mode 100644 index 2177982..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceBoundaryDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceDAO.class deleted file mode 100644 index eedcb86..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/CellSpaceDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/EdgesDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/EdgesDAO.class deleted file mode 100644 index 157b941..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/EdgesDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/FeatureDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/FeatureDAO.class deleted file mode 100644 index a1a0072..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/FeatureDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/IndoorFeaturesDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/IndoorFeaturesDAO.class deleted file mode 100644 index d15557b..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/IndoorFeaturesDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/MultiLayeredGraphDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/MultiLayeredGraphDAO.class deleted file mode 100644 index 73330e8..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/MultiLayeredGraphDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/NodesDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/NodesDAO.class deleted file mode 100644 index 2130b20..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/NodesDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/PrimalSpaceFeaturesDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/PrimalSpaceFeaturesDAO.class deleted file mode 100644 index 8f04c4a..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/PrimalSpaceFeaturesDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayerDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayerDAO.class deleted file mode 100644 index 19d39d3..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayerDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayersDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayersDAO.class deleted file mode 100644 index 004e499..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/SpaceLayersDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/StateDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/StateDAO.class deleted file mode 100644 index ab75831..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/StateDAO.class and /dev/null differ diff --git a/database/bin/src/main/java/edu/pnu/stem/db/dao/TransitionDAO.class b/database/bin/src/main/java/edu/pnu/stem/db/dao/TransitionDAO.class deleted file mode 100644 index 532c096..0000000 Binary files a/database/bin/src/main/java/edu/pnu/stem/db/dao/TransitionDAO.class and /dev/null differ diff --git a/database/bin/src/test/java/edu/pnu/stem/AppTest.class b/database/bin/src/test/java/edu/pnu/stem/AppTest.class deleted file mode 100644 index 49b6f13..0000000 Binary files a/database/bin/src/test/java/edu/pnu/stem/AppTest.class and /dev/null differ diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/BindingNode.java b/igml-feature/src/main/java/edu/pnu/stem/binder/BindingNode.java index 04d3fda..7693e22 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/BindingNode.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/BindingNode.java @@ -11,13 +11,13 @@ * */ public class BindingNode { - + private Map attributes = new HashMap(); - + private Map associations = new HashMap(); - + private Map> collections = new HashMap>(); - + public void addAttribute(String key, Object value) { key = key.toUpperCase(); if( !attributes.containsKey(key)) { @@ -26,13 +26,13 @@ public void addAttribute(String key, Object value) { String msg = "Duplicated Key : " + key; throw new IllegalArgumentException(msg); } - + } - + public Object getAttribute(String key) { key = key.toUpperCase(); int idx= key.indexOf("/"); - + if(idx == -1) { return attributes.get(key); } else { @@ -47,26 +47,26 @@ public Object getAttribute(String key) { } } } - + public Map getAttributes() { return attributes; } - - + + public void addAssociation(String key, BindingNode node) { key = key.toUpperCase(); if( !associations.containsKey(key)) { associations.put(key, node); } else { String msg = "Duplicated Key : " + key; - throw new IllegalArgumentException(msg); + throw new IllegalArgumentException(msg); } } - + public BindingNode getAssociation(String key) { key = key.toUpperCase(); int idx= key.indexOf("/"); - + if(idx == -1) { return associations.get(key); } else { @@ -80,7 +80,7 @@ public BindingNode getAssociation(String key) { } } } - + public void addCollection(String key, BindingNode node) { key = key.toUpperCase(); if(!collections.containsKey(key)) { @@ -89,7 +89,7 @@ public void addCollection(String key, BindingNode node) { List bindingList = collections.get(key); bindingList.add(node); } - + public List getCollection(String key) { key = key.toUpperCase(); if(collections.containsKey(key)) { @@ -117,7 +117,7 @@ public Integer getInteger(String key) { return (Integer) value; } } - + public String getString(String key) { Object value = getAttribute(key); if(value == null) { @@ -126,7 +126,7 @@ public String getString(String key) { return (String) value; } } - - + + } diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2FeatureClass.java b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2FeatureClass.java index a58d471..7e701b6 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2FeatureClass.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2FeatureClass.java @@ -80,7 +80,7 @@ import net.opengis.indoorgml.navigation.v_1_0.GeneralSpaceType; /** - * + * * @author Hyung-Gyu Ryoo (hyunggyu.ryoo@gmail.com, Pusan National Univeristy) * */ @@ -92,31 +92,31 @@ public static IndoorFeatures change2FeatureClass(IndoorGMLMap savedMap, String d if(newFeature == null) { newFeature = new IndoorFeatures(savedMap, feature.getId()); savedMap.setFeature(feature.getId(), "IndoorFeatures", newFeature); - } + } // Creating containing features PrimalSpaceFeatures childP = change2FeatureClass(savedMap, feature.getPrimalSpaceFeatures().getPrimalSpaceFeatures(), feature.getId()); newFeature.setPrimalSpaceFeatures(childP); - + MultiLayeredGraph childM = change2FeatureClass(savedMap, feature.getMultiLayeredGraph().getMultiLayeredGraph(), feature.getId()); newFeature.setMultiLayeredGraph(childM); - + return newFeature; } public static Object change2FeatureClass(IndoorGMLMap savedMap, String parentId, CellSpaceGeometryType feature) { Object newFeature = null; - + if (feature.isSetGeometry2D()) { AbstractSurfaceType geom = feature.getGeometry2D().getAbstractSurface().getValue(); if (geom instanceof PolygonType) { PolygonType poly = (PolygonType) geom; - + } else if (geom instanceof SurfaceType) { - + } else if (geom instanceof OrientableSurfaceType) { - + } else if (geom instanceof CompositeSurfaceType) { CompositeSurfaceType tempGeo = (CompositeSurfaceType) geom; List surfList = tempGeo.getSurfaceMember(); @@ -126,14 +126,14 @@ public static Object change2FeatureClass(IndoorGMLMap savedMap, String parentId, } else { //feature.isSetGeometry3D() AbstractSolidType geom = feature.getGeometry3D().getAbstractSolid().getValue(); if (geom instanceof SolidType) { - + } else if (geom instanceof CompositeSolidType) { - + } else { //TODO : Exception } } - + if (newFeature != null) { savedMap.setFeature(parentId, "Geometry", newFeature); } @@ -179,7 +179,7 @@ public static Object change2FeatureClass(IndoorGMLMap savedMap, String parentId, public static CellSpace change2FeatureClass(IndoorGMLMap savedMap, CellSpaceType feature, String parentId) { // Creating this feature CellSpace newFeature = (CellSpace) savedMap.getFeature(feature.getId()); - if(newFeature == null) { + if(newFeature == null) { if(savedMap.hasFutureID(feature.getId())){ newFeature = (CellSpace)savedMap.getFutureFeature(feature.getId()); } @@ -188,21 +188,21 @@ public static CellSpace change2FeatureClass(IndoorGMLMap savedMap, CellSpaceType } savedMap.setFeature(feature.getId(), "CellSpace", newFeature); } - - // Setting parent + + // Setting parent PrimalSpaceFeatures parent = (PrimalSpaceFeatures) savedMap.getFeature(parentId); newFeature.setParent(parent); - + // Creating containing features - + // 1. duality StatePropertyType stateProp = feature.getDuality(); if(stateProp != null){ // Check state is defined as instance or is referenced - + if(stateProp.getHref() != null) { String dualityId = stateProp.getHref().substring(1); - + State duality = (State) savedMap.getFeature(dualityId); if(duality != null) { newFeature.setDuality(duality); @@ -214,11 +214,11 @@ public static CellSpace change2FeatureClass(IndoorGMLMap savedMap, CellSpaceType //TODO } } - + // 2. geometry CellSpaceGeometryType cellSpaceGeom = feature.getCellSpaceGeometry(); if (cellSpaceGeom != null) { - change2FeatureClass(savedMap, feature.getId(), cellSpaceGeom); + change2FeatureClass(savedMap, feature.getId(), cellSpaceGeom); if(cellSpaceGeom.isSetGeometry2D()){ Polygon geom = Convert2JTSGeometry.convert2Polygon((PolygonType)feature.getCellSpaceGeometry().getGeometry2D().getAbstractSurface().getValue()); //GeometryUtil.setMetadata(geom, "id", feature.getCellSpaceGeometry().getGeometry2D().getAbstractSurface().getValue().getId()); @@ -229,7 +229,7 @@ else if(cellSpaceGeom.isSetGeometry3D()){ //GeometryUtil.setMetadata(geom, "id", feature.getCellSpaceGeometry().getGeometry3D().getAbstractSolid().getValue().getId()); newFeature.setGeometry(geom); } - + } else { //TODO : Exception System.out.println("Converter : There is no Geometry Information"); @@ -251,9 +251,9 @@ else if(cellSpaceGeom.isSetGeometry3D()){ //TODO }; } - + savedMap.removeFutureID(feature.getId()); - + return newFeature; } @@ -261,30 +261,30 @@ public static CellSpaceBoundary change2FeatureClass(IndoorGMLMap savedMap, CellS // Creating this feature CellSpaceBoundary newFeature = (CellSpaceBoundary) savedMap.getFeature(feature.getId()); if(newFeature == null) { - + if(savedMap.hasFutureID(feature.getId())){ newFeature = (CellSpaceBoundary)savedMap.getFutureFeature(feature.getId()); } else { newFeature = new CellSpaceBoundary(savedMap, feature.getId()); - } + } savedMap.setFeature(feature.getId(), "CellSpaceBoundary", newFeature); } - - // Setting parent + + // Setting parent PrimalSpaceFeatures parent = (PrimalSpaceFeatures) savedMap.getFeature(parentId); newFeature.setParent(parent); - + // Creating containing features // 1. duality TransitionPropertyType transitionProp = feature.getDuality(); if (transitionProp != null) { // Check transition is defined as instance or is referenced - + if(transitionProp.getHref() != null) { String dualityId = transitionProp.getHref().substring(1); - + Transition duality = (Transition) savedMap.getFeature(dualityId); if(duality != null) { newFeature.setDuality(duality); @@ -296,7 +296,7 @@ public static CellSpaceBoundary change2FeatureClass(IndoorGMLMap savedMap, CellS //TODO } } - + // 2. geometry CellSpaceBoundaryGeometryType cellSpaceBoundaryGeom = feature.getCellSpaceBoundaryGeometry(); if (cellSpaceBoundaryGeom != null) { @@ -305,7 +305,7 @@ public static CellSpaceBoundary change2FeatureClass(IndoorGMLMap savedMap, CellS //TODO : Exception System.out.println("Converter : There is no Geometry Information"); } - + return newFeature; } @@ -336,11 +336,11 @@ public static MultiLayeredGraph change2FeatureClass(IndoorGMLMap savedMap, Multi else{ newFeature = new MultiLayeredGraph(savedMap, feature.getId()); } - + savedMap.setFeature(feature.getId(), "MultiLayeredGraph", newFeature); } - - // Setting parent + + // Setting parent IndoorFeatures parent = (IndoorFeatures) savedMap.getFeature(parentId); newFeature.setParent(parent); @@ -352,7 +352,7 @@ public static MultiLayeredGraph change2FeatureClass(IndoorGMLMap savedMap, Multi //newFeature.addSpaceLayers(sls); } newFeature.setSpaceLayers(spaceLayers); - + ArrayList interEdges = new ArrayList(); for (InterEdgesType iet : feature.getInterEdges()) { InterEdges ie = change2FeatureClass(savedMap, iet, newFeature.getId()); @@ -373,14 +373,14 @@ public static SpaceLayers change2FeatureClass(IndoorGMLMap savedMap, SpaceLayers else{ newFeature = new SpaceLayers(savedMap, feature.getId()); } - + savedMap.setFeature(feature.getId(), "SpaceLayers", newFeature); } - - // Setting parent + + // Setting parent MultiLayeredGraph parent = (MultiLayeredGraph) savedMap.getFeature(parentId); newFeature.setParent(parent); - + // Creating containing features ArrayListspaceLayerMember = new ArrayList(); for (SpaceLayerMemberType slmType : feature.getSpaceLayerMember()) { @@ -400,11 +400,11 @@ public static InterEdges change2FeatureClass(IndoorGMLMap savedMap, InterEdgesTy newFeature = new InterEdges(savedMap, feature.getId()); savedMap.setFeature(feature.getId(), "InterEdges", newFeature); } - - // Setting parent + + // Setting parent MultiLayeredGraph parent = (MultiLayeredGraph) savedMap.getFeature(parentId); newFeature.setParent(parent); - + //TODO List interLayerConnectionMember = feature.getInterLayerConnectionMember(); List interLayerConnection = new ArrayList(); @@ -427,31 +427,31 @@ public static Edges change2FeatureClass(IndoorGMLMap savedMap, EdgesType feature // Creating this feature Edges newFeature = (Edges) savedMap.getFeature(feature.getId()); if(newFeature == null) { - + if(savedMap.hasFutureID(feature.getId())){ newFeature = (Edges)savedMap.getFutureFeature(feature.getId()); } else{ newFeature = new Edges(savedMap, feature.getId()); } - + savedMap.setFeature(feature.getId(), "Edges", newFeature); } - - // Setting parent + + // Setting parent SpaceLayer parent = (SpaceLayer) savedMap.getFeature(parentId); newFeature.setParent(parent); - + List tms = feature.getTransitionMember(); List transitionMemberReference = new ArrayList(); - + for(TransitionMemberType tmType : tms) { TransitionType tType = tmType.getTransition(); Transition t = change2FeatureClass(savedMap, tType, newFeature.getId()); transitionMemberReference.add(t); //newFeature.addTransitionMember(t); } - + newFeature.setTransitionMembers(transitionMemberReference); return newFeature; } @@ -466,21 +466,21 @@ public static InterLayerConnection change2FeatureClass(IndoorGMLMap savedMap, In else{ newFeature = new InterLayerConnection(savedMap, feature.getId()); } - + savedMap.setFeature(feature.getId(), "InterLayerConnection", newFeature); } - - // Setting parent + + // Setting parent InterEdges parent = (InterEdges) savedMap.getFeature(parentId); newFeature.setParent(parent); List spacelayerList = new ArrayList(); for (SpaceLayerPropertyType slpProp : feature.getConnectedLayers()) { - + SpaceLayer connected = null; if(slpProp.getHref() != null) { String href = slpProp.getHref().substring(1); - + connected = (SpaceLayer) savedMap.getFeature(href); if(connected == null) { //TODO @@ -499,11 +499,11 @@ public static InterLayerConnection change2FeatureClass(IndoorGMLMap savedMap, In List interConnectionList = new ArrayList(); for (StatePropertyType stateProp : feature.getInterConnects()) { - + State s = null; if(stateProp.getHref() != null) { String href = stateProp.getHref().substring(1); - + s = (State) savedMap.getFeature(href); if(s == null) { //TODO @@ -523,7 +523,7 @@ public static InterLayerConnection change2FeatureClass(IndoorGMLMap savedMap, In if (spacelayerList.size() != 2 || interConnectionList.size() != 2) { System.out.println("Converter : number of SpaceLayer or InterConnection is not 2 at InterLayerConnection"); } else { - + } return newFeature; @@ -540,27 +540,27 @@ public static PrimalSpaceFeatures change2FeatureClass(IndoorGMLMap savedMap, Pri else{ newFeature = new PrimalSpaceFeatures(savedMap, feature.getId()); } - + savedMap.setFeature(feature.getId(), "PrimalSpaceFeatures", newFeature); } - - // Setting parent + + // Setting parent IndoorFeatures parent = (IndoorFeatures) savedMap.getFeature(parentId); newFeature.setParent(parent); - + // Creating containing features for (CellSpaceMemberType csm : feature.getCellSpaceMember()) { CellSpaceType cs = csm.getCellSpace().getValue(); CellSpace c = change2FeatureClass(savedMap, cs, newFeature.getId()); newFeature.addCellSpaceMember(c); } - + for (CellSpaceBoundaryMemberType csbm : feature.getCellSpaceBoundaryMember()) { CellSpaceBoundaryType cs = csbm.getCellSpaceBoundary().getValue(); CellSpaceBoundary cb = change2FeatureClass(savedMap, cs, newFeature.getId()); newFeature.addCellSpaceBoundaryMember(cb); } - + return newFeature; } @@ -568,7 +568,7 @@ public static Nodes change2FeatureClass(IndoorGMLMap savedMap, NodesType feature // Creating this feature Nodes newFeature = (Nodes) savedMap.getFeature(feature.getId()); if(newFeature == null) { - + if(savedMap.hasFutureID(feature.getId())){ newFeature = (Nodes)savedMap.getFutureFeature(feature.getId()); } @@ -576,13 +576,13 @@ public static Nodes change2FeatureClass(IndoorGMLMap savedMap, NodesType feature newFeature = new Nodes(savedMap, feature.getId()); } savedMap.setFeature(feature.getId(), "Nodes", newFeature); - + } - + // Setting parent SpaceLayer parent = (SpaceLayer) savedMap.getFeature(parentId); newFeature.setParent(parent); - + List tempML = feature.getStateMember(); List stateList = new ArrayList(); @@ -592,7 +592,7 @@ public static Nodes change2FeatureClass(IndoorGMLMap savedMap, NodesType feature stateList.add(temp); } newFeature.setStateMember(stateList); - + savedMap.setFeature(feature.getId(), "Nodes", newFeature); return newFeature; } @@ -607,14 +607,14 @@ public static SpaceLayer change2FeatureClass(IndoorGMLMap savedMap, SpaceLayerTy else{ newFeature = new SpaceLayer(savedMap, feature.getId()); } - + savedMap.setFeature(feature.getId(), "SpaceLayer", newFeature); } - + // Setting parent SpaceLayers parent = (SpaceLayers) savedMap.getFeature(parentId); newFeature.setParent(parent); - + // newFeature.createDate = feature.getCreationDate(); // newFeature.terminateDate = feature.getTerminateDate(); newFeature.setClassType(feature.getClazz()); @@ -624,7 +624,7 @@ public static SpaceLayer change2FeatureClass(IndoorGMLMap savedMap, SpaceLayerTy Nodes ns = change2FeatureClass(savedMap, nodesType, newFeature.getId()); newFeature.addNodes(ns); } - + for (EdgesType edgesType : feature.getEdges()) { Edges ns = change2FeatureClass(savedMap, edgesType, newFeature.getId()); newFeature.addEdges(ns); @@ -646,9 +646,9 @@ public static State change2FeatureClass(IndoorGMLMap savedMap, StateType feature else{ newFeature = new State(savedMap, feature.getId()); } - + } - + // Setting parent Nodes parent = (Nodes) savedMap.getFeature(parentId); if(parent == null){ @@ -659,15 +659,15 @@ public static State change2FeatureClass(IndoorGMLMap savedMap, StateType feature parent = new Nodes(savedMap, parentId); } newFeature.setParent(parent); - + // 1. duality CellSpacePropertyType cellSpaceProp = feature.getDuality(); if(cellSpaceProp != null){ // Check state is defined as instance or is referenced - + if(cellSpaceProp.getHref() != null) { String dualityId = cellSpaceProp.getHref().substring(1); - + CellSpace duality = (CellSpace) savedMap.getFeature(dualityId); if(duality != null) { newFeature.setDuality(duality); @@ -679,14 +679,14 @@ public static State change2FeatureClass(IndoorGMLMap savedMap, StateType feature //TODO } } - + // 2. geometry if(feature.isSetGeometry()){ Point geom = Convert2JTSGeometry.convert2Point(feature.getGeometry().getPoint()); GeometryUtil.setMetadata(geom, "id", feature.getGeometry().getPoint().getId()); newFeature.setGeometry(geom); } - + // 3. connects List featureConnects = feature.getConnects(); for (TransitionPropertyType tProp : featureConnects) { @@ -697,7 +697,7 @@ public static State change2FeatureClass(IndoorGMLMap savedMap, StateType feature //TODO }; } - + savedMap.setFeature(feature.getId(), "State", newFeature); return newFeature; } @@ -712,13 +712,13 @@ public static Transition change2FeatureClass(IndoorGMLMap savedMap, TransitionTy else{ newFeature = new Transition(savedMap, feature.getId()); } - + } - + // Setting parent Edges parent = (Edges) savedMap.getFeature(parentId); newFeature.setParent(parent); - + // 2. geometry if(feature.isSetGeometry()){ LineString geom = Convert2JTSGeometry.convert2LineString((LineStringType)feature.getGeometry().getAbstractCurve().getValue()); @@ -729,24 +729,24 @@ public static Transition change2FeatureClass(IndoorGMLMap savedMap, TransitionTy // 3. connects List connects = feature.getConnects(); State[] sArr = new State[2]; - + String connects1Id = connects.get(0).getHref().substring(1); State connects1 = new State(savedMap,connects1Id); sArr[0] = connects1; - + String connects2Id = connects.get(1).getHref().substring(1); State connects2 = new State(savedMap,connects2Id); sArr[1] = connects2; newFeature.setConnects(sArr); - + // 4. duality CellSpaceBoundaryPropertyType cellSpaceBoundaryProp = feature.getDuality(); if(cellSpaceBoundaryProp != null){ // Check state is defined as instance or is referenced - + if(cellSpaceBoundaryProp.getHref() != null) { String dualityId = cellSpaceBoundaryProp.getHref().substring(1); - + CellSpaceBoundary duality = (CellSpaceBoundary) savedMap.getFeature(dualityId); if(duality != null) { newFeature.setDuality(duality); @@ -764,36 +764,36 @@ public static Transition change2FeatureClass(IndoorGMLMap savedMap, TransitionTy savedMap.setFeature(feature.getId(), "Transition", newFeature); return newFeature; } - - + + public static AnchorBoundary change2FeatureClass(IndoorGMLMap savedMap, AnchorBoundaryType feature, String parentId) { // Creating this feature AnchorBoundary newFeature = (AnchorBoundary) savedMap.getFeature(feature.getId()); if(newFeature == null) { - + if(savedMap.hasFutureID(feature.getId())){ newFeature = (AnchorBoundary)savedMap.getFutureFeature(feature.getId()); } else { newFeature = new AnchorBoundary(savedMap, feature.getId()); - } + } savedMap.setFeature(feature.getId(), "AnchorBoundary", newFeature); } - - // Setting parent + + // Setting parent PrimalSpaceFeatures parent = (PrimalSpaceFeatures) savedMap.getFeature(parentId); newFeature.setParent(parent); - + // Creating containing features // 1. duality TransitionPropertyType transitionProp = feature.getDuality(); if (transitionProp != null) { // Check transition is defined as instance or is referenced - + if(transitionProp.getHref() != null) { String dualityId = transitionProp.getHref().substring(1); - + Transition duality = (Transition) savedMap.getFeature(dualityId); if(duality != null) { newFeature.setDuality(duality); @@ -805,7 +805,7 @@ public static AnchorBoundary change2FeatureClass(IndoorGMLMap savedMap, AnchorBo //TODO } } - + // 2. geometry CellSpaceBoundaryGeometryType cellSpaceBoundaryGeom = feature.getCellSpaceBoundaryGeometry(); if (cellSpaceBoundaryGeom != null) { @@ -814,7 +814,7 @@ public static AnchorBoundary change2FeatureClass(IndoorGMLMap savedMap, AnchorBo //TODO : Exception System.out.println("Converter : There is no Geometry Information"); } - + return newFeature; } @@ -823,6 +823,6 @@ public static typeOfTopoExpressionCode change2FeatureClass(TypeOfTopoExpressionC return null; } - + } diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2GeoJsonGeometry.java b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2GeoJsonGeometry.java index 861863b..d549d80 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2GeoJsonGeometry.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2GeoJsonGeometry.java @@ -14,7 +14,7 @@ public static JsonNode convert2GeoJson(JsonNode geometry, String featureType){ String geometryType = geometry.get("type").asText().trim(); ObjectMapper mapper = new ObjectMapper(); ObjectNode jsonNode = mapper .createObjectNode(); - + if(geometryType.equals("Solid")||(geometryType.equals("Surface") && geometry.get("properties").get("extrude").asText().trim().equals("true"))){ result = convert2Solid3D(geometry); jsonNode.put("type", "Solid"); @@ -46,7 +46,7 @@ else if(geometry.get("properties").get("extrude").asText().trim().equals("false" else if(featureType.equals("Transition")){ result = convert2Curve2D(geometry); } - + } else if(geometryType.equals("Point")){ result = convert2Point2D(geometry); @@ -54,15 +54,15 @@ else if(geometryType.equals("Point")){ else{ System.out.println("GeoJson : Not defined Geometry"); } - - - - + + + + return jsonNode; } public static List makeDoubleCoordinates(JsonNode coordinates){ ListcoordinatesToArray = new ArrayList(); - + for(int i = 0 ; i < coordinates.size() ; i++){ List coordinate = new ArrayList(); coordinate.add(coordinates.get(i).get(0).asDouble()); @@ -72,7 +72,7 @@ public static List makeDoubleCoordinates(JsonNode coordinates){ } coordinatesToArray.add(coordinate); } - + return coordinatesToArray; }; public static JsonNode convert2Solid3D(JsonNode geometry){ @@ -108,38 +108,38 @@ public static JsonNode convert2ExtrudedCurve3D(JsonNode geometry){ List coordInDouble = makeDoubleCoordinates(coordinates); List container = new ArrayList(); List polygon = new ArrayList(); - polygon.add(makeExtrudedCurve3D(coordInDouble, height)); + polygon.add(makeExtrudedCurve3D(coordInDouble, height)); //container.add(polygon); result = mapper.valueToTree(polygon); return result; - + } public static List makeExtrudedCurve3D(Listcoordinates, Double height){ - - + + List polygon = new ArrayList(); List extrudedPoint = new ArrayList(); - + polygon.add(new ArrayList(coordinates.get(0))); polygon.add(new ArrayList(coordinates.get(1))); - + extrudedPoint = new ArrayList(coordinates.get(1)); Double ground = extrudedPoint.get(2); extrudedPoint.remove(2); extrudedPoint.add(ground + height); polygon.add(new ArrayList(extrudedPoint)); - + extrudedPoint = new ArrayList(coordinates.get(0)); ground = extrudedPoint.get(2); extrudedPoint.remove(2); extrudedPoint.add(ground + height); polygon.add(new ArrayList(extrudedPoint)); - + polygon.add(new ArrayList(coordinates.get(0))); return polygon; } public static List makeSolid(List coordinates, Double height){ - + List result = new ArrayList(); List exterior = new ArrayList(); List interior = new ArrayList(); @@ -147,9 +147,9 @@ public static List makeSolid(List coordinates, Double height){ List upperSurface = new ArrayList(); List lowerSurface = new ArrayList(); List wholeSurface = new ArrayList(); - + for(int i = coordinates.size()-1 ; i > -1 ; i--){ - + ListtempList = new ArrayList(coordinates.get(i)); lowerSurface.add(tempList); } @@ -163,33 +163,33 @@ public static List makeSolid(List coordinates, Double height){ Double ground = 0.0; surface.add(coordinates.get(i)); surface.add(coordinates.get(i+1)); - + extrudedPoint = new ArrayList(coordinates.get(i+1)); ground = extrudedPoint.get(2); ground += height; extrudedPoint.remove(2); extrudedPoint.add(ground); - + surface.add(extrudedPoint); - + extrudedPoint = new ArrayList(coordinates.get(i)); ground = extrudedPoint.get(2); ground += height; extrudedPoint.remove(2); extrudedPoint.add(height); - + surface.add(extrudedPoint); surface.add(new ArrayList(coordinates.get(i))); wholeSurface.add(surface); exterior.add(new ArrayList(wholeSurface)); } - + //make 3d surface of the lid - + for(int i = 0 ; i < coordinates.size(); i++){ ListextrudedPoint = new ArrayList(coordinates.get(i)); Double ground = 0.0; - + ground = extrudedPoint.get(2); ground += height; extrudedPoint.remove(2); @@ -199,52 +199,52 @@ public static List makeSolid(List coordinates, Double height){ wholeSurface = new ArrayList(); wholeSurface.add(upperSurface); exterior.add(wholeSurface); - - + + result.add(exterior); result.add(interior); - + return result; } public static List makeSurface3D(List coordinates, Double height){ //List result = new ArrayList(); - + for(List coord : coordinates){ Double ground = .0; - + ground = (Double) coord.get(2); ground += height; coord.remove(2); coord.add(ground); - + } - + //result.add(coordinates); - + return coordinates; - + } - + public static List makeExtrudedCurve(List coordinates, Double height){ Listresult = new ArrayList(); //TODO : need to support linesting which has several points List upperRight = new ArrayList(); List upperLeft = new ArrayList(); - + upperRight.add((Double)coordinates.get(1).get(0)); upperRight.add((Double)coordinates.get(1).get(1)); upperRight.add((Double)coordinates.get(1).get(2)+height); - + upperLeft.add((Double)coordinates.get(0).get(0)); upperLeft.add((Double)coordinates.get(0).get(1)); upperLeft.add((Double)coordinates.get(0).get(2)+height); - + coordinates.add(upperRight); coordinates.add(upperLeft); - + //result.add(coordinates); return coordinates; } - - + + } diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JTSGeometry.java b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JTSGeometry.java index d70a692..e897da4 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JTSGeometry.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JTSGeometry.java @@ -1,204 +1,204 @@ -package edu.pnu.stem.binder; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import javax.xml.bind.JAXBElement; - -import org.locationtech.jts.geom.Coordinate; -import org.locationtech.jts.geom.Geometry; -import org.locationtech.jts.geom.GeometryFactory; -import org.locationtech.jts.geom.LineString; -import org.locationtech.jts.geom.LinearRing; -import org.locationtech.jts.geom.MultiPolygon; -import org.locationtech.jts.geom.Point; -import org.locationtech.jts.geom.Polygon; - -import com.vividsolutions.jts.geom.Envelope; - -import edu.pnu.stem.geometry.jts.Envelope3D; -import edu.pnu.stem.geometry.jts.Solid; -import net.opengis.gml.v_3_2_1.AbstractRingType; -import net.opengis.gml.v_3_2_1.AbstractSurfaceType; -import net.opengis.gml.v_3_2_1.CompositeSurfaceType; -import net.opengis.gml.v_3_2_1.CoordinatesType; -import net.opengis.gml.v_3_2_1.DirectPositionListType; -import net.opengis.gml.v_3_2_1.DirectPositionType; -import net.opengis.gml.v_3_2_1.EnvelopeType; -import net.opengis.gml.v_3_2_1.LineStringType; -import net.opengis.gml.v_3_2_1.LinearRingType; -import net.opengis.gml.v_3_2_1.OrientableSurfaceType; -import net.opengis.gml.v_3_2_1.PointType; -import net.opengis.gml.v_3_2_1.PolygonType; -import net.opengis.gml.v_3_2_1.RingType; -import net.opengis.gml.v_3_2_1.ShellType; -import net.opengis.gml.v_3_2_1.SolidType; -import net.opengis.gml.v_3_2_1.SurfacePropertyType; -import net.opengis.gml.v_3_2_1.SurfaceType; - -public class Convert2JTSGeometry { - - private final static GeometryFactory geometryFactory = new GeometryFactory(); - - +package edu.pnu.stem.binder; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import javax.xml.bind.JAXBElement; + +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.geom.LineString; +import org.locationtech.jts.geom.LinearRing; +import org.locationtech.jts.geom.MultiPolygon; +import org.locationtech.jts.geom.Point; +import org.locationtech.jts.geom.Polygon; + +import com.vividsolutions.jts.geom.Envelope; + +import edu.pnu.stem.geometry.jts.Envelope3D; +import edu.pnu.stem.geometry.jts.Solid; +import net.opengis.gml.v_3_2_1.AbstractRingType; +import net.opengis.gml.v_3_2_1.AbstractSurfaceType; +import net.opengis.gml.v_3_2_1.CompositeSurfaceType; +import net.opengis.gml.v_3_2_1.CoordinatesType; +import net.opengis.gml.v_3_2_1.DirectPositionListType; +import net.opengis.gml.v_3_2_1.DirectPositionType; +import net.opengis.gml.v_3_2_1.EnvelopeType; +import net.opengis.gml.v_3_2_1.LineStringType; +import net.opengis.gml.v_3_2_1.LinearRingType; +import net.opengis.gml.v_3_2_1.OrientableSurfaceType; +import net.opengis.gml.v_3_2_1.PointType; +import net.opengis.gml.v_3_2_1.PolygonType; +import net.opengis.gml.v_3_2_1.RingType; +import net.opengis.gml.v_3_2_1.ShellType; +import net.opengis.gml.v_3_2_1.SolidType; +import net.opengis.gml.v_3_2_1.SurfacePropertyType; +import net.opengis.gml.v_3_2_1.SurfaceType; + +public class Convert2JTSGeometry { + + private final static GeometryFactory geometryFactory = new GeometryFactory(); + + public static Solid Convert2Solid(SolidType feature){ - Solid newFeature = null; - ShellType exterior = feature.getExterior().getShell(); - MultiPolygon shell = convert2MultiPolygon(exterior); - newFeature = new Solid(shell, null, geometryFactory); - if(feature.getId() == null) { - edu.pnu.stem.util.GeometryUtil.setMetadata(newFeature,"id", UUID.randomUUID().toString()); - } - else { - edu.pnu.stem.util.GeometryUtil.setMetadata(newFeature,"id", feature.getId()); - } - return newFeature; - } - + Solid newFeature = null; + ShellType exterior = feature.getExterior().getShell(); + MultiPolygon shell = convert2MultiPolygon(exterior); + newFeature = new Solid(shell, null, geometryFactory); + if(feature.getId() == null) { + edu.pnu.stem.util.GeometryUtil.setMetadata(newFeature,"id", UUID.randomUUID().toString()); + } + else { + edu.pnu.stem.util.GeometryUtil.setMetadata(newFeature,"id", feature.getId()); + } + return newFeature; + } + public static MultiPolygon convert2MultiPolygon(ShellType feature){ - MultiPolygon newFeature = null; - AbstractSurfaceType firstGeo = feature.getSurfaceMember().get(0).getAbstractSurface().getValue(); - ListmultiPolygonList = new ArrayList(); - MultiPolygon shell = null; - if(firstGeo instanceof CompositeSurfaceType){ - //TODO : support CompositeSurfaceType later - } - else if(firstGeo instanceof OrientableSurfaceType){ - SurfacePropertyType surface = ((OrientableSurfaceType) firstGeo).getBaseSurface(); - //surface.getHref() - //TODO : support OrientableSurfaceType later - } - else if(firstGeo instanceof PolygonType){ - ListpolygonList = new ArrayList(); - for(int i = 0 ; i < feature.getSurfaceMember().size() ; i++){ - polygonList.add((PolygonType)feature.getSurfaceMember().get(i).getAbstractSurface().getValue()); - } - - for(int i = 0 ; i < polygonList.size() ; i++){ - multiPolygonList.add(convert2Polygon(polygonList.get(i))); - Polygon[]temp = new Polygon[multiPolygonList.size()]; - shell = geometryFactory.createMultiPolygon(multiPolygonList.toArray(temp)); - } - } - else if(firstGeo instanceof SurfaceType){ - //TODO : support SurfaceType later - } - return shell; - } - /* - public Polygon Convert2Surface(SurfaceType feature){ - - - } - * */ - + MultiPolygon newFeature = null; + AbstractSurfaceType firstGeo = feature.getSurfaceMember().get(0).getAbstractSurface().getValue(); + ListmultiPolygonList = new ArrayList(); + MultiPolygon shell = null; + if(firstGeo instanceof CompositeSurfaceType){ + //TODO : support CompositeSurfaceType later + } + else if(firstGeo instanceof OrientableSurfaceType){ + SurfacePropertyType surface = ((OrientableSurfaceType) firstGeo).getBaseSurface(); + //surface.getHref() + //TODO : support OrientableSurfaceType later + } + else if(firstGeo instanceof PolygonType){ + ListpolygonList = new ArrayList(); + for(int i = 0 ; i < feature.getSurfaceMember().size() ; i++){ + polygonList.add((PolygonType)feature.getSurfaceMember().get(i).getAbstractSurface().getValue()); + } + + for(int i = 0 ; i < polygonList.size() ; i++){ + multiPolygonList.add(convert2Polygon(polygonList.get(i))); + Polygon[]temp = new Polygon[multiPolygonList.size()]; + shell = geometryFactory.createMultiPolygon(multiPolygonList.toArray(temp)); + } + } + else if(firstGeo instanceof SurfaceType){ + //TODO : support SurfaceType later + } + return shell; + } + /* + public Polygon Convert2Surface(SurfaceType feature){ + + + } + * */ + public static Polygon convert2Polygon(PolygonType feature){ - AbstractRingType ring = feature.getExterior().getAbstractRing().getValue(); - Polygon newFeature = null; - if(ring instanceof LinearRingType){ - newFeature = geometryFactory.createPolygon(convert2LinearRing((LinearRingType)ring)); - } - else if(ring instanceof RingType){ - //TODO : support RingType later - } - if(feature.getId() == null) { - edu.pnu.stem.util.GeometryUtil.setMetadata(newFeature,"id", UUID.randomUUID().toString()); - } - else { - edu.pnu.stem.util.GeometryUtil.setMetadata(newFeature,"id", feature.getId()); - } - return newFeature; - } + AbstractRingType ring = feature.getExterior().getAbstractRing().getValue(); + Polygon newFeature = null; + if(ring instanceof LinearRingType){ + newFeature = geometryFactory.createPolygon(convert2LinearRing((LinearRingType)ring)); + } + else if(ring instanceof RingType){ + //TODO : support RingType later + } + if(feature.getId() == null) { + edu.pnu.stem.util.GeometryUtil.setMetadata(newFeature,"id", UUID.randomUUID().toString()); + } + else { + edu.pnu.stem.util.GeometryUtil.setMetadata(newFeature,"id", feature.getId()); + } + return newFeature; + } public static LinearRing convert2LinearRing(LinearRingType feature){ - DirectPositionListType directpositionList = feature.getPosList(); - List> postList = feature.getPosOrPointPropertyOrPointRep(); - CoordinatesType coord = feature.getCoordinates(); - List coordList = new ArrayList(); - - if(directpositionList != null){ - //coord = convert2Coordinate(directpositionList); - } - else{ - if(postList.size() != 0){ - for( JAXBElement point : postList){ - coordList.add(convert2Coordinate((DirectPositionType)point.getValue())); - } - } - else{ - if(coord != null){ - - } - else{ - //TODO - //nogeometryexception - } - } - } - - Coordinate[] newCoordinate = new Coordinate[coordList.size()]; - coordList.toArray(newCoordinate); - - LinearRing newFeature = null; - - try{ - newFeature = geometryFactory.createLinearRing(newCoordinate); - } - catch(Exception e){ - e.printStackTrace(); - } - - return newFeature; - } - - public static LineString convert2LineString(LineStringType feature){ - List pointList = new ArrayList(); - - for(int i = 0 ; i < feature.getPosOrPointPropertyOrPointRep().size() ; i++){ - pointList.add(convert2Coordinate((DirectPositionType)feature.getPosOrPointPropertyOrPointRep().get(i).getValue())); - } + DirectPositionListType directpositionList = feature.getPosList(); + List> postList = feature.getPosOrPointPropertyOrPointRep(); + CoordinatesType coord = feature.getCoordinates(); + List coordList = new ArrayList(); + + if(directpositionList != null){ + //coord = convert2Coordinate(directpositionList); + } + else{ + if(postList.size() != 0){ + for( JAXBElement point : postList){ + coordList.add(convert2Coordinate((DirectPositionType)point.getValue())); + } + } + else{ + if(coord != null){ + + } + else{ + //TODO + //nogeometryexception + } + } + } + + Coordinate[] newCoordinate = new Coordinate[coordList.size()]; + coordList.toArray(newCoordinate); + + LinearRing newFeature = null; + + try{ + newFeature = geometryFactory.createLinearRing(newCoordinate); + } + catch(Exception e){ + e.printStackTrace(); + } + + return newFeature; + } + + public static LineString convert2LineString(LineStringType feature){ + List pointList = new ArrayList(); + + for(int i = 0 ; i < feature.getPosOrPointPropertyOrPointRep().size() ; i++){ + pointList.add(convert2Coordinate((DirectPositionType)feature.getPosOrPointPropertyOrPointRep().get(i).getValue())); + } Coordinate[] coordList = new Coordinate[pointList.size()]; - return geometryFactory.createLineString(pointList.toArray(coordList)); - } + return geometryFactory.createLineString(pointList.toArray(coordList)); + } public static Point convert2Point(PointType feature){ - Point newFeature = null; - newFeature = geometryFactory.createPoint(convert2Coordinate(feature.getPos())); - return newFeature; - } - + Point newFeature = null; + newFeature = geometryFactory.createPoint(convert2Coordinate(feature.getPos())); + return newFeature; + } + public static Coordinate convert2Coordinate(DirectPositionType feature){ - Coordinate newFeature = null; - Listcoordinates = feature.getValue(); - if(coordinates.size() == 2){ - newFeature = new Coordinate(coordinates.get(0), coordinates.get(1)); - } - else if(coordinates.size() == 3){ - newFeature = new Coordinate(coordinates.get(0), coordinates.get(1), coordinates.get(2)); - } - return newFeature; - } - + Coordinate newFeature = null; + Listcoordinates = feature.getValue(); + if(coordinates.size() == 2){ + newFeature = new Coordinate(coordinates.get(0), coordinates.get(1)); + } + else if(coordinates.size() == 3){ + newFeature = new Coordinate(coordinates.get(0), coordinates.get(1), coordinates.get(2)); + } + return newFeature; + } + public static List convert2CoordinateList(DirectPositionListType feature) { - List pointList = feature.getValue(); - List coordinateList = new ArrayList(); - if(feature.getSrsDimension().intValue() == 2) { - for(int i = 0 ; i < pointList.size(); i++) { - Coordinate temp = new Coordinate(pointList.get(i), pointList.get(i + 1)); - coordinateList.add(temp); - } - } - else if(feature.getSrsDimension().intValue() == 3) { - for(int i = 0 ; i < pointList.size(); i++) { - Coordinate temp = new Coordinate(pointList.get(i), pointList.get(i + 1), pointList.get(i + 2)); - coordinateList.add(temp); - } - } - else{ - //TODO : dimension error - } - return coordinateList; - } - -} + List pointList = feature.getValue(); + List coordinateList = new ArrayList(); + if(feature.getSrsDimension().intValue() == 2) { + for(int i = 0 ; i < pointList.size(); i++) { + Coordinate temp = new Coordinate(pointList.get(i), pointList.get(i + 1)); + coordinateList.add(temp); + } + } + else if(feature.getSrsDimension().intValue() == 3) { + for(int i = 0 ; i < pointList.size(); i++) { + Coordinate temp = new Coordinate(pointList.get(i), pointList.get(i + 1), pointList.get(i + 2)); + coordinateList.add(temp); + } + } + else{ + //TODO : dimension error + } + return coordinateList; + } + +} diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JaxbClass.java b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JaxbClass.java index 37e7725..bfa3d7a 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JaxbClass.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JaxbClass.java @@ -96,7 +96,7 @@ public class Convert2JaxbClass { @SuppressWarnings("unchecked") public static CellSpaceType change2JaxbClass(IndoorGMLMap savedMap, CellSpace feature) throws JAXBException { - + CellSpaceType newFeature = indoorgmlcoreOF.createCellSpaceType(); StatePropertyType duality = new StatePropertyType(); @@ -166,7 +166,7 @@ public static CellSpaceType change2JaxbClass(IndoorGMLMap savedMap, CellSpace fe newFeature.setCellSpaceGeometry(cellSpaceGeometryType); } } - + return newFeature; } @@ -275,15 +275,15 @@ static public IndoorFeaturesType change2JaxbClass(IndoorGMLMap savedMap, IndoorF throws JAXBException { IndoorFeaturesType newFeature = new IndoorFeaturesType(); newFeature.setId(feature.getId()); - + if(feature.getBoundedBy() != null) { - Envelope e = (Envelope) savedMap.getFeature(feature.getBoundedBy().getId()); + Envelope e = (Envelope) savedMap.getFeature(feature.getBoundedBy().getId()); JAXBElement jaxbEnvelope = gmlOF.createEnvelope(change2JaxbClass(savedMap,e)); - BoundingShapeType bs = gmlOF.createBoundingShapeType(); + BoundingShapeType bs = gmlOF.createBoundingShapeType(); bs.setEnvelope(jaxbEnvelope); - newFeature.setBoundedBy(bs); + newFeature.setBoundedBy(bs); } - + if (feature.getPrimalSpaceFeatures() != null) { // Convert2FeatureClass.docContainer. PrimalSpaceFeatures p = (PrimalSpaceFeatures) savedMap.getFeature(feature.getPrimalSpaceFeatures().getId()); @@ -303,7 +303,7 @@ static public IndoorFeaturesType change2JaxbClass(IndoorGMLMap savedMap, IndoorF static public EnvelopeType change2JaxbClass(IndoorGMLMap savedMap, Envelope feature) throws JAXBException { EnvelopeType newFeature = new EnvelopeType(); - + Point low = (Point) feature.getLowerCorner(); Point upper = (Point) feature.getUpperCorner(); if (low != null) { @@ -312,7 +312,7 @@ static public EnvelopeType change2JaxbClass(IndoorGMLMap savedMap, Envelope feat } if (upper != null) { PointType point = Convert2JaxbGeometry.Convert2PointType(upper); - + newFeature.setUpperCorner(point.getPos()); } newFeature.setSrsName(feature.getSrsName()); @@ -491,8 +491,8 @@ static PrimalSpaceFeaturesType change2JaxbClass(IndoorGMLMap savedMap, PrimalSpa for (int i = 0; i < feature.getCellSpaceMember().size(); i++) { if (feature.getCellSpaceMember().get(i).getClass().getSimpleName().equals("GeneralSpace")) { - - + + GeneralSpace tempcellspace = (GeneralSpace) savedMap.getFeature(feature.getCellSpaceMember().get(i).getId()); CellSpaceMemberType tempcellspacemember = indoorgmlcoreOF.createCellSpaceMemberType(); tempcellspacemember.setCellSpace( @@ -500,7 +500,7 @@ static PrimalSpaceFeaturesType change2JaxbClass(IndoorGMLMap savedMap, PrimalSpa cellspacemember.add(tempcellspacemember); } else if (feature.getCellSpaceMember().get(i).getClass().getSimpleName().equals("TransitionSpace")) { - + TransitionSpace tempcellspace = (TransitionSpace) savedMap .getFeature(feature.getCellSpaceMember().get(i).getId()); CellSpaceMemberType tempcellspacemember = indoorgmlcoreOF.createCellSpaceMemberType(); @@ -508,7 +508,7 @@ static PrimalSpaceFeaturesType change2JaxbClass(IndoorGMLMap savedMap, PrimalSpa indoorgmlnaviOF.createTransitionSpace(change2JaxbClass(savedMap, tempcellspace))); cellspacemember.add(tempcellspacemember); } else if (feature.getCellSpaceMember().get(i).getClass().getSimpleName().equals("ConnectionSpace")) { - + ConnectionSpace tempcellspace = (ConnectionSpace) savedMap .getFeature(feature.getCellSpaceMember().get(i).getId()); CellSpaceMemberType tempcellspacemember = indoorgmlcoreOF.createCellSpaceMemberType(); @@ -517,7 +517,7 @@ static PrimalSpaceFeaturesType change2JaxbClass(IndoorGMLMap savedMap, PrimalSpa cellspacemember.add(tempcellspacemember); } else if (feature.getCellSpaceMember().get(i).getClass().getSimpleName().equals("AnchorSpace")) { - + AnchorSpace tempcellspace = (AnchorSpace) savedMap .getFeature(feature.getCellSpaceMember().get(i).getId()); CellSpaceMemberType tempcellspacemember = indoorgmlcoreOF.createCellSpaceMemberType(); @@ -526,7 +526,7 @@ static PrimalSpaceFeaturesType change2JaxbClass(IndoorGMLMap savedMap, PrimalSpa cellspacemember.add(tempcellspacemember); } else { - + CellSpace tempcellspace = (CellSpace) savedMap .getFeature(feature.getCellSpaceMember().get(i).getId()); CellSpaceMemberType tempcellspacemember = indoorgmlcoreOF.createCellSpaceMemberType(); @@ -540,28 +540,28 @@ static PrimalSpaceFeaturesType change2JaxbClass(IndoorGMLMap savedMap, PrimalSpa if (feature.getCellSpaceBoundaryMember() != null) { for (int i = 0; i < feature.getCellSpaceBoundaryMember().size(); i++) { - + if (feature.getCellSpaceBoundaryMember().get(i).getClass().getSimpleName().equals("AnchorBoundary")) { - + AnchorBoundary tempcellspace = (AnchorBoundary) savedMap.getFeature(feature.getCellSpaceBoundaryMember().get(i).getId()); CellSpaceBoundaryMemberType tempcellspacemember = indoorgmlcoreOF.createCellSpaceBoundaryMemberType(); tempcellspacemember.setCellSpaceBoundary(indoorgmlnaviOF.createAnchorBoundary(change2JaxbClass(savedMap, tempcellspace))); cellspaceboundarymember.add(tempcellspacemember); } else if(feature.getCellSpaceBoundaryMember().get(i).getClass().getSimpleName().equals("ConnectionBoundary")) { - + ConnectionBoundary tempcellspace = (ConnectionBoundary) savedMap.getFeature(feature.getCellSpaceBoundaryMember().get(i).getId()); CellSpaceBoundaryMemberType tempcellspacemember = indoorgmlcoreOF.createCellSpaceBoundaryMemberType(); tempcellspacemember.setCellSpaceBoundary(indoorgmlnaviOF.createConnectionBoundary(change2JaxbClass(savedMap, tempcellspace))); cellspaceboundarymember.add(tempcellspacemember); } else { - + CellSpaceBoundary tempcellspace = (CellSpaceBoundary) savedMap .getFeature(feature.getCellSpaceBoundaryMember().get(i).getId()); CellSpaceBoundaryMemberType tempcellspacemember = indoorgmlcoreOF.createCellSpaceBoundaryMemberType(); tempcellspacemember.setCellSpaceBoundary(indoorgmlcoreOF.createCellSpaceBoundary(change2JaxbClass(savedMap, tempcellspace))); - cellspaceboundarymember.add(tempcellspacemember); + cellspaceboundarymember.add(tempcellspacemember); } } @@ -678,7 +678,7 @@ static TransitionType change2JaxbClass(IndoorGMLMap savedMap, Transition feature } public static GeneralSpaceType change2JaxbClass(IndoorGMLMap savedMap, GeneralSpace feature) throws JAXBException { - + GeneralSpaceType newFeature = indoorgmlnaviOF.createGeneralSpaceType(); StatePropertyType duality = new StatePropertyType(); @@ -706,19 +706,19 @@ public static GeneralSpaceType change2JaxbClass(IndoorGMLMap savedMap, GeneralSp CodeType e = new CodeType(); e.setValue(feature.getClassType()); newFeature.setClazz(e); - + } if (feature.getFunctionType() != null) { CodeType e = new CodeType(); e.setValue(feature.getFunctionType()); newFeature.setFunction(e); - + } if (feature.getUsageType() != null) { CodeType e = new CodeType(); e.setValue(feature.getUsageType()); newFeature.setUsage(e); - + } newFeature.setId(feature.getId()); @@ -771,7 +771,7 @@ public static GeneralSpaceType change2JaxbClass(IndoorGMLMap savedMap, GeneralSp } public static TransitionSpaceType change2JaxbClass(IndoorGMLMap savedMap, TransitionSpace feature) throws JAXBException { - + TransitionSpaceType newFeature = indoorgmlnaviOF.createTransitionSpaceType(); StatePropertyType duality = new StatePropertyType(); @@ -799,13 +799,13 @@ public static TransitionSpaceType change2JaxbClass(IndoorGMLMap savedMap, Transi CodeType e = new CodeType(); e.setValue(feature.getClassType()); newFeature.setClazz(e); - + } if (feature.getFunctionType() != null) { CodeType e = new CodeType(); e.setValue(feature.getFunctionType()); newFeature.setFunction(e); - + } if (feature.getUsageType() != null) { CodeType e = new CodeType(); @@ -863,7 +863,7 @@ public static TransitionSpaceType change2JaxbClass(IndoorGMLMap savedMap, Transi public static ConnectionSpaceType change2JaxbClass(IndoorGMLMap savedMap, ConnectionSpace feature) throws JAXBException { - + ConnectionSpaceType newFeature = indoorgmlnaviOF.createConnectionSpaceType(); StatePropertyType duality = new StatePropertyType(); @@ -891,19 +891,19 @@ public static ConnectionSpaceType change2JaxbClass(IndoorGMLMap savedMap, Connec CodeType e = new CodeType(); e.setValue(feature.getClassType()); newFeature.setClazz(e); - + } if (feature.getFunctionType() != null) { CodeType e = new CodeType(); e.setValue(feature.getFunctionType()); newFeature.setFunction(e); - + } if (feature.getUsageType() != null) { CodeType e = new CodeType(); e.setValue(feature.getUsageType()); newFeature.setUsage(e); - + } newFeature.setId(feature.getId()); @@ -956,7 +956,7 @@ public static ConnectionSpaceType change2JaxbClass(IndoorGMLMap savedMap, Connec } public static AnchorSpaceType change2JaxbClass(IndoorGMLMap savedMap, AnchorSpace feature) throws JAXBException { - + AnchorSpaceType newFeature = indoorgmlnaviOF.createAnchorSpaceType(); StatePropertyType duality = new StatePropertyType(); @@ -984,19 +984,19 @@ public static AnchorSpaceType change2JaxbClass(IndoorGMLMap savedMap, AnchorSpac CodeType e = new CodeType(); e.setValue(feature.getClassType()); newFeature.setClazz(e); - + } if (feature.getFunctionType() != null) { CodeType e = new CodeType(); e.setValue(feature.getFunctionType()); newFeature.setFunction(e); - + } if (feature.getUsageType() != null) { CodeType e = new CodeType(); e.setValue(feature.getUsageType()); newFeature.setUsage(e); - + } newFeature.setId(feature.getId()); diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JaxbGeometry.java b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JaxbGeometry.java index 8f94270..834e70a 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JaxbGeometry.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2JaxbGeometry.java @@ -1,178 +1,178 @@ -package edu.pnu.stem.binder; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBElement; - -import org.locationtech.jts.geom.Coordinate; -import org.locationtech.jts.geom.LineString; -import org.locationtech.jts.geom.LinearRing; -import org.locationtech.jts.geom.MultiPolygon; -import org.locationtech.jts.geom.Point; -import org.locationtech.jts.geom.Polygon; - -import com.vividsolutions.jts.geom.Envelope; - -import edu.pnu.stem.geometry.jts.Envelope3D; -import edu.pnu.stem.geometry.jts.Solid; -import edu.pnu.stem.util.GeometryUtil; -import net.opengis.gml.v_3_2_1.AbstractRingPropertyType; -import net.opengis.gml.v_3_2_1.DirectPositionListType; -import net.opengis.gml.v_3_2_1.DirectPositionType; -import net.opengis.gml.v_3_2_1.EnvelopeType; -import net.opengis.gml.v_3_2_1.LineStringType; -import net.opengis.gml.v_3_2_1.LinearRingType; -import net.opengis.gml.v_3_2_1.PointType; -import net.opengis.gml.v_3_2_1.PolygonType; -import net.opengis.gml.v_3_2_1.ShellPropertyType; -import net.opengis.gml.v_3_2_1.ShellType; -import net.opengis.gml.v_3_2_1.SolidType; -import net.opengis.gml.v_3_2_1.SurfacePropertyType; - -public class Convert2JaxbGeometry { - private final static net.opengis.gml.v_3_2_1.ObjectFactory gmlFactory = new net.opengis.gml.v_3_2_1.ObjectFactory(); - - public static SolidType Convert2SolidType(Solid feature){ - MultiPolygon shell = feature.getShell(); +package edu.pnu.stem.binder; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBElement; + +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.LineString; +import org.locationtech.jts.geom.LinearRing; +import org.locationtech.jts.geom.MultiPolygon; +import org.locationtech.jts.geom.Point; +import org.locationtech.jts.geom.Polygon; + +import com.vividsolutions.jts.geom.Envelope; + +import edu.pnu.stem.geometry.jts.Envelope3D; +import edu.pnu.stem.geometry.jts.Solid; +import edu.pnu.stem.util.GeometryUtil; +import net.opengis.gml.v_3_2_1.AbstractRingPropertyType; +import net.opengis.gml.v_3_2_1.DirectPositionListType; +import net.opengis.gml.v_3_2_1.DirectPositionType; +import net.opengis.gml.v_3_2_1.EnvelopeType; +import net.opengis.gml.v_3_2_1.LineStringType; +import net.opengis.gml.v_3_2_1.LinearRingType; +import net.opengis.gml.v_3_2_1.PointType; +import net.opengis.gml.v_3_2_1.PolygonType; +import net.opengis.gml.v_3_2_1.ShellPropertyType; +import net.opengis.gml.v_3_2_1.ShellType; +import net.opengis.gml.v_3_2_1.SolidType; +import net.opengis.gml.v_3_2_1.SurfacePropertyType; + +public class Convert2JaxbGeometry { + private final static net.opengis.gml.v_3_2_1.ObjectFactory gmlFactory = new net.opengis.gml.v_3_2_1.ObjectFactory(); + + public static SolidType Convert2SolidType(Solid feature){ + MultiPolygon shell = feature.getShell(); MultiPolygon[] holes = feature.getHoles(); - SolidType newFeature = gmlFactory.createSolidType(); - - ShellType exteriorShellType = Convert2ShellType(shell); - - ShellPropertyType shellProp = gmlFactory.createShellPropertyType(); - shellProp.setShell(exteriorShellType); - - newFeature.setExterior(shellProp); - - if(holes!=null) { - List holesPropList = new ArrayList(); - int index = 0; - for(MultiPolygon mp : holes) { - - ShellType interiorShellType = Convert2ShellType(mp); - ShellPropertyType inshellProp = gmlFactory.createShellPropertyType(); - inshellProp.setShell(interiorShellType); - holesPropList.add(inshellProp); - } - newFeature.setInterior(holesPropList); - } - - newFeature.setId(GeometryUtil.getMetadata(feature, "id")); - + SolidType newFeature = gmlFactory.createSolidType(); + + ShellType exteriorShellType = Convert2ShellType(shell); + + ShellPropertyType shellProp = gmlFactory.createShellPropertyType(); + shellProp.setShell(exteriorShellType); + + newFeature.setExterior(shellProp); + + if(holes!=null) { + List holesPropList = new ArrayList(); + int index = 0; + for(MultiPolygon mp : holes) { + + ShellType interiorShellType = Convert2ShellType(mp); + ShellPropertyType inshellProp = gmlFactory.createShellPropertyType(); + inshellProp.setShell(interiorShellType); + holesPropList.add(inshellProp); + } + newFeature.setInterior(holesPropList); + } + + newFeature.setId(GeometryUtil.getMetadata(feature, "id")); + return newFeature; - } - - public static ShellType Convert2ShellType(MultiPolygon feature){ - List surfaceProps = new ArrayList(); - ShellType newFeature = gmlFactory.createShellType(); - for(int i = 0 ; i < feature.getNumGeometries() ; i++){ - Polygon p = (Polygon) feature.getGeometryN(i); - PolygonType s = Convert2SurfaceType(p); - SurfacePropertyType sProp = gmlFactory.createSurfacePropertyType(); - sProp.setAbstractSurface(gmlFactory.createPolygon(s)); - surfaceProps.add(sProp); - } - - newFeature.setSurfaceMember(surfaceProps); - return newFeature; - } - - public static PolygonType Convert2SurfaceType(Polygon feature){ - PolygonType newFeature = gmlFactory.createPolygonType(); - - LinearRingType extRing = Convert2LinearRingType((LinearRing)feature.getExteriorRing()); - AbstractRingPropertyType extProp = gmlFactory.createAbstractRingPropertyType(); - extProp.setAbstractRing(gmlFactory.createLinearRing(extRing)); - newFeature.setExterior(extProp); - - int numofIntRing = feature.getNumInteriorRing(); - if(numofIntRing!= 0) { - List intProp = new ArrayList(); - for(int i = 0 ; i < numofIntRing; i++) { - LinearRingType tempIntRing = Convert2LinearRingType((LinearRing)feature.getInteriorRingN(i)); - AbstractRingPropertyType singleintProp = gmlFactory.createAbstractRingPropertyType(); - singleintProp.setAbstractRing(gmlFactory.createLinearRing(tempIntRing)); - intProp.add(singleintProp); - } - newFeature.setInterior(intProp); - } - - - if(feature.getNumInteriorRing() > 0) { - //TODO - } - newFeature.setId(GeometryUtil.getMetadata(feature, "id")); - return newFeature; - } - - public static LinearRingType Convert2LinearRingType(LinearRing feature){ - LinearRingType newFeature = gmlFactory.createLinearRingType(); - - List> dpList = new ArrayList>(); - for(int i = 0 ; i < feature.getCoordinates().length; i++){ - Coordinate c = feature.getCoordinates()[i]; - JAXBElement dpt = gmlFactory.createPos(Convert2CoordinateType(c, feature.getDimension())); - dpList.add(dpt); - } - - newFeature.setPosOrPointPropertyOrPointRep(dpList); + } + + public static ShellType Convert2ShellType(MultiPolygon feature){ + List surfaceProps = new ArrayList(); + ShellType newFeature = gmlFactory.createShellType(); + for(int i = 0 ; i < feature.getNumGeometries() ; i++){ + Polygon p = (Polygon) feature.getGeometryN(i); + PolygonType s = Convert2SurfaceType(p); + SurfacePropertyType sProp = gmlFactory.createSurfacePropertyType(); + sProp.setAbstractSurface(gmlFactory.createPolygon(s)); + surfaceProps.add(sProp); + } + + newFeature.setSurfaceMember(surfaceProps); + return newFeature; + } + + public static PolygonType Convert2SurfaceType(Polygon feature){ + PolygonType newFeature = gmlFactory.createPolygonType(); + + LinearRingType extRing = Convert2LinearRingType((LinearRing)feature.getExteriorRing()); + AbstractRingPropertyType extProp = gmlFactory.createAbstractRingPropertyType(); + extProp.setAbstractRing(gmlFactory.createLinearRing(extRing)); + newFeature.setExterior(extProp); + + int numofIntRing = feature.getNumInteriorRing(); + if(numofIntRing!= 0) { + List intProp = new ArrayList(); + for(int i = 0 ; i < numofIntRing; i++) { + LinearRingType tempIntRing = Convert2LinearRingType((LinearRing)feature.getInteriorRingN(i)); + AbstractRingPropertyType singleintProp = gmlFactory.createAbstractRingPropertyType(); + singleintProp.setAbstractRing(gmlFactory.createLinearRing(tempIntRing)); + intProp.add(singleintProp); + } + newFeature.setInterior(intProp); + } + + + if(feature.getNumInteriorRing() > 0) { + //TODO + } + newFeature.setId(GeometryUtil.getMetadata(feature, "id")); return newFeature; - } - + } + + public static LinearRingType Convert2LinearRingType(LinearRing feature){ + LinearRingType newFeature = gmlFactory.createLinearRingType(); + + List> dpList = new ArrayList>(); + for(int i = 0 ; i < feature.getCoordinates().length; i++){ + Coordinate c = feature.getCoordinates()[i]; + JAXBElement dpt = gmlFactory.createPos(Convert2CoordinateType(c, feature.getDimension())); + dpList.add(dpt); + } + + newFeature.setPosOrPointPropertyOrPointRep(dpList); + return newFeature; + } + public static LineStringType Convert2LineStringType(LineString feature){ - LineStringType newFeature = gmlFactory.createLineStringType(); - - List> dpList = new ArrayList>(); - for(int i = 0 ; i < feature.getCoordinates().length; i++){ - Coordinate c = feature.getCoordinates()[i]; - JAXBElement dpt = gmlFactory.createPos(Convert2CoordinateType(c, feature.getDimension())); - dpList.add(dpt); - } - - newFeature.setPosOrPointPropertyOrPointRep(dpList); - newFeature.setId(GeometryUtil.getMetadata(feature, "id")); + LineStringType newFeature = gmlFactory.createLineStringType(); + + List> dpList = new ArrayList>(); + for(int i = 0 ; i < feature.getCoordinates().length; i++){ + Coordinate c = feature.getCoordinates()[i]; + JAXBElement dpt = gmlFactory.createPos(Convert2CoordinateType(c, feature.getDimension())); + dpList.add(dpt); + } + + newFeature.setPosOrPointPropertyOrPointRep(dpList); + newFeature.setId(GeometryUtil.getMetadata(feature, "id")); return newFeature; } - - public static PointType Convert2PointType(Point feature){ - PointType newFeature = gmlFactory.createPointType(); - newFeature.setPos(Convert2CoordinateType(feature.getCoordinateSequence().getCoordinate(0), feature.getDimension())); - newFeature.setId(GeometryUtil.getMetadata(feature, "id")); + + public static PointType Convert2PointType(Point feature){ + PointType newFeature = gmlFactory.createPointType(); + newFeature.setPos(Convert2CoordinateType(feature.getCoordinateSequence().getCoordinate(0), feature.getDimension())); + newFeature.setId(GeometryUtil.getMetadata(feature, "id")); return newFeature; - } - - public DirectPositionListType Convert2DirectPositionType(Coordinate[] feature){ - DirectPositionListType newFeature = gmlFactory.createDirectPositionListType(); - return newFeature; - } - public static DirectPositionType Convert2CoordinateType(Coordinate feature, int dimension){ - DirectPositionType newFeature = gmlFactory.createDirectPositionType(); - int count = 0; - for (char ch: feature.toString().toCharArray()) { - if (ch == ',') { - count++; - } - } - if(count == 1){ - List points = new ArrayList(); - points.add(feature.x); - points.add(feature.y); - newFeature.setValue(points); - } - else if(count == 2){ - Listpoints = new ArrayList(); - points.add(feature.x); - points.add(feature.y); - points.add(feature.z); - newFeature.setValue(points); - } - count++; - BigInteger d = BigInteger.valueOf((long)count); - newFeature.setSrsDimension(d); - return newFeature; - } - - + } + + public DirectPositionListType Convert2DirectPositionType(Coordinate[] feature){ + DirectPositionListType newFeature = gmlFactory.createDirectPositionListType(); + return newFeature; + } + public static DirectPositionType Convert2CoordinateType(Coordinate feature, int dimension){ + DirectPositionType newFeature = gmlFactory.createDirectPositionType(); + int count = 0; + for (char ch: feature.toString().toCharArray()) { + if (ch == ',') { + count++; + } + } + if(count == 1){ + List points = new ArrayList(); + points.add(feature.x); + points.add(feature.y); + newFeature.setValue(points); + } + else if(count == 2){ + Listpoints = new ArrayList(); + points.add(feature.x); + points.add(feature.y); + points.add(feature.z); + newFeature.setValue(points); + } + count++; + BigInteger d = BigInteger.valueOf((long)count); + newFeature.setSrsDimension(d); + return newFeature; + } + + } diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2Json.java b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2Json.java index ddd7b71..4d3022d 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2Json.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/Convert2Json.java @@ -466,15 +466,15 @@ public static ObjectNode convert2JSON(IndoorGMLMap map, Envelope target) { properties.put("srsDimension", target.getSrsDimension()); } - + if (target.getDescription() != null) { if (properties == null) { properties = JsonNodeFactory.instance.objectNode(); } properties.put("description", target.getDescription()); } - - + + return result; } diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/IndoorGMLMap.java b/igml-feature/src/main/java/edu/pnu/stem/binder/IndoorGMLMap.java index fe8f6f6..4265ab5 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/IndoorGMLMap.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/IndoorGMLMap.java @@ -16,14 +16,14 @@ public class IndoorGMLMap implements Serializable { protected ConcurrentHashMap> collection; private String docId; - + public IndoorGMLMap() { this.collection = new ConcurrentHashMap>(); setFeatureClassContainer(); } private void setFeatureClassContainer() { - + collection.put("ID", new ConcurrentHashMap()); collection.put("FutureID", new ConcurrentHashMap()); collection.put("IndoorFeatures", new ConcurrentHashMap()); @@ -42,18 +42,18 @@ private void setFeatureClassContainer() { collection.put("State", new ConcurrentHashMap()); collection.put("Reference", new ConcurrentHashMap()); collection.put("Envelope", new ConcurrentHashMap()); - collection.put("Geometry", new ConcurrentHashMap()); - + collection.put("Geometry", new ConcurrentHashMap()); + collection.put("GeneralSpace", new ConcurrentHashMap()); collection.put("TransitionSpace", new ConcurrentHashMap()); collection.put("ConnectionSpace", new ConcurrentHashMap()); collection.put("AnchorSpace", new ConcurrentHashMap()); - + collection.put("ConnectionBoundary", new ConcurrentHashMap()); collection.put("AnchorBoundary", new ConcurrentHashMap()); } - + public void clearMap() { collection.clear(); } @@ -66,7 +66,7 @@ public boolean hasID(String id) { } return flag; } - + public boolean hasFutureID(String id){ boolean flag = false; ConcurrentHashMap idContainer = getFeatureContainer("FutureID"); @@ -75,25 +75,25 @@ public boolean hasFutureID(String id){ } return flag; } - + public void setFutureFeature(String id, String featureName){ if(!hasID(id)){ collection.get("FutureID").put(id, featureName); //System.out.println("Do not forget to create the feature id : "+id+" later : " + featureName); } } - - public void setFutureFeature(String id, Object feature){ + + public void setFutureFeature(String id, Object feature){ collection.get("FutureID").put(id, feature); //System.out.println("Do not forget to create the feature id : "+id+" later"); } - + private void setID(String id, String featureName) { if(!hasID(id)){ getFeatureContainer("ID").put(id, featureName); } } - + public void removeFeature(String id) { if(hasID(id)) { String featurename = (String)collection.get("ID").get(id); @@ -101,22 +101,22 @@ public void removeFeature(String id) { removeID(id); } } - + public void removeFutureID(String id){ getFeatureContainer("FutureID").remove(id); //System.out.println("Remove Future ID : "+id); } - + private void removeID(String id){ getFeatureContainer("ID").remove(id); } - + public String getFeatureNameFromID(String id) { ConcurrentHashMap idContainer = getFeatureContainer("id"); String featureName = (String) idContainer.get(id); return featureName; } - + public ConcurrentHashMap getFeatureContainer(String featureName) { ConcurrentHashMap newFeatureContainer = null; @@ -132,7 +132,7 @@ public static Object getFeature(String id) { return Container.getInstance().getFeature(docId, id); } */ - + public Object getFeature(String id){ Object newFeature = null; if(hasID(id)){ @@ -144,7 +144,7 @@ public Object getFeature(String id){ } return newFeature; } - + public Object getFutureFeature(String id){ Object newFeature = null; if(hasFutureID(id)){ @@ -155,8 +155,8 @@ public Object getFutureFeature(String id){ } return newFeature; } - - + + // TODO : Merge those two functions with feature setter and getter public Geometry getFeature4Geometry(String id){ ConcurrentHashMap geomContainer = collection.get("Geometry"); @@ -181,7 +181,7 @@ public void setFeature4Geometry(String id, Geometry geom){ //Excpetion } } - + public void setFeature(String id, String featureName, Object featureValue){ if(!hasID(id)){ if(hasFutureID(id)){ @@ -194,12 +194,12 @@ public void setFeature(String id, String featureName, Object featureValue){ } else{ System.out.println("Already Exist Id : " + id+", Feature :" + featureName ); - + //container.get(featureName).put(id, featureValue); } } - - + + public void setReference(String id){ if(hasID(id)){ ConcurrentHashMap referenceContainer = getFeatureContainer("Reference"); @@ -216,21 +216,21 @@ public void setReference(String id){ } public void setDocId(String id) { - this.docId = id; + this.docId = id; } public String getDocId(){ return new String(this.docId); } - + public void Marshall(String path) { - - + + Enumeration fe = collection.get("IndoorFeatures").elements(); IndoorFeatures features = null; if(fe.hasMoreElements()) { features = (IndoorFeatures) fe.nextElement(); - - + + IndoorFeaturesType resultDoc; try { resultDoc = edu.pnu.stem.binder.Convert2JaxbClass.change2JaxbClass(this, features); diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/JaxbUtil.java b/igml-feature/src/main/java/edu/pnu/stem/binder/JaxbUtil.java index aeb20c2..f5e578f 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/JaxbUtil.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/JaxbUtil.java @@ -7,18 +7,18 @@ public class JaxbUtil { public static JAXBContext createIndoorGMLContext() throws JAXBException { JAXBContext context = JAXBContext.newInstance( - "net.opengis.indoorgml.core.v_1_0" + - ":org.w3.XMLSchema" + - ":net.opengis.gml.v_3_2" + + "net.opengis.indoorgml.core.v_1_0" + + ":org.w3.XMLSchema" + + ":net.opengis.gml.v_3_2" + ":org.w3.xlink"); return context; } public static JAXBContext createGMLContext() throws JAXBException { JAXBContext context = JAXBContext.newInstance( - "net.opengis.gml.v_3_2" + - ":org.w3.XMLSchema" + - ":net.ascc.xml.schematron" + + "net.opengis.gml.v_3_2" + + ":org.w3.XMLSchema" + + ":net.ascc.xml.schematron" + ":org.w3.xlink"); return context; } diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/Mashaller.java b/igml-feature/src/main/java/edu/pnu/stem/binder/Mashaller.java index 101da54..ba5db74 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/Mashaller.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/Mashaller.java @@ -25,7 +25,7 @@ public static void exportIndoorGMLCore(Properties props, String id, String fileP //IndoorFeaturesType indoorFeaturesType = Convert2JaxbClass.change2JaxbClass((IndoorFeatures)Convert2FeatureClass.docContainer.getFeature(id)); //marshalIndoorFeatures(filePath, indoorFeaturesType); } - + public static void marshalDocument(String path, IndoorGMLMap map) throws JAXBException, IOException { ConcurrentHashMap indoorfeatures = map.getFeatureContainer("IndoorFeatures"); String indoorfeaturesId = null; diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/SymbolListener.java b/igml-feature/src/main/java/edu/pnu/stem/binder/SymbolListener.java index c4f9742..be6751c 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/SymbolListener.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/SymbolListener.java @@ -11,18 +11,18 @@ * */ public class SymbolListener extends javax.xml.bind.Unmarshaller.Listener { - + private Map idRegistryMap; private Map parentMap; private Map referenceRegistryMap; - + /** * AbstractGML Type */ private final Class _GMLType; - + /** - * + * */ public SymbolListener(Class abstractGMLType) { this.idRegistryMap = new HashMap(); @@ -39,19 +39,19 @@ public void afterUnmarshal(Object target, Object parent) { if(href != null) { href = href.replaceAll("#", ""); /*System.out.println("XLink : " + href);*/ - + //System.out.println("xlink target : " + target.getClass()); - + referenceRegistryMap.put(href, target); - + } } catch ( Exception e ) { //e.printStackTrace(); } try { - /* + /* if(target instanceof net.opengis.gml.v_3_1_1.AbstractGMLType) { String gmlId = ((net.opengis.gml.v_3_1_1.AbstractGMLType) target).getId(); if( gmlId != null ) { @@ -69,7 +69,7 @@ public void afterUnmarshal(Object target, Object parent) { idRegistryMap.put(gmlId, target); parentMap.put(target, parent); /*System.out.println("GMLID : " + gmlId);*/ - + //System.out.println("gml target : " + target.getClass()); } } @@ -77,7 +77,7 @@ public void afterUnmarshal(Object target, Object parent) { //e.printStackTrace(); } } - + public XLinkSymbolMap getSymbolMap() { return new XLinkSymbolMap(idRegistryMap, parentMap, referenceRegistryMap); } diff --git a/igml-feature/src/main/java/edu/pnu/stem/binder/package-info.java b/igml-feature/src/main/java/edu/pnu/stem/binder/package-info.java index e88810d..edb249f 100644 --- a/igml-feature/src/main/java/edu/pnu/stem/binder/package-info.java +++ b/igml-feature/src/main/java/edu/pnu/stem/binder/package-info.java @@ -1,5 +1,5 @@ /** - * + * */ /** * @author jungh diff --git a/npm-debug.log b/npm-debug.log deleted file mode 100644 index 4e6b9e1..0000000 --- a/npm-debug.log +++ /dev/null @@ -1,23 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', -1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', -1 verbose cli 'start' ] -2 info using npm@3.10.8 -3 info using node@v6.9.1 -4 verbose config Skipping project config: C:\Users\stem/.npmrc. (matches userconfig) -5 verbose stack Error: ENOENT: no such file or directory, open 'C:\Users\stem\package.json' -5 verbose stack at Error (native) -6 verbose cwd C:\Users\stem\Documents\TEST\InFactory-master -7 error Windows_NT 10.0.18362 -8 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" -9 error node v6.9.1 -10 error npm v3.10.8 -11 error path C:\Users\stem\package.json -12 error code ENOENT -13 error errno -4058 -14 error syscall open -15 error enoent ENOENT: no such file or directory, open 'C:\Users\stem\package.json' -16 error enoent ENOENT: no such file or directory, open 'C:\Users\stem\package.json' -16 error enoent This is most likely not a problem with npm itself -16 error enoent and is related to npm not being able to find a file. -17 verbose exit [ -4058, true ]