mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-27 11:39:16 +02:00
Added the "Load map dir" feature
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include "map/map.h"
|
||||
#include "popup.h"
|
||||
#include "tooltip.h"
|
||||
#include "areaitem.h"
|
||||
|
||||
|
||||
@ -22,7 +23,7 @@ QString AreaItem::info() const
|
||||
}
|
||||
|
||||
AreaItem::AreaItem(const Area &area, Map *map, GraphicsItem *parent)
|
||||
: GraphicsItem(parent), _area(area)
|
||||
: PlaneItem(parent), _area(area)
|
||||
{
|
||||
_map = map;
|
||||
_digitalZoom = 0;
|
||||
@ -158,7 +159,6 @@ void AreaItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF((_width + 1) * pow(2, -_digitalZoom));
|
||||
setZValue(zValue() + 1.0);
|
||||
update();
|
||||
}
|
||||
|
||||
@ -167,12 +167,5 @@ void AreaItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
setZValue(zValue() - 1.0);
|
||||
update();
|
||||
}
|
||||
|
||||
void AreaItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Popup::show(event->screenPos(), info(), event->widget());
|
||||
QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
|
@ -2,12 +2,9 @@
|
||||
#define AREAITEM_H
|
||||
|
||||
#include "data/area.h"
|
||||
#include "graphicsscene.h"
|
||||
#include "tooltip.h"
|
||||
#include "planeitem.h"
|
||||
|
||||
class Map;
|
||||
|
||||
class AreaItem : public GraphicsItem
|
||||
class AreaItem : public PlaneItem
|
||||
{
|
||||
public:
|
||||
AreaItem(const Area &area, Map *map, GraphicsItem *parent = 0);
|
||||
@ -19,6 +16,7 @@ public:
|
||||
|
||||
const Area &area() const {return _area;}
|
||||
|
||||
RectC bounds() const {return _area.boundingRect();}
|
||||
void setMap(Map *map);
|
||||
|
||||
void setColor(const QColor &color);
|
||||
@ -27,17 +25,15 @@ public:
|
||||
void setStyle(Qt::PenStyle style);
|
||||
void setDigitalZoom(int zoom);
|
||||
|
||||
virtual QString info() const;
|
||||
QString info() const;
|
||||
|
||||
protected:
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
|
||||
private:
|
||||
QPainterPath painterPath(const Polygon &polygon);
|
||||
void updatePainterPath();
|
||||
ToolTip toolTip() const;
|
||||
|
||||
Area _area;
|
||||
Map *_map;
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "graphtab.h"
|
||||
#include "graphitem.h"
|
||||
#include "pathitem.h"
|
||||
#include "mapitem.h"
|
||||
#include "mapaction.h"
|
||||
#include "gui.h"
|
||||
|
||||
@ -306,10 +307,14 @@ void GUI::createActions()
|
||||
this);
|
||||
_loadMapAction->setMenuRole(QAction::NoRole);
|
||||
connect(_loadMapAction, SIGNAL(triggered()), this, SLOT(loadMap()));
|
||||
_loadMapDirAction = new QAction(QIcon(OPEN_FILE_ICON),
|
||||
tr("Load map directory..."), this);
|
||||
_loadMapDirAction->setMenuRole(QAction::NoRole);
|
||||
connect(_loadMapDirAction, SIGNAL(triggered()), this, SLOT(loadMapDir()));
|
||||
_clearMapCacheAction = new QAction(tr("Clear tile cache"), this);
|
||||
_clearMapCacheAction->setEnabled(false);
|
||||
_clearMapCacheAction->setMenuRole(QAction::NoRole);
|
||||
connect(_clearMapCacheAction, SIGNAL(triggered()), _mapView,
|
||||
connect(_clearMapCacheAction, SIGNAL(triggered()), this,
|
||||
SLOT(clearMapCache()));
|
||||
_nextMapAction = new QAction(tr("Next map"), this);
|
||||
_nextMapAction->setMenuRole(QAction::NoRole);
|
||||
@ -519,6 +524,7 @@ void GUI::createMenus()
|
||||
_mapMenu->addActions(_mapsActionGroup->actions());
|
||||
_mapsEnd = _mapMenu->addSeparator();
|
||||
_mapMenu->addAction(_loadMapAction);
|
||||
_mapMenu->addAction(_loadMapDirAction);
|
||||
_mapMenu->addAction(_clearMapCacheAction);
|
||||
_mapMenu->addSeparator();
|
||||
_mapMenu->addAction(_showCoordinatesAction);
|
||||
@ -774,23 +780,19 @@ bool GUI::openFile(const QString &fileName)
|
||||
if (fileName.isEmpty() || _files.contains(fileName))
|
||||
return false;
|
||||
|
||||
if (loadFile(fileName)) {
|
||||
_files.append(fileName);
|
||||
_browser->setCurrent(fileName);
|
||||
_fileActionGroup->setEnabled(true);
|
||||
_navigationActionGroup->setEnabled(true);
|
||||
|
||||
updateNavigationActions();
|
||||
updateStatusBarInfo();
|
||||
updateWindowTitle();
|
||||
|
||||
return true;
|
||||
} else {
|
||||
if (_files.isEmpty())
|
||||
_fileActionGroup->setEnabled(false);
|
||||
|
||||
if (!loadFile(fileName))
|
||||
return false;
|
||||
}
|
||||
|
||||
_files.append(fileName);
|
||||
_browser->setCurrent(fileName);
|
||||
_fileActionGroup->setEnabled(true);
|
||||
_navigationActionGroup->setEnabled(true);
|
||||
|
||||
updateNavigationActions();
|
||||
updateStatusBarInfo();
|
||||
updateWindowTitle();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GUI::loadFile(const QString &fileName)
|
||||
@ -1453,18 +1455,22 @@ bool GUI::loadMap(const QString &fileName)
|
||||
return false;
|
||||
}
|
||||
|
||||
MapAction *lastReady = 0;
|
||||
for (int i = 0; i < maps.size(); i++) {
|
||||
Map *map = maps.at(i);
|
||||
MapAction *a = createMapAction(map);
|
||||
_mapMenu->insertAction(_mapsEnd, a);
|
||||
if (map->isReady()) {
|
||||
a->trigger();
|
||||
lastReady = a;
|
||||
_showMapAction->setEnabled(true);
|
||||
_clearMapCacheAction->setEnabled(true);
|
||||
} else
|
||||
connect(a, SIGNAL(loaded()), this, SLOT(mapLoaded()));
|
||||
}
|
||||
|
||||
if (lastReady)
|
||||
lastReady->trigger();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1485,6 +1491,52 @@ void GUI::mapLoaded()
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::loadMapDir()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this,
|
||||
tr("Select maps directory"), _mapDir, QFileDialog::ShowDirsOnly);
|
||||
if (dir.isEmpty())
|
||||
return;
|
||||
|
||||
QString error;
|
||||
QList<Map*> maps(MapList::loadMaps(dir, error));
|
||||
if (maps.isEmpty()) {
|
||||
QMessageBox::critical(this, APP_NAME, tr("No usable map found"));
|
||||
return;
|
||||
}
|
||||
|
||||
QList<MapItem*> items(_mapView->loadMaps(maps));
|
||||
|
||||
QFileInfo fi(dir);
|
||||
QMenu *menu = new QMenu(fi.fileName());
|
||||
_mapMenu->insertMenu(_mapsEnd, menu);
|
||||
|
||||
for (int i = 0; i < maps.size(); i++) {
|
||||
Map *map = maps.at(i);
|
||||
MapAction *a = createMapAction(map);
|
||||
menu->addAction(a);
|
||||
if (map->isReady()) {
|
||||
_showMapAction->setEnabled(true);
|
||||
_clearMapCacheAction->setEnabled(true);
|
||||
} else
|
||||
connect(a, SIGNAL(loaded()), this, SLOT(mapLoaded()));
|
||||
|
||||
connect(items.at(i), SIGNAL(triggered()), a, SLOT(trigger()));
|
||||
}
|
||||
|
||||
_mapDir = fi.absolutePath();
|
||||
_areaCount += maps.size();
|
||||
_fileActionGroup->setEnabled(true);
|
||||
_reloadFileAction->setEnabled(false);
|
||||
}
|
||||
|
||||
void GUI::clearMapCache()
|
||||
{
|
||||
if (QMessageBox::question(this, APP_NAME,
|
||||
tr("Clear the map tile cache?")) == QMessageBox::Yes)
|
||||
_mapView->clearMapCache();
|
||||
}
|
||||
|
||||
void GUI::updateStatusBarInfo()
|
||||
{
|
||||
if (_files.count() == 0)
|
||||
|
@ -62,9 +62,11 @@ private slots:
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show);
|
||||
void loadMap();
|
||||
void loadMapDir();
|
||||
void nextMap();
|
||||
void prevMap();
|
||||
void openOptions();
|
||||
void clearMapCache();
|
||||
|
||||
void mapChanged();
|
||||
void graphChanged(int);
|
||||
@ -172,6 +174,7 @@ private:
|
||||
QAction *_showMapAction;
|
||||
QAction *_fullscreenAction;
|
||||
QAction *_loadMapAction;
|
||||
QAction *_loadMapDirAction;
|
||||
QAction *_clearMapCacheAction;
|
||||
QAction *_showGraphsAction;
|
||||
QAction *_showGraphGridAction;
|
||||
|
169
src/GUI/mapitem.cpp
Normal file
169
src/GUI/mapitem.cpp
Normal file
@ -0,0 +1,169 @@
|
||||
#include <QCursor>
|
||||
#include <QPainter>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include "map/map.h"
|
||||
#include "popup.h"
|
||||
#include "tooltip.h"
|
||||
#include "mapitem.h"
|
||||
|
||||
|
||||
QString MapItem::info() const
|
||||
{
|
||||
ToolTip tt;
|
||||
|
||||
if (!_name.isEmpty())
|
||||
tt.insert(tr("Name"), _name);
|
||||
if (!_fileName.isEmpty())
|
||||
tt.insert(tr("File"), _fileName);
|
||||
|
||||
return tt.toString();
|
||||
}
|
||||
|
||||
MapItem::MapItem(Map *src, Map *map, GraphicsItem *parent)
|
||||
: PlaneItem(parent)
|
||||
{
|
||||
_name = src->name();
|
||||
_fileName = src->path();
|
||||
_bounds = RectC(src->xy2ll(src->bounds().topLeft()),
|
||||
src->xy2ll(src->bounds().bottomRight()));
|
||||
|
||||
_map = map;
|
||||
_digitalZoom = 0;
|
||||
|
||||
_width = 2;
|
||||
_opacity = 0.5;
|
||||
QBrush brush(Qt::SolidPattern);
|
||||
_pen = QPen(brush, _width);
|
||||
|
||||
updatePainterPath();
|
||||
|
||||
setCursor(Qt::ArrowCursor);
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
||||
void MapItem::updatePainterPath()
|
||||
{
|
||||
_painterPath = QPainterPath();
|
||||
|
||||
if (_bounds.left() > _bounds.right()) {
|
||||
QRectF r1(_map->ll2xy(_bounds.topLeft()), _map->ll2xy(Coordinates(180,
|
||||
_bounds.bottomRight().lat())));
|
||||
QRectF r2(_map->ll2xy(Coordinates(-180, _bounds.topLeft().lat())),
|
||||
_map->ll2xy(_bounds.bottomRight()));
|
||||
QRectF r(_map->ll2xy(_bounds.topLeft()),
|
||||
_map->ll2xy(_bounds.bottomRight()));
|
||||
|
||||
if (r1.united(r2) == r)
|
||||
_painterPath.addRect(r);
|
||||
else {
|
||||
_painterPath.addRect(r1);
|
||||
_painterPath.addRect(r2);
|
||||
}
|
||||
} else
|
||||
_painterPath.addRect(QRectF(_map->ll2xy(_bounds.topLeft()),
|
||||
_map->ll2xy(_bounds.bottomRight())));
|
||||
}
|
||||
|
||||
void MapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(widget);
|
||||
|
||||
painter->setPen(_width ? _pen : QPen(Qt::NoPen));
|
||||
painter->drawPath(_painterPath);
|
||||
painter->fillPath(_painterPath, _brush);
|
||||
|
||||
//QPen p = QPen(QBrush(Qt::red), 0);
|
||||
//painter->setPen(p);
|
||||
//painter->drawRect(boundingRect());
|
||||
}
|
||||
|
||||
void MapItem::setMap(Map *map)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
|
||||
_map = map;
|
||||
|
||||
updatePainterPath();
|
||||
}
|
||||
|
||||
void MapItem::setColor(const QColor &color)
|
||||
{
|
||||
if (_pen.color() == color)
|
||||
return;
|
||||
|
||||
QColor bc(color);
|
||||
bc.setAlphaF(_opacity * color.alphaF());
|
||||
|
||||
_pen.setColor(color);
|
||||
_brush = QBrush(bc);
|
||||
update();
|
||||
}
|
||||
|
||||
void MapItem::setOpacity(qreal opacity)
|
||||
{
|
||||
if (_opacity == opacity)
|
||||
return;
|
||||
|
||||
_opacity = opacity;
|
||||
QColor bc(_pen.color());
|
||||
bc.setAlphaF(_opacity * _pen.color().alphaF());
|
||||
_brush = QBrush(bc);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void MapItem::setWidth(qreal width)
|
||||
{
|
||||
if (_width == width)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
|
||||
_width = width;
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
}
|
||||
|
||||
void MapItem::setStyle(Qt::PenStyle style)
|
||||
{
|
||||
if (_pen.style() == style)
|
||||
return;
|
||||
|
||||
_pen.setStyle(style);
|
||||
update();
|
||||
}
|
||||
|
||||
void MapItem::setDigitalZoom(int zoom)
|
||||
{
|
||||
if (_digitalZoom == zoom)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
|
||||
_digitalZoom = zoom;
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
}
|
||||
|
||||
void MapItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF((_width + 1) * pow(2, -_digitalZoom));
|
||||
update();
|
||||
}
|
||||
|
||||
void MapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
_pen.setWidthF(_width * pow(2, -_digitalZoom));
|
||||
update();
|
||||
}
|
||||
|
||||
void MapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
emit triggered();
|
||||
}
|
55
src/GUI/mapitem.h
Normal file
55
src/GUI/mapitem.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef MAPITEM_H
|
||||
#define MAPITEM_H
|
||||
|
||||
#include "planeitem.h"
|
||||
|
||||
class MapItem : public QObject, public PlaneItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MapItem(Map *src, Map *map, GraphicsItem *parent = 0);
|
||||
|
||||
QPainterPath shape() const {return _painterPath;}
|
||||
QRectF boundingRect() const {return _painterPath.boundingRect();}
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
||||
RectC bounds() const {return _bounds;}
|
||||
void setMap(Map *map);
|
||||
|
||||
void setColor(const QColor &color);
|
||||
void setOpacity(qreal opacity);
|
||||
void setWidth(qreal width);
|
||||
void setStyle(Qt::PenStyle style);
|
||||
void setDigitalZoom(int zoom);
|
||||
|
||||
QString info() const;
|
||||
|
||||
signals:
|
||||
void triggered();
|
||||
|
||||
protected:
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
||||
|
||||
private:
|
||||
void updatePainterPath();
|
||||
|
||||
RectC _bounds;
|
||||
QString _name;
|
||||
QString _fileName;
|
||||
|
||||
Map *_map;
|
||||
int _digitalZoom;
|
||||
|
||||
qreal _width;
|
||||
QPen _pen;
|
||||
QBrush _brush;
|
||||
qreal _opacity;
|
||||
|
||||
QPainterPath _painterPath;
|
||||
};
|
||||
|
||||
#endif // MAPITEM_H
|
@ -15,6 +15,7 @@
|
||||
#include "areaitem.h"
|
||||
#include "scaleitem.h"
|
||||
#include "coordinatesitem.h"
|
||||
#include "mapitem.h"
|
||||
#include "keys.h"
|
||||
#include "graphicsscene.h"
|
||||
#include "mapview.h"
|
||||
@ -27,6 +28,20 @@
|
||||
#define COORDINATES_OFFSET SCALE_OFFSET
|
||||
|
||||
|
||||
template<typename T>
|
||||
static void updateZValues(T &items)
|
||||
{
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
const QGraphicsItem *ai = items.at(i);
|
||||
for (int j = 0; j < items.size(); j++) {
|
||||
QGraphicsItem *aj = items[j];
|
||||
if (aj->boundingRect().contains(ai->boundingRect()))
|
||||
aj->setZValue(qMin(ai->zValue() - 1, aj->zValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
{
|
||||
@ -170,18 +185,19 @@ void MapView::addArea(const Area &area)
|
||||
}
|
||||
|
||||
AreaItem *ai = new AreaItem(area, _map);
|
||||
_areas.append(ai);
|
||||
_ar |= ai->area().boundingRect();
|
||||
ai->setColor(_palette.nextColor());
|
||||
ai->setWidth(_areaWidth);
|
||||
ai->setStyle(_areaStyle);
|
||||
ai->setOpacity(_areaOpacity);
|
||||
ai->setDigitalZoom(_digitalZoom);
|
||||
ai->setVisible(_showAreas);
|
||||
|
||||
_scene->addItem(ai);
|
||||
_ar |= ai->bounds();
|
||||
_areas.append(ai);
|
||||
|
||||
if (_showAreas)
|
||||
addPOI(_poi->points(ai->area()));
|
||||
addPOI(_poi->points(ai->bounds()));
|
||||
}
|
||||
|
||||
void MapView::addWaypoints(const QVector<Waypoint> &waypoints)
|
||||
@ -205,6 +221,26 @@ void MapView::addWaypoints(const QVector<Waypoint> &waypoints)
|
||||
}
|
||||
}
|
||||
|
||||
MapItem *MapView::addMap(Map *map)
|
||||
{
|
||||
MapItem *mi = new MapItem(map, _map);
|
||||
mi->setColor(_palette.nextColor());
|
||||
mi->setWidth(_areaWidth);
|
||||
mi->setStyle(_areaStyle);
|
||||
mi->setOpacity(_areaOpacity);
|
||||
mi->setDigitalZoom(_digitalZoom);
|
||||
mi->setVisible(_showAreas);
|
||||
|
||||
_scene->addItem(mi);
|
||||
_ar |= mi->bounds();
|
||||
_areas.append(mi);
|
||||
|
||||
if (_showAreas)
|
||||
addPOI(_poi->points(mi->bounds()));
|
||||
|
||||
return mi;
|
||||
}
|
||||
|
||||
QList<PathItem *> MapView::loadData(const Data &data)
|
||||
{
|
||||
QList<PathItem *> paths;
|
||||
@ -227,11 +263,34 @@ QList<PathItem *> MapView::loadData(const Data &data)
|
||||
else
|
||||
updatePOIVisibility();
|
||||
|
||||
if (!data.areas().isEmpty())
|
||||
updateZValues(_areas);
|
||||
|
||||
centerOn(contentCenter());
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
QList<MapItem *> MapView::loadMaps(const QList<Map*> &maps)
|
||||
{
|
||||
QList<MapItem *> items;
|
||||
int zoom = _map->zoom();
|
||||
|
||||
for (int i = 0; i < maps.size(); i++)
|
||||
items.append(addMap(maps.at(i)));
|
||||
|
||||
if (fitMapZoom() != zoom)
|
||||
rescale();
|
||||
else
|
||||
updatePOIVisibility();
|
||||
|
||||
updateZValues(_areas);
|
||||
|
||||
centerOn(contentCenter());
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
int MapView::fitMapZoom() const
|
||||
{
|
||||
RectC br = _tr | _rr | _wr | _ar;
|
||||
@ -373,7 +432,7 @@ void MapView::updatePOI()
|
||||
addPOI(_poi->points(_routes.at(i)->path()));
|
||||
if (_showAreas)
|
||||
for (int i = 0; i < _areas.size(); i++)
|
||||
addPOI(_poi->points(_areas.at(i)->area()));
|
||||
addPOI(_poi->points(_areas.at(i)->bounds()));
|
||||
if (_showWaypoints)
|
||||
for (int i = 0; i< _waypoints.size(); i++)
|
||||
addPOI(_poi->points(_waypoints.at(i)->waypoint()));
|
||||
@ -504,6 +563,10 @@ void MapView::wheelEvent(QWheelEvent *event)
|
||||
|
||||
void MapView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
QGraphicsView::mouseDoubleClickEvent(event);
|
||||
if (event->isAccepted())
|
||||
return;
|
||||
|
||||
if (event->button() != Qt::LeftButton && event->button() != Qt::RightButton)
|
||||
return;
|
||||
|
||||
|
@ -29,7 +29,8 @@ class ScaleItem;
|
||||
class CoordinatesItem;
|
||||
class PathItem;
|
||||
class GraphItem;
|
||||
class AreaItem;
|
||||
class PlaneItem;
|
||||
class MapItem;
|
||||
class Area;
|
||||
class GraphicsScene;
|
||||
class QTimeZone;
|
||||
@ -49,6 +50,7 @@ public:
|
||||
MapView(Map *map, POI *poi, QWidget *parent = 0);
|
||||
|
||||
QList<PathItem *> loadData(const Data &data);
|
||||
QList<MapItem *> loadMaps(const QList<Map*> &maps);
|
||||
|
||||
void setPalette(const Palette &palette);
|
||||
void setPOI(POI *poi);
|
||||
@ -108,6 +110,7 @@ private:
|
||||
|
||||
PathItem *addTrack(const Track &track);
|
||||
PathItem *addRoute(const Route &route);
|
||||
MapItem *addMap(Map *map);
|
||||
void addArea(const Area &area);
|
||||
void addWaypoints(const QVector<Waypoint> &waypoints);
|
||||
void addPOI(const QList<Waypoint> &waypoints);
|
||||
@ -140,7 +143,7 @@ private:
|
||||
QList<TrackItem*> _tracks;
|
||||
QList<RouteItem*> _routes;
|
||||
QList<WaypointItem*> _waypoints;
|
||||
QList<AreaItem*> _areas;
|
||||
QList<PlaneItem*> _areas;
|
||||
POIHash _pois;
|
||||
|
||||
RectC _tr, _rr, _wr, _ar;
|
||||
|
24
src/GUI/planeitem.h
Normal file
24
src/GUI/planeitem.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef PLANEITEM_H
|
||||
#define PLANEITEM_H
|
||||
|
||||
#include "common/rectc.h"
|
||||
#include "graphicsscene.h"
|
||||
|
||||
class Map;
|
||||
|
||||
class PlaneItem : public GraphicsItem
|
||||
{
|
||||
public:
|
||||
PlaneItem(GraphicsItem *parent = 0) : GraphicsItem(parent) {}
|
||||
|
||||
virtual RectC bounds() const = 0;
|
||||
virtual void setMap(Map *map) = 0;
|
||||
|
||||
virtual void setColor(const QColor &color) = 0;
|
||||
virtual void setOpacity(qreal opacity) = 0;
|
||||
virtual void setWidth(qreal width) = 0;
|
||||
virtual void setStyle(Qt::PenStyle style) = 0;
|
||||
virtual void setDigitalZoom(int zoom) = 0;
|
||||
};
|
||||
|
||||
#endif // PLANEITEM_H
|
Reference in New Issue
Block a user