TreeSearch.h

00001 //---------------------------------------------------------------------------
00002 
00003 #ifndef TreeSearchH
00004 #define TreeSearchH
00005 //---------------------------------------------------------------------------
00006 
00007 #include "Tree.h"
00008 
00009 class clPlot;
00010 
00011 
00050 class clTreeSearch {
00051   friend class clTreePopulation;
00052   friend class clTestTreePopulation; 
00054   public:
00055 
00060   clTree* NextTree() {
00061     clTree *p_oReturnTree; //tree to return
00062     p_oReturnTree = mp_oCurrentTree;
00063     mp_oCurrentTree = (*this.*function)();
00064     return p_oReturnTree;
00065   };
00066 
00072   void StartOver();
00073 
00087   clTreeSearch(clTreePopulation* p_oTreePop, clPlot *p_oPlot);
00088 
00092   ~clTreeSearch();
00093 
00094   protected:
00096   clTreePopulation *mp_oTreePop;
00098   clPlot *mp_oPlot;
00099 
00101   clTree* (clTreeSearch::*function)();
00102 
00108   clTree* FindNextDHTree();
00109 
00115   clTree* FindNextTSTree();
00116 
00122   clTree* FindNextTTree();
00123 
00131   clTree* FindNextAllTree();
00132 
00139   clTree* FindFirstDHTree();
00140 
00147   clTree* FindFirstTSTree();
00148 
00155   clTree* FindFirstTTree();
00156 
00163   clTree* FindFirstAllTree();
00164 
00168   void Setup();
00169 
00170   clTree  *mp_oCurrentTree; 
00172   //Flags for what kinds of arguments were specified
00173   bool m_bDistanceHeightUsed;  
00174   bool m_bTypeUsed;            
00175   bool m_bSpeciesUsed;         
00176   bool m_bAllUsed;             
00179   //"All" parameters
00180   int m_iCurrentXGrid; 
00181   int m_iCurrentYGrid; 
00183   //Distance/height parameters
00184   float m_fFromX; 
00185   float m_fFromY; 
00186   float m_fDistanceCutoff; 
00188   float m_fHeightCutoff;  
00190   short int m_iMaxX; 
00191   short int m_iMaxY; 
00192   short int m_iMinX; 
00193   short int m_iMinY; 
00194   short int m_iHomeX; 
00195   short int m_iHomeY; 
00196   bool m_bCellOnEdge; 
00201   // Square search parameters
00202   //Re-use the following from distance/height search:
00203   //m_fFromX and m_fFromY, m_iMaxX, m_iMaxY, m_iMinX, m_iMinY, m_bCellOnEdge
00204   // float m_fToX, m_fToY; //XY coords of end of range
00205 
00206   //Type parameters
00207 
00208   short int m_iWhatTypes; 
00212   short int m_iStartHeightDiv; 
00214   short int m_iEndHeightDiv; 
00216   bool m_bSeeds; 
00217   bool m_bSeedlings; 
00218   bool m_bSaplings; 
00219   bool m_bAdults;
00220   bool m_bSnags; 
00221   bool m_bWoody_Debris;
00223   //Species parameters
00224   bool *mp_bWhatSpecies; 
00226 };
00227 
00228 /*///////////////////////////////////////////////////////////////////////////////
00229   A note on the storage of type information:
00230   The type information is stored in an int which are being treated as a boolean
00231   array.  The unsigned long int has 32 bits in it; each bit, starting with the
00232   rightmost, represents a boolean for whether or not that type is included.  So
00233   if types 1, 3, and 6 are to be used, the last 8 bits of the int would look
00234   like 00100101.
00235 
00236   To extract this information, bitwise shifts and bitwise operators will be
00237   used. More on this in the relevant code.
00239 
00240 #endif

Generated on Thu Jan 26 13:44:36 2006 for SORTIE Core C++ Documentation by  doxygen 1.4.6-NO