diff --git a/src/App/PropertyGeo.h b/src/App/PropertyGeo.h index 381682a680..1515809be7 100644 --- a/src/App/PropertyGeo.h +++ b/src/App/PropertyGeo.h @@ -508,6 +508,10 @@ public: /** @name Modification */ //@{ + /// Set the placement of the geometry + virtual void setTransform(const Base::Matrix4D& rclTrf) = 0; + /// Get the placement of the geometry + virtual Base::Matrix4D getTransform() const = 0; /// Applies a transformation on the real geometric data type virtual void transformGeometry(const Base::Matrix4D &rclMat) = 0; /// Retrieve bounding box information diff --git a/src/Mod/Fem/App/FemMeshObject.cpp b/src/Mod/Fem/App/FemMeshObject.cpp index 8c056e9bb8..7d53cc9ac8 100644 --- a/src/Mod/Fem/App/FemMeshObject.cpp +++ b/src/Mod/Fem/App/FemMeshObject.cpp @@ -68,7 +68,7 @@ void FemMeshObject::onChanged(const Property* prop) // if the placement has changed apply the change to the mesh data as well if (prop == &this->Placement) { - const_cast(this->FemMesh.getValue()).setTransform(this->Placement.getValue().toMatrix()); + this->FemMesh.setTransform(this->Placement.getValue().toMatrix()); } } diff --git a/src/Mod/Fem/App/FemMeshProperty.cpp b/src/Mod/Fem/App/FemMeshProperty.cpp index 96c28688e5..14a9576830 100644 --- a/src/Mod/Fem/App/FemMeshProperty.cpp +++ b/src/Mod/Fem/App/FemMeshProperty.cpp @@ -82,6 +82,16 @@ Base::BoundBox3d PropertyFemMesh::getBoundingBox() const return _FemMesh->getBoundBox(); } +void PropertyFemMesh::setTransform(const Base::Matrix4D &rclTrf) +{ + _FemMesh->setTransform(rclTrf); +} + +Base::Matrix4D PropertyFemMesh::getTransform() const +{ + return _FemMesh->getTransform(); +} + void PropertyFemMesh::transformGeometry(const Base::Matrix4D &rclMat) { aboutToSetValue(); diff --git a/src/Mod/Fem/App/FemMeshProperty.h b/src/Mod/Fem/App/FemMeshProperty.h index 857f3cb881..77d1358cc6 100644 --- a/src/Mod/Fem/App/FemMeshProperty.h +++ b/src/Mod/Fem/App/FemMeshProperty.h @@ -60,6 +60,10 @@ public: //@{ /** Returns the bounding box around the underlying mesh kernel */ Base::BoundBox3d getBoundingBox() const; + /// Set the placement of the geometry + void setTransform(const Base::Matrix4D& rclTrf); + /// Get the placement of the geometry + Base::Matrix4D getTransform() const; void transformGeometry(const Base::Matrix4D &rclMat); //@} diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index dde5d962be..0dcb2883c4 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -541,14 +541,12 @@ void Feature::onChanged(const App::Property* prop) { // if the placement has changed apply the change to the point data as well if (prop == &this->Placement) { - TopoShape& shape = const_cast(this->Shape.getShape()); - shape.setTransform(this->Placement.getValue().toMatrix()); + this->Shape.setTransform(this->Placement.getValue().toMatrix()); } // if the point data has changed check and adjust the transformation as well else if (prop == &this->Shape) { if (this->isRecomputing()) { - TopoShape& shape = const_cast(this->Shape.getShape()); - shape.setTransform(this->Placement.getValue().toMatrix()); + this->Shape.setTransform(this->Placement.getValue().toMatrix()); } else { Base::Placement p; diff --git a/src/Mod/Part/App/PropertyTopoShape.cpp b/src/Mod/Part/App/PropertyTopoShape.cpp index eb8cbdb0b7..38513236de 100644 --- a/src/Mod/Part/App/PropertyTopoShape.cpp +++ b/src/Mod/Part/App/PropertyTopoShape.cpp @@ -137,6 +137,16 @@ Base::BoundBox3d PropertyPartShape::getBoundingBox() const return box; } +void PropertyPartShape::setTransform(const Base::Matrix4D &rclTrf) +{ + _Shape.setTransform(rclTrf); +} + +Base::Matrix4D PropertyPartShape::getTransform() const +{ + return _Shape.getTransform(); +} + void PropertyPartShape::transformGeometry(const Base::Matrix4D &rclTrf) { aboutToSetValue(); diff --git a/src/Mod/Part/App/PropertyTopoShape.h b/src/Mod/Part/App/PropertyTopoShape.h index fc0e52f7b9..c6382396b5 100644 --- a/src/Mod/Part/App/PropertyTopoShape.h +++ b/src/Mod/Part/App/PropertyTopoShape.h @@ -59,6 +59,10 @@ public: /** @name Modification */ //@{ + /// Set the placement of the geometry + void setTransform(const Base::Matrix4D& rclTrf); + /// Get the placement of the geometry + Base::Matrix4D getTransform() const; /// Transform the real shape data void transformGeometry(const Base::Matrix4D &rclMat); //@} diff --git a/src/Mod/Points/App/PointsFeature.cpp b/src/Mod/Points/App/PointsFeature.cpp index f623057334..1ac669d745 100644 --- a/src/Mod/Points/App/PointsFeature.cpp +++ b/src/Mod/Points/App/PointsFeature.cpp @@ -80,13 +80,12 @@ void Feature::onChanged(const App::Property* prop) { // if the placement has changed apply the change to the point data as well if (prop == &this->Placement) { - PointKernel& pts = const_cast(this->Points.getValue()); - pts.setTransform(this->Placement.getValue().toMatrix()); + this->Points.setTransform(this->Placement.getValue().toMatrix()); } // if the point data has changed check and adjust the transformation as well else if (prop == &this->Points) { Base::Placement p; - p.fromMatrix(this->Points.getValue().getTransform()); + p.fromMatrix(this->Points.getTransform()); if (p != this->Placement.getValue()) this->Placement.setValue(p); } diff --git a/src/Mod/Points/App/PropertyPointKernel.cpp b/src/Mod/Points/App/PropertyPointKernel.cpp index 038253415a..7a8289bd39 100644 --- a/src/Mod/Points/App/PropertyPointKernel.cpp +++ b/src/Mod/Points/App/PropertyPointKernel.cpp @@ -68,6 +68,16 @@ const Data::ComplexGeoData* PropertyPointKernel::getComplexData() const return _cPoints; } +void PropertyPointKernel::setTransform(const Base::Matrix4D& rclTrf) +{ + _cPoints->setTransform(rclTrf); +} + +Base::Matrix4D PropertyPointKernel::getTransform() const +{ + return _cPoints->getTransform(); +} + Base::BoundBox3d PropertyPointKernel::getBoundingBox() const { return _cPoints->getBoundBox(); diff --git a/src/Mod/Points/App/PropertyPointKernel.h b/src/Mod/Points/App/PropertyPointKernel.h index 9bad519ebc..23b01a837b 100644 --- a/src/Mod/Points/App/PropertyPointKernel.h +++ b/src/Mod/Points/App/PropertyPointKernel.h @@ -46,6 +46,8 @@ public: /// get the points (only const possible!) const PointKernel &getValue() const; const Data::ComplexGeoData* getComplexData() const; + void setTransform(const Base::Matrix4D& rclTrf); + Base::Matrix4D getTransform() const; //@} /** @name Getting basic geometric entities */