void DotQtAnnotation::moveCoordinateBy(const Point& moveBy) { std::vector<Point> coords = this->getAnnotation()->getCoordinates(); prepareGeometryChange(); coords[0].setX(coords[0].getX() + moveBy.getX() / _scale); coords[0].setY(coords[0].getY() + moveBy.getY() / _scale); this->getAnnotation()->setCoordinates(coords); this->setPos(QPointF(coords[0].getX()*_scale, coords[0].getY()*_scale)); onCoordinatesChanged(); }
void PolyQtAnnotation::moveCoordinatesBy(const Point& moveBy) { std::vector<Point> coords = this->getAnnotation()->getCoordinates(); for (std::vector<Point>::iterator it = coords.begin(); it != coords.end(); ++it) { it->setX(it->getX() + moveBy.getX()/_scale); it->setY(it->getY() + moveBy.getY()/_scale); } this->getAnnotation()->setCoordinates(coords); this->setPos(QPointF(coords[0].getX()*_scale, coords[0].getY()*_scale)); onCoordinatesChanged(); }
void PolyQtAnnotation::moveCoordinateBy(unsigned int index, const Point& moveBy) { std::vector<Point> coords = this->getAnnotation()->getCoordinates(); if (index < coords.size()) { prepareGeometryChange(); coords[index].setX(coords[index].getX() + moveBy.getX() / _scale); coords[index].setY(coords[index].getY() + moveBy.getY() / _scale); this->getAnnotation()->setCoordinates(coords); if (index == 0) { this->setPos(QPointF(coords[0].getX()*_scale, coords[0].getY()*_scale)); } } onCoordinatesChanged(); }
void PolyQtAnnotation::finish() { prepareGeometryChange(); _closed = true; onCoordinatesChanged(); }