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<TopoShape&>(this->Shape.getShape()); 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<TopoShape&>(this->Shape.getShape()); shape.setTransform(this->Placement.getValue().toMatrix()); } else { Base::Placement p; // shape must not be null to override the placement if (!this->Shape.getValue().IsNull()) { p.fromMatrix(this->Shape.getShape().getTransform()); if (p != this->Placement.getValue()) this->Placement.setValue(p); } } } GeoFeature::onChanged(prop); }
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()); } // 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()); if (p != this->Placement.getValue()) this->Placement.setValue(p); } GeoFeature::onChanged(prop); }
void Feature::onChanged(const App::Property* prop) { // if the placement has changed apply the change to the mesh data as well if (prop == &this->Placement) { MeshObject& mesh = const_cast<MeshObject&>(this->Mesh.getValue()); mesh.setTransform(this->Placement.getValue().toMatrix()); } // if the mesh data has changed check and adjust the transformation as well else if (prop == &this->Mesh) { Base::Placement p; p.fromMatrix(this->Mesh.getValue().getTransform()); if (p != this->Placement.getValue()) this->Placement.setValue(p); } // Note: If the Mesh property has changed the property and this object are marked as 'touched' // but no recomputation of this objects needs to be done because the Mesh property is regarded // as output of a previous recomputation The mustExecute() method returns 0 in that case. // However, objects that reference this object the Mesh property can be an input parameter. // As this object and the property are touched such objects can check this and return a value 1 // (or -1) in their mustExecute() to be recomputed the next time the document recomputes itself. DocumentObject::onChanged(prop); }