ProductView.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 PRODUCTVIEW_H
00011 #define PRODUCTVIEW_H
00012 
00013 #include "ConfigurationSettings.h"
00014 #include "PerspectiveView.h"
00015 #include "TypesFile.h"
00016 
00017 #include <string>
00018 #include <vector>
00019 
00020 class AnnotationLayer;
00021 class ClassificationLayer;
00022 class GraphicLayer;
00023 class GraphicObject;
00024 
00025 /**
00026  *  A view for custom product generation.
00027  *
00028  *  The product view provides a means by which custom output products can be created.
00029  *  The view contains an annotation layer called the layout layer that is displayed on
00030  *  a sheet of paper.  Annotation objects can be added to the layout layer to create a
00031  *  finished product.  View objects are often used in the layout layer to display
00032  *  data or results.  Because views can be modified separately, the product view contains
00033  *  an active edit view.  The active edit view object is identified in the layout layer
00034  *  with selection handles.  The view also contains a classification layer to specify
00035  *  classification markings for the product.
00036  *
00037  *  The product view defines the following mouse modes, where the name given is the name
00038  *  populated by MouseMode::getName():
00039  *  - LayerMode
00040  *  - PanMode
00041  *  - ZoomInMode
00042  *  - ZoomOutMode
00043  *  - ZoomBoxMode
00044  *
00045  *  This subclass of Subject will notify upon the following conditions:
00046  *  - The following methods are called: setPaperSize(), setPaperColor(),
00047  *    setDpi(), setActiveLayer().
00048  *  - Everything else documented in PerspectiveView.
00049  *
00050  *  @see     AnnotationLayer, ClassificationLayer
00051  */
00052 class ProductView : public PerspectiveView
00053 {
00054 public:
00055    SETTING_PTR(TemplateFile, ProductView, Filename)
00056    SETTING_PTR(TemplatePath, ProductView, Filename)
00057    SETTING(ClassificationMarkingPositions, ProductView, PositionType, CENTER)
00058 
00059    /**
00060     *  Emitted with boost::any<std::pair<double,double> > when the paper size
00061     *  is changed.
00062     */
00063    SIGNAL_METHOD(ProductView, PaperSizeChanged)
00064 
00065    /**
00066     *  Emitted with boost::any<ColorType> when the paper color is changed.
00067     */
00068    SIGNAL_METHOD(ProductView, PaperColorChanged)
00069 
00070    /**
00071     *  Emitted with boost::any<unsigned int> when the paper dpi changes.
00072     */
00073    SIGNAL_METHOD(ProductView, DpiChanged)
00074 
00075    /**
00076     *  Emitted with boost::any<Layer*> when a layer is activated.
00077     */
00078    SIGNAL_METHOD(ProductView, LayerActivated)
00079 
00080    /**
00081     *  Sets the paper size.
00082     *
00083     *  This method does not call View::refresh() so that multiple calls to modify
00084     *  view settings can be made without refreshing the view after each modification.
00085     *
00086     *  @param   dWidth
00087     *           The new width of the displayed paper in inches.
00088     *  @param   dHeight
00089     *           The new height of the displayed paper in inches.
00090     *
00091     *  @notify  This method will notify signalPaperSizeChanged with any<std::pair<double,double> >.
00092     */
00093    virtual void setPaperSize(double dWidth, double dHeight) = 0;
00094 
00095    /**
00096     *  Retrieves the paper size.
00097     *
00098     *  @param   dWidth
00099     *           Populated with the width of the displayed paper in inches.
00100     *  @param   dHeight
00101     *           Populated with the height of the displayed paper in inches.
00102     */
00103    virtual void getPaperSize(double& dWidth, double& dHeight) const = 0;
00104 
00105    /**
00106     *  Sets the paper color.
00107     *
00108     *  The paper color extends to the edge of the paper area.  Depending on the view
00109     *  zoom level, this may or may not extend to the edge of the view area.
00110     *
00111     *  This method does not call View::refresh() so that multiple calls to modify
00112     *  view settings can be made without refreshing the view after each modification.
00113     *
00114     *  @param   paperColor
00115     *           The new paper color.
00116     *
00117     *  @notify  This method will notify signalPaperColorChanged with any<ColorType>.
00118     *
00119     *  @see     View::setBackgroundColor()
00120     */
00121    virtual void setPaperColor(const ColorType& paperColor) = 0;
00122 
00123    /**
00124     *  Returns the paper color.
00125     *
00126     *  @return  The current paper color.
00127     *
00128     *  @see     View::getBackgroundColor()
00129     */
00130    virtual ColorType getPaperColor() const = 0;
00131 
00132    /**
00133     *  Sets the dots per inch (DPI) of the paper.
00134     *
00135     *  The paper DPI is used in conjunction with the paper size to establish
00136     *  the coordinate extents of the paper used by the Layout annotation layer.
00137     *  The default DPI is 100, so a paper size of 8.5 by 11 has paper coordinate
00138     *  extents of 850 and 1100.
00139     *
00140     *  This method does not call View::refresh() so that multiple calls to modify
00141     *  view settings can be made without refreshing the view after each modification.
00142     *
00143     *  @param   dpi
00144     *           The new dots per inch value of the paper.
00145     *
00146     *  @notify  This method will notify signalDpiChanged with any<unsigned int>.
00147     */
00148    virtual void setDpi(unsigned int dpi) = 0;
00149 
00150    /**
00151     *  Returns the dots per inch (DPI) of the displayed paper.
00152     *
00153     *  The paper DPI is used in conjunction with the paper size to establish
00154     *  the coordinate extents of the paper used by the Layout annotation layer.
00155     *  The default DPI is 100, so a paper size of 8.5 by 11 has paper coordinate
00156     *  extents of 850 and 1100.
00157     *
00158     *  @return  The dots per inch value of the paper.
00159     */
00160    virtual unsigned int getDpi() const = 0;
00161 
00162    /**
00163     *  Loads a product template from a file.
00164     *
00165     *  A product template is a set of annotation objects displayed in the layout
00166     *  layer. Loading a template from a file removes all objects currently displayed
00167     *  in the layout layer.
00168     *
00169     *  @param   filename
00170     *           The filename of the template to load.  An empty string will cause a
00171     *           file selection dialog box to be displayed for the user to select
00172     *           a file.
00173     *
00174     *  @return  TRUE if the template was loaded successfully, otherwise FALSE.
00175     *
00176     *  @see     getLayoutLayer()
00177     */
00178    virtual bool loadTemplate(const std::string& filename) = 0;
00179 
00180    /**
00181     *  Saves the annotation objects in the layout layer as a template.
00182     *
00183     *  @param   filename
00184     *           The destination filename of the template to save.  An empty string
00185     *           will cause a file selection dialog box to be displayed for the user
00186     *           to select a file.
00187     *
00188     *  @return  TRUE if the template was saved successfully, otherwise FALSE.
00189     */
00190    virtual bool saveTemplate(const std::string& filename) const = 0;
00191 
00192    /**
00193     *  Returns the annotation layer for the product's annotation objects.
00194     *
00195     *  @return  A pointer to the annotation layer containing the annotation objects.
00196     */
00197    virtual AnnotationLayer* getLayoutLayer() const = 0;
00198 
00199    /**
00200     *  Returns the classification layer used to display the product classification
00201     *  markings.
00202     *
00203     *  @return  A pointer to the classification layer.
00204     */
00205    virtual ClassificationLayer* getClassificationLayer() const = 0;
00206 
00207    /**
00208     *  Sets the active layer in the view.
00209     *
00210     *  The active layer will appear on the toolbar if there is no active edit view.
00211     *
00212     *  @param   pLayer
00213     *           The layer to activate.  This must be either the layout layer or the
00214     *           classification layer.
00215     *
00216     *  @see     getLayoutLayer(), getClassificationLayer()
00217     *
00218     *  @notify  This method will notify signalLayerActivated with any<GraphicLayer*>.
00219     */
00220    virtual void setActiveLayer(GraphicLayer* pLayer) = 0;
00221 
00222    /**
00223     *  Returns the active product view layer.
00224     *
00225     *  @return  A pointer to the active layer, either the layout layer or the
00226     *           classification layer.  NULL is returned if there is an active
00227     *           edit view object.
00228     *
00229     *  @see     getLayoutLayer(), getClassificationLayer(), getActiveEditObject(),
00230     *           getActiveEditView()
00231     */
00232    virtual GraphicLayer* getActiveLayer() const = 0;
00233 
00234    /**
00235     *  Sets the active view object that processes mouse and other events.
00236     *
00237     *  This method enables and disables editing of a view inside of its annotation
00238     *  view object.  The active view object appears with selection handles and all
00239     *  mouse events are processed by the view instead of the layout layer.
00240     *
00241     *  The active edit view object can also be set according to its view by calling
00242     *  setActiveEditView().
00243     *
00244     *  @param   pObject
00245     *           The annotation view object to set as the active edit object.  If
00246     *           this value is non-NULL, the active layer becomes NULL.  If the value
00247     *           is NULL, editing of the view is disabled and editing of the layout
00248     *           layer is enabled.
00249     *
00250     *  @return  This method returns true if the annotation view object was successfully
00251     *           activated, thereby enabling editing of its view, otherwise false.
00252     *
00253     *  @see     setActiveEditView()
00254     */
00255    virtual bool setActiveEditObject(GraphicObject* pObject) = 0;
00256 
00257    /**
00258     *  Returns the annotation view object that has view editing enabled.
00259     *
00260     *  This method returns the current annotation object containing the view that can
00261     *  be edited.  The view inside the annotation object can be obtained directly by
00262     *  calling getActiveEditView().
00263     *
00264     *  @return  A pointer to the active annotation view object that allows editing of
00265     *           the view contained in the object.  NULL is returned if view editing is
00266     *           disabled and the layout layer or classification layer is enabled.
00267     *
00268     *  @see     getActiveEditView()
00269     */
00270    virtual GraphicObject* getActiveEditObject() const = 0;
00271 
00272    /**
00273     *  Sets the active view that processes mouse and other events.
00274     *
00275     *  This method enables and disables editing of a view inside of its annotation
00276     *  view object.  The active view object appears with selection handles and all
00277     *  mouse events are processed by the view instead of the layout layer.
00278     *
00279     *  The active edit view object can also be set according to its annotation
00280     *  object by calling setActiveEditObject().
00281     *
00282     *  @param   pView
00283     *           The view to set as the active edit view.  The view must be contained
00284     *           in a valid annotation view object in the layout layer.  If the view
00285     *           object containing this view is found, the active layer becomes NULL.
00286     *           Set this value to NULL to disable view editing and enable editing of
00287     *           the layout layer.
00288     *
00289     *  @return  This method returns true if the annotation view object containing the
00290     *           given view was successfully activated, thereby enabling editing of
00291     *           view.  Otherwise this method returns false.
00292     *
00293     *  @see     setActiveEditObject()
00294     */
00295    virtual bool setActiveEditView(View* pView) = 0;
00296 
00297    /**
00298     *  Returns the view that has editing enabled.
00299     *
00300     *  This method returns the view inside the annotation view object that is
00301     *  currently active.  This is identical to getActiveEditObject()->getObjectView().
00302     *
00303     *  @return  A pointer to the view inside of an annotation view object that can be
00304     *           actively edited.  NULL is returned if view editing is disabled and the
00305     *           layout layer or classification layer is enabled.
00306     *
00307     *  @see     getActiveEditObject()
00308     */
00309    virtual View* getActiveEditView() const = 0;
00310 
00311 protected:
00312    /**
00313     * This should be destroyed by calling DesktopServices::deleteView.
00314     */
00315    virtual ~ProductView() {}
00316 };
00317 
00318 #endif

Software Development Kit - Opticks 4.9.0 Build 16218