00001 /****************************************************************************** 00002 * SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3 * 00003 * (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS * 00004 * * 00005 * This library is free software; you can redistribute it and/or modify it * 00006 * under the terms of the GNU Lesser General Public License as published by * 00007 * the Free Software Foundation; either version 2.1 of the License, or (at * 00008 * your option) any later version. * 00009 * * 00010 * This library is distributed in the hope that it will be useful, but WITHOUT * 00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * 00013 * for more details. * 00014 * * 00015 * You should have received a copy of the GNU Lesser General Public License * 00016 * along with this library; if not, write to the Free Software Foundation, * 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 00018 ******************************************************************************* 00019 * SOFA :: Modules * 00020 * * 00021 * Authors: The SOFA Team and external contributors (see Authors.txt) * 00022 * * 00023 * Contact information: contact@sofa-framework.org * 00024 ******************************************************************************/ 00025 #ifndef SOFA_SIMULATION_TREE_EXPORTDOTACTION_H 00026 #define SOFA_SIMULATION_TREE_EXPORTDOTACTION_H 00027 00028 #include <sofa/simulation/tree/GNodeVisitor.h> 00029 #include <string> 00030 #include <iostream> 00031 00032 00033 namespace sofa 00034 { 00035 00036 namespace simulation 00037 { 00038 00039 namespace tree 00040 { 00041 00042 class ExportDotVisitor : public GNodeVisitor 00043 { 00044 public: 00045 std::ostream* out; 00046 00047 bool showNode; 00048 bool showObject; 00049 bool showBehaviorModel; 00050 bool showCollisionModel; 00051 bool showVisualModel; 00052 bool showMapping; 00053 bool showContext; 00054 bool showCollisionPipeline; 00055 bool showSolver; 00056 bool showMechanicalState; 00057 bool showForceField; 00058 bool showInteractionForceField; 00059 bool showConstraint; 00060 bool showMass; 00061 bool showTopology; 00062 bool showMechanicalMapping; 00063 00064 bool labelNodeName; 00065 bool labelNodeClass; 00066 bool labelObjectName; 00067 bool labelObjectClass; 00068 00069 ExportDotVisitor(std::ostream* out); 00070 ~ExportDotVisitor(); 00071 00072 void processObject(GNode* node, core::objectmodel::BaseObject* obj); 00073 00074 virtual Result processNodeTopDown(GNode* node); 00075 virtual void processNodeBottomUp(GNode* node); 00076 00077 00078 protected: 00079 00081 std::map<core::objectmodel::Base*, std::string> names; 00083 std::map<std::string, int> nextIndex; 00084 00086 bool display(GNode* node, const char** color=NULL); 00087 00089 bool display(core::objectmodel::BaseObject* obj, const char** color=NULL); 00090 00094 std::string getParentName(core::objectmodel::BaseObject* obj); 00095 00097 std::string getName(core::objectmodel::Base* o, std::string prefix); 00098 00100 std::string getName(GNode* node); 00101 00103 std::string getName(core::objectmodel::BaseObject* obj); 00104 00105 }; 00106 00107 } // namespace tree 00108 00109 } // namespace simulation 00110 00111 } // namespace sofa 00112 00113 #endif
1.5.7.1