Ejemplo n.º 1
0
void MarbleWidget::notifyMouseClick( int x, int y)
{
    qreal  lon   = 0;
    qreal  lat   = 0;

    bool const valid = geoCoordinates( x, y, lon, lat, GeoDataCoordinates::Radian );

    if ( valid ) {
        emit mouseClickGeoPosition( lon, lat, GeoDataCoordinates::Radian );
    }
}
Ejemplo n.º 2
0
GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0)
{
	// check if Google Sat Maps are installed
	// if not, check if they are in a known location
	MapThemeManager mtm;
	QStringList list = mtm.mapThemeIds();
	QString theme, subsurfaceDataPath;
	QDir marble;
	bool foundGoogleMap = false;
	Q_FOREACH(theme, list)
		if (theme == "earth/googlesat/googlesat.dgml")
			foundGoogleMap = true;
	if (!foundGoogleMap) {
		subsurfaceDataPath = getSubsurfaceDataPath("marbledata");
		if (subsurfaceDataPath != "")
			MarbleDirs::setMarbleDataPath(subsurfaceDataPath);
	}
	messageWidget = new KMessageWidget(this);
	messageWidget->setCloseButtonVisible(false);
	messageWidget->setHidden(true);

	setMapThemeId("earth/googlesat/googlesat.dgml");
	//setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
	setProjection(Marble::Spherical);

	setAnimationsEnabled(true);
	setShowClouds(false);
	setShowBorders(false);
	setShowPlaces(true);
	setShowCrosshairs(false);
	setShowGrid(false);
	setShowOverviewMap(false);
	setShowScaleBar(true);
	setShowCompass(false);
	connect(this, SIGNAL(mouseClickGeoPosition(qreal, qreal, GeoDataCoordinates::Unit)),
			this, SLOT(mouseClicked(qreal, qreal, GeoDataCoordinates::Unit)));

	setMinimumHeight(0);
	setMinimumWidth(0);
	editingDiveCoords = 0;
	fixZoomTimer = new QTimer();
	connect(fixZoomTimer, SIGNAL(timeout()), this, SLOT(fixZoom()));
	fixZoomTimer->setSingleShot(true);
}
Ejemplo n.º 3
0
    setProjection(Marble::Spherical);

    setAnimationsEnabled(true);
    Q_FOREACH (AbstractFloatItem *i, floatItems()) {
        i->setVisible(false);
    }

    setShowClouds(false);
    setShowBorders(false);
    setShowPlaces(true);
    setShowCrosshairs(false);
    setShowGrid(false);
    setShowOverviewMap(false);
    setShowScaleBar(true);
    setShowCompass(false);
    connect(this, SIGNAL(mouseClickGeoPosition(qreal, qreal, GeoDataCoordinates::Unit)),
            this, SLOT(mouseClicked(qreal, qreal, GeoDataCoordinates::Unit)));

    setMinimumHeight(0);
    setMinimumWidth(0);
    connect(fixZoomTimer, SIGNAL(timeout()), this, SLOT(fixZoom()));
    fixZoomTimer->setSingleShot(true);
    installEventFilter(this);
}

bool GlobeGPS::eventFilter(QObject *obj, QEvent *ev)
{
    // sometimes Marble seems not to notice double clicks and consequently not call
    // the right callback - so let's remember here if the last 'click' is a 'double' or not
    enum QEvent::Type type = ev->type();
    if (type == QEvent::MouseButtonDblClick)