ViewProviderBoolean.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2008 Werner Mayer <wmayer[at]users.sourceforge.net>     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #include "PreCompiled.h"
00025 
00026 #ifndef _PreComp_
00027 #endif
00028 
00029 #include "ViewProviderBoolean.h"
00030 #include <Gui/BitmapFactory.h>
00031 #include <Mod/Part/App/FeaturePartBoolean.h>
00032 #include <Mod/Part/App/FeaturePartFuse.h>
00033 #include <Mod/Part/App/FeaturePartCommon.h>
00034 
00035 using namespace PartGui;
00036 
00037 PROPERTY_SOURCE(PartGui::ViewProviderBoolean,PartGui::ViewProviderPart)
00038 
00039 ViewProviderBoolean::ViewProviderBoolean()
00040 {
00041 }
00042 
00043 ViewProviderBoolean::~ViewProviderBoolean()
00044 {
00045 }
00046 
00047 std::vector<App::DocumentObject*> ViewProviderBoolean::claimChildren(void)const
00048 {
00049     std::vector<App::DocumentObject*> temp;
00050     temp.push_back(static_cast<Part::Boolean*>(getObject())->Base.getValue());
00051     temp.push_back(static_cast<Part::Boolean*>(getObject())->Tool.getValue());
00052 
00053     return temp;
00054 }
00055 
00056 QIcon ViewProviderBoolean::getIcon(void) const
00057 {
00058     App::DocumentObject* obj = getObject();
00059     if (obj) {
00060         Base::Type type = obj->getTypeId();
00061         if (type == Base::Type::fromName("Part::Common"))
00062             return Gui::BitmapFactory().pixmap("Part_Common");
00063         else if (type == Base::Type::fromName("Part::Fuse"))
00064             return Gui::BitmapFactory().pixmap("Part_Fuse");
00065         else if (type == Base::Type::fromName("Part::Cut"))
00066             return Gui::BitmapFactory().pixmap("Part_Cut");
00067         else if (type == Base::Type::fromName("Part::Section"))
00068             return Gui::BitmapFactory().pixmap("Part_Section");
00069     }
00070 
00071     return ViewProviderPart::getIcon();
00072 }
00073 
00074 
00075 PROPERTY_SOURCE(PartGui::ViewProviderMultiFuse,PartGui::ViewProviderPart)
00076 
00077 ViewProviderMultiFuse::ViewProviderMultiFuse()
00078 {
00079 }
00080 
00081 ViewProviderMultiFuse::~ViewProviderMultiFuse()
00082 {
00083 }
00084 
00085 std::vector<App::DocumentObject*> ViewProviderMultiFuse::claimChildren(void)const
00086 {
00087     return std::vector<App::DocumentObject*>(static_cast<Part::MultiFuse*>(getObject())->Shapes.getValues());
00088 }
00089 
00090 QIcon ViewProviderMultiFuse::getIcon(void) const
00091 {
00092     return Gui::BitmapFactory().pixmap("Part_Fuse");
00093 }
00094 
00095 
00096 PROPERTY_SOURCE(PartGui::ViewProviderMultiCommon,PartGui::ViewProviderPart)
00097 
00098 ViewProviderMultiCommon::ViewProviderMultiCommon()
00099 {
00100 }
00101 
00102 ViewProviderMultiCommon::~ViewProviderMultiCommon()
00103 {
00104 }
00105 
00106 std::vector<App::DocumentObject*> ViewProviderMultiCommon::claimChildren(void)const
00107 {
00108     return std::vector<App::DocumentObject*>(static_cast<Part::MultiCommon*>(getObject())->Shapes.getValues());
00109 }
00110 
00111 QIcon ViewProviderMultiCommon::getIcon(void) const
00112 {
00113     return Gui::BitmapFactory().pixmap("Part_Common");
00114 }

Generated on Wed Nov 23 19:00:58 2011 for FreeCAD by  doxygen 1.6.1