mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Code cleanup
This commit is contained in:
parent
3dfb3caf40
commit
ff2dd6cdec
@ -202,12 +202,10 @@ void RasterTile::drawTextItems(QPainter *painter,
|
||||
textItems.at(i)->paint(painter);
|
||||
}
|
||||
|
||||
void RasterTile::processPoints(QList<TextItem*> &textItems)
|
||||
void RasterTile::processPolygons(QList<TextItem*> &textItems)
|
||||
{
|
||||
const Style &s = style();
|
||||
|
||||
std::sort(_points.begin(), _points.end(), pointLess);
|
||||
|
||||
for (int i = 0; i < _polygons.size(); i++) {
|
||||
const MapData::Poly *poly = _polygons.at(i);
|
||||
uint type = poly->type()>>16;
|
||||
@ -227,6 +225,13 @@ void RasterTile::processPoints(QList<TextItem*> &textItems)
|
||||
else
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
void RasterTile::processPoints(QList<TextItem*> &textItems)
|
||||
{
|
||||
const Style &s = style();
|
||||
|
||||
std::sort(_points.begin(), _points.end(), pointLess);
|
||||
|
||||
for (int i = 0; i < _points.size(); i++) {
|
||||
const MapData::Point *point = _points.at(i);
|
||||
@ -283,6 +288,7 @@ void RasterTile::render()
|
||||
_pixmap.setDevicePixelRatio(_ratio);
|
||||
_pixmap.fill(Qt::transparent);
|
||||
|
||||
processPolygons(textItems);
|
||||
processPoints(textItems);
|
||||
processLines(textItems);
|
||||
|
||||
|
@ -35,6 +35,7 @@ private:
|
||||
QPolygonF arrow(const Coordinates &c, qreal angle) const;
|
||||
void processPoints(QList<TextItem*> &textItems);
|
||||
void processLines(QList<TextItem*> &textItems);
|
||||
void processPolygons(QList<TextItem*> &textItems);
|
||||
void drawBitmapPath(QPainter *painter, const QImage &img,
|
||||
const Polygon &polygon);
|
||||
void drawArrows(QPainter *painter);
|
||||
|
@ -14,7 +14,7 @@ static QImage railroad()
|
||||
return img;
|
||||
}
|
||||
|
||||
void Style::defaultPolygonStyle()
|
||||
void Style::polygonStyle()
|
||||
{
|
||||
_polygons[TYPE(M_COVR)] = Polygon(QBrush("#ffffff"));
|
||||
_polygons[TYPE(LNDARE)] = Polygon(QBrush("#e8e064"));
|
||||
@ -117,7 +117,7 @@ void Style::defaultPolygonStyle()
|
||||
<< SUBTYPE(I_RESARE, 17) << TYPE(CBLARE) << TYPE(PIPARE) << TYPE(PRCARE);
|
||||
}
|
||||
|
||||
void Style::defaultLineStyle()
|
||||
void Style::lineStyle()
|
||||
{
|
||||
_lines[TYPE(BUISGL)] = Line(QPen(QColor("#966118"), 1.5));
|
||||
_lines[TYPE(DEPCNT)] = Line(QPen(QColor("#659aef"), 1, Qt::SolidLine));
|
||||
@ -130,6 +130,7 @@ void Style::defaultLineStyle()
|
||||
_lines[TYPE(CBLSUB)] = Line(QImage(":/marine/cable.png"));
|
||||
_lines[TYPE(CBLSUB)].setTextFontSize(Small);
|
||||
_lines[TYPE(PIPSOL)] = Line(QImage(":/marine/pipeline.png"));
|
||||
_lines[TYPE(PIPSOL)].setTextFontSize(Small);
|
||||
_lines[TYPE(NAVLNE)] = Line(QPen(QColor("#eb49eb"), 1, Qt::DashLine));
|
||||
_lines[TYPE(COALNE)] = Line(QPen(QColor("#000000"), 1, Qt::SolidLine));
|
||||
_lines[TYPE(SLCONS)] = Line(QPen(QColor("#000000"), 2, Qt::SolidLine));
|
||||
@ -165,7 +166,7 @@ void Style::defaultLineStyle()
|
||||
_lines[TYPE(CANALS)] = Line(QPen(QColor("#9fc4e1"), 2));
|
||||
}
|
||||
|
||||
void Style::defaultPointStyle()
|
||||
void Style::pointStyle()
|
||||
{
|
||||
_points[SUBTYPE(BUAARE, 1)].setTextFontSize(Large);
|
||||
_points[SUBTYPE(BUAARE, 5)].setTextFontSize(Large);
|
||||
@ -259,9 +260,9 @@ void Style::defaultPointStyle()
|
||||
|
||||
Style::Style()
|
||||
{
|
||||
defaultPolygonStyle();
|
||||
defaultLineStyle();
|
||||
defaultPointStyle();
|
||||
polygonStyle();
|
||||
lineStyle();
|
||||
pointStyle();
|
||||
}
|
||||
|
||||
const Style::Line &Style::line(uint type) const
|
||||
|
@ -98,9 +98,9 @@ public:
|
||||
{return (type & 0xFFFF0000) == TYPE(I_DISMAR);}
|
||||
|
||||
private:
|
||||
void defaultPolygonStyle();
|
||||
void defaultLineStyle();
|
||||
void defaultPointStyle();
|
||||
void polygonStyle();
|
||||
void lineStyle();
|
||||
void pointStyle();
|
||||
|
||||
QMap<uint, Line> _lines;
|
||||
QMap<uint, Polygon> _polygons;
|
||||
|
Loading…
Reference in New Issue
Block a user