PerspectiveView.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 PERSPECTIVEVIEW_H
00011 #define PERSPECTIVEVIEW_H
00012 
00013 #include "View.h"
00014 
00015 /**
00016  *  A three-dimensional perspective view.
00017  *
00018  *  The perspective view uses a perspective projection to draw its contents in three
00019  *  dimensions.  The data can be zoomed, panned, and rotated in several different
00020  *  fashions.  The reset() and resetOrientation() functions return the view to its
00021  *  original display state.  The aspect ratio is preserved in all dimensions regardless
00022  *  of the display configuration.
00023  *
00024  *  This subclass of Subject will notify upon the following conditions:
00025  *  - The following methods are called: zoomTo(), rotateTo(), rotateBy(),
00026  *    zoomAboutPoint(), zoomBy(), zoomToPoint(), zoomToCenter(), flipBy(), flipTo(),
00027  *    flipHorizontal(), flipVertical(), resetZoom(), resetOrientation(), and reset().
00028  *  - The user causes the view to pan, rotate, flip, or zoom.
00029  *  - Everything else documented in View.
00030  *
00031  *  @see     View, OrthographicView
00032  */
00033 class PerspectiveView : public View
00034 {
00035 public:
00036    SETTING(ZoomPercentage, PerspectiveView, unsigned int, 0)
00037 
00038    /**
00039     *  Emitted with any<double> when the zoom level changes.
00040     */
00041    SIGNAL_METHOD(PerspectiveView, ZoomChanged)
00042    /**
00043     *  Emitted  with any<double> when the scene rotation changes.
00044     */
00045    SIGNAL_METHOD(PerspectiveView, RotationChanged)
00046    /**
00047     *  Emitted  with any<double> when the scene pitch angle changes.
00048     */
00049    SIGNAL_METHOD(PerspectiveView, PitchChanged)
00050    /**
00051     *  Emitted when the viewable area changes.
00052     */
00053    SIGNAL_METHOD(PerspectiveView, DisplayAreaChanged)
00054 
00055    /**
00056     *  Adjusts the current zoom level by a given percentage.
00057     *
00058     *  This method does not call View::refresh() so that multiple calls to modify
00059     *  view settings can be made without refreshing the view after each modification.
00060     *
00061     *  @param   dPercent
00062     *           The percentage by which the zoom level is adjusted.
00063     *
00064     *  @see     zoomTo()
00065     *
00066     *  @notify  This method will notify signalZoomChanged with any<double>.
00067     */
00068    virtual void zoomBy(double dPercent) = 0;
00069 
00070    /**
00071     *  Sets the current zoom level to a given percentage.
00072     *
00073     *  This method does not call View::refresh() so that multiple calls to modify
00074     *  view settings can be made without refreshing the view after each modification.
00075     *
00076     *  @param   dPercent
00077     *           The percentage to which the zoom level is set.
00078     *
00079     *  @see     zoomBy()
00080     *
00081     *  @notify  This method will notify signalZoomChanged with any<double>.
00082     */
00083    virtual void zoomTo(double dPercent) = 0;
00084 
00085    /**
00086     *  Sets the current zoom level to a given percentage centered on a given point.
00087     *
00088     *  This method sets the view zoom level based on a given point.  The
00089     *  view is panned to center the point, the zoom level is set, and the
00090     *  view is panned back to the given point.  To not pan back to the
00091     *  given point, call zoomToPoint() instead.
00092     *
00093     *  This method does not call View::refresh() so that multiple calls to modify
00094     *  view settings can be made without refreshing the view after each modification.
00095     *
00096     *  @param   worldCoord
00097     *           The pixel coordinate about which zoom action is centered.
00098     *  @param   dPercent
00099     *           The percentage to which the zoom level is set.
00100     *
00101     *  @see     zoomToPoint()
00102     *
00103     *  @notify  This method will notify signalZoomChanged with any<double>.
00104     */
00105    virtual void zoomAboutPoint(const LocationType& worldCoord, double dPercent) = 0;
00106 
00107    /**
00108     *  Sets the current zoom level and pans to a given point.
00109     *
00110     *  This method sets the view zoom level based on a given point.  The
00111     *  view is panned to center the point and the zoom level is set.
00112     *
00113     *  This method does not call View::refresh() so that multiple calls to modify
00114     *  view settings can be made without refreshing the view after each modification.
00115     *
00116     *  @param   worldCoord
00117     *           The pixel coordinate for the new view center.
00118     *  @param   dPercent
00119     *           The percentage to which the zoom level is set.
00120     *
00121     *  @see     zoomAboutPoint()
00122     *
00123     *  @notify  This method will notify signalZoomChanged with any<double>.
00124     */
00125    virtual void zoomToPoint(const LocationType& worldCoord, double dPercent) = 0;
00126 
00127    /**
00128     *  Sets the current zoom level and pans to the center of the image.
00129     *
00130     *  This method first centers the image in the view and then zooms to the given
00131     *  percentage.  This is equivalent to calling panToCenter() and then zoomTo().
00132     *
00133     *  This method does not call View::refresh() so that multiple calls to modify
00134     *  view settings can be made without refreshing the view after each modification.
00135     *
00136     *  @param   dPercent
00137     *           The percentage to which the zoom level is set.
00138     *
00139     *  @see     zoomToPoint()
00140     *
00141     *  @notify  This method will notify signalZoomChanged with any<double>.
00142     */
00143    virtual void zoomToCenter(double dPercent) = 0;
00144 
00145    /**
00146     *  Returns the current zoom level as a percentage.
00147     *
00148     *  @return  The current zoom percentage.  The percentage is the relationship
00149     *           between screen pixel and scene pixel.  A 100% zoom indicates one scene
00150     *           pixel is displayed in one screen pixel.
00151     */
00152    virtual double getZoomPercentage() const = 0;
00153 
00154    /**
00155     *  Rotates the image from its current position by a given angle.
00156     *
00157     *  This method does not call View::refresh() so that multiple calls to modify
00158     *  view settings can be made without refreshing the view after each modification.
00159     *
00160     *  @param   dDegrees
00161     *           The angle in degrees by which the view should be rotated.  The value
00162     *           must be between -360.0 and 360.0 degrees.  A positive value indicates a
00163     *           counterclockwise rotation.
00164     *
00165     *  @see     rotateTo()
00166     *
00167     *  @notify  This method will notify signalRotationChanged with any<double>.
00168     */
00169    virtual void rotateBy(double dDegrees) = 0;
00170 
00171    /**
00172     *  Rotates the image to a given angle.
00173     *
00174     *  This method does not call View::refresh() so that multiple calls to modify
00175     *  view settings can be made without refreshing the view after each modification.
00176     *
00177     *  @param   dDegrees
00178     *           The angle in degrees to which the view should be rotated.  The value
00179     *           must be between 0.0 and 360.0 degrees.
00180     *
00181     *  @see     rotateBy()
00182     *
00183     *  @notify  This method will notify signalRotationChanged with any<double>.
00184     */
00185    virtual void rotateTo(double dDegrees) = 0;
00186 
00187    /**
00188     *  Returns the current rotation angle.
00189     *
00190     *  @return  The angle in degrees by which the view is rotated, ranging from 0.0 to
00191     *           360.0 degrees.
00192     *
00193     *  @see     rotateTo()
00194     */
00195    virtual double getRotation() const = 0;
00196 
00197    /**
00198     *  Flips the image from its current position by a given angle.
00199     *
00200     *  This method does not call View::refresh() so that multiple calls to modify
00201     *  view settings can be made without refreshing the view after each modification.
00202     *
00203     *  @param   dDegrees
00204     *           The angle in degrees by which the view should be flipped.  The value
00205     *           must be between -360.0 and 360.0 degrees.
00206     *
00207     *  @see     flipTo(), flipHorizontal(), flipVertical()
00208     *
00209     *  @notify  This method will notify signalPitchChanged with any<double>.
00210     */
00211    virtual void flipBy(double dDegrees) = 0;
00212 
00213    /**
00214     *  Flips the image to a given angle.
00215     *
00216     *  This method does not call View::refresh() so that multiple calls to modify
00217     *  view settings can be made without refreshing the view after each modification.
00218     *
00219     *  @param   dDegrees
00220     *           The angle in degrees to which the view should be flipped.  The value
00221     *           must be between 0.0 and 360.0 degrees.
00222     *
00223     *  @notify  This method will notify signalPitchChanged with any<double>.
00224     *
00225     *  @see     flipBy(), flipHorizontal(), flipVertical()
00226     */
00227    virtual void flipTo(double dDegrees) = 0;
00228 
00229    /**
00230     *  Flips the image across the horizontal axis.
00231     *
00232     *  This method does not call View::refresh() so that multiple calls to modify
00233     *  view settings can be made without refreshing the view after each modification.
00234     *
00235     *  @see     flipVertical(), flipTo(), flipBy()
00236     *
00237     *  @notify  This method will notify signalPitchChanged with any<double> and 
00238     *              signalRotationChanged with any<double>.
00239     */
00240    virtual void flipHorizontal() = 0;
00241 
00242    /**
00243     *  Flips the image across the vertical axis.
00244     *
00245     *  This method does not call View::refresh() so that multiple calls to modify
00246     *  view settings can be made without refreshing the view after each modification.
00247     *
00248     *  @see     flipHorizontal(), flipTo(), flipBy()
00249     *
00250     *  @notify  This method will notify signalPitchChanged with any<double>.
00251     */
00252    virtual void flipVertical() = 0;
00253 
00254    /**
00255     *  Returns the current pitch angle.
00256     *
00257     *  @return  The angle in degrees by which the view is pitched, ranging from 0.0 to
00258     *           360.0 degrees.
00259     *
00260     *  @see     flipTo()
00261     */
00262    virtual double getPitch() const = 0;
00263   
00264    /**
00265     *  Resets the zoom level to the user-defined default value.
00266     *
00267     *  This method adjusts the zoom level based on the getSettingZoomPercentage()
00268     *  value.  If the default zoom percentage is zero, zoomExtents() is called.
00269     *  Otherwise, zoomTo() is called and the data origin is aligned to the corner of
00270     *  the view.
00271     *
00272     *  This method does not call View::refresh() so that multiple calls to modify
00273     *  view settings can be made without refreshing the view after each modification.
00274     *
00275     *  @see     reset()
00276     *
00277     *  @notify  This method will notify signalZoomChanged with any<double>.
00278     */
00279    virtual void resetZoom() = 0;
00280 
00281    /**
00282     *  Resets the image rotatation and flip angles.
00283     *
00284     *  This method does not call View::refresh() so that multiple calls to modify
00285     *  view settings can be made without refreshing the view after each modification.
00286     *
00287     *  @see     reset()
00288     *
00289     *  @notify  This method will notify Subject::signalModified.
00290     */
00291    virtual void resetOrientation() = 0;
00292 
00293    /**
00294     *  Resets the image zoom and rotation.
00295     *
00296     *  This method zooms the image to the data extents and resets the rotation
00297     *  and flip angles to 0.0.
00298     *
00299     *  This method does not call View::refresh() so that multiple calls to modify
00300     *  view settings can be made without refreshing the view after each modification.
00301     *
00302     *  @see     zoomExtents(), resetOrientation()
00303     *
00304     *  @notify  This method will notify Subject::signalModified.
00305     */
00306    virtual void reset() = 0;
00307 
00308    /**
00309     *  Toggles whether to show pixel coordinates or pixel values
00310     *  when sufficiently zoomed.
00311     */
00312    virtual void toggleShowCoordinates() = 0;
00313 
00314    /**
00315     * Gets the pixel aspect ratio.
00316     *
00317     * Values greater than 1 will cause a stretch in the x direction, 
00318     * values less than 1 will cause a stretch in the y direction.
00319     *
00320     * @return The ratio of x as compared to y.
00321     */
00322    virtual double getPixelAspect() const = 0;
00323 
00324    /**
00325     * Sets the pixel aspect ratio.
00326     *
00327     * Values greater than 1 will cause a stretch in the x direction, 
00328     * values less than 1 will cause a stretch in the y direction.
00329     *
00330     * @param aspect
00331     *        The ratio of x as compared to y.
00332     */
00333    virtual void setPixelAspect(double aspect) = 0;
00334 
00335 protected:
00336    /**
00337     * This should be destroyed by calling DesktopServices::deleteView.
00338     */
00339    virtual ~PerspectiveView() {}
00340 };
00341 
00342 #endif

Software Development Kit - Opticks 4.9.0 Build 16218