1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-18 03:42:09 +01:00

RCTLPT areas and TSSLPT/RCTLPT points

This commit is contained in:
Martin Tůma 2024-12-18 12:41:05 +01:00
parent 7f20e2e307
commit 0ab6e02e6c
4 changed files with 37 additions and 7 deletions

View File

@ -285,7 +285,8 @@ MapData::Point::Point(uint type, const Coordinates &c, const QString &label,
else else
_label += "\n(" + QString::fromLatin1(params.at(0)) _label += "\n(" + QString::fromLatin1(params.at(0))
+ "\xE2\x80\x89m)"; + "\xE2\x80\x89m)";
} } else if ((type == TYPE(TSSLPT) || type == TYPE(RCTLPT)) && params.size())
_param = QVariant(params.at(0).toDouble());
} }
MapData::Poly::Poly(uint type, const Polygon &path, const QString &label, MapData::Poly::Poly(uint type, const Polygon &path, const QString &label,
@ -293,7 +294,7 @@ MapData::Poly::Poly(uint type, const Polygon &path, const QString &label,
{ {
if (type == TYPE(DEPARE) && params.size()) if (type == TYPE(DEPARE) && params.size())
_type = SUBTYPE(DEPARE, depthLevel(params.at(0))); _type = SUBTYPE(DEPARE, depthLevel(params.at(0)));
else if (type == TYPE(TSSLPT) && params.size()) else if ((type == TYPE(TSSLPT) || type == TYPE(RCTLPT)) && params.size())
_param = QVariant(params.at(0).toDouble()); _param = QVariant(params.at(0).toDouble());
else if ((type == TYPE(BRIDGE) || type == TYPE(I_BRIDGE)) else if ((type == TYPE(BRIDGE) || type == TYPE(I_BRIDGE))
&& params.size()) { && params.size()) {
@ -595,7 +596,9 @@ MapData::Attr MapData::pointAttr(const ISO8211::Record &r, uint OBJL)
|| (OBJL == RDOCAL && key == ORIENT) || (OBJL == RDOCAL && key == ORIENT)
|| (OBJL == I_RDOCAL && key == ORIENT) || (OBJL == I_RDOCAL && key == ORIENT)
|| (OBJL == CURENT && key == ORIENT) || (OBJL == CURENT && key == ORIENT)
|| (OBJL == LNDELV && key == ELEVAT)) || (OBJL == LNDELV && key == ELEVAT)
|| (OBJL == TSSLPT && key == ORIENT)
|| (OBJL == RCTLPT && key == ORIENT))
params[0] = av.at(1).toByteArray(); params[0] = av.at(1).toByteArray();
if ((OBJL == I_RDOCAL && key == COMCHA) if ((OBJL == I_RDOCAL && key == COMCHA)
|| (OBJL == RDOCAL && key == COMCHA) || (OBJL == RDOCAL && key == COMCHA)
@ -668,6 +671,7 @@ MapData::Attr MapData::polyAttr(const ISO8211::Record &r, uint OBJL)
} }
if ((OBJL == TSSLPT && key == ORIENT) if ((OBJL == TSSLPT && key == ORIENT)
|| (OBJL == RCTLPT && key == ORIENT)
|| (OBJL == DEPARE && key == DRVAL1)) || (OBJL == DEPARE && key == DRVAL1))
params[0] = av.at(1).toByteArray(); params[0] = av.at(1).toByteArray();
if ((OBJL == BRIDGE && key == VERCLR) if ((OBJL == BRIDGE && key == VERCLR)

View File

@ -74,6 +74,7 @@
#define RAILWY 106 #define RAILWY 106
#define RCRTCL 108 #define RCRTCL 108
#define RECTRC 109 #define RECTRC 109
#define RCTLPT 110
#define RSCSTA 111 #define RSCSTA 111
#define RESARE 112 #define RESARE 112
#define RIVERS 114 #define RIVERS 114

View File

@ -150,19 +150,42 @@ QPolygonF RasterTile::tsslptArrow(const QPointF &p, qreal angle) const
return polygon; return polygon;
} }
static void drawArrow(QPainter *painter, const QPolygonF &polygon, uint type)
{
if (type>>16 == RCTLPT) {
painter->setPen(QPen(tsslptPen, 1, Qt::DashLine));
painter->setBrush(Qt::NoBrush);
} else {
painter->setPen(QPen(tsslptPen, 1));
painter->setBrush(QBrush(tsslptBrush));
}
painter->drawPolygon(polygon);
}
void RasterTile::drawArrows(QPainter *painter, void RasterTile::drawArrows(QPainter *painter,
const QList<MapData::Poly> &polygons) const QList<MapData::Poly> &polygons)
{ {
for (int i = 0; i < polygons.size(); i++) { for (int i = 0; i < polygons.size(); i++) {
const MapData::Poly &poly = polygons.at(i); const MapData::Poly &poly = polygons.at(i);
if (poly.type()>>16 == TSSLPT) { if (poly.type()>>16 == TSSLPT || poly.type()>>16 == RCTLPT) {
QPolygonF polygon(tsslptArrow(centroid(poly.path().first()), QPolygonF polygon(tsslptArrow(centroid(poly.path().first()),
deg2rad(poly.param().toDouble()))); deg2rad(poly.param().toDouble())));
drawArrow(painter, polygon, poly.type());
}
}
}
painter->setPen(QPen(tsslptPen, 1)); void RasterTile::drawArrows(QPainter *painter,
painter->setBrush(QBrush(tsslptBrush)); const QList<MapData::Point> &points)
painter->drawPolygon(polygon); {
for (int i = 0; i < points.size(); i++) {
const MapData::Point &point = points.at(i);
if (point.type()>>16 == TSSLPT || point.type()>>16 == RCTLPT) {
QPolygonF polygon(tsslptArrow(ll2xy(point.pos()),
deg2rad(point.param().toDouble())));
drawArrow(painter, polygon, point.type());
} }
} }
} }
@ -400,6 +423,7 @@ void RasterTile::render()
drawPolygons(&painter, polygons); drawPolygons(&painter, polygons);
drawLines(&painter, lines); drawLines(&painter, lines);
drawArrows(&painter, polygons); drawArrows(&painter, polygons);
drawArrows(&painter, points);
drawTextItems(&painter, lights); drawTextItems(&painter, lights);
drawTextItems(&painter, textItems); drawTextItems(&painter, textItems);

View File

@ -52,6 +52,7 @@ private:
void drawBitmapPath(QPainter *painter, const QImage &img, void drawBitmapPath(QPainter *painter, const QImage &img,
const Polygon &polygon); const Polygon &polygon);
void drawArrows(QPainter *painter, const QList<MapData::Poly> &polygons); void drawArrows(QPainter *painter, const QList<MapData::Poly> &polygons);
void drawArrows(QPainter *painter, const QList<MapData::Point> &points);
void drawPolygons(QPainter *painter, const QList<MapData::Poly> &polygons); void drawPolygons(QPainter *painter, const QList<MapData::Poly> &polygons);
void drawLines(QPainter *painter, const QList<MapData::Line> &lines); void drawLines(QPainter *painter, const QList<MapData::Line> &lines);
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems); void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);