int NavigationView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QGraphicsView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: mouseAtGeoPos((*reinterpret_cast< const QPointF(*)>(_a[1]))); break; case 1: newPointAdded((*reinterpret_cast< const QPointF(*)>(_a[1]))); break; case 2: newLineAdded((*reinterpret_cast< QPointF(*)>(_a[1])),(*reinterpret_cast< QPointF(*)>(_a[2]))); break; case 3: newLandmarkAdded((*reinterpret_cast< const QPointF(*)>(_a[1]))); break; case 4: setRoverPosAndHeading((*reinterpret_cast< const QPointF(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2]))); break; case 5: setRoverPosition((*reinterpret_cast< const QPointF(*)>(_a[1]))); break; case 6: setRoverHeading((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 7: updateConfiguration(); break; case 8: plotLineForSelected(); break; case 9: plotLineForPoints((*reinterpret_cast< QPointF(*)>(_a[1])),(*reinterpret_cast< QPointF(*)>(_a[2]))); break; case 10: plotLineIntersection(); break; case 11: selectPoint((*reinterpret_cast< QPointF(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; case 12: selectPoint((*reinterpret_cast< QPointF(*)>(_a[1]))); break; case 13: clearSelectedPoints(); break; case 14: selectLines((*reinterpret_cast< QList<QPair<QPointF,QPointF> >(*)>(_a[1]))); break; case 15: clearSelectedLines(); break; case 16: deleteSelectedPoints(); break; case 17: deleteSelectedLines(); break; default: ; } _id -= 18; } return _id; }
NavigationWidget::NavigationWidget(QWidget *parent) : QWidget(parent) { setupUi(this); //navView = new NavigationView(this); //verticalLayout->insertWidget(0, navView); connect(navView, SIGNAL(mouseAtGeoPos(QPointF)), this, SLOT(displayCoordinates(QPointF))); triangulationWidget = new TriangulationWidget(); connect(triangulationButton, SIGNAL(clicked()), triangulationWidget, SLOT(show())); connect(connectLineButton, SIGNAL(clicked()), navView, SLOT(plotLineForSelected())); connect(markIsectButton, SIGNAL(clicked()), navView, SLOT(plotLineIntersection())); connect(requestGPSButton, SIGNAL(clicked()), this, SLOT(sendGPSRequest())); connect(RobotController::gpsController(), SIGNAL(gotPositionUpdate(GPSPositionData)), this, SLOT(gotGPSUpdate(GPSPositionData))); connect(navView, SIGNAL(newPointAdded(QPointF)), triangulationSidebar, SLOT(addPoint(QPointF))); connect(navView, SIGNAL(newLineAdded(QPointF,QPointF)), triangulationSidebar, SLOT(addLine(QPointF,QPointF))); connect(navView, SIGNAL(newLandmarkAdded(QPointF)), triangulationSidebar, SLOT(addLandmark(QPointF))); connect(triangulationSidebar, SIGNAL(selectPoint(QPointF, bool)), navView, SLOT(selectPoint(QPointF, bool))); connect(triangulationSidebar, SIGNAL(clearSelectedPoints()), navView, SLOT(clearSelectedPoints())); connect(triangulationSidebar, SIGNAL(drawLine(QPointF,QPointF)), navView, SLOT(plotLineForPoints(QPointF,QPointF))); connect(triangulationSidebar, SIGNAL(selectLines(QList<QPair<QPointF,QPointF> >)), navView, SLOT(selectLines(QList<QPair<QPointF,QPointF> >))); connect(triangulationSidebar, SIGNAL(clearSelectedLines()), navView, SLOT(clearSelectedLines())); connect(triangulationSidebar, SIGNAL(intersectLines()), navView, SLOT(plotLineIntersection())); connect(triangulationSidebar, SIGNAL(deleteLines()), navView, SLOT(deleteSelectedLines())); connect(triangulationSidebar, SIGNAL(deletePoints()), navView, SLOT(deleteSelectedPoints())); // Test rover slots /*navView->setRoverPosition(QPointF(-110.791497, 38.406392)); navView->setRoverPosition(QPointF(-110.790889, 38.406158)); navView->setRoverPosition(QPointF(-110.790469, 38.405850)); navView->setRoverPosition(QPointF(-110.790257, 38.405575)); navView->setRoverPosition(QPointF(-110.790161, 38.405359)); navView->setRoverPosition(QPointF(-110.790177, 38.405195)); navView->setRoverPosition(QPointF(-110.790037, 38.404941)); navView->setRoverPosition(QPointF(-110.789840, 38.404890)); navView->setRoverPosition(QPointF(-110.789420, 38.404986)); navView->setRoverPosition(QPointF(-110.789219, 38.404973)); navView->setRoverHeading(92.334915);*/ //navView->setRoverPosition(QPointF(-123.212968,44.674917)); // adair //navView->setRoverPosition(QPointF(-123.274951,44.567328)); // covell parking lot }
void NavigationView::plotLineForSelected() { if (scene()->selectedItems().count()<2) return; QLineF vectorLine(scene()->selectedItems().at(0)->pos(), scene()->selectedItems().at(1)->pos()); QLineF sides[4] = { QLineF(0, 0, 0, scene()->height()), QLineF(scene()->width(), 0, scene()->width(), scene()->height()), QLineF(0, 0, scene()->width(), 0), QLineF(0, scene()->height(), scene()->width(), scene()->height()) }; QPointF yStart; QPointF xStart; int i=0; while(yStart.isNull()) { if (vectorLine.intersect(sides[i++], &yStart)!=QLineF::BoundedIntersection) { qDebug("could not intersect y"); } i++; } i=1; while(xStart.isNull()) { if (vectorLine.intersect(sides[i++], &xStart)!=QLineF::BoundedIntersection) { qDebug("could not intersect x"); } } //IntersectionLineItem lineItem(QLineF(yStart, xStart); QPen linePen(Qt::black); linePen.setWidth(3); QGraphicsLineItem * line = scene()->addLine(QLineF(yStart, xStart)); line->setPen(linePen); line->setFlag(QGraphicsItem::ItemIsSelectable, true); emit newLineAdded(mapSceneToGeo(scene()->selectedItems().at(0)->pos()), mapSceneToGeo(scene()->selectedItems().at(1)->pos())); }
void GameSceneController::addVertex(int xNew, int yNew) { emit newLineAdded(mVertexOne, mVertexTwo, mPoints, QPoint(xNew, yNew)); }