Search in sources :

Example 11 with IfcCartesianPoint

use of org.bimserver.models.ifc2x3tc1.IfcCartesianPoint in project BIMserver by opensourceBIM.

the class IfcUtils method getAbsolutePosition.

/**
 * Not finished, does not take into account the directions
 *
 * @param ifcObjectPlacement
 * @return
 * @throws PlacementNotImplementedException
 */
public static double[] getAbsolutePosition(IfcObjectPlacement ifcObjectPlacement) throws PlacementNotImplementedException {
    if (ifcObjectPlacement instanceof IfcGridPlacement) {
        throw new PlacementNotImplementedException("IfcGridPlacement has not been implemented");
    } else if (ifcObjectPlacement instanceof IfcLocalPlacement) {
        IfcLocalPlacement ifcLocalPlacement = (IfcLocalPlacement) ifcObjectPlacement;
        IfcAxis2Placement relativePlacement = ifcLocalPlacement.getRelativePlacement();
        if (relativePlacement instanceof IfcAxis2Placement2D) {
            throw new PlacementNotImplementedException("IfcAxis2Placement2D has not been implemented");
        } else if (relativePlacement instanceof IfcAxis2Placement3D) {
            IfcAxis2Placement3D ifcAxis2Placement3D = (IfcAxis2Placement3D) relativePlacement;
            IfcObjectPlacement placementRelativeTo = ifcLocalPlacement.getPlacementRelTo();
            if (placementRelativeTo == null) {
                IfcCartesianPoint ifcCartesianPoint = ifcAxis2Placement3D.getLocation();
                return new double[] { ifcCartesianPoint.getCoordinates().get(0), ifcCartesianPoint.getCoordinates().get(1), ifcCartesianPoint.getCoordinates().get(2) };
            } else {
                double[] relative = getAbsolutePosition(placementRelativeTo);
                IfcCartesianPoint ifcCartesianPoint = ifcAxis2Placement3D.getLocation();
                return new double[] { relative[0] + ifcCartesianPoint.getCoordinates().get(0), relative[1] + ifcCartesianPoint.getCoordinates().get(1), relative[2] + ifcCartesianPoint.getCoordinates().get(2) };
            }
        }
    }
    return new double[] { 0d, 0d, 0d };
}
Also used : IfcGridPlacement(org.bimserver.models.ifc2x3tc1.IfcGridPlacement) IfcAxis2Placement2D(org.bimserver.models.ifc2x3tc1.IfcAxis2Placement2D) IfcAxis2Placement3D(org.bimserver.models.ifc2x3tc1.IfcAxis2Placement3D) IfcLocalPlacement(org.bimserver.models.ifc2x3tc1.IfcLocalPlacement) IfcCartesianPoint(org.bimserver.models.ifc2x3tc1.IfcCartesianPoint) IfcObjectPlacement(org.bimserver.models.ifc2x3tc1.IfcObjectPlacement) IfcAxis2Placement(org.bimserver.models.ifc2x3tc1.IfcAxis2Placement)

Example 12 with IfcCartesianPoint

use of org.bimserver.models.ifc2x3tc1.IfcCartesianPoint in project BIMserver by opensourceBIM.

the class IfcUtils method getBoundingBox2D.

public static AxisAlignedBoundingBox2D getBoundingBox2D(List<IfcCartesianPoint> points) throws GeometryException {
    AxisAlignedBoundingBox2D box2d = new AxisAlignedBoundingBox2D();
    for (IfcCartesianPoint ifcCartesianPoint : points) {
        EList<Double> coordinates = ifcCartesianPoint.getCoordinates();
        if (coordinates.size() > 2) {
            throw new GeometryException("Too many dimensions (" + coordinates.size() + ") for 2D boundingbox");
        }
        box2d.process(coordinates);
    }
    return box2d;
}
Also used : IfcCartesianPoint(org.bimserver.models.ifc2x3tc1.IfcCartesianPoint) AxisAlignedBoundingBox2D(org.bimserver.geometry.AxisAlignedBoundingBox2D)

Aggregations

IfcCartesianPoint (org.bimserver.models.ifc2x3tc1.IfcCartesianPoint)11 IfcAxis2Placement3D (org.bimserver.models.ifc2x3tc1.IfcAxis2Placement3D)4 IfcExtrudedAreaSolid (org.bimserver.models.ifc2x3tc1.IfcExtrudedAreaSolid)3 IfcLocalPlacement (org.bimserver.models.ifc2x3tc1.IfcLocalPlacement)3 Path2D (java.awt.geom.Path2D)2 IfcModelInterface (org.bimserver.emf.IfcModelInterface)2 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)2 SProject (org.bimserver.interfaces.objects.SProject)2 IfcArbitraryClosedProfileDef (org.bimserver.models.ifc2x3tc1.IfcArbitraryClosedProfileDef)2 IfcAxis2Placement (org.bimserver.models.ifc2x3tc1.IfcAxis2Placement)2 IfcBuildingStorey (org.bimserver.models.ifc2x3tc1.IfcBuildingStorey)2 IfcFurnishingElement (org.bimserver.models.ifc2x3tc1.IfcFurnishingElement)2 IfcObjectPlacement (org.bimserver.models.ifc2x3tc1.IfcObjectPlacement)2 IfcPolyline (org.bimserver.models.ifc2x3tc1.IfcPolyline)2 IfcSpace (org.bimserver.models.ifc2x3tc1.IfcSpace)2 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)2 Test (org.junit.Test)2 Area (java.awt.geom.Area)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1