Search in sources :

Example 11 with HashMapWrappedVirtualObject

use of org.bimserver.shared.HashMapWrappedVirtualObject in project BIMserver by opensourceBIM.

the class StreamingGeometryGenerator method processExtends.

void processExtends(VirtualObject geometryInfo, double[] transformationMatrix, float[] vertices, int index, GenerateGeometryResult generateGeometryResult) throws BimserverDatabaseException {
    double x = vertices[index];
    double y = vertices[index + 1];
    double z = vertices[index + 2];
    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];
    HashMapWrappedVirtualObject minBounds = (HashMapWrappedVirtualObject) geometryInfo.eGet(GeometryPackage.eINSTANCE.getGeometryInfo_MinBounds());
    HashMapWrappedVirtualObject maxBounds = (HashMapWrappedVirtualObject) geometryInfo.eGet(GeometryPackage.eINSTANCE.getGeometryInfo_MaxBounds());
    minBounds.set("x", Math.min(x, (double) minBounds.eGet("x")));
    minBounds.set("y", Math.min(y, (double) minBounds.eGet("y")));
    minBounds.set("z", Math.min(z, (double) minBounds.eGet("z")));
    maxBounds.set("x", Math.max(x, (double) maxBounds.eGet("x")));
    maxBounds.set("y", Math.max(y, (double) maxBounds.eGet("y")));
    maxBounds.set("z", Math.max(z, (double) maxBounds.eGet("z")));
    generateGeometryResult.setMinX(Math.min(x, generateGeometryResult.getMinX()));
    generateGeometryResult.setMinY(Math.min(y, generateGeometryResult.getMinY()));
    generateGeometryResult.setMinZ(Math.min(z, generateGeometryResult.getMinZ()));
    generateGeometryResult.setMaxX(Math.max(x, generateGeometryResult.getMaxX()));
    generateGeometryResult.setMaxY(Math.max(y, generateGeometryResult.getMaxY()));
    generateGeometryResult.setMaxZ(Math.max(z, generateGeometryResult.getMaxZ()));
}
Also used : HashMapWrappedVirtualObject(org.bimserver.shared.HashMapWrappedVirtualObject)

Aggregations

HashMapWrappedVirtualObject (org.bimserver.shared.HashMapWrappedVirtualObject)11 HashMapVirtualObject (org.bimserver.shared.HashMapVirtualObject)9 List (java.util.List)4 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)4 QueryObjectProvider (org.bimserver.database.queries.QueryObjectProvider)3 Query (org.bimserver.database.queries.om.Query)3 EClass (org.eclipse.emf.ecore.EClass)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 QueryPart (org.bimserver.database.queries.om.QueryPart)2 PackageMetaData (org.bimserver.emf.PackageMetaData)2 UserException (org.bimserver.shared.exceptions.UserException)2 EReference (org.eclipse.emf.ecore.EReference)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1