00001 /****************************************************************************************************** 00002 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * 00003 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * 00004 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * 00005 ******************************************************************************************************/ 00006 00007 #ifndef GRAPHICS_LINES_FOR_CURVE_H 00008 #define GRAPHICS_LINES_FOR_CURVE_H 00009 00010 #include "Point.h" 00011 #include "OrdinalToGraphicsPoint.h" 00012 #include <QGraphicsPathItem> 00013 00014 class CurveStyle; 00015 class GeometryWindow; 00016 class GraphicsPoint; 00017 class GraphicsScene; 00018 class LineStyle; 00019 class PointStyle; 00020 class QTestStream; 00021 class Transformation; 00022 00025 class GraphicsLinesForCurve : public QGraphicsPathItem 00026 { 00027 public: 00029 GraphicsLinesForCurve(const QString &curveName); 00030 ~GraphicsLinesForCurve(); 00031 00036 void addPoint (const QString &pointIdentifier, 00037 double ordinal, 00038 GraphicsPoint &point); 00039 00041 double identifierToOrdinal (const QString &identifier) const; 00042 00044 void lineMembershipPurge (const LineStyle &lineStyle); 00045 00047 void lineMembershipReset (); 00048 00050 void printStream (QString indentation, 00051 QTextStream &str) const; 00052 00054 void removePoint (double ordinal); 00055 00058 void removeTemporaryPointIfExists (); 00059 00061 void updateAfterCommand (GraphicsScene &scene, 00062 const PointStyle &pointStyle, 00063 const Point &point, 00064 GeometryWindow *geometryWindow); 00065 00067 void updateCurveStyle (const CurveStyle &curveStyle); 00068 00070 void updateGraphicsLinesToMatchGraphicsPoints (const LineStyle &lineStyle); 00071 00073 void updateHighlightOpacity (double highlightOpacity); 00074 00076 void updatePointOrdinalsAfterDrag (const LineStyle &lineStyle, 00077 const Transformation &transformation); 00078 00079 private: 00080 00081 QPainterPath drawLinesSmooth (); 00082 QPainterPath drawLinesStraight (); 00083 bool needOrdinalRenumbering () const; // True if m_graphicsPoints ordinal keys need renumbering 00084 void renumberOrdinals(); // Renumbers m_graphicsPoints ordinal keys 00085 00086 const QString m_curveName; 00087 OrdinalToGraphicsPoint m_graphicsPoints; 00088 }; 00089 00090 #endif // GRAPHICS_LINES_FOR_CURVE_H