Added Material base-classes
This commit is contained in:
parent
e6c649cc1d
commit
fd262a24f6
|
@ -93,6 +93,7 @@
|
|||
#include "MeasureDistance.h"
|
||||
#include "Placement.h"
|
||||
#include "Plane.h"
|
||||
#include "MaterialObject.h"
|
||||
|
||||
// If you stumble here, run the target "BuildExtractRevision" on Windows systems
|
||||
// or the Python script "SubWCRev.py" on Linux based systems which builds
|
||||
|
@ -1044,6 +1045,7 @@ void Application::initTypes(void)
|
|||
App ::Annotation ::init();
|
||||
App ::AnnotationLabel ::init();
|
||||
App ::MeasureDistance ::init();
|
||||
App ::MaterialObject ::init();
|
||||
App ::Placement ::init();
|
||||
App ::Plane ::init();
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ SET(Document_CPP_SRCS
|
|||
Plane.cpp
|
||||
Transactions.cpp
|
||||
VRMLObject.cpp
|
||||
MaterialObject.cpp
|
||||
)
|
||||
|
||||
SET(Document_HPP_SRCS
|
||||
|
@ -98,6 +99,7 @@ SET(Document_HPP_SRCS
|
|||
Plane.h
|
||||
Transactions.h
|
||||
VRMLObject.h
|
||||
MaterialObject.h
|
||||
)
|
||||
SET(Document_SRCS
|
||||
${Document_CPP_SRCS}
|
||||
|
|
66
src/App/MaterialObject.cpp
Normal file
66
src/App/MaterialObject.cpp
Normal file
|
@ -0,0 +1,66 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* 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
|
||||
|
||||
#include "MaterialObject.h"
|
||||
#include "DocumentObjectPy.h"
|
||||
|
||||
using namespace App;
|
||||
|
||||
PROPERTY_SOURCE(App::MaterialObject, App::DocumentObject)
|
||||
|
||||
|
||||
MaterialObject::MaterialObject()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Material,(),"Material",Prop_None,"Material key/valu map");
|
||||
|
||||
}
|
||||
|
||||
MaterialObject::~MaterialObject()
|
||||
{
|
||||
}
|
||||
|
||||
// Python feature ---------------------------------------------------------
|
||||
|
||||
namespace App {
|
||||
/// @cond DOXERR
|
||||
PROPERTY_SOURCE_TEMPLATE(App::MaterialObjectPython, App::MaterialObject)
|
||||
template<> const char* App::MaterialObjectPython::getViewProviderName(void) const {
|
||||
return "Gui::ViewProviderMaterialObject";
|
||||
}
|
||||
template<> PyObject* App::MaterialObjectPython::getPyObject(void) {
|
||||
if (PythonObject.is(Py::_None())) {
|
||||
// ref counter is set to 1
|
||||
PythonObject = Py::Object(new App::DocumentObjectPy(this),true);
|
||||
}
|
||||
return Py::new_reference_to(PythonObject);
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class AppExport FeaturePythonT<App::MaterialObject>;
|
||||
}
|
60
src/App/MaterialObject.h
Normal file
60
src/App/MaterialObject.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef APP_MaterialObject_H
|
||||
#define APP_MaterialObject_H
|
||||
|
||||
#include "DocumentObject.h"
|
||||
#include "PropertyStandard.h"
|
||||
#include "FeaturePython.h"
|
||||
|
||||
|
||||
namespace App
|
||||
{
|
||||
|
||||
class AppExport MaterialObject : public DocumentObject
|
||||
{
|
||||
PROPERTY_HEADER(App::MaterialObject);
|
||||
|
||||
public:
|
||||
/// Constructor
|
||||
MaterialObject(void);
|
||||
virtual ~MaterialObject();
|
||||
|
||||
App::PropertyMap Material;
|
||||
|
||||
|
||||
/// returns the type name of the ViewProvider
|
||||
const char* getViewProviderName(void) const {
|
||||
return "Gui::ViewProviderMaterialObject";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef App::FeaturePythonT<MaterialObject> MaterialObjectPython;
|
||||
|
||||
|
||||
} //namespace App
|
||||
|
||||
|
||||
#endif // APP_MaterialObject_H
|
|
@ -622,6 +622,7 @@ SET(Viewprovider_CPP_SRCS
|
|||
ViewProviderBuilder.cpp
|
||||
ViewProviderPlacement.cpp
|
||||
ViewProviderPlane.cpp
|
||||
ViewProviderMaterialObject.cpp
|
||||
)
|
||||
SET(Viewprovider_SRCS
|
||||
${Viewprovider_CPP_SRCS}
|
||||
|
@ -639,6 +640,7 @@ SET(Viewprovider_SRCS
|
|||
ViewProviderBuilder.h
|
||||
ViewProviderPlacement.h
|
||||
ViewProviderPlane.h
|
||||
ViewProviderMaterialObject.h
|
||||
)
|
||||
SOURCE_GROUP("View3D\\Viewprovider" FILES ${Viewprovider_SRCS})
|
||||
|
||||
|
|
87
src/Gui/ViewProviderMaterialObject.cpp
Normal file
87
src/Gui/ViewProviderMaterialObject.cpp
Normal file
|
@ -0,0 +1,87 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2006 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* 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_
|
||||
# include <QApplication>
|
||||
# include <QPixmap>
|
||||
#endif
|
||||
|
||||
#include <App/DocumentObjectGroup.h>
|
||||
#include <App/Document.h>
|
||||
|
||||
/// Here the FreeCAD includes sorted by Base,App,Gui......
|
||||
#include "ViewProviderMaterialObject.h"
|
||||
#include "Application.h"
|
||||
#include "Command.h"
|
||||
#include "BitmapFactory.h"
|
||||
#include "Document.h"
|
||||
#include "Tree.h"
|
||||
|
||||
|
||||
using namespace Gui;
|
||||
|
||||
|
||||
PROPERTY_SOURCE(Gui::ViewProviderMaterialObject, Gui::ViewProviderDocumentObject)
|
||||
|
||||
|
||||
/**
|
||||
* Creates the view provider for an object group.
|
||||
*/
|
||||
ViewProviderMaterialObject::ViewProviderMaterialObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ViewProviderMaterialObject::~ViewProviderMaterialObject()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the pixmap for the list item.
|
||||
*/
|
||||
QIcon ViewProviderMaterialObject::getIcon() const
|
||||
{
|
||||
QIcon groupIcon;
|
||||
groupIcon.addPixmap(QApplication::style()->standardPixmap(QStyle::SP_DirClosedIcon),
|
||||
QIcon::Normal, QIcon::Off);
|
||||
groupIcon.addPixmap(QApplication::style()->standardPixmap(QStyle::SP_DirOpenIcon),
|
||||
QIcon::Normal, QIcon::On);
|
||||
return groupIcon;
|
||||
}
|
||||
|
||||
|
||||
// Python feature -----------------------------------------------------------------------
|
||||
|
||||
namespace Gui {
|
||||
/// @cond DOXERR
|
||||
PROPERTY_SOURCE_TEMPLATE(Gui::ViewProviderMaterialObjectPython, Gui::ViewProviderMaterialObject)
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class GuiExport ViewProviderPythonFeatureT<ViewProviderMaterialObject>;
|
||||
}
|
53
src/Gui/ViewProviderMaterialObject.h
Normal file
53
src/Gui/ViewProviderMaterialObject.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/***************************************************************************
|
||||
* Copyright (c) 2006 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef GUI_VIEWPROVIDER_DOCUMENTOBJECTGROUP_H
|
||||
#define GUI_VIEWPROVIDER_DOCUMENTOBJECTGROUP_H
|
||||
|
||||
|
||||
#include "ViewProviderDocumentObject.h"
|
||||
#include "ViewProviderPythonFeature.h"
|
||||
|
||||
namespace Gui {
|
||||
|
||||
class GuiExport ViewProviderMaterialObject : public ViewProviderDocumentObject
|
||||
{
|
||||
PROPERTY_HEADER(Gui::ViewProviderMaterialObject);
|
||||
|
||||
public:
|
||||
/// constructor.
|
||||
ViewProviderMaterialObject();
|
||||
/// destructor.
|
||||
virtual ~ViewProviderMaterialObject();
|
||||
|
||||
QIcon getIcon(void) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
typedef ViewProviderPythonFeatureT<ViewProviderMaterialObject> ViewProviderMaterialObjectPython;
|
||||
|
||||
} // namespace Gui
|
||||
|
||||
#endif // GUI_VIEWPROVIDER_DOCUMENTOBJECTGROUP_H
|
||||
|
Loading…
Reference in New Issue
Block a user