Esempio n. 1
0
FlyToEditWidget::FlyToEditWidget( const QModelIndex &index, MarbleWidget* widget, QWidget *parent ) :
    QWidget( parent ),
    m_widget( widget ),
    m_index( index ),
    m_button( new QToolButton )
{
    QHBoxLayout *layout = new QHBoxLayout;
    layout->setSpacing( 5 );

    QLabel* iconLabel = new QLabel;
    iconLabel->setPixmap( QPixmap( ":/marble/flag.png" ) );
    layout->addWidget( iconLabel );

    QLabel *waitLabel = new QLabel;
    waitLabel->setText(tr("Wait duration:"));
    layout->addWidget(waitLabel);

    m_waitSpin = new QDoubleSpinBox;
    layout->addWidget(m_waitSpin);
    m_waitSpin->setValue(flyToElement()->duration());
    m_waitSpin->setSuffix( tr(" s", "seconds") );

    QToolButton* flyToPinCenter = new QToolButton;
    flyToPinCenter->setIcon(QIcon(":/marble/places.png"));
    flyToPinCenter->setToolTip(tr("Current map center"));
    connect(flyToPinCenter, SIGNAL(clicked()), this, SLOT(updateCoordinates()));
    layout->addWidget(flyToPinCenter);

    m_button->setIcon( QIcon( ":/marble/document-save.png" ) );
    connect(m_button, SIGNAL(clicked()), this, SLOT(save()));
    layout->addWidget( m_button );

    setLayout( layout );
}
Esempio n. 2
0
void FlyToEditWidget::save()
{
    if (flyToElement()->view() != nullptr && m_coord != GeoDataCoordinates()) {
        GeoDataCoordinates coords = m_coord;
        if (auto camera = geodata_cast<GeoDataCamera>(flyToElement()->view())) {
            camera->setCoordinates( coords );
        } else if (auto lookAt = geodata_cast<GeoDataLookAt>(flyToElement()->view())) {
            lookAt->setCoordinates( coords );
        } else{
            lookAt = new GeoDataLookAt;
            lookAt->setCoordinates( coords );
            flyToElement()->setView( lookAt );
        }
    }

    flyToElement()->setDuration(m_durationSpin->value());

    if (m_modeCombo->currentIndex() == 0) {
        flyToElement()->setFlyToMode( GeoDataFlyTo::Smooth );
    } else if (m_modeCombo->currentIndex() == 1) {
        flyToElement()->setFlyToMode( GeoDataFlyTo::Bounce );
    }

    emit editingDone(m_index);
}
Esempio n. 3
0
void FlyToEditWidget::save()
{
    if (flyToElement()->view() != 0 && m_coord != GeoDataCoordinates()) {
        GeoDataCoordinates coords = m_coord;
        if ( flyToElement()->view()->nodeType() == GeoDataTypes::GeoDataCameraType ) {
            GeoDataCamera* camera = dynamic_cast<GeoDataCamera*>( flyToElement()->view() );
            camera->setCoordinates( coords );
        } else if ( flyToElement()->view()->nodeType() == GeoDataTypes::GeoDataLookAtType ) {
            GeoDataLookAt* lookAt = dynamic_cast<GeoDataLookAt*>( flyToElement()->view() );
            lookAt->setCoordinates( coords );
        } else{
            GeoDataLookAt* lookAt = new GeoDataLookAt;
            lookAt->setCoordinates( coords );
            flyToElement()->setView( lookAt );
        }
    }

    flyToElement()->setDuration(m_waitSpin->value());

    emit editingDone(m_index);
}
Esempio n. 4
0
FlyToEditWidget::FlyToEditWidget( const QModelIndex &index, MarbleWidget* widget, QWidget *parent ) :
    QWidget( parent ),
    m_widget( widget ),
    m_index( index ),
    m_button( new QToolButton )
{
    QHBoxLayout *layout = new QHBoxLayout;
    layout->setSpacing( 5 );

    QLabel* iconLabel = new QLabel;
    iconLabel->setPixmap(QPixmap(QStringLiteral(":/marble/flag.png")));
    layout->addWidget( iconLabel );

    QHBoxLayout *pairLayout = new QHBoxLayout;
    pairLayout->setSpacing( 10 );

    QHBoxLayout *durationLayout = new QHBoxLayout;
    durationLayout->setSpacing( 5 );

    QLabel *durationLabel = new QLabel;
    durationLabel->setText( tr("Duration:") );
    durationLayout->addWidget( durationLabel );

    m_durationSpin = new QDoubleSpinBox;
    durationLayout->addWidget( m_durationSpin );
    m_durationSpin->setValue( flyToElement()->duration() );
    m_durationSpin->setSuffix( tr(" s", "seconds") );

    QHBoxLayout *modeLayout = new QHBoxLayout;
    modeLayout->addSpacing( 5 );

    QLabel *modeLabel = new QLabel;
    modeLabel->setText( tr("Mode:") );
    modeLayout->addWidget( modeLabel );

    m_modeCombo = new QComboBox;
    modeLayout->addWidget( m_modeCombo );
    m_modeCombo->addItem( tr("Smooth") );
    m_modeCombo->addItem( tr("Bounce") );

    if( flyToElement()->flyToMode() == GeoDataFlyTo::Smooth ){
        m_modeCombo->setCurrentIndex( 0 );
    } else if( flyToElement()->flyToMode() == GeoDataFlyTo::Bounce ){
        m_modeCombo->setCurrentIndex( 1 );
    } else {
        m_modeCombo->setCurrentIndex( -1 );
    }

    pairLayout->addLayout( durationLayout );
    pairLayout->addLayout( modeLayout );

    layout->addLayout( pairLayout );

    QToolButton* flyToPinCenter = new QToolButton;
    flyToPinCenter->setIcon(QIcon(QStringLiteral(":/marble/places.png")));
    flyToPinCenter->setToolTip(tr("Current map center"));
    connect(flyToPinCenter, SIGNAL(clicked()), this, SLOT(updateCoordinates()));
    layout->addWidget(flyToPinCenter);

    m_button->setIcon(QIcon(QStringLiteral(":/marble/document-save.png")));
    connect(m_button, SIGNAL(clicked()), this, SLOT(save()));
    layout->addWidget( m_button );

    setLayout( layout );
}