Engauge Digitizer  2
Public Member Functions | List of all members
GraphicsScene Class Reference

Add point and line handling to generic QGraphicsScene. More...

#include <GraphicsScene.h>

Inheritance diagram for GraphicsScene:

Public Member Functions

 GraphicsScene (MainWindow *mainWindow)
 Single constructor.
 
void addTemporaryPoint (const QString &identifier, GraphicsPoint *point)
 Add one temporary point to m_graphicsLinesForCurves. Non-temporary points are handled by the updateLineMembership functions.
 
void addTemporaryScaleBar (GraphicsPoint *point0, GraphicsPoint *point1, const QString &pointIdentifier0, const QString &pointIdentifier1)
 Add temporary scale bar to scene. More...
 
GraphicsPointcreatePoint (const QString &identifier, const PointStyle &pointStyle, const QPointF &posScreen, GeometryWindow *geometryWindow)
 Create one QGraphicsItem-based object that represents one Point. It is NOT added to m_graphicsLinesForCurves (see addPoint)
 
void hideAllItemsExceptImage ()
 Hide all graphics items, except background image, in preparation for preview during IMPORT_TYPE_ADVANCED.
 
QStringList positionHasChangedPointIdentifiers () const
 Return a list of identifiers for the points that have moved since the last call to resetPositionHasChanged.
 
void printStream (QString indentation, QTextStream &str)
 Debugging method that supports print method of this class and printStream method of some other class(es)
 
void removePoint (const QString &identifier)
 Remove specified point. This aborts if the point does not exist.
 
void removeTemporaryPointIfExists ()
 Remove temporary point if it exists. More...
 
void removeTemporaryScaleBarIfExists ()
 Remove temporary scale bar, composed of two points and the line between them.
 
void resetOnLoad ()
 Reset, when loading a document after the first, to same state that first document was at when loaded.
 
void resetPositionHasChangedFlags ()
 Reset positionHasChanged flag for all items. Typically this is done as part of mousePressEvent.
 
void showCurves (bool show, bool showAll=false, const QString &curveName="")
 Show or hide all Curves (if showAll is true) or just the selected Curve (if showAll is false);.
 
void updateAfterCommand (CmdMediator &cmdMediator, double highlightOpacity, GeometryWindow *geometryWindow)
 Update the Points and their Curves after executing a command. More...
 
void updateCurveStyles (const CurveStyles &modelCurveStyles)
 Update curve styles after settings changed.
 
void updateGraphicsLinesToMatchGraphicsPoints (const CurveStyles &modelCurveStyles, const Transformation &transformation)
 A mouse move has just occurred so move the selected points, since they were dragged. More...
 

Detailed Description

Add point and line handling to generic QGraphicsScene.

The primary tasks are:

  1. update the graphics items to stay in sync with the explicit Points in the Document
  2. update the graphics items to stay in sync with the implicit lines between the Points, according to Document settings

This class stores points and lines as QGraphicsItems, but also maintains identifier-to-QGraphicsItems mappings to the points and lines are accessible for updates (like when dragging points around and we need to update the attached lines).

Definition at line 33 of file GraphicsScene.h.

Member Function Documentation

◆ addTemporaryScaleBar()

void GraphicsScene::addTemporaryScaleBar ( GraphicsPoint point0,
GraphicsPoint point1,
const QString &  pointIdentifier0,
const QString &  pointIdentifier1 
)

Add temporary scale bar to scene.

The scale bar is different from points and lines (always a complete set of 2 points and one line, and drawn using different point and line styles) that it is handled outside m_graphisLinesForCurves

Definition at line 45 of file GraphicsScene.cpp.

◆ removeTemporaryPointIfExists()

void GraphicsScene::removeTemporaryPointIfExists ( )

Remove temporary point if it exists.

Temporary point handling is so complicated that this method quietly allows redundant calls to this method, without complaining that the point has already been removed when called again

Definition at line 187 of file GraphicsScene.cpp.

◆ updateAfterCommand()

void GraphicsScene::updateAfterCommand ( CmdMediator cmdMediator,
double  highlightOpacity,
GeometryWindow geometryWindow 
)

Update the Points and their Curves after executing a command.

After a mouse drag, the lines are already updated and updating would be done on out of date information (since that would be brought up to date by the NEXT command)

Definition at line 270 of file GraphicsScene.cpp.

◆ updateGraphicsLinesToMatchGraphicsPoints()

void GraphicsScene::updateGraphicsLinesToMatchGraphicsPoints ( const CurveStyles modelCurveStyles,
const Transformation transformation 
)

A mouse move has just occurred so move the selected points, since they were dragged.

The transformation is needed so the screen coordinates can be converted to graph coordinates when updating point ordinals

Definition at line 305 of file GraphicsScene.cpp.


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