Part: modernize type checking
This commit is contained in:
@@ -805,7 +805,7 @@ private:
|
||||
PyObject* item = (*it).ptr();
|
||||
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(item)->getDocumentObjectPtr();
|
||||
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (obj->isDerivedFrom<Part::Feature>()) {
|
||||
Part::Feature* part = static_cast<Part::Feature*>(obj);
|
||||
const TopoDS_Shape& shape = part->Shape.getValue();
|
||||
if (!shape.IsNull())
|
||||
|
||||
@@ -765,7 +765,7 @@ void AttachEngine::readLinks(const App::PropertyLinkSubList &references,
|
||||
shapes.resize(objs.size());
|
||||
types.resize(objs.size());
|
||||
for (std::size_t i = 0; i < objs.size(); i++) {
|
||||
if (!objs[i]->getTypeId().isDerivedFrom(App::GeoFeature::getClassTypeId())) {
|
||||
if (!objs[i]->isDerivedFrom<App::GeoFeature>()) {
|
||||
throw AttachEngineException("AttachEngine3D: link points to something that is not App::GeoFeature");
|
||||
}
|
||||
App::GeoFeature* geof = static_cast<App::GeoFeature*>(objs[i]);
|
||||
|
||||
@@ -82,7 +82,7 @@ int CurveConstraintPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
|
||||
#if OCC_VERSION_HEX >= 0x070600
|
||||
Handle(Adaptor3d_Curve) hCurve;
|
||||
if (curve->getTypeId().isDerivedFrom(GeomTrimmedCurve::getClassTypeId())) {
|
||||
if (curve->isDerivedFrom<GeomTrimmedCurve>()) {
|
||||
GeomTrimmedCurve* trim = static_cast<GeomTrimmedCurve*>(curve);
|
||||
hCurve = new GeomAdaptor_Curve(handle, trim->getFirstParameter(), trim->getLastParameter());
|
||||
}
|
||||
@@ -91,7 +91,7 @@ int CurveConstraintPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
}
|
||||
#else
|
||||
Handle(Adaptor3d_HCurve) hCurve;
|
||||
if (curve->getTypeId().isDerivedFrom(GeomTrimmedCurve::getClassTypeId())) {
|
||||
if (curve->isDerivedFrom<GeomTrimmedCurve>()) {
|
||||
GeomTrimmedCurve* trim = static_cast<GeomTrimmedCurve*>(curve);
|
||||
GeomAdaptor_Curve adapt(handle, trim->getFirstParameter(), trim->getLastParameter());
|
||||
hCurve = new GeomAdaptor_HCurve(adapt);
|
||||
|
||||
@@ -157,7 +157,7 @@ bool Part2DObject::seekTrimPoints(const std::vector<Geometry *> &geomlist,
|
||||
// this is just a work-around until that bug is fixed.
|
||||
// https://www.freecad.org/tracker/view.php?id=2463
|
||||
// https://tracker.dev.opencascade.org/view.php?id=30217
|
||||
if (geomlist[id]->getTypeId().isDerivedFrom(Part::GeomBoundedCurve::getClassTypeId())) {
|
||||
if (geomlist[id]->isDerivedFrom<Part::GeomBoundedCurve>()) {
|
||||
|
||||
Part::GeomBoundedCurve * bcurve = static_cast<Part::GeomBoundedCurve *>(geomlist[id]);
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ void Primitive::handleChangedPropertyType(Base::XMLReader &reader, const char *
|
||||
// types don't match if both inherit from PropertyFloat because all derived
|
||||
// classes do not re-implement the Save/Restore methods.
|
||||
Base::Type inputType = Base::Type::fromName(TypeName);
|
||||
if (prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId()) &&
|
||||
if (prop->isDerivedFrom<App::PropertyFloat>() &&
|
||||
inputType.isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||
// Do not directly call the property's Restore method in case the implementation
|
||||
// has changed. So, create a temporary PropertyFloat object and assign the value.
|
||||
|
||||
@@ -3771,7 +3771,7 @@ void TopoShape::getLinesFromSubElement(const Data::Segment* element,
|
||||
std::vector<Base::Vector3d> &vertices,
|
||||
std::vector<Line> &lines) const
|
||||
{
|
||||
if (element->getTypeId() == ShapeSegment::getClassTypeId()) {
|
||||
if (element->is<ShapeSegment>()) {
|
||||
const TopoDS_Shape& shape = static_cast<const ShapeSegment*>(element)->Shape;
|
||||
if (shape.IsNull())
|
||||
return;
|
||||
@@ -3785,7 +3785,7 @@ void TopoShape::getFacesFromSubElement(const Data::Segment* element,
|
||||
std::vector<Base::Vector3d> &pointNormals,
|
||||
std::vector<Facet> &faces) const
|
||||
{
|
||||
if (element->getTypeId() == ShapeSegment::getClassTypeId()) {
|
||||
if (element->is<ShapeSegment>()) {
|
||||
const TopoDS_Shape& shape = static_cast<const ShapeSegment*>(element)->Shape;
|
||||
if (shape.IsNull() || shape.ShapeType() != TopAbs_FACE)
|
||||
return;
|
||||
|
||||
@@ -126,7 +126,7 @@ void DlgBooleanOperation::slotCreatedObject(const App::DocumentObject& obj)
|
||||
if (!activeDoc)
|
||||
return;
|
||||
App::Document* doc = obj.getDocument();
|
||||
if (activeDoc == doc && obj.getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (activeDoc == doc && obj.isDerivedFrom<Part::Feature>()) {
|
||||
observe.push_back(&obj);
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ void DlgBooleanOperation::slotChangedObject(const App::DocumentObject& obj,
|
||||
{
|
||||
std::list<const App::DocumentObject*>::iterator it;
|
||||
it = std::find(observe.begin(), observe.end(), &obj);
|
||||
if (it != observe.end() && prop.getTypeId() == Part::PropertyPartShape::getClassTypeId()) {
|
||||
if (it != observe.end() && prop.is<Part::PropertyPartShape>()) {
|
||||
const TopoDS_Shape& shape = static_cast<const Part::PropertyPartShape&>(prop).getValue();
|
||||
if (!shape.IsNull()) {
|
||||
Gui::Document* activeGui = Gui::Application::Instance->getDocument(obj.getDocument());
|
||||
@@ -198,7 +198,7 @@ void DlgBooleanOperation::slotChangedObject(const App::DocumentObject& obj,
|
||||
|
||||
bool DlgBooleanOperation::hasSolids(const App::DocumentObject* obj) const
|
||||
{
|
||||
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (obj->isDerivedFrom<Part::Feature>()) {
|
||||
const TopoDS_Shape& shape = static_cast<const Part::Feature*>(obj)->Shape.getValue();
|
||||
TopExp_Explorer anExp (shape, TopAbs_SOLID);
|
||||
if (anExp.More()) {
|
||||
|
||||
@@ -732,7 +732,7 @@ void DlgFilletEdges::onShapeObjectActivated(int itemPos)
|
||||
if (!doc)
|
||||
return;
|
||||
App::DocumentObject* part = doc->getObject((const char*)name);
|
||||
if (part && part->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (part && part->isDerivedFrom<Part::Feature>()) {
|
||||
d->object = part;
|
||||
TopoDS_Shape myShape = static_cast<Part::Feature*>(part)->Shape.getValue();
|
||||
|
||||
|
||||
@@ -79,11 +79,11 @@ void PropertyEnumAttacherItem::openTask()
|
||||
if (prop) {
|
||||
App::PropertyContainer* parent = prop->getContainer();
|
||||
|
||||
if (parent->getTypeId().isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
if (parent->isDerivedFrom<App::DocumentObject>()) {
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObject*>(parent);
|
||||
Gui::ViewProvider* view = Gui::Application::Instance->getViewProvider(obj);
|
||||
|
||||
if (view->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) {
|
||||
if (view->isDerivedFrom<Gui::ViewProviderDocumentObject>()) {
|
||||
task = new TaskDlgAttacher(static_cast<Gui::ViewProviderDocumentObject*>(view));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ const QString makeRefString(const App::DocumentObject* obj, const std::string& s
|
||||
if (!obj)
|
||||
return QObject::tr("No reference selected");
|
||||
|
||||
if (obj->getTypeId().isDerivedFrom(App::OriginFeature::getClassTypeId()) ||
|
||||
obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId()))
|
||||
if (obj->isDerivedFrom<App::OriginFeature>() ||
|
||||
obj->isDerivedFrom<Part::Datum>())
|
||||
// App::Plane, Line or Datum feature
|
||||
return QString::fromLatin1(obj->getNameInDocument());
|
||||
|
||||
@@ -372,8 +372,8 @@ void TaskAttacher::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
std::string subname = msg.pSubName;
|
||||
|
||||
// Remove subname for planes and datum features
|
||||
if (selObj->getTypeId().isDerivedFrom(App::OriginFeature::getClassTypeId()) ||
|
||||
selObj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId()))
|
||||
if (selObj->isDerivedFrom<App::OriginFeature>() ||
|
||||
selObj->isDerivedFrom<Part::Datum>())
|
||||
subname = "";
|
||||
|
||||
// eliminate duplicate selections
|
||||
@@ -614,13 +614,13 @@ void TaskAttacher::onRefName(const QString& text, unsigned idx)
|
||||
|
||||
std::string subElement;
|
||||
|
||||
if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
if (obj->isDerivedFrom<App::Plane>()) {
|
||||
// everything is OK (we assume a Part can only have exactly 3 App::Plane objects located at the base of the feature tree)
|
||||
subElement.clear();
|
||||
} else if (obj->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
|
||||
} else if (obj->isDerivedFrom<App::Line>()) {
|
||||
// everything is OK (we assume a Part can only have exactly 3 App::Line objects located at the base of the feature tree)
|
||||
subElement.clear();
|
||||
} else if (obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) {
|
||||
} else if (obj->isDerivedFrom<Part::Datum>()) {
|
||||
subElement.clear();
|
||||
} else {
|
||||
// TODO: check validity of the text that was entered: Does subElement actually reference to an element on the obj?
|
||||
|
||||
@@ -222,7 +222,7 @@ public:
|
||||
|
||||
FaceColors* self = static_cast<FaceColors*>(ud);
|
||||
self->d->view = nullptr;
|
||||
if (self->d->obj && self->d->obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (self->d->obj && self->d->obj->isDerivedFrom<Part::Feature>()) {
|
||||
cb->setHandled();
|
||||
const TopoDS_Shape& shape = static_cast<Part::Feature*>(self->d->obj)->Shape.getValue();
|
||||
self->d->boxSelection = true;
|
||||
|
||||
@@ -152,7 +152,7 @@ void ShapeBuilderWidget::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
bool blocked = blockSelection(true);
|
||||
App::Document* doc = App::GetApplication().getDocument(msg.pDocName);
|
||||
App::DocumentObject* obj = doc->getObject(msg.pObjectName);
|
||||
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
if (obj->isDerivedFrom<Part::Feature>()) {
|
||||
TopoDS_Shape myShape = static_cast<Part::Feature*>(obj)->Shape.getValue();
|
||||
TopTools_IndexedMapOfShape all_faces;
|
||||
TopExp::MapShapes(myShape, TopAbs_FACE, all_faces);
|
||||
|
||||
@@ -210,7 +210,7 @@ void ViewProvider2DObjectGrid::updateData(const App::Property* prop)
|
||||
{
|
||||
ViewProvider2DObject::updateData(prop);
|
||||
|
||||
if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId()) {
|
||||
if (prop->is<Part::PropertyPartShape>()) {
|
||||
if (GridAutoSize.getValue()) {
|
||||
Base::BoundBox3d bbox = static_cast<const Part::PropertyPartShape*>(prop)->getBoundingBox();
|
||||
if (!bbox.IsValid())
|
||||
@@ -263,7 +263,7 @@ void ViewProvider2DObjectGrid::handleChangedPropertyType(Base::XMLReader &reader
|
||||
App::Property * prop)
|
||||
{
|
||||
Base::Type inputType = Base::Type::fromName(TypeName);
|
||||
if (prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId()) &&
|
||||
if (prop->isDerivedFrom<App::PropertyFloat>() &&
|
||||
inputType.isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||
// Do not directly call the property's Restore method in case the implementation
|
||||
// has changed. So, create a temporary PropertyFloat object and assign the value.
|
||||
|
||||
@@ -73,7 +73,7 @@ QIcon ViewProviderBoolean::getIcon() const
|
||||
void ViewProviderBoolean::updateData(const App::Property* prop)
|
||||
{
|
||||
PartGui::ViewProviderPart::updateData(prop);
|
||||
if (prop->getTypeId() == Part::PropertyShapeHistory::getClassTypeId()) {
|
||||
if (prop->is<Part::PropertyShapeHistory>()) {
|
||||
const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
|
||||
(prop)->getValues();
|
||||
if (hist.size() != 2)
|
||||
@@ -133,7 +133,7 @@ void ViewProviderBoolean::updateData(const App::Property* prop)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLink::getClassTypeId())) {
|
||||
else if (prop->isDerivedFrom<App::PropertyLink>()) {
|
||||
App::DocumentObject *pBase = static_cast<const App::PropertyLink*>(prop)->getValue();
|
||||
if (pBase)
|
||||
Gui::Application::Instance->hideViewProvider(pBase);
|
||||
@@ -174,7 +174,7 @@ QIcon ViewProviderMultiFuse::getIcon() const
|
||||
void ViewProviderMultiFuse::updateData(const App::Property* prop)
|
||||
{
|
||||
PartGui::ViewProviderPart::updateData(prop);
|
||||
if (prop->getTypeId() == Part::PropertyShapeHistory::getClassTypeId()) {
|
||||
if (prop->is<Part::PropertyShapeHistory>()) {
|
||||
const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
|
||||
(prop)->getValues();
|
||||
Part::MultiFuse* objBool = static_cast<Part::MultiFuse*>(getObject());
|
||||
@@ -221,7 +221,7 @@ void ViewProviderMultiFuse::updateData(const App::Property* prop)
|
||||
|
||||
this->DiffuseColor.setValues(colBool);
|
||||
}
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
else if (prop->isDerivedFrom<App::PropertyLinkList>()) {
|
||||
std::vector<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (auto it : pShapes) {
|
||||
if (it) {
|
||||
@@ -309,7 +309,7 @@ QIcon ViewProviderMultiCommon::getIcon() const
|
||||
void ViewProviderMultiCommon::updateData(const App::Property* prop)
|
||||
{
|
||||
PartGui::ViewProviderPart::updateData(prop);
|
||||
if (prop->getTypeId() == Part::PropertyShapeHistory::getClassTypeId()) {
|
||||
if (prop->is<Part::PropertyShapeHistory>()) {
|
||||
const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
|
||||
(prop)->getValues();
|
||||
Part::MultiCommon* objBool = static_cast<Part::MultiCommon*>(getObject());
|
||||
@@ -356,7 +356,7 @@ void ViewProviderMultiCommon::updateData(const App::Property* prop)
|
||||
|
||||
this->DiffuseColor.setValues(colBool);
|
||||
}
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
else if (prop->isDerivedFrom<App::PropertyLinkList>()) {
|
||||
std::vector<App::DocumentObject*> pShapes = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (auto it : pShapes) {
|
||||
if (it) {
|
||||
|
||||
@@ -65,7 +65,7 @@ bool ViewProviderCompound::onDelete(const std::vector<std::string> &)
|
||||
void ViewProviderCompound::updateData(const App::Property* prop)
|
||||
{
|
||||
PartGui::ViewProviderPart::updateData(prop);
|
||||
if (prop->getTypeId() == Part::PropertyShapeHistory::getClassTypeId()) {
|
||||
if (prop->is<Part::PropertyShapeHistory>()) {
|
||||
const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
|
||||
(prop)->getValues();
|
||||
Part::Compound* objComp = static_cast<Part::Compound*>(getObject());
|
||||
@@ -131,7 +131,7 @@ void ViewProviderCompound::updateData(const App::Property* prop)
|
||||
|
||||
this->DiffuseColor.setValues(compCol);
|
||||
}
|
||||
else if (prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId())) {
|
||||
else if (prop->isDerivedFrom<App::PropertyLinkList>()) {
|
||||
const std::vector<App::DocumentObject *>& pBases = static_cast<const App::PropertyLinkList*>(prop)->getValues();
|
||||
for (auto pBase : pBases) {
|
||||
if (pBase) Gui::Application::Instance->hideViewProvider(pBase);
|
||||
@@ -146,7 +146,7 @@ bool ViewProviderCompound::canDragObjects() const
|
||||
|
||||
bool ViewProviderCompound::canDragObject(App::DocumentObject* obj) const
|
||||
{
|
||||
return obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId());
|
||||
return obj->isDerivedFrom<Part::Feature>();
|
||||
}
|
||||
|
||||
void ViewProviderCompound::dragObject(App::DocumentObject* obj)
|
||||
@@ -169,7 +169,7 @@ bool ViewProviderCompound::canDropObjects() const
|
||||
|
||||
bool ViewProviderCompound::canDropObject(App::DocumentObject* obj) const
|
||||
{
|
||||
return obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId());
|
||||
return obj->isDerivedFrom<Part::Feature>();
|
||||
}
|
||||
|
||||
void ViewProviderCompound::dropObject(App::DocumentObject* obj)
|
||||
|
||||
@@ -99,7 +99,7 @@ void ViewProviderCurveNet::attach(App::DocumentObject *pcFeat)
|
||||
void ViewProviderCurveNet::updateData(const App::Property* prop)
|
||||
{
|
||||
Gui::ViewProviderGeometryObject::updateData(prop); // clazy:exclude=skipped-base-method
|
||||
if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId()) {
|
||||
if (prop->is<Part::PropertyPartShape>()) {
|
||||
TopoDS_Shape cShape = static_cast<const Part::PropertyPartShape*>(prop)->getValue();
|
||||
if (cShape.IsNull())
|
||||
return;
|
||||
|
||||
@@ -377,7 +377,7 @@ void ViewProviderPartExt::onChanged(const App::Property* prop)
|
||||
bool ViewProviderPartExt::allowOverride(const App::DocumentObject &) const {
|
||||
// Many derived view providers still uses static_cast to get object
|
||||
// pointer, so check for exact type here.
|
||||
return getTypeId() == ViewProviderPartExt::getClassTypeId();
|
||||
return is<ViewProviderPartExt>();
|
||||
}
|
||||
|
||||
void ViewProviderPartExt::attach(App::DocumentObject *pcFeat)
|
||||
|
||||
@@ -468,7 +468,7 @@ void ViewProviderGridExtension::getClosestGridPoint(double &x, double &y) const
|
||||
void ViewProviderGridExtension::extensionUpdateData(const App::Property* prop)
|
||||
{
|
||||
if(pImpl->getEnabled()) {
|
||||
if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId()) {
|
||||
if (prop->is<Part::PropertyPartShape>()) {
|
||||
pImpl->drawGrid();
|
||||
}
|
||||
}
|
||||
@@ -539,7 +539,7 @@ bool ViewProviderGridExtension::extensionHandleChangedPropertyType(Base::XMLRead
|
||||
{
|
||||
Base::Type inputType = Base::Type::fromName(TypeName);
|
||||
|
||||
if (prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId()) &&
|
||||
if (prop->isDerivedFrom<App::PropertyFloat>() &&
|
||||
inputType.isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||
// Do not directly call the property's Restore method in case the implementation
|
||||
// has changed. So, create a temporary PropertyFloat object and assign the value.
|
||||
|
||||
@@ -231,7 +231,7 @@ ViewProviderFillet::~ViewProviderFillet() = default;
|
||||
void ViewProviderFillet::updateData(const App::Property* prop)
|
||||
{
|
||||
PartGui::ViewProviderPart::updateData(prop);
|
||||
if (prop->getTypeId() == Part::PropertyShapeHistory::getClassTypeId()) {
|
||||
if (prop->is<Part::PropertyShapeHistory>()) {
|
||||
const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
|
||||
(prop)->getValues();
|
||||
if (hist.size() != 1)
|
||||
@@ -341,7 +341,7 @@ ViewProviderChamfer::~ViewProviderChamfer() = default;
|
||||
void ViewProviderChamfer::updateData(const App::Property* prop)
|
||||
{
|
||||
PartGui::ViewProviderPart::updateData(prop);
|
||||
if (prop->getTypeId() == Part::PropertyShapeHistory::getClassTypeId()) {
|
||||
if (prop->is<Part::PropertyShapeHistory>()) {
|
||||
const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
|
||||
(prop)->getValues();
|
||||
if (hist.size() != 1)
|
||||
|
||||
@@ -57,12 +57,12 @@ void ViewProviderCustom::onChanged(const App::Property* prop)
|
||||
|
||||
void ViewProviderCustom::updateData(const App::Property* prop)
|
||||
{
|
||||
if (prop->getTypeId().isDerivedFrom(App::PropertyComplexGeoData::getClassTypeId())) {
|
||||
if (prop->isDerivedFrom<App::PropertyComplexGeoData>()) {
|
||||
std::map<const App::Property*, Gui::ViewProvider*>::iterator it = propView.find(prop);
|
||||
if (it == propView.end()) {
|
||||
Gui::ViewProvider* view = Gui::ViewProviderBuilder::create(prop->getTypeId());
|
||||
if (view) {
|
||||
if (view->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) {
|
||||
if (view->isDerivedFrom<Gui::ViewProviderDocumentObject>()) {
|
||||
static_cast<Gui::ViewProviderDocumentObject*>(view)->attach(this->getObject());
|
||||
static_cast<Gui::ViewProviderDocumentObject*>(view)->setDisplayMode(this->getActiveDisplayMode().c_str());
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ std::vector<App::DocumentObject*> ViewProviderRuledSurface::claimChildren() cons
|
||||
void ViewProviderRuledSurface::updateData(const App::Property* prop)
|
||||
{
|
||||
PartGui::ViewProviderPart::updateData(prop);
|
||||
if (prop->getTypeId() == Part::PropertyShapeHistory::getClassTypeId()) {
|
||||
if (prop->is<Part::PropertyShapeHistory>()) {
|
||||
//const std::vector<Part::ShapeHistory>& hist = static_cast<const Part::PropertyShapeHistory*>
|
||||
// (prop)->getValues();
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ void ViewProviderSplineExtension::extensionSetupContextMenu(QMenu* menu, QObject
|
||||
void ViewProviderSplineExtension::extensionUpdateData(const App::Property* prop)
|
||||
{
|
||||
Gui::ViewProviderExtension::extensionUpdateData(prop);
|
||||
if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId() && strcmp(prop->getName(), "Shape") == 0) {
|
||||
if (prop->is<Part::PropertyPartShape>() && strcmp(prop->getName(), "Shape") == 0) {
|
||||
// update control points if there
|
||||
if (pcControlPoints) {
|
||||
Gui::coinRemoveAllChildren(pcControlPoints);
|
||||
@@ -139,7 +139,7 @@ void ViewProviderSplineExtension::showControlPoints(bool show, const App::Proper
|
||||
return;
|
||||
|
||||
// ask for the property we are interested in
|
||||
if (prop && prop->getTypeId() == Part::PropertyPartShape::getClassTypeId()) {
|
||||
if (prop && prop->is<Part::PropertyPartShape>()) {
|
||||
const TopoDS_Shape& shape = static_cast<const Part::PropertyPartShape*>(prop)->getValue();
|
||||
if (shape.IsNull())
|
||||
return; // empty shape
|
||||
|
||||
Reference in New Issue
Block a user