casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DSMarker.h
Go to the documentation of this file.
1 //# DSMarker.h: Marker implementation for "DisplayShapes"
2 //# Copyright (C) 1998,1999,2000,2001,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_DSMARKER_H
29 #define TRIALDISPLAY_DSMARKER_H
30 
31 #include <casa/aips.h>
34 
35 #include <casa/Arrays/Vector.h>
36 #include <casa/Arrays/Matrix.h>
37 
38 
39 namespace casa { //# NAMESPACE CASA - BEGIN
40 
41  class PixelCanvas;
42  class DSPCMarker;
43  class DSWCMarker;
44 
45  template <class T> class DParameterRange;
46 
47 // <summary>
48 // Implementation of a marker.
49 // </summary>
50 //
51 // <prerequisite>
52 // <li> <linkto class="DSBasic">DSBasic</linkto>
53 // <li> <linkto class="Display">Display</linkto>
54 // <li> <linkto class="DisplayShape">DisplayShape</linkto>
55 // </prerequisite>
56 //
57 // <etymology>
58 // DSMarker is a method of managind the drawing of a marker onto a pixel
59 // canvas.
60 // </etymology>
61 //
62 // <synopsis>
63 // DSArrow simply extends from DSLine, and adds the management of a polygon
64 // to it. The polygon is used to represent the arrow head, and various options
65 // regarding its apppearance can be changed.
66 //
67 // There are generally two ways to make DisplayShape(s); To create them in
68 // "one hit" by providing arguments to the constructor, or by using the
69 // default constructor and then the "setOptions" method. A simple interface
70 // for all classes inheriting from the
71 // <linkto class="DisplayShape">DisplayShape</linkto> class is provided by
72 // <linkto class="DisplayShapeInterface">DisplayShapeInterface</linkto>.
73 // </synopsis>
74 //
75 // <motivation>
76 // A desire to have markers, similar to those used by PGPlot available as an
77 // annotation object. This wrapper is designed to make the management of
78 // drawing markers as primitives easier.
79 // </motivation>
80 //
81 // <example>
82 // <srcblock>
83 // </srcblock>
84 // </example>
85 
86 
87  class DSMarker : public DSBasic {
88 
89  public:
90 
91  // Constructors and destructor. See
92  // <linkto class="Display">Display</linkto> for a list of avaiable
93  // markers. Currently, all pixelHeights are changed to an even number,
94  // as odd sized markers tend to look funny. The pixelSize corresponds
95  // to the height of the marker in pixels.
96  // <group>
97  DSMarker();
98  DSMarker(const casacore::Float& xPos, const casacore::Float& yPos,
99  const Display::Marker& marker = Display::Square,
100  const casacore::uInt pixelSize = 10);
101  DSMarker(const casacore::Record& settings);
102 
103  DSMarker(const DSPCMarker& other);
104  DSMarker(const DSWCMarker& other);
105  DSMarker(const DSMarker& other);
106 
107  virtual ~DSMarker();
108  // </group>
109 
110  // Standard DisplayShape functions.
111  // <group>
112  virtual void move(const casacore::Float& dX, const casacore::Float& dY);
113  virtual void setCenter(const casacore::Float& xPos, const casacore::Float& yPos);
115  virtual void scale(const casacore::Float& scaleFactor);
116  virtual void draw(PixelCanvas* pc);
117  virtual casacore::Bool inObject(const casacore::Float& xPos, const casacore::Float& yPos);
118  // </group>
119 
120  virtual void setSize(const casacore::uInt newSize);
121 
122  // Get and set options.
123  // <group>
124  virtual casacore::Bool setOptions(const casacore::Record& settings);
125  virtual casacore::Record getOptions();
126  // </group>
127 
128  // Overload, since we never want to click on a marker (Well actually
129  // we might, but as yet we have no use, and sometimes people think that
130  // have clicked on a marker when actually they are on a handle. This
131  // makes it appear as though the marker isn't moving.
132  virtual casacore::Bool whichHandle(const casacore::Float& /*xPos*/, const casacore::Float& /*yPos*/,
133  casacore::Int& /*active*/) {
134  return false;
135  }
136 
137  // These functions do not apply for DSMarkers. They are here to ensure
138  // no strange behavior
139  // <group>
140  virtual void rotate(const casacore::Float& /*angle*/) {};
141  virtual void changePoint(const casacore::Vector<casacore::Float>& /*newPos*/) {};
142  virtual void changePoint(const casacore::Vector<casacore::Float>& /*newPoint*/,
143  const casacore::Int /*nPoint*/) {};
144  // </group>
145 
146  // virtual void recalculateScreenPosition();
147 
148  private:
149  // Set the default options. Called by default constructor.
150  virtual void setDefaultOptions();
151 
152  // Update location of single handle
153  void updateHandle();
154 
159 
162 
163  };
164 
165 } //# NAMESPACE CASA - END
166 
167 #endif
168 
int Int
Definition: aipstype.h:50
virtual ~DSMarker()
DParameterRange< casacore::Int > * itsSize
Definition: DSMarker.h:158
virtual void changePoint(const casacore::Vector< casacore::Float > &)
Changes the closest point to the supplied location to that location.
Definition: DSMarker.h:141
virtual casacore::Record getOptions()
Settings.
virtual void draw(PixelCanvas *pc)
Standard fns.
virtual void move(const casacore::Float &dX, const casacore::Float &dY)
Standard DisplayShape functions.
Display::Marker itsMarkerStyle
Definition: DSMarker.h:160
casacore::Bool itsBuiltHandle
Definition: DSMarker.h:157
virtual casacore::Bool whichHandle(const casacore::Float &, const casacore::Float &, casacore::Int &)
Overload, since we never want to click on a marker (Well actually we might, but as yet we have no use...
Definition: DSMarker.h:132
casacore::Bool itsValid
Definition: DSMarker.h:161
virtual void setCenter(const casacore::Float &xPos, const casacore::Float &yPos)
Sets the center of the DisplayShape.
DSMarker()
Constructors and destructor.
virtual void changePoint(const casacore::Vector< casacore::Float > &, const casacore::Int)
Changes the nth point making up the DisplayShape ot the specified location.
Definition: DSMarker.h:142
Base class defining interface to pixel-based output devices.
Definition: PixelCanvas.h:161
virtual casacore::Bool inObject(const casacore::Float &xPos, const casacore::Float &yPos)
Is the supplied point within the DisplayShape?
casacore::Matrix< casacore::Float > itsHandle
Definition: DSMarker.h:156
virtual void setSize(const casacore::uInt newSize)
void updateHandle()
Update location of single handle.
virtual void setDefaultOptions()
virtual void recalculateScreenPosition();
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
float Float
Definition: aipstype.h:54
A helper class to deal with data ranges to support options.
Definition: DSMarker.h:45
virtual casacore::Vector< casacore::Float > getCenter()
Returns the center of the DisplayShape (x,y).
virtual void scale(const casacore::Float &scaleFactor)
Scale the shape about its center by the scaleFactor.
virtual casacore::Bool setOptions(const casacore::Record &settings)
Get and set options.
Implementation of a marker.
Definition: DSMarker.h:87
Base class for all &quot;basic&quot; shapes.
Definition: DSBasic.h:68
unsigned int uInt
Definition: aipstype.h:51
virtual void rotate(const casacore::Float &)
These functions do not apply for DSMarkers.
Definition: DSMarker.h:140
casacore::Vector< casacore::Float > itsCenter
Definition: DSMarker.h:155