casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DrawingDisplayData.h
Go to the documentation of this file.
1 //# DrawingDisplayData.h: interactive drawing DisplayData
2 //# Copyright (C) 1999,2000,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef TRIALDISPLAY_DRAWINGDISPLAYDATA_H
29 #define TRIALDISPLAY_DRAWINGDISPLAYDATA_H
30 
31 #include <casa/aips.h>
32 #include <list>
35 
36 namespace casa { //# NAMESPACE CASA - BEGIN
37 
38  class WorldCanvas;
39  class WorldCanvasHolder;
40  class AttributeBuffer;
41  class DrawingDisplayMethod;
42  class DDDObject;
43 
44 // <summary>
45 // DisplayData which provides interactive drawing capabilities.
46 // </summary>
47 
48 // <synopsis>
49 // This class provides an implementation of a PassiveCachingDD which
50 // provides the ability for the programmer to add various objects
51 // to the display (eg. rectangles), and then modify them, or allow
52 // the user to interactively modify the objects.
53 // </synopsis>
54 
56 
57  public:
58 
59  // Constructor.
60  DrawingDisplayData(const Display::KeySym keysym =
62 
63  // Destructor.
64  virtual ~DrawingDisplayData();
65 
66  // Install the default options for this DisplayData.
67  virtual void setDefaultOptions();
68 
69  // Apply options stored in <src>rec</src> to the DisplayData. A
70  // return value of <src>true</src> means a refresh is needed.
71  // <src>recOut</src> contains any fields which were implicitly
72  // changed as a result of the call to this function.
74 
75  // Retrieve the current and default options and parameter types.
76  virtual casacore::Record getOptions( bool scrub=false ) const;
77 
78  // Return the type of this DisplayData.
81  }
82 
83  // Create a new AxesDisplayMethod for drawing on the given
84  // WorldCanvas when the AttributeBuffers are suitably matched to the
85  // current state of this DisplayData and of the WorldCanvas/Holder.
86  // The tag is a unique number used to identify the age of the newly
87  // constructed CachingDisplayMethod.
89  AttributeBuffer *wchAttributes,
90  AttributeBuffer *ddAttributes,
91  CachingDisplayData *dd);
92 
93  // Return the current options of this DisplayData as an
94  // AttributeBuffer.
96 
97  virtual void refreshEH(const WCRefreshEvent &ev);
98 
99  // Add an object to the drawing as described in the given Record.
100  virtual void addObject(const casacore::Record &description);
101 
102  // Get the description of the object with the given id.
103  virtual casacore::Record description(const casacore::Int objectID);
104 
105  // Set the description of the object with the given id.
106  virtual void setDescription(const casacore::Int objectID, const casacore::Record &rec);
107 
108  // Remove the object with the given id.
109  virtual void removeObject(const casacore::Int objectID);
110 
111  // Set the handle state of the particular item.
112  virtual void setHandleState(DDDObject *item, const casacore::Bool state);
113 
114  // Return the current setting of the labelposition option.
117  }
118 
119  // Set/get which key to catch.
120  // <group>
121  virtual void setKey(const Display::KeySym &keysym);
122  virtual Display::KeySym key() const {
123  return itsKeySym;
124  }
126  return itsKeyModifier;
127  }
128  // </group>
129 
130  // casacore::Double click interval.
132  return itsDoubleClickInterval;
133  }
134 
135  // Called when a double click occurred for the identified object.
136  // Null implementation in this class, derived classes can over-ride.
137  virtual void doubleClick(const casacore::Int objectID);
138 
139  protected:
140 
141  // (Required) copy constructor.
143 
144  // (Required) copy assignment.
145  void operator=(const DrawingDisplayData &other);
146 
147  private:
148 
149  friend class DrawingDisplayMethod;
150 
151  // The key to handle.
153 
154  // The modifier mask for the key.
156 
157  // casacore::Double click interval (seconds)
159 
160  // casacore::List containing the DDDObjects for this DrawingDisplayData.
161  std::list<void *> itsDDDOList;
162 
163  // Obvious!
165 
166  // Install the default options for this DisplayData.
167  void installDefaultOptions();
168 
169  // Option: position for labels
171 
172  };
173 
174 
175 } //# NAMESPACE CASA - END
176 
177 #endif
int Int
Definition: aipstype.h:50
Assistance class for auto-caching of DisplayData objects.
Class which stores WorldCanvas refresh event information.
virtual Display::KeySym key() const
DisplayData which provides interactive drawing capabilities.
std::list< void * > itsDDDOList
casacore::List containing the DDDObjects for this DrawingDisplayData.
Display::KeyModifier itsKeyModifier
The modifier mask for the key.
DisplayDataType
WorldCanvasHolder - what type of DisplayData is this, need to know for drawing order.
Definition: DisplayEnums.h:355
Buffer for storing Attributes.
virtual casacore::Record getOptions(bool scrub=false) const
Retrieve the current and default options and parameter types.
virtual void setDefaultOptions()
Install the default options for this DisplayData.
virtual ~DrawingDisplayData()
Destructor.
void operator=(const DrawingDisplayData &other)
(Required) copy assignment.
virtual void doubleClick(const casacore::Int objectID)
Called when a double click occurred for the identified object.
virtual Display::KeyModifier keyModifier() const
virtual casacore::String description() const
Definition: DisplayData.h:614
void installDefaultOptions()
Install the default options for this DisplayData.
DDDObject * itsObjectWhichIsShowingHandles
Obvious!
virtual void addObject(const casacore::Record &description)
Add an object to the drawing as described in the given Record.
virtual casacore::String labelPosition()
Return the current setting of the labelposition option.
virtual casacore::Double doubleClickInterval() const
casacore::Double click interval.
Base class for auto-caching DisplayData objects.
virtual Display::DisplayDataType classType()
Return the type of this DisplayData.
double Double
Definition: aipstype.h:55
virtual void removeObject(const casacore::Int objectID)
Remove the object with the given id.
virtual CachingDisplayMethod * newDisplayMethod(WorldCanvas *worldCanvas, AttributeBuffer *wchAttributes, AttributeBuffer *ddAttributes, CachingDisplayData *dd)
Create a new AxesDisplayMethod for drawing on the given WorldCanvas when the AttributeBuffers are sui...
DrawingDisplayData(const Display::KeySym keysym=Display::K_Pointer_Button1)
Constructor.
virtual AttributeBuffer optionsAsAttributes()
Return the current options of this DisplayData as an AttributeBuffer.
Base class describing interface for objects supported by DrawingDisplayData.
Definition: DDDObject.h:62
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void refreshEH(const WCRefreshEvent &ev)
Negotiatiate WorldCanvas linear coordinate system when asked to do so by the WorldCanvasHolder.
Class providing passive behaviour for CachingDisplayDatas.
virtual void setKey(const Display::KeySym &keysym)
Set/get which key to catch.
virtual void setHandleState(DDDObject *item, const casacore::Bool state)
Set the handle state of the particular item.
KeyModifier
All events - modifier codes.
Definition: DisplayEnums.h:368
virtual void setDescription(const casacore::Int objectID, const casacore::Record &rec)
Set the description of the object with the given id.
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
virtual casacore::Bool setOptions(casacore::Record &rec, casacore::Record &recOut)
Apply options stored in rec to the DisplayData.
Display::KeySym itsKeySym
The key to handle.
casacore::String itsOptionsLabelPosition
Option: position for labels.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
KeySym
Keysyms for PixelCanvas keyboard events.
Definition: DisplayEnums.h:412
Canvas annotation - can draw outside draw area.
Definition: DisplayEnums.h:363
casacore::Double itsDoubleClickInterval
casacore::Double click interval (seconds)
DisplayMethod which provides actual drawing for DrawingDisplayData class.