15#include <QGraphicsPixmapItem>
16#include <QGraphicsScene>
42 m_cmdMediator = cmdMediator;
53 const QSize &viewSize)
const
63 return QCursor (Qt::ArrowCursor);
71 SegmentFactory segmentFactory (
dynamic_cast<QGraphicsScene &
> (scene),
83 const QString &pointIdentifier)
86 <<
" point=" << pointIdentifier.toLatin1 ().data ();
90 const QStringList &pointIdentifiers)
93 <<
"points=" << pointIdentifiers.join(
",").toLatin1 ().data ();
103 SegmentFactory segmentFactory (
dynamic_cast<QGraphicsScene &
> (scene),
114 QList<Segment*>::iterator itr;
115 for (itr = m_segments.begin(); itr != m_segments.end(); itr++) {
121 connect (segment, SIGNAL (signalMouseClickOnSegment (QPointF)),
this, SLOT (
slotMouseClickOnSegment (QPointF)));
127 bool atLeastOneSelectedItem)
130 <<
" key=" << QKeySequence (key).toString ().toLatin1 ().data ();
134 atLeastOneSelectedItem);
155Segment *DigitizeStateSegment::segmentFromSegmentStart (
const QPointF &posSegmentStart)
const
158 <<
" segments=" << m_segments.count();
160 QList<Segment*>::const_iterator itr;
161 for (itr = m_segments.begin(); itr != m_segments.end(); itr++) {
164 if (segment->
firstPoint() == posSegmentStart) {
179 Segment *segment = segmentFromSegmentStart (posSegmentStart);
182 QList<Segment*> segments;
183 segments.push_back (segment);
187 SegmentFactory segmentFactory (
dynamic_cast<QGraphicsScene &
> (scene),
190 QList<QPoint> points = segmentFactory.
fillPoints (m_cmdMediator->document().modelSegments(),
195 Document &document = m_cmdMediator->document ();
197 QList<double> ordinals;
198 QList<QPoint>::iterator itr;
199 for (itr = points.begin(); itr != points.end(); itr++) {
211 context ().mainWindow().selectedGraphCurve(),
220 return "DigitizeStateSegment";
238 QList<Segment*>::const_iterator itr;
239 for (itr = m_segments.begin(); itr != m_segments.end(); itr++) {
DigitizeState
Set of possible states of Digitize toolbar.
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
log4cpp::Category * mainCat
Command for adding one or more graph points. This is for Segment Fill mode.
virtual void handleKeyPressArrow(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
If the key is an arrow (left, right, up, down) then move currently selected items.
DigitizeStateAbstractBase(DigitizeStateContext &context)
Single constructor.
bool canPasteProtected(const Transformation &transformation, const QSize &viewSize) const
Protected version of canPaste method. Some, but not all, leaf classes use this method.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses,...
void setCursor(CmdMediator *cmdMediator)
Update the cursor according to the current state.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
void setDragMode(QGraphicsView::DragMode dragMode)
Set QGraphicsView drag mode (in m_view). Called from DigitizeStateAbstractBase subclasses.
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
MainWindow & mainWindow()
Reference to the MainWindow, without const.
virtual bool guidelinesAreSelectable() const
Enable/disable guidelines according to state.
virtual QString state() const
State name for debugging.
virtual void handleMousePress(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse press that was intercepted earlier.
virtual void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
Handle a right click, on an axis point, that was intercepted earlier.
virtual void begin(CmdMediator *cmdMediator, DigitizeState previousState)
Method that is called at the exact moment a state is entered.
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
virtual void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
void slotMouseClickOnSegment(QPointF)
Receive signal from Segment that has been clicked on. The CmdMediator from the begin method will be u...
virtual void handleCurveChange(CmdMediator *cmdMediator)
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
virtual void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
Handle a right click, on a graph point, that was intercepted earlier.
virtual QCursor cursor(CmdMediator *cmdMediator) const
Returns the state-specific cursor shape.
virtual void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
virtual bool canPaste(const Transformation &transformation, const QSize &viewSize) const
Return true if there is good data in the clipboard for pasting, and that is compatible with the curre...
DigitizeStateSegment(DigitizeStateContext &context)
Single constructor.
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
virtual ~DigitizeStateSegment()
virtual void updateAfterPointAddition()
Update graphics attributes after possible new points. This is useful for highlight opacity.
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual void handleMouseMove(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mod...
virtual void handleMouseRelease(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse release that was intercepted earlier.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Model for DlgSettingsSegments and CmdSettingsSegments.
Storage of one imported image and the data attached to that image.
DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
Add point and line handling to generic QGraphicsScene.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
void handleGuidelinesActiveChange(bool active)
Handle Guidelines active status toggle.
QImage imageFiltered() const
Background image that has been filtered for the current curve. This asserts if a curve-specific image...
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
Transformation transformation() const
Return read-only copy of transformation.
Utility class for generating ordinal numbers.
double generateCurvePointOrdinal(const Document &document, const Transformation &transformation, const QPointF &posScreen, const QString &curveName)
Select ordinal so new point curve passes smoothly through existing points.
Factory class for Segment objects.
QList< QPoint > fillPoints(const DocumentModelSegments &modelSegments, QList< Segment * > segments)
Return segment fill points for all segments, for previewing.
void clearSegments(QList< Segment * > &segments)
Remove the segments created by makeSegments.
void makeSegments(const QImage &imageFiltered, const DocumentModelSegments &modelSegments, QList< Segment * > &segments, bool useDlg=true)
Main entry point for creating all Segments for the filtered image.
Selectable piecewise-defined line that follows a filtered line in the image.
int lineCount() const
Get method for number of lines.
void updateModelSegment(const DocumentModelSegments &modelSegments)
Update this segment given the new settings.
QPointF firstPoint() const
Coordinates of first point in Segment.
#define LOG4CPP_INFO_S(logger)
#define LOG4CPP_DEBUG_S(logger)
#define LOG4CPP_ERROR_S(logger)