casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlotMSAnnotator.h
Go to the documentation of this file.
1 //# PlotMSAnnotator.h: Annotator tool for PlotMS.
2 //# Copyright (C) 2009
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 #ifndef PLOTMSANNOTATOR_H_
28 #define PLOTMSANNOTATOR_H_
29 
33 
34 #include <QAction>
35 
36 namespace casa {
37 
38 //# Forward Declarations.
39 //class PlotMSApp;
40 class PlotMSPlotter;
41 
42 // Subclass of PlotMouseTool for drawing/managing annotations on the plot
43 // canvases of PlotMSApp.
45 
46  //# Friend class declarations.
47  friend class PlotMSPlotter;
48 
49 public:
50  // Static //
51 
52  // Drawing mode for the annotator.
53  enum Mode {
54  TEXT = 0,
56  };
57 
58 
59  // Non-Static //
60 
61  // Constructor which takes the PlotMS parent and optional starting mode.
62  PlotMSAnnotator(/*PlotMSApp**/PlotMSPlotter* parent, Mode startingMode = TEXT);
63 
64  // Destructor.
66 
67 
68  // Gets/Sets the current drawing mode.
69  // <group>
70  Mode drawingMode() const;
71  void setDrawingMode(Mode mode);
72  // </group>
73 
74  // Gets/Sets the current text properties (null means default for
75  // PlotAnnotation object). Only applies to future text annotations.
76  // <group>
77  PlotFontPtr textFont() const;
78  void setTextFont(const PlotFontPtr font);
79  PlotLinePtr textOutline() const;
80  void setTextOutline(const PlotLinePtr outline);
82  void setTextBackground(const PlotAreaFillPtr background);
83  // </group>
84 
85  // Gets/Sets the current rectangle properties (null means default for
86  // PlotShapeRectangle object). Only applies to future rectangle
87  // annotations.
88  // <group>
89  PlotLinePtr rectangleLine() const;
90  void setRectangleLine(const PlotLinePtr line);
92  void setRectangleAreaFill(const PlotAreaFillPtr fill);
93  // </group>
94 
95  // Clears all text/rectangle annotations off the given canvas. If the
96  // given canvas is NULL, then it clears them from all canvases.
97  // <group>
98  void clearText(PlotCanvas* canvas = NULL);
99  void clearRectangles(PlotCanvas* canvas = NULL);
100  void clearAll(PlotCanvas* canvas = NULL);
101  // </group>
102 
103 
104  // Overrides PlotTool::setActive().
105  void setActive(bool isActive = true);
106 
107  // Implements PlotMouseTool::handleMouseEvent().
108  void handleMouseEvent(const PlotEvent& event);
109 
110  // Implements PlotMSPlotManagerWatcher::plotChanged(). Removes annotations
111  // that are attached to canvases that no longer exist.
112  void plotsChanged(const PlotMSPlotManager& manager);
113 
114 protected:
115  // Sets the annotate and mode actions and the factory to the given. MUST
116  // be called before the annotator is used.
117  void setActions(QAction* annotateAction,
118  const QMap<PlotMSAction::Type, QAction*>& actionMap,
120 
121  // Overrides PlotTool::attach().
122  void attach(PlotCanvas* canvas);
123 
124  // Overrides PlotTool::detach().
125  void detach();
126 
127 private:
128  // Parent.
129  //PlotMSApp* itsParent_;
130 
131  // Factory for generating plot objects.
133 
134  // Current drawing mode.
136 
137  // Actions to keep updated.
138  // <group>
140  QMap<Mode, QAction*> itsModeActions_;
141  // </group>
142 
143  // Text annotations.
144  QMultiMap<PlotCanvas*, PlotAnnotationPtr> itsAText_;
145 
146  // Current text properties.
147  // <group>
151  // </group>
152 
153  // Rectangle annotations.
154  QMultiMap<PlotCanvas*, PlotShapeRectanglePtr> itsARect_;
155 
156  // Current rectangle properties.
157  // <group>
160  // </group>
161 
162 
163  // Sets properties to their defaults.
164  void setDefaults();
165 
167 };
168 
169 }
170 
171 #endif /* PLOTMSANNOTATOR_QO_H_ */
void attach(PlotCanvas *canvas)
Overrides PlotTool::attach().
~PlotMSAnnotator()
Destructor.
QMultiMap< PlotCanvas *, PlotShapeRectanglePtr > itsARect_
Rectangle annotations.
PlotAreaFillPtr itsTextFill_
void setTextOutline(const PlotLinePtr outline)
A PlotMouseTool is a specialization of PlotTool that handles all mouse events.
Definition: PlotTool.h:165
PlotFontPtr textFont() const
Gets/Sets the current text properties (null means default for PlotAnnotation object).
Subclass of PlotMouseTool for drawing/managing annotations on the plot canvases of PlotMSApp...
void plotsChanged(const PlotMSPlotManager &manager)
Implements PlotMSPlotManagerWatcher::plotChanged().
void handleMouseEvent(const PlotEvent &event)
Implements PlotMouseTool::handleMouseEvent().
void setRectangleAreaFill(const PlotAreaFillPtr fill)
void setRectangleLine(const PlotLinePtr line)
PlotMSPlotter * guiParent
PlotFontPtr itsTextFont_
Current text properties.
PlotLinePtr rectangleLine() const
Gets/Sets the current rectangle properties (null means default for PlotShapeRectangle object)...
PlotFactoryPtr itsFactory_
Parent.
Base class for an event.
Definition: PlotEvent.h:41
void setActive(bool isActive=true)
Overrides PlotTool::setActive().
virtual bool isActive() const
Returns whether this tool is currently active or not.
PlotMSAnnotator(PlotMSPlotter *parent, Mode startingMode=TEXT)
Non-Static //.
void setDefaults()
Sets properties to their defaults.
QAction * itsAnnotateAction_
Actions to keep updated.
QMultiMap< PlotCanvas *, PlotAnnotationPtr > itsAText_
Text annotations.
void setTextFont(const PlotFontPtr font)
Interface for any class that wants to be notified when the plots in the manager have changed...
virtual PlotCanvas * canvas() const
Returns the canvas this tool is attached to, or NULL for none.
QMap< Mode, QAction * > itsModeActions_
PlotLinePtr textOutline() const
void setDrawingMode(Mode mode)
PlotLinePtr itsRectLine_
Current rectangle properties.
PlotCanvas is an area for different PlotItems to be attached and drawn.
Definition: PlotCanvas.h:83
PlotAreaFillPtr itsRectFill_
Mode drawingMode() const
Gets/Sets the current drawing mode.
void setActions(QAction *annotateAction, const QMap< PlotMSAction::Type, QAction * > &actionMap, PlotFactoryPtr factory)
Sets the annotate and mode actions and the factory to the given.
void clearRectangles(PlotCanvas *canvas=NULL)
PlotAreaFillPtr textBackground() const
High(ish)-level plotter class that manages the GUI (semi-) transparently to the rest of PlotMS...
void setTextBackground(const PlotAreaFillPtr background)
Class which manages PlotMSPlots for plotms.
void detach()
Overrides PlotTool::detach().
Mode itsMode_
Current drawing mode.
virtual PlotFactory * factory() const
Returns a factory that can be used for generating implementation-specific classes, or NULL for none.
void clearAll(PlotCanvas *canvas=NULL)
PlotAreaFillPtr rectangleAreaFill() const
void clearText(PlotCanvas *canvas=NULL)
Clears all text/rectangle annotations off the given canvas.