void ViewProviderInspection::attach(App::DocumentObject *pcFeat) { // creats the standard viewing modes inherited::attach(pcFeat); SoShapeHints * flathints = new SoShapeHints; flathints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE ; flathints->shapeType = SoShapeHints::UNKNOWN_SHAPE_TYPE; SoGroup* pcColorShadedRoot = new SoGroup(); pcColorShadedRoot->addChild(flathints); // color shaded ------------------------------------------ SoDrawStyle *pcFlatStyle = new SoDrawStyle(); pcFlatStyle->style = SoDrawStyle::FILLED; pcColorShadedRoot->addChild(pcFlatStyle); pcColorShadedRoot->addChild(pcColorMat); pcColorShadedRoot->addChild(pcMatBinding); pcColorShadedRoot->addChild(pcLinkRoot); addDisplayMaskMode(pcColorShadedRoot, "ColorShaded"); // Check for an already existing color bar Gui::SoFCColorBar* pcBar = ((Gui::SoFCColorBar*)findFrontRootOfType(Gui::SoFCColorBar::getClassTypeId())); if (pcBar) { float fMin = pcColorBar->getMinValue(); float fMax = pcColorBar->getMaxValue(); // Attach to the foreign color bar and delete our own bar pcBar->Attach(this); pcBar->ref(); pcBar->setRange(fMin, fMax, 3); pcBar->Notify(0); pcColorBar->Detach(this); pcColorBar->unref(); pcColorBar = pcBar; } pcColorRoot->addChild(pcColorBar); }
void ViewProviderFemPostObject::attach(App::DocumentObject *pcObj) { ViewProviderDocumentObject::attach(pcObj); // face nodes m_seperator->addChild(m_shapeHints); m_seperator->addChild(m_drawStyle); m_seperator->addChild(m_materialBinding); m_seperator->addChild(m_material); m_seperator->addChild(m_coordinates); m_seperator->addChild(m_markers); m_seperator->addChild(m_lines); m_seperator->addChild(m_faces); // Check for an already existing color bar Gui::SoFCColorBar* pcBar = ((Gui::SoFCColorBar*)findFrontRootOfType( Gui::SoFCColorBar::getClassTypeId() )); if ( pcBar ) { float fMin = m_colorBar->getMinValue(); float fMax = m_colorBar->getMaxValue(); // Attach to the foreign color bar and delete our own bar pcBar->Attach(this); pcBar->ref(); pcBar->setRange(fMin, fMax, 3); pcBar->Notify(0); m_colorBar->Detach(this); m_colorBar->unref(); m_colorBar = pcBar; } m_colorRoot->addChild(m_colorBar); //all addDisplayMaskMode(m_seperator, "Default"); setDisplayMaskMode("Default"); setupPipeline(); }