23
#include "PreCompiled.h"
25
#include <Inventor/nodes/SoSeparator.h>
28
#include <Gui/ViewProviderBuilder.h>
30
#include "ViewProviderPython.h"
33
using namespace SketcherGui;
35
PROPERTY_SOURCE(SketcherGui::ViewProviderCustom, SketcherGui::ViewProviderSketch)
37
ViewProviderCustom::ViewProviderCustom()
40
ViewProviderCustom::~ViewProviderCustom()
43
void ViewProviderCustom::onChanged(const App::Property* prop)
45
std::map<const App::Property*, Gui::ViewProvider*>::iterator it;
46
for (it = propView.begin(); it != propView.end(); ++it) {
47
App::Property* view = it->second->getPropertyByName(prop->getName());
49
App::Property* copy = prop->Copy();
56
ViewProviderSketch::onChanged(prop);
59
void ViewProviderCustom::updateData(const App::Property* prop)
61
if (prop->isDerivedFrom<App::PropertyComplexGeoData>()) {
62
std::map<const App::Property*, Gui::ViewProvider*>::iterator it = propView.find(prop);
63
if (it == propView.end()) {
64
Gui::ViewProvider* view = Gui::ViewProviderBuilder::create(prop->getTypeId());
66
if (view->isDerivedFrom<Gui::ViewProviderDocumentObject>()) {
67
static_cast<Gui::ViewProviderDocumentObject*>(view)->attach(this->getObject());
68
static_cast<Gui::ViewProviderDocumentObject*>(view)->setDisplayMode(
69
this->getActiveDisplayMode().c_str());
71
propView[prop] = view;
72
view->updateData(prop);
73
this->getRoot()->addChild(view->getRoot());
77
it->second->updateData(prop);
87
PROPERTY_SOURCE_TEMPLATE(SketcherGui::ViewProviderPython, SketcherGui::ViewProviderSketch)
91
template class SketcherGuiExport ViewProviderFeaturePythonT<SketcherGui::ViewProviderSketch>;
94
PROPERTY_SOURCE_TEMPLATE(SketcherGui::ViewProviderCustomPython, SketcherGui::ViewProviderCustom)
98
template class SketcherGuiExport ViewProviderFeaturePythonT<SketcherGui::ViewProviderCustom>;