├── .classpath
├── .gitignore
├── .project
├── lib
├── JTS_Test.jar
├── acme.jar
├── activation.jar
├── citygml4j.jar
├── commons-io-2.1.jar
├── commons-math3-3.3-javadoc.jar
├── commons-math3-3.3.jar
├── jaxb-api.jar
├── jaxb-impl.jar
├── jaxb-xjc.jar
├── jcoord-1.1-b.jar
├── jdom.jar
├── jsr173_1.0_api.jar
├── jts-1.8.jar
├── jtsio-1.8.jar
├── junit.jar
├── openifctools.com.openifcjavatoolbox_1.0.1_20111129.jar
├── sjsxp.jar
└── xerces.jar
└── src
├── ObjectIdDiagrams
├── main.ucls
├── sbm-ifc.ucls
└── sbm.ucls
└── co
└── edu
└── udistrital
└── bim2gis4j
├── bim2gisbm
├── Coordenada.java
├── Edificio.java
├── Muro.java
├── Piso.java
├── Plancha.java
├── Poligono.java
├── Rectangulo.java
├── Segmento.java
└── Vacio.java
├── ifc
├── Axis2Placement3D.java
├── Placement.java
├── PlanoDeCorte.java
├── Representation.java
└── Solido.java
├── main
└── Main.java
├── samples
├── Lod2.java
├── Lod3.java
├── PruebaAngulo2Vectores.java
├── PruebaCentroide.java
├── PruebaCommonsMath.java
├── PruebaSentidoHorario.java
└── PruebaSiluetaMuro.java
└── util
├── BuildingCreator.java
├── ComparadorAngulos.java
├── LatLonConvert.java
├── LectorAxis2Placement3D.java
├── LectorCoordenada.java
├── LectorModeloIfc.java
├── LectorMuros.java
├── LectorPlanchas.java
├── LectorRepresentation.java
├── LectorVacios.java
├── OperacionesBooleanas3D.java
└── Transformador.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | BIM2GIS4J
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/lib/JTS_Test.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/JTS_Test.jar
--------------------------------------------------------------------------------
/lib/acme.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/acme.jar
--------------------------------------------------------------------------------
/lib/activation.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/activation.jar
--------------------------------------------------------------------------------
/lib/citygml4j.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/citygml4j.jar
--------------------------------------------------------------------------------
/lib/commons-io-2.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/commons-io-2.1.jar
--------------------------------------------------------------------------------
/lib/commons-math3-3.3-javadoc.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/commons-math3-3.3-javadoc.jar
--------------------------------------------------------------------------------
/lib/commons-math3-3.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/commons-math3-3.3.jar
--------------------------------------------------------------------------------
/lib/jaxb-api.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/jaxb-api.jar
--------------------------------------------------------------------------------
/lib/jaxb-impl.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/jaxb-impl.jar
--------------------------------------------------------------------------------
/lib/jaxb-xjc.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/jaxb-xjc.jar
--------------------------------------------------------------------------------
/lib/jcoord-1.1-b.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/jcoord-1.1-b.jar
--------------------------------------------------------------------------------
/lib/jdom.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/jdom.jar
--------------------------------------------------------------------------------
/lib/jsr173_1.0_api.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/jsr173_1.0_api.jar
--------------------------------------------------------------------------------
/lib/jts-1.8.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/jts-1.8.jar
--------------------------------------------------------------------------------
/lib/jtsio-1.8.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/jtsio-1.8.jar
--------------------------------------------------------------------------------
/lib/junit.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/junit.jar
--------------------------------------------------------------------------------
/lib/openifctools.com.openifcjavatoolbox_1.0.1_20111129.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/openifctools.com.openifcjavatoolbox_1.0.1_20111129.jar
--------------------------------------------------------------------------------
/lib/sjsxp.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/sjsxp.jar
--------------------------------------------------------------------------------
/lib/xerces.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/lib/xerces.jar
--------------------------------------------------------------------------------
/src/ObjectIdDiagrams/main.ucls:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
15 |
16 |
18 |
19 |
20 |
21 |
22 |
24 |
25 |
27 |
28 |
29 |
30 |
31 |
33 |
34 |
36 |
37 |
38 |
39 |
40 |
42 |
43 |
45 |
46 |
47 |
48 |
49 |
52 |
53 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/src/ObjectIdDiagrams/sbm-ifc.ucls:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
16 |
17 |
19 |
20 |
21 |
22 |
23 |
26 |
27 |
29 |
30 |
31 |
32 |
33 |
35 |
36 |
38 |
39 |
40 |
41 |
42 |
45 |
46 |
48 |
49 |
50 |
51 |
52 |
55 |
56 |
58 |
59 |
60 |
61 |
62 |
65 |
66 |
68 |
69 |
70 |
71 |
72 |
74 |
75 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
163 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/src/ObjectIdDiagrams/sbm.ucls:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
15 |
16 |
18 |
19 |
20 |
21 |
22 |
24 |
25 |
27 |
28 |
29 |
30 |
31 |
33 |
34 |
36 |
37 |
38 |
39 |
40 |
42 |
43 |
45 |
46 |
47 |
48 |
49 |
51 |
52 |
54 |
55 |
56 |
57 |
58 |
60 |
61 |
63 |
64 |
65 |
66 |
67 |
69 |
70 |
72 |
73 |
74 |
75 |
76 |
78 |
79 |
81 |
82 |
83 |
84 |
85 |
87 |
88 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
216 |
217 |
218 |
219 |
220 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Coordenada.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.bim2gisbm;
2 |
3 | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
4 |
5 | public class Coordenada /*implements Comparable*/ {
6 |
7 | double x;
8 | double y;
9 | double z;
10 |
11 | //si dos coordenadas tienen una distancia menor a la tolerancia se consideran iguales
12 | public static double tolerancia = 0.001;
13 |
14 | public Coordenada(){
15 | x = 0;
16 | y = 0;
17 | z = 0;
18 | }
19 |
20 | public Coordenada(double X, double Y, double Z){
21 | x = X;
22 | y = Y;
23 | z = Z;
24 | }
25 |
26 | public Coordenada(Vector3D vector){
27 | x = vector.getX();
28 | y = vector.getY();
29 | z = vector.getZ();
30 | }
31 |
32 | public double getX() {
33 | return x;
34 | }
35 | public void setX(double x) {
36 | this.x = x;
37 | }
38 | public double getY() {
39 | return y;
40 | }
41 | public void setY(double y) {
42 | this.y = y;
43 | }
44 | public double getZ() {
45 | return z;
46 | }
47 | public void setZ(double z) {
48 | this.z = z;
49 | }
50 |
51 | @Override
52 | public String toString(){
53 | return "( " + getX() + ", " + getY() + ", " + getZ() + " )";
54 | }
55 |
56 | public Vector3D toVector3D(){
57 | return new Vector3D(x,y,z);
58 | }
59 |
60 | public boolean esIgual(Coordenada c){
61 | boolean r = false;
62 |
63 | if( x==c.x && y==c.y && z == c.z) r = true;
64 |
65 | return r;
66 | }
67 |
68 |
69 | //se usa para evitar coordenadas repetidas dentro del mismo poligono
70 | @Override
71 | public boolean equals(Object otraCoordenada){
72 |
73 | boolean r = false;
74 |
75 | Coordenada otra = (Coordenada) otraCoordenada;
76 | double distancia = this.toVector3D().distance(otra.toVector3D());
77 |
78 | if(distancia <= tolerancia){
79 | r = true;
80 | }
81 |
82 |
83 | return r;
84 |
85 |
86 | }
87 |
88 |
89 | /*
90 | @Override
91 | public int compareTo(Coordenada otraCoordenada) {
92 |
93 | int r = 0;
94 |
95 | Coordenada origen = new Coordenada (0,0,0);
96 |
97 | double distanciaEstaCoordenada = this.toVector3D().distance(origen.toVector3D());
98 |
99 | double distanciaOtraCoordenada = otraCoordenada.toVector3D().distance(origen.toVector3D());
100 |
101 | if(distanciaEstaCoordenada > distanciaOtraCoordenada) r = 1;
102 |
103 | if(distanciaEstaCoordenada == distanciaOtraCoordenada) r = 0;
104 |
105 | if(distanciaEstaCoordenada < distanciaOtraCoordenada) r = -1;
106 |
107 |
108 | return r;
109 | };
110 |
111 | */
112 |
113 |
114 | }
115 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Edificio.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.bim2gisbm;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | public class Edificio {
8 |
9 | private String id;
10 | private List pisos;
11 |
12 | public List getPisos() {
13 | return pisos;
14 | }
15 |
16 | public void setPisos(List pisos) {
17 | this.pisos = pisos;
18 | }
19 |
20 | public Edificio(){
21 | //pisos = new ArrayList();
22 | }
23 |
24 |
25 | public Piso buscarPiso(String id){
26 |
27 | Piso r = null;
28 |
29 | for (Piso pisoActual : getPisos()) {
30 |
31 | if ( pisoActual.getId().equals(id)){
32 | r = pisoActual;
33 | break;
34 | }
35 |
36 | }
37 |
38 | return r;
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Muro.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.bim2gisbm;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcBooleanClippingResult;
8 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcBooleanOperand;
9 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcExtrudedAreaSolid;
10 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRepresentation;
11 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcSlab;
12 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcWallStandardCase;
13 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.LIST;
14 |
15 | import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
16 | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
17 | import co.edu.udistrital.bim2gis4j.ifc.Solido;
18 |
19 | import com.vividsolutions.jts.geom.Coordinate;
20 | import com.vividsolutions.jts.geom.GeometryFactory;
21 | import com.vividsolutions.jts.geom.LinearRing;
22 | import com.vividsolutions.jts.geom.Polygon;
23 |
24 | public class Muro extends Solido {
25 |
26 | List vacios = null;
27 |
28 | public List getVacios() {
29 | return vacios;
30 | }
31 |
32 |
33 | public void setVacios(List vacios) {
34 | this.vacios = vacios;
35 | }
36 |
37 |
38 | public void abrirVaciosParaPuertasYVentanas() {
39 |
40 | List carasNuevas = new ArrayList();
41 | List carasTijera = null;
42 |
43 |
44 | //en este loop se determinan las caras de los vacios que cortan a las caras de los muros
45 | //una vez determinadas se procede a recortar la nueva silueta de cada cara de los muros
46 | //Las caras que cortan un muro son las que tiene un borde que coincide con el borde del muro
47 | for (Poligono caraMuroActual : this.getCaras()) {
48 |
49 | carasTijera = new ArrayList();
50 |
51 | for (Vacio vacioActual : this.getVacios()) {
52 | for (Poligono caraVacioActual : vacioActual.getCaras()) {
53 |
54 | //las puertas alteran la silueta del muro
55 | if(vacioActual.getTipo()!=null && vacioActual.getTipo().equals("puerta")){
56 |
57 | if(caraMuroActual.compartePlanoCon(caraVacioActual)){
58 |
59 | if(caraMuroActual.comparteBordeCon(caraVacioActual)){
60 |
61 | caraVacioActual.setVacioPadre(vacioActual);
62 | carasTijera.add(caraVacioActual);
63 | caraVacioActual.setAdicional(false);
64 |
65 | }
66 | }
67 | }
68 | }
69 | }
70 |
71 | Poligono siluetaMuroRecortada = new Poligono();
72 | siluetaMuroRecortada.getCoordenadas().addAll(caraMuroActual.getCoordenadas());
73 | boolean hay2NuevasCaras = false;
74 | Poligono nuevaCara01 = null;
75 | Poligono nuevaCara02 = null;
76 |
77 | //if(this.getId().equals("3PfS__Y_DBAfq5naM6zD2Z")){
78 | //System.err.println("Cara muro original = " + siluetaMuroRecortada);
79 | for (Poligono tijeraActual : carasTijera) {
80 |
81 | //System.err.println("Tijera " + tijeraActual);
82 |
83 | List silueta = siluetaMuroRecortada.diferencia(tijeraActual);
84 | if(silueta!=null && silueta.size()==1){
85 | siluetaMuroRecortada = silueta.get(0);
86 | }
87 |
88 | if(silueta!=null && silueta.size()==2){
89 | hay2NuevasCaras = true;
90 | nuevaCara01 = silueta.get(0);
91 | nuevaCara02 = silueta.get(1);
92 | }
93 |
94 |
95 | //System.err.println("Resultado = " + siluetaMuroRecortada);
96 | }
97 |
98 | //}
99 |
100 | if(hay2NuevasCaras){
101 | nuevaCara01.setCarasTijera(carasTijera);
102 | carasNuevas.add(nuevaCara01);
103 | carasNuevas.add(nuevaCara02);
104 | }else{
105 | siluetaMuroRecortada.setCarasTijera(carasTijera);
106 | carasNuevas.add(siluetaMuroRecortada);
107 | }
108 | }
109 |
110 | this.setCaras(carasNuevas);
111 |
112 | //a las caras ya recortadas se les asigna sus caras internas
113 | //que son los huecos que genera una ventana, estos huecos no alteran la silueta del muro solo su interior
114 | for (Vacio vacioActual : this.getVacios()) {
115 | for (Poligono caraVacioActual : vacioActual.getCaras()) {
116 | for (Poligono caraMuroActual : this.getCaras()) {
117 |
118 | //las ventanas generan caras internas y caras adicionales pero no alteran la silueta
119 | if(vacioActual.getTipo()!=null && vacioActual.getTipo().equals("ventana")){
120 |
121 | if(caraMuroActual.compartePlanoCon(caraVacioActual)){
122 |
123 | caraVacioActual.setVacioPadre(vacioActual);
124 | caraVacioActual.setInterno(true);
125 | caraMuroActual.getCarasInternas().add(caraVacioActual);
126 | caraVacioActual.setAdicional(false);
127 |
128 | }
129 | }
130 |
131 |
132 | }
133 | }
134 | }
135 |
136 |
137 | for (Vacio vacioActual : this.getVacios()) {
138 | for (Poligono caraVacioActual : vacioActual.getCaras()) {
139 |
140 | if(vacioActual.getTipo()!=null && (vacioActual.getTipo().equals("ventana") || vacioActual.getTipo().equals("puerta"))){
141 |
142 | if(caraVacioActual.getAdicional()==true){
143 |
144 | this.getCaras().add(caraVacioActual);
145 |
146 | }
147 | }
148 | }
149 | }
150 |
151 |
152 | }
153 |
154 | }
155 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Piso.java:
--------------------------------------------------------------------------------
1 |
2 | package co.edu.udistrital.bim2gis4j.bim2gisbm;
3 |
4 | import java.util.ArrayList;
5 | import java.util.Iterator;
6 | import java.util.List;
7 |
8 | import org.apache.commons.math3.geometry.euclidean.threed.Plane;
9 | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
10 | import co.edu.udistrital.bim2gis4j.ifc.PlanoDeCorte;
11 | import co.edu.udistrital.bim2gis4j.util.LectorCoordenada;
12 | import co.edu.udistrital.bim2gis4j.util.Transformador;
13 |
14 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcHalfSpaceSolid;
15 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcPlane;
16 |
17 | import com.vividsolutions.jts.geom.GeometryFactory;
18 | import com.vividsolutions.jts.geom.MultiPolygon;
19 | import com.vividsolutions.jts.geom.Polygon;
20 |
21 | public class Piso {
22 |
23 | private String id;
24 | private String nombre;
25 | private double elevacion;
26 |
27 | private List planchas;
28 | private List muros;
29 |
30 |
31 |
32 | public List getMuros() {
33 | return muros;
34 | }
35 |
36 | public void setMuros(List muros) {
37 | this.muros = muros;
38 | }
39 |
40 | public String getId() {
41 | return id;
42 | }
43 |
44 | public void setId(String id) {
45 | this.id = id;
46 | }
47 |
48 | public String getNombre() {
49 | return nombre;
50 | }
51 |
52 | public void setNombre(String nombre) {
53 | this.nombre = nombre;
54 | }
55 |
56 | public double getElevacion() {
57 | return elevacion;
58 | }
59 |
60 | public void setElevacion(double elevacion) {
61 | this.elevacion = elevacion;
62 | }
63 |
64 | public List getPlanchas() {
65 | return planchas;
66 | }
67 |
68 | public void setPlanchas(List planchas) {
69 | this.planchas = planchas;
70 | }
71 |
72 |
73 | public Piso(){
74 | planchas = new ArrayList();
75 | muros = new ArrayList();
76 | }
77 |
78 | public void imprimir(){
79 | String cadena = "";
80 | cadena += "\nPiso \"" + getNombre() + "\" ( id=" + getId() + " , elevacion=" + getElevacion() + " )";
81 |
82 | cadena += "\n " + getPlanchas().size() + " Planchas:";
83 | for (Plancha planchaActual : getPlanchas()) {
84 | cadena += "\n |__ Plancha";
85 | cadena += "\n id = " + planchaActual.getId();
86 | cadena += "\n tipo = " + planchaActual.getTipo();
87 | cadena += "\n placementRelTo";
88 | cadena += "\n placementRelTo = [ ";
89 |
90 | cadena += planchaActual.objectPlacement.getPlacementRelTo_placementRelTo().getX() + " ";
91 | cadena += planchaActual.objectPlacement.getPlacementRelTo_placementRelTo().getY() + " ";
92 | cadena += planchaActual.objectPlacement.getPlacementRelTo_placementRelTo().getZ() + " ";
93 | cadena += "]";
94 |
95 | cadena += "\n relativePlacement = [ ";
96 | cadena += planchaActual.objectPlacement.getPlacementRelTo_relativePlacement().getX() + " ";
97 | cadena += planchaActual.objectPlacement.getPlacementRelTo_relativePlacement().getY() + " ";
98 | cadena += planchaActual.objectPlacement.getPlacementRelTo_relativePlacement().getZ() + " ";
99 | cadena += "]";
100 |
101 | cadena += "\n relativePlacement";
102 | cadena += "\n location = [ ";
103 | cadena += planchaActual.objectPlacement.getRelativePlacement_location().getX() + " ";
104 | cadena += planchaActual.objectPlacement.getRelativePlacement_location().getY() + " ";
105 | cadena += planchaActual.objectPlacement.getRelativePlacement_location().getZ() + " ";
106 | cadena += "]";
107 |
108 | cadena += "\n Axis = [ ";
109 | cadena += (( planchaActual.objectPlacement.getRelativePlacement_axis() !=null) ? planchaActual.objectPlacement.getRelativePlacement_axis().getX() : "null") + " ";
110 | cadena += (( planchaActual.objectPlacement.getRelativePlacement_axis() !=null) ? planchaActual.objectPlacement.getRelativePlacement_axis().getY() : "null") + " ";
111 | cadena += (( planchaActual.objectPlacement.getRelativePlacement_axis() !=null) ? planchaActual.objectPlacement.getRelativePlacement_axis().getZ() : "null") + " ";
112 | cadena += "]";
113 |
114 | cadena += "\n RefDirection = [ ";
115 | cadena += (( planchaActual.objectPlacement.getRelativePlacement_refDirection() !=null) ? planchaActual.objectPlacement.getRelativePlacement_refDirection().getX() : "null") + " ";
116 | cadena += (( planchaActual.objectPlacement.getRelativePlacement_refDirection() !=null) ? planchaActual.objectPlacement.getRelativePlacement_refDirection().getY() : "null") + " ";
117 | cadena += (( planchaActual.objectPlacement.getRelativePlacement_refDirection() !=null) ? planchaActual.objectPlacement.getRelativePlacement_refDirection().getZ() : "null") + " ";
118 | cadena += "]";
119 |
120 |
121 | cadena += "\n Representation";
122 | cadena += "\n RepresentationType = " + planchaActual.representation.getRepresentation_representationType();
123 | cadena += "\n SweptAreaType = " + planchaActual.representation.getRepresentation_representation_SweptAreaType();
124 | cadena += "\n Position ";
125 | cadena += "\n Location = [ ";
126 | cadena += planchaActual.representation.getRepresentation_position_location().getX() + " ";
127 | cadena += planchaActual.representation.getRepresentation_position_location().getY() + " ";
128 | cadena += planchaActual.representation.getRepresentation_position_location().getZ() + " ";
129 | cadena += "]";
130 |
131 |
132 |
133 | cadena += "\n Axis = [ ";
134 | cadena += (( planchaActual.representation.getRepresentation_position_axis()!=null) ? planchaActual.representation.getRepresentation_position_axis().getX() : "null") + " ";
135 | cadena += (( planchaActual.representation.getRepresentation_position_axis()!=null) ? planchaActual.representation.getRepresentation_position_axis().getY() : "null") + " ";
136 | cadena += (( planchaActual.representation.getRepresentation_position_axis()!=null) ? planchaActual.representation.getRepresentation_position_axis().getZ() : "null") + " ";
137 | cadena += "]";
138 |
139 | cadena += "\n RefDirection = [ ";
140 | cadena += (( planchaActual.representation.getRepresentation_position_refDirection()!=null) ? planchaActual.representation.getRepresentation_position_refDirection().getX() : "null") + " ";
141 | cadena += (( planchaActual.representation.getRepresentation_position_refDirection()!=null) ? planchaActual.representation.getRepresentation_position_refDirection().getY() : "null") + " ";
142 | cadena += (( planchaActual.representation.getRepresentation_position_refDirection()!=null) ? planchaActual.representation.getRepresentation_position_refDirection().getZ() : "null") + " ";
143 | cadena += "]";
144 |
145 |
146 | cadena += "\n ExtrudedDirection = [ ";
147 | cadena += planchaActual.representation.getRepresentation_extruded_direction().getX() + " ";
148 | cadena += planchaActual.representation.getRepresentation_extruded_direction().getY() + " ";
149 | cadena += planchaActual.representation.getRepresentation_extruded_direction().getZ() + " ";
150 | cadena += "]";
151 |
152 | if(planchaActual.getRepresentation_points()!=null){
153 | cadena += "\n Puntos (" + planchaActual.getRepresentation_points().size() + ") = [ ";
154 | for (Coordenada coordenadaActual : planchaActual.getRepresentation_points()) {
155 | cadena += coordenadaActual.getX() + " " + coordenadaActual.getY() + " , ";
156 | }
157 | cadena += "]";
158 | }
159 |
160 | if(planchaActual.getRepresentation_segmentos()!=null){
161 | cadena += "\n Segmentos (" + planchaActual.getRepresentation_segmentos().size() + ") = [ ";
162 | for (Segmento segmentoActual : planchaActual.getRepresentation_segmentos()) {
163 | cadena += segmentoActual.getP0().getX() + " " + segmentoActual.getP0().getY() + " , ";
164 | cadena += segmentoActual.getP1().getX() + " " + segmentoActual.getP1().getY() + " , ";
165 | }
166 | cadena += "]";
167 | }
168 |
169 | if(planchaActual.getRectangulo()!=null){
170 | Rectangulo rec = planchaActual.getRectangulo();
171 | cadena += "\n Rectangulo";
172 | cadena += "\n Location = [ " + rec.getPosition_location().getX() + " " + rec.getPosition_location().getY() + " ]";
173 | cadena += "\n RefDirection = [ " + rec.getPosition_refDirection().getX() + " " + rec.getPosition_refDirection().getY() + " ]";
174 | cadena += "\n XDim = " + rec.getXDim();
175 | cadena += "\n YDim = " + rec.getYDim();
176 | }
177 |
178 | if(planchaActual.getCoordenadasAbsolutas()!=null){
179 | cadena += "\n Absolutas (" + planchaActual.getCoordenadasAbsolutas().size() + ") = [ ";
180 | for (Coordenada coordenadaActual : planchaActual.getCoordenadasAbsolutas()) {
181 | cadena += coordenadaActual.getX() + " " + coordenadaActual.getY() + " " + coordenadaActual.getZ() + " , ";
182 | }
183 | cadena += "]";
184 | }
185 |
186 | cadena += "\n Piso Padre";
187 | cadena += "\n Id = " + planchaActual.getPisoPadre().getId();
188 | cadena += "\n Nombre = " + planchaActual.getPisoPadre().getNombre();
189 | cadena += "\n Elevacion = " + planchaActual.getPisoPadre().getElevacion();
190 |
191 | if(planchaActual.getCaras()!=null){
192 |
193 | Iterator i = planchaActual.getCaras().iterator();
194 | cadena += "\n Caras GEOGEBRA 5 3D (" + planchaActual.getCaras().size() + ") = \n";
195 |
196 | for (Poligono caraActual : planchaActual.getCaras()) {
197 | cadena += " " + caraActual + "\n";
198 | }
199 |
200 | }
201 |
202 | }
203 |
204 |
205 | cadena += "\n " + getMuros().size() + " Muros:";
206 | for (Muro muroActual : getMuros()) {
207 | cadena += "\n |__ Muro";
208 | cadena += "\n id = " + muroActual.getId();
209 | cadena += "\n tipo = " + muroActual.getTipo();
210 | cadena += "\n placementRelTo";
211 | cadena += "\n placementRelTo = [ ";
212 |
213 | cadena += muroActual.objectPlacement.getPlacementRelTo_placementRelTo().getX() + " ";
214 | cadena += muroActual.objectPlacement.getPlacementRelTo_placementRelTo().getY() + " ";
215 | cadena += muroActual.objectPlacement.getPlacementRelTo_placementRelTo().getZ() + " ";
216 | cadena += "]";
217 |
218 | cadena += "\n relativePlacement = [ ";
219 | cadena += muroActual.objectPlacement.getPlacementRelTo_relativePlacement().getX() + " ";
220 | cadena += muroActual.objectPlacement.getPlacementRelTo_relativePlacement().getY() + " ";
221 | cadena += muroActual.objectPlacement.getPlacementRelTo_relativePlacement().getZ() + " ";
222 | cadena += "]";
223 |
224 | cadena += "\n relativePlacement";
225 | cadena += "\n location = [ ";
226 | cadena += muroActual.objectPlacement.getRelativePlacement_location().getX() + " ";
227 | cadena += muroActual.objectPlacement.getRelativePlacement_location().getY() + " ";
228 | cadena += muroActual.objectPlacement.getRelativePlacement_location().getZ() + " ";
229 | cadena += "]";
230 |
231 | cadena += "\n Axis = [ ";
232 | cadena += (( muroActual.objectPlacement.getRelativePlacement_axis() !=null) ? muroActual.objectPlacement.getRelativePlacement_axis().getX() : "null") + " ";
233 | cadena += (( muroActual.objectPlacement.getRelativePlacement_axis() !=null) ? muroActual.objectPlacement.getRelativePlacement_axis().getY() : "null") + " ";
234 | cadena += (( muroActual.objectPlacement.getRelativePlacement_axis() !=null) ? muroActual.objectPlacement.getRelativePlacement_axis().getZ() : "null") + " ";
235 | cadena += "]";
236 |
237 | cadena += "\n RefDirection = [ ";
238 | cadena += (( muroActual.objectPlacement.getRelativePlacement_refDirection() !=null) ? muroActual.objectPlacement.getRelativePlacement_refDirection().getX() : "null") + " ";
239 | cadena += (( muroActual.objectPlacement.getRelativePlacement_refDirection() !=null) ? muroActual.objectPlacement.getRelativePlacement_refDirection().getY() : "null") + " ";
240 | cadena += (( muroActual.objectPlacement.getRelativePlacement_refDirection() !=null) ? muroActual.objectPlacement.getRelativePlacement_refDirection().getZ() : "null") + " ";
241 | cadena += "]";
242 |
243 | cadena += "\n Representation";
244 | cadena += "\n STEP Line number = " + muroActual.representation.getStepLineNumber();
245 | cadena += "\n RepresentationType = " + muroActual.representation.getRepresentation_representationType();
246 | cadena += "\n SweptAreaType = " + muroActual.representation.getRepresentation_representation_SweptAreaType();
247 | cadena += "\n Position ";
248 | cadena += "\n Location = [ ";
249 | cadena += muroActual.representation.getRepresentation_position_location().getX() + " ";
250 | cadena += muroActual.representation.getRepresentation_position_location().getY() + " ";
251 | cadena += muroActual.representation.getRepresentation_position_location().getZ() + " ";
252 | cadena += "]";
253 |
254 | cadena += "\n Axis = [ ";
255 | cadena += (( muroActual.representation.getRepresentation_position_axis()!=null) ? muroActual.representation.getRepresentation_position_axis().getX() : "null") + " ";
256 | cadena += (( muroActual.representation.getRepresentation_position_axis()!=null) ? muroActual.representation.getRepresentation_position_axis().getY() : "null") + " ";
257 | cadena += (( muroActual.representation.getRepresentation_position_axis()!=null) ? muroActual.representation.getRepresentation_position_axis().getZ() : "null") + " ";
258 | cadena += "]";
259 |
260 | cadena += "\n RefDirection = [ ";
261 | cadena += (( muroActual.representation.getRepresentation_position_refDirection()!=null) ? muroActual.representation.getRepresentation_position_refDirection().getX() : "null") + " ";
262 | cadena += (( muroActual.representation.getRepresentation_position_refDirection()!=null) ? muroActual.representation.getRepresentation_position_refDirection().getY() : "null") + " ";
263 | cadena += (( muroActual.representation.getRepresentation_position_refDirection()!=null) ? muroActual.representation.getRepresentation_position_refDirection().getZ() : "null") + " ";
264 | cadena += "]";
265 |
266 |
267 | cadena += "\n ExtrudedDirection = [ ";
268 | cadena += muroActual.representation.getRepresentation_extruded_direction().getX() + " ";
269 | cadena += muroActual.representation.getRepresentation_extruded_direction().getY() + " ";
270 | cadena += muroActual.representation.getRepresentation_extruded_direction().getZ() + " ";
271 | cadena += "]";
272 |
273 |
274 | if(muroActual.getRepresentation_points()!=null){
275 | cadena += "\n Puntos (" + muroActual.getRepresentation_points().size() + ") = [ ";
276 | for (Coordenada coordenadaActual : muroActual.getRepresentation_points()) {
277 | cadena += coordenadaActual.getX() + " " + coordenadaActual.getY() + " , ";
278 | }
279 | cadena += "]";
280 | }
281 |
282 | if(muroActual.getRepresentation_segmentos()!=null){
283 | cadena += "\n Segmentos (" + muroActual.getRepresentation_segmentos().size() + ") = [ ";
284 | for (Segmento segmentoActual : muroActual.getRepresentation_segmentos()) {
285 | cadena += segmentoActual.getP0().getX() + " " + segmentoActual.getP0().getY() + " , ";
286 | cadena += segmentoActual.getP1().getX() + " " + segmentoActual.getP1().getY() + " , ";
287 | }
288 | cadena += "]";
289 | }
290 |
291 | if(muroActual.getRectangulo()!=null){
292 | Rectangulo rec = muroActual.getRectangulo();
293 | cadena += "\n Rectangulo";
294 | cadena += "\n Location = [ " + rec.getPosition_location().getX() + " " + rec.getPosition_location().getY() + " ]";
295 | cadena += "\n RefDirection = [ " + rec.getPosition_refDirection().getX() + " " + rec.getPosition_refDirection().getY() + " ]";
296 | cadena += "\n XDim = " + rec.getXDim();
297 | cadena += "\n YDim = " + rec.getYDim();
298 | }
299 |
300 | if(muroActual.getCoordenadasAbsolutas()!=null){
301 | cadena += "\n Absolutas (" + muroActual.getCoordenadasAbsolutas().size() + ") = [ ";
302 | for (Coordenada coordenadaActual : muroActual.getCoordenadasAbsolutas()) {
303 | cadena += coordenadaActual + " ";
304 | }
305 | cadena += "]";
306 |
307 | }
308 |
309 | if(muroActual.getCaras()!=null){
310 |
311 | Iterator i = muroActual.getCaras().iterator();
312 | cadena += "\n Caras GEOGEBRA 5 3D (" + muroActual.getCaras().size() + ") = ";
313 |
314 | for (Poligono caraActual : muroActual.getCaras()) {
315 | cadena += "\n " + caraActual;
316 | }
317 |
318 | }
319 |
320 |
321 | if(muroActual.getPlanosDeCorte()!=null){
322 | cadena += "\n Planos de corte (" + muroActual.getPlanosDeCorte().size() + ") = ";
323 | int c = 0;
324 | for (PlanoDeCorte planoActual : muroActual.getPlanosDeCorte()) {
325 |
326 | c++;
327 | cadena += "\n |__ Plano " + c;
328 |
329 | cadena += "\n Step Line = " + planoActual.getPlanoIfc().getStepLineNumber();
330 | cadena += "\n Ifc : origen = " + planoActual.getLocationAbsolutaIfc() + " normal = " + planoActual.getNormalAbsolutaIfc();
331 |
332 | Vector3D normal = planoActual.getPlanoApache().getNormal();
333 | Coordenada normalApache = new Coordenada (normal.getX(), normal.getY(), normal.getZ());
334 | Vector3D origen = planoActual.getPlanoApache().getOrigin();
335 | Coordenada origenApache = new Coordenada (origen.getX(), origen.getY(), origen.getZ());
336 |
337 | cadena += "\n Apache : origen = " + origenApache + " normal = " + normalApache;
338 |
339 | cadena += "\n agreementFlagIfc = " + planoActual.getAgreementFlagIfc();
340 |
341 | cadena += "\n Caras A Cortar = ";
342 |
343 | for (Poligono caraActual : planoActual.getCarasACortar() ) {
344 |
345 | cadena += " " + caraActual;
346 |
347 | }
348 |
349 | cadena += "\n Caras Resultado = ";
350 |
351 | for (Poligono caraActual : planoActual.getCarasResultado() ) {
352 |
353 | cadena += " " + caraActual;
354 |
355 | }
356 |
357 | cadena += " cara de corte = " + planoActual.getCaraDeCorte();
358 | }
359 | //cadena += "]";
360 |
361 |
362 |
363 | }
364 |
365 | if(muroActual.getVacios()!=null){
366 |
367 | Iterator i = muroActual.getCaras().iterator();
368 |
369 | cadena += "\n " + muroActual.getVacios().size() + " Vacios:";
370 | for (Vacio vacioActual : muroActual.getVacios()) {
371 |
372 |
373 | cadena += "\n |__ Vacio";
374 | cadena += "\n id = " + vacioActual.getId();
375 | cadena += "\n tipo = " + vacioActual.getTipo();
376 | cadena += "\n placementRelTo";
377 | cadena += "\n placementRelTo = [ ";
378 |
379 | cadena += vacioActual.objectPlacement.getPlacementRelTo_placementRelTo().getX() + " ";
380 | cadena += vacioActual.objectPlacement.getPlacementRelTo_placementRelTo().getY() + " ";
381 | cadena += vacioActual.objectPlacement.getPlacementRelTo_placementRelTo().getZ() + " ";
382 | cadena += "]";
383 |
384 | cadena += "\n relativePlacement = [ ";
385 | cadena += vacioActual.objectPlacement.getPlacementRelTo_relativePlacement().getX() + " ";
386 | cadena += vacioActual.objectPlacement.getPlacementRelTo_relativePlacement().getY() + " ";
387 | cadena += vacioActual.objectPlacement.getPlacementRelTo_relativePlacement().getZ() + " ";
388 | cadena += "]";
389 |
390 | cadena += "\n relativePlacement";
391 | cadena += "\n location = [ ";
392 | cadena += vacioActual.objectPlacement.getRelativePlacement_location().getX() + " ";
393 | cadena += vacioActual.objectPlacement.getRelativePlacement_location().getY() + " ";
394 | cadena += vacioActual.objectPlacement.getRelativePlacement_location().getZ() + " ";
395 | cadena += "]";
396 |
397 | cadena += "\n Axis = [ ";
398 | cadena += (( vacioActual.objectPlacement.getRelativePlacement_axis() !=null) ? vacioActual.objectPlacement.getRelativePlacement_axis().getX() : "null") + " ";
399 | cadena += (( vacioActual.objectPlacement.getRelativePlacement_axis() !=null) ? vacioActual.objectPlacement.getRelativePlacement_axis().getY() : "null") + " ";
400 | cadena += (( vacioActual.objectPlacement.getRelativePlacement_axis() !=null) ? vacioActual.objectPlacement.getRelativePlacement_axis().getZ() : "null") + " ";
401 | cadena += "]";
402 |
403 | cadena += "\n RefDirection = [ ";
404 | cadena += (( vacioActual.objectPlacement.getRelativePlacement_refDirection() !=null) ? vacioActual.objectPlacement.getRelativePlacement_refDirection().getX() : "null") + " ";
405 | cadena += (( vacioActual.objectPlacement.getRelativePlacement_refDirection() !=null) ? vacioActual.objectPlacement.getRelativePlacement_refDirection().getY() : "null") + " ";
406 | cadena += (( vacioActual.objectPlacement.getRelativePlacement_refDirection() !=null) ? vacioActual.objectPlacement.getRelativePlacement_refDirection().getZ() : "null") + " ";
407 | cadena += "]";
408 |
409 | cadena += "\n Representation";
410 | cadena += "\n STEP Line number = " + vacioActual.representation.getStepLineNumber();
411 | cadena += "\n RepresentationType = " + vacioActual.representation.getRepresentation_representationType();
412 | cadena += "\n SweptAreaType = " + vacioActual.representation.getRepresentation_representation_SweptAreaType();
413 | cadena += "\n Position ";
414 | cadena += "\n Location = [ ";
415 | cadena += vacioActual.representation.getRepresentation_position_location().getX() + " ";
416 | cadena += vacioActual.representation.getRepresentation_position_location().getY() + " ";
417 | cadena += vacioActual.representation.getRepresentation_position_location().getZ() + " ";
418 | cadena += "]";
419 |
420 | cadena += "\n Axis = [ ";
421 | cadena += (( vacioActual.representation.getRepresentation_position_axis()!=null) ? vacioActual.representation.getRepresentation_position_axis().getX() : "null") + " ";
422 | cadena += (( vacioActual.representation.getRepresentation_position_axis()!=null) ? vacioActual.representation.getRepresentation_position_axis().getY() : "null") + " ";
423 | cadena += (( vacioActual.representation.getRepresentation_position_axis()!=null) ? vacioActual.representation.getRepresentation_position_axis().getZ() : "null") + " ";
424 | cadena += "]";
425 |
426 | cadena += "\n RefDirection = [ ";
427 | cadena += (( vacioActual.representation.getRepresentation_position_refDirection()!=null) ? vacioActual.representation.getRepresentation_position_refDirection().getX() : "null") + " ";
428 | cadena += (( vacioActual.representation.getRepresentation_position_refDirection()!=null) ? vacioActual.representation.getRepresentation_position_refDirection().getY() : "null") + " ";
429 | cadena += (( vacioActual.representation.getRepresentation_position_refDirection()!=null) ? vacioActual.representation.getRepresentation_position_refDirection().getZ() : "null") + " ";
430 | cadena += "]";
431 |
432 |
433 | cadena += "\n ExtrudedDirection = [ ";
434 | cadena += vacioActual.representation.getRepresentation_extruded_direction().getX() + " ";
435 | cadena += vacioActual.representation.getRepresentation_extruded_direction().getY() + " ";
436 | cadena += vacioActual.representation.getRepresentation_extruded_direction().getZ() + " ";
437 | cadena += "]";
438 |
439 |
440 | if(vacioActual.getRepresentation_points()!=null){
441 | cadena += "\n Puntos (" + vacioActual.getRepresentation_points().size() + ") = [ ";
442 | for (Coordenada coordenadaActual : vacioActual.getRepresentation_points()) {
443 | cadena += coordenadaActual.getX() + " " + coordenadaActual.getY() + " , ";
444 | }
445 | cadena += "]";
446 | }
447 |
448 | if(vacioActual.getRepresentation_segmentos()!=null){
449 | cadena += "\n Segmentos (" + vacioActual.getRepresentation_segmentos().size() + ") = [ ";
450 | for (Segmento segmentoActual : vacioActual.getRepresentation_segmentos()) {
451 | cadena += segmentoActual.getP0().getX() + " " + segmentoActual.getP0().getY() + " , ";
452 | cadena += segmentoActual.getP1().getX() + " " + segmentoActual.getP1().getY() + " , ";
453 | }
454 | cadena += "]";
455 | }
456 |
457 | if(vacioActual.getRectangulo()!=null){
458 | Rectangulo rec = vacioActual.getRectangulo();
459 | cadena += "\n Rectangulo";
460 | cadena += "\n Location = [ " + rec.getPosition_location().getX() + " " + rec.getPosition_location().getY() + " ]";
461 | cadena += "\n RefDirection = [ " + rec.getPosition_refDirection().getX() + " " + rec.getPosition_refDirection().getY() + " ]";
462 | cadena += "\n XDim = " + rec.getXDim();
463 | cadena += "\n YDim = " + rec.getYDim();
464 | }
465 |
466 | if(vacioActual.getCoordenadasAbsolutas()!=null){
467 | cadena += "\n Absolutas (" + vacioActual.getCoordenadasAbsolutas().size() + ") =";
468 | for (Coordenada coordenadaActual : vacioActual.getCoordenadasAbsolutas()) {
469 | cadena += "\n " + coordenadaActual;
470 | }
471 |
472 | }
473 |
474 | if(vacioActual.getCaras()!=null){
475 |
476 | //Iterator i2 = vacioActual.getCaras().iterator();
477 | cadena += "\n Caras GEOGEBRA 5 3D (" + vacioActual.getCaras().size() + ") = ";
478 |
479 | for (Poligono caraActual : vacioActual.getCaras()) {
480 |
481 | if(caraActual.getInterno()){
482 | cadena += "\n I " + caraActual ;
483 | }else{
484 | cadena += "\n " + caraActual ;
485 | }
486 |
487 | }
488 |
489 | }
490 |
491 |
492 | }
493 |
494 |
495 | }
496 |
497 |
498 | /*
499 |
500 | if(planchaActual.getCoordenadasAbsolutas()!=null){
501 | cadena += "\n Absolutas (" + planchaActual.getCoordenadasAbsolutas().size() + ") = [ ";
502 | for (Coordenada coordenadaActual : planchaActual.getCoordenadasAbsolutas()) {
503 | cadena += coordenadaActual.getX() + " " + coordenadaActual.getY() + " " + coordenadaActual.getZ() + " , ";
504 | }
505 | cadena += "]";
506 | }
507 |
508 | cadena += "\n Piso Padre";
509 | cadena += "\n Id = " + planchaActual.getPisoPadre().getId();
510 | cadena += "\n Nombre = " + planchaActual.getPisoPadre().getNombre();
511 | cadena += "\n Elevacion = " + planchaActual.getPisoPadre().getElevacion();
512 |
513 | }
514 |
515 |
516 | */
517 | }
518 |
519 |
520 |
521 | System.out.println(cadena);
522 | }
523 |
524 | public Polygon[] generarPoligonos(double easting, double northing){
525 |
526 | int planchasTipoFloor = 0;
527 | for (Plancha planchaActual : getPlanchas()){
528 | if(planchaActual.getTipo().equals("FLOOR") || planchaActual.getTipo().equals("BASESLAB")){
529 | planchasTipoFloor++;
530 | }
531 | }
532 |
533 |
534 | Polygon[] poligonos = new Polygon[planchasTipoFloor];
535 | int c=0;
536 | for (Plancha planchaActual : getPlanchas()){
537 | //solo se toman en cuenta las planchas que sea de tipo "FLOOR,BASESLAB", se descartan "ROOF,LANDING,USERDEFINED,NOTDEFINED"
538 | if(planchaActual.getTipo().equals("FLOOR") || planchaActual.getTipo().equals("BASESLAB")){
539 |
540 | Polygon poligonoActual = planchaActual.generarPoligono(easting, northing);
541 | poligonos[c] = poligonoActual;
542 | c++;
543 |
544 | }
545 |
546 | }
547 |
548 | return poligonos;
549 | }
550 |
551 | }
552 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Plancha.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Plancha.java
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Poligono.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Poligono.java
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Rectangulo.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.bim2gisbm;
2 |
3 | public class Rectangulo {
4 |
5 | Coordenada position_location;
6 | Coordenada position_refDirection;
7 |
8 | double XDim;
9 | double YDim;
10 |
11 | public Rectangulo(){
12 |
13 | position_location = new Coordenada();
14 | position_refDirection = new Coordenada();
15 |
16 | XDim = 0;
17 | YDim = 0;
18 | }
19 |
20 | public Coordenada getPosition_location() {
21 | return position_location;
22 | }
23 | public void setPosition_location(Coordenada position_location) {
24 | this.position_location = position_location;
25 | }
26 | public Coordenada getPosition_refDirection() {
27 | return position_refDirection;
28 | }
29 | public void setPosition_refDirection(Coordenada position_refDirection) {
30 | this.position_refDirection = position_refDirection;
31 | }
32 | public double getXDim() {
33 | return XDim;
34 | }
35 | public void setXDim(double xDim) {
36 | XDim = xDim;
37 | }
38 | public double getYDim() {
39 | return YDim;
40 | }
41 | public void setYDim(double yDim) {
42 | YDim = yDim;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Segmento.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.bim2gisbm;
2 |
3 | public class Segmento {
4 |
5 | Coordenada p0;
6 |
7 | Coordenada p1;
8 |
9 | public Coordenada getP0() {
10 | return p0;
11 | }
12 |
13 | public void setP0(Coordenada p0) {
14 | this.p0 = p0;
15 | }
16 |
17 | public Coordenada getP1() {
18 | return p1;
19 | }
20 |
21 | public void setP1(Coordenada p1) {
22 | this.p1 = p1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/bim2gisbm/Vacio.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.bim2gisbm;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collections;
5 | import java.util.List;
6 |
7 | import co.edu.udistrital.bim2gis4j.ifc.Solido;
8 | import co.edu.udistrital.bim2gis4j.util.Transformador;
9 |
10 | public class Vacio extends Solido{
11 |
12 | Muro muroAlQueVacia = null;
13 |
14 | public Muro getMuroAlQueVacia() {
15 | return muroAlQueVacia;
16 | }
17 |
18 | public void setMuroAlQueVacia(Muro muroAlQueVacia) {
19 | this.muroAlQueVacia = muroAlQueVacia;
20 | }
21 |
22 | public void rotarCoordenadasVacio(){
23 |
24 | if(coordenadasAbsolutas !=null){
25 | //inicialmente se rotan las coordenadas absolutas
26 | //esto simplemente sirve para hacer que coincidan con la ubicacion final de las caras
27 | //las caras ya estaban calculadas anteriormente con base en las coordenadas absolutas sin rotar
28 | List absolutasOriginales = this.coordenadasAbsolutas;
29 | List absolutasRotadas = new ArrayList();
30 |
31 | for (Coordenada coordenadaActual : coordenadasAbsolutas) {
32 |
33 | Coordenada rotada = Transformador.rotarCoordenadaVacio(coordenadaActual, this);
34 | absolutasRotadas.add(rotada);
35 |
36 | }
37 |
38 | this.setCoordenadasAbsolutas(absolutasRotadas);
39 |
40 |
41 | //posteriormente se rota cada una de las coordenadas que somponen las caras del vacio
42 |
43 | List carasOriginales = this.getCaras();
44 | List carasRotadas = new ArrayList();
45 |
46 | for (Poligono caraActual : carasOriginales) {
47 |
48 | Poligono caraRotada = new Poligono();
49 |
50 | for (Coordenada coordenadaActual : caraActual.getCoordenadas()) {
51 |
52 | Coordenada rotada = Transformador.rotarCoordenadaVacio(coordenadaActual, this);
53 |
54 | caraRotada.getCoordenadas().add(rotada);
55 |
56 | }
57 |
58 | carasRotadas.add(caraRotada);
59 | }
60 |
61 | this.setCaras(carasRotadas);
62 |
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/ifc/Axis2Placement3D.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.ifc;
2 |
3 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
4 |
5 | public class Axis2Placement3D {
6 |
7 | public Coordenada location;
8 |
9 | public Coordenada axis;
10 |
11 | public Coordenada refDirection;
12 |
13 |
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/ifc/Placement.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.ifc;
2 |
3 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
4 |
5 | public class Placement {
6 |
7 | // ObjectPlacement
8 |
9 | public Coordenada placementRelTo_placementRelTo;
10 |
11 | public Coordenada placementRelTo_relativePlacement;
12 |
13 | public Coordenada getPlacementRelTo_placementRelTo() {
14 | return placementRelTo_placementRelTo;
15 | }
16 |
17 | public void setPlacementRelTo_placementRelTo(
18 | Coordenada placementRelTo_placementRelTo) {
19 | this.placementRelTo_placementRelTo = placementRelTo_placementRelTo;
20 | }
21 |
22 | public Coordenada getPlacementRelTo_relativePlacement() {
23 | return placementRelTo_relativePlacement;
24 | }
25 |
26 | public void setPlacementRelTo_relativePlacement(
27 | Coordenada placementRelTo_relativePlacement) {
28 | this.placementRelTo_relativePlacement = placementRelTo_relativePlacement;
29 | }
30 |
31 |
32 |
33 |
34 | public Axis2Placement3D relativePlacement = new Axis2Placement3D();
35 |
36 |
37 | public Coordenada getRelativePlacement_axis() {
38 | return relativePlacement.axis;
39 | }
40 |
41 | public void setRelativePlacement_axis(Coordenada axis) {
42 | relativePlacement.axis = axis;
43 | }
44 |
45 | public Coordenada getRelativePlacement_refDirection() {
46 | return relativePlacement.refDirection;
47 | }
48 |
49 | public void setRelativePlacement_refDirection( Coordenada refDirection) {
50 | this.relativePlacement.refDirection = refDirection;
51 | }
52 |
53 | public Coordenada getRelativePlacement_location() {
54 | return relativePlacement.location;
55 | }
56 |
57 | public void setRelativePlacement_location( Coordenada location) {
58 | this.relativePlacement.location = location;
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/ifc/PlanoDeCorte.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/src/co/edu/udistrital/bim2gis4j/ifc/PlanoDeCorte.java
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/ifc/Representation.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.ifc;
2 |
3 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
4 |
5 | public class Representation {
6 |
7 | // Representation
8 |
9 | public String representation_representationType;
10 |
11 | public String representation_representation_SweptAreaType;
12 |
13 | public Axis2Placement3D position = new Axis2Placement3D();
14 |
15 | public Coordenada representation_extruded_direction;
16 |
17 | public int stepLineNumber;
18 |
19 | public int getStepLineNumber() {
20 | return stepLineNumber;
21 | }
22 |
23 | public void setStepLineNumber(int stepLineNumber) {
24 | this.stepLineNumber = stepLineNumber;
25 | }
26 |
27 | public String getRepresentation_representation_SweptAreaType() {
28 | return representation_representation_SweptAreaType;
29 | }
30 |
31 | public void setRepresentation_representation_SweptAreaType(
32 | String representation_representation_SweptAreaType) {
33 | this.representation_representation_SweptAreaType = representation_representation_SweptAreaType;
34 | }
35 |
36 | public Coordenada getRepresentation_extruded_direction() {
37 | return representation_extruded_direction;
38 | }
39 |
40 | public void setRepresentation_extruded_direction(
41 | Coordenada representation_extruded_direction) {
42 | this.representation_extruded_direction = representation_extruded_direction;
43 | }
44 |
45 | public Coordenada getRepresentation_position_location() {
46 | return position.location;
47 | }
48 |
49 | public void setRepresentation_position_location(
50 | Coordenada representation_position_location) {
51 | this.position.location = representation_position_location;
52 | }
53 |
54 | public Coordenada getRepresentation_position_axis() {
55 | return position.axis;
56 | }
57 |
58 | public void setRepresentation_position_axis(
59 | Coordenada representation_position_axis) {
60 | this.position.axis = representation_position_axis;
61 | }
62 |
63 | public Coordenada getRepresentation_position_refDirection() {
64 | return position.refDirection;
65 | }
66 |
67 | public void setRepresentation_position_refDirection(
68 | Coordenada representation_position_refDirection) {
69 | this.position.refDirection = representation_position_refDirection;
70 | }
71 |
72 | public String getRepresentation_representationType() {
73 | return representation_representationType;
74 | }
75 |
76 | public void setRepresentation_representationType(
77 | String representation_representationType) {
78 | this.representation_representationType = representation_representationType;
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/ifc/Solido.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/src/co/edu/udistrital/bim2gis4j/ifc/Solido.java
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/main/Main.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/src/co/edu/udistrital/bim2gis4j/main/Main.java
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/samples/Lod2.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.samples;
2 |
3 | //basado en : citygml4j-1.0-src\samples\creating_citygml\src\BuildingCreator.java
4 |
5 | /*
6 | * This file is part of citygml4j.
7 | * Copyright (c) 2007 - 2010
8 | * Institute for Geodesy and Geoinformation Science
9 | * Technische Universitaet Berlin, Germany
10 | * http://www.igg.tu-berlin.de/
11 | *
12 | * The citygml4j library is free software:
13 | * you can redistribute it and/or modify it under the terms of the
14 | * GNU Lesser General Public License as published by the Free
15 | * Software Foundation, either version 3 of the License, or
16 | * (at your option) any later version.
17 | *
18 | * This library is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU Lesser General Public License for more details.
22 | *
23 | * You should have received a copy of the GNU Lesser General Public
24 | * License along with this library. If not, see
25 | * .
26 | */
27 | import java.io.File;
28 | import java.text.SimpleDateFormat;
29 | import java.util.ArrayList;
30 | import java.util.Date;
31 | import java.util.List;
32 |
33 | import org.citygml4j.CityGMLContext;
34 | import org.citygml4j.builder.jaxb.JAXBBuilder;
35 | import org.citygml4j.factory.CityGMLFactory;
36 | import org.citygml4j.factory.GMLFactory;
37 | import org.citygml4j.factory.geometry.GMLGeometryFactory;
38 | import org.citygml4j.model.citygml.CityGMLClass;
39 | import org.citygml4j.model.citygml.building.AbstractBoundarySurface;
40 | import org.citygml4j.model.citygml.building.BoundarySurfaceProperty;
41 | import org.citygml4j.model.citygml.building.Building;
42 | import org.citygml4j.model.citygml.core.CityModel;
43 | import org.citygml4j.model.gml.geometry.complexes.CompositeSurface;
44 | import org.citygml4j.model.gml.geometry.primitives.Polygon;
45 | import org.citygml4j.model.gml.geometry.primitives.Solid;
46 | import org.citygml4j.model.gml.geometry.primitives.SurfaceProperty;
47 | import org.citygml4j.model.module.citygml.CityGMLVersion;
48 | import org.citygml4j.util.gmlid.DefaultGMLIdManager;
49 | import org.citygml4j.util.gmlid.GMLIdManager;
50 | import org.citygml4j.xml.io.CityGMLOutputFactory;
51 | import org.citygml4j.xml.io.writer.CityGMLWriter;
52 |
53 |
54 | public class Lod2 {
55 | private CityGMLFactory citygml;
56 | private GMLFactory gml;
57 |
58 | public static void main(String[] args) throws Exception {
59 | new Lod2().doMain();
60 | }
61 |
62 | public void doMain() throws Exception {
63 | SimpleDateFormat df = new SimpleDateFormat("[HH:mm:ss] ");
64 |
65 | System.out.println(df.format(new Date()) + "setting up citygml4j context and JAXB builder");
66 | CityGMLContext ctx = new CityGMLContext();
67 | JAXBBuilder builder = ctx.createJAXBBuilder();
68 |
69 | System.out.println(df.format(new Date()) + "creating LOD2 building as citygml4j in-memory object tree");
70 | GMLGeometryFactory geom = new GMLGeometryFactory();
71 | citygml = new CityGMLFactory();
72 | gml = new GMLFactory();
73 |
74 | GMLIdManager gmlIdManager = DefaultGMLIdManager.getInstance();
75 |
76 | Building building = citygml.createBuilding();
77 |
78 | Polygon ground = geom.createLinearPolygon(new double[] {0,0,0, 0,12,0, 6,12,0, 6,0,0, 0,0,0}, 3);
79 | Polygon wall_1 = geom.createLinearPolygon(new double[] {6,0,0, 6,12,0, 6,12,6, 6,0,6, 6,0,0}, 3);
80 | Polygon wall_2 = geom.createLinearPolygon(new double[] {0,0,0, 0,0,6, 0,12,6, 0,12,0, 0,0,0}, 3);
81 | Polygon wall_3 = geom.createLinearPolygon(new double[] {0,0,0, 6,0,0, 6,0,6, 3,0,9, 0,0,6, 0,0,0}, 3);
82 | Polygon wall_4 = geom.createLinearPolygon(new double[] {6,12,0, 0,12,0, 0,12,6, 3,12,9, 6,12,6, 6,12,0}, 3);
83 | Polygon roof_1 = geom.createLinearPolygon(new double[] {6,0,6, 6,12,6, 3,12,9, 3,0,9, 6,0,6}, 3);
84 | Polygon roof_2 = geom.createLinearPolygon(new double[] {0,0,6, 3,0,9, 3,12,9, 0,12,6, 0,0,6}, 3);
85 |
86 | ground.setId(gmlIdManager.generateGmlId());
87 | wall_1.setId(gmlIdManager.generateGmlId());
88 | wall_2.setId(gmlIdManager.generateGmlId());
89 | wall_3.setId(gmlIdManager.generateGmlId());
90 | wall_4.setId(gmlIdManager.generateGmlId());
91 | roof_1.setId(gmlIdManager.generateGmlId());
92 | roof_2.setId(gmlIdManager.generateGmlId());
93 |
94 | // lod2 solid
95 | List surfaceMember = new ArrayList();
96 | surfaceMember.add(gml.createSurfaceProperty('#' + ground.getId()));
97 | surfaceMember.add(gml.createSurfaceProperty('#' + wall_1.getId()));
98 | surfaceMember.add(gml.createSurfaceProperty('#' + wall_2.getId()));
99 | surfaceMember.add(gml.createSurfaceProperty('#' + wall_3.getId()));
100 | surfaceMember.add(gml.createSurfaceProperty('#' + wall_4.getId()));
101 | surfaceMember.add(gml.createSurfaceProperty('#' + roof_1.getId()));
102 | surfaceMember.add(gml.createSurfaceProperty('#' + roof_2.getId()));
103 |
104 | CompositeSurface compositeSurface = gml.createCompositeSurface();
105 | compositeSurface.setSurfaceMember(surfaceMember);
106 | Solid solid = gml.createSolid();
107 | solid.setExterior(gml.createSurfaceProperty(compositeSurface));
108 |
109 | building.setLod2Solid(gml.createSolidProperty(solid));
110 |
111 | // thematic boundary surfaces
112 | List boundedBy = new ArrayList();
113 | boundedBy.add(createBoundarySurface(CityGMLClass.GROUND_SURFACE, ground));
114 | boundedBy.add(createBoundarySurface(CityGMLClass.WALL_SURFACE, wall_1));
115 | boundedBy.add(createBoundarySurface(CityGMLClass.WALL_SURFACE, wall_2));
116 | boundedBy.add(createBoundarySurface(CityGMLClass.WALL_SURFACE, wall_3));
117 | boundedBy.add(createBoundarySurface(CityGMLClass.WALL_SURFACE, wall_4));
118 | boundedBy.add(createBoundarySurface(CityGMLClass.ROOF_SURFACE, roof_1));
119 | boundedBy.add(createBoundarySurface(CityGMLClass.ROOF_SURFACE, roof_2));
120 | building.setBoundedBySurface(boundedBy);
121 |
122 | CityModel cityModel = citygml.createCityModel();
123 | cityModel.setBoundedBy(building.calcBoundedBy(false));
124 | cityModel.addCityObjectMember(citygml.createCityObjectMember(building));
125 |
126 | System.out.println(df.format(new Date()) + "writing citygml4j object tree");
127 | CityGMLOutputFactory out = builder.createCityGMLOutputFactory(CityGMLVersion.v1_0_0);
128 | CityGMLWriter writer = out.createCityGMLWriter(new File("LOD2_Building_v100.xml"));
129 |
130 | writer.setPrefixes(CityGMLVersion.v1_0_0);
131 | writer.setSchemaLocations(CityGMLVersion.v1_0_0);
132 | writer.setIndentString(" ");
133 | writer.write(cityModel);
134 | writer.close();
135 |
136 | System.out.println(df.format(new Date()) + "CityGML file LOD2_Building_v100.xml written");
137 | System.out.println(df.format(new Date()) + "sample citygml4j application successfully finished");
138 | }
139 |
140 | private BoundarySurfaceProperty createBoundarySurface(CityGMLClass type, Polygon geometry) {
141 | AbstractBoundarySurface boundarySurface = null;
142 |
143 | switch (type) {
144 | case WALL_SURFACE:
145 | boundarySurface = citygml.createWallSurface();
146 | break;
147 | case ROOF_SURFACE:
148 | boundarySurface = citygml.createRoofSurface();
149 | break;
150 | case GROUND_SURFACE:
151 | boundarySurface = citygml.createGroundSurface();
152 | break;
153 | }
154 |
155 | if (boundarySurface != null) {
156 | boundarySurface.setLod2MultiSurface(gml.createMultiSurfaceProperty(gml.createMultiSurface(geometry)));
157 | return citygml.createBoundarySurfaceProperty(boundarySurface);
158 | }
159 |
160 | return null;
161 | }
162 |
163 | }
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/samples/Lod3.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.samples;
2 |
3 | //basado en: http://opportunity.bv.tu-berlin.de/software/boards/2/topics/22
4 |
5 | /*
6 | * This file is part of citygml4j.
7 | * Copyright (c) 2007 - 2010
8 | * Institute for Geodesy and Geoinformation Science
9 | * Technische Universitaet Berlin, Germany
10 | * http://www.igg.tu-berlin.de/
11 | *
12 | * The citygml4j library is free software:
13 | * you can redistribute it and/or modify it under the terms of the
14 | * GNU Lesser General Public License as published by the Free
15 | * Software Foundation, either version 3 of the License, or
16 | * (at your option) any later version.
17 | *
18 | * This library is distributed in the hope that it will be useful,
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | * GNU Lesser General Public License for more details.
22 | *
23 | * You should have received a copy of the GNU Lesser General Public
24 | * License along with this library. If not, see
25 | * .
26 | */
27 | import java.io.File;
28 | import java.text.SimpleDateFormat;
29 | import java.util.ArrayList;
30 | import java.util.Date;
31 | import java.util.List;
32 |
33 | import org.citygml4j.CityGMLContext;
34 | import org.citygml4j.builder.jaxb.JAXBBuilder;
35 | import org.citygml4j.factory.CityGMLFactory;
36 | import org.citygml4j.factory.GMLFactory;
37 | import org.citygml4j.factory.geometry.GMLGeometryFactory;
38 | import org.citygml4j.impl.gml.geometry.primitives.InteriorImpl;
39 | import org.citygml4j.model.citygml.CityGMLClass;
40 | import org.citygml4j.model.citygml.building.AbstractBoundarySurface;
41 | import org.citygml4j.model.citygml.building.BoundarySurfaceProperty;
42 | import org.citygml4j.model.citygml.building.Building;
43 | import org.citygml4j.model.citygml.building.Door;
44 | import org.citygml4j.model.citygml.building.InteriorWallSurface;
45 | import org.citygml4j.model.citygml.building.OpeningProperty;
46 | import org.citygml4j.model.citygml.building.WallSurface;
47 | import org.citygml4j.model.citygml.building.Window;
48 | import org.citygml4j.model.citygml.core.CityModel;
49 | import org.citygml4j.model.gml.geometry.complexes.CompositeSurface;
50 | import org.citygml4j.model.gml.geometry.primitives.AbstractRingProperty;
51 | import org.citygml4j.model.gml.geometry.primitives.Interior;
52 | import org.citygml4j.model.gml.geometry.primitives.LinearRing;
53 | import org.citygml4j.model.gml.geometry.primitives.Polygon;
54 | import org.citygml4j.model.gml.geometry.primitives.Ring;
55 | import org.citygml4j.model.gml.geometry.primitives.Solid;
56 | import org.citygml4j.model.gml.geometry.primitives.SurfaceProperty;
57 | import org.citygml4j.model.module.citygml.CityGMLVersion;
58 | import org.citygml4j.util.gmlid.DefaultGMLIdManager;
59 | import org.citygml4j.util.gmlid.GMLIdManager;
60 | import org.citygml4j.xml.io.CityGMLOutputFactory;
61 | import org.citygml4j.xml.io.writer.CityGMLWriter;
62 |
63 |
64 | public class Lod3 {
65 | private CityGMLFactory citygml;
66 | private GMLFactory gml;
67 |
68 | public static void main(String[] args) throws Exception {
69 | new Lod3().doMain();
70 | }
71 |
72 | public void doMain() throws Exception {
73 | SimpleDateFormat df = new SimpleDateFormat("[HH:mm:ss] ");
74 |
75 | System.out.println(df.format(new Date()) + "setting up citygml4j context and JAXB builder");
76 | CityGMLContext ctx = new CityGMLContext();
77 | JAXBBuilder builder = ctx.createJAXBBuilder();
78 |
79 | System.out.println(df.format(new Date()) + "creating LOD3 building as citygml4j in-memory object tree");
80 | GMLGeometryFactory geom = new GMLGeometryFactory();
81 | citygml = new CityGMLFactory();
82 | gml = new GMLFactory();
83 |
84 | GMLIdManager gmlIdManager = DefaultGMLIdManager.getInstance();
85 |
86 | Building building = citygml.createBuilding();
87 |
88 | // second create a wall surface and add it to the building
89 | WallSurface wallSurface = citygml.createWallSurface();
90 |
91 | Polygon wall_3 = geom.createLinearPolygon(new double[] {0,0,0, 6,0,0, 6,0,6, 3,0,9, 0,0,6, 0,0,0}, 3);
92 |
93 | LinearRing opening_3 = geom.createLinearRing(new double[] {2,0,2, 4,0,2, 4,0,4, 2,0,4, 2,0,2}, 3);
94 | Interior interior = new InteriorImpl();
95 | interior.setRing(opening_3);
96 | wall_3.addInterior(interior);
97 |
98 | wallSurface.setLod3MultiSurface(gml.createMultiSurfaceProperty(gml.createMultiSurface(wall_3)));
99 |
100 |
101 | BoundarySurfaceProperty boundedBy = citygml.createBoundarySurfaceProperty();
102 | boundedBy.setObject(wallSurface);
103 |
104 | building.addBoundedBySurface(boundedBy);
105 |
106 | // finally, create a door and associate it with the wall surface
107 | // similar steps are necessary for adding a window
108 | //Door door = citygml.createDoor();
109 | Window ventana = citygml.createWindow();
110 |
111 | Polygon superficieVentana = geom.createLinearPolygon(new double[] {2,0,2, 4,0,2, 4,0,4, 2,0,4, 2,0,2}, 3);
112 | ventana.setLod3MultiSurface(gml.createMultiSurfaceProperty(gml.createMultiSurface(superficieVentana)));
113 |
114 | OpeningProperty openingProperty = citygml.createOpeningProperty();
115 | //openingProperty.setOpening(door);
116 | openingProperty.setObject(ventana);
117 |
118 | wallSurface.addOpening(openingProperty);
119 |
120 |
121 | CityModel cityModel = citygml.createCityModel();
122 | cityModel.setBoundedBy(building.calcBoundedBy(false));
123 | cityModel.addCityObjectMember(citygml.createCityObjectMember(building));
124 |
125 | System.out.println(df.format(new Date()) + "writing citygml4j object tree");
126 | CityGMLOutputFactory out = builder.createCityGMLOutputFactory(CityGMLVersion.v1_0_0);
127 | CityGMLWriter writer = out.createCityGMLWriter(new File("LOD3_Building_v100.xml"));
128 |
129 | writer.setPrefixes(CityGMLVersion.v1_0_0);
130 | writer.setSchemaLocations(CityGMLVersion.v1_0_0);
131 | writer.setIndentString(" ");
132 | writer.write(cityModel);
133 | writer.close();
134 |
135 | System.out.println(df.format(new Date()) + "CityGML file LOD3_Building_v100.xml written");
136 | System.out.println(df.format(new Date()) + "sample citygml4j application successfully finished");
137 | }
138 |
139 | private BoundarySurfaceProperty createBoundarySurface(CityGMLClass type, Polygon geometry) {
140 | AbstractBoundarySurface boundarySurface = null;
141 |
142 | switch (type) {
143 | case WALL_SURFACE:
144 | boundarySurface = citygml.createWallSurface();
145 | break;
146 | case ROOF_SURFACE:
147 | boundarySurface = citygml.createRoofSurface();
148 | break;
149 | case GROUND_SURFACE:
150 | boundarySurface = citygml.createGroundSurface();
151 | break;
152 | }
153 |
154 | if (boundarySurface != null) {
155 | boundarySurface.setLod2MultiSurface(gml.createMultiSurfaceProperty(gml.createMultiSurface(geometry)));
156 | return citygml.createBoundarySurfaceProperty(boundarySurface);
157 | }
158 |
159 | return null;
160 | }
161 |
162 |
163 | }
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/samples/PruebaAngulo2Vectores.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.samples;
2 |
3 | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
4 |
5 | public class PruebaAngulo2Vectores {
6 |
7 |
8 | public static void main(String[] args){
9 |
10 | Vector3D normal = new Vector3D(1,1,-0.001);
11 |
12 | Vector3D normalPlanoXY = new Vector3D(0,0,-1);
13 |
14 | double angulo = Vector3D.angle(normalPlanoXY, normal);
15 |
16 | System.out.println(Math.toDegrees(angulo));
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/samples/PruebaCentroide.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.samples;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collections;
5 | import java.util.Iterator;
6 | import java.util.List;
7 |
8 | import org.apache.commons.math3.geometry.euclidean.threed.Plane;
9 | import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
10 | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
11 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
12 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Poligono;
13 | import co.edu.udistrital.bim2gis4j.util.ComparadorAngulos;
14 |
15 | import com.vividsolutions.jts.algorithm.CentroidPoint;
16 | import com.vividsolutions.jts.geom.Coordinate;
17 |
18 | public class PruebaCentroide {
19 |
20 | /**
21 | * @param args
22 | */
23 | public static void main(String[] args) {
24 | // TODO Auto-generated method stub
25 |
26 | Poligono poli = new Poligono();
27 |
28 | poli.getCoordenadas().add(new Coordenada(new Vector3D( 0.0, 0.0, 3.2 )));
29 | poli.getCoordenadas().add(new Coordenada(new Vector3D( 11.7, 0.3, 3.3732050815137757 )));
30 | poli.getCoordenadas().add(new Coordenada(new Vector3D( 12.0, 0.0, 3.2 )));
31 | poli.getCoordenadas().add(new Coordenada(new Vector3D( 0.3000000000000007, 0.3, 3.3732050815137757 )));
32 |
33 | poli.ordenarVerticesRespectoACentroide();
34 |
35 | //System.out.println(poli.getCentroide());
36 |
37 | //ordena las coordenadas respecto al centroide para que el poligono se genere correctamente, evitando cruces de bordes por ejemplo
38 | //Collections.sort(poli.getCoordenadas(), new ComparadorAngulos(poli.getCentroide()));
39 |
40 | System.out.println(poli.toString());
41 | }
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/samples/PruebaCommonsMath.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.samples;
2 |
3 | import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
4 | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
5 |
6 | public class PruebaCommonsMath {
7 |
8 | /**
9 | * @param args
10 | */
11 | public static void main(String[] args) {
12 | // TODO Auto-generated method stub
13 |
14 | Vector3D axisX = new Vector3D(1, 0, 0);
15 | //Vector3D axisY = new Vector3D(0, 1, 0);
16 | Vector3D axisZ = new Vector3D(0, 0, 1);
17 |
18 | Vector3D deseadoX = new Vector3D(0, 0.434187, 0.900823); //(AXIS, eje Z)
19 | //Vector3D deseadoX = new Vector3D(0, 0, 1); //(AXIS, eje Z)
20 | Vector3D deseadoZ = new Vector3D(1, 0, 0); //(refdirection, eje X)
21 | //Vector3D deseadoY = Vector3D.crossProduct(deseadoX, deseadoZ); // producto cruz
22 | //System.out.println(Vector3D.crossProduct(deseadoX, deseadoZ));
23 |
24 | Rotation rotacionX = new Rotation(axisX,deseadoZ);
25 | //Rotation rotacionY = new Rotation(axisY,deseadoY);
26 | Rotation rotacionZ = new Rotation(axisZ,deseadoX);
27 |
28 | Vector3D punto = new Vector3D(1, 1, 1);
29 |
30 | Vector3D puntoRotado = rotacionX.applyTo(punto);
31 | //puntoRotado = rotacionY.applyTo(puntoRotado);
32 | puntoRotado = rotacionZ.applyTo(puntoRotado);
33 |
34 | System.err.println(puntoRotado);
35 |
36 | //System.err.println(puntoRotado.getNorm());
37 |
38 |
39 |
40 | }
41 |
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/samples/PruebaSentidoHorario.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.samples;
2 |
3 | import java.util.Collections;
4 |
5 | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
6 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
7 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Poligono;
8 |
9 | public class PruebaSentidoHorario {
10 |
11 | // http://stackoverflow.com/questions/1988100/how-to-determine-ordering-of-3d-vertices
12 | //
13 | // As others have noted, your question isn't entirely clear. Is the for something like a 3D backface culling test?
14 | // If so, you need a point to determine the winding direction relative to. Viewed from one side of the polygon the
15 | // vertices will appear to wind clockwise. From the other side they'll appear to wind counter clockwise.
16 | //
17 | // But suppose your polygon is convex and properly planar. Take any three consecutive vertices A, B, and C.
18 | // Then you can find the surface normal vector using the cross product:
19 | //
20 | // N = (B - A) x (C - A)
21 | // Taking the dot product of the normal with a vector from the given view point, V, to one of the vertices
22 | // will give you a value whose sign indicates which way the vertices appear to wind when viewed from V:
23 | //
24 | // w = N . (A - V)
25 | //
26 | // Whether this is positive for clockwise and negative for anticlockwise or the opposite will depend on
27 | // the handedness of your coordinate system.
28 |
29 | public static void main(String[] args) {
30 |
31 |
32 | Poligono p = new Poligono();
33 |
34 | p.getCoordenadas().add(new Coordenada(-0.5, 5.00000000155568, 6.317691469461097));
35 | p.getCoordenadas().add(new Coordenada(12.5, 5.00000000155568, 6.317691469461097));
36 | p.getCoordenadas().add(new Coordenada(12.5, -0.5000000001555679, 3.1422649740538904));
37 | p.getCoordenadas().add(new Coordenada(-0.5, -0.5000000001555679, 3.1422649740538904));
38 | p.getCoordenadas().add(new Coordenada(-0.5, 5.00000000155568, 6.317691469461097));
39 |
40 | Vector3D A = p.getCoordenadas().get(0).toVector3D();
41 | Vector3D B = p.getCoordenadas().get(1).toVector3D();
42 | Vector3D C = p.getCoordenadas().get(2).toVector3D();
43 | Vector3D B_A = B.subtract(A);
44 | Vector3D C_A = C.subtract(A);
45 |
46 | Vector3D V = new Vector3D(0,0,0);
47 | Vector3D A_V = A.subtract(V);
48 |
49 | Vector3D N = B_A.crossProduct(C_A);
50 |
51 | //si sentido es negativo el poligono es antihorario, si no es horario
52 | double sentido = N.dotProduct(A_V);
53 |
54 | System.out.println("Originales = " + p);
55 | System.out.println(sentido);
56 |
57 | if(sentido<0){
58 | Collections.reverse(p.getCoordenadas());
59 | System.out.println("Revertidas = " + p);
60 | }
61 |
62 |
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/samples/PruebaSiluetaMuro.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.samples;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import org.apache.commons.math3.geometry.euclidean.threed.Plane;
8 | import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
9 | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
10 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
11 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Poligono;
12 |
13 | import com.vividsolutions.jts.geom.Coordinate;
14 | import com.vividsolutions.jts.geom.Geometry;
15 | import com.vividsolutions.jts.geom.GeometryFactory;
16 | import com.vividsolutions.jts.geom.LinearRing;
17 | import com.vividsolutions.jts.geom.Polygon;
18 |
19 | public class PruebaSiluetaMuro {
20 |
21 | /**
22 | * @param args
23 | */
24 | public static void main(String[] args) {
25 | // TODO Auto-generated method stub
26 |
27 | /*
28 | //EJEMPLO QUE DEVUELVE UN SOLO POLIGONO
29 | Poligono caraMuro = new Poligono();
30 |
31 | caraMuro.getCoordenadas().add(new Coordenada(new Vector3D( 0.3, 5.75, 0.0 )));
32 | caraMuro.getCoordenadas().add(new Coordenada(new Vector3D( 7.41, 5.75, 0.0 )));
33 | caraMuro.getCoordenadas().add(new Coordenada(new Vector3D( 7.41, 5.75, 2.5 )));
34 | caraMuro.getCoordenadas().add(new Coordenada(new Vector3D( 0.3, 5.75, 2.5 )));
35 | caraMuro.getCoordenadas().add(new Coordenada(new Vector3D( 0.3, 5.75, 0.0 )));
36 |
37 | Poligono caraPuerta = new Poligono();
38 |
39 | caraPuerta.getCoordenadas().add(new Coordenada(new Vector3D( 6.1025, 5.75, 0.0 )));
40 | caraPuerta.getCoordenadas().add(new Coordenada(new Vector3D( 6.1025, 5.75, 2.01 )));
41 | caraPuerta.getCoordenadas().add(new Coordenada(new Vector3D( 5.2175, 5.75, 2.01 )));
42 | caraPuerta.getCoordenadas().add(new Coordenada(new Vector3D( 5.2175, 5.75, 0.0 )));
43 | caraPuerta.getCoordenadas().add(new Coordenada(new Vector3D( 6.1025, 5.75, 0.0 )));
44 |
45 | */
46 |
47 |
48 | /*
49 | //EJEMPLO QUE DEVUELVE DOS POLIGONOS
50 |
51 | Poligono caraMuro = new Poligono();
52 |
53 | caraMuro.getCoordenadas().add(new Coordenada(new Vector3D( 0.3, 5.75, 0.0 )));
54 | caraMuro.getCoordenadas().add(new Coordenada(new Vector3D( 7.41, 5.75, 0.0 )));
55 | caraMuro.getCoordenadas().add(new Coordenada(new Vector3D( 7.41, 5.99, 0.0 )));
56 | caraMuro.getCoordenadas().add(new Coordenada(new Vector3D( 0.3, 5.99, 0.0 )));
57 | caraMuro.getCoordenadas().add(new Coordenada(new Vector3D( 0.3, 5.75, 0.0 )));
58 |
59 | Poligono caraPuerta = new Poligono();
60 |
61 | caraPuerta.getCoordenadas().add(new Coordenada(new Vector3D( 5.2175, 5.75, 0.0 )));
62 | caraPuerta.getCoordenadas().add(new Coordenada(new Vector3D( 6.1025, 5.75, 0.0 )));
63 | caraPuerta.getCoordenadas().add(new Coordenada(new Vector3D( 6.1025, 5.99, 0.0 )));
64 | caraPuerta.getCoordenadas().add(new Coordenada(new Vector3D( 5.2175, 5.99, 0.0 )));
65 | caraPuerta.getCoordenadas().add(new Coordenada(new Vector3D( 5.2175, 5.75, 0.0 )));
66 | */
67 |
68 | Poligono original = new Poligono();
69 |
70 | original.getCoordenadas().add(new Coordenada(new Vector3D( 7.41, 5.99, 0.0 )));
71 | original.getCoordenadas().add(new Coordenada(new Vector3D( 0.3, 5.99, 0.0 )));
72 | original.getCoordenadas().add(new Coordenada(new Vector3D( 0.3, 5.99, 2.5 )));
73 | original.getCoordenadas().add(new Coordenada(new Vector3D( 7.41, 5.99, 2.5 )));
74 | original.getCoordenadas().add(new Coordenada(new Vector3D( 7.41, 5.99, 0.0 )));
75 |
76 | Poligono tijera01 = new Poligono();
77 |
78 | tijera01.getCoordenadas().add(new Coordenada(new Vector3D( 2.4924999999999997, 5.99, 0.0 )));
79 | tijera01.getCoordenadas().add(new Coordenada(new Vector3D( 2.4924999999999997, 5.99, 2.01 )));
80 | tijera01.getCoordenadas().add(new Coordenada(new Vector3D( 1.6075, 5.99, 2.01 )));
81 | tijera01.getCoordenadas().add(new Coordenada(new Vector3D( 1.6075, 5.99, 0.0 )));
82 | tijera01.getCoordenadas().add(new Coordenada(new Vector3D( 2.4924999999999997, 5.99, 0.0 )));
83 |
84 |
85 | //Resultado = Polygon[(2.4924999999999997, 5.99, 0.0) ,(7.41, 5.99, 0.0) ,(7.41, 5.99, 2.5) ,(0.3, 5.99, 2.5) ,(0.3, 5.99, 0.0) ,(1.6075, 5.99, 0.0) ,(2.4924999999999997, 5.99, 0.0)]
86 | //Tijera Polygon[(6.1025, 5.99, 0.0) ,(6.1025, 5.99, 2.01) ,(5.2175, 5.99, 2.01) ,(5.2175, 5.99, 0.0) ,(6.1025, 5.99, 0.0)]
87 | //Resultado = Polygon[(5.2175, 5.99, 0.0) ,(2.4924999999999997, 5.99, 0.0) ,(1.6075, 5.99, 0.0) ,(0.3, 5.99, 0.0) ,(0.3, 5.990000000000002, 2.5000000000000004) ,(7.41, 5.990000000000002, 2.5000000000000004) ,(7.41, 5.99, 0.0) ,(6.102499999999998, 5.99, 0.0) ,(6.102499999999998, 5.99, 2.0100000000000002) ,(5.2175, 5.99, 2.0100000000000002) ,(5.2175, 5.99, 0.0)]
88 |
89 |
90 | System.out.println("original = " + original);
91 | System.out.println("tijera01 = " + tijera01);
92 |
93 | List resultado = original.diferencia(tijera01);
94 |
95 | for (Poligono actual : resultado) {
96 |
97 | System.out.println(actual);
98 |
99 | }
100 |
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/util/BuildingCreator.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FredyBello/BIM2GIS4J/b2c69bde71b6f89ea6026f4bed7c9353fad48029/src/co/edu/udistrital/bim2gis4j/util/BuildingCreator.java
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/util/ComparadorAngulos.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.util;
2 |
3 | import java.util.Comparator;
4 |
5 | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
6 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
7 |
8 | import com.vividsolutions.jts.geom.Coordinate;
9 |
10 |
11 | //basado en http://stackoverflow.com/questions/19713092/how-to-order-vertices-in-a-non-convex-polygon-how-to-find-one-of-many-solutions
12 | public class ComparadorAngulos implements Comparator{
13 |
14 | Coordinate centroide;
15 |
16 | public ComparadorAngulos(Coordinate pCentroide){
17 | centroide = pCentroide;
18 | }
19 |
20 | //compara los angulos de dos coordenadas respecto a un centroide
21 | @Override
22 | public int compare(Coordenada cA, Coordenada cB) {
23 |
24 | int r = 0;
25 |
26 | double anguloDeA = Math.atan2(cA.getY() - centroide.y, cA.getX() - centroide.x);
27 | double anguloDeB = Math.atan2(cB.getY() - centroide.y, cB.getX() - centroide.x);
28 |
29 | if(anguloDeA > anguloDeB){
30 | r = 1;
31 | }
32 |
33 | if(anguloDeA == anguloDeB){
34 |
35 | double distanciaA = Vector3D.distance(cA.toVector3D(), new Vector3D(centroide.x, centroide.y, centroide.z));
36 | double distanciaB = Vector3D.distance(cB.toVector3D(), new Vector3D(centroide.x, centroide.y, centroide.z));
37 |
38 | if(distanciaA < distanciaB) r = 1;
39 | if(distanciaB < distanciaA) r = -1;
40 | }
41 |
42 | if(anguloDeA < anguloDeB){
43 | r = -1;
44 | }
45 |
46 | return r;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/util/LatLonConvert.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.util;
2 |
3 | /******************************************************************************
4 | *
5 | * LatLonConvert.java
6 | *
7 | *******************************************************************************
8 | *
9 | * Java Class: LatLonConvert
10 | *
11 | * This Java class is part of a collection of classes developed for the
12 | * reading and processing of oceanographic and meterological data collected
13 | * since 1970 by environmental buoys and stations. This dataset is
14 | * maintained by the National Oceanographic Data Center and is publicly
15 | * available. These Java classes were written for the US Environmental
16 | * Protection Agency's National Exposure Research Laboratory under Contract
17 | * No. GS-10F-0073K with Neptune and Company of Los Alamos, New Mexico.
18 | *
19 | * Purpose:
20 | *
21 | * This class contains utilities for latitude/longitude conversions.
22 | * Specifically, this class performs conversions from lat (or long)
23 | * in decimal degrees to degrees-minutes-seconds, and vice versa.
24 | *
25 | * Inputs:
26 | *
27 | * Given a decimal degree, the equivalent degrees/minutes/seconds
28 | * are calculated, and vice versa, using two methods.
29 | *
30 | * Outputs:
31 | *
32 | * The outputs are provided as public accessor methods:
33 | * double getDecimal() returns decimal degrees
34 | * double getDegree() returns degree part of degree/minute/second
35 | * double getMinute() returns minute part of degree/minute/second
36 | * double getSecond() returns second part of degree/minute/second
37 | *
38 | * Required classes or packages:
39 | *
40 | * Classes from the java language:
41 | *
42 | * java.lang.Math
43 | *
44 | * Classes developed as part of this project:
45 | *
46 | * None
47 | *
48 | * Required functions or methods:
49 | *
50 | * None
51 | *
52 | * Package of which this class is a member:
53 | *
54 | * default
55 | *
56 | * Known limitations:
57 | *
58 | * Values provided to this class as input are assumed to be valid,
59 | * but the math doesn't care.
60 | *
61 | * Compatibility:
62 | *
63 | * Java 1.1.8
64 | *
65 | * References:
66 | *
67 | * None.
68 | *
69 | * Author/Company:
70 | *
71 | * JDT: Neptune and Company
72 | *
73 | * Change log:
74 | *
75 | * date ver by description of change
76 | * _________ ____ ___ ________________________________________________
77 | * 06 Feb 01 0.01 JDT Original coding.
78 | * 07 Feb 01 0.02 JDT Fixed conversion from negative Lat Long.
79 | * 07 Feb 01 0.03 JDT Fixed roundoff problems with sec.
80 | * 12 Feb 01 0.04 JDT Fixed roundoff problems with min.
81 | * 27 Feb 01 0.05 JDT Renamed LatLonUtil to LatLonConvert and
82 | * provided an overloaded constructor, and
83 | * accessor methods.
84 | * 28 Mar 01 1.10 JDT Final version accompanying deliverable 1b.
85 | * 13 Aug 01 1.20 JDT Final version accompanying deliverable 1c.
86 | * 4 Sep 01 1.21 JDT Thorough code and comment review.
87 | * 21 Sep 01 1.30 JDT Final version accompanying deliverable 2.
88 | * 17 Dec 01 1.40 JDT Version accompanying final deliverable.
89 | *
90 | * -------------------------------------------------------------------------- */
91 |
92 | // Import required classes
93 | import java.lang.Math;
94 |
95 | /******************************************************************************
96 | * class: LatLonConvert class
97 | *******************************************************************************
98 | *
99 | * This class contains utilities for latitude/longitude conversions.
100 | *
101 | * -------------------------------------------------------------------------- */
102 | public class LatLonConvert
103 | {
104 | // declare local variables used throughout the class
105 | private double dfDecimal; // decimal degrees
106 | private double dfDegree; // degree part of degrees/minutes/seconds
107 | private double dfMinute; // minute part of degrees/minutes/seconds
108 | private double dfSecond; // second part of degrees/minutes/seconds
109 |
110 |
111 | /******************************************************************************
112 | * method: LatLonConvert
113 | *******************************************************************************
114 | *
115 | * The two constructors for LatLonConvert class accept either
116 | *
117 | * - a single double, which is interpreted as decimal degrees to be
118 | * converted to degrees/minutes/seconds, or
119 | *
120 | * - three doubles, which are interpreted as values of degrees, minutes,
121 | * and seconds, respectively, to be converted to decimal degrees.
122 | *
123 | * Member of LatLonConvert class
124 | *
125 | * -------------------------------------------------------------------------- */
126 |
127 | // This constructor converts decimal degrees to degrees/minutes/seconds
128 | public LatLonConvert(
129 | double dfDecimalIn
130 | )
131 | {
132 | // load local variables
133 | dfDecimal = dfDecimalIn;
134 |
135 | // call appropriate conversion method
136 | fromDec2DMS();
137 | }
138 |
139 | // This constructor converts degrees/minutes/seconds to decimal degrees
140 | public LatLonConvert(
141 | double dfDegreeIn,
142 | double dfMinuteIn,
143 | double dfSecondIn
144 | )
145 | {
146 | // load local variables
147 | dfDegree = dfDegreeIn;
148 | dfMinute = dfMinuteIn;
149 | dfSecond = dfSecondIn;
150 |
151 | // call appropriate conversion method
152 | fromDMS2Dec();
153 | }
154 |
155 |
156 | /******************************************************************************
157 | * method: fromDec2DMS()
158 | *******************************************************************************
159 | *
160 | * Converts decimal degrees to degrees/minutes/seconds.
161 | *
162 | * Member of LatLonConvert class
163 | *
164 | * -------------------------------------------------------------------------- */
165 | private void fromDec2DMS()
166 | {
167 | // define variables local to this method
168 | double dfFrac; // fraction after decimal
169 | double dfSec; // fraction converted to seconds
170 |
171 | // Get degrees by chopping off at the decimal
172 | dfDegree = Math.floor( dfDecimal );
173 | // correction required since floor() is not the same as int()
174 | if ( dfDegree < 0 )
175 | dfDegree = dfDegree + 1;
176 |
177 | // Get fraction after the decimal
178 | dfFrac = Math.abs( dfDecimal - dfDegree );
179 |
180 | // Convert this fraction to seconds (without minutes)
181 | dfSec = dfFrac * 3600;
182 |
183 | // Determine number of whole minutes in the fraction
184 | dfMinute = Math.floor( dfSec / 60 );
185 |
186 | // Put the remainder in seconds
187 | dfSecond = dfSec - dfMinute * 60;
188 |
189 | // Fix rounoff errors
190 | if ( Math.rint( dfSecond ) == 60 )
191 | {
192 | dfMinute = dfMinute + 1;
193 | dfSecond = 0;
194 | }
195 |
196 | if ( Math.rint( dfMinute ) == 60 )
197 | {
198 | if ( dfDegree < 0 )
199 | dfDegree = dfDegree - 1;
200 | else // ( dfDegree => 0 )
201 | dfDegree = dfDegree + 1;
202 |
203 | dfMinute = 0;
204 | }
205 |
206 | return;
207 | }
208 |
209 |
210 | /******************************************************************************
211 | * method: fromDMS2Dec()
212 | *******************************************************************************
213 | *
214 | * Converts degrees/minutes/seconds to decimal degrees.
215 | *
216 | * Member of LatLonConvert class
217 | *
218 | * -------------------------------------------------------------------------- */
219 | private void fromDMS2Dec()
220 | {
221 | // define variables local to this method
222 | double dfFrac; // fraction after decimal
223 |
224 | // Determine fraction from minutes and seconds
225 | dfFrac = dfMinute / 60 + dfSecond / 3600;
226 |
227 | // Be careful to get the sign right. dfDegIn is the only signed input.
228 | if ( dfDegree < 0 )
229 | dfDecimal = dfDegree - dfFrac;
230 | else
231 | dfDecimal = dfDegree + dfFrac;
232 |
233 | return;
234 | }
235 |
236 |
237 | /******************************************************************************
238 | * method: getDecimal()
239 | *******************************************************************************
240 | *
241 | * Gets the value in decimal degrees.
242 | *
243 | * Member of LatLonConvert class
244 | *
245 | * -------------------------------------------------------------------------- */
246 | public double getDecimal()
247 | {
248 | return( dfDecimal );
249 | }
250 |
251 |
252 | /******************************************************************************
253 | * method: getDegree()
254 | *******************************************************************************
255 | *
256 | * Gets the degree part of degrees/minutes/seconds.
257 | *
258 | * Member of LatLonConvert class
259 | *
260 | * -------------------------------------------------------------------------- */
261 | public double getDegree()
262 | {
263 | return( dfDegree );
264 | }
265 |
266 |
267 | /******************************************************************************
268 | * method: getMinute()
269 | *******************************************************************************
270 | *
271 | * Gets the minute part of degrees/minutes/seconds.
272 | *
273 | * Member of LatLonConvert class
274 | *
275 | * -------------------------------------------------------------------------- */
276 | public double getMinute()
277 | {
278 | return( dfMinute );
279 | }
280 |
281 |
282 | /******************************************************************************
283 | * method: getSecond()
284 | *******************************************************************************
285 | *
286 | * Gets the second part of degrees/minutes/seconds.
287 | *
288 | * Member of LatLonConvert class
289 | *
290 | * -------------------------------------------------------------------------- */
291 | public double getSecond()
292 | {
293 | return( dfSecond );
294 | }
295 |
296 |
297 | }
298 |
299 | /*-----------------------------------------------------------------------------
300 | * end of class
301 | *----------------------------------------------------------------------------*/
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/util/LectorAxis2Placement3D.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.util;
2 |
3 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.DOUBLE;
4 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcAxis2Placement3D;
5 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcCartesianPoint;
6 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcDirection;
7 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcLengthMeasure;
8 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.LIST;
9 |
10 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
11 | import co.edu.udistrital.bim2gis4j.ifc.Placement;
12 |
13 |
14 | public class LectorAxis2Placement3D {
15 |
16 |
17 | public static void leerAxis2Placement3D (Placement objectPlacementRecibido, IfcAxis2Placement3D axis2Placement3D){
18 |
19 | //Se lee location
20 |
21 | IfcCartesianPoint locationC = axis2Placement3D.getLocation();
22 | LIST coordinatesC = locationC.getCoordinates();
23 |
24 | int coordenadasC = coordinatesC.size();
25 |
26 | Coordenada coordC = new Coordenada();
27 | for(int n = 0; n directionRatios = axis.getDirectionRatios();
47 |
48 | int coordenadas = directionRatios.size();
49 |
50 | Coordenada coord = new Coordenada();
51 |
52 | for(int n = 0; n coordinates = puntoCartesiano.getCoordinates();
17 |
18 | int coordenadas = coordinates.size();
19 |
20 | Coordenada r = new Coordenada();
21 | for(int n = 0; n coordinates = puntoCartesiano.getDirectionRatios();
41 |
42 | int coordenadas = coordinates.size();
43 |
44 | Coordenada r = new Coordenada();
45 | for(int n = 0; n 0)) {
24 |
25 | System.out.println(event.getMessage() + " - "
26 | + event.getCurrentState() + "%");
27 | }
28 | }
29 | });
30 | try {
31 | modeloEnMemoria.readStepFile(file);
32 | } catch (Exception e) {
33 | e.printStackTrace();
34 | }
35 |
36 | return modeloEnMemoria;
37 |
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/util/LectorMuros.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.util;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collection;
5 | import java.util.Iterator;
6 | import java.util.List;
7 | /*
8 | import jp.ne.so_net.ga2.no_ji.jcom.IDispatch;
9 | import jp.ne.so_net.ga2.no_ji.jcom.ReleaseManager;
10 | */
11 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.DOUBLE;
12 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcArbitraryClosedProfileDef;
13 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcAxis2Placement2D;
14 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcAxis2Placement3D;
15 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcBooleanClippingResult;
16 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcBuildingStorey;
17 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcCartesianPoint;
18 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcCompositeCurve;
19 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcCompositeCurveSegment;
20 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcCurve;
21 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcDirection;
22 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcExtrudedAreaSolid;
23 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcLengthMeasure;
24 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcLocalPlacement;
25 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcPolyline;
26 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcPositiveLengthMeasure;
27 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcProduct;
28 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcProductDefinitionShape;
29 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcProductRepresentation;
30 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRectangleProfileDef;
31 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRelAggregates;
32 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRelContainedInSpatialStructure;
33 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRepresentation;
34 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRepresentationItem;
35 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRoof;
36 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcSlab;
37 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcSlabTypeEnum;
38 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcTrimmedCurve;
39 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcWall;
40 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcWallStandardCase;
41 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.LIST;
42 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.SET;
43 | import openifctools.com.openifcjavatoolbox.ifcmodel.IfcModel;
44 |
45 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
46 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Edificio;
47 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Muro;
48 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Piso;
49 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Plancha;
50 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Rectangulo;
51 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Segmento;
52 |
53 | public class LectorMuros {
54 |
55 | protected List listaTechosAgregados = new ArrayList();
56 |
57 | public void cargarDatosBasicos(IfcModel ifcModel, Edificio edificio){
58 |
59 |
60 | //Se leen los pisos del edificio y se cargan los IDs de muros
61 | for (IfcRelContainedInSpatialStructure currentRelation : (Collection) ifcModel
62 | .getCollection(IfcRelContainedInSpatialStructure.class)) {
63 | // solo interesa averiguar por los PISOS del edificio
64 | if (currentRelation.getRelatingStructure() instanceof IfcBuildingStorey) {
65 | IfcBuildingStorey storey = (IfcBuildingStorey) currentRelation
66 | .getRelatingStructure();
67 | // no se tienen en cuenta los pisos subterraneos ni el piso base
68 | // (elevation = 0)
69 | if (storey.getElevation().value >= 0) {
70 |
71 | Piso pisoActual = edificio.buscarPiso(storey.getGlobalId().toString());
72 |
73 | if(pisoActual != null){
74 |
75 | SET relatedElements = currentRelation
76 | .getRelatedElements();
77 |
78 | // se buscan las planchas que tenga el piso
79 | for (Object product : relatedElements) {
80 |
81 | Muro muroActual = new Muro();
82 |
83 | muroActual.setIfcModel(ifcModel);
84 | muroActual.setPisoPadre(pisoActual);
85 |
86 | if (product instanceof IfcWallStandardCase) {
87 |
88 | IfcWallStandardCase currentWall = (IfcWallStandardCase) product;
89 |
90 | muroActual.setId(currentWall.getGlobalId().toString());
91 | muroActual.setTipo("ESTANDAR");
92 | pisoActual.getMuros().add(muroActual);
93 |
94 |
95 | }else if (product instanceof IfcWall){ //los muros que no son estandar
96 |
97 | IfcWall currentWall = (IfcWall) product;
98 | muroActual.setId(currentWall.getGlobalId().toString());
99 | muroActual.setTipo("NO ESTANDAR");
100 | pisoActual.getMuros().add(muroActual);
101 |
102 | }
103 | }
104 | }
105 | }
106 | }
107 | }
108 | }
109 |
110 | public void leerMuros(List pisos, IfcModel ifcModel){
111 |
112 |
113 | try {
114 |
115 | for (Piso pisoActual : pisos) {
116 | for (Muro muroActual : pisoActual.getMuros()){
117 |
118 | muroActual.objectPlacement.setPlacementRelTo_placementRelTo(new Coordenada());
119 | muroActual.objectPlacement.setPlacementRelTo_relativePlacement(new Coordenada());
120 |
121 | muroActual.objectPlacement.setRelativePlacement_location(new Coordenada());
122 | //Definition from IAI: If the attribute values for Axis and RefDirection are not given, the placement defaults to P[1] (x-axis) as [1.,0.,0.], P[2] (y-axis) as [0.,1.,0.] and P[3] (z-axis) as [0.,0.,1.].
123 | //planchaActual.objectPlacement.setRelativePlacement_axis(new Coordenada(1,0,0));
124 | muroActual.objectPlacement.setRelativePlacement_axis(null);
125 | //planchaActual.objectPlacement.setRelativePlacement_refDirection(new Coordenada(0,0,1));
126 | muroActual.objectPlacement.setRelativePlacement_refDirection(null);
127 |
128 | muroActual.representation.setRepresentation_position_location(new Coordenada());
129 | //Definition from IAI: If the attribute values for Axis and RefDirection are not given, the placement defaults to P[1] (x-axis) as [1.,0.,0.], P[2] (y-axis) as [0.,1.,0.] and P[3] (z-axis) as [0.,0.,1.].
130 | //planchaActual.representation.setRepresentation_position_axis(new Coordenada(1,0,0));
131 | muroActual.representation.setRepresentation_position_axis(null);
132 | //planchaActual.representation.setRepresentation_position_refDirection(new Coordenada(0,0,1));
133 | muroActual.representation.setRepresentation_position_refDirection(null);
134 |
135 | muroActual.representation.setRepresentation_extruded_direction(new Coordenada());
136 |
137 |
138 |
139 |
140 |
141 | Object objeto = ifcModel.getIfcObjectByID(muroActual.getId());
142 |
143 | if (objeto instanceof IfcWallStandardCase) {
144 |
145 | IfcWallStandardCase muroEncontrado = (IfcWallStandardCase) ifcModel.getIfcObjectByID(muroActual.getId());
146 |
147 |
148 | //Se ubica en el nodo objectPlacement->placementRelTo de la plancha
149 | IfcLocalPlacement objectPlacement = (IfcLocalPlacement) muroEncontrado.getObjectPlacement();
150 | IfcLocalPlacement placementRelToA = (IfcLocalPlacement) objectPlacement.getPlacementRelTo();
151 |
152 |
153 |
154 | //Se lee PlacementRelTo
155 | IfcLocalPlacement placementRelToB = (IfcLocalPlacement) placementRelToA.getPlacementRelTo();
156 | IfcAxis2Placement3D relativePlacementA = (IfcAxis2Placement3D) placementRelToB.getRelativePlacement();
157 | muroActual.objectPlacement.setPlacementRelTo_placementRelTo(LectorCoordenada.Leer(relativePlacementA.getLocation()));
158 |
159 |
160 |
161 | //Se lee RelativePlacement
162 |
163 | IfcAxis2Placement3D relativePlacementB = (IfcAxis2Placement3D) placementRelToA.getRelativePlacement();
164 | muroActual.objectPlacement.setPlacementRelTo_relativePlacement(LectorCoordenada.Leer(relativePlacementB.getLocation()));
165 |
166 |
167 | //Se lee location
168 |
169 | IfcAxis2Placement3D relativePlacementC = (IfcAxis2Placement3D) objectPlacement.getRelativePlacement();
170 | LectorAxis2Placement3D.leerAxis2Placement3D(muroActual.objectPlacement, relativePlacementC);
171 |
172 |
173 | //Se lee Representation
174 |
175 | IfcProductDefinitionShape representation = (IfcProductDefinitionShape) muroEncontrado.getRepresentation();
176 |
177 | //se asume que siempre va a existir UNA sola representacion (SOLO SE LEE LA POSICION 0)
178 |
179 | for (IfcRepresentation repActual : representation.getRepresentations()) {
180 |
181 |
182 | //posible valores = Clipping - Curve2D - SweptSolid
183 | if(repActual.getRepresentationType().toString().equals("SweptSolid")){
184 |
185 | //System.err.println("Procesando representation " + repActual.getStepLineNumber() + " en muro " + muroActual.getId());
186 | procesarSweptSolid(repActual, muroActual);
187 |
188 | }else if (repActual.getRepresentationType().toString().equals("Clipping")){
189 |
190 | //System.err.println("En muro " + muroActual.getId() + " procesando representation tipo Clipping con STEP number = " + repActual.getStepLineNumber());
191 | procesarClipping(repActual, muroActual);
192 |
193 | }else if (repActual.getRepresentationType().toString().equals("Curve2D")){
194 |
195 | //System.err.println("MURO " + muroActual.getId() + " DESCARTADA REPRESENTATION PORQUE ES TIPO \"Curve2D\" STEP NUMBER = " + repActual.getStepLineNumber());
196 | muroActual.representation.setRepresentation_representationType("DESCARTADA - " + repActual.getRepresentationType().toString());
197 |
198 | }else{
199 |
200 | System.err.println("DESCARTADA REPRESENTATION PORQUE ES TIPO DESCONOCIDO");
201 |
202 | }
203 |
204 |
205 |
206 | }
207 | }else{
208 | //
209 | System.err.println("DESCARTADO MURO CON ID = " + muroActual.getId() + " PORQUE NO ES IfcWallStandardCase");
210 |
211 | }
212 | }
213 | }
214 | } catch (Exception e) {
215 | e.printStackTrace();
216 | } finally {
217 | //rm.release();
218 | }
219 |
220 | }
221 |
222 | public static void procesarSweptSolid(IfcRepresentation representationActual, Muro muroActual){
223 |
224 |
225 | LectorRepresentation.procesarSweptSolid(representationActual, muroActual);
226 |
227 | }
228 |
229 |
230 |
231 | public static void procesarClipping(IfcRepresentation representationActual, Muro muroActual){
232 |
233 | LectorRepresentation.procesarClipping(representationActual, muroActual);
234 |
235 | }
236 |
237 | }
238 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/util/LectorPlanchas.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.util;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collection;
5 | import java.util.Iterator;
6 | import java.util.List;
7 | /*
8 | import jp.ne.so_net.ga2.no_ji.jcom.IDispatch;
9 | import jp.ne.so_net.ga2.no_ji.jcom.ReleaseManager;
10 | */
11 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.DOUBLE;
12 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcArbitraryClosedProfileDef;
13 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcAxis2Placement2D;
14 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcAxis2Placement3D;
15 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcBuildingStorey;
16 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcCartesianPoint;
17 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcCompositeCurve;
18 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcCompositeCurveSegment;
19 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcCurve;
20 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcDirection;
21 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcExtrudedAreaSolid;
22 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcLengthMeasure;
23 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcLocalPlacement;
24 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcPolyline;
25 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcPositiveLengthMeasure;
26 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcProduct;
27 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcProductDefinitionShape;
28 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcProductRepresentation;
29 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRectangleProfileDef;
30 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRelAggregates;
31 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRelContainedInSpatialStructure;
32 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRepresentation;
33 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRepresentationItem;
34 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcRoof;
35 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcSlab;
36 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcSlabTypeEnum;
37 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcTrimmedCurve;
38 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.LIST;
39 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.SET;
40 | import openifctools.com.openifcjavatoolbox.ifcmodel.IfcModel;
41 |
42 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
43 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Edificio;
44 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Piso;
45 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Plancha;
46 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Rectangulo;
47 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Segmento;
48 |
49 | public class LectorPlanchas {
50 |
51 | protected List listaTechosAgregados = new ArrayList();
52 |
53 | public void cargarDatosBasicos(IfcModel ifcModel, Edificio edificio){
54 |
55 | edificio.setPisos(new ArrayList());
56 |
57 | //Se carga el listado de IfcRelAggregates que contiene las definiciones de techos (un techo puede ser definido por un IfcSlab unicamente o por un IfcRelAggregates que contiene un IfcRoof y un IfcSlab agregados)
58 | for (IfcRelAggregates techoAgregado : (Collection) ifcModel.getCollection(IfcRelAggregates.class)) {
59 | Object objetoRelacionado = techoAgregado.getRelatingObject();
60 | if(objetoRelacionado instanceof IfcRoof){
61 | listaTechosAgregados.add(techoAgregado);
62 | }
63 | }
64 |
65 | //Se leen los pisos del edificio y se cargan los IDs de planchas
66 | for (IfcRelContainedInSpatialStructure currentRelation : (Collection) ifcModel
67 | .getCollection(IfcRelContainedInSpatialStructure.class)) {
68 | // solo interesa averiguar por los PISOS del edificio
69 | if (currentRelation.getRelatingStructure() instanceof IfcBuildingStorey) {
70 | IfcBuildingStorey storey = (IfcBuildingStorey) currentRelation
71 | .getRelatingStructure();
72 | // no se tienen en cuenta los pisos subterraneos ni el piso base
73 | // (elevation = 0)
74 | if (storey.getElevation().value >= 0) {
75 |
76 | Piso pisoActual = new Piso();
77 | pisoActual.setId(storey.getGlobalId().toString());
78 | pisoActual.setElevacion(storey.getElevation().value);
79 | pisoActual.setNombre(storey.getName().toString());
80 |
81 | edificio.getPisos().add(pisoActual);
82 |
83 | SET relatedElements = currentRelation
84 | .getRelatedElements();
85 |
86 | // se buscan las planchas que tenga el piso
87 | for (Object product : relatedElements) {
88 |
89 | Plancha planchaActual = new Plancha();
90 |
91 | planchaActual.setIfcModel(ifcModel);
92 | planchaActual.setPisoPadre(pisoActual);
93 |
94 | if (product instanceof IfcSlab) {
95 |
96 | IfcSlab currentSlab = (IfcSlab) product;
97 |
98 | if (
99 | currentSlab.getPredefinedType().value == IfcSlabTypeEnum.IfcSlabTypeEnum_internal.FLOOR
100 | ||
101 | currentSlab.getPredefinedType().value == IfcSlabTypeEnum.IfcSlabTypeEnum_internal.BASESLAB
102 | ||
103 | currentSlab.getPredefinedType().value == IfcSlabTypeEnum.IfcSlabTypeEnum_internal.ROOF
104 | ) {
105 |
106 | planchaActual.setId(currentSlab.getGlobalId().toString());
107 | planchaActual.setTipo(currentSlab.getPredefinedType().value.name());
108 | pisoActual.getPlanchas().add(planchaActual);
109 |
110 | }
111 |
112 | }else if (product instanceof IfcRoof){ //los techos que no se hayan capturado en el if anterior se capturan aca, las dos opciones son probables
113 |
114 | IfcRoof techoVacioPiso = (IfcRoof) product;
115 |
116 | for (IfcRelAggregates techoAgregado : (Collection) listaTechosAgregados) {
117 | IfcRoof techoVacioAgregado = (IfcRoof) techoAgregado.getRelatingObject();
118 |
119 | if(techoVacioPiso.getGlobalId().toString().equals(techoVacioAgregado.getGlobalId().toString())){
120 | //System.err.println("TECHO " + techoVacioPiso.getGlobalId() + " EN PISO " + pisoActual.getNombre());
121 |
122 | IfcSlab currentSlab = (IfcSlab) techoAgregado.getRelatedObjects().iterator().next();
123 |
124 | planchaActual.setId(currentSlab.getGlobalId().toString());
125 | planchaActual.setTipo(currentSlab.getPredefinedType().value.name());
126 | pisoActual.getPlanchas().add(planchaActual);
127 |
128 |
129 | }
130 | }
131 | }
132 | }
133 | }
134 | }
135 | }
136 | }
137 |
138 | public void leerPlanchas(IfcModel ifcModel, List pisos){
139 |
140 | try {
141 |
142 | for (Piso pisoActual : pisos) {
143 | for (Plancha planchaActual : pisoActual.getPlanchas()){
144 |
145 | planchaActual.objectPlacement.setPlacementRelTo_placementRelTo(new Coordenada());
146 | planchaActual.objectPlacement.setPlacementRelTo_relativePlacement(new Coordenada());
147 |
148 | planchaActual.objectPlacement.setRelativePlacement_location(new Coordenada());
149 | //Definition from IAI: If the attribute values for Axis and RefDirection are not given, the placement defaults to P[1] (x-axis) as [1.,0.,0.], P[2] (y-axis) as [0.,1.,0.] and P[3] (z-axis) as [0.,0.,1.].
150 | //planchaActual.objectPlacement.setRelativePlacement_axis(new Coordenada(1,0,0));
151 | planchaActual.objectPlacement.setRelativePlacement_axis(null);
152 | //planchaActual.objectPlacement.setRelativePlacement_refDirection(new Coordenada(0,0,1));
153 | planchaActual.objectPlacement.setRelativePlacement_refDirection(null);
154 |
155 | planchaActual.representation.setRepresentation_position_location(new Coordenada());
156 | //Definition from IAI: If the attribute values for Axis and RefDirection are not given, the placement defaults to P[1] (x-axis) as [1.,0.,0.], P[2] (y-axis) as [0.,1.,0.] and P[3] (z-axis) as [0.,0.,1.].
157 | //planchaActual.representation.setRepresentation_position_axis(new Coordenada(1,0,0));
158 | planchaActual.representation.setRepresentation_position_axis(null);
159 | //planchaActual.representation.setRepresentation_position_refDirection(new Coordenada(0,0,1));
160 | planchaActual.representation.setRepresentation_position_refDirection(null);
161 |
162 | planchaActual.representation.setRepresentation_extruded_direction(new Coordenada());
163 |
164 | IfcSlab planchaEncontrada = (IfcSlab) ifcModel.getIfcObjectByID(planchaActual.getId());
165 |
166 |
167 |
168 | //Se ubica en el nodo objectPlacement->placementRelTo de la plancha
169 | IfcLocalPlacement objectPlacement = (IfcLocalPlacement) planchaEncontrada.getObjectPlacement();
170 | IfcLocalPlacement placementRelToA = (IfcLocalPlacement) objectPlacement.getPlacementRelTo();
171 |
172 |
173 |
174 | //Se lee PlacementRelTo
175 | IfcLocalPlacement placementRelToB = (IfcLocalPlacement) placementRelToA.getPlacementRelTo();
176 | IfcAxis2Placement3D relativePlacementA = (IfcAxis2Placement3D) placementRelToB.getRelativePlacement();
177 | IfcCartesianPoint locationA = relativePlacementA.getLocation();
178 | LIST coordinatesA = locationA.getCoordinates();
179 |
180 | int coordenadasA = coordinatesA.size();
181 |
182 | Coordenada coordA = new Coordenada();
183 | for(int n = 0; n coordinatesB = locationB.getCoordinates();
203 |
204 | int coordenadasB = coordinatesB.size();
205 |
206 | Coordenada coordB = new Coordenada();
207 | for(int n = 0; n coordinatesC = locationC.getCoordinates();
225 |
226 | int coordenadasC = coordinatesC.size();
227 |
228 | Coordenada coordC = new Coordenada();
229 | for(int n = 0; n directionRatios = axis.getDirectionRatios();
247 |
248 | int coordenadas = directionRatios.size();
249 |
250 | Coordenada coord = new Coordenada();
251 |
252 | for(int n = 0; n representations = representation.getRepresentations();
292 | //se asume que siempre va a existir UNA sola representacion (SOLO SE LEE LA POSICION 0)
293 | IfcRepresentation representationActual = representations.get(0);
294 | String representationType = representationActual.getRepresentationType().toString();
295 | planchaActual.representation.setRepresentation_representationType(representationType);
296 |
297 | SET items = representationActual.getItems();
298 | Iterator it = items.iterator();
299 | //se asume que siempre va a existir UNA sola representacion (SOLO SE LEE EL PRIMER ITEM)
300 | IfcExtrudedAreaSolid itemActual = (IfcExtrudedAreaSolid) it.next();
301 |
302 | //System.err.println(representationType + " PLANCHA " + planchaActual.getId() + " PISO " + pisoActual.getNombre() + " DEPTH = " + itemActual.getDepth().value + " EXTRUDED DIR = " + itemActual.getExtrudedDirection().getDirectionRatios());
303 |
304 |
305 | IfcAxis2Placement3D position = itemActual.getPosition();
306 | IfcCartesianPoint location = position.getLocation();
307 | LIST coordinatesD = location.getCoordinates();
308 |
309 | int coordenadas = coordinatesD.size();
310 |
311 | Coordenada coord = new Coordenada();
312 | for(int n = 0; n coordinatesF = direction.getDirectionRatios();
329 |
330 | coordenadas = coordinatesF.size();
331 |
332 | coord = new Coordenada();
333 | for(int n = 0; n directionRatios = axis.getDirectionRatios();
356 |
357 | coordenadas = directionRatios.size();
358 |
359 | coord = new Coordenada();
360 |
361 | for(int n = 0; n points = outerCurveActual.getPoints();
412 |
413 | int puntos = points.size();
414 |
415 | for(int n = 0; n coordinatesE = pointsActual.getCoordinates();
420 | int coordenadasE = coordinatesE.size();
421 | Coordenada coordenada = new Coordenada();
422 |
423 | for(int i = 0; i segments = outerCurveActual.getSegments();
444 | int segmentos = segments.size();
445 |
446 | for(int n = 0; n points = parentCurveActual.getPoints();
457 | int puntos = points.size();
458 |
459 | Coordenada p0 = new Coordenada();
460 | Coordenada p1 = new Coordenada();
461 |
462 | for(int i = 0; i coordinates = puntoActual.getCoordinates();
466 | coordenadas = coordinates.size();
467 |
468 | for(int m = 0; m coordinates = locationD.getCoordinates();
524 | coordenadas = coordinates.size();
525 |
526 | Coordenada coordenada = new Coordenada();
527 |
528 | for(int i = 0; i directionRatiosD = refDirectionD.getDirectionRatios();
541 | coordenadas = directionRatiosD.size();
542 |
543 | coordenada = new Coordenada();
544 |
545 | for(int i = 0; i vacioYTipo = new HashMap();
94 |
95 | //Se carga la relacion que indica los vacios y a cual muro pertenecen
96 | for (IfcRelFillsElement currentRelation : (Collection) ifcModel
97 | .getCollection(IfcRelFillsElement.class)){
98 |
99 | String idDelVacio = currentRelation.getRelatingOpeningElement().getGlobalId().toString();
100 | String puertaOVentana = "desconocido";
101 |
102 | if (currentRelation.getRelatedBuildingElement() instanceof IfcDoor){
103 | puertaOVentana = "puerta";
104 | }else if (currentRelation.getRelatedBuildingElement() instanceof IfcWindow){
105 | puertaOVentana = "ventana";
106 | }
107 |
108 | vacioYTipo.put(idDelVacio, puertaOVentana);
109 |
110 | }
111 |
112 | //se asignan a cada vacio su tipo de relleno, puerta o ventana
113 | for (Piso pisoActual : edificio.getPisos()) {
114 |
115 | for (Muro muroActual : pisoActual.getMuros()) {
116 |
117 | if(muroActual.getVacios() != null){
118 |
119 | for (Vacio vacioActual : muroActual.getVacios()){
120 |
121 | String puertaOVentana = vacioYTipo.get(vacioActual.getId());
122 | vacioActual.setTipo(puertaOVentana);
123 |
124 | }
125 |
126 | }
127 |
128 | }
129 |
130 | }
131 |
132 | }
133 |
134 |
135 | public void leerVacios(IfcModel ifcModel, Edificio edificio){
136 |
137 |
138 | try {
139 |
140 | //se asignan a cada vacio su tipo de relleno, puerta o ventana
141 | for (Piso pisoActual : edificio.getPisos()) {
142 |
143 | for (Muro muritoActual : pisoActual.getMuros()) {
144 |
145 | if(muritoActual.getVacios() != null){
146 |
147 | for (Vacio vacioActual : muritoActual.getVacios()){
148 |
149 | //lo unico que la diferencia de LectorMuros es esta linea
150 | vacioActual.setMuroAlQueVacia(muritoActual);
151 |
152 | vacioActual.objectPlacement.setPlacementRelTo_placementRelTo(new Coordenada());
153 | vacioActual.objectPlacement.setPlacementRelTo_relativePlacement(new Coordenada());
154 |
155 | vacioActual.objectPlacement.setRelativePlacement_location(new Coordenada());
156 | //Definition from IAI: If the attribute values for Axis and RefDirection are not given, the placement defaults to P[1] (x-axis) as [1.,0.,0.], P[2] (y-axis) as [0.,1.,0.] and P[3] (z-axis) as [0.,0.,1.].
157 | //planchaActual.objectPlacement.setRelativePlacement_axis(new Coordenada(1,0,0));
158 | vacioActual.objectPlacement.setRelativePlacement_axis(null);
159 | //planchaActual.objectPlacement.setRelativePlacement_refDirection(new Coordenada(0,0,1));
160 | vacioActual.objectPlacement.setRelativePlacement_refDirection(null);
161 |
162 | vacioActual.representation.setRepresentation_position_location(new Coordenada());
163 | //Definition from IAI: If the attribute values for Axis and RefDirection are not given, the placement defaults to P[1] (x-axis) as [1.,0.,0.], P[2] (y-axis) as [0.,1.,0.] and P[3] (z-axis) as [0.,0.,1.].
164 | //planchaActual.representation.setRepresentation_position_axis(new Coordenada(1,0,0));
165 | vacioActual.representation.setRepresentation_position_axis(null);
166 | //planchaActual.representation.setRepresentation_position_refDirection(new Coordenada(0,0,1));
167 | vacioActual.representation.setRepresentation_position_refDirection(null);
168 |
169 | vacioActual.representation.setRepresentation_extruded_direction(new Coordenada());
170 |
171 |
172 |
173 |
174 |
175 | Object objeto = ifcModel.getIfcObjectByID(vacioActual.getId());
176 |
177 | if (objeto instanceof IfcOpeningElement) {
178 |
179 | IfcOpeningElement vacioEncontrado = (IfcOpeningElement) ifcModel.getIfcObjectByID(vacioActual.getId());
180 |
181 |
182 | //Se ubica en el nodo objectPlacement->placementRelTo de la plancha
183 | IfcLocalPlacement objectPlacement = (IfcLocalPlacement) vacioEncontrado.getObjectPlacement();
184 | IfcLocalPlacement placementRelToA = (IfcLocalPlacement) objectPlacement.getPlacementRelTo();
185 |
186 |
187 |
188 | //Se lee PlacementRelTo
189 | IfcLocalPlacement placementRelToB = (IfcLocalPlacement) placementRelToA.getPlacementRelTo();
190 | IfcAxis2Placement3D relativePlacementA = (IfcAxis2Placement3D) placementRelToB.getRelativePlacement();
191 | vacioActual.objectPlacement.setPlacementRelTo_placementRelTo(LectorCoordenada.Leer(relativePlacementA.getLocation()));
192 |
193 |
194 |
195 | //Se lee RelativePlacement
196 |
197 | IfcAxis2Placement3D relativePlacementB = (IfcAxis2Placement3D) placementRelToA.getRelativePlacement();
198 | vacioActual.objectPlacement.setPlacementRelTo_relativePlacement(LectorCoordenada.Leer(relativePlacementB.getLocation()));
199 |
200 |
201 | //Se lee location
202 |
203 | IfcAxis2Placement3D relativePlacementC = (IfcAxis2Placement3D) objectPlacement.getRelativePlacement();
204 | LectorAxis2Placement3D.leerAxis2Placement3D(vacioActual.objectPlacement, relativePlacementC);
205 |
206 |
207 | //Se lee Representation
208 |
209 | IfcProductDefinitionShape representation = (IfcProductDefinitionShape) vacioEncontrado.getRepresentation();
210 |
211 | //se asume que siempre va a existir UNA sola representacion (SOLO SE LEE LA POSICION 0)
212 |
213 | for (IfcRepresentation repActual : representation.getRepresentations()) {
214 |
215 |
216 | //posible valores = Clipping - Curve2D - SweptSolid
217 | if(repActual.getRepresentationType().toString().equals("SweptSolid")){
218 |
219 | //System.err.println("Procesando representation " + repActual.getStepLineNumber() + " en muro " + muroActual.getId());
220 | procesarSweptSolid(repActual, vacioActual);
221 |
222 | }else if (repActual.getRepresentationType().toString().equals("Clipping")){
223 |
224 | //System.err.println("En muro " + muroActual.getId() + " procesando representation tipo Clipping con STEP number = " + repActual.getStepLineNumber());
225 | procesarClipping(repActual, vacioActual);
226 |
227 | }else if (repActual.getRepresentationType().toString().equals("Curve2D")){
228 |
229 | //System.err.println("MURO " + muroActual.getId() + " DESCARTADA REPRESENTATION PORQUE ES TIPO \"Curve2D\" STEP NUMBER = " + repActual.getStepLineNumber());
230 | vacioActual.representation.setRepresentation_representationType("DESCARTADA - " + repActual.getRepresentationType().toString());
231 |
232 | }else{
233 |
234 | System.err.println("DESCARTADA REPRESENTATION PORQUE ES TIPO DESCONOCIDO");
235 |
236 | }
237 |
238 |
239 |
240 | }
241 | }else{
242 | //
243 | System.err.println("DESCARTADO VACIO CON ID = " + vacioActual.getId() + " PORQUE NO ES IfcOpeningElement");
244 |
245 | }
246 |
247 | }
248 |
249 | }
250 |
251 | }
252 |
253 | }
254 | } catch (Exception e) {
255 | e.printStackTrace();
256 | } finally {
257 | //rm.release();
258 | }
259 |
260 | }
261 |
262 | public static void procesarSweptSolid(IfcRepresentation representationActual, Vacio vacioActual){
263 |
264 |
265 | LectorRepresentation.procesarSweptSolid(representationActual, vacioActual);
266 |
267 | }
268 |
269 |
270 |
271 | public static void procesarClipping(IfcRepresentation representationActual, Vacio vacioActual){
272 |
273 | LectorRepresentation.procesarClipping(representationActual, vacioActual);
274 |
275 | }
276 |
277 |
278 |
279 | }
280 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/util/OperacionesBooleanas3D.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.util;
2 |
3 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcBooleanClippingResult;
4 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcBooleanOperand;
5 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcExtrudedAreaSolid;
6 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcHalfSpaceSolid;
7 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcPolygonalBoundedHalfSpace;
8 |
9 | public class OperacionesBooleanas3D {
10 |
11 | public void resolverClipping(IfcBooleanClippingResult clipping){
12 |
13 |
14 |
15 | if(clipping.getOperator().value.toString().equals("DIFFERENCE")){
16 |
17 | clippingDifference(clipping);
18 |
19 | }if(clipping.getOperator().value.toString().equals("UNION")){
20 |
21 | System.err.println("UNION NO IMPLEMENTADO");
22 |
23 | }if(clipping.getOperator().value.toString().equals("INTERSECTION")){
24 |
25 | System.err.println("INTERSECTION NO IMPLEMENTADO");
26 |
27 | }
28 |
29 |
30 |
31 | }
32 |
33 | public void clippingDifference(IfcBooleanClippingResult clipping){
34 |
35 | IfcBooleanOperand opA = clipping.getFirstOperand();
36 | IfcBooleanOperand opB = clipping.getSecondOperand();
37 |
38 | String claseDeA = "DESCONOCIDA";
39 | String claseDeB = "DESCONOCIDA";
40 |
41 |
42 |
43 | if(opA instanceof IfcExtrudedAreaSolid){
44 | claseDeA = "IfcExtrudedAreaSolid";
45 | }
46 |
47 | if(opA instanceof IfcBooleanClippingResult){
48 | claseDeA = "IfcBooleanClippingResult";
49 | }
50 |
51 |
52 |
53 | if(opB instanceof IfcHalfSpaceSolid){
54 | claseDeB = "IfcHalfSpaceSolid";
55 |
56 |
57 | }
58 |
59 |
60 | System.err.println("A = " + claseDeA + " B = " + claseDeB );
61 |
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/co/edu/udistrital/bim2gis4j/util/Transformador.java:
--------------------------------------------------------------------------------
1 | package co.edu.udistrital.bim2gis4j.util;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import openifctools.com.openifcjavatoolbox.ifc2x3tc1.IfcOpeningElement;
7 |
8 | import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
9 | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
10 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Coordenada;
11 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Muro;
12 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Poligono;
13 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Rectangulo;
14 | import co.edu.udistrital.bim2gis4j.bim2gisbm.Vacio;
15 | import co.edu.udistrital.bim2gis4j.ifc.Solido;
16 |
17 | public class Transformador {
18 |
19 |
20 |
21 | public Coordenada convertirEnAbsoluta(Coordenada coordOriginal, Solido pSolido){
22 |
23 | Coordenada coordAbsoluta = aplicarObjectRepresentation(coordOriginal, pSolido);
24 | coordAbsoluta = aplicarObjectPlacement(coordAbsoluta, pSolido);
25 |
26 | return coordAbsoluta;
27 | }
28 |
29 | public static Coordenada rotarCoordenadaVacio(Coordenada original, Vacio pVacio) {
30 |
31 | Coordenada locationMuro = pVacio.getMuroAlQueVacia().objectPlacement.getRelativePlacement_location();
32 | Coordenada axisMuro = pVacio.getMuroAlQueVacia().objectPlacement.getRelativePlacement_axis();
33 | Coordenada refDirectionMuro = pVacio.getMuroAlQueVacia().objectPlacement.getRelativePlacement_refDirection();
34 |
35 | //Coordenada axisVacio = pVacio.representation.position.axis;
36 | //Coordenada refDirectionVacio = pVacio.representation.position.refDirection;
37 |
38 | Vector3D vectorOrigen = Vector3D.ZERO;
39 | Vector3D diferenciaConOrigen = vectorOrigen.subtract(locationMuro.toVector3D());
40 |
41 | Vector3D coordenadaTrasladada = original.toVector3D().add(diferenciaConOrigen);
42 | Coordenada coordenadaRotada = rotarCoordenada(new Coordenada(coordenadaTrasladada), axisMuro, refDirectionMuro);
43 | Vector3D coordenadaRotadaReubicada = coordenadaRotada.toVector3D().subtract(diferenciaConOrigen);
44 |
45 | return new Coordenada(coordenadaRotadaReubicada);
46 |
47 |
48 | }
49 |
50 | private Coordenada aplicarObjectRepresentation(Coordenada coordOriginal, Solido pSolido){
51 |
52 | coordOriginal = rotarCoordenada(
53 | coordOriginal
54 | , pSolido.representation.position.axis
55 | , pSolido.representation.position.refDirection
56 | );
57 |
58 | Coordenada location = pSolido.representation.position.location;
59 |
60 | double xActual = coordOriginal.getX();
61 | xActual += location.getX();
62 |
63 | double yActual = coordOriginal.getY();
64 | yActual += location.getY();
65 |
66 | double zActual = coordOriginal.getZ();
67 | zActual += location.getZ();
68 |
69 | Coordenada coord = new Coordenada(xActual, yActual, zActual);
70 |
71 | return coord;
72 |
73 | }
74 |
75 | private Coordenada aplicarObjectPlacement(Coordenada original, Solido pSolido){
76 | //Hay que rotar primero, o no funciona bien
77 | Coordenada conRotacion = rotarCoordenada(
78 | original
79 | , pSolido.objectPlacement.relativePlacement.axis
80 | , pSolido.objectPlacement.relativePlacement.refDirection
81 | );
82 |
83 | //si es un vacio se necesita aplicar la rotacion propia del vacio
84 | if(pSolido.objectPlacement.relativePlacement.axis == null && pSolido.getIfcModel().getIfcObjectByID(pSolido.getId()) instanceof IfcOpeningElement){
85 |
86 | Vacio vacio = (Vacio)pSolido;
87 |
88 | conRotacion = rotarCoordenada(
89 | original
90 | , vacio.representation.position.axis
91 | , vacio.representation.position.refDirection
92 | );
93 |
94 | conRotacion.setZ(conRotacion.getZ() + vacio.objectPlacement.relativePlacement.location.getZ());
95 | }
96 |
97 | double xActual = conRotacion.getX();
98 |
99 |
100 | xActual += pSolido.objectPlacement.placementRelTo_placementRelTo.getX();
101 | xActual += pSolido.objectPlacement.placementRelTo_relativePlacement.getX();
102 | xActual += pSolido.objectPlacement.relativePlacement.location.getX();
103 |
104 | double yActual = conRotacion.getY();
105 |
106 |
107 | yActual += pSolido.objectPlacement.placementRelTo_placementRelTo.getY();
108 | yActual += pSolido.objectPlacement.placementRelTo_relativePlacement.getY();
109 | yActual += pSolido.objectPlacement.relativePlacement.location.getY();
110 |
111 | double zActual = conRotacion.getZ();
112 |
113 | zActual += pSolido.objectPlacement.placementRelTo_placementRelTo.getZ();
114 | zActual += pSolido.objectPlacement.placementRelTo_relativePlacement.getZ();
115 | zActual += pSolido.objectPlacement.relativePlacement.location.getZ();
116 |
117 |
118 | Coordenada coord = new Coordenada(xActual, yActual, zActual);
119 |
120 | return coord;
121 |
122 | }
123 |
124 | public static Coordenada rotarCoordenada(Coordenada coordOriginal, Coordenada axis, Coordenada refDirection){
125 |
126 | Coordenada r = new Coordenada();
127 |
128 | if(axis != null && refDirection != null){
129 |
130 | Vector3D axisX = new Vector3D(1, 0, 0);
131 | Vector3D axisZ = new Vector3D(0, 0, 1);
132 |
133 | Vector3D deseadoX = new Vector3D(axis.getX(), axis.getY(), axis.getZ()); //(AXIS, eje Z)
134 | Vector3D deseadoZ = new Vector3D(refDirection.getX(), refDirection.getY(), refDirection.getZ()); //(refdirection, eje X)
135 |
136 | Rotation rotacionX = new Rotation(axisX,deseadoZ);
137 | Rotation rotacionZ = new Rotation(axisZ,deseadoX);
138 |
139 |
140 | Vector3D punto = new Vector3D(coordOriginal.getX(), coordOriginal.getY(), coordOriginal.getZ());
141 | Vector3D puntoRotado = rotacionX.applyTo(punto);
142 | puntoRotado = rotacionZ.applyTo(puntoRotado);
143 |
144 | r.setX(puntoRotado.getX());
145 | r.setY(puntoRotado.getY());
146 | r.setZ(puntoRotado.getZ());
147 | }else{
148 | r = coordOriginal;
149 | }
150 |
151 |
152 | return r;
153 | }
154 |
155 | }
156 |
--------------------------------------------------------------------------------