#ifndef _RandomViewCellsHandler_H__ #define _RandomViewCellsHandler_H__ #include "Containers.h" #include "SimpleRay.h" namespace GtpVisibilityPreprocessor { class ViewCell; class ViewCellsManager; typedef pair ViewCellPoints; typedef vector ViewCellPointsList; /** This class functions define a system to generate, export and import a list of random view cells and valid view points. */ class RandomViewCellsHandler { //friend class ViewCellsManager; public: RandomViewCellsHandler(ViewCellsManager *vcManager); ~RandomViewCellsHandler(); /** Exports list of random view cells. */ bool ExportRandomViewCells(const string &filename); /** Returns the stored list of view cells and view points. */ ViewCellPointsList *GetViewCellPointsList(); /** Load list of view cells using the current list of view points. */ bool ImportViewCellsList(const string &filename); protected: bool GenerateRandomViewCells(ViewCellContainer &viewCells, const int numViewCells); bool GenerateRandomViewCells(ViewCellPointsList &viewCells, const int nViewCells, const int nViewPoints); /** Generates a list of random view points in a view cells. @param viewCell the view cells @param numViewPoints the number of view points @param viewPoints returns view points in this container. */ bool GenerateViewPoints(ViewCell *viewCell, const int numViewPoints, SimpleRayContainer &viewPoints); /** Load list of view cells and view points. */ bool ImportViewCellsList(const string &filename, vector &viewCells); /** Exports list of random view cells and valid view points. */ bool ExportRandomViewCells(const string &filename, const vector &viewCells); /** Generates a new valid random view point. */ bool GenerateViewPoint(ViewCell *viewCell, SimpleRay &ray); /** Returns true if this view cell is in valid view space. */ bool IsValidViewSpace(ViewCell *vc); protected: ViewCellsManager *mViewCellsManager; ViewCellPointsList mViewCellPointsList; }; } #endif