App: add pure virtual methods to PropertyGeometry to delegate it to the geometry of sub-classes
Following the law of Demeter add some wrapper methods to PropertyGeometry and implement them in sub-classes. As a side-effect this makes some const_cast obsolete
This commit is contained in:
@@ -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<PointKernel&>(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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user