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 GEOREFERENCE_H 00011 #define GEOREFERENCE_H 00012 00013 #include "ConfigurationSettings.h" 00014 #include "LocationType.h" 00015 00016 #include <string> 00017 #include <vector> 00018 00019 class QWidget; 00020 class RasterElement; 00021 00022 /** 00023 * Interface specific to georeference plug-ins. 00024 * 00025 * Defines the georeference specific interface to all algorithm plug-ins. 00026 * This interface contains all georeference specific operations. 00027 * 00028 * For Georeference plug-ins to properly serialize and deserialize as part of 00029 * a session, they need to implement SessionItem::serialize and 00030 * SessionItem::deserialize. 00031 */ 00032 class Georeference 00033 { 00034 public: 00035 SETTING(AutoGeoreference, Georeference, bool, true) 00036 SETTING(ImporterGeoreferencePlugIn, Georeference, bool, true) 00037 SETTING(GeoreferencePlugIns, Georeference, std::vector<std::string>, std::vector<std::string>()) 00038 SETTING(CreateLatLonLayer, Georeference, bool, true) 00039 SETTING(DisplayLatLonLayer, Georeference, bool, false) 00040 SETTING(GeocoordType, Georeference, GeocoordType, GEOCOORD_LATLON) 00041 SETTING(LatLonFormat, Georeference, DmsFormatType, DMS_FULL) 00042 00043 /** 00044 * The name for a GcpList argument. 00045 * 00046 * Input arguments with this name will be automatically populated with a 00047 * GcpList pointer when the plug-in is executed as part of the 00048 * auto-georeferencing capability of RasterElementImporterShell. Arguments 00049 * with this name should be of the type GcpList. 00050 */ 00051 static std::string GcpListArg() 00052 { 00053 return std::string("GCP List"); 00054 } 00055 00056 /** 00057 * Takes a scene pixel coordinate and returns the corresponding 00058 * geocoordinate value. 00059 * 00060 * @param pixel 00061 * The scene pixel location as a LocationType 00062 * @param pAccurate 00063 * Output indicator of conversion accuracy. Georeference plug-ins that 00064 * can not accurately extrapolate should return \c false when \c pixel is 00065 * outside the extents of the reference points. When \c NULL, no accuracy 00066 * check is performed. 00067 * 00068 * @return The corresponding geocoordinate as a LocationType. 00069 */ 00070 virtual LocationType pixelToGeo(LocationType pixel, bool* pAccurate = NULL) const = 0; 00071 00072 /** 00073 * Takes a scene pixel coordinate and returns the approximate corresponding 00074 * geocoordinate value. This function will accomplish the goal faster 00075 * than pixelToGeo() if possible. 00076 * 00077 * @param pixel 00078 * The scene pixel location as a LocationType 00079 * @param pAccurate 00080 * Output indicator of conversion accuracy. Georeference plug-ins that 00081 * can not accurately extrapolate should return \c false when \c pixel is 00082 * outside the extents of the reference points. When \c NULL, no accuracy 00083 * check is performed. 00084 * 00085 * @return The corresponding geocoordinate as a LocationType. 00086 */ 00087 virtual LocationType pixelToGeoQuick(LocationType pixel, bool* pAccurate = NULL) const = 0; 00088 00089 /** 00090 * Takes a geocoordinate and returns the corresponding pixel 00091 * coordinate value. 00092 * 00093 * @param geo 00094 * The geocoordinate as a LocationType 00095 * @param pAccurate 00096 * Output indicator of conversion accuracy. Georeference plug-ins that 00097 * can not accurately extrapolate should return \c false when \c geo is 00098 * outside the extents of the reference points. When \c NULL, no accuracy 00099 * check is performed. 00100 * 00101 * @return The corresponding pixel as a LocationType. 00102 */ 00103 virtual LocationType geoToPixel(LocationType geo, bool* pAccurate = NULL) const = 0; 00104 00105 /** 00106 * Takes a and returns the approximate corresponding geocoordinate 00107 * scene pixel coordinate value. This function will accomplish the goal faster 00108 * than pixelToGeo() if possible. 00109 * 00110 * @param geo 00111 * The geocoordinate location as a LocationType 00112 * @param pAccurate 00113 * Output indicator of conversion accuracy. Georeference plug-ins that 00114 * can not accurately extrapolate should return \c false when \c geo is 00115 * outside the extents of the reference points. When \c NULL, no accuracy 00116 * check is performed. 00117 * 00118 * @return The corresponding pixel as a LocationType. 00119 */ 00120 virtual LocationType geoToPixelQuick(LocationType geo, bool* pAccurate = NULL) const = 0; 00121 00122 /** 00123 * Gets a QWidget to set all parameters needed by the georeferencing algorithm. 00124 * 00125 * The calling method takes ownership of the returned widget. The returned widget 00126 * may be destroyed at any time after calling Executable::execute() on the plug-in. 00127 * 00128 * @param pRaster 00129 * The RasterElement to create the GUI for. 00130 * 00131 * @return The widget with any appropriate controls, or \b NULL if interactive mode 00132 * is not supported or no controls are needed. 00133 */ 00134 virtual QWidget* getGui(RasterElement* pRaster) = 0; 00135 00136 /** 00137 * Determines if the user input through the GUI is valid. 00138 * 00139 * @return Returns \b true if the input is valid, otherwise returns 00140 * \b false. 00141 * 00142 * @see getGui() 00143 */ 00144 virtual bool validateGuiInput() const = 0; 00145 00146 /** 00147 * Determine if this georeferencing algorithm can be used for the given 00148 * RasterElement. 00149 * 00150 * @param pRaster 00151 * The RasterElement to test. 00152 * @return \c true if the plugin can handle the RasterElement, \c false otherwise 00153 */ 00154 virtual bool canHandleRasterElement(RasterElement *pRaster) const = 0; 00155 00156 protected: 00157 /** 00158 * Since the Georeference interface is usually used in conjunction with the 00159 * PlugIn and Executable interfaces, this should be destroyed by casting to 00160 * the PlugIn interface and calling PlugInManagerServices::destroyPlugIn(). 00161 */ 00162 virtual ~Georeference() {} 00163 }; 00164 00165 #endif