DrawingDisplayData.h

Go to the documentation of this file.
00001 //# DrawingDisplayData.h: interactive drawing DisplayData
00002 //# Copyright (C) 1999,2000,2002
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TRIALDISPLAY_DRAWINGDISPLAYDATA_H
00029 #define TRIALDISPLAY_DRAWINGDISPLAYDATA_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/Containers/List.h>
00033 #include <display/Display/DisplayEnums.h>
00034 #include <display/DisplayDatas/PassiveCachingDD.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038         class WorldCanvas;
00039         class WorldCanvasHolder;
00040         class AttributeBuffer;
00041         class DrawingDisplayMethod;
00042         class DDDObject;
00043 
00044 // <summary>
00045 // DisplayData which provides interactive drawing capabilities.
00046 // </summary>
00047 
00048 // <synopsis>
00049 // This class provides an implementation of a PassiveCachingDD which
00050 // provides the ability for the programmer to add various objects
00051 // to the display (eg. rectangles), and then modify them, or allow
00052 // the user to interactively modify the objects.
00053 // </synopsis>
00054 
00055         class DrawingDisplayData : public PassiveCachingDD {
00056 
00057         public:
00058 
00059                 // Constructor.
00060                 DrawingDisplayData(const Display::KeySym keysym =
00061                                        Display::K_Pointer_Button1);
00062 
00063                 // Destructor.
00064                 virtual ~DrawingDisplayData();
00065 
00066                 // Install the default options for this DisplayData.
00067                 virtual void setDefaultOptions();
00068 
00069                 // Apply options stored in <src>rec</src> to the DisplayData.  A
00070                 // return value of <src>True</src> means a refresh is needed.
00071                 // <src>recOut</src> contains any fields which were implicitly
00072                 // changed as a result of the call to this function.
00073                 virtual Bool setOptions(Record &rec, Record &recOut);
00074 
00075                 // Retrieve the current and default options and parameter types.
00076                 virtual Record getOptions( bool scrub=false ) const;
00077 
00078                 // Return the type of this DisplayData.
00079                 virtual Display::DisplayDataType classType() {
00080                         return Display::CanvasAnnotation;
00081                 }
00082 
00083                 // Create a new AxesDisplayMethod for drawing on the given
00084                 // WorldCanvas when the AttributeBuffers are suitably matched to the
00085                 // current state of this DisplayData and of the WorldCanvas/Holder.
00086                 // The tag is a unique number used to identify the age of the newly
00087                 // constructed CachingDisplayMethod.
00088                 virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas,
00089                         AttributeBuffer *wchAttributes,
00090                         AttributeBuffer *ddAttributes,
00091                         CachingDisplayData *dd);
00092 
00093                 // Return the current options of this DisplayData as an
00094                 // AttributeBuffer.
00095                 virtual AttributeBuffer optionsAsAttributes();
00096 
00097                 virtual void refreshEH(const WCRefreshEvent &ev);
00098 
00099                 // Add an object to the drawing as described in the given Record.
00100                 virtual void addObject(const Record &description);
00101 
00102                 // Get the description of the object with the given id.
00103                 virtual Record description(const Int objectID);
00104 
00105                 // Set the description of the object with the given id.
00106                 virtual void setDescription(const Int objectID, const Record &rec);
00107 
00108                 // Remove the object with the given id.
00109                 virtual void removeObject(const Int objectID);
00110 
00111                 // Set the handle state of the particular item.
00112                 virtual void setHandleState(DDDObject *item, const Bool state);
00113 
00114                 // Return the current setting of the labelposition option.
00115                 virtual String labelPosition() {
00116                         return itsOptionsLabelPosition;
00117                 }
00118 
00119                 // Set/get which key to catch.
00120                 // <group>
00121                 virtual void setKey(const Display::KeySym &keysym);
00122                 virtual Display::KeySym key() const {
00123                         return itsKeySym;
00124                 }
00125                 virtual Display::KeyModifier keyModifier() const {
00126                         return itsKeyModifier;
00127                 }
00128                 // </group>
00129 
00130                 // Double click interval.
00131                 virtual Double doubleClickInterval() const {
00132                         return itsDoubleClickInterval;
00133                 }
00134 
00135                 // Called when a double click occurred for the identified object.
00136                 // Null implementation in this class, derived classes can over-ride.
00137                 virtual void doubleClick(const Int objectID);
00138 
00139         protected:
00140 
00141                 // (Required) copy constructor.
00142                 DrawingDisplayData(const DrawingDisplayData &other);
00143 
00144                 // (Required) copy assignment.
00145                 void operator=(const DrawingDisplayData &other);
00146 
00147         private:
00148 
00149                 friend class DrawingDisplayMethod;
00150 
00151                 // The key to handle.
00152                 Display::KeySym itsKeySym;
00153 
00154                 // The modifier mask for the key.
00155                 Display::KeyModifier itsKeyModifier;
00156 
00157                 // Double click interval (seconds)
00158                 Double itsDoubleClickInterval;
00159 
00160                 // List containing the DDDObjects for this DrawingDisplayData.
00161                 List<void *> itsDDDOList;
00162 
00163                 // Iterator for itsDDDOList
00164                 ListIter<void *> *itsDDDOListIter;
00165 
00166                 // Obvious!
00167                 DDDObject *itsObjectWhichIsShowingHandles;
00168 
00169                 // Install the default options for this DisplayData.
00170                 void installDefaultOptions();
00171 
00172                 // Option: position for labels
00173                 String itsOptionsLabelPosition;
00174 
00175         };
00176 
00177 
00178 } //# NAMESPACE CASA - END
00179 
00180 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1