Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions Circleoutline.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <opencv2/opencv.hpp>
#include <QJsonObject>
void fillCircle(cv::Mat &m, double cx, double cy, double rad, void *color);
class CircleOutline: public boundary
class CircleOutline final: public boundary
{
public:
CircleOutline();
Expand All @@ -35,7 +35,7 @@ class CircleOutline: public boundary
CircleOutline(const QJsonObject &obj);
void toJson(QJsonObject &obj);

virtual ~CircleOutline();
~CircleOutline();
void draw(QPainter& painter, double scale, double scale2 = -1.);
bool isInside(QPointF& p , int offset = 0);
bool isInside(double x, double y, int offset=0);
Expand All @@ -48,17 +48,15 @@ class CircleOutline: public boundary
double m_radius;
gPlus m_p1;
gPlus m_p2;
protected:

private:
};

class ellipseOutline: public boundary
class ellipseOutline final: public boundary
{
public:
ellipseOutline();
ellipseOutline(QPointF center, double minorAxis, double majorAxis);
ellipseOutline(QPointF left, QPointF right, double ecc);
void draw(QPainter& painter, double scale, double scale2 = -1.);
bool isInside(QPointF& p , int offset = 0);
void enlarge(int del);
void translate(QPointF del);
Expand All @@ -76,11 +74,12 @@ class ellipseOutline: public boundary
gPlus m_p2;
};

class rectangleOutline: public boundary
class rectangleOutline final: public boundary
{
public:
rectangleOutline();
rectangleOutline(QPointF upperLeft, QPointF lowerRight);
void draw(QPainter& painter, double scale, double scale2 = -1.);
bool isInside(QPointF& p , int offset = 0);
void enlarge(int del);
void translate(QPointF del);
Expand Down
13 changes: 11 additions & 2 deletions boundary.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,26 @@
#ifndef BOUNDARY_H
#define BOUNDARY_H
#include <QPainter>

// asbtract base class. Zero risk of slicing.
class boundary
{
protected:
boundary() = default;
~boundary() = default;
// Copy operations
boundary(const boundary&) = default;
boundary& operator=(const boundary&) = default;
// Move operations
boundary(boundary&&) noexcept = default;
boundary& operator=(boundary&&) noexcept = default;
public:
virtual ~boundary() {}
virtual void draw(QPainter& painter, double scale, double scale2 = -1.) = 0;
virtual void enlarge(int del) = 0;
virtual void translate(QPointF del) = 0;
virtual void scale(double factor) = 0;
virtual bool isValid() = 0;
virtual bool isInside(QPointF& p, int offset = 0) = 0;
protected:
private:
};
QDataStream & operator<<(QDataStream & stream, const boundary &outline);
Expand Down
2 changes: 1 addition & 1 deletion gplus.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class gPlus
public:
gPlus(QPointF p);
gPlus();
virtual ~gPlus();
~gPlus();
void draw(QPainter& dc, double scale, int size = 10);
QPointF m_p;
protected:
Expand Down
Loading