graphic addPoints
This commit is contained in:
@@ -750,12 +750,40 @@ void Graphic::addPoint(const QPointF & p, int graphic, bool update_) {
|
||||
if (t.cvrect.left() > p.x()) t.cvrect.setLeft(p.x());
|
||||
}
|
||||
if (t.polyline.size() == 0) t.max_x = p.x();
|
||||
t.polyline << p;
|
||||
if (t.max_x < p.x()) t.max_x = p.x();
|
||||
t.polyline << p;
|
||||
tick(graphic, true, update_);
|
||||
}
|
||||
|
||||
|
||||
void Graphic::addPoints(const QPolygonF & pts, int graphic, bool update_) {
|
||||
if (graphic >= graphics.size() || graphic < 0 || pts.isEmpty()) return;
|
||||
GraphicType & t(graphics[graphic]);
|
||||
if (!t.cvrect.isNull() && !pause_) {
|
||||
for(const QPointF & p : pts) {
|
||||
if (t.cvrect.top() < p.y()) t.cvrect.setTop(p.y());
|
||||
if (t.cvrect.bottom() > p.y()) t.cvrect.setBottom(p.y());
|
||||
if (t.cvrect.right() < p.x()) t.cvrect.setRight(p.x());
|
||||
if (t.cvrect.left() > p.x()) t.cvrect.setLeft(p.x());
|
||||
}
|
||||
}
|
||||
if (t.polyline.size() == 0) t.max_x = pts.at(0).x();
|
||||
for(const QPointF & p : pts) if (t.max_x < p.x()) t.max_x = p.x();
|
||||
t.polyline << pts;
|
||||
tick(graphic, true, update_);
|
||||
}
|
||||
|
||||
|
||||
void Graphic::addPoints(const QVector<double> & pts, int graphic, bool update_) {
|
||||
QPolygonF ps;
|
||||
ps.reserve(pts.size());
|
||||
double stx = 0;
|
||||
if (!graphics[curGraphic].polyline.isEmpty()) stx = graphics[curGraphic].max_x;
|
||||
for (int i=0; i<pts.size(); ++i) ps << QPointF(stx + i*inc_x, pts[i]);
|
||||
addPoints(ps, graphic, update_);
|
||||
}
|
||||
|
||||
|
||||
void Graphic::setGraphicData(const QVector<QPointF> & g, int graphic, bool update_) {
|
||||
if (graphic >= graphics.size() || graphic < 0) return;
|
||||
GraphicType & t(graphics[graphic]);
|
||||
|
||||
Reference in New Issue
Block a user