15#include <QGraphicsScene>
28 m_isGnuplot (isGnuplot)
34 QList<SegmentLine*>::iterator
itr;
35 for (
itr = m_lines.begin();
itr != m_lines.end();
itr++) {
52 <<
" segment=0x" << std::hex << static_cast<void*> (
this) << std::dec
71 m_length +=
qSqrt((1.0) * (1.0) + (y - m_yLast) * (y - m_yLast));
76void Segment::createAcceptablePoint(
bool *
pFirst,
121 strDump <<
"set label \"" <<
label <<
"\" at graph 0, graph 0.02\n";
126 int rows = 0, cols = 0;
127 QList<SegmentLine*>::const_iterator
itr;
128 for (
itr = m_lines.begin();
itr != m_lines.end();
itr++) {
138 rows =
qMax (rows,
y1 + 1);
139 rows =
qMax (rows,
y2 + 1);
140 cols =
qMax (cols,
x1 + 1);
141 cols =
qMax (cols,
x2 + 1);
159 <<
"\"-\" title \"\" with lines, \\\n"
160 <<
"\"-\" title \"\" with lines, \\\n"
161 <<
"\"-\" title \"Replacement\" with lines, \\\n"
162 <<
"\"-\" title \"Segment pixels Even\" with linespoints, \\\n"
163 <<
"\"-\" title \"Segment pixels Odd\" with linespoints\n"
177 for (
int index = 0; index < m_lines.count(); index++) {
185 if (index % 2 == 0) {
200 strDump <<
"pause -1 \"Hit Enter to continue\"\n";
210 return fillPointsFillingCorners(modelSegments);
212 return fillPointsWithoutFillingCorners(modelSegments);
220 if (m_lines.count() > 0) {
222 double xLast = m_lines.first()->line().x1();
223 double yLast = m_lines.first()->line().y1();
230 double xPrev = m_lines.first()->line().x1();
231 double yPrev = m_lines.first()->line().y1();
233 QList<SegmentLine*>::iterator
itr;
234 for (
itr = m_lines.begin();
itr != m_lines.end();
itr++) {
284 <<
" lineCount=" << m_lines.count();
301 <<
" segmentLines=" << m_lines.count();
306bool Segment::isCorner (
double yLast,
323 if (m_lines.count() > 0) {
325 double xLast = m_lines.first()->line().x1();
326 double yLast = m_lines.first()->line().y1();
333 double xPrev = m_lines.first()->line().x1();
334 double yPrev = m_lines.first()->line().y1();
336 QList<SegmentLine*>::iterator
itr;
337 for (
itr = m_lines.begin();
itr != m_lines.end();
itr++) {
382 return m_lines.count();
385bool Segment::pointIsCloseToLine(
double xLeft,
400bool Segment::pointsAreCloseToLine(
double xLeft,
406 QList<QPoint>::iterator
itr;
408 if (!pointIsCloseToLine(
xLeft,
434 fileDump->open (QIODevice::WriteOnly | QIODevice::Text);
446 for (
itr = m_lines.begin();
itr != m_lines.end();
itr++) {
482 <<
" segment=0x" << std::hex << static_cast<void*> (
this) << std::dec
486 <<
" and modifying ("
487 <<
line->line().x1() <<
"," <<
line->line().y1() <<
") to ("
488 <<
line->line().x2() <<
"," <<
line->line().y2() <<
") into ("
512 if (
itr == m_lines.end()) {
520 *
strDump <<
"set terminal x11 persist\n";
533 for (
itr = m_lines.begin();
itr != m_lines.end();
itr++) {
544 QList<SegmentLine*>::iterator
itr;
545 for (
itr = m_lines.begin();
itr != m_lines.end();
itr++) {
const int INNER_RADIUS_MIN
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
#define ENGAUGE_CHECK_PTR(ptr)
#endif
log4cpp::Category * mainCat
QString QPointFToString(const QPointF &pos)
Model for DlgSettingsSegments and CmdSettingsSegments.
bool fillCorners() const
Get method for fill corners.
double pointSeparation() const
Get method for point separation.
This class is a special case of the standard QGraphicsLineItem for segments.
void setHover(bool hover)
Apply/remove highlighting triggered by hover enter/leave.
void updateModelSegment(const DocumentModelSegments &modelSegments)
Update this segment line with new settings.
void signalMouseClickOnSegment(QPointF posSegmentStart)
Pass mouse press event, with coordinates of first point in the Segment since that info uniquely ident...
double length() const
Get method for length in pixels.
int lineCount() const
Get method for number of lines.
QList< QPoint > fillPoints(const DocumentModelSegments &modelSegments)
Create evenly spaced points along the segment.
Segment(QGraphicsScene &scene, int yLast, bool isGnuplot)
Single constructor.
void forwardMousePress()
Forward mouse press event from a component SegmentLine that was just clicked on.
void slotHover(bool hover)
Slot for hover enter/leave events in the associated SegmentLines.
void updateModelSegment(const DocumentModelSegments &modelSegments)
Update this segment given the new settings.
void appendColumn(int x, int y, const DocumentModelSegments &modelSegments)
Add some more pixels in a new column to an active segment.
QPointF firstPoint() const
Coordinates of first point in Segment.
void removeUnneededLines(int *foldedLines)
Try to compress a segment that was just completed, by folding together line from point i to point i+1...
Priority::Value getPriority() const
Returns unused priority.
#define LOG4CPP_INFO_S(logger)
#define LOG4CPP_DEBUG_S(logger)
const QString GNUPLOT_FILE_MESSAGE
void projectPointOntoLine(double xToProject, double yToProject, double xStart, double yStart, double xStop, double yStop, double *xProjection, double *yProjection, double *projectedDistanceOutsideLine, double *distanceToLine)
Find the projection of a point onto a line segment such that the line through the point and its proje...