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 LATLONLAYER_H 00011 #define LATLONLAYER_H 00012 00013 #include "ColorType.h" 00014 #include "ConfigurationSettings.h" 00015 #include "Layer.h" 00016 #include "LocationType.h" 00017 #include "TypesFile.h" 00018 00019 #include <string> 00020 00021 class Font; 00022 00023 /** 00024 * Adjusts the properties of a latitude/longitude layer. 00025 * 00026 * A latitude/longitude layer consists of gridlines marking the location of equal 00027 * latitude and equal longitude values. The gridlines have four properties: color, 00028 * style, width and tick spacing. This class also contains a flag where the tick spacing 00029 * will be automatically calculated for the current layer. This class provides the 00030 * means to set the properties for the current lat/long layer and also the default 00031 * properties for new lat/long layers. 00032 * 00033 * This subclass of Subject will notify upon the following conditions: 00034 * - The following methods are called: setLatLonFormat(), setColor(), 00035 * setFont(), setStyle(), setWidth(), setTickSpacing(), 00036 * setAutoTickSpacing(), setGeocoordType(), 00037 * - Everything else documented in Layer. 00038 * 00039 * @see Layer 00040 */ 00041 class LatLonLayer : public Layer 00042 { 00043 public: 00044 SETTING(Font, LatLonLayer, std::string, "") 00045 SETTING(FontSize, LatLonLayer, unsigned int, 8) 00046 SETTING(GridlineColor, LatLonLayer, ColorType, ColorType()) 00047 SETTING(GridlineStyle, LatLonLayer, LatLonStyle, LATLONSTYLE_SOLID) 00048 SETTING(GridlineWidth, LatLonLayer, unsigned int, 0) 00049 00050 /** 00051 * Emitted with any<DmsFormatType> when the numeric format changes. 00052 */ 00053 SIGNAL_METHOD(LatLonLayer, FormatChanged) 00054 /** 00055 * Emitted with any<ColorType> when the grid color changes. 00056 */ 00057 SIGNAL_METHOD(LatLonLayer, ColorChanged) 00058 /** 00059 * Emitted with any<QFont> when the grid font changes. 00060 */ 00061 SIGNAL_METHOD(LatLonLayer, FontChanged) 00062 /** 00063 * Emitted with any<LatLonStyle> when the grid style changes. 00064 */ 00065 SIGNAL_METHOD(LatLonLayer, StyleChanged) 00066 /** 00067 * Emitted with any<unsigned int> when the grid line width changes. 00068 */ 00069 SIGNAL_METHOD(LatLonLayer, WidthChanged) 00070 /** 00071 * Emitted with any<LocationType> when the tick spacing changes. 00072 */ 00073 SIGNAL_METHOD(LatLonLayer, TickSpacingChanged) 00074 /** 00075 * Emitted with any<bool> when autocomputing of tick spacing changes. 00076 */ 00077 SIGNAL_METHOD(LatLonLayer, AutoTickSpacingChanged) 00078 /** 00079 * Emitted with any<GeocoordType> when the coordinate system changes. 00080 */ 00081 SIGNAL_METHOD(LatLonLayer, CoordTypeChanged) 00082 00083 /** 00084 * Sets the line color for the current lat/long layer. 00085 * 00086 * @param colorType 00087 * The new line color, which must be valid 00088 * 00089 * @notify This method will notify Subject::signalModified. 00090 * 00091 * @see getColor(), ColorType::isValid() 00092 */ 00093 virtual void setColor(const ColorType& colorType) = 0; 00094 00095 /** 00096 * Returns the line color of the current lat/long layer. 00097 * 00098 * @return The current line color. 00099 * 00100 * @see setColor() 00101 */ 00102 virtual ColorType getColor() const = 0; 00103 00104 /** 00105 * Sets the line style for the current lat/long layer. 00106 * 00107 * @param eStyle 00108 * The new line style. 00109 * 00110 * @notify This method will notify Subject::signalModified. 00111 * 00112 * @see getStyle() 00113 */ 00114 virtual void setStyle(const LatLonStyle& eStyle) = 0; 00115 00116 /** 00117 * Returns the line style of the current lat/long layer. 00118 * 00119 * @return The current line style. 00120 * 00121 * @see setStyle() 00122 */ 00123 virtual LatLonStyle getStyle() const = 0; 00124 00125 /** 00126 * Sets the line width for the current lat/long layer. 00127 * 00128 * @param width 00129 * The new line width. 00130 * 00131 * @notify This method will notify Subject::signalModified. 00132 * 00133 * @see getWidth() 00134 */ 00135 virtual void setWidth(unsigned int width) = 0; 00136 00137 /** 00138 * Returns the line width of the current lat/long layer. 00139 * 00140 * @return The current line width. 00141 * 00142 * @see setWidth() 00143 */ 00144 virtual unsigned int getWidth() const = 0; 00145 00146 /** 00147 * Sets the gridline tick spacing of the current lat/long layer. 00148 * 00149 * The tick spacing defines the distance separating the gridlines. This method sets 00150 * both the latitude and longitude (X and Y) spacing. Calling this method disables 00151 * auto tick spacing. 00152 * 00153 * @param spacing 00154 * The tick spacing in the X and Y dimensions as a LocationType. 00155 * The spacing should be in the geocoordinate system specified in 00156 * setGeocoordType(). 00157 * 00158 * @notify This method will notify Subject::signalModified. 00159 * 00160 * @see getTickSpacing() 00161 */ 00162 virtual void setTickSpacing(const LocationType& spacing) = 0; 00163 00164 /** 00165 * Returns the gridline tick spacing of the current lat/long layer. 00166 * 00167 * @return The tick spacing in the X and Y dimensions as a LocationType. 00168 * 00169 * @see setTickSpacing() 00170 */ 00171 virtual LocationType getTickSpacing() const = 0; 00172 00173 /** 00174 * Turns on or off auto computed tick spacing. 00175 * 00176 * This method sets the current lat/long layer to automatically calculate the 00177 * tick spacing. 00178 * 00179 * @param bAutoSpacing 00180 * TRUE to automatically calculate the tick spacing. FALSE to use the 00181 * manually set values. 00182 * 00183 * @notify This method will notify Subject::signalModified. 00184 * 00185 * @see getAutoTickSpacing() 00186 */ 00187 virtual void setAutoTickSpacing(bool bAutoSpacing) = 0; 00188 00189 /** 00190 * Returns the current state of auto computed tick spacing. 00191 * 00192 * @return TRUE if the layer is set to automatically calculate the tick spacing. 00193 * FALSE if the layer uses the manually set values. 00194 * 00195 * @see setAutoTickSpacing() 00196 */ 00197 virtual bool getAutoTickSpacing() const = 0; 00198 00199 /** 00200 * Sets the font for the latitude/longitude text. 00201 * 00202 * @param font 00203 * The new latitude/longitude font. 00204 * 00205 * @notify This method will notify Subject::signalModified(). 00206 */ 00207 virtual void setFont(const Font& font) = 0; 00208 00209 /** 00210 * Returns read-only access to the latitude/longitude text font. 00211 * 00212 * @return The current latitude/longitude text font. To modify the font 00213 * values, call setFont() instead. 00214 */ 00215 virtual const Font& getFont() const = 0; 00216 00217 /** 00218 * Sets the displayed geocoordinate system. 00219 * 00220 * If auto spacing is not enabled, setTickSpacing() should be called to 00221 * specify the tick spacing in the geocoordinate system. 00222 * 00223 * @param system 00224 * The geocoordinate system used for display. 00225 * 00226 * @notify This method will notify Subject::signalModified. 00227 * 00228 * @see GeocoordType 00229 */ 00230 virtual void setGeocoordType(const GeocoordType& system) = 0; 00231 00232 /** 00233 * Returns the geocoordinate system used for display. 00234 * 00235 * @return The geocoordinate system. 00236 * 00237 * @see GeocoordType 00238 */ 00239 virtual GeocoordType getGeocoordType() const = 0; 00240 00241 /** 00242 * Sets the display format for latitude/longitude values. 00243 * 00244 * This method sets the display format for latitude longitude values. 00245 * It can still be called when the current geocoordinate system is 00246 * not latitude/longitude, and will take effect when the user updates 00247 * the view to display latitude/longitude values. 00248 * 00249 * @param eFormat 00250 * The latitude/longitude display format. 00251 * 00252 * @notify This method will notify Subject::signalModified. 00253 * 00254 * @see DmsFormatType, getGeocoordType() 00255 */ 00256 virtual void setLatLonFormat(const DmsFormatType& eFormat) = 0; 00257 00258 /** 00259 * Returns the display format of latitude/longitude values. 00260 * 00261 * @return The latitude/longitude display format. This value will be 00262 * valid even if the currently displayed geocoordinate 00263 * system is not latitude/longitude. 00264 * 00265 * @see DmsFormatType, getGeocoordType() 00266 */ 00267 virtual DmsFormatType getLatLonFormat() const = 0; 00268 00269 protected: 00270 /** 00271 * This should be destroyed by calling SpatialDataView::deleteLayer. 00272 */ 00273 virtual ~LatLonLayer() {} 00274 }; 00275 00276 #endif