SoBotanicalFruit.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 SoBotanicalFruit 00028 * 00029 * @author Valerie Maquil 00030 * 00031 * $Header: 00032 * @file */ 00033 /* ======================================================================= */ 00034 00035 00036 00037 #ifndef SoBotanicalFruit_H 00038 #define SoBotanicalFruit_H 00039 00040 #include "SoBotanicalBase.h" 00041 #include <Inventor/sensors/SoNodeSensor.h> 00042 00043 #include <string> 00044 00045 00046 /** 00047 * implements a fruit of a botanical tree. Each fruit is represented by a SoSphere 00048 * with variable radius and colour. A fruit corresponds to one or more SoTreeLeaf's 00049 * where the radius is commuted by adding up the sizes of the SoTreeLeaf's. 00050 00051 CATALOG PARTS 00052 00053 All Parts 00054 <table> 00055 <tr> <td>Part Name</td><td>Part Type</td><td>Default Type</td><td>NULL Default</td></tr> 00056 <tr> <td>translation </td><td>SoTranslation</td><td>SoTranslation</td><td>NO</td></tr> 00057 <tr> <td>color </td><td>SoMaterial</td><td>SoMaterial</td><td>NO</td></tr> 00058 <tr> <td>fruit </td><td>SoSphere</td><td>SoSphere</td><td>NO</td></tr> 00059 <tr> <td>data </td><td>SoNodeKitListPart</td><td>---</td><td>NO</td></tr> 00060 </table> 00061 00062 Extra Information for List Parts from Above Table 00063 00064 <table> 00065 <tr> <td>Part Name</td><td>Container Type</td><td>Possible Types</td></tr> 00066 <tr> <td>data</td><td>SoGroup</td><td>SoTreeLeaf</td></tr> 00067 </table> 00068 00069 File Format / defaults: 00070 00071 @verbatim 00072 SoBotanicalFruit { 00073 00074 # from SoBotanicalBase 00075 SoSFInt32 strands 0 00076 SoSFFloat lengthOfBranch 10.0 00077 00078 } 00079 @endverbatim 00080 00081 00082 @ingroup bot 00083 */ 00084 class BOTANIC_VIS_API SoBotanicalFruit : public SoBotanicalBase 00085 { 00086 SO_KIT_HEADER(SoBotanicalFruit); 00087 /** 00088 * colour of the fruit 00089 */ 00090 SO_KIT_CATALOG_ENTRY_HEADER(color); 00091 /** 00092 * SoSphere representing the fruit 00093 */ 00094 SO_KIT_CATALOG_ENTRY_HEADER(fruit); 00095 /** 00096 * list of the SoTreeLeaf's represented by this fruit 00097 */ 00098 SO_KIT_CATALOG_ENTRY_HEADER(data); 00099 00100 00101 00102 public: 00103 /** 00104 * inventor class initialization 00105 */ 00106 static void initClass(); 00107 /** 00108 * constructor 00109 */ 00110 SoBotanicalFruit(); 00111 00112 /** 00113 * sets the connections of the sensors 00114 */ 00115 virtual SbBool setUpConnections( SbBool onOff, SbBool doItAlways = FALSE ); 00116 00117 /** 00118 * returns the size of this fruit 00119 */ 00120 float getSize() {return size;}; 00121 00122 protected: 00123 /** 00124 * destructor 00125 */ 00126 virtual ~SoBotanicalFruit(); 00127 00128 00129 virtual void resizeHeightCB(); 00130 virtual void resizeThicknessCB(); 00131 00132 SoNodeSensor dataSensor; 00133 /** 00134 * adapts the geometry of the fruit using the information stored in "data" 00135 */ 00136 static void dataSensorCB(void *data, SoSensor *sen); 00137 00138 /** 00139 * size of this fruit. Corresponds to a logarithmic value of the sum of the 00140 * sizes of the leaves represented by this fruit 00141 */ 00142 float size; 00143 00144 00145 00146 }; 00147 00148 //---------------------------------------------------------------------------- 00149 00150 #endif