GcpList.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 GCPLIST_H
00011 #define GCPLIST_H
00012 
00013 #include "AppConfig.h"
00014 #include "DataElement.h"
00015 #include "LocationType.h"
00016 
00017 #include <list>
00018 #include <string>
00019 
00020 /**
00021  *  A Ground Control Point (GCP)
00022  *
00023  *  The GcpPoint struct packages two LocationType objects (the reference and
00024  *  destination coordinates) with a name and root mean square (RMS) error.
00025  */
00026 class GcpPoint
00027 {
00028 public:
00029    /**
00030     *  Compares two GCPs.
00031     *
00032     *  @param   gcp
00033     *           The GCP to compare to this GCP.
00034     *
00035     *  @return  Returns \c true if the reference and destination coordinates and
00036     *           RMS error of this GCP are equal to that of \em gcp; otherwise
00037     *           returns \c false.
00038     */
00039    bool operator==(const GcpPoint& gcp) const
00040    {
00041       return (mPixel == gcp.mPixel) && (mCoordinate == gcp.mCoordinate) && (mRmsError == gcp.mRmsError);
00042    }
00043 
00044    /**
00045     *  Compares two GCPs.
00046     *
00047     *  @param   gcp
00048     *           The GCP to compare to this GCP.
00049     *
00050     *  @return  Returns \c true if the reference and destination coordinates and
00051     *           RMS error of this GCP are not equal to that of \em gcp;
00052     *           otherwise returns \c false.
00053     */
00054    bool operator!=(const GcpPoint& gcp) const
00055    {
00056       return !(*this == gcp);
00057    }
00058 
00059    LocationType mPixel;       /**< The reference coordinate of the GCP. */
00060    LocationType mCoordinate;  /**< The destination coordinate of the GCP. */
00061    LocationType mRmsError;    /**< The error computed during georeferencing. */
00062 };
00063 
00064 /**
00065  *  A list containing a set of GCPs.
00066  *
00067  *  The GcpList class stores a list of GcpPoint structs and allows for
00068  *  editing of the list and saving to disk. It is an abstract class
00069  *  providing the interface for this capability. The GcpList is used primarily
00070  *  for georeferencing.
00071  *
00072  *  This subclass of Subject will notify upon the following conditions:
00073  *  - The following methods are called: addPoints(), addPoint(),
00074  *    removePoints(), removePoint(), clearPoints().
00075  *  - Everything else documented in DataElement.
00076  */
00077 class GcpList : public DataElement
00078 {
00079 public:
00080    /**
00081     *  Emitted with any<GcpPoint> when a GCP is added to the list.
00082     */
00083    SIGNAL_METHOD(GcpList, PointAdded)
00084    /**
00085     *  Emitted with any<list<GcpPoint> > when GCPs are added to the list.
00086     */
00087    SIGNAL_METHOD(GcpList, PointsAdded)
00088    /**
00089     *  Emitted with any<GcpPoint> when a GCP is removed from the list.
00090     */
00091    SIGNAL_METHOD(GcpList, PointRemoved)
00092    /**
00093     *  Emitted with any<list<GcpPoint> > when GCPs are removed from the list.
00094     */
00095    SIGNAL_METHOD(GcpList, PointsRemoved)
00096    /**
00097     *  Emitted when the list is cleared.
00098     */
00099    SIGNAL_METHOD(GcpList, Cleared)
00100 
00101    /**
00102     *  Gets the list of GcpPoints the comprise the GcpList.
00103     *
00104     *  @return  Returns a reference to the internal list of GcpPoint
00105     *           structs.
00106     */
00107    virtual const std::list<GcpPoint>& getSelectedPoints() const = 0;
00108 
00109    /**
00110     *  Merges GcpPoints into the GcpList. The added points will be
00111     *  placed at the end of the list.
00112     *
00113     *  @param   points
00114     *           A list of GcpPoints to add to the GcpList.
00115     *
00116     *  @notify  This method will notify signalGcpsAdded with any<list<GcpPoint> >
00117     */
00118    virtual void addPoints(const std::list<GcpPoint>& points) = 0;
00119 
00120    /**
00121     *  Merges a GcpPoint into the GcpList. The added point will be
00122     *  placed at the end of the list.
00123     *
00124     *  @param   point
00125     *           A GcpPoint to add to the GcpList.
00126     *
00127     *  @notify  This method will notify signalGcpAdded with any<GcpPoint>
00128     */
00129    virtual void addPoint(const GcpPoint& point) = 0;
00130 
00131    /**
00132     *  Returns the number of GCPs in the list.
00133     *
00134     *  This method is equivalent to getSelectedPoints().size().
00135     *
00136     *  @return  The number of GCPs in the list.
00137     */
00138    virtual int getCount() const = 0;
00139 
00140    /**
00141     *  Removes GcpPoints from the GcpList.
00142     *
00143     *  %Any GcpPoints in the GcpList that are also in the list provided as 
00144     *  parameter will be removed from the GcpList.
00145     *
00146     *  @param   points
00147     *           A list of GcpPoints to remove from the GcpList
00148     *
00149     *  @notify  This method will notify signalGcpsRemoved with any<list<GcpPoint> >
00150     */
00151    virtual void removePoints(const std::list<GcpPoint>& points) = 0;
00152 
00153    /**
00154     *  Removes a GcpPoint from the GcpList. If the GcpPoint matches a point in
00155     *  the GcpList, it will be removed from the GcpList.
00156     *
00157     *  @param   point
00158     *           The GcpPoint to remove from the GcpList
00159     *
00160     *  @notify  This method will notify signalGcpRemoved with GcpPoint
00161     */
00162    virtual void removePoint(const GcpPoint& point) = 0;
00163 
00164    /**
00165     *  Removes all GcpPoints from the GcpList.
00166     *
00167     *  @notify  This method will notify signalCleared
00168     */
00169    virtual void clearPoints() = 0;
00170 
00171 protected:
00172    /**
00173     * This should be destroyed by calling ModelServices::destroyElement.
00174     */
00175    virtual ~GcpList() {}
00176 };
00177 
00178 #endif

Software Development Kit - Opticks 4.9.0 Build 16218