casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QPShape.h
Go to the documentation of this file.
1 //# QPShape.h: Qwt implementation of generic PlotShape classes.
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 QPSHAPE_H_
28 #define QPSHAPE_H_
29 
30 #ifdef AIPS_HAS_QWT
31 
35 
36 #include <qwt_plot_item.h>
37 #include <qwt_plot_marker.h>
38 
39 namespace casa {
40 
41 // QPShape is the abstract superclass for any qwt-based shapes. It handles the
42 // common functionality like changing the QPen and QBrush.
43 class QPShape : public QPPlotItem, public virtual PlotShape {
44 public:
45  // Static //
46 
47  // Makes a copy of the given generic PlotShape into its Qwt-specific
48  // subclass and returns it, or NULL for an error (shouldn't happen).
49  static QPShape* clone(const PlotShape& copy);
50 
51 
52  // Non-Static //
53 
54  // Constructor.
55  QPShape();
56 
57  // Copy constructor which takes generic PlotShape. Will be called by copy
58  // constructors of children.
59  QPShape(const PlotShape& copy);
60 
61  // Destructor.
62  virtual ~QPShape();
63 
64 
65  // Include overloaded methods.
66  using PlotShape::setLine;
68 
69 
70  // QPPlotItem Methods //
71 
72 #if QWT_VERSION < 0x060000
73  // Overrides QwtPlotItem::legendItem().
74  virtual QWidget* legendItem() const;
75 #endif
76 
77  // PlotShape Methods //
78 
79  // Implements PlotShape::lineShown().
80  bool lineShown() const;
81 
82  // Implements PlotShape::setLineShown().
83  void setLineShown(bool line = true);
84 
85  // Implements PlotShape::line().
86  PlotLinePtr line() const;
87 
88  // Implements PlotShape::setLine().
89  void setLine(const PlotLine& line);
90 
91  // Implements PlotShape::areaFilled().
92  bool areaFilled() const;
93 
94  // Implements PlotShape::setAreaFilled().
95  void setAreaFilled(bool area = true);
96 
97  // Implements PlotShape::areaFill().
98  PlotAreaFillPtr areaFill() const;
99 
100  // Implements PlotShape::setAreaFill().
101  void setAreaFill(const PlotAreaFill& fill);
102 
103 protected:
104  QPLine m_line; // Line
105  QPAreaFill m_area; // Area fill
106 
107 
108  // Used for creating legend items.
109  virtual QwtSymbol::Style legendStyle() const = 0;
110 };
111 
112 
113 // Implementation of PlotShapeRectangle for Qwt plotter.
114 class QPRectangle : public QPShape, public PlotShapeRectangle {
115 public:
116  // Static //
117 
118  // Convenient access to class name (QPRectangle).
119  static const casacore::String CLASS_NAME;
120 
121 
122  // Non-Static //
123 
124  // Constructor which takes the upper-left and lower-right coordinates.
125  QPRectangle(const PlotCoordinate& upperLeft,
126  const PlotCoordinate& lowerRight);
127 
128  // Constructor which takes a QwtDoubleRect in world coordinates.
129  QPRectangle(const QwtDoubleRect& r);
130 
131  // Copy constructor for generic PlotShapeRectangle.
132  QPRectangle(const PlotShapeRectangle& copy);
133 
134  // Destructor.
135  ~QPRectangle();
136 
137 
138  // QPShape Methods //
139 
140  // Implements PlotItem::isValid().
141  bool isValid() const;
142 
143  // Overrides QwtPlotItem::boundingRect().
144  QwtDoubleRect boundingRect() const;
145 
146 
147  // PlotShapeRectangle Methods //
148 
149  // Implements PlotShape::coordinates().
150  std::vector<PlotCoordinate> coordinates() const;
151 
152  // Implements PlotShape::setCoordinates().
153  void setCoordinates(const std::vector<PlotCoordinate>& coords);
154 
155  // Implements PlotShapeRectangle::setRectCoordinates().
156  void setRectCoordinates(const PlotCoordinate& upperLeft,
157  const PlotCoordinate& lowerRight);
158 
159 protected:
160  // Implements QPPlotItem::className().
161  const casacore::String& className() const { return CLASS_NAME; }
162 
163  // Implements QPLayerItem::draw_(). Ignores draw index and count.
164 #if QWT_VERSION >= 0x060000
165  void draw_(QPainter* painter, const QwtScaleMap& xMap,
166  const QwtScaleMap& yMap, const QRectF& canvasRect,
167  unsigned int drawIndex, unsigned int drawCount) const;
168 #else
169  void draw_(QPainter* painter, const QwtScaleMap& xMap,
170  const QwtScaleMap& yMap, const QRect& canvasRect,
171  unsigned int drawIndex, unsigned int drawCount) const;
172 #endif
173 
174  // Implements QPShape::legendStyle().
175  QwtSymbol::Style legendStyle() const { return QwtSymbol::Rect; }
176 
177 
178 private:
179  PlotCoordinate m_upperLeft; // upper left coordinate
180  PlotCoordinate m_lowerRight; // lower right coordinate
181 };
182 
183 
184 // Implementation of PlotShapeEllipse for Qwt plotter.
185 class QPEllipse : public QPShape, public PlotShapeEllipse {
186 public:
187  // Static //
188 
189  // Convenient access to class name (QPEllipse).
190  static const casacore::String CLASS_NAME;
191 
192 
193  // Non-Static //
194 
195  // Constructor which takes the center and radii as PlotCoordinates.
196  QPEllipse(const PlotCoordinate& center, const PlotCoordinate& radii);
197 
198  // Constructor which uses the given QwtDoubleRect in world coordinates.
199  QPEllipse(const QwtDoubleRect& r);
200 
201  // Copy constructor for generic PlotShapeEllipse.
202  QPEllipse(const PlotShapeEllipse& copy);
203 
204  // Destructor.
205  ~QPEllipse();
206 
207 
208  // QPShape Methods //
209 
210  // Implements PlotItem::isValid().
211  bool isValid() const;
212 
213  // Overrides QwtPlotItem::boundingRect().
214  QwtDoubleRect boundingRect() const;
215 
216 
217  // PlotShapeEllipse Methods //
218 
219  // Implements PlotShape::coordinates().
220  std::vector<PlotCoordinate> coordinates() const;
221 
222  // Implements PlotShape::setCoordinates().
223  void setCoordinates(const std::vector<PlotCoordinate>& coords);
224 
225  // Implements PlotShapeEllipse::setEllipseCoordinates().
226  void setEllipseCoordinates(const PlotCoordinate& center,
227  const PlotCoordinate& radii);
228 
229  // Implements PlotShapeEllipse::radii().
230  PlotCoordinate radii() const;
231 
232  // Implements PlotShapeEllipse::setRadii().
233  void setRadii(const PlotCoordinate& radii);
234 
235  // Implements PlotShapeEllipse::center().
236  PlotCoordinate center() const;
237 
238  // Implements PlotShapeEllipse::setCenter().
239  void setCenter(const PlotCoordinate& center);
240 
241 protected:
242  // Implements QPPlotItem::className().
243  const casacore::String& className() const { return CLASS_NAME; }
244 
245  // Implements QPLayerItem::draw_(). Ignores draw index and count.
246 #if QWT_VERSION >= 0x060000
247  void draw_(QPainter* painter, const QwtScaleMap& xMap,
248  const QwtScaleMap& yMap, const QRectF& canvasRect,
249  unsigned int drawIndex, unsigned int drawCount) const;
250 #else
251  void draw_(QPainter* painter, const QwtScaleMap& xMap,
252  const QwtScaleMap& yMap, const QRect& canvasRect,
253  unsigned int drawIndex, unsigned int drawCount) const;
254 #endif
255 
256  // Implements QPShape::legendStyle().
257  QwtSymbol::Style legendStyle() const { return QwtSymbol::Ellipse; }
258 
259 private:
260  PlotCoordinate m_center; // Center
261  PlotCoordinate m_radii; // Radii
262 };
263 
264 
265 // Implementation of PlotShapePolygon for Qwt plotter.
266 class QPPolygon : public QPShape, public PlotShapePolygon {
267 public:
268  // Static //
269 
270  // Convenient access to class name (QPPolygon).
271  static const casacore::String CLASS_NAME;
272 
273 
274  // Non-Static //
275 
276  // Constructor which takes list of coordinates.
277  QPPolygon(const std::vector<PlotCoordinate>& coords);
278 
279  // Copy constructor for generic PlotShapePolygon.
280  QPPolygon(const PlotShapePolygon& copy);
281 
282  // Destructor.
283  ~QPPolygon();
284 
285 
286  // QPShape Methods //
287 
288  // Implements PlotItem::isValid().
289  bool isValid() const;
290 
291  // Overrides QwtPlotItem::boundingRect().
292  QwtDoubleRect boundingRect() const;
293 
294 
295  // PlotShapePolygon Methods //
296 
297  // Implements PlotShape::coordinates().
298  std::vector<PlotCoordinate> coordinates() const;
299 
300  // Implements PlotShape::setCoordinates().
301  void setCoordinates(const std::vector<PlotCoordinate>& coords);
302 
303 protected:
304  // Implements QPPlotItem::className().
305  const casacore::String& className() const { return CLASS_NAME; }
306 
307  // Implements QPLayerItem::draw_().
308 #if QWT_VERSION >= 0x060000
309  void draw_(QPainter* painter, const QwtScaleMap& xMap,
310  const QwtScaleMap& yMap, const QRectF& canvasRect,
311  unsigned int drawIndex, unsigned int drawCount) const;
312 #else
313  void draw_(QPainter* painter, const QwtScaleMap& xMap,
314  const QwtScaleMap& yMap, const QRect& canvasRect,
315  unsigned int drawIndex, unsigned int drawCount) const;
316 #endif
317 
318  // Implements QPShape::legendStyle().
319  QwtSymbol::Style legendStyle() const { return QwtSymbol::Hexagon; }
320 
321 private:
322  std::vector<PlotCoordinate> m_coords; // Coordinates
323 };
324 
325 
326 // Implementation of PlotShapeLine for Qwt plotter.
327 class QPLineShape : public QPShape, public PlotShapeLine {
328 public:
329  // Static //
330 
331  // Convenient access to class name (QPLineShape).
332  static const casacore::String CLASS_NAME;
333 
334 
335  // Non-Static //
336 
337  // Constructor which takes location in world coordinates and axis.
338  QPLineShape(double location, PlotAxis axis);
339 
340  // Copy constructor for generic PlotShapeLine.
341  QPLineShape(const PlotShapeLine& copy);
342 
343  // Destructor.
344  ~QPLineShape();
345 
346 
347  // QPShape Methods //
348 
349  // Implements PlotItem::isValid().
350  bool isValid() const;
351 
352  // Overrides QwtPlotItem::boundingRect().
353  QwtDoubleRect boundingRect() const;
354 
355 
356  // PlotShapeLine Methods //
357 
358  // Implements PlotShape::coordinates().
359  std::vector<PlotCoordinate> coordinates() const;
360 
361  // Implements PlotShape::setCoordinates().
362  void setCoordinates(const std::vector<PlotCoordinate>& coords);
363 
364  // Implements PlotShapeLine::setLineCoordinates().
365  void setLineCoordinates(double location, PlotAxis axis);
366 
367  // Implements PlotShapeLine::location().
368  double location() const;
369 
370  // Implements PlotShapeLine::axis().
371  PlotAxis axis() const;
372 
373 protected:
374  // Implements QPPlotItem::className().
375  const casacore::String& className() const { return CLASS_NAME; }
376 
377  // Implements QPLayerItem::draw_(). Ignores draw index and count.
378 #if QWT_VERSION >= 0x060000
379  void draw_(QPainter* painter, const QwtScaleMap& xMap,
380  const QwtScaleMap& yMap, const QRectF& canvasRect,
381  unsigned int drawIndex, unsigned int drawCount) const;
382 #else
383  void draw_(QPainter* painter, const QwtScaleMap& xMap,
384  const QwtScaleMap& yMap, const QRect& canvasRect,
385  unsigned int drawIndex, unsigned int drawCount) const;
386 #endif
387 
388  // Implements QPShape::legendStyle().
389  QwtSymbol::Style legendStyle() const { return QwtSymbol::HLine; }
390 
391 private:
392  QwtPlotMarker m_marker; // Marker
393  PlotAxis m_axis; // Axis
394 };
395 
396 
397 // Implementation of PlotShapeArrow for Qwt plotter.
398 class QPArrow : public QPShape, public PlotShapeArrow {
399 public:
400  // Static //
401 
402  // Convenient access to class name (QPArrow).
403  static const casacore::String CLASS_NAME;
404 
405  // Returns the two points necessary to make an arrow shape from the given
406  // point to the given point, with the given length. The two arrow points
407  // are at a 45 degree angle from the "from" point and the line between the
408  // point and the "from" point is equal to "length".
409  // <group>
410  static std::pair<QPointF, QPointF> arrowPoints(QPointF from, QPointF to,
411  double length);
412  static void arrowPoints(double x1, double y1, double x2, double y2,
413  double length, double& resX1, double& resY1,
414  double& resX2, double& resY2);
415  // </group>
416 
417 
418  // Non-Static //
419 
420  // Constructor which takes the two coordinates.
421  QPArrow(const PlotCoordinate& from, const PlotCoordinate& to);
422 
423  // Copy constructor for generic PlotshapeArrow.
424  QPArrow(const PlotShapeArrow& copy);
425 
426  // Destructor.
427  ~QPArrow();
428 
429 
430  // QPShape Methods //
431 
432  // Implements PlotItem::isValid().
433  bool isValid() const;
434 
435  // Overrides QwtPlotItem::boundingRect().
436  QwtDoubleRect boundingRect() const;
437 
438 
439  // PlotShapeArrow Methods //
440 
441  // Implements PlotShape::coordinates().
442  std::vector<PlotCoordinate> coordinates() const;
443 
444  // Implements PlotShape::setCoordinates().
445  void setCoordinates(const std::vector<PlotCoordinate>& coords);
446 
447  // Implements PlotShapeArrow::setArrowCoordinates().
448  void setArrowCoordinates(const PlotCoordinate& from,
449  const PlotCoordinate& to);
450 
451  // Implements PlotShapeArrow::arrowStyleFrom().
452  Style arrowStyleFrom() const;
453 
454  // Implements PlotShapeArrow::arrowStyleTo().
455  Style arrowStyleTo() const;
456 
457  // Implements PlotShapeArrow::setArrowStyleFrom().
458  void setArrowStyleFrom(Style style) { setArrowStyles(style, m_toStyle); }
459 
460  // Implements PlotShapeArrow::setArrowStyleTo().
461  void setArrowStyleTo(Style style) { setArrowStyles(m_fromStyle, style); }
462 
463  // Overrides PlotShapeArrow::setArrowStyles().
464  void setArrowStyles(Style from, Style to);
465 
466  // Implements PlotShapeArrow::arrowSize().
467  double arrowSize() const;
468 
469  // Implements PlotShapeArrow::setArrowSize().
470  void setArrowSize(double size);
471 
472 protected:
473  // Implements QPPlotItem::className().
474  const casacore::String& className() const { return CLASS_NAME; }
475 
476  // Implements QPLayerItem::draw_(). Ignores draw index and count.
477 #if QWT_VERSION >= 0x060000
478  void draw_(QPainter* painter, const QwtScaleMap& xMap,
479  const QwtScaleMap& yMap, const QRectF& canvasRect,
480  unsigned int drawIndex, unsigned int drawCount) const;
481 #else
482  void draw_(QPainter* painter, const QwtScaleMap& xMap,
483  const QwtScaleMap& yMap, const QRect& canvasRect,
484  unsigned int drawIndex, unsigned int drawCount) const;
485 #endif
486 
487  // Implements QPShape::legendStyle().
488  QwtSymbol::Style legendStyle() const { return QwtSymbol::HLine; }
489 
490 private:
491  PlotCoordinate m_from; // From point
492  PlotCoordinate m_to; // To point
493  Style m_fromStyle, m_toStyle; // Arrow styles
494  double m_size; // Arrow size
495 
496 
497  // Static //
498 
499  // Helper for arrowPoints. Calculates the points under the assumption that
500  // the arrow is pointing in an assumed direction, and then lets arrowPoints
501  // rotate/transform the results as needed.
502  static std::pair<QPointF, QPointF> arrowPointsHelper(QPointF p1, QPointF p2,
503  double length);
504 };
505 
506 
507 // Implementation of PlotShapePath for Qwt plotter.
508 class QPPath : public QPShape, public PlotShapePath {
509 public:
510  // Static //
511 
512  // Convenient access to class name (QPPath).
513  static const casacore::String CLASS_NAME;
514 
515 
516  // Non-Static //
517 
518  // Constructor which takes the points.
519  QPPath(const std::vector<PlotCoordinate>& points);
520 
521  // Copy constructor for generic PlotShapePath.
522  QPPath(const PlotShapePath& copy);
523 
524  // Destructor.
525  ~QPPath();
526 
527 
528  // QPShape Methods //
529 
530  // Implements PlotItem::isValid().
531  bool isValid() const;
532 
533  // Overrides QwtPlotItem::boundingRect().
534  QwtDoubleRect boundingRect() const;
535 
536 
537  // PlotShapePath Methods //
538 
539  // Implements PlotShape::coordinates().
540  std::vector<PlotCoordinate> coordinates() const;
541 
542  // Implements PlotShape::setCoordinates().
543  void setCoordinates(const std::vector<PlotCoordinate>& coords);
544 
545 protected:
546  // Implements QPPlotItem::className().
547  const casacore::String& className() const { return CLASS_NAME; }
548 
549  // Implements QPLayerItem::draw_().
550 #if QWT_VERSION >= 0x060000
551  void draw_(QPainter* painter, const QwtScaleMap& xMap,
552  const QwtScaleMap& yMap, const QRectF& canvasRect,
553  unsigned int drawIndex, unsigned int drawCount) const;
554 #else
555  void draw_(QPainter* painter, const QwtScaleMap& xMap,
556  const QwtScaleMap& yMap, const QRect& canvasRect,
557  unsigned int drawIndex, unsigned int drawCount) const;
558 #endif
559 
560  // Implements QPShape::legendStyle().
561  QwtSymbol::Style legendStyle() const { return QwtSymbol::HLine; }
562 
563 private:
564  std::vector<PlotCoordinate> m_coords; // Coordinates
565 };
566 
567 
568 // Implementation of PlotShapeArc for Qwt plotter.
569 class QPArc : public QPShape, public PlotShapeArc {
570 public:
571  // Static //
572 
573  // Convenient access to class name (QPArc).
574  static const casacore::String CLASS_NAME;
575 
576 
577  // Non-Static //
578 
579  // Constructor which takes the start coordinate, width, height, start
580  // angle, and span angle.
581  QPArc(const PlotCoordinate& start, const PlotCoordinate& widthHeight,
582  int startAngle, int spanAngle);
583 
584  // Copy constructor for generic PlotShapeArc.
585  QPArc(const PlotShapeArc& copy);
586 
587  // Destructor.
588  ~QPArc();
589 
590 
591  // Include overloaded methods.
593 
594 
595  // QPShape Methods //
596 
597  // Implements PlotItem::isValid().
598  bool isValid() const;
599 
600  // Overrides QwtPlotItem::boundingRect().
601  QwtDoubleRect boundingRect() const;
602 
603 
604  // PlotShapeArc Methods //
605 
606  // Implements PlotShape::coordinates().
607  std::vector<PlotCoordinate> coordinates() const;
608 
609  // Implements PlotShape::coordinates().
610  void setCoordinates(const std::vector<PlotCoordinate>& coords);
611 
612  // Implements PlotShapeArc::startCoordinate().
613  PlotCoordinate startCoordinate() const;
614 
615  // Implements PlotShapeArc::setStartCoordinate().
616  void setStartCoordinate(const PlotCoordinate& coord);
617 
618  // Implements PlotShapeArc::widthHeight().
619  PlotCoordinate widthHeight() const;
620 
621  // Implements PlotShapeArc::setWidthHeight().
622  void setWidthHeight(const PlotCoordinate& widthHeight);
623 
624  // Implements PlotShapeArc::startAngle().
625  int startAngle() const;
626 
627  // Implements PlotShapeArc::setStartAngle().
628  void setStartAngle(int startAngle);
629 
630  // Implements PlotShapeArc::spanAngle().
631  int spanAngle() const;
632 
633  // Implements PlotShapeArc::setSpanAngle().
634  void setSpanAngle(int spanAngle);
635 
636  // Implements PlotShapeArc::orientation().
637  int orientation() const;
638 
639  // Implements PlotShapeArc::setOrientation().
640  void setOrientation(int o);
641 
642 protected:
643  // Implements QPPlotItem::className().
644  const casacore::String& className() const { return CLASS_NAME; }
645 
646  // Implements QPLayerItem::draw_(). Ignores draw index and count.
647 #if QWT_VERSION >= 0x060000
648  void draw_(QPainter* painter, const QwtScaleMap& xMap,
649  const QwtScaleMap& yMap, const QRectF& canvasRect,
650  unsigned int drawIndex, unsigned int drawCount) const;
651 #else
652  void draw_(QPainter* painter, const QwtScaleMap& xMap,
653  const QwtScaleMap& yMap, const QRect& canvasRect,
654  unsigned int drawIndex, unsigned int drawCount) const;
655 #endif
656 
657  // Implements QPShape::legendStyle().
658  QwtSymbol::Style legendStyle() const { return QwtSymbol::HLine; }
659 
660 private:
661  PlotCoordinate m_start; // Start coordinate
662  PlotCoordinate m_size; // Width and height
663  int m_startAngle; // Start angle
664  int m_spanAngle; // Span angle
665  int m_orient; // Orientation
666 };
667 
668 
669 // Implementation of PlotPoint for Qwt plotter.
670 class QPPoint : public QPPlotItem, public PlotPoint {
671 public:
672  // Static //
673 
674  // Convenient access to class name (QPPoint).
675  static const casacore::String CLASS_NAME;
676 
677 
678  // Non-Static //
679 
680  // Constructors which take the location and symbol.
681  // <group>
682  QPPoint(const PlotCoordinate& coordinate, const PlotSymbol& symbol);
683  QPPoint(const PlotCoordinate& coordinate, const PlotSymbolPtr symbol);
684  QPPoint(const PlotCoordinate& coordinate,
686  // </group>
687 
688  // Copy constructor for generic PlotPoint.
689  QPPoint(const PlotPoint& copy);
690 
691  // Destructor.
692  ~QPPoint();
693 
694 
695  // Include overloaded methods.
696  using PlotPoint::setSymbol;
697 
698 
699  // QPPlotItem Methods //
700 
701  // Implements PlotItem::isValid().
702  bool isValid() const { return true; }
703 
704  // Overrides QwtPlotItem::boundingRect();
705  QwtDoubleRect boundingRect() const;
706 
707 #if QWT_VERSION < 0x060000
708  // Overrides QwtPlotItem::legendItem().
709  QWidget* legendItem() const;
710 #endif
711 
712  // PlotPoint Methods //
713 
714  // Implements PlotPoint::coordinate().
715  PlotCoordinate coordinate() const;
716 
717  // Implements PlotPoint::setCoordinate().
718  void setCoordinate(const PlotCoordinate& coordinate);
719 
720  // Implements PlotPoint::symbol().
721  PlotSymbolPtr symbol() const;
722 
723  // Implements PlotPoint::setSymbol().
724  void setSymbol(const PlotSymbol& symbol);
725 
726 protected:
727  // Implements QPPlotItem::className().
728  const casacore::String& className() const { return CLASS_NAME; }
729 
730  // Implements QPLayerItem::draw_(). Ignores draw index and count.
731 #if QWT_VERSION >= 0x060000
732  void draw_(QPainter* painter, const QwtScaleMap& xMap,
733  const QwtScaleMap& yMap, const QRectF& canvasRect,
734  unsigned int drawIndex, unsigned int drawCount) const;
735 #else
736  void draw_(QPainter* painter, const QwtScaleMap& xMap,
737  const QwtScaleMap& yMap, const QRect& canvasRect,
738  unsigned int drawIndex, unsigned int drawCount) const;
739 #endif
740 
741 private:
742  QPSymbol m_symbol; // symbol
743  PlotCoordinate m_coord; // location
744 };
745 
746 }
747 
748 #else
749 
750 #include <QPointF>
751 #include <utility>
752 
753 using namespace std;
754 
755 namespace casa {
756 
757 // Used by the viewer's region shapes, so have it outside the ifdefs in case
758 // the flag isn't on.
759 class QPArrow {
760 public:
761  static std::pair<QPointF, QPointF> arrowPoints(QPointF from, QPointF to,
762  double length);
763 
764  static void arrowPoints(double x1, double y1, double x2, double y2,
765  double length, double& resX1, double& resY1,
766  double& resX2, double& resY2);
767 
768 private:
769  static std::pair<QPointF, QPointF> arrowPointsHelper(QPointF p1, QPointF p2,
770  double length);
771 };
772 
773 }
774 
775 #endif
776 
777 #endif /*QPSHAPE_H_*/
virtual void setAreaFill(const PlotAreaFill &fill)=0
Sets this shape&#39;s area fill to the given.
casacore::CountedPtr< PlotAreaFill > PlotAreaFillPtr
Definition: PlotOptions.h:364
StatsData< AccumType > copy(const StatsData< AccumType > &stats)
static bool arrowPointsHelper(double x1, double y1, double x2, double y2, double length, double &resX1, double &resY1, double &resX2, double &resY2)
Helper for arrowPoints.
casacore::CountedPtr< PlotLine > PlotLinePtr
Definition: PlotOptions.h:446
Used by the viewer&#39;s region shapes, so have it outside the ifdefs in case the flag isn&#39;t on...
Definition: QPShape.h:759
virtual void setSymbol(const PlotSymbolPtr symbol)
Definition: PlotShape.h:356
virtual void setWidthHeight(double width, double height)
Sets the width and height to the given.
Definition: PlotShape.h:295
size_t size() const
static bool arrowPoints(double x1, double y1, double x2, double y2, double length, double &resX1, double &resY1, double &resX2, double &resY2)
Generates arrow points based on the given (x1, y1) (x2, y2) points.
virtual void setLine(const PlotLine &line)=0
Sets this shape&#39;s line to the given.
static std::pair< QPointF, QPointF > arrowPoints(QPointF from, QPointF to, double length)
static std::pair< QPointF, QPointF > arrowPointsHelper(QPointF p1, QPointF p2, double length)
casacore::CountedPtr< PlotSymbol > PlotSymbolPtr
Definition: PlotOptions.h:604
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
SMART POINTER DEFINITIONS PlotShape
Definition: PlotShape.h:374
PlotAxis
Enum for the four plot axes.
Definition: PlotOptions.h:62
casacore::Bool clone(const casacore::String &imageName, const casacore::String &newImageName)
virtual void setSymbol(const PlotSymbol &symbol)=0
Sets the symbol used to draw the point.
Symbol
Static //.
Definition: PlotOptions.h:456
String: the storage and methods of handling collections of characters.
Definition: String.h:223