AppMeshGui.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2004 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 #ifndef _PreComp_
00026 #endif
00027 
00028 #include <Base/Interpreter.h>
00029 #include <Base/Console.h>
00030 
00031 #include <Gui/Application.h>
00032 #include <Gui/BitmapFactory.h>
00033 #include <Gui/WidgetFactory.h>
00034 #include <Gui/Language/Translator.h>
00035 
00036 #include <Mod/Mesh/App/MeshProperties.h>
00037 
00038 #include "images.h"
00039 #include "DlgEvaluateMeshImp.h"
00040 #include "PropertyEditorMesh.h"
00041 #include "DlgSettingsMeshView.h"
00042 #include "SoFCMeshObject.h"
00043 #include "SoFCIndexedFaceSet.h"
00044 #include "ViewProvider.h"
00045 #include "ViewProviderMeshFaceSet.h"
00046 #include "ViewProviderCurvature.h"
00047 #include "ViewProviderTransform.h"
00048 #include "ViewProviderTransformDemolding.h"
00049 #include "ViewProviderDefects.h"
00050 #include "ViewProviderPython.h"
00051 #include "Workbench.h"
00052 #include "qrc_Mesh.cpp"
00053 
00054 
00055 // use a different name to CreateCommand()
00056 void CreateMeshCommands(void);
00057 
00058 void loadMeshResource()
00059 {
00060     // add resources and reloads the translators
00061     Q_INIT_RESOURCE(Mesh);
00062     Gui::Translator::instance()->refresh();
00063 }
00064 
00065 /* registration table  */
00066 static struct PyMethodDef MeshGui_methods[] = {
00067     {NULL, NULL}                   /* end of table marker */
00068 };
00069 
00070 /* Python entry */
00071 extern "C" {
00072 void MeshGuiExport initMeshGui()
00073 {
00074     if (!Gui::Application::Instance) {
00075         PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
00076         return;
00077     }
00078 
00079     // load dependent module
00080     try {
00081         Base::Interpreter().loadModule("Mesh");
00082     }
00083     catch(const Base::Exception& e) {
00084         PyErr_SetString(PyExc_ImportError, e.what());
00085         return;
00086     }
00087     (void) Py_InitModule("MeshGui", MeshGui_methods);   /* mod name, table ptr */
00088     Base::Console().Log("Loading GUI of Mesh module... done\n");
00089 
00090     // Register icons
00091     Gui::BitmapFactory().addXPM("curv_info", curv_info);
00092     Gui::BitmapFactory().addXPM("import_mesh", import_mesh);
00093     Gui::BitmapFactory().addXPM("export_mesh", export_mesh);
00094     Gui::BitmapFactory().addXPM("solid_mesh", solid_mesh);
00095     Gui::BitmapFactory().addXPM("mesh_fillhole", mesh_fillhole);
00096     Gui::BitmapFactory().addXPM("mesh_pipette", mesh_pipette);
00097 
00098     // instantiating the commands
00099     CreateMeshCommands();
00100     (void)new MeshGui::CleanupHandler;
00101 
00102     // register preferences pages
00103     (void)new Gui::PrefPageProducer<MeshGui::DlgSettingsMeshView> ("Display");
00104 
00105     MeshGui::SoFCMeshObjectElement              ::initClass();
00106     MeshGui::SoSFMeshObject                     ::initClass();
00107     MeshGui::SoFCMeshObjectNode                 ::initClass();
00108     MeshGui::SoFCMeshObjectShape                ::initClass();
00109     MeshGui::SoFCMeshSegmentShape               ::initClass();
00110     MeshGui::SoFCMeshObjectBoundary             ::initClass();
00111     MeshGui::SoFCIndexedFaceSet                 ::initClass();
00112     MeshGui::SoFCMeshPickNode                   ::initClass();
00113     MeshGui::SoFCMeshGridNode                   ::initClass();
00114     MeshGui::PropertyMeshKernelItem             ::init();
00115     MeshGui::ViewProviderMesh                   ::init();
00116     MeshGui::ViewProviderMeshObject             ::init();
00117     MeshGui::ViewProviderIndexedFaceSet         ::init();
00118     MeshGui::ViewProviderMeshFaceSet            ::init();
00119     MeshGui::ViewProviderPython                 ::init();
00120     MeshGui::ViewProviderExport                 ::init();
00121     MeshGui::ViewProviderMeshCurvature          ::init();
00122     MeshGui::ViewProviderMeshTransform          ::init();
00123     MeshGui::ViewProviderMeshTransformDemolding ::init();
00124     MeshGui::ViewProviderMeshDefects            ::init();
00125     MeshGui::ViewProviderMeshOrientation        ::init();
00126     MeshGui::ViewProviderMeshNonManifolds       ::init();
00127     MeshGui::ViewProviderMeshDuplicatedFaces    ::init();
00128     MeshGui::ViewProviderMeshDuplicatedPoints   ::init();
00129     MeshGui::ViewProviderMeshDegenerations      ::init();
00130     MeshGui::ViewProviderMeshIndices            ::init();
00131     MeshGui::ViewProviderMeshSelfIntersections  ::init();
00132     MeshGui::ViewProviderMeshFolds              ::init();
00133     MeshGui::Workbench                          ::init();
00134     Gui::ViewProviderBuilder::add(
00135         Mesh::PropertyMeshKernel::getClassTypeId(),
00136         MeshGui::ViewProviderMeshFaceSet::getClassTypeId());
00137 
00138     // add resources and reloads the translators
00139     loadMeshResource();
00140 }
00141 
00142 } // extern "C" {

Generated on Wed Nov 23 18:59:56 2011 for FreeCAD by  doxygen 1.6.1