mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-18 11:52:08 +01:00
Added waypoints/POI size/color settings
This commit is contained in:
parent
47683e5447
commit
9fd8b84c3b
28
src/gui.cpp
28
src/gui.cpp
@ -881,6 +881,14 @@ void GUI::openOptions()
|
|||||||
_pathView->setTrackStyle(options.trackStyle);
|
_pathView->setTrackStyle(options.trackStyle);
|
||||||
if (options.routeStyle != _options.routeStyle)
|
if (options.routeStyle != _options.routeStyle)
|
||||||
_pathView->setRouteStyle(options.routeStyle);
|
_pathView->setRouteStyle(options.routeStyle);
|
||||||
|
if (options.waypointSize != _options.waypointSize)
|
||||||
|
_pathView->setWaypointSize(options.waypointSize);
|
||||||
|
if (options.waypointColor != _options.waypointColor)
|
||||||
|
_pathView->setWaypointColor(options.waypointColor);
|
||||||
|
if (options.poiSize != _options.poiSize)
|
||||||
|
_pathView->setPOISize(options.poiSize);
|
||||||
|
if (options.poiColor != _options.poiColor)
|
||||||
|
_pathView->setPOIColor(options.poiColor);
|
||||||
if (options.pathAntiAliasing != _options.pathAntiAliasing)
|
if (options.pathAntiAliasing != _options.pathAntiAliasing)
|
||||||
_pathView->setRenderHint(QPainter::Antialiasing,
|
_pathView->setRenderHint(QPainter::Antialiasing,
|
||||||
options.pathAntiAliasing);
|
options.pathAntiAliasing);
|
||||||
@ -1620,6 +1628,14 @@ void GUI::writeSettings()
|
|||||||
settings.setValue(TRACK_STYLE_SETTING, (int)_options.trackStyle);
|
settings.setValue(TRACK_STYLE_SETTING, (int)_options.trackStyle);
|
||||||
if (_options.routeStyle != ROUTE_STYLE_DEFAULT)
|
if (_options.routeStyle != ROUTE_STYLE_DEFAULT)
|
||||||
settings.setValue(ROUTE_STYLE_SETTING, (int)_options.routeStyle);
|
settings.setValue(ROUTE_STYLE_SETTING, (int)_options.routeStyle);
|
||||||
|
if (_options.waypointSize != WAYPOINT_SIZE_DEFAULT)
|
||||||
|
settings.setValue(WAYPOINT_SIZE_SETTING, _options.waypointSize);
|
||||||
|
if (_options.waypointColor != WAYPOINT_COLOR_DEFAULT)
|
||||||
|
settings.setValue(WAYPOINT_COLOR_SETTING, _options.waypointColor);
|
||||||
|
if (_options.poiSize != POI_SIZE_DEFAULT)
|
||||||
|
settings.setValue(POI_SIZE_SETTING, _options.poiSize);
|
||||||
|
if (_options.poiColor != POI_COLOR_DEFAULT)
|
||||||
|
settings.setValue(POI_COLOR_SETTING, _options.poiColor);
|
||||||
if (_options.graphWidth != GRAPH_WIDTH_DEFAULT)
|
if (_options.graphWidth != GRAPH_WIDTH_DEFAULT)
|
||||||
settings.setValue(GRAPH_WIDTH_SETTING, _options.graphWidth);
|
settings.setValue(GRAPH_WIDTH_SETTING, _options.graphWidth);
|
||||||
if (_options.pathAntiAliasing != PATH_AA_DEFAULT)
|
if (_options.pathAntiAliasing != PATH_AA_DEFAULT)
|
||||||
@ -1825,6 +1841,14 @@ void GUI::readSettings()
|
|||||||
(int)ROUTE_STYLE_DEFAULT).toInt();
|
(int)ROUTE_STYLE_DEFAULT).toInt();
|
||||||
_options.pathAntiAliasing = settings.value(PATH_AA_SETTING, PATH_AA_DEFAULT)
|
_options.pathAntiAliasing = settings.value(PATH_AA_SETTING, PATH_AA_DEFAULT)
|
||||||
.toBool();
|
.toBool();
|
||||||
|
_options.waypointSize = settings.value(WAYPOINT_SIZE_SETTING,
|
||||||
|
WAYPOINT_SIZE_DEFAULT).toInt();
|
||||||
|
_options.waypointColor = settings.value(WAYPOINT_COLOR_SETTING,
|
||||||
|
WAYPOINT_COLOR_DEFAULT).value<QColor>();
|
||||||
|
_options.poiSize = settings.value(POI_SIZE_SETTING, POI_SIZE_DEFAULT)
|
||||||
|
.toInt();
|
||||||
|
_options.poiColor = settings.value(POI_COLOR_SETTING, POI_COLOR_DEFAULT)
|
||||||
|
.value<QColor>();
|
||||||
_options.graphWidth = settings.value(GRAPH_WIDTH_SETTING,
|
_options.graphWidth = settings.value(GRAPH_WIDTH_SETTING,
|
||||||
GRAPH_WIDTH_DEFAULT).toInt();
|
GRAPH_WIDTH_DEFAULT).toInt();
|
||||||
_options.graphAntiAliasing = settings.value(GRAPH_AA_SETTING,
|
_options.graphAntiAliasing = settings.value(GRAPH_AA_SETTING,
|
||||||
@ -1875,6 +1899,10 @@ void GUI::readSettings()
|
|||||||
_pathView->setRouteWidth(_options.routeWidth);
|
_pathView->setRouteWidth(_options.routeWidth);
|
||||||
_pathView->setTrackStyle(_options.trackStyle);
|
_pathView->setTrackStyle(_options.trackStyle);
|
||||||
_pathView->setRouteStyle(_options.routeStyle);
|
_pathView->setRouteStyle(_options.routeStyle);
|
||||||
|
_pathView->setWaypointSize(_options.waypointSize);
|
||||||
|
_pathView->setWaypointColor(_options.waypointColor);
|
||||||
|
_pathView->setPOISize(_options.poiSize);
|
||||||
|
_pathView->setPOIColor(_options.poiColor);
|
||||||
_pathView->setRenderHint(QPainter::Antialiasing, _options.pathAntiAliasing);
|
_pathView->setRenderHint(QPainter::Antialiasing, _options.pathAntiAliasing);
|
||||||
if (_options.useOpenGL)
|
if (_options.useOpenGL)
|
||||||
_pathView->useOpenGL(true);
|
_pathView->useOpenGL(true);
|
||||||
|
@ -24,8 +24,20 @@
|
|||||||
#define MENU_MARGIN 20
|
#define MENU_MARGIN 20
|
||||||
#define MENU_ICON_SIZE 32
|
#define MENU_ICON_SIZE 32
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
static QFrame *line()
|
||||||
|
{
|
||||||
|
QFrame *l = new QFrame();
|
||||||
|
l->setFrameShape(QFrame::HLine);
|
||||||
|
l->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QWidget *OptionsDialog::createAppearancePage()
|
QWidget *OptionsDialog::createAppearancePage()
|
||||||
{
|
{
|
||||||
|
// Paths
|
||||||
_baseColor = new ColorBox();
|
_baseColor = new ColorBox();
|
||||||
_baseColor->setColor(_options->palette.color());
|
_baseColor->setColor(_options->palette.color());
|
||||||
_colorOffset = new QDoubleSpinBox();
|
_colorOffset = new QDoubleSpinBox();
|
||||||
@ -75,22 +87,12 @@ QWidget *OptionsDialog::createAppearancePage()
|
|||||||
QWidget *pathTab = new QWidget();
|
QWidget *pathTab = new QWidget();
|
||||||
QVBoxLayout *pathTabLayout = new QVBoxLayout();
|
QVBoxLayout *pathTabLayout = new QVBoxLayout();
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QFrame *l0 = new QFrame();
|
|
||||||
l0->setFrameShape(QFrame::HLine);
|
|
||||||
l0->setFrameShadow(QFrame::Sunken);
|
|
||||||
QFrame *l1 = new QFrame();
|
|
||||||
l1->setFrameShape(QFrame::HLine);
|
|
||||||
l1->setFrameShadow(QFrame::Sunken);
|
|
||||||
QFrame *l2 = new QFrame();
|
|
||||||
l2->setFrameShape(QFrame::HLine);
|
|
||||||
l2->setFrameShadow(QFrame::Sunken);
|
|
||||||
|
|
||||||
pathTabLayout->addLayout(paletteLayout);
|
pathTabLayout->addLayout(paletteLayout);
|
||||||
pathTabLayout->addWidget(l0);
|
pathTabLayout->addWidget(line());
|
||||||
pathTabLayout->addLayout(trackLayout);
|
pathTabLayout->addLayout(trackLayout);
|
||||||
pathTabLayout->addWidget(l1);
|
pathTabLayout->addWidget(line());
|
||||||
pathTabLayout->addLayout(routeLayout);
|
pathTabLayout->addLayout(routeLayout);
|
||||||
pathTabLayout->addWidget(l2);
|
pathTabLayout->addWidget(line());
|
||||||
#else // Q_OS_MAC
|
#else // Q_OS_MAC
|
||||||
pathTabLayout->addWidget(colorBox);
|
pathTabLayout->addWidget(colorBox);
|
||||||
pathTabLayout->addWidget(trackBox);
|
pathTabLayout->addWidget(trackBox);
|
||||||
@ -100,6 +102,47 @@ QWidget *OptionsDialog::createAppearancePage()
|
|||||||
pathTabLayout->addStretch();
|
pathTabLayout->addStretch();
|
||||||
pathTab->setLayout(pathTabLayout);
|
pathTab->setLayout(pathTabLayout);
|
||||||
|
|
||||||
|
|
||||||
|
// Waypoints
|
||||||
|
_waypointSize = new QSpinBox();
|
||||||
|
_waypointSize->setValue(_options->waypointSize);
|
||||||
|
_waypointColor = new ColorBox();
|
||||||
|
_waypointColor->setColor(_options->waypointColor);
|
||||||
|
QFormLayout *waypointLayout = new QFormLayout();
|
||||||
|
waypointLayout->addRow(tr("Waypoint color:"), _waypointColor);
|
||||||
|
waypointLayout->addRow(tr("Waypoint size:"), _waypointSize);
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
QGroupBox *waypointBox = new QGroupBox(tr("Waypoints"));
|
||||||
|
waypointBox->setLayout(waypointLayout);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
|
_poiSize = new QSpinBox();
|
||||||
|
_poiSize->setValue(_options->poiSize);
|
||||||
|
_poiColor = new ColorBox();
|
||||||
|
_poiColor->setColor(_options->poiColor);
|
||||||
|
QFormLayout *poiLayout = new QFormLayout();
|
||||||
|
poiLayout->addRow(tr("POI color:"), _poiColor);
|
||||||
|
poiLayout->addRow(tr("POI size:"), _poiSize);
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
QGroupBox *poiBox = new QGroupBox(tr("POIs"));
|
||||||
|
poiBox->setLayout(poiLayout);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
|
QWidget *pointTab = new QWidget();
|
||||||
|
QVBoxLayout *pointTabLayout = new QVBoxLayout();
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
pointTabLayout->addLayout(waypointLayout);
|
||||||
|
pathTabLayout->addWidget(line());
|
||||||
|
pathTabLayout->addLayout(poiLayout);
|
||||||
|
#else // Q_OS_MAC
|
||||||
|
pointTabLayout->addWidget(waypointBox);
|
||||||
|
pointTabLayout->addWidget(poiBox);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
|
pointTabLayout->addStretch();
|
||||||
|
pointTab->setLayout(pointTabLayout);
|
||||||
|
|
||||||
|
|
||||||
|
// Graphs
|
||||||
_graphWidth = new QSpinBox();
|
_graphWidth = new QSpinBox();
|
||||||
_graphWidth->setValue(_options->graphWidth);
|
_graphWidth->setValue(_options->graphWidth);
|
||||||
_graphWidth->setMinimum(1);
|
_graphWidth->setMinimum(1);
|
||||||
@ -111,7 +154,6 @@ QWidget *OptionsDialog::createAppearancePage()
|
|||||||
QFormLayout *graphAALayout = new QFormLayout();
|
QFormLayout *graphAALayout = new QFormLayout();
|
||||||
graphAALayout->addWidget(_graphAA);
|
graphAALayout->addWidget(_graphAA);
|
||||||
|
|
||||||
|
|
||||||
QWidget *graphTab = new QWidget();
|
QWidget *graphTab = new QWidget();
|
||||||
QVBoxLayout *graphTabLayout = new QVBoxLayout();
|
QVBoxLayout *graphTabLayout = new QVBoxLayout();
|
||||||
graphTabLayout->addLayout(graphLayout);
|
graphTabLayout->addLayout(graphLayout);
|
||||||
@ -120,6 +162,7 @@ QWidget *OptionsDialog::createAppearancePage()
|
|||||||
graphTab->setLayout(graphTabLayout);
|
graphTab->setLayout(graphTabLayout);
|
||||||
|
|
||||||
|
|
||||||
|
// Map
|
||||||
_mapOpacity = new PercentSlider();
|
_mapOpacity = new PercentSlider();
|
||||||
_mapOpacity->setValue(_options->mapOpacity);
|
_mapOpacity->setValue(_options->mapOpacity);
|
||||||
_blendColor = new ColorBox();
|
_blendColor = new ColorBox();
|
||||||
@ -128,7 +171,6 @@ QWidget *OptionsDialog::createAppearancePage()
|
|||||||
mapLayout->addRow(tr("Background color:"), _blendColor);
|
mapLayout->addRow(tr("Background color:"), _blendColor);
|
||||||
mapLayout->addRow(tr("Map opacity:"), _mapOpacity);
|
mapLayout->addRow(tr("Map opacity:"), _mapOpacity);
|
||||||
|
|
||||||
|
|
||||||
QWidget *mapTab = new QWidget();
|
QWidget *mapTab = new QWidget();
|
||||||
QVBoxLayout *mapTabLayout = new QVBoxLayout();
|
QVBoxLayout *mapTabLayout = new QVBoxLayout();
|
||||||
mapTabLayout->addLayout(mapLayout);
|
mapTabLayout->addLayout(mapLayout);
|
||||||
@ -136,9 +178,9 @@ QWidget *OptionsDialog::createAppearancePage()
|
|||||||
mapTab->setLayout(mapTabLayout);
|
mapTab->setLayout(mapTabLayout);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QTabWidget *appearancePage = new QTabWidget();
|
QTabWidget *appearancePage = new QTabWidget();
|
||||||
appearancePage->addTab(pathTab, tr("Paths"));
|
appearancePage->addTab(pathTab, tr("Paths"));
|
||||||
|
appearancePage->addTab(pointTab, tr("Points"));
|
||||||
appearancePage->addTab(graphTab, tr("Graphs"));
|
appearancePage->addTab(graphTab, tr("Graphs"));
|
||||||
appearancePage->addTab(mapTab, tr("Map"));
|
appearancePage->addTab(mapTab, tr("Map"));
|
||||||
|
|
||||||
@ -189,14 +231,9 @@ QWidget *OptionsDialog::createDataPage()
|
|||||||
QWidget *filterTab = new QWidget();
|
QWidget *filterTab = new QWidget();
|
||||||
QVBoxLayout *filterTabLayout = new QVBoxLayout();
|
QVBoxLayout *filterTabLayout = new QVBoxLayout();
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QLabel *label = new QLabel(tr("Smoothing:"));
|
filterTabLayout->addWidget(new QLabel(tr("Smoothing:")));
|
||||||
QFrame *line = new QFrame();
|
|
||||||
line->setFrameShape(QFrame::HLine);
|
|
||||||
line->setFrameShadow(QFrame::Sunken);
|
|
||||||
|
|
||||||
filterTabLayout->addWidget(label);
|
|
||||||
filterTabLayout->addLayout(smoothLayout);
|
filterTabLayout->addLayout(smoothLayout);
|
||||||
filterTabLayout->addWidget(line);
|
filterTabLayout->addWidget(line());
|
||||||
filterTabLayout->addLayout(outlierLayout);
|
filterTabLayout->addLayout(outlierLayout);
|
||||||
#else // Q_OS_MAC
|
#else // Q_OS_MAC
|
||||||
filterTabLayout->addWidget(smoothBox);
|
filterTabLayout->addWidget(smoothBox);
|
||||||
@ -339,12 +376,6 @@ QWidget *OptionsDialog::createExportPage()
|
|||||||
QWidget *OptionsDialog::createSystemPage()
|
QWidget *OptionsDialog::createSystemPage()
|
||||||
{
|
{
|
||||||
_useOpenGL = new QCheckBox(tr("Use OpenGL"));
|
_useOpenGL = new QCheckBox(tr("Use OpenGL"));
|
||||||
#ifdef Q_OS_WIN32
|
|
||||||
if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) {
|
|
||||||
_useOpenGL->setChecked(false);
|
|
||||||
_useOpenGL->setEnabled(false);
|
|
||||||
} else
|
|
||||||
#endif // Q_OS_WIN32
|
|
||||||
_useOpenGL->setChecked(_options->useOpenGL);
|
_useOpenGL->setChecked(_options->useOpenGL);
|
||||||
|
|
||||||
_pixmapCache = new QSpinBox();
|
_pixmapCache = new QSpinBox();
|
||||||
@ -434,6 +465,10 @@ void OptionsDialog::accept()
|
|||||||
_options->routeStyle = (Qt::PenStyle) _routeStyle->itemData(
|
_options->routeStyle = (Qt::PenStyle) _routeStyle->itemData(
|
||||||
_routeStyle->currentIndex()).toInt();
|
_routeStyle->currentIndex()).toInt();
|
||||||
_options->pathAntiAliasing = _pathAA->isChecked();
|
_options->pathAntiAliasing = _pathAA->isChecked();
|
||||||
|
_options->waypointSize = _waypointSize->value();
|
||||||
|
_options->waypointColor = _waypointColor->color();
|
||||||
|
_options->poiSize = _poiSize->value();
|
||||||
|
_options->poiColor = _poiColor->color();
|
||||||
_options->graphWidth = _graphWidth->value();
|
_options->graphWidth = _graphWidth->value();
|
||||||
_options->graphAntiAliasing = _graphAA->isChecked();
|
_options->graphAntiAliasing = _graphAA->isChecked();
|
||||||
|
|
||||||
|
@ -18,15 +18,19 @@ class PercentSlider;
|
|||||||
struct Options {
|
struct Options {
|
||||||
// Appearance
|
// Appearance
|
||||||
Palette palette;
|
Palette palette;
|
||||||
int mapOpacity;
|
|
||||||
QColor blendColor;
|
|
||||||
int trackWidth;
|
int trackWidth;
|
||||||
int routeWidth;
|
int routeWidth;
|
||||||
Qt::PenStyle trackStyle;
|
Qt::PenStyle trackStyle;
|
||||||
Qt::PenStyle routeStyle;
|
Qt::PenStyle routeStyle;
|
||||||
|
QColor waypointColor;
|
||||||
|
QColor poiColor;
|
||||||
|
int waypointSize;
|
||||||
|
int poiSize;
|
||||||
int graphWidth;
|
int graphWidth;
|
||||||
bool pathAntiAliasing;
|
bool pathAntiAliasing;
|
||||||
bool graphAntiAliasing;
|
bool graphAntiAliasing;
|
||||||
|
int mapOpacity;
|
||||||
|
QColor blendColor;
|
||||||
// Data
|
// Data
|
||||||
int elevationFilter;
|
int elevationFilter;
|
||||||
int speedFilter;
|
int speedFilter;
|
||||||
@ -83,6 +87,10 @@ private:
|
|||||||
QSpinBox *_routeWidth;
|
QSpinBox *_routeWidth;
|
||||||
StyleComboBox *_routeStyle;
|
StyleComboBox *_routeStyle;
|
||||||
QCheckBox *_pathAA;
|
QCheckBox *_pathAA;
|
||||||
|
QSpinBox *_waypointSize;
|
||||||
|
ColorBox *_waypointColor;
|
||||||
|
QSpinBox *_poiSize;
|
||||||
|
ColorBox *_poiColor;
|
||||||
QSpinBox *_graphWidth;
|
QSpinBox *_graphWidth;
|
||||||
QCheckBox *_graphAA;
|
QCheckBox *_graphAA;
|
||||||
// Data
|
// Data
|
||||||
|
@ -62,6 +62,10 @@ PathView::PathView(Map *map, POI *poi, QWidget *parent)
|
|||||||
_routeWidth = 3;
|
_routeWidth = 3;
|
||||||
_trackStyle = Qt::SolidLine;
|
_trackStyle = Qt::SolidLine;
|
||||||
_routeStyle = Qt::DashLine;
|
_routeStyle = Qt::DashLine;
|
||||||
|
_waypointSize = 8;
|
||||||
|
_waypointColor = Qt::black;
|
||||||
|
_poiSize = 8;
|
||||||
|
_poiColor = Qt::black;
|
||||||
|
|
||||||
_plot = false;
|
_plot = false;
|
||||||
_digitalZoom = 0;
|
_digitalZoom = 0;
|
||||||
@ -133,6 +137,8 @@ void PathView::addWaypoints(const QList<Waypoint> &waypoints)
|
|||||||
_waypoints.append(wi);
|
_waypoints.append(wi);
|
||||||
updateWaypointsBoundingRect(wi->waypoint().coordinates());
|
updateWaypointsBoundingRect(wi->waypoint().coordinates());
|
||||||
wi->setZValue(1);
|
wi->setZValue(1);
|
||||||
|
wi->setSize(_waypointSize);
|
||||||
|
wi->setColor(_waypointColor);
|
||||||
wi->showLabel(_showWaypointLabels);
|
wi->showLabel(_showWaypointLabels);
|
||||||
wi->setUnits(_units);
|
wi->setUnits(_units);
|
||||||
wi->setVisible(_showWaypoints);
|
wi->setVisible(_showWaypoints);
|
||||||
@ -325,6 +331,8 @@ void PathView::addPOI(const QVector<Waypoint> &waypoints)
|
|||||||
|
|
||||||
WaypointItem *pi = new WaypointItem(w, _map);
|
WaypointItem *pi = new WaypointItem(w, _map);
|
||||||
pi->setZValue(1);
|
pi->setZValue(1);
|
||||||
|
pi->setSize(_poiSize);
|
||||||
|
pi->setColor(_poiColor);
|
||||||
pi->showLabel(_showPOILabels);
|
pi->showLabel(_showPOILabels);
|
||||||
pi->setVisible(_showPOI);
|
pi->setVisible(_showPOI);
|
||||||
pi->setDigitalZoom(_digitalZoom);
|
pi->setDigitalZoom(_digitalZoom);
|
||||||
@ -680,6 +688,42 @@ void PathView::setRouteStyle(Qt::PenStyle style)
|
|||||||
_routes.at(i)->setStyle(style);
|
_routes.at(i)->setStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathView::setWaypointSize(int size)
|
||||||
|
{
|
||||||
|
_waypointSize = size;
|
||||||
|
|
||||||
|
for (int i = 0; i < _waypoints.size(); i++)
|
||||||
|
_waypoints.at(i)->setSize(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathView::setWaypointColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_waypointColor = color;
|
||||||
|
|
||||||
|
for (int i = 0; i < _waypoints.size(); i++)
|
||||||
|
_waypoints.at(i)->setColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathView::setPOISize(int size)
|
||||||
|
{
|
||||||
|
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||||
|
|
||||||
|
_poiSize = size;
|
||||||
|
|
||||||
|
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||||
|
it.value()->setSize(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathView::setPOIColor(const QColor &color)
|
||||||
|
{
|
||||||
|
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||||
|
|
||||||
|
_poiColor = color;
|
||||||
|
|
||||||
|
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||||
|
it.value()->setColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
void PathView::setMapOpacity(int opacity)
|
void PathView::setMapOpacity(int opacity)
|
||||||
{
|
{
|
||||||
_opacity = opacity / 100.0;
|
_opacity = opacity / 100.0;
|
||||||
|
@ -63,6 +63,10 @@ public slots:
|
|||||||
void setRouteWidth(int width);
|
void setRouteWidth(int width);
|
||||||
void setTrackStyle(Qt::PenStyle style);
|
void setTrackStyle(Qt::PenStyle style);
|
||||||
void setRouteStyle(Qt::PenStyle style);
|
void setRouteStyle(Qt::PenStyle style);
|
||||||
|
void setWaypointSize(int size);
|
||||||
|
void setWaypointColor(const QColor &color);
|
||||||
|
void setPOISize(int size);
|
||||||
|
void setPOIColor(const QColor &color);
|
||||||
void setMapOpacity(int opacity);
|
void setMapOpacity(int opacity);
|
||||||
void setBlendColor(const QColor &color);
|
void setBlendColor(const QColor &color);
|
||||||
|
|
||||||
@ -108,9 +112,9 @@ private:
|
|||||||
POI *_poi;
|
POI *_poi;
|
||||||
Palette _palette;
|
Palette _palette;
|
||||||
Units _units;
|
Units _units;
|
||||||
|
|
||||||
qreal _opacity;
|
qreal _opacity;
|
||||||
QColor _blendColor;
|
QColor _blendColor;
|
||||||
|
|
||||||
bool _showMap;
|
bool _showMap;
|
||||||
bool _showTracks;
|
bool _showTracks;
|
||||||
bool _showRoutes;
|
bool _showRoutes;
|
||||||
@ -124,6 +128,10 @@ private:
|
|||||||
int _routeWidth;
|
int _routeWidth;
|
||||||
Qt::PenStyle _trackStyle;
|
Qt::PenStyle _trackStyle;
|
||||||
Qt::PenStyle _routeStyle;
|
Qt::PenStyle _routeStyle;
|
||||||
|
int _waypointSize;
|
||||||
|
int _poiSize;
|
||||||
|
QColor _waypointColor;
|
||||||
|
QColor _poiColor;
|
||||||
|
|
||||||
int _digitalZoom;
|
int _digitalZoom;
|
||||||
bool _plot;
|
bool _plot;
|
||||||
|
@ -90,6 +90,14 @@
|
|||||||
#define TRACK_STYLE_DEFAULT Qt::SolidLine
|
#define TRACK_STYLE_DEFAULT Qt::SolidLine
|
||||||
#define ROUTE_STYLE_SETTING "routeStyle"
|
#define ROUTE_STYLE_SETTING "routeStyle"
|
||||||
#define ROUTE_STYLE_DEFAULT Qt::DotLine
|
#define ROUTE_STYLE_DEFAULT Qt::DotLine
|
||||||
|
#define WAYPOINT_SIZE_SETTING "waypointSize"
|
||||||
|
#define WAYPOINT_SIZE_DEFAULT 8
|
||||||
|
#define WAYPOINT_COLOR_SETTING "waypointColor"
|
||||||
|
#define WAYPOINT_COLOR_DEFAULT QColor(Qt::black)
|
||||||
|
#define POI_SIZE_SETTING "poiSize"
|
||||||
|
#define POI_SIZE_DEFAULT 8
|
||||||
|
#define POI_COLOR_SETTING "poiColor"
|
||||||
|
#define POI_COLOR_DEFAULT QColor(Qt::black)
|
||||||
#define GRAPH_WIDTH_SETTING "graphWidth"
|
#define GRAPH_WIDTH_SETTING "graphWidth"
|
||||||
#define GRAPH_WIDTH_DEFAULT 1
|
#define GRAPH_WIDTH_DEFAULT 1
|
||||||
#define PATH_AA_SETTING "pathAntiAliasing"
|
#define PATH_AA_SETTING "pathAntiAliasing"
|
||||||
|
@ -6,8 +6,10 @@
|
|||||||
#include "waypointitem.h"
|
#include "waypointitem.h"
|
||||||
|
|
||||||
|
|
||||||
#define POINT_SIZE 8
|
#define HS(size) \
|
||||||
#define HOVER_SIZE 10
|
((int)((qreal)size * 1.2))
|
||||||
|
#define FS(size) \
|
||||||
|
((int)((qreal)size * 1.41))
|
||||||
|
|
||||||
QString WaypointItem::toolTip(Units units)
|
QString WaypointItem::toolTip(Units units)
|
||||||
{
|
{
|
||||||
@ -36,6 +38,8 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
|||||||
_waypoint = waypoint;
|
_waypoint = waypoint;
|
||||||
_showLabel = true;
|
_showLabel = true;
|
||||||
_hover = false;
|
_hover = false;
|
||||||
|
_size = 8;
|
||||||
|
_color = Qt::black;
|
||||||
|
|
||||||
updateShape();
|
updateShape();
|
||||||
|
|
||||||
@ -48,11 +52,11 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
|||||||
void WaypointItem::updateShape()
|
void WaypointItem::updateShape()
|
||||||
{
|
{
|
||||||
QPainterPath p;
|
QPainterPath p;
|
||||||
qreal pointSize = _hover ? HOVER_SIZE : POINT_SIZE;
|
qreal pointSize = _hover ? HS(_size) : _size;
|
||||||
|
|
||||||
if (_showLabel) {
|
if (_showLabel) {
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(FONT_SIZE);
|
font.setPixelSize(FS(_size));
|
||||||
font.setFamily(FONT_FAMILY);
|
font.setFamily(FONT_FAMILY);
|
||||||
if (_hover)
|
if (_hover)
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
@ -74,11 +78,13 @@ void WaypointItem::paint(QPainter *painter,
|
|||||||
Q_UNUSED(option);
|
Q_UNUSED(option);
|
||||||
Q_UNUSED(widget);
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
qreal pointSize = _hover ? HOVER_SIZE : POINT_SIZE;
|
qreal pointSize = _hover ? HS(_size) : _size;
|
||||||
|
|
||||||
|
painter->setPen(_color);
|
||||||
|
|
||||||
if (_showLabel) {
|
if (_showLabel) {
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(FONT_SIZE);
|
font.setPixelSize(FS(_size));
|
||||||
font.setFamily(FONT_FAMILY);
|
font.setFamily(FONT_FAMILY);
|
||||||
if (_hover)
|
if (_hover)
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
@ -90,7 +96,7 @@ void WaypointItem::paint(QPainter *painter,
|
|||||||
+ ts.height(), _waypoint.name());
|
+ ts.height(), _waypoint.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->setBrush(Qt::SolidPattern);
|
painter->setBrush(QBrush(_color, Qt::SolidPattern));
|
||||||
painter->drawEllipse(-pointSize/2, -pointSize/2, pointSize, pointSize);
|
painter->drawEllipse(-pointSize/2, -pointSize/2, pointSize, pointSize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -100,6 +106,19 @@ void WaypointItem::paint(QPainter *painter,
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WaypointItem::setSize(int size)
|
||||||
|
{
|
||||||
|
prepareGeometryChange();
|
||||||
|
_size = size;
|
||||||
|
updateShape();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaypointItem::setColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_color = color;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
void WaypointItem::setUnits(enum Units units)
|
void WaypointItem::setUnits(enum Units units)
|
||||||
{
|
{
|
||||||
setToolTip(toolTip(units));
|
setToolTip(toolTip(units));
|
||||||
|
@ -16,6 +16,8 @@ public:
|
|||||||
|
|
||||||
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
|
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
|
||||||
void setUnits(Units units);
|
void setUnits(Units units);
|
||||||
|
void setSize(int size);
|
||||||
|
void setColor(const QColor &color);
|
||||||
void showLabel(bool show);
|
void showLabel(bool show);
|
||||||
void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));}
|
void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));}
|
||||||
|
|
||||||
@ -34,6 +36,8 @@ private:
|
|||||||
QPainterPath _shape;
|
QPainterPath _shape;
|
||||||
Waypoint _waypoint;
|
Waypoint _waypoint;
|
||||||
|
|
||||||
|
QColor _color;
|
||||||
|
int _size;
|
||||||
bool _hover;
|
bool _hover;
|
||||||
bool _showLabel;
|
bool _showLabel;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user