00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 00011 00012 #ifndef PLOTGROUP_H 00013 #define PLOTGROUP_H 00014 00015 #include "LocationType.h" 00016 #include "PlotObject.h" 00017 00018 #include <vector> 00019 00020 /** 00021 * A set of plotobjects. 00022 * 00023 * This subclass of Subject will notify upon the following conditions: 00024 * - The following methods are called: insertObject(), removeObject(), 00025 * addObject(), insertObjects(). 00026 * - Everything else documented in PlotObject. 00027 * 00028 * @see PlotObject 00029 */ 00030 class PlotGroup : public PlotObject 00031 { 00032 public: 00033 /** 00034 * Emitted with any<PlotObject*> when an object is added to the group. 00035 */ 00036 SIGNAL_METHOD(PlotGroup, ObjectAdded) 00037 00038 /** 00039 * Creates a new plot object of type PlotObjectType and adds it 00040 * to the PlotGroup 00041 * 00042 * @param eType The PlotObjectType 00043 * @return A pointer to the plot object 00044 * 00045 * @notify This method will notify signalObjectAdded with any(PlotObject*>. 00046 */ 00047 virtual PlotObject* addObject(const PlotObjectType& eType) = 0; 00048 00049 /** 00050 * Inserts a vector of plot objects into the plot group 00051 * 00052 * @param objects The vector of plot objects 00053 * 00054 * @notify This method will notify signalObjectAdded with any(PlotObject*>. 00055 */ 00056 virtual void insertObjects(const std::vector<PlotObject*>& objects) = 0; 00057 00058 /** 00059 * Checks to see if the provide plot object is in this plot group 00060 * 00061 * @param pObject The plot object to look for 00062 * 00063 * @return True if the plot object is in this plot group, false otherwise. 00064 */ 00065 virtual bool hasObject(PlotObject* pObject) const = 0; 00066 00067 /** 00068 * Retrieves a vector of plot objects from the plot group 00069 * 00070 * @return A vector of plot objects 00071 */ 00072 virtual const std::vector<PlotObject*>& getObjects() const = 0; 00073 00074 /** 00075 * Returns the number of plot objects in the plot group 00076 * 00077 * @return The number of plot objects 00078 */ 00079 virtual unsigned int getNumObjects() const = 0; 00080 00081 /** 00082 * Determines if a plot object resides at this point, most likely a mouse click 00083 * 00084 * @param point The location of the mouse click 00085 * 00086 * @return The object that was hit, NULL otherwise. 00087 */ 00088 virtual PlotObject* hitObject(LocationType point) const = 0; 00089 00090 /** 00091 * Determines if a plot object within this plot group resides at this point, most likely a mouse click 00092 * 00093 * @param point The location of the mouse click 00094 * 00095 * @return True if a plot object is at this point 00096 */ 00097 virtual bool hit(LocationType point) const = 0; 00098 00099 /** 00100 * Sets the plot groups visibility 00101 * 00102 * @param bVisible True - visible, False - not visible 00103 */ 00104 virtual void setVisible(bool bVisible) = 0; 00105 00106 /** 00107 * Sets the plot groups selected property 00108 * 00109 * @param bSelect True - selected, False - not selected 00110 */ 00111 virtual void setSelected(bool bSelect) = 0; 00112 00113 /** 00114 * Inserts an existing plot object into the plot group 00115 * 00116 * @param pObject Pointer to a plot object 00117 * 00118 * @return True if successfully inserted, false otherwise 00119 * 00120 * @notify This method will notify signalObjectAdded with any(PlotObject*>. 00121 */ 00122 virtual bool insertObject(PlotObject* pObject) = 0; 00123 00124 /** 00125 * Removes a plot object from the plot group 00126 * 00127 * @param pObject The plot object to remove 00128 * @param bDelete True - deletes the object upon removal, False - just removes the plot object 00129 * @return True if the removal was successfule, false otherwise. 00130 * 00131 * @notify This method will notify Subject::signalModified. 00132 */ 00133 virtual bool removeObject(PlotObject* pObject, bool bDelete = false) = 0; 00134 00135 /** 00136 * Clears the plot groups plot objects 00137 * 00138 * @param bDelete True - deletes all the plot objects, false - Just removes the plot objects 00139 */ 00140 virtual void clear(bool bDelete = false) = 0; 00141 00142 protected: 00143 /** 00144 * This should be destroyed by calling PlotView::deleteObject. 00145 */ 00146 virtual ~PlotGroup() {} 00147 }; 00148 00149 #endif