void MarbleMap::setSize( const QSize& size ) { d->m_viewport.setSize( size ); d->m_textureLayer.setNeedsUpdate(); emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() ); }
void MarbleMap::centerOn( const qreal lon, const qreal lat ) { d->m_viewport.centerOn( lon * DEG2RAD, lat * DEG2RAD ); d->m_textureLayer.setNeedsUpdate(); emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() ); }
void Search::setMap( MarbleWidget* widget ) { m_marbleWidget = widget; connect( m_marbleWidget, SIGNAL(visibleLatLonAltBoxChanged()), this, SLOT(updatePlacemarks()) ); connect( m_marbleWidget, SIGNAL(mapThemeChanged()), this, SLOT(updatePlacemarks()) ); emit mapChanged(); }
void DownloadRegionDialog::showEvent( QShowEvent * event ) { connect( d->m_widget, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)), this, SLOT(setVisibleLatLonAltBox(GeoDataLatLonAltBox)) ); connect( d->m_widget, SIGNAL(themeChanged(QString)), this, SLOT(updateTextureLayer()) ); emit shown(); event->accept(); }
void MarbleMap::setProjection( Projection projection ) { emit projectionChanged( projection ); d->m_viewport.setProjection( projection ); d->m_textureLayer.setupTextureMapper( projection ); emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() ); }
MarbleDBusInterface::MarbleDBusInterface( MarbleWidget* widget ) : QDBusAbstractAdaptor( widget ), d( new Private( widget ) ) { connect( widget, SIGNAL(themeChanged(QString)), this, SIGNAL(mapThemeChanged(QString)) ); connect( widget, SIGNAL(tileLevelChanged(int)), this, SIGNAL(tileLevelChanged(int)) ); connect( widget, SIGNAL(zoomChanged(int)), this, SIGNAL(zoomChanged(int)) ); connect( widget, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)), this, SLOT(handleVisibleLatLonAltBoxChange()) ); }
RoutingLayer::RoutingLayer( MarbleWidget *widget, QWidget *parent ) : QObject( parent ), d( new RoutingLayerPrivate( this, widget ) ) { widget->installEventFilter( this ); connect( widget->model()->routingManager(), SIGNAL( stateChanged( RoutingManager::State ) ), this, SLOT( updateRouteState( RoutingManager::State ) ) ); connect( widget, SIGNAL( visibleLatLonAltBoxChanged( GeoDataLatLonAltBox ) ), this, SLOT( setViewportChanged() ) ); connect( widget->model()->routingManager()->alternativeRoutesModel(), SIGNAL( currentRouteChanged( GeoDataDocument* ) ), this, SLOT( setViewportChanged() ) ); }
void MarbleMap::setRadius( int radius ) { const int oldRadius = d->m_viewport.radius(); d->m_viewport.setRadius( radius ); d->m_textureLayer.setNeedsUpdate(); if ( oldRadius != d->m_viewport.radius() ) { emit radiusChanged( radius ); emit visibleLatLonAltBoxChanged( d->m_viewport.viewLatLonAltBox() ); } }
RoutingLayer::RoutingLayer( MarbleWidget *widget, QWidget *parent ) : QObject( parent ), d( new RoutingLayerPrivate( this, widget ) ) { connect( widget->model()->routingManager(), SIGNAL(stateChanged(RoutingManager::State)), this, SLOT(updateRouteState()) ); connect( widget, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)), this, SLOT(setViewportChanged()) ); connect( widget->model()->routingManager()->alternativeRoutesModel(), SIGNAL(currentRouteChanged(GeoDataDocument*)), this, SLOT(setViewportChanged()) ); connect( widget->model()->routingManager()->alternativeRoutesModel(), SIGNAL(currentRouteChanged(GeoDataDocument*)), this, SIGNAL(repaintNeeded()) ); connect( widget->model()->routingManager()->alternativeRoutesModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(showAlternativeRoutes()) ); }
MapBrowserWidget::MapBrowserWidget(QWidget *parent) : Marble::MarbleWidget(parent), KFormDesigner::FormWidgetInterface(), KexiFormDataItemInterface(), m_slotMapChanged_enabled(true), m_internalReadOnly(false) { #ifndef Q_CC_MSVC #warning this id could be invalid; try to use Marble::MapThemeManager::mapThemes() and get proper Marble::GeoSceneDocument::head()->mapThemeId() #endif //Marble::GeoSceneDocument::head()->mapThemeId() setMapThemeId("earth/srtm/srtm.dgml"); connect( this, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)), this , SLOT(slotMapChanged())); }
void Tracking::setMap( MarbleQuickItem* item ) { if ( item != m_marbleQuickItem ) { m_marbleQuickItem = item; if ( m_marbleQuickItem ) { m_marbleQuickItem->model()->positionTracking()->setTrackVisible( showTrack() ); setShowPositionMarkerPlugin( m_positionMarkerType == Arrow ); connect( m_marbleQuickItem, SIGNAL(visibleLatLonAltBoxChanged()), this, SLOT(updatePositionMarker()) ); connect( m_marbleQuickItem, SIGNAL(mapThemeChanged()), this, SLOT(updatePositionMarker()) ); } emit mapChanged(); } }
void Navigation::setMap( MarbleWidget* widget ) { d->m_marbleWidget = widget; if ( d->m_marbleWidget ) { // Avoid the QWidget based warning d->m_marbleWidget->model()->routingManager()->setShowGuidanceModeStartupWarning( false ); connect( d->m_marbleWidget->model()->routingManager()->routingModel(), SIGNAL(positionChanged()), this, SLOT(update()) ); delete d->m_autoNavigation; d->m_autoNavigation = new Marble::AutoNavigation( d->m_marbleWidget->model(), d->m_marbleWidget->viewport(), this ); connect( d->m_autoNavigation, SIGNAL(zoomIn(FlyToMode)), d->m_marbleWidget, SLOT(zoomIn()) ); connect( d->m_autoNavigation, SIGNAL(zoomOut(FlyToMode)), d->m_marbleWidget, SLOT(zoomOut()) ); connect( d->m_autoNavigation, SIGNAL(centerOn(GeoDataCoordinates,bool)), d->m_marbleWidget, SLOT(centerOn(GeoDataCoordinates)) ); connect( d->m_marbleWidget, SIGNAL(visibleLatLonAltBoxChanged()), d->m_autoNavigation, SLOT(inhibitAutoAdjustments()) ); connect( d->m_marbleWidget->model()->positionTracking(), SIGNAL(statusChanged(PositionProviderStatus)), &d->m_voiceNavigation, SLOT(handleTrackingStatusChange(PositionProviderStatus)) ); }
bool ElevationProfileFloatItem::eventFilter( QObject *object, QEvent *e ) { if ( !enabled() || !visible() ) { return false; } MarbleWidget *widget = dynamic_cast<MarbleWidget*>( object ); if ( !widget ) { return AbstractFloatItem::eventFilter(object,e); } if ( widget && !m_marbleWidget ) { m_marbleWidget = widget; connect( this, SIGNAL(dataUpdated()), this, SLOT(updateVisiblePoints()) ); connect( m_marbleWidget, SIGNAL(visibleLatLonAltBoxChanged(GeoDataLatLonAltBox)), this, SLOT(updateVisiblePoints()) ); connect( this, SIGNAL(settingsChanged(QString)), this, SLOT(updateVisiblePoints()) ); } if ( e->type() == QEvent::MouseButtonDblClick || e->type() == QEvent::MouseMove ) { GeoDataTreeModel *const treeModel = const_cast<MarbleModel *>( marbleModel() )->treeModel(); QMouseEvent *event = static_cast<QMouseEvent*>( e ); QRectF plotRect = QRectF ( m_leftGraphMargin, 0, m_eleGraphWidth, contentSize().height() ); plotRect.translate( positivePosition() ); plotRect.translate( padding(), padding() ); // for antialiasing: increase size by 1 px to each side plotRect.translate(-1, -1); plotRect.setSize(plotRect.size() + QSize(2, 2) ); const bool cursorAboveFloatItem = plotRect.contains(event->pos()); if ( cursorAboveFloatItem ) { const int start = m_zoomToViewport ? m_firstVisiblePoint : 0; const int end = m_zoomToViewport ? m_lastVisiblePoint : m_eleData.size(); // Double click triggers recentering the map at the specified position if ( e->type() == QEvent::MouseButtonDblClick ) { const QPointF mousePosition = event->pos() - plotRect.topLeft(); const int xPos = mousePosition.x(); for ( int i = start; i < end; ++i) { const int plotPos = ( m_eleData.value(i).x() - m_axisX.minValue() ) * m_eleGraphWidth / m_axisX.range(); if ( plotPos >= xPos ) { widget->centerOn( m_points[i], true ); break; } } return true; } if ( e->type() == QEvent::MouseMove && !(event->buttons() & Qt::LeftButton) ) { // Cross hair cursor when moving above the float item // and mark the position on the graph widget->setCursor(QCursor(Qt::CrossCursor)); if ( m_cursorPositionX != event->pos().x() - plotRect.left() ) { m_cursorPositionX = event->pos().x() - plotRect.left(); const qreal xpos = m_axisX.minValue() + ( m_cursorPositionX / m_eleGraphWidth ) * m_axisX.range(); GeoDataCoordinates currentPoint; // invalid coordinates for ( int i = start; i < end; ++i) { if ( m_eleData.value(i).x() >= xpos ) { currentPoint = m_points[i]; currentPoint.setAltitude( m_eleData.value(i).y() ); break; } } m_markerPlacemark->setCoordinate( currentPoint ); if ( m_documentIndex < 0 ) { m_documentIndex = treeModel->addDocument( &m_markerDocument ); } emit repaintNeeded(); } return true; } } else { if ( m_documentIndex >= 0 ) { m_markerPlacemark->setCoordinate( GeoDataCoordinates() ); // set to invalid treeModel->removeDocument( &m_markerDocument ); m_documentIndex = -1; emit repaintNeeded(); } } } return AbstractFloatItem::eventFilter(object,e); }