mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 13:46:54 +00:00
Fix some casting logic
This commit is contained in:
@@ -93,11 +93,11 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcCircle* l, Handle(Geom_Curve)&
|
||||
}
|
||||
gp_Trsf trsf;
|
||||
IfcSchema::IfcAxis2Placement* placement = l->Position();
|
||||
if (placement->declaration().is(IfcSchema::IfcAxis2Placement3D::Class())) {
|
||||
IfcGeom::Kernel::convert((IfcSchema::IfcAxis2Placement3D*)placement,trsf);
|
||||
if (placement->as<IfcSchema::IfcAxis2Placement3D>()) {
|
||||
IfcGeom::Kernel::convert(placement->as<IfcSchema::IfcAxis2Placement3D>(),trsf);
|
||||
} else {
|
||||
gp_Trsf2d trsf2d;
|
||||
IfcGeom::Kernel::convert((IfcSchema::IfcAxis2Placement2D*)placement,trsf2d);
|
||||
IfcGeom::Kernel::convert(placement->as<IfcSchema::IfcAxis2Placement2D>(),trsf2d);
|
||||
trsf = trsf2d;
|
||||
}
|
||||
gp_Ax2 ax = gp_Ax2().Transformed(trsf);
|
||||
@@ -117,14 +117,16 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcEllipse* l, Handle(Geom_Curve)
|
||||
// when creating a trimmed curve off of an ellipse like this.
|
||||
const bool rotated = y > x;
|
||||
gp_Trsf trsf;
|
||||
|
||||
IfcSchema::IfcAxis2Placement* placement = l->Position();
|
||||
if (placement->declaration().is(IfcSchema::IfcAxis2Placement3D::Class())) {
|
||||
convert((IfcSchema::IfcAxis2Placement3D*)placement,trsf);
|
||||
if (placement->as<IfcSchema::IfcAxis2Placement3D>()) {
|
||||
IfcGeom::Kernel::convert(placement->as<IfcSchema::IfcAxis2Placement3D>(), trsf);
|
||||
} else {
|
||||
gp_Trsf2d trsf2d;
|
||||
convert((IfcSchema::IfcAxis2Placement2D*)placement,trsf2d);
|
||||
IfcGeom::Kernel::convert(placement->as<IfcSchema::IfcAxis2Placement2D>(), trsf2d);
|
||||
trsf = trsf2d;
|
||||
}
|
||||
|
||||
gp_Ax2 ax = gp_Ax2();
|
||||
if (rotated) {
|
||||
ax.Rotate(ax.Axis(), M_PI / 2.);
|
||||
|
||||
@@ -3445,8 +3445,8 @@ const IfcSchema::IfcRepresentationItem* IfcGeom::Kernel::find_item_carrying_styl
|
||||
while (item->declaration().is(IfcSchema::IfcBooleanResult::Class())) {
|
||||
// All instantiations of IfcBooleanOperand (type of FirstOperand) are subtypes of
|
||||
// IfcGeometricRepresentationItem
|
||||
item = (IfcSchema::IfcGeometricRepresentationItem*) ((IfcSchema::IfcBooleanResult*) item)->FirstOperand();
|
||||
if (item->StyledByItem()->size()) {
|
||||
item = item->as<IfcSchema::IfcBooleanResult>()->FirstOperand()->as<IfcSchema::IfcRepresentationItem>();
|
||||
if (item && item->StyledByItem()->size()) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,8 +429,8 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcObjectPlacement* l, gp_Trsf& t
|
||||
for (;;) {
|
||||
gp_Trsf trsf2;
|
||||
IfcSchema::IfcAxis2Placement* relplacement = current->RelativePlacement();
|
||||
if ( relplacement->declaration().is(IfcSchema::IfcAxis2Placement3D::Class()) ) {
|
||||
IfcGeom::Kernel::convert((IfcSchema::IfcAxis2Placement3D*)relplacement,trsf2);
|
||||
if (relplacement->as<IfcSchema::IfcAxis2Placement3D>()) {
|
||||
IfcGeom::Kernel::convert(relplacement->as<IfcSchema::IfcAxis2Placement3D>(),trsf2);
|
||||
trsf.PreMultiply(trsf2);
|
||||
}
|
||||
if ( current->PlacementRelTo() ) {
|
||||
@@ -444,7 +444,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcObjectPlacement* l, gp_Trsf& t
|
||||
|
||||
if ( parentPlacesType ) break;
|
||||
else if ( parent->declaration().is(IfcSchema::IfcLocalPlacement::Class()) )
|
||||
current = (IfcSchema::IfcLocalPlacement*)current->PlacementRelTo();
|
||||
current = current->PlacementRelTo()->as<IfcSchema::IfcLocalPlacement>();
|
||||
else break;
|
||||
} else break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user