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 PLOTOBJECT_H 00013 #define PLOTOBJECT_H 00014 00015 #include "Subject.h" 00016 #include "TypesFile.h" 00017 00018 #include <string> 00019 00020 /** 00021 * The base class for all objects displayed on a plot. 00022 * 00023 * This class contains properties for plot objects that are common to all objects. 00024 * Each object has a name, type, display state, primary or secondary state, selection 00025 * state, and coordinate extents. 00026 * 00027 * This subclass of Subject will notify upon the following conditions: 00028 * - The following methods are called: setObjectName(), setVisible(), 00029 * setSelected(). 00030 * - Everything else documented in Subject. 00031 * 00032 * @see PlotView 00033 */ 00034 class PlotObject : public Subject 00035 { 00036 public: 00037 /** 00038 * Emitted with any<std::string> when the object is renamed. 00039 */ 00040 SIGNAL_METHOD(PlotObject, Renamed) 00041 /** 00042 * Emitted with any<bool> when the object is shown or hidden. 00043 */ 00044 SIGNAL_METHOD(PlotObject, VisibilityChanged) 00045 /** 00046 * Emitted with any<bool> when the object is selected or deselected. 00047 */ 00048 SIGNAL_METHOD(PlotObject, Selected) 00049 00050 /** 00051 * Sets the object name. 00052 * 00053 * @param objectName 00054 * The new object name. Cannot be empty. 00055 * 00056 * @notify This method will notify signalRenamed with any<std::string>. 00057 */ 00058 virtual void setObjectName(const std::string& objectName) = 0; 00059 00060 /** 00061 * Retrieves the object name. 00062 * 00063 * @param objectName 00064 * A string that is populated with the object name. 00065 */ 00066 virtual void getObjectName(std::string& objectName) const = 0; 00067 00068 /** 00069 * Returns the specific object type. 00070 * 00071 * @return The object type. 00072 * 00073 * @see PlotObjectType 00074 */ 00075 virtual PlotObjectType getType() const = 0; 00076 00077 /** 00078 * Toggles the display of the object on the plot. 00079 * 00080 * @param bVisible 00081 * Set this value to TRUE to show the object or FALSE to hide the object. 00082 * 00083 * @notify This method will notify signalVisibilityChanged with any<bool>. 00084 */ 00085 virtual void setVisible(bool bVisible) = 0; 00086 00087 /** 00088 * Queries whether the object is currently displayed on the plot. 00089 * 00090 * @return TRUE if the object is displayed or FALSE if the object is hidden. 00091 */ 00092 virtual bool isVisible() const = 0; 00093 00094 /** 00095 * Queries whether the object is a primary object on the plot. 00096 * 00097 * A primary plot object is one that appears in the foreground of the plot and 00098 * has an entry in the legend. Most objects added to a plot will be primary objects, 00099 * but objects such as gridlines can be created as secondary objects since they are 00100 * not the main focus of the plot data. 00101 * 00102 * @return TRUE if the object is a primary object or FALSE if the object is a 00103 * secondary object. 00104 * 00105 * @see PlotView::addObject() 00106 */ 00107 virtual bool isPrimary() const = 0; 00108 00109 /** 00110 * Sets the selection state of the object. 00111 * 00112 * This method sets the plot object as selected and may alter how the object is drawn 00113 * in the plot. This is done mainly for user feedback that the object is selected. 00114 * For some objects, like the histogram, selecting the object does nothing. 00115 * 00116 * @param bSelect 00117 * Set this value to TRUE to select the object or FALSE to deselect the 00118 * object. 00119 * 00120 * @notify This method will notify signalSelected with any<bool>. 00121 */ 00122 virtual void setSelected(bool bSelect) = 0; 00123 00124 /** 00125 * Queries whether the object is currently selected. 00126 * 00127 * @return TRUE if the object is selected or FALSE if the object is not selected. 00128 * 00129 * @see setSelected() 00130 */ 00131 virtual bool isSelected() const = 0; 00132 00133 /** 00134 * Retrieves the bounding box of the object. 00135 * 00136 * This method retrieves the minimum and maximum coordinates of the object at its 00137 * current location in the plot. These are provided as world coordinates. 00138 * 00139 * @param dMinX 00140 * Populated with the minimum x-coordinate of the object. 00141 * @param dMinY 00142 * Populated with the minimum y-coordinate of the object. 00143 * @param dMaxX 00144 * Populated with the maximum x-coordinate of the object. 00145 * @param dMaxY 00146 * Populated with the maximum y-coordinate of the object. 00147 * 00148 * @return TRUE if the coordinate extents were successfully populated, otherwise 00149 * FALSE. 00150 */ 00151 virtual bool getExtents(double& dMinX, double& dMinY, double& dMaxX, double& dMaxY) = 0; 00152 00153 protected: 00154 /** 00155 * This should be destroyed by calling PlotView::deleteObject. 00156 */ 00157 virtual ~PlotObject() {} 00158 }; 00159 00160 #endif