36 #include <qwt_plot_item.h>
37 #include <qwt_plot_marker.h>
43 class QPShape :
public QPPlotItem,
public virtual PlotShape {
72 #if QWT_VERSION < 0x060000
74 virtual QWidget* legendItem()
const;
80 bool lineShown()
const;
83 void setLineShown(
bool line =
true);
89 void setLine(
const PlotLine& line);
92 bool areaFilled()
const;
95 void setAreaFilled(
bool area =
true);
101 void setAreaFill(
const PlotAreaFill& fill);
109 virtual QwtSymbol::Style legendStyle()
const = 0;
114 class QPRectangle :
public QPShape,
public PlotShapeRectangle {
125 QPRectangle(
const PlotCoordinate& upperLeft,
126 const PlotCoordinate& lowerRight);
129 QPRectangle(
const QwtDoubleRect& r);
132 QPRectangle(
const PlotShapeRectangle&
copy);
141 bool isValid()
const;
144 QwtDoubleRect boundingRect()
const;
150 std::vector<PlotCoordinate> coordinates()
const;
153 void setCoordinates(
const std::vector<PlotCoordinate>& coords);
156 void setRectCoordinates(
const PlotCoordinate& upperLeft,
157 const PlotCoordinate& lowerRight);
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;
169 void draw_(QPainter* painter,
const QwtScaleMap& xMap,
170 const QwtScaleMap& yMap,
const QRect& canvasRect,
171 unsigned int drawIndex,
unsigned int drawCount)
const;
175 QwtSymbol::Style legendStyle()
const {
return QwtSymbol::Rect; }
179 PlotCoordinate m_upperLeft;
180 PlotCoordinate m_lowerRight;
185 class QPEllipse :
public QPShape,
public PlotShapeEllipse {
196 QPEllipse(
const PlotCoordinate& center,
const PlotCoordinate& radii);
199 QPEllipse(
const QwtDoubleRect& r);
202 QPEllipse(
const PlotShapeEllipse&
copy);
211 bool isValid()
const;
214 QwtDoubleRect boundingRect()
const;
220 std::vector<PlotCoordinate> coordinates()
const;
223 void setCoordinates(
const std::vector<PlotCoordinate>& coords);
226 void setEllipseCoordinates(
const PlotCoordinate& center,
227 const PlotCoordinate& radii);
230 PlotCoordinate radii()
const;
233 void setRadii(
const PlotCoordinate& radii);
236 PlotCoordinate center()
const;
239 void setCenter(
const PlotCoordinate& center);
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;
251 void draw_(QPainter* painter,
const QwtScaleMap& xMap,
252 const QwtScaleMap& yMap,
const QRect& canvasRect,
253 unsigned int drawIndex,
unsigned int drawCount)
const;
257 QwtSymbol::Style legendStyle()
const {
return QwtSymbol::Ellipse; }
260 PlotCoordinate m_center;
261 PlotCoordinate m_radii;
266 class QPPolygon :
public QPShape,
public PlotShapePolygon {
277 QPPolygon(
const std::vector<PlotCoordinate>& coords);
280 QPPolygon(
const PlotShapePolygon&
copy);
289 bool isValid()
const;
292 QwtDoubleRect boundingRect()
const;
298 std::vector<PlotCoordinate> coordinates()
const;
301 void setCoordinates(
const std::vector<PlotCoordinate>& coords);
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;
313 void draw_(QPainter* painter,
const QwtScaleMap& xMap,
314 const QwtScaleMap& yMap,
const QRect& canvasRect,
315 unsigned int drawIndex,
unsigned int drawCount)
const;
319 QwtSymbol::Style legendStyle()
const {
return QwtSymbol::Hexagon; }
322 std::vector<PlotCoordinate> m_coords;
327 class QPLineShape :
public QPShape,
public PlotShapeLine {
338 QPLineShape(
double location,
PlotAxis axis);
341 QPLineShape(
const PlotShapeLine&
copy);
350 bool isValid()
const;
353 QwtDoubleRect boundingRect()
const;
359 std::vector<PlotCoordinate> coordinates()
const;
362 void setCoordinates(
const std::vector<PlotCoordinate>& coords);
365 void setLineCoordinates(
double location,
PlotAxis axis);
368 double location()
const;
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;
383 void draw_(QPainter* painter,
const QwtScaleMap& xMap,
384 const QwtScaleMap& yMap,
const QRect& canvasRect,
385 unsigned int drawIndex,
unsigned int drawCount)
const;
389 QwtSymbol::Style legendStyle()
const {
return QwtSymbol::HLine; }
392 QwtPlotMarker m_marker;
398 class QPArrow :
public QPShape,
public PlotShapeArrow {
410 static std::pair<QPointF, QPointF>
arrowPoints(QPointF from, QPointF to,
412 static void arrowPoints(
double x1,
double y1,
double x2,
double y2,
413 double length,
double& resX1,
double& resY1,
414 double& resX2,
double& resY2);
421 QPArrow(
const PlotCoordinate& from,
const PlotCoordinate& to);
424 QPArrow(
const PlotShapeArrow&
copy);
433 bool isValid()
const;
436 QwtDoubleRect boundingRect()
const;
442 std::vector<PlotCoordinate> coordinates()
const;
445 void setCoordinates(
const std::vector<PlotCoordinate>& coords);
448 void setArrowCoordinates(
const PlotCoordinate& from,
449 const PlotCoordinate& to);
452 Style arrowStyleFrom()
const;
455 Style arrowStyleTo()
const;
458 void setArrowStyleFrom(Style style) { setArrowStyles(style, m_toStyle); }
461 void setArrowStyleTo(Style style) { setArrowStyles(m_fromStyle, style); }
464 void setArrowStyles(Style from, Style to);
467 double arrowSize()
const;
470 void setArrowSize(
double size);
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;
482 void draw_(QPainter* painter,
const QwtScaleMap& xMap,
483 const QwtScaleMap& yMap,
const QRect& canvasRect,
484 unsigned int drawIndex,
unsigned int drawCount)
const;
488 QwtSymbol::Style legendStyle()
const {
return QwtSymbol::HLine; }
491 PlotCoordinate m_from;
493 Style m_fromStyle, m_toStyle;
508 class QPPath :
public QPShape,
public PlotShapePath {
519 QPPath(
const std::vector<PlotCoordinate>& points);
522 QPPath(
const PlotShapePath&
copy);
531 bool isValid()
const;
534 QwtDoubleRect boundingRect()
const;
540 std::vector<PlotCoordinate> coordinates()
const;
543 void setCoordinates(
const std::vector<PlotCoordinate>& coords);
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;
555 void draw_(QPainter* painter,
const QwtScaleMap& xMap,
556 const QwtScaleMap& yMap,
const QRect& canvasRect,
557 unsigned int drawIndex,
unsigned int drawCount)
const;
561 QwtSymbol::Style legendStyle()
const {
return QwtSymbol::HLine; }
564 std::vector<PlotCoordinate> m_coords;
569 class QPArc :
public QPShape,
public PlotShapeArc {
581 QPArc(
const PlotCoordinate& start,
const PlotCoordinate& widthHeight,
582 int startAngle,
int spanAngle);
585 QPArc(
const PlotShapeArc&
copy);
598 bool isValid()
const;
601 QwtDoubleRect boundingRect()
const;
607 std::vector<PlotCoordinate> coordinates()
const;
610 void setCoordinates(
const std::vector<PlotCoordinate>& coords);
613 PlotCoordinate startCoordinate()
const;
616 void setStartCoordinate(
const PlotCoordinate& coord);
619 PlotCoordinate widthHeight()
const;
622 void setWidthHeight(
const PlotCoordinate& widthHeight);
625 int startAngle()
const;
628 void setStartAngle(
int startAngle);
631 int spanAngle()
const;
634 void setSpanAngle(
int spanAngle);
637 int orientation()
const;
640 void setOrientation(
int o);
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;
652 void draw_(QPainter* painter,
const QwtScaleMap& xMap,
653 const QwtScaleMap& yMap,
const QRect& canvasRect,
654 unsigned int drawIndex,
unsigned int drawCount)
const;
658 QwtSymbol::Style legendStyle()
const {
return QwtSymbol::HLine; }
661 PlotCoordinate m_start;
662 PlotCoordinate m_size;
670 class QPPoint :
public QPPlotItem,
public PlotPoint {
682 QPPoint(
const PlotCoordinate& coordinate,
const PlotSymbol& symbol);
683 QPPoint(
const PlotCoordinate& coordinate,
const PlotSymbolPtr symbol);
684 QPPoint(
const PlotCoordinate& coordinate,
689 QPPoint(
const PlotPoint&
copy);
702 bool isValid()
const {
return true; }
705 QwtDoubleRect boundingRect()
const;
707 #if QWT_VERSION < 0x060000
709 QWidget* legendItem()
const;
715 PlotCoordinate coordinate()
const;
718 void setCoordinate(
const PlotCoordinate& coordinate);
724 void setSymbol(
const PlotSymbol& symbol);
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;
736 void draw_(QPainter* painter,
const QwtScaleMap& xMap,
737 const QwtScaleMap& yMap,
const QRect& canvasRect,
738 unsigned int drawIndex,
unsigned int drawCount)
const;
743 PlotCoordinate m_coord;
761 static std::pair<QPointF, QPointF>
arrowPoints(QPointF from, QPointF to,
764 static void arrowPoints(
double x1,
double y1,
double x2,
double y2,
765 double length,
double& resX1,
double& resY1,
766 double& resX2,
double& resY2);
virtual void setAreaFill(const PlotAreaFill &fill)=0
Sets this shape's area fill to the given.
casacore::CountedPtr< PlotAreaFill > PlotAreaFillPtr
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
Used by the viewer's region shapes, so have it outside the ifdefs in case the flag isn't on...
virtual void setSymbol(const PlotSymbolPtr symbol)
virtual void setWidthHeight(double width, double height)
Sets the width and height to the given.
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'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
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
SMART POINTER DEFINITIONS PlotShape
PlotAxis
Enum for the four plot axes.
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.
String: the storage and methods of handling collections of characters.