/*************************************************************************** * Copyright (c) 2004 Jürgen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) any later version. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Library General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this library; see the file COPYING.LIB. If not, * * write to the Free Software Foundation, Inc., 59 Temple Place, * * Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************/ #include "PreCompiled.h" #ifndef _PreComp_ #endif /// Here the FreeCAD includes sorted by Base,App,Gui...... #include #include "ViewProviderRuledSurface.h" #include #include //#include "Tree.h" using namespace PartGui; using namespace std; //************************************************************************** // Construction/Destruction PROPERTY_SOURCE(PartGui::ViewProviderRuledSurface, PartGui::ViewProviderPart) ViewProviderRuledSurface::ViewProviderRuledSurface() { sPixmap = "Part_RuledSurface.svg"; } ViewProviderRuledSurface::~ViewProviderRuledSurface() { } std::vector ViewProviderRuledSurface::claimChildren() const { std::vector temp; temp.push_back(static_cast(getObject())->Curve1.getValue()); temp.push_back(static_cast(getObject())->Curve2.getValue()); return temp; } void ViewProviderRuledSurface::updateData(const App::Property* prop) { PartGui::ViewProviderPart::updateData(prop); if (prop->getTypeId() == Part::PropertyShapeHistory::getClassTypeId()) { //const std::vector& hist = static_cast // (prop)->getValues(); } /* //The following hides the Children shapes. If the edges from which the Ruled Surface was created * were selected from the subshapes of another shape, it is likely that one would not want to hide the shape * hence this section is commented out Part::RuledSurface* pRuledSurface = static_cast(getObject()); App::DocumentObject *pCurve1 = pRuledSurface->Curve1.getValue(); App::DocumentObject *pCurve2 = pRuledSurface->Curve2.getValue(); if (pCurve1) Gui::Application::Instance->hideViewProvider(pCurve1); if (pCurve2) Gui::Application::Instance->hideViewProvider(pCurve2);*/ } bool ViewProviderRuledSurface::onDelete(const std::vector &) { // get the input shape Part::RuledSurface* pRuledSurface = static_cast(getObject()); App::DocumentObject *pCurve1 = pRuledSurface->Curve1.getValue(); App::DocumentObject *pCurve2 = pRuledSurface->Curve2.getValue(); if (pCurve1) Gui::Application::Instance->showViewProvider(pCurve1); if (pCurve2) Gui::Application::Instance->showViewProvider(pCurve2); return true; } // ********************************************************************************** std::vector ViewProviderRuledSurface::getDisplayModes(void) const { // get the modes of the father std::vector StrList; // add your own modes StrList.push_back("Flat Lines"); StrList.push_back("Shaded"); StrList.push_back("Wireframe"); StrList.push_back("Points"); return StrList; }