Search in sources :

Example 1 with IfcAxis2Placement2D

use of org.bimserver.models.ifc2x3tc1.IfcAxis2Placement2D 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)

Aggregations

IfcAxis2Placement (org.bimserver.models.ifc2x3tc1.IfcAxis2Placement)1 IfcAxis2Placement2D (org.bimserver.models.ifc2x3tc1.IfcAxis2Placement2D)1 IfcAxis2Placement3D (org.bimserver.models.ifc2x3tc1.IfcAxis2Placement3D)1 IfcCartesianPoint (org.bimserver.models.ifc2x3tc1.IfcCartesianPoint)1 IfcGridPlacement (org.bimserver.models.ifc2x3tc1.IfcGridPlacement)1 IfcLocalPlacement (org.bimserver.models.ifc2x3tc1.IfcLocalPlacement)1 IfcObjectPlacement (org.bimserver.models.ifc2x3tc1.IfcObjectPlacement)1