Ejemplo n.º 1
0
//___________________________________________________________
bool BlurHelper::eventFilter( QObject* object, QEvent* event )
{

    // do nothing if not enabled
    if( !enabled() ) return false;

    switch( event->type() )
    {

    case QEvent::Hide:
    {
        QWidget* widget( qobject_cast<QWidget*>( object ) );
        if( widget && isOpaque( widget ) )
        {
            QWidget* window( widget->window() );
            if (window && isTransparent(window) && !_pendingWidgets.contains(window) )
            {
                _pendingWidgets.insert( window, window );
                delayedUpdate();
            }
        }
        break;

    }

    case QEvent::Show:
    case QEvent::Resize:
    {

        // cast to widget and check
        QWidget* widget( qobject_cast<QWidget*>( object ) );
        if( !widget ) break;
        if( isTransparent( widget ) )
        {

            _pendingWidgets.insert( widget, widget );
            delayedUpdate();

        } else if( isOpaque( widget ) ) {

            QWidget* window( widget->window() );
            if( isTransparent( window ) )
            {
                _pendingWidgets.insert( window, window );
                delayedUpdate();
            }

        }

        break;
    }

    default: break;

    }

    // never eat events
    return false;

}
Ejemplo n.º 2
0
void AbstractDataPlugin::setModel( AbstractDataPluginModel* model )
{
    if ( d->m_model ) {
        disconnect( d->m_model, SIGNAL(itemsUpdated()), this, SLOT(delayedUpdate()) );
        delete d->m_model;
    }
    d->m_model = model;

    connect( d->m_model, SIGNAL(itemsUpdated()), this, SLOT(delayedUpdate()) );
    connect( d->m_model, SIGNAL(favoriteItemsChanged(QStringList)), this,
             SLOT(favoriteItemsChanged(QStringList)) );
    connect( d->m_model, SIGNAL(favoriteItemsOnlyChanged()), this,
                         SIGNAL(favoriteItemsOnlyChanged()) );

    emit favoritesModelChanged();
}
Ejemplo n.º 3
0
IMUWidget::IMUWidget(QWidget *parent, Qt::WFlags flags) : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
{
    connect(this, SIGNAL(delayedUpdate()), this, SLOT(update()), Qt::QueuedConnection);

    linear_acceleration = make_tuple(0,0,0); // ROS Geometry Messages Vector3: <x, y, z> -- Initialize to all 0s
    angular_velocity = make_tuple(0,0,0); // ROS Geometry Messages Vector3: <x, y, z>    -- Initialize to all 0s
    orientation = make_tuple(0,0,0,0); // ROS Geometry Messages Quaternion: <w, x, y, z>   -- Initialize to all 0s

}
Ejemplo n.º 4
0
void MapFrame::addCollectionPoint(string rover, float x, float y)
{
    // The QT drawing coordinate system is reversed from the robot coordinate system in the y direction
    y = -y;

    update_mutex.lock();
    collection_points[rover_to_display].push_back(pair<float,float>(x,y));
    update_mutex.unlock();
    emit delayedUpdate();
}
Ejemplo n.º 5
0
void MapFrame::addTargetLocation(string rover, float x, float y)
{
  //The QT drawing coordinate system is reversed from the robot coordinate system in the y direction
    y = -y;

    update_mutex.lock();
    target_locations[rover].push_back(pair<float,float>(x,y));
    update_mutex.unlock();
    emit delayedUpdate();
}
Ejemplo n.º 6
0
FilterSortingArea::FilterSortingArea(int processorId,
                                     const OlvisInterface &model,
                                     bool allowInputCreation, QWidget *parent)
    : QWidget(parent), mInterface(model), mProcessorId(processorId),
      ui(new Ui::FilterSortingArea)
{
    mRecursivePaint = false;
    ui->setupUi(this);
    mAllowInputCreate = allowInputCreation;
    ui->inputs->setAllowPortCreation(allowInputCreation);
    if (!allowInputCreation)
        ui->inputs->setVisible(false);
    setAcceptDrops(true);
    mEmptyWidget = new QWidget();
    mEmptyWidget->setFixedHeight(60);

    mCurrent.ignore = 0;

    connect(ui->outputs, SIGNAL(startConnect(FilterPortWidget *)),
            SLOT(onStartConnect(FilterPortWidget *)));
    connect(ui->outputs, SIGNAL(startDisconnect(FilterPortWidget *)),
            SLOT(onStartDisconnect(FilterPortWidget *)));
    connect(ui->inputs, SIGNAL(startConnect(FilterPortWidget *)),
            SLOT(onStartConnect(FilterPortWidget *)));
    connect(ui->inputs, SIGNAL(startDisconnect(FilterPortWidget *)),
            SLOT(onStartDisconnect(FilterPortWidget *)));

    connect(this, SIGNAL(delayedUpdateReq()), SLOT(delayedUpdate()),
            Qt::QueuedConnection);

    connect(this, SIGNAL(addFilterRequested(int, QString, int)), &mInterface,
            SLOT(addFilter(int, QString, int)), Qt::QueuedConnection);
    connect(this, SIGNAL(moveFilterRequested(int, int)), &mInterface,
            SLOT(moveFilter(int, int)), Qt::QueuedConnection);
    connect(this, SIGNAL(connectRequested(int, QString, int, QString)),
            &mInterface, SLOT(connectFilter(int, QString, int, QString)),
            Qt::QueuedConnection);
    connect(this, SIGNAL(connectInputRequested(QString, int, QString)),
            &mInterface, SLOT(connectProcessorInput(QString, int, QString)),
            Qt::QueuedConnection);
    connect(this, SIGNAL(disconnectRequested(int, QString)), &mInterface,
            SLOT(disconnectFilter(int, QString)), Qt::QueuedConnection);
    connect(this, SIGNAL(addProcessorOutputRequested(int, QString)),
            &mInterface, SLOT(createProcessorOutput(int, QString)),
            Qt::QueuedConnection);
    connect(this, SIGNAL(deleteProcessorOutputRequested(int, QString)),
            &mInterface, SLOT(deleteProcessorOutput(int, QString)),
            Qt::QueuedConnection);
}
Ejemplo n.º 7
0
void MapFrame::addToEKFRoverPath(string rover, float x, float y)
{
  // Negate the y direction to orient the map so up is north.
  y = -y;

    if (x > max_ekf_seen_x[rover]) max_ekf_seen_x[rover] = x;
    if (y > max_ekf_seen_y[rover]) max_ekf_seen_y[rover] = y;
    if (x < min_ekf_seen_x[rover]) min_ekf_seen_x[rover] = x;
    if (y < min_ekf_seen_y[rover]) min_ekf_seen_y[rover] = y;

    // Normalize the displayed coordinates to the largest coordinates seen since we don't know the coordinate system.
    max_ekf_seen_width[rover] = max_ekf_seen_x[rover]-min_ekf_seen_x[rover];
    max_ekf_seen_height[rover] = max_ekf_seen_y[rover]-min_ekf_seen_y[rover];

    update_mutex.lock();
    ekf_rover_path[rover].push_back(pair<float,float>(x,y));
    update_mutex.unlock();
    emit delayedUpdate();
}
Ejemplo n.º 8
0
MapFrame::MapFrame(QWidget *parent, Qt::WFlags flags) : QFrame(parent)
{
    connect(this, SIGNAL(delayedUpdate()), this, SLOT(update()), Qt::QueuedConnection);
    // Scale coordinates
    frame_width = this->width();
    frame_height = this->height();

//    max_gps_seen_x[rover] = -std::numeric_limits<float>::max();
//    max_gps_seen_y[rover] = -std::numeric_limits<float>::max();
//    min_gps_seen_x[rover] = std::numeric_limits<float>::max();
//    min_gps_seen_y[rover] = std::numeric_limits<float>::max();

//    max_ekf_seen_x[rover] = -std::numeric_limits<float>::max();
//    max_ekf_seen_y[rover] = -std::numeric_limits<float>::max();
//    min_ekf_seen_x[rover] = std::numeric_limits<float>::max();
//    min_ekf_seen_y[rover] = std::numeric_limits<float>::max();

//    max_encoder_seen_x[rover] = -std::numeric_limits<float>::max();
//    max_encoder_seen_y[rover] = -std::numeric_limits<float>::max();
//    min_encoder_seen_x[rover] = std::numeric_limits<float>::max();
//    min_encoder_seen_y[rover] = std::numeric_limits<float>::max();

//    max_gps_seen_width[rover] = 0;
//    max_gps_seen_height[rover] = 0;

//    max_ekf_seen_width[rover] = 0;
//    max_ekf_seen_height[rover] = 0;

//    max_encoder_seen_width[rover] = 0;
//    max_encoder_seen_height[rover] = 0;

    display_ekf_data = false;
    display_gps_data = false;
    display_encoder_data = false;

    frames = 0;

}
    //___________________________________________________________
    void BlurHelper::registerWidget( QWidget* widget )
    {

        // check if already registered
        if( _widgets.contains( widget ) ) return;

        // install event filter
        addEventFilter( widget );

        // add to widgets list
        _widgets.insert( widget );

        // cleanup on destruction
        connect( widget, SIGNAL( destroyed( QObject* ) ), SLOT( widgetDestroyed( QObject* ) ) );

        if( enabled() )
        {
            // schedule shadow area repaint
            _pendingWidgets.insert( widget, widget );
            delayedUpdate();
        }

    }
Ejemplo n.º 10
0
bool BlurHelper::eventFilter (QObject* object, QEvent* event)
{
  switch (event->type())
  {
    case QEvent::Show:
    case QEvent::Hide:
    case QEvent::Resize:
    /* the theme may changed from
       Kvantum and to it again */
    case QEvent::StyleChange: {
      QWidget* widget (qobject_cast<QWidget*>(object));
      /* take precautions */
      if (!widget || !widget->isWindow()) break;
      pendingWidgets_.insert (widget, widget);
      delayedUpdate();
      break;
    }

    default: break;
  }

  // never eat events
  return false;
}
Ejemplo n.º 11
0
void Controller::on_ui_down_released() 	{ m_cbc->downReleased(m_port); delayedUpdate(); }
Ejemplo n.º 12
0
void Controller::on_ui_up_released() 	{ m_cbc->upReleased(m_port); delayedUpdate(); }
Ejemplo n.º 13
0
void Controller::on_ui_right_released() { m_cbc->rightReleased(m_port); delayedUpdate(); }
Ejemplo n.º 14
0
void Controller::on_ui_left_released() 	{ m_cbc->leftReleased(m_port); delayedUpdate(); }
Ejemplo n.º 15
0
void Controller::on_ui_stop_clicked()
{
	m_client->setPort(m_port);
	m_client->sendCommand(KISS_STOP_COMMAND);
	delayedUpdate();
}
Ejemplo n.º 16
0
GPSFrame::GPSFrame(QWidget *parent, Qt::WFlags flags) : QFrame(parent)
{
    connect(this, SIGNAL(delayedUpdate()), this, SLOT(update()), Qt::QueuedConnection);

        frames = 0;
}