casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RSUtils.qo.h
Go to the documentation of this file.
1 //# RSUtils.qo.h: Common utilities/constants for region shapes.
2 //# Copyright (C) 2008
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 RSUTILS_QO_H_
28 #define RSUTILS_QO_H_
29 
30 #include <QtGui>
31 
32 #include <QLineEdit>
33 #include <QComboBox>
34 #include <QHBoxLayout>
35 #include <QPushButton>
36 #include <casa/BasicSL/String.h>
41 
42 #include <casa/namespace.h>
43 
44 namespace casa {
45 
46  class QtColorWidget;
47 
48 // Common utilities/constants for region shapes.
49  class RSUtils {
50  public:
51  // Returns a new layout with the given parent, and calls setupLayout
52  // on it;
53  // <group>
54  static QHBoxLayout* hlayout(QWidget* parent = NULL);
55  static QVBoxLayout* vlayout(QWidget* parent = NULL);
56  // </group>
57 
58  // Sets up the given layout by setting:
59  // 1) margins to 0,
60  // 2) spacing to 3.
61  static void setupLayout(QLayout* layout);
62 
63  // Returns a horizontal or vertical line (QFrame).
64  // <group>
65  static QWidget* hline();
66  static QWidget* vline();
67  // </group>
68 
69  // Returns a new color widget. If margins and spacing are given, they are
70  // applied to the widget. If a frame is given, the widget is inserted into
71  // the frame.
72  static QtColorWidget* colorWidget(bool showButton = false,
73  casacore::String setColor = "",
74  QWidget* parent = NULL);
75 
76 
77  // Pixel coordinate system. Used for converting between different
78  // systems, etc.
79  static const casacore::String PIXEL;
80 
81 
82  // Returns whether or not the given coordinate system has a direction
83  // coordinate or not.
84  // <group>
85  static bool hasDirectionCoordinate(const DisplayCoordinateSystem& cs);
86  static bool hasDirectionCoordinate(const WorldCanvas* wc) {
87  return wc != NULL && hasDirectionCoordinate(wc->coordinateSystem());
88  }
89  static bool hasDirectionCoordinate(const WorldCanvasHolder& wch) {
91  }
92  // </group>
93 
94  // Returns the world system type for the given coordinate system.
96 
97  // Returns the world system type for the given WorldCanvas.
99  return worldSystem(wc->coordinateSystem());
100  }
101 
102  // Returns the world system type for the given WorldCanvasHolder.
104  return worldSystem(wch.worldCanvas()->coordinateSystem());
105  }
106 
107  // Converts between coordinate systems. The result has unit
108  // RegionShape::UNIT.
109  static bool convertWCS(const casacore::Quantum<casacore::Vector<double> >& from,
113 
114  // Converts the given coordinates between different systems, using the
115  // given WorldCanvas and world system (if applicable). casacore::Input world values
116  // are expected to have unit RegionShape::UNIT; output world values always
117  // have unit RegionShape::UNIT. Methods that have a "wrap" flag will check
118  // the sign of the values when converting between different world
119  // coordinate systems, and wrap the values to have the same sign. If
120  // a casacore::String is given, it will be used to record errors when the method
121  // returns false.
122  // <group>
123  static bool worldToPixel(const casacore::Quantum<casacore::Vector<double> >& worldX,
127  bool wrap = true, casacore::String* error = NULL);
128 
129  static bool pixelToWorld(const casacore::Vector<double>& pixelX,
130  const casacore::Vector<double>& pixelY,
134  bool wrap = true, casacore::String* error = NULL);
135 
136  static bool worldToLinear(const casacore::Quantum<casacore::Vector<double> >& worldX,
140  bool wrap = true, casacore::String* error = NULL);
141 
142  static bool pixelToLinear(const casacore::Vector<double>& pixelX,
143  const casacore::Vector<double>& pixelY,
145  WorldCanvasHolder& wch, casacore::String* error = NULL);
146 
147  static bool linearToScreen(const casacore::Vector<double>& linearX,
148  const casacore::Vector<double>& linearY,
150  WorldCanvasHolder& wch, casacore::String* error = NULL);
151 
156  bool wrap = true, casacore::String* error = NULL) {
157  casacore::Vector<double> linX(worldX.getValue().size()),
158  linY(worldY.getValue().size());
159  return worldToLinear(worldX, worldY, linX, linY, wch, fromSys, wrap,
160  error) && linearToScreen(linX,linY,screenX,screenY,wch,error);
161  }
162 
163  static bool pixelToScreen(const casacore::Vector<double>& pixelX,
164  const casacore::Vector<double>& pixelY,
166  WorldCanvasHolder& wch, casacore::String* error = NULL) {
167  casacore::Vector<double> linX(pixelX.size()), linY(pixelY.size());
168  return pixelToLinear(pixelX, pixelY, linX, linY, wch, error) &&
169  linearToScreen(linX, linY, screenX, screenY, wch, error);
170  }
171 
172  static bool screenToLinear(const casacore::Vector<double>& screenX,
173  const casacore::Vector<double>& screenY,
175  WorldCanvasHolder& wch, casacore::String* error = NULL);
176 
177  static bool linearToWorld(const casacore::Vector<double>& linearX,
178  const casacore::Vector<double>& linearY,
182  const std::vector<int>& xSign,const std::vector<int>& ySign,
183  bool wrap = true, casacore::String* error = NULL);
184 
185  static bool linearToWorld(const casacore::Vector<double>& linearX,
186  const casacore::Vector<double>& linearY,
190  casacore::String* error = NULL) {
191  return linearToWorld(linearX, linearY, worldX, worldY, wch, toSys,
192  std::vector<int>(), std::vector<int>(), false, error);
193  }
194 
195  static bool linearToPixel(const casacore::Vector<double>& linearX,
196  const casacore::Vector<double>& linearY,
198  WorldCanvasHolder& wch, casacore::String* error = NULL);
199 
200  static bool screenToWorld(const casacore::Vector<double>& screenX,
201  const casacore::Vector<double>& screenY,
205  casacore::String* error = NULL) {
206  casacore::Vector<double> linX(screenX.size()), linY(screenY.size());
207  return screenToLinear(screenX, screenY, linX, linY, wch) &&
208  linearToWorld(linX, linY, worldX, worldY, wch, toSys,
209  std::vector<int>(), std::vector<int>(), false, error);
210  }
211 
212  static bool screenToWorld(const casacore::Vector<double>& screenX,
213  const casacore::Vector<double>& screenY,
217  const std::vector<int>& xSign, const std::vector<int>& ySign,
218  casacore::String* error = NULL) {
219  casacore::Vector<double> linX(screenX.size()), linY(screenY.size());
220  return screenToLinear(screenX, screenY, linX, linY, wch) &&
221  linearToWorld(linX, linY, worldX, worldY, wch, toSys,
222  xSign, ySign, true, error);
223  }
224 
225  static bool screenToPixel(const casacore::Vector<double>& screenX,
226  const casacore::Vector<double>& screenY,
228  WorldCanvasHolder& wch, casacore::String* error = NULL) {
229  casacore::Vector<double> linX(screenX.size()), linY(screenY.size());
230  return screenToLinear(screenX, screenY, linX, linY, wch, error) &&
231  linearToPixel(linX, linY, pixelX, pixelY, wch, error);
232  }
233  // </group>
234 
235 
236  // Appends the given message to the given stream, if the stream does not
237  // already contain an identical message. Messages are newline-separated.
238  // <group>
239  static void appendUniqueMessage(stringstream& ss, const casacore::String& message);
240  static void appendUniqueMessage(stringstream* ss, const casacore::String& message) {
241  if(ss != NULL) appendUniqueMessage(*ss, message);
242  }
243  static void appendUniqueMessage(casacore::String& ss, const casacore::String& message);
244  static void appendUniqueMessage(casacore::String* ss, const casacore::String& message) {
245  if(ss != NULL) appendUniqueMessage(*ss, message);
246  }
247  // </group>
248  };
249 
250 
251 // A widget that lets the user select a color: either one from a list, or a
252 // custom color.
253  class QtColorWidget : public QHBoxLayout {
254  Q_OBJECT
255 
256  public:
257  // Constructor that uses default colors. If setText is nonempty, the
258  // chooser is set to the given. If showButton is true, a "pick" button
259  // is shown for picking colors.
260  QtColorWidget(bool showButton = false, casacore::String setText = "",
261  QWidget* parent = NULL);
262 
263  // Constructor that uses the given colors. If setText is nonempty, the
264  // chooser is set to the given. If showButton is true, a "pick" button
265  // is shown for picking colors.
266  QtColorWidget(const std::vector<casacore::String>& colors, bool showButton = false,
267  casacore::String setText = "", QWidget* parent = NULL);
268 
269  // Destructor.
270  ~QtColorWidget();
271 
272  // Returns the color that the user has chosen. This will either be from
273  // the initial list, or in "#000000" form (see QColor::name()).
274  casacore::String getColor() const;
275 
276  // Sets the displayed color to the given. If the color is in the colors
277  // list, that index will be selected -- otherwise it will be entered in
278  // the custom color box.
279  void setColor(const casacore::String& color);
280 
281 
282  // Returns default colors.
283  static std::vector<casacore::String> defaultColors() {
284  static std::vector<casacore::String> v(9);
285  v[0] = "white";
286  v[1] = "black";
287  v[2] = "red";
288  v[3] = "green";
289  v[4] = "blue";
290  v[5] = "cyan";
291  v[6] = "magenta";
292  v[7] = "yellow";
293  v[8] = "gray";
294  return v;
295  }
296 
297  private:
298  // Color chooser.
299  QComboBox* m_chooser;
300 
301  // Custom color.
302  QLineEdit* m_edit;
303 
304  // Picker button.
305  QPushButton* m_button;
306 
307  // Initializes GUI members.
308  void init(const std::vector<casacore::String>& colors, const casacore::String& setText,
309  bool showButton);
310 
311  private slots:
312  // For when the user picks a different color in the chooser.
313  void colorChanged(int index);
314 
315  // For when the user clicks the "pick" button.
316  void colorPick();
317  };
318 
319 
320 // Convenience class for the different units available for coordinates/sizes.
321 // Two modes: quantum and HMS/DMS (distinguished by the "isQuantum" flag).
322 // <ol><li>casacore::Quantum: consists of a value and a unit, stored in "val".</li>
323 // <li>HMS/DMS: consists of three values and two flags. Hours/degrees
324 // are stored in "hOrD", minutes are stored in "min", and seconds are
325 // stored in "sec". The "isHMS" flag distinguishes between HMS and
326 // DMS. The "isMinusZero" flag is used when "hOrD" is zero, but the
327 // whole value is negative.</li></ol>
328  class RSValue {
329  public:
330  RSValue(double d = 0) : isQuantum(true), isHMS(false), isMinusZero(false),
331  val(d, DEG), hOrD(0), min(0), sec(0) { }
332 
333  RSValue(double d, casacore::Unit u) : isQuantum(true), isHMS(false),
334  isMinusZero(false), val(d, u), hOrD(0), min(0), sec(0) { }
335 
336  RSValue(bool hms, long hd, long m, double s, bool minus = false) :
337  isQuantum(false), isHMS(hms), isMinusZero(minus), val(0, "_"),
338  hOrD(hd), min(m), sec(s) { }
339 
340  ~RSValue() { }
341 
342  bool isQuantum;
343  bool isHMS;
345 
347  long hOrD;
348  long min;
349  double sec;
350 
351 
352  // casacore::Conversion methods/constants //
353 
354  // Units constants.
355  // <group>
356  static const casacore::String DEG;
357  static const casacore::String RAD;
358  static const casacore::String ARCSEC;
359  static const casacore::String ARCMIN;
360  static const casacore::String HMS;
361  static const casacore::String DMS;
362  // </group>
363 
364  // Converts the value in the given QString in the given units to the given
365  // RSValue. The output RSValue is in degrees. fromUnits should either be:
366  // 1) HMS or DMS constants,
367  // 2) a relevant Unit.
368  static bool convertBetween(const QString& from, const casacore::String& fromUnits,
369  RSValue& to);
370 
371  // Converts the value in the given RSValue to the given QString, using the
372  // given precision for the doubles.
373  static bool convertBetween(const RSValue& from, QString& to,
374  int precision = -1);
375 
376  // Converts the value in the given RSValue to the give RSValue which uses
377  // the given units. toUnits should either be:
378  // 1) HMS or DMS constants,
379  // 2) a relevant Unit.
380  static bool convertBetween(const RSValue& from, RSValue& to,
381  const casacore::String& toUnits);
382  };
383 
384 
385 // Convenience class for a casacore::String, bool, or double.
386  class RSOption {
387  public:
388  // casacore::String constructor.
389  RSOption(const casacore::String& str);
390 
391  // bool constructor.
392  RSOption(bool b = false);
393 
394  // double constructor.
395  RSOption(double d);
396 
397  // casacore::String vector constructor.
398  RSOption(const std::vector<casacore::String>& v);
399 
400  // Destructor.
401  ~RSOption();
402 
403  // Type methods.
404  // <group>
405  bool isString() const;
406  bool isBool() const;
407  bool isDouble() const;
408  bool isStringArray() const;
409  // </group>
410 
411  // Value methods.
412  // <group>
413  const casacore::String& asString() const;
414  bool asBool() const;
415  double asDouble() const;
416  const std::vector<casacore::String>& asStringArray() const;
417  // </group>
418 
419  // Operators.
420  // <group>
421  bool operator==(const RSOption& other);
422  bool operator!=(const RSOption& other);
423  RSOption& operator=(const casacore::String& str);
424  RSOption& operator=(bool b);
425  RSOption& operator=(double d);
426  RSOption& operator=(const std::vector<casacore::String>& v);
427  // </group>
428 
429  private:
432  bool m_isBool;
433  bool m_bool;
435  double m_double;
437  std::vector<casacore::String> m_stringArray;
438  };
439 
440 
441 // A "handle" is a four-point structure (usually a rectangle) that describes
442 // the boundaries in screen pixels that a RegionShape takes on a canvas. In
443 // the future, this will be used for selecting/editing/moving/resizing shapes
444 // on the canvas using the mouse.
445  class RSHandle {
446  public:
447  // Defaults.
448  // <group>
449  static const int DEFAULT_MARKER_HEIGHT;
452  // </group>
453 
454  // Constructor which makes an invalid handle.
455  RSHandle();
456 
457  // Constructor which takes x and y vectors. x and y MUST be length 4 or
458  // the handle is invalid.
459  RSHandle(const std::vector<double>& x, const std::vector<double>& y,
460  int markerHeight = DEFAULT_MARKER_HEIGHT,
461  const casacore::String& markerColor = DEFAULT_MARKER_COLOR,
462  Display::Marker markerType = DEFAULT_MARKER_TYPE);
463 
464  // Constructor which takes x and y Vectors. x and y MUST be length 4 or
465  // the handle is invalid.
467  int markerHeight = DEFAULT_MARKER_HEIGHT,
468  const casacore::String& markerColor = DEFAULT_MARKER_COLOR,
469  Display::Marker markerType = DEFAULT_MARKER_TYPE);
470 
471  // Destructor.
472  ~RSHandle();
473 
474  // Gets/sets the marker height/color/type.
475  // <group>
476  int getMarkerHeight() const {
477  return m_markerHeight;
478  }
479  void setMarkerHeight(int height);
481  return m_markerColor;
482  }
485  return m_markerType;
486  }
488  // </group>
489 
490  // Returns whether the handle is valid (has four valid points) or not.
491  bool isValid() const {
492  return m_isValid;
493  }
494 
495  // Returns true if the handle is valid and the given point is inside.
496  bool containsPoint(double x, double y) const;
497 
498  // Gets the handle vertices coordinates and returns whether the operation
499  // succeeded or not (i.e. if the handle is valid). If it succeeded, x and
500  // y will be resize to be size 4 if necessary.
501  bool getVertices(std::vector<double>& x, std::vector<double>& y) const;
502 
503  // Draws the handles on the given canvas and returns whether the operation
504  // succeeded or not (i.e. if the handle is valid). If valid, each of the
505  // four points is drawn as a marker.
506  bool draw(PixelCanvas* canvas) const;
507 
508  private:
509  bool m_isValid;
510  std::vector<double> m_x, m_y;
514  };
515 
516 }
517 
518 #endif /* RSUTILS_H_ */
static casacore::MDirection::Types worldSystem(const DisplayCoordinateSystem &cs)
Returns the world system type for the given coordinate system.
static bool screenToLinear(const casacore::Vector< double > &screenX, const casacore::Vector< double > &screenY, casacore::Vector< double > &linearX, casacore::Vector< double > &linearY, WorldCanvasHolder &wch, casacore::String *error=NULL)
void setMarkerType(Display::Marker type)
bool asBool() const
Display::Marker getMarkerType() const
Definition: RSUtils.qo.h:484
static QHBoxLayout * hlayout(QWidget *parent=NULL)
Returns a new layout with the given parent, and calls setupLayout on it;.
static bool convertBetween(const QString &from, const casacore::String &fromUnits, RSValue &to)
Converts the value in the given QString in the given units to the given RSValue.
const casacore::String & asString() const
Value methods.
virtual WorldCanvas * worldCanvas() const
Return the WorldCanvas which is held by this WorldCanvasHolder.
A &quot;handle&quot; is a four-point structure (usually a rectangle) that describes the boundaries in screen pi...
Definition: RSUtils.qo.h:445
static std::vector< casacore::String > defaultColors()
Returns default colors.
Definition: RSUtils.qo.h:283
static bool hasDirectionCoordinate(const WorldCanvasHolder &wch)
Definition: RSUtils.qo.h:89
RSValue(double d=0)
Definition: RSUtils.qo.h:330
casacore::String getColor() const
Returns the color that the user has chosen.
static QWidget * vline()
const std::vector< casacore::String > & asStringArray() const
virtual Type type()
Return the type enum.
~RSOption()
Destructor.
void setMarkerHeight(int height)
Display::Marker m_markerType
Definition: RSUtils.qo.h:513
bool isBool() const
static bool screenToWorld(const casacore::Vector< double > &screenX, const casacore::Vector< double > &screenY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, casacore::MDirection::Types toSys, const std::vector< int > &xSign, const std::vector< int > &ySign, casacore::String *error=NULL)
Definition: RSUtils.qo.h:212
~QtColorWidget()
Destructor.
void setColor(const casacore::String &color)
Sets the displayed color to the given.
~RSHandle()
Destructor.
Convenience class for a casacore::String, bool, or double.
Definition: RSUtils.qo.h:386
static const casacore::String HMS
Definition: RSUtils.qo.h:360
static const casacore::String ARCMIN
Definition: RSUtils.qo.h:359
std::vector< double > m_y
Definition: RSUtils.qo.h:510
static bool hasDirectionCoordinate(const WorldCanvas *wc)
Definition: RSUtils.qo.h:86
static bool screenToWorld(const casacore::Vector< double > &screenX, const casacore::Vector< double > &screenY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, casacore::MDirection::Types toSys, casacore::String *error=NULL)
Definition: RSUtils.qo.h:200
RSOption & operator=(const casacore::String &str)
static bool pixelToLinear(const casacore::Vector< double > &pixelX, const casacore::Vector< double > &pixelY, casacore::Vector< double > &linearX, casacore::Vector< double > &linearY, WorldCanvasHolder &wch, casacore::String *error=NULL)
static QtColorWidget * colorWidget(bool showButton=false, casacore::String setColor="", QWidget *parent=NULL)
Returns a new color widget.
static const casacore::String RAD
Definition: RSUtils.qo.h:357
static void appendUniqueMessage(casacore::String *ss, const casacore::String &message)
Definition: RSUtils.qo.h:244
static const casacore::String DMS
Definition: RSUtils.qo.h:361
QComboBox * m_chooser
Color chooser.
Definition: RSUtils.qo.h:299
casacore::String getMarkerColor() const
Definition: RSUtils.qo.h:480
Base class defining interface to pixel-based output devices.
Definition: PixelCanvas.h:161
static bool linearToScreen(const casacore::Vector< double > &linearX, const casacore::Vector< double > &linearY, casacore::Vector< double > &screenX, casacore::Vector< double > &screenY, WorldCanvasHolder &wch, casacore::String *error=NULL)
QPushButton * m_button
Picker button.
Definition: RSUtils.qo.h:305
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
RSValue(double d, casacore::Unit u)
Definition: RSUtils.qo.h:333
defines physical units
Definition: Unit.h:189
QLineEdit * m_edit
Custom color.
Definition: RSUtils.qo.h:302
static casacore::MDirection::Types worldSystem(const WorldCanvas *wc)
Returns the world system type for the given WorldCanvas.
Definition: RSUtils.qo.h:98
void setMarkerColor(const casacore::String &color)
static bool pixelToScreen(const casacore::Vector< double > &pixelX, const casacore::Vector< double > &pixelY, casacore::Vector< double > &screenX, casacore::Vector< double > &screenY, WorldCanvasHolder &wch, casacore::String *error=NULL)
Definition: RSUtils.qo.h:163
void colorPick()
For when the user clicks the &quot;pick&quot; button.
bool draw(PixelCanvas *canvas) const
Draws the handles on the given canvas and returns whether the operation succeeded or not (i...
int getMarkerHeight() const
Gets/sets the marker height/color/type.
Definition: RSUtils.qo.h:476
static bool convertWCS(const casacore::Quantum< casacore::Vector< double > > &from, casacore::MDirection::Types fromSys, casacore::Quantum< casacore::Vector< double > > &to, casacore::MDirection::Types toSys)
Converts between coordinate systems.
static bool linearToWorld(const casacore::Vector< double > &linearX, const casacore::Vector< double > &linearY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, casacore::MDirection::Types toSys, casacore::String *error=NULL)
Definition: RSUtils.qo.h:185
bool getVertices(std::vector< double > &x, std::vector< double > &y) const
Gets the handle vertices coordinates and returns whether the operation succeeded or not (i...
QtColorWidget(bool showButton=false, casacore::String setText="", QWidget *parent=NULL)
Constructor that uses default colors.
bool operator==(const RSOption &other)
Operators.
RSHandle()
Constructor which makes an invalid handle.
A widget that lets the user select a color: either one from a list, or a custom color.
Definition: RSUtils.qo.h:253
static bool pixelToWorld(const casacore::Vector< double > &pixelX, const casacore::Vector< double > &pixelY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, casacore::MDirection::Types toSys, bool wrap=true, casacore::String *error=NULL)
static QWidget * hline()
Returns a horizontal or vertical line (QFrame).
static bool worldToPixel(const casacore::Quantum< casacore::Vector< double > > &worldX, const casacore::Quantum< casacore::Vector< double > > &worldY, casacore::Vector< double > &pixelX, casacore::Vector< double > &pixelY, WorldCanvasHolder &wch, casacore::MDirection::Types fromSys, bool wrap=true, casacore::String *error=NULL)
Converts the given coordinates between different systems, using the given WorldCanvas and world syste...
void colorChanged(int index)
For when the user picks a different color in the chooser.
bool isStringArray() const
casacore::String m_markerColor
Definition: RSUtils.qo.h:512
void init(const std::vector< casacore::String > &colors, const casacore::String &setText, bool showButton)
Initializes GUI members.
Quantities (i.e. dimensioned values)
Definition: QuantumHolder.h:44
static bool linearToPixel(const casacore::Vector< double > &linearX, const casacore::Vector< double > &linearY, casacore::Vector< double > &pixelX, casacore::Vector< double > &pixelY, WorldCanvasHolder &wch, casacore::String *error=NULL)
bool containsPoint(double x, double y) const
Returns true if the handle is valid and the given point is inside.
static bool hasDirectionCoordinate(const DisplayCoordinateSystem &cs)
Returns whether or not the given coordinate system has a direction coordinate or not.
const DisplayCoordinateSystem & coordinateSystem() const
RSValue(bool hms, long hd, long m, double s, bool minus=false)
Definition: RSUtils.qo.h:336
static QVBoxLayout * vlayout(QWidget *parent=NULL)
casacore::Quantum< double > val
Definition: RSUtils.qo.h:346
static void appendUniqueMessage(stringstream &ss, const casacore::String &message)
Appends the given message to the given stream, if the stream does not already contain an identical me...
double asDouble() const
double m_double
Definition: RSUtils.qo.h:435
static bool screenToPixel(const casacore::Vector< double > &screenX, const casacore::Vector< double > &screenY, casacore::Vector< double > &pixelX, casacore::Vector< double > &pixelY, WorldCanvasHolder &wch, casacore::String *error=NULL)
Definition: RSUtils.qo.h:225
static void setupLayout(QLayout *layout)
Sets up the given layout by setting: 1) margins to 0, 2) spacing to 3.
static bool worldToLinear(const casacore::Quantum< casacore::Vector< double > > &worldX, const casacore::Quantum< casacore::Vector< double > > &worldY, casacore::Vector< double > &linearX, casacore::Vector< double > &linearY, WorldCanvasHolder &wch, casacore::MDirection::Types fromSys, bool wrap=true, casacore::String *error=NULL)
casacore::String m_string
Definition: RSUtils.qo.h:431
bool isMinusZero
Definition: RSUtils.qo.h:344
bool operator!=(const RSOption &other)
A holder to interface between DisplayDatas and a WorldCanvas.
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
static const casacore::String DEFAULT_MARKER_COLOR
Definition: RSUtils.qo.h:450
static const casacore::String PIXEL
Pixel coordinate system.
Definition: RSUtils.qo.h:79
static const casacore::String ARCSEC
Definition: RSUtils.qo.h:358
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static void appendUniqueMessage(stringstream *ss, const casacore::String &message)
Definition: RSUtils.qo.h:240
bool isDouble() const
size_t size() const
Definition: ArrayBase.h:101
GRID LAYOUT CLASSES casacore::Coordinate for a grid layout
static bool worldToScreen(const casacore::Quantum< casacore::Vector< double > > &worldX, const casacore::Quantum< casacore::Vector< double > > &worldY, casacore::Vector< double > &screenX, casacore::Vector< double > &screenY, WorldCanvasHolder &wch, casacore::MDirection::Types fromSys, bool wrap=true, casacore::String *error=NULL)
Definition: RSUtils.qo.h:152
TableExprNode hms(const TableExprNode &node)
Functions for angle-values.
Definition: ExprNode.h:1510
std::vector< double > m_x
Definition: RSUtils.qo.h:510
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
static bool linearToWorld(const casacore::Vector< double > &linearX, const casacore::Vector< double > &linearY, casacore::Quantum< casacore::Vector< double > > &worldX, casacore::Quantum< casacore::Vector< double > > &worldY, WorldCanvasHolder &wch, casacore::MDirection::Types toSys, const std::vector< int > &xSign, const std::vector< int > &ySign, bool wrap=true, casacore::String *error=NULL)
RSOption(const casacore::String &str)
casacore::String constructor.
bool m_isStringArray
Definition: RSUtils.qo.h:436
bool isValid() const
Returns whether the handle is valid (has four valid points) or not.
Definition: RSUtils.qo.h:491
static const int DEFAULT_MARKER_HEIGHT
Defaults.
Definition: RSUtils.qo.h:449
bool isString() const
Type methods.
Common utilities/constants for region shapes.
Definition: RSUtils.qo.h:49
static const Display::Marker DEFAULT_MARKER_TYPE
Definition: RSUtils.qo.h:451
static casacore::MDirection::Types worldSystem(const WorldCanvasHolder &wch)
Returns the world system type for the given WorldCanvasHolder.
Definition: RSUtils.qo.h:103
static const casacore::String DEG
casacore::Conversion methods/constants //
Definition: RSUtils.qo.h:356
std::vector< casacore::String > m_stringArray
Definition: RSUtils.qo.h:437
Convenience class for the different units available for coordinates/sizes.
Definition: RSUtils.qo.h:328