SoBotanicalBase.h
Go to the documentation of this file.00001 /* ======================================================================== 00002 * Copyright (C) 2000 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: Studierstube 00024 * ======================================================================== */ 00025 00026 /* ======================================================================= */ 00027 /** Header file for API definitions of SoBotanicalBase 00028 * 00029 * @author Valerie Maquil 00030 * 00031 * $Header: 00032 * @file */ 00033 /* ======================================================================= */ 00034 00035 00036 00037 #ifndef SoBotanicalBase_H 00038 #define SoBotanicalBase_H 00039 00040 #ifdef _WIN32 00041 #include <SoWinEnterScope.h> 00042 #endif 00043 00044 #include <Inventor/nodekits/SoBaseKit.h> 00045 #include <Inventor/fields/SoSFFloat.h> 00046 #include <Inventor/fields/SoSFInt32.h> 00047 #include <Inventor/sensors/SoFieldSensor.h> 00048 00049 #ifdef _WIN32 00050 #include <SoWinLeaveScope.h> 00051 #endif 00052 00053 #include "BotanicVis.h" 00054 #include <string> 00055 #include <stdlib.h> 00056 #include <iostream> 00057 00058 00059 /** 00060 * base class for all elements of a botanical tree 00061 00062 CATALOG PARTS 00063 00064 All Parts 00065 <table> 00066 <tr> <td>Part Name</td><td>Part Type</td><td>Default Type</td><td>NULL Default</td></tr> 00067 <tr> <td>geometry </td><td>SoSeparator</td><td>SoSeparator</td><td>YES</td></tr> 00068 </table> 00069 00070 00071 00072 File Format / defaults: 00073 00074 @verbatim 00075 SoBotanicalBase { 00076 SoSFInt32 strands 0 00077 SoSFFloat lengthOfBranch 10.0 00078 } 00079 @endverbatim 00080 00081 00082 @ingroup bot 00083 */ 00084 class BOTANIC_VIS_API SoBotanicalBase : public SoBaseKit 00085 { 00086 SO_KIT_HEADER(SoBotanicBase); 00087 /** 00088 * contains the geometry of this element of the botanical tree 00089 */ 00090 SO_KIT_CATALOG_ENTRY_HEADER(geometry); 00091 00092 00093 public: 00094 /** 00095 * this field specifies the height of the cylinders representing the branches 00096 */ 00097 SoSFFloat lengthOfBranch; 00098 /** 00099 * in this field the number of strands of this element is stored. The number of strands 00100 * of one botanical branch equals the sum of strands of its subbranches. The number 00101 * of strands of a fruit depends on the size of the leafs represented by this fruit 00102 */ 00103 SoSFInt32 strands; 00104 00105 /** 00106 *Inventor class initialization 00107 */ 00108 static void initClass(); 00109 /** 00110 * constructor 00111 */ 00112 SoBotanicalBase(); 00113 00114 /** 00115 * sets the connections of the sensors 00116 */ 00117 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE ); 00118 00119 protected: 00120 /** 00121 * destructor 00122 */ 00123 virtual ~SoBotanicalBase(); 00124 00125 /** 00126 * sensor attached to the field "lengthOfBranches" 00127 */ 00128 SoFieldSensor lengthOfBranchSensor; 00129 /** 00130 * calls resizeHeightCB() 00131 */ 00132 static void lengthOfBranchCB(void *, SoSensor*); 00133 virtual void resizeHeightCB() {};///< does nothing 00134 00135 /** 00136 * sensor attached to the field "strands" 00137 */ 00138 SoFieldSensor strandsSensor; 00139 /** 00140 * calls strandsCB() 00141 */ 00142 static void strandsCB(void *, SoSensor*); 00143 virtual void resizeThicknessCB() {};///< does nothing 00144 00145 00146 }; 00147 00148 //---------------------------------------------------------------------------- 00149 00150 #endif