Files
GoldenCheetah/src/BingMap.h
Mark Liversedge ac88659b9e Add Zoom to Interval on Maps
Can now zoom to a specific interval on the map views;
* Google Map
* Bing Map
2011-08-29 13:01:53 +01:00

109 lines
2.7 KiB
C++

/*
* Copyright (c) 2011 Mark Liversedge (liversedge@gmail.com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _GC_BingMap_h
#define _GC_BingMap_h
#include "GoldenCheetah.h"
#include <QWidget>
#include <QtWebKit>
#include <string>
#include <iostream>
#include <sstream>
#include <string>
#include "RideFile.h"
#include "MainWindow.h"
class QMouseEvent;
class RideItem;
class MainWindow;
class QColor;
class QVBoxLayout;
class QTabWidget;
class BingMap;
class BWebBridge : public QObject
{
Q_OBJECT;
private:
MainWindow *mainWindow;
BingMap *gm;
public:
BWebBridge(MainWindow *mainWindow, BingMap *gm) : mainWindow(mainWindow), gm(gm) {}
public slots:
Q_INVOKABLE void call(int count);
// drawing basic route, and interval polylines
Q_INVOKABLE int intervalCount();
Q_INVOKABLE QVariantList getLatLons(int i); // get array of latitudes for highlighted n
// once map and basic route is loaded
// this slot is called to draw additional
// overlays e.g. shaded route, markers
Q_INVOKABLE void drawOverlays();
// display/toggle interval on map
Q_INVOKABLE void toggleInterval(int);
void intervalsChanged() { emit drawIntervals(); }
signals:
void drawIntervals();
};
class BingMap : public GcWindow
{
Q_OBJECT
G_OBJECT
public:
BingMap(MainWindow *);
virtual ~BingMap() {}
bool first;
public slots:
void rideSelected();
void createMarkers();
void drawShadedRoute();
void zoomInterval(IntervalItem*);
private:
MainWindow *main;
QVBoxLayout *layout;
QWebView *view;
MainWindow *parent;
BWebBridge *webBridge;
BingMap(); // default ctor
int range;
int rideCP; // rider's CP
QString currentPage;
RideItem *current;
QColor GetColor(int watts);
void createHtml();
private slots:
void loadRide();
void updateFrame();
};
#endif