00001 00002 //! @file View.h 00003 //! Some Comment 00004 //! Some Comment 00005 //! @author ME 00006 00007 #ifndef Vis_View 00008 #define Vis_View 00009 00010 namespace Vis { class Matrix4x4; } 00011 namespace Vis { class View; } 00012 namespace Vis { class Viewport; } 00013 namespace Vis { class ViewData; } 00014 namespace Vis { class ViewEvent; } 00015 00016 #include <boost/signal.hpp> // connections 00017 #include <Visualization/Matrix.h> // member 00018 #include <Visualization/Types.h> // OriginID 00019 00020 //! View is the abstract interface that all views must adhere to. The 00021 //! interface for this class should be kept lightweight so as not to penalize 00022 //! children classes with pointless implementation or unusued memory. 00023 //! This class plays the role of the "Component" in the decorator pattern. 00024 //! This class also plays the role of the prototype in the prototype pattern 00025 //! and has cloning functionality. 00026 //! @ingroup framework 00027 //! @see GoF-Decorator, GoF-Prototype 00028 class Vis::View 00029 { 00030 public: // Members 00031 00032 //! @name Constructors / Conversions / Destructors 00033 //@{ 00034 00035 //! Default constructor initializing members 00036 View(void); 00037 00038 //! Virtual destructor to aid in polymorphism 00039 //! Any event locks performed by the view will be 00040 //! removed prior to deletion. 00041 virtual ~View(void); 00042 00043 //@} 00044 00045 //! @name Abstract Interface 00046 //@{ 00047 00048 //! Construct a clone of this object and return it. 00049 //! Clones will share their rendered data pointer, but 00050 //! not their children or other data. 00051 //! @return An auto_ptr to the newly allocated View. This object is 00052 //! owned by the caller, and will not be managed by the cloning class. 00053 virtual std::auto_ptr<View> clone(void) const; 00054 00055 //! Access the bottom node of a view chain. This is the node 00056 //! that provides the overall context for the view. 00057 //! @return A reference to the bottommost node of the current view. 00058 virtual const View& root(void) const; 00059 00060 //! @return number of layers in the view 00061 virtual const int size(void) const; 00062 00063 //! @return viewport for this view 00064 virtual const Viewport& viewport(void) const; 00065 00066 //! Changes the position of the viewport 00067 //! @param x - desired x position (pixels) of lower left corner 00068 //! @param y - desired y position (pixels) of lower left corner 00069 //! @see Viewport::reposition() 00070 virtual void reposition(const int x, const int y); 00071 00072 //! Changes the size of the viewport 00073 //! @param width - desired width of the viewport 00074 //! @param height - desired height of the viewport 00075 //! @see Viewport::resize() 00076 virtual void resize(const unsigned int width, const unsigned int height); 00077 00078 //! Flip the view in the provided direction(s) 00079 //! @param x - if true, flip the view in the x direction 00080 //! @param y - if true, flip the view in the y direction 00081 virtual void flip(const bool x, const bool y); 00082 00083 //! Rotate the view CCW by the given angle 00084 //! @param angle - angle in degrees to rotate the view 00085 virtual void rotate(const float angle); 00086 00087 //! Scale the view by the given constant 00088 //! @param scale - constant by which the view should be multiplied 00089 virtual void zoom(const float scale); 00090 00091 //! Shift the view in the x and y directions 00092 //! @param x - desired shift in the x direction (pixels) 00093 //! @param y - desired shift in the y direction (pixels) 00094 virtual void shift(const float x, const float y); 00095 00096 //! Reset the view manipulation xform to the identity 00097 virtual void home(void); 00098 00099 //@} 00100 }; 00101 00102 #endif // Vis_View