コード例 #1
0
ファイル: globe.cpp プロジェクト: levisjani/subsurface
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);
}
コード例 #2
0
ファイル: globe.cpp プロジェクト: Jheengut/subsurface
    }

    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)
        doubleClick = true;
    else if (type == QEvent::MouseButtonPress)
        doubleClick = false;

    // This disables Zooming when a double click occours on the scene.