8 #include "CurveStyles.h" 10 #include "EngaugeAssert.h" 11 #include "GraphicsLinesForCurve.h" 12 #include "GraphicsLinesForCurves.h" 13 #include "GraphicsPoint.h" 14 #include "GraphicsPointAbstractBase.h" 15 #include "GraphicsScene.h" 17 #include "LineStyle.h" 20 #include <QGraphicsItem> 21 #include <QPainterPath> 22 #include <QTextStream> 23 #include "QtToString.h" 24 #include "Transformation.h" 31 const QString &pointIdentifier,
35 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::addPoint" 36 <<
" curve=" << curveName.toLatin1().data()
37 <<
" identifier=" << pointIdentifier.toLatin1().data()
38 <<
" ordinal=" << ordinal
39 <<
" pos=" << QPointFToString (point.
pos()).toLatin1().data();
41 m_graphicsLinesForCurve [curveName]->addPoint (pointIdentifier,
47 const QStringList &curveNames)
49 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::addRemoveCurves" 50 <<
" curveCount=" << m_graphicsLinesForCurve.count();
53 QStringList::const_iterator itrC;
54 for (itrC = curveNames.begin (); itrC != curveNames.end (); itrC++) {
56 QString curveName = *itrC;
58 if (!m_graphicsLinesForCurve.contains (curveName)) {
63 m_graphicsLinesForCurve [curveName] = item;
68 GraphicsLinesContainer::const_iterator itrG, itrGNext;
69 for (itrG = m_graphicsLinesForCurve.begin (); itrG != m_graphicsLinesForCurve.end (); itrG = itrGNext) {
71 const QString curveName = itrG.key ();
77 if (!curveNames.contains (curveName)) {
80 m_graphicsLinesForCurve.remove (curveName);
87 QPainterPath &pathMultiValued,
90 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::lineMembershipPurge";
92 GraphicsLinesContainer::const_iterator itr;
93 for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
95 const QString curveName = itr.key ();
107 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::lineMembershipReset";
109 GraphicsLinesContainer::const_iterator itr;
110 for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
121 QTextStream str (&text);
124 std::cerr << text.toLatin1().data();
128 QTextStream &str)
const 130 str << indentation <<
"GraphicsLinesForCurves\n";
132 indentation += INDENTATION_DELTA;
134 GraphicsLinesContainer::const_iterator itr;
135 for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
146 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::removePoint" 147 <<
" point=" << identifier.toLatin1().data ()
148 <<
" curveCount=" << m_graphicsLinesForCurve.count();
152 ENGAUGE_ASSERT (m_graphicsLinesForCurve.contains (curveName));
153 double ordinal = m_graphicsLinesForCurve [curveName]->identifierToOrdinal (identifier);
154 m_graphicsLinesForCurve [curveName]->removePoint(ordinal);
159 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::removeTemporaryPointIfExists";
163 ENGAUGE_ASSERT (m_graphicsLinesForCurve.contains (curveName));
164 m_graphicsLinesForCurve [curveName]->removeTemporaryPointIfExists ();
169 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::resetOnLoad";
171 GraphicsLinesContainer::iterator itr;
172 for (itr = m_graphicsLinesForCurve.begin(); itr != m_graphicsLinesForCurve.end(); itr++) {
177 m_graphicsLinesForCurve.clear();
182 const QString &curveName,
186 LOG4CPP_DEBUG_S ((*mainCat)) <<
"GraphicsLinesForCurves::updateAfterCommand" 187 <<
" point=" << point.
identifier().toLatin1().data()
188 <<
" curveCount=" << m_graphicsLinesForCurve.count();
190 ENGAUGE_ASSERT (m_graphicsLinesForCurve.contains (curveName));
191 m_graphicsLinesForCurve [curveName]->updateAfterCommand (scene,
199 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::updateCurveStyles";
201 GraphicsLinesContainer::const_iterator itr;
202 for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
204 QString curveName = itr.key();
206 m_graphicsLinesForCurve [curveName]->updateCurveStyle (modelCurveStyles.
curveStyle (curveName));
212 QPainterPath &pathMultiValued,
215 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::updateGraphicsLinesToMatchGraphicsPoints";
217 GraphicsLinesContainer::const_iterator itr;
218 for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
220 QString curveName = itr.key();
223 if (curveName != AXIS_CURVE_NAME) {
225 m_graphicsLinesForCurve [curveName]->updateGraphicsLinesToMatchGraphicsPoints(curveStyles.
lineStyle (curveName),
235 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::updateHighlightOpacity" 236 <<
" highlightOpacity=" << highlightOpacity;
238 GraphicsLinesContainer::const_iterator itr;
239 for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
241 QString curveName = itr.key();
243 m_graphicsLinesForCurve [curveName]->updateHighlightOpacity (highlightOpacity);
250 LOG4CPP_INFO_S ((*mainCat)) <<
"GraphicsLinesForCurves::updatePointOrdinalsAfterDrag";
252 GraphicsLinesContainer::const_iterator itr;
253 for (itr = m_graphicsLinesForCurve.begin (); itr != m_graphicsLinesForCurve.end (); itr++) {
255 QString curveName = itr.key();
void updateGraphicsLinesToMatchGraphicsPoints(const CurveStyles &curveStyles, SplineDrawer &splineDrawer, QPainterPath &pathMultiValued, LineStyle &lineMultiValued)
Calls to moveLinesWithDraggedPoint have finished so update the lines correspondingly.
void removePoint(const QString &identifier)
Remove the specified point. The act of deleting it will automatically remove it from the GraphicsScen...
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
static QString curveNameFromPointIdentifier(const QString &pointIdentifier)
Parse the curve name from the specified point identifier. This does the opposite of uniqueIdentifierG...
void lineMembershipReset()
Mark points as unwanted. Afterwards, lineMembershipPurge gets called.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
QPointF pos() const
Proxy method for QGraphicsItem::pos.
GraphicsLinesForCurves()
Single constructor.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
void addPoint(const QString &curveName, const QString &pointIdentifier, double ordinal, GraphicsPoint &point)
Add new point.
void lineMembershipReset()
Mark points as unwanted. Afterwards, lineMembershipPurge gets called.
const PointStyle pointStyle(const QString &curveName) const
Get method for copying one point style. Cannot return just a reference or else there is a warning abo...
void removeTemporaryPointIfExists()
Remove temporary point if it exists.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Window that displays the geometry information, as a table, for the current curve.
static QString temporaryPointIdentifier()
Point identifier for temporary point that is used by DigitzeStateAxis.
void updateAfterCommand(GraphicsScene &scene, const CurveStyles &curveStyles, const QString &curveName, const Point &point, GeometryWindow *geometryWindow)
Update the GraphicsScene with the specified Point from the Document. If it does not exist yet in the ...
void updatePointOrdinalsAfterDrag(const CurveStyles &curveStyles, const Transformation &transformation)
See GraphicsScene::updateOrdinalsAfterDrag.
void updatePointOrdinalsAfterDrag(const LineStyle &lineStyle, const Transformation &transformation)
See GraphicsScene::updateOrdinalsAfterDrag. Pretty much the same steps as Curve::updatePointOrdinals.
This class stores the GraphicsLine objects for one Curve.
QString identifier() const
Unique identifier for a specific Point.
void lineMembershipPurge(const LineStyle &lineStyle, SplineDrawer &splineDrawer, QPainterPath &pathMultiValued, LineStyle &lineMultiValued)
Mark the end of addPoint calls. Remove stale lines, insert missing lines, and draw the graphics lines...
void print() const
Debugging method for printing directly from symbolic debugger.
const LineStyle lineStyle(const QString &curveName) const
Get method for copying one line style in one step.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Details for a specific Line.
void lineMembershipPurge(const CurveStyles &curveStyles, SplineDrawer &splineDrawer, QPainterPath &pathMultiValued, LineStyle &lineMultiValued)
Mark the end of addPoint calls. Remove stale lines, insert missing lines, and draw the graphics lines...
Graphics item for drawing a circular or polygonal Point.
void updateCurveStyles(const CurveStyles &modelCurveStyles)
Update the curve style for every curve.
Add point and line handling to generic QGraphicsScene.
This class takes the output from Spline and uses that to draw the curve in the graphics window,...
void resetOnLoad()
Reset, when loading a document after the first, to same state that first document was at when loaded.
void addRemoveCurves(GraphicsScene &scene, const QStringList &curveNames)
Add new curves and remove expired curves to match the specified list.
void updateHighlightOpacity(double highlightOpacity)
Update the highlight opacity value. This may or may not affect the current display immediately depend...