PointSet.h

Go to the documentation of this file.
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 #ifndef POINTSET_H
00011 #define POINTSET_H
00012 
00013 #include "ColorType.h"
00014 #include "LocationType.h"
00015 #include "PlotObject.h"
00016 #include "TypesFile.h"
00017 
00018 class Point;
00019 
00020 #include <vector>
00021 
00022 /**
00023  *  A set of points.
00024  *
00025  *  This subclass of Subject will notify upon the following conditions:
00026  *  - The following methods are called: insertPoint(), setPoints(),
00027  *    removePoint(), setLineColor(), setLineWidth(), setLineStyle().
00028  *  - Everything else documented in PlotObject.
00029  *
00030  *  @see     PlotObject
00031  */
00032 class PointSet : public PlotObject
00033 {
00034 public:
00035    /**
00036     *  Emitted with any<Point*> when a point is added to the %PointSet.
00037     */
00038    SIGNAL_METHOD(PointSet, PointAdded)
00039    /**
00040     *  Emitted with any<vector<Point*> > when the PointSet's points are replaced.
00041     */
00042    SIGNAL_METHOD(PointSet, PointsSet)
00043 
00044    /**
00045     *  Creates an empty Point plot object and adds it to the pointset
00046     *  
00047     *  @return  The newly created Point
00048     *
00049     *  @notify  This method will notify signalPointAdded with any<Point*>.
00050     */
00051    virtual Point* addPoint() = 0;
00052    
00053    /**
00054     *  Creates a Point plot object and adds it to the pointset
00055     *  
00056     *  @param dX  The points x value
00057     *  @param dY  The points y value
00058     *  @return  The newly created point
00059     *
00060     *  @notify  This method will notify signalPointAdded with any<Point*>.
00061     */
00062    virtual Point* addPoint(double dX, double dY) = 0;
00063    
00064    /**
00065     *  Inserts an existing Point plot object into the pointset
00066     *  
00067     *  @param pPoint  The point to insert
00068     *  @return  True if successfully inserted, false otherwise
00069     *
00070     *  @notify  This method will notify signalPointAdded with any<Point*>.
00071     */
00072    virtual bool insertPoint(Point* pPoint) = 0;
00073    
00074    /**
00075     *  Inserts a vector of existing Point plot objects into the pointset, replacing
00076     *  any existing points.  The existing points are removed but not destroyed.
00077     *  
00078     *  @param points  The new list of points
00079     *
00080     *  @notify  This method will notify signalPointsSet with any<vector<Point*> >.
00081     */
00082    virtual void setPoints(const std::vector<Point*>& points) = 0;
00083    
00084    /**
00085     *  Returns the list of points in the pointset
00086     *  
00087     *  @return  The list of points
00088     */
00089    virtual std::vector<Point*> getPoints() const = 0;
00090    
00091    /**
00092     *  Returns the number of points in the pointset
00093     *  
00094     *  @return  The number of points in the pointset
00095     */
00096    virtual unsigned int getNumPoints() const = 0;
00097    
00098    /**
00099     *  Checks the pointsets list of points for the point object.
00100     *  
00101     *  @param pPoint  The point to look for
00102     *  @return  True if the pointset contains this point, false otherwise.
00103     */
00104    virtual bool hasPoint(Point* pPoint) const = 0;
00105    
00106    /**
00107     *  Removes the point from the pointset
00108     *  
00109     *  @param pPoint  The point to remove
00110     *  @param bDelete  True - deletes the point upon removal, False - just removes the point
00111     *  @return  True if the point was removed, false otherwise
00112     *
00113     *  @notify  This method will notify Subject::signalModified.
00114     */
00115    virtual bool removePoint(Point* pPoint, bool bDelete) = 0;
00116    
00117    /**
00118     *  Clears the list of points from the pointset
00119     *  
00120     *  @param bDelete  True - deletes the points upon removal, False - just removes the points
00121     *
00122     *  @notify  This method will notify signalPointsSet with any<vector<Point*> > with the vector empty.
00123     */
00124    virtual void clear(bool bDelete) = 0;
00125 
00126    // Symbols
00127 
00128    /**
00129     *  Checks to see if the symbols are displayed
00130     *  
00131     *  @return  True if the symbols are displayed, false otherwise
00132     */
00133    virtual bool areSymbolsDisplayed() const = 0;
00134 
00135    /**
00136     *  Sets the symbol display attribute
00137     *  
00138     *  @param bDisplay  True displays the symbols, false turns the display off
00139     */
00140    virtual void displaySymbols(bool bDisplay) = 0;
00141 
00142    // Line
00143 
00144    /**
00145     *  Returns the state of the line display property
00146     *  
00147     *  @return  True if lines are displayed, false if they are not
00148     */
00149    virtual bool isLineDisplayed() const = 0;
00150 
00151    /**
00152     *  Returns the line color
00153     *  
00154     *  @return  The line color
00155     */
00156    virtual ColorType getLineColor() const = 0;
00157 
00158    /**
00159     *  Returns the line width
00160     *  
00161     *  @return  The line width
00162     */
00163    virtual int getLineWidth() const = 0;
00164 
00165    /**
00166     *  Returns the line style
00167     *  
00168     *  @return  The line style
00169     *
00170     *  @see LineStyle
00171     */
00172    virtual LineStyle getLineStyle() const = 0;
00173 
00174    /**
00175     *  Sets the line display property
00176     *  
00177     *  @param bDisplay  True - display lines, False - do not display lines
00178     */
00179    virtual void displayLine(bool bDisplay) = 0;
00180 
00181    /**
00182     *  Determines if this plot object resides at this point, most likely a mouse click
00183     *
00184     *  @param point  The location of the mouse click
00185     *  @return       The Point object if the plot object is at this point
00186     */
00187    virtual Point* hitPoint(LocationType point) const = 0;
00188 
00189    /**
00190     *  Determines if this plot object resides at this point, most likely a mouse click
00191     *
00192     *  @param point  The location of the mouse click
00193     *  @return       True if the plot object is at this point
00194     */
00195    virtual bool hit(LocationType point) const = 0;
00196 
00197    /**
00198     *  Returns the extents of the pointset.  (Its bounds)
00199     *  
00200     *  @param dMinX  The minimum x value
00201     *  @param dMinY  The minimum y value
00202     *  @param dMaxX  The maximum x value
00203     *  @param dMaxY  The maximum y value
00204     *  @return 
00205     */
00206    virtual bool getExtents(double& dMinX, double& dMinY, double& dMaxX, double& dMaxY) = 0;
00207 
00208    /**
00209     *  Sets the line color
00210     *  
00211     *  @param clrLine  The new line color
00212     *
00213     *  @notify  This method will notify Subject::signalModified.
00214     */
00215    virtual void setLineColor(const ColorType& clrLine) = 0;
00216 
00217    /**
00218     *  Sets the line width
00219     *  
00220     *  @param iWidth  The new line width
00221     *
00222     *  @notify  This method will notify Subject::signalModified.
00223     */
00224    virtual void setLineWidth(int iWidth) = 0;
00225 
00226    /**
00227     *  Sets the line style
00228     *  
00229     *  @param eStyle  The new line style
00230     *
00231     *  @see LineStyle
00232     *
00233     *  @notify  This method will notify Subject::signalModified.
00234     */
00235    virtual void setLineStyle(const LineStyle& eStyle) = 0;
00236 
00237    /**
00238     * Set the current interactivity state.
00239     *
00240     * Setting this to false will cause the PointSet to delay
00241     * processing until set to interactive again.  This is useful
00242     * when making a large number of changes to the PointSet.
00243     *
00244     * @param interactive
00245     *        The new interactive state.
00246     *
00247     * @see setInteractive
00248     */
00249    virtual void setInteractive(bool interactive) = 0;
00250 
00251    /**
00252     * Get the current interactivity state.
00253     *
00254     * @return The current interactivity state.
00255     *
00256     * @see getInteractive
00257     */
00258    virtual bool getInteractive() = 0;
00259 
00260 protected:
00261    /**
00262     * This should be destroyed by calling PlotView::deleteObject.
00263     */
00264    virtual ~PointSet() {}
00265 };
00266 
00267 #endif

Software Development Kit - Opticks 4.9.0 Build 16218