Skip to content

Commit

Permalink
#1 Fix
Browse files Browse the repository at this point in the history
bot:containsElement between storey and element is incorrectly converted from IFC #1

Preparing for a geometry based inference.
  • Loading branch information
jyrkioraskari committed Oct 2, 2020
1 parent 42dc568 commit 34d597b
Show file tree
Hide file tree
Showing 10 changed files with 216 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,21 @@ public BoundingBox getBoundingBox(String guid) {
if (renderEngineInstance == null) {
return null;
}

IfcGeomServerClientEntity geometry = renderEngineInstance.generateGeometry();
if (geometry != null && geometry.getIndices().length > 0) {
boundingBox = new BoundingBox();
double[] tranformationMatrix = new double[16];
if (renderEngineInstance.getTransformationMatrix() != null) {
tranformationMatrix = renderEngineInstance.getTransformationMatrix();
tranformationMatrix = Matrix.changeOrientation(tranformationMatrix);
} else {
Matrix.setIdentityM(tranformationMatrix, 0);
}

float[] vertices = geometry.getPositions();
for (int i = 0; i < geometry.getPositions().length; i += 3) {
processExtends(boundingBox, tranformationMatrix, vertices[i], vertices[i + 1], vertices[i + 2]);
}
}
if (geometry != null && geometry.getIndices().length > 0) {
boundingBox = new BoundingBox();
double[] tranformationMatrix = new double[16];
Matrix.setIdentityM(tranformationMatrix, 0);
if (renderEngineInstance.getTransformationMatrix() != null) {
tranformationMatrix = renderEngineInstance.getTransformationMatrix();
}
for (int i = 0; i < geometry.getIndices().length; i++) {
Point3d p=processExtends(tranformationMatrix, geometry.getPositions(), geometry.getIndices()[i] * 3);
boundingBox.add(p);
}
}

return boundingBox;
}

Expand All @@ -74,14 +73,18 @@ private IfcOpenShellModel getRenderEngineModel(File ifcFile) throws RenderEngine
return model;
}

private void processExtends(BoundingBox boundingBox, double[] transformationMatrix, double x, double y, double z) {
double[] result = new double[4];
Matrix.multiplyMV(result, 0, transformationMatrix, 0, new double[] { x, y, z, 1 }, 0);
x = result[0];
y = result[1];
z = result[2];
Point3d point = new Point3d(x / 1000, y / 1000, z / 1000);
boundingBox.add(point);
}
private Point3d processExtends(double[] transformationMatrix, float[] ds, int index) {
double x = ds[index];
double y = ds[index + 1];
double z = ds[index + 2];

double[] result = new double[4];
Matrix.multiplyMV(result, 0, transformationMatrix, 0, new double[] { x, y, z, 1 }, 0);

Point3d point = new Point3d(result[0], result[2], result[2]);
return point;

}


}
34 changes: 20 additions & 14 deletions converter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<assembly.finalName>${project.build.finalName}</assembly.finalName>
</properties>
<dependencies>
<dependency>
<dependency>
<groupId>de.rwth-aachen.dc.lbd</groupId>
<artifactId>IFCtoLBDGeometry</artifactId>
<version>2.8</version>
Expand Down Expand Up @@ -113,25 +113,31 @@
<artifactId>IFCtoRDF</artifactId>
<version>0.5J-SNAPSHOT</version>
</dependency>
<!-- overrided IFCtoRDF -->
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-core</artifactId>
<version>3.16.0</version>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
<version>3.16.0</version>
</dependency>
<!-- overrided IFCtoRDF -->
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-core</artifactId>
<version>3.16.0</version>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
<version>3.16.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.jena/apache-jena-libs -->
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<version>3.16.0</version>
<type>pom</type>
<type>pom</type>
</dependency>

<!-- https://mvnrepository.com/artifact/com.github.davidmoten/rtree-multi -->
<dependency>
<groupId>com.github.davidmoten</groupId>
<artifactId>rtree-multi</artifactId>
<version>0.1-RC1</version>
</dependency>

</dependencies>
<scm>
<connection>scm:git:github.com/jyrkioraskari/IFCtoLBD.git</connection>
Expand Down
2 changes: 1 addition & 1 deletion converter/src/license/THIRD-PARTY.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@
# Please fill the missing licenses for dependencies :
#
#
#Thu Oct 01 15:24:55 CEST 2020
#Fri Oct 02 20:10:27 CEST 2020
gnu.getopt--java-getopt--1.0.13=
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public IFCtoLBDConverter(String ifc_filename, String uriBase, String target_file
eventBus.post(new IFCtoLBD_SystemStatusEvent("Not a valid IFC version."));
return;
}

System.out.println("#2");

try {
System.out.println("Set the bounding box generator");
this.bounding_boxes = new IFCBoundingBoxes(new File(ifc_filename));
Expand Down Expand Up @@ -149,6 +150,8 @@ public IFCtoLBDConverter(String ifc_filename, String uriBase, String target_file
eventBus.post(new IFCtoLBD_SystemStatusEvent("Not a valid IFC version."));
return;
}
System.out.println("#2");


if(hasGeometry)
try {
Expand Down Expand Up @@ -310,7 +313,7 @@ public Model convert(String ifc_filename, String target_file, boolean hasBuildin
boolean hasSeparateBuildingElementsModel, boolean hasBuildingProperties, boolean hasSeparatePropertiesModel,
boolean hasGeolocation, boolean hasGeometry) {


System.out.println("#1");
if(IfcOWLUtils.getExpressSchema(ifc_filename)==null) //TODO this result could be saved
{
eventBus.post(new IFCtoLBD_SystemStatusEvent("Not a valid IFC version."));
Expand All @@ -329,6 +332,7 @@ public Model convert(String ifc_filename, String target_file, boolean hasBuildin

ifcowl_model = readAndConvertIFC(ifc_filename, uriBase); // Before: readInOntologies(ifc_filename);

System.out.println("converted RDF");
eventBus.post(new IFCtoLBD_SystemStatusEvent("Reading in ontologies"));
readInOntologies(ifc_filename);
createIfcLBDProductMapping();
Expand Down
Loading

0 comments on commit 34d597b

Please sign in to comment.