Пример #1
0
int main(int argc, char *argv[])
{
    std::string startMode = checkArguments (argc,argv);

    QApplication a(argc, argv);

    bool simulationMode=false;
    if (startMode=="simulation")
        simulationMode = true;

    DataProcessing dataProcessor(simulationMode);
    MapWidget mapW;
    OriginDataWidget originDataW;
    StationsDataWidget stationsDataW;

    /**SIGNAL -> SLOT mapping**/

    QObject::connect (&dataProcessor, SIGNAL(stationsLoaded(std::set<Station>)),
                      &stationsDataW, SLOT(showStationsData(std::set<Station>)));

    QObject::connect (&dataProcessor, SIGNAL(stationsLoaded(std::set<Station>)),
                      &mapW, SLOT(paintStations(std::set<Station>)));

    QObject::connect (&dataProcessor, SIGNAL(originReceived(Origin)),
                      &originDataW, SLOT(showOriginData(Origin)));

    QObject::connect (&dataProcessor, SIGNAL(originReceived(Origin)),
                      &mapW, SLOT(paintOrigin(Origin)));

    QObject::connect (&dataProcessor, SIGNAL(stationColorReceived(std::set<Station>)),
                      &stationsDataW, SLOT(changeStationsData(std::set<Station>)));

    QObject::connect (&dataProcessor, SIGNAL(stationColorReceived(std::set<Station>)),
                      &mapW, SLOT(changeStationsColors(std::set<Station>)));

    QObject::connect (&dataProcessor, SIGNAL(eventReceived(Origin)),
                      &originDataW, SLOT(showOriginData(Origin)));

    QObject::connect (&dataProcessor, SIGNAL(eventReceived(Origin)),
                      &mapW, SLOT(paintOrigin(Origin)));

    mapW.show();
    originDataW.show();
    stationsDataW.show();

    if (startMode == "realtime"){
        dataProcessor.init();
    }
    else if (startMode == "simulation"){
        QDateTime datetime =QDateTime::fromString(QString(argv[2])+" "+QString(argv[3]),
                                                  "yyyy-MM-dd hh:mm:ss");
        dataProcessor.init();
        dataProcessor.initSimulation(datetime);
    }

    return a.exec();
}
Пример #2
0
void PaintMethods::paintDebugDrawing(QPainter& painter, const DebugDrawing& debugDrawing, const QTransform& baseTrans)
{
  for(const DebugDrawing::Element* e = debugDrawing.getFirst(); e; e = debugDrawing.getNext(e))
    switch(e->type)
    {
      case DebugDrawing::Element::POLYGON:
      {
        paintPolygon(*static_cast<const DebugDrawing::Polygon*>(e), painter);
        break;
      }
      case DebugDrawing::Element::GRID_RGBA:
      {
        paintGridRGBA(*static_cast<const DebugDrawing::GridRGBA*>(e), painter);
        break;
      }
      case DebugDrawing::Element::GRID_MONO:
      {
        paintGridMono(*static_cast<const DebugDrawing::GridMono*>(e), painter);
        break;
      }
      case DebugDrawing::Element::ELLIPSE:
      {
        paintEllipse(*static_cast<const DebugDrawing::Ellipse*>(e), painter);
        break;
      }
      case DebugDrawing::Element::ARC:
      {
        paintArc(*static_cast<const DebugDrawing::Arc*>(e), painter);
        break;
      }
      case DebugDrawing::Element::RECTANGLE:
      {
        paintRectangle(*static_cast<const DebugDrawing::Rectangle*>(e), painter);
        break;
      }
      case DebugDrawing::Element::LINE:
      {
        paintLine(*static_cast<const DebugDrawing::Line*>(e), painter);
        break;
      }
      case DebugDrawing::Element::ORIGIN:
      {
        paintOrigin(*static_cast<const DebugDrawing::Origin*>(e), painter, baseTrans);
        break;
      }
      case DebugDrawing::Element::TEXT:
      {
        paintText(*static_cast<const DebugDrawing::Text*>(e), painter);
        break;
      }
      default:
        break;
    }
}