Ejemplo n.º 1
0
void
GUIVehicle::drawAction_drawVehicleBlinker(double length) const {
    if (!signalSet(MSVehicle::VEH_SIGNAL_BLINKER_RIGHT | MSVehicle::VEH_SIGNAL_BLINKER_LEFT | MSVehicle::VEH_SIGNAL_BLINKER_EMERGENCY)) {
        return;
    }
    const double offset = MAX2(.5 * getVehicleType().getWidth(), .4);
    if (signalSet(MSVehicle::VEH_SIGNAL_BLINKER_RIGHT)) {
        drawAction_drawBlinker(-offset, length);
    }
    if (signalSet(MSVehicle::VEH_SIGNAL_BLINKER_LEFT)) {
        drawAction_drawBlinker(offset, length);;
    }
    if (signalSet(MSVehicle::VEH_SIGNAL_BLINKER_EMERGENCY)) {
        drawAction_drawBlinker(-offset, length);
        drawAction_drawBlinker(offset, length);
    }
}
Ejemplo n.º 2
0
inline void
GUIVehicle::drawAction_drawVehicleBlueLight() const {
    if (signalSet(MSVehicle::VEH_SIGNAL_EMERGENCY_BLUE)) {
        glPushMatrix();
        glTranslated(0, 2.5, .5);
        glColor3f(0, 0, 1);
        GLHelper::drawFilledCircle(.5, 6);
        glPopMatrix();
    }
}
Ejemplo n.º 3
0
inline void
GUIVehicle::drawAction_drawVehicleBrakeLight(double length, bool onlyOne) const {
    if (!signalSet(MSVehicle::VEH_SIGNAL_BRAKELIGHT)) {
        return;
    }
    glColor3f(1.f, .2f, 0);
    glPushMatrix();
    if (onlyOne) {
        glTranslated(0, length, -0.1);
        GLHelper::drawFilledCircle(.5, 6);
    } else {
        glTranslated(-getVehicleType().getWidth() * 0.5, length, -0.1);
        GLHelper::drawFilledCircle(.5, 6);
        glPopMatrix();
        glPushMatrix();
        glTranslated(getVehicleType().getWidth() * 0.5, length, -0.1);
        GLHelper::drawFilledCircle(.5, 6);
    }
    glPopMatrix();
}
 void
 initialize()
 {
   boost::asio::signal_set signalSet(*ioService_, SIGINT, SIGTERM);
   signalSet.async_wait(boost::bind(&NdnTrafficClient::signalHandler, this));
   m_logger.initializeLog(instanceId_);
   initializeTrafficConfiguration();
   boost::asio::deadline_timer deadlineTimer(*ioService_,
                                             boost::posix_time::millisec(interestInterval_));
   deadlineTimer.async_wait(boost::bind(&NdnTrafficClient::generateTraffic,
                                        this,
                                        boost::asio::placeholders::error,
                                        &deadlineTimer));
   try {
     face_.processEvents();
   }
   catch(std::exception &e) {
     m_logger.log("ERROR: "+(std::string)e.what(), true, true);
     m_logger.shutdownLogger();
   }
 }
Ejemplo n.º 5
0
  void
  run()
  {
    std::cout << "\n=== File Sender " << m_prefix <<" ===\n" << std::endl;

    boost::asio::signal_set signalSet(m_ioService, SIGINT, SIGTERM);
    signalSet.async_wait(bind([this]() { signalHandler(); }));
    m_name = m_prefix;
    m_face.setInterestFilter(m_name,
                             bind(&NdnTlvFileSender::onInterest,
                                  this, _2),
                             bind(&NdnTlvFileSender::onRegisterFailed,
                                  this, _1,_2));
    try {
      m_face.processEvents();
    }
    catch (std::exception& e) {
      std::cerr << "ERROR: " << e.what() << std::endl;
      m_hasError = true;
      m_ioService.stop();
    }
  }