Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineProjectorAbstract Class Reference

Base class for Guideline projectors. More...

#include <GuidelineProjectorAbstract.h>

Inheritance diagram for GuidelineProjectorAbstract:
Inheritance graph
Collaboration diagram for GuidelineProjectorAbstract:
Collaboration graph

Public Member Functions

 GuidelineProjectorAbstract ()
 Single constructor.
 ~GuidelineProjectorAbstract ()

Protected Member Functions

void calculateCorners (const Transformation &transformation, const QRectF &sceneRect, QPointF &posGraphBL, QPointF &posGraphTL, QPointF &posGraphTR, QPointF &posGraphBR) const
 Conpute four corners of scene in graph coordinates.
bool isOutside (const QRectF &sceneRect, const QPointF &posScreen) const
 Return true if point is outside of the scene.

Detailed Description

Base class for Guideline projectors.

Definition at line 15 of file GuidelineProjectorAbstract.h.

Constructor & Destructor Documentation

◆ GuidelineProjectorAbstract()

GuidelineProjectorAbstract::GuidelineProjectorAbstract ( )

Single constructor.

Definition at line 12 of file GuidelineProjectorAbstract.cpp.

13{
14}

◆ ~GuidelineProjectorAbstract()

GuidelineProjectorAbstract::~GuidelineProjectorAbstract ( )

Definition at line 16 of file GuidelineProjectorAbstract.cpp.

17{
18}

Member Function Documentation

◆ calculateCorners()

void GuidelineProjectorAbstract::calculateCorners ( const Transformation & transformation,
const QRectF & sceneRect,
QPointF & posGraphBL,
QPointF & posGraphTL,
QPointF & posGraphTR,
QPointF & posGraphBR ) const
protected

Conpute four corners of scene in graph coordinates.

Definition at line 20 of file GuidelineProjectorAbstract.cpp.

26{
27 double width = sceneRect.width();
28 double height = sceneRect.height();
29
30 // Convert sceneRect to graph coordinates
31 QPointF posScreenBL (0, 0), posScreenTL (0, height), posScreenTR (width, height), posScreenBR (width, 0);
32
33 transformation.transformScreenToRawGraph (posScreenBL, posGraphBL);
34 transformation.transformScreenToRawGraph (posScreenTL, posGraphTL);
35 transformation.transformScreenToRawGraph (posScreenTR, posGraphTR);
36 transformation.transformScreenToRawGraph (posScreenBR, posGraphBR);
37}
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.

◆ isOutside()

bool GuidelineProjectorAbstract::isOutside ( const QRectF & sceneRect,
const QPointF & posScreen ) const
protected

Return true if point is outside of the scene.

Definition at line 39 of file GuidelineProjectorAbstract.cpp.

41{
42 double width = sceneRect.width();
43 double height = sceneRect.height();
44
45 QPointF posScreenBL (0, 0), posScreenTL (0, height), posScreenTR (width, height), posScreenBR (width, 0);
46
47 QPolygonF polygon;
48 polygon << posScreenBL << posScreenTL << posScreenTR << posScreenBR;
49
50 // Qt::OddEvenFill is faster and less accurate and Qt::WindingFill is slower and more accurate
51 return !polygon.containsPoint (posScreen,
52 Qt::WindingFill);
53}

The documentation for this class was generated from the following files: