Studierstube Documentation Project

   Main Page       Modules       Class Hierarchy       Alphabetical List       Compound List       File List       Compound Members       Related Pages   

SoBuildBotanicAction.h

Go to the documentation of this file.
00001 /* ========================================================================
00002  * Copyright (C) 2000,2001,2002  Vienna University of Technology
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  *
00018  * For further information please contact Dieter Schmalstieg under
00019  * <schmalstieg@ims.tuwien.ac.at> or write to Dieter Schmalstieg,
00020  * Vienna University of Technology, Favoritenstr. 9-11/188, A1040 Vienna,
00021  * Austria.
00022  * ========================================================================
00023  * PROJECT: animal
00024  * ======================================================================== */
00025 /**
00026  * header file for SoBuildPucStyleAction
00027  *
00028  * @author  Valerie Maquil
00029  *
00030  * $Header:
00031  * @file                                                                   */
00032 /* ======================================================================= */
00033 
00034 #ifndef __SOBuildBotanicAction_H__
00035 #define __SOBuildBotanicAction_H__
00036 
00037 
00038 #include <Inventor/actions/SoSubAction.h>
00039 #include <Inventor/nodes/SoSeparator.h>
00040 #include <Inventor/nodes/SoTransform.h>
00041 
00042 
00043 #ifdef WIN32
00044 #include <SoWinLeaveScope.h>
00045 #endif
00046 
00047 
00048 #include "BotanicVis.h"
00049 #include "SoBotanicalBranch.h"
00050 #include "SoBotanicalFruit.h"
00051 
00052 #include <string>
00053 #include <stdlib.h>
00054 
00055 
00056 /**
00057  * reorganises a hierarchical structure consisting of SoTreeNode's and SoTreeLeaf's
00058  * into a botanical hierachical structure consisting of SoBotanicalBranch'es and 
00059  * SoBotanicalFruit's.
00060  *
00061  * This action is thus only responsible for determing the structure of the botanical 
00062  * tree and doesn't calculate any transformations of its elements.
00063 
00064 
00065   @ingroup bot
00066 */
00067 class BOTANIC_VIS_API SoBuildBotanicAction : public SoAction {
00068     SO_ACTION_HEADER(SoBuildBotanicAction);
00069 
00070 public:
00071 
00072     /**
00073      * inventor class initialisation
00074      */
00075     static void initClass();
00076 
00077     /** 
00078      * constructor
00079      */
00080     SoBuildBotanicAction();
00081     /**
00082      * destructor
00083      */
00084     virtual ~SoBuildBotanicAction();
00085 
00086     /**
00087      * returns the structure of the botanical tree
00088      */
00089     SoSeparator *getGeometry() const {return treeLayout; }
00090 
00091     /** 
00092      * sets the number of branching connections to num
00093      */
00094     void setNumBranches(int num) {numBranches = num;}
00095 
00096 protected:
00097 
00098     /**
00099      * is called before traversal of the scenegraph
00100      */
00101     virtual void beginTraversal(SoNode *node);
00102 
00103 private:
00104 
00105     /** function that is called for nodes that perform a default action behaviour
00106      * e.g.separators
00107      */
00108     static void callDoAction(SoAction *, SoNode *);
00109     /**
00110      * function that is called for nodes of type SoTreeNode
00111      */
00112     static void treeNodeAction(SoAction *, SoNode *);
00113     /**
00114      * function that is called for nodes of type SoTreeLeaf
00115      */
00116     static void treeLeafAction(SoAction *, SoNode *);
00117 
00118     /**
00119      * contains the new structure of the botanical tree
00120      */
00121     SoSeparator *treeLayout;
00122 
00123     /**
00124      * number of branching connections leaving one branch
00125      */
00126     int numBranches;
00127     /**
00128      * pointer to the branch where the next child should be added
00129      */
00130     SoBotanicalBranch *curBranch;
00131     /**
00132      * pointer to the node list of the branch where the next child should 
00133      * be added
00134      */
00135     SoNodeKitListPart *curBranchList;
00136     /**
00137      * if TRUE the current node that is traversed is the root node
00138      */
00139     bool first;
00140 
00141 };
00142 
00143 
00144 #ifdef WIN32
00145 #include <SoWinEnterScope.h>
00146 #endif
00147 
00148 #endif
 This page was generated at Sat Jun 26 21:29:46 2004 for BotanicVis by Doxygen.
 If you have any comments, please send a message to schmalstieg@ims.tuwien.ac.at.
www.studierstube.org