This class stores the GraphicsLine objects for one Curve.
More...
#include <GraphicsLinesForCurve.h>
|
| | GraphicsLinesForCurve (const QString &curveName) |
| | Single constructor. More...
|
| |
| | ~GraphicsLinesForCurve () |
| |
| void | addPoint (const QString &pointIdentifier, double ordinal, GraphicsPoint &point) |
| | Add new line. More...
|
| |
| double | identifierToOrdinal (const QString &identifier) const |
| | Get ordinal for specified identifier. More...
|
| |
| 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. More...
|
| |
| void | lineMembershipReset () |
| | Mark points as unwanted. Afterwards, lineMembershipPurge gets called. More...
|
| |
| void | printStream (QString indentation, QTextStream &str) const |
| | Debugging method that supports print method of this class and printStream method of some other class(es) More...
|
| |
| void | removePoint (double ordinal) |
| | Remove the specified point. The act of deleting it will automatically remove it from the GraphicsScene. More...
|
| |
| void | removeTemporaryPointIfExists () |
| | Remove temporary point if it exists. More...
|
| |
| void | updateAfterCommand (GraphicsScene &scene, const PointStyle &pointStyle, const Point &point, GeometryWindow *geometryWindow) |
| | Update the GraphicsScene with the specified Point from the Document. If it does not exist yet in the scene, we add it. More...
|
| |
| void | updateCurveStyle (const CurveStyle &curveStyle) |
| | Update the curve style for this curve. More...
|
| |
| void | updateGraphicsLinesToMatchGraphicsPoints (const LineStyle &lineStyle, SplineDrawer &splineDrawer, QPainterPath &pathMultiValued, LineStyle &lineMultiValued) |
| | Calls to moveLinesWithDraggedPoint have finished so update the lines correspondingly. More...
|
| |
| void | updateHighlightOpacity (double highlightOpacity) |
| | Update the highlight opacity value. This may or may not affect the current display immediately depending on the state. More...
|
| |
| void | updatePointOrdinalsAfterDrag (const LineStyle &lineStyle, const Transformation &transformation) |
| | See GraphicsScene::updateOrdinalsAfterDrag. Pretty much the same steps as Curve::updatePointOrdinals. More...
|
| |
This class stores the GraphicsLine objects for one Curve.
The container is a QMap since that container maintains order by key
Definition at line 26 of file GraphicsLinesForCurve.h.
◆ GraphicsLinesForCurve()
| GraphicsLinesForCurve::GraphicsLinesForCurve |
( |
const QString & |
curveName | ) |
|
◆ ~GraphicsLinesForCurve()
| GraphicsLinesForCurve::~GraphicsLinesForCurve |
( |
| ) |
|
Definition at line 44 of file GraphicsLinesForCurve.cpp.
46 OrdinalToGraphicsPoint::iterator itr;
47 for (itr = m_graphicsPoints.begin(); itr != m_graphicsPoints.end(); itr++) {
52 m_graphicsPoints.clear();
◆ addPoint()
| void GraphicsLinesForCurve::addPoint |
( |
const QString & |
pointIdentifier, |
|
|
double |
ordinal, |
|
|
GraphicsPoint & |
point |
|
) |
| |
Add new line.
The GraphicsPoint arguments are not const since this line binds to the points, so dragging points also drags the lines. The ordinal is already in the GraphicsPoint as DATA_KEY_ORDINAL
Definition at line 55 of file GraphicsLinesForCurve.cpp.
60 <<
" curve=" << m_curveName.toLatin1().data()
61 <<
" identifier=" << pointIdentifier.toLatin1().data()
62 <<
" ordinal=" << ordinal
64 <<
" newPointCount=" << (m_graphicsPoints.count() + 1);
66 m_graphicsPoints [ordinal] = &graphicsPoint;
◆ identifierToOrdinal()
| double GraphicsLinesForCurve::identifierToOrdinal |
( |
const QString & |
identifier | ) |
const |
Get ordinal for specified identifier.
Definition at line 186 of file GraphicsLinesForCurve.cpp.
189 <<
" identifier=" << identifier.toLatin1().data();
191 OrdinalToGraphicsPoint::const_iterator itr;
192 for (itr = m_graphicsPoints.begin(); itr != m_graphicsPoints.end(); itr++) {
◆ lineMembershipPurge()
| void GraphicsLinesForCurve::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.
Definition at line 206 of file GraphicsLinesForCurve.cpp.
212 <<
" curve=" << m_curveName.toLatin1().data();
214 OrdinalToGraphicsPoint::iterator itr, itrNext;
215 for (itr = m_graphicsPoints.begin(); itr != m_graphicsPoints.end(); itr = itrNext) {
224 double ordinal = itr.key ();
227 m_graphicsPoints.remove (ordinal);
235 pen = QPen (Qt::NoPen);
◆ lineMembershipReset()
| void GraphicsLinesForCurve::lineMembershipReset |
( |
| ) |
|
Mark points as unwanted. Afterwards, lineMembershipPurge gets called.
Definition at line 252 of file GraphicsLinesForCurve.cpp.
255 <<
" curve=" << m_curveName.toLatin1().data();
257 OrdinalToGraphicsPoint::iterator itr;
258 for (itr = m_graphicsPoints.begin(); itr != m_graphicsPoints.end(); itr++) {
◆ printStream()
| void GraphicsLinesForCurve::printStream |
( |
QString |
indentation, |
|
|
QTextStream & |
str |
|
) |
| const |
Debugging method that supports print method of this class and printStream method of some other class(es)
Definition at line 286 of file GraphicsLinesForCurve.cpp.
291 str << indentation <<
"GraphicsLinesForCurve=" << m_curveName
297 OrdinalToGraphicsPoint::const_iterator itr;
298 for (itr = m_graphicsPoints.begin(); itr != m_graphicsPoints.end(); itr++) {
300 double ordinalKey = itr.key();
◆ removePoint()
| void GraphicsLinesForCurve::removePoint |
( |
double |
ordinal | ) |
|
Remove the specified point. The act of deleting it will automatically remove it from the GraphicsScene.
Definition at line 309 of file GraphicsLinesForCurve.cpp.
312 <<
" point=" << ordinal
313 <<
" pointCount=" << m_graphicsPoints.count();
318 m_graphicsPoints.remove (ordinal);
320 delete graphicsPoint;
◆ removeTemporaryPointIfExists()
| void GraphicsLinesForCurve::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 323 of file GraphicsLinesForCurve.cpp.
329 OrdinalToGraphicsPoint::iterator itr;
330 for (itr = m_graphicsPoints.begin(); itr != m_graphicsPoints.end(); itr++) {
334 m_graphicsPoints.remove (itr.key());
336 delete graphicsPoint;
◆ updateAfterCommand()
Update the GraphicsScene with the specified Point from the Document. If it does not exist yet in the scene, we add it.
Definition at line 366 of file GraphicsLinesForCurve.cpp.
372 <<
" curve=" << m_curveName.toLatin1().data()
373 <<
" pointCount=" << m_graphicsPoints.count();
376 if (m_graphicsPoints.contains (point.
ordinal())) {
378 graphicsPoint = m_graphicsPoints [point.
ordinal()];
394 m_graphicsPoints [point.
ordinal ()] = graphicsPoint;
◆ updateCurveStyle()
| void GraphicsLinesForCurve::updateCurveStyle |
( |
const CurveStyle & |
curveStyle | ) |
|
Update the curve style for this curve.
Definition at line 403 of file GraphicsLinesForCurve.cpp.
407 OrdinalToGraphicsPoint::const_iterator itr;
408 for (itr = m_graphicsPoints.begin(); itr != m_graphicsPoints.end(); itr++) {
◆ updateGraphicsLinesToMatchGraphicsPoints()
| void GraphicsLinesForCurve::updateGraphicsLinesToMatchGraphicsPoints |
( |
const LineStyle & |
lineStyle, |
|
|
SplineDrawer & |
splineDrawer, |
|
|
QPainterPath & |
pathMultiValued, |
|
|
LineStyle & |
lineMultiValued |
|
) |
| |
Calls to moveLinesWithDraggedPoint have finished so update the lines correspondingly.
Definition at line 429 of file GraphicsLinesForCurve.cpp.
436 bool needRenumbering = needOrdinalRenumbering ();
437 if (needRenumbering) {
444 <<
" numberPoints=" << m_graphicsPoints.count()
445 <<
" ordinalRenumbering=" << (needRenumbering ?
"true" :
"false");
454 m_graphicsPoints.count () < 3) {
456 path = drawLinesStraight (pathMultiValued);
458 path = drawLinesSmooth (lineStyle,
◆ updateHighlightOpacity()
| void GraphicsLinesForCurve::updateHighlightOpacity |
( |
double |
highlightOpacity | ) |
|
Update the highlight opacity value. This may or may not affect the current display immediately depending on the state.
Definition at line 415 of file GraphicsLinesForCurve.cpp.
418 <<
" curve=" << m_curveName.toLatin1().data()
419 <<
" highlightOpacity=" << highlightOpacity;
421 OrdinalToGraphicsPoint::const_iterator itr;
422 for (itr = m_graphicsPoints.begin(); itr != m_graphicsPoints.end(); itr++) {
◆ updatePointOrdinalsAfterDrag()
| void GraphicsLinesForCurve::updatePointOrdinalsAfterDrag |
( |
const LineStyle & |
lineStyle, |
|
|
const Transformation & |
transformation |
|
) |
| |
See GraphicsScene::updateOrdinalsAfterDrag. Pretty much the same steps as Curve::updatePointOrdinals.
Definition at line 468 of file GraphicsLinesForCurve.cpp.
474 <<
" curve=" << m_curveName.toLatin1().data()
484 OrdinalToGraphicsPoint::iterator itrP;
485 for (itrP = m_graphicsPoints.begin(); itrP != m_graphicsPoints.end(); itrP++) {
487 double ordinal = itrP.key();
495 xOrThetaToOrdinal [pointGraph.x()] = ordinal;
501 XOrThetaToOrdinal::const_iterator itrX;
502 for (itrX = xOrThetaToOrdinal.begin(); itrX != xOrThetaToOrdinal.end(); itrX++) {
504 double ordinalOld = *itrX;
507 temporaryList [ordinalNew++] = point;
511 m_graphicsPoints.clear();
512 for (itrP = temporaryList.begin(); itrP != temporaryList.end(); itrP++) {
514 double ordinal = itrP.key();
517 m_graphicsPoints [ordinal] = point;
The documentation for this class was generated from the following files:
void setWanted()
Mark point as wanted. Marking as unwanted is done by the reset function.
QVariant data(int key) const
Proxy method for QGraphicsItem::data.
GraphicsPoint * createPoint(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_graphicsLinesFo...
Unique identifier for QGraphicsItem object
void printStream(QString indentation, QTextStream &str, double ordinalKey) const
Debugging method that supports print method of this class and printStream method of some other class(...
unsigned int width() const
Width of line.
QString dataKeyToString(DataKey dataKey)
DataKey
Index values for storing item details in QGraphicsItem using setData/data.
bool wanted() const
Identify point as wanted//unwanted.
QMap< double, GraphicsPoint * > OrdinalToGraphicsPoint
double ordinal(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Get method for ordinal. Skip check if copying one instance to another.
#define ENGAUGE_CHECK_PTR(ptr)
#endif
QPointF posScreen() const
Accessor for screen position.
ColorPalette paletteColor() const
Line color.
void setPos(const QPointF pos)
Update the position.
#define LOG4CPP_INFO_S(logger)
QString identifier() const
Unique identifier for a specific Point.
QPointF pos() const
Proxy method for QGraphicsItem::pos.
log4cpp::Category * mainCat
QColor ColorPaletteToQColor(ColorPalette color)
QMap< double, double > XOrThetaToOrdinal
const QString INDENTATION_DELTA
Graphics item for drawing a circular or polygonal Point.
void setData(int key, const QVariant &data)
Proxy method for QGraphicsItem::setData.
#define LOG4CPP_DEBUG_S(logger)
void setHighlightOpacity(double highlightOpacity)
Set method for highlight opacity.
void updateGraphicsLinesToMatchGraphicsPoints(const LineStyle &lineStyle, SplineDrawer &splineDrawer, QPainterPath &pathMultiValued, LineStyle &lineMultiValued)
Calls to moveLinesWithDraggedPoint have finished so update the lines correspondingly.
CurveConnectAs curveConnectAs() const
Get method for connect type.
QString curveConnectAsToString(CurveConnectAs curveConnectAs)
QString QPointFToString(const QPointF &pos)
void updateCurveStyle(const CurveStyle &curveStyle)
Update point and line styles that comprise the curve style.
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
void reset()
Mark point as unwanted, and unbind any bound lines.