1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-02-22 18:20:49 +01:00

Compare commits

..

No commits in common. "e0000d7299b8db616be523998dfd641097a8894b" and "819a67158a4cad232d94e283fadce06b118140a7" have entirely different histories.

5 changed files with 21 additions and 38 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 139 B

View File

@ -31,7 +31,6 @@
#define SECTR2 137
#define TRAFIC 172
#define VALDCO 174
#define VALNMR 178
#define VERCLR 181
#define WATLEV 187

View File

@ -13,7 +13,7 @@ using namespace ENC;
#define TEXT_EXTENT 160
#define TSSLPT_SIZE 24
#define RANGE_FACTOR 4
#define SECTOR_RADIUS 40
static const float C1 = 0.866025f; /* sqrt(3)/2 */
static const QColor tsslptPen = QColor(0xeb, 0x49, 0xeb);
@ -213,40 +213,31 @@ void RasterTile::drawTextItems(QPainter *painter,
}
}
static QRectF lightRect(const QPointF &pos, double range)
{
return QRectF(pos.x() - range * RANGE_FACTOR, pos.y() - range * RANGE_FACTOR,
2*range * RANGE_FACTOR, 2*range * RANGE_FACTOR);
}
void RasterTile::drawSectorLights(QPainter *painter,
const QList<SectorLight> &lights) const
{
for (int i = 0; i < lights.size(); i++) {
const SectorLight &l = lights.at(i);
QPointF pos(ll2xy(l.pos));
QRectF rect(lightRect(pos, (l.range == 0) ? 6 : l.range));
QRectF rect(pos.x() - SECTOR_RADIUS, pos.y() - SECTOR_RADIUS,
2*SECTOR_RADIUS, 2*SECTOR_RADIUS);
double a1 = -(l.end + 90);
double a2 = -(l.start + 90);
if (a1 > a2)
a2 += 360;
double as = (a2 - a1);
if (as == 0)
as = 360;
if (l.visibility == 3 || l.visibility >= 6)
painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
else {
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine, Qt::FlatCap));
painter->drawArc(rect, a1 * 16, as * 16);
painter->drawArc(rect, a1 * 16, (a2 - a1) * 16);
painter->setPen(QPen(Style::color(l.color), 4, Qt::SolidLine,
Qt::FlatCap));
}
painter->drawArc(rect, a1 * 16, as * 16);
painter->drawArc(rect, a1 * 16, (a2 - a1) * 16);
if (a2 - a1 != 0) {
QLineF ln(pos, QPointF(pos.x() + rect.width(), pos.y()));
QLineF ln(pos, QPointF(pos.x() + 2*SECTOR_RADIUS, pos.y()));
ln.setAngle(a1);
painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
painter->drawLine(ln);
@ -254,7 +245,6 @@ void RasterTile::drawSectorLights(QPainter *painter,
painter->drawLine(ln);
}
}
}
void RasterTile::processPoints(QList<MapData::Point> &points,
QList<TextItem*> &textItems, QList<TextItem*> &lights,
@ -262,7 +252,6 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
{
LightMap lightsMap;
SignalSet signalsSet;
QSet<Coordinates> slMap;
int i;
std::sort(points.begin(), points.end());
@ -274,14 +263,11 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
if (point.type()>>16 == LIGHTS) {
const MapData::Attributes &attr = point.attributes();
Style::Color color = (Style::Color)(attr.value(COLOUR).toUInt());
double range = attr.value(VALNMR).toDouble();
if (attr.contains(SECTR1)
|| (range >= 6 && !(point.type() & 0xFFFF))) {
if (attr.contains(SECTR1)) {
sectorLights.append(SectorLight(point.pos(), color,
attr.value(LITVIS).toUInt(), range,
attr.value(SECTR1).toDouble(), attr.value(SECTR2).toDouble()));
slMap.insert(point.pos());
attr.value(LITVIS).toUInt(), attr.value(SECTR1).toDouble(),
attr.value(SECTR2).toDouble()));
} else
lightsMap.insert(point.pos(), color);
} else if (point.type()>>16 == FOGSIG)
@ -312,8 +298,7 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
TextPointItem *item = new TextPointItem(pos + offset, label, fnt, img,
color, hColor, 0, 2, rotate);
if (item->isValid() && (slMap.contains(point.pos())
|| !item->collides(textItems))) {
if (item->isValid() && !item->collides(textItems)) {
textItems.append(item);
if (lightsMap.contains(point.pos()))
lights.append(new TextPointItem(pos + _style->lightOffset(),

View File

@ -37,13 +37,12 @@ private:
struct SectorLight
{
SectorLight(const Coordinates &pos, Style::Color color, uint visibility,
double range, double start, double end) : pos(pos), color(color),
visibility(visibility), range(range), start(start), end(end) {}
double start, double end) : pos(pos), color(color),
visibility(visibility), start(start), end(end) {}
Coordinates pos;
Style::Color color;
uint visibility;
double range;
double start;
double end;
};

View File

@ -245,7 +245,7 @@ void RasterTile::drawSectorLights(QPainter *painter,
const Lights::Sector &end = (j == p->lights.sectors.size() - 1)
? p->lights.sectors.at(0) : p->lights.sectors.at(j+1);
if (start.color) {
if (start.color && start.range) {
double a1 = -(end.angle / 10.0 + 90.0);
double a2 = -(start.angle / 10.0 + 90.0);
if (a1 > a2)
@ -254,7 +254,7 @@ void RasterTile::drawSectorLights(QPainter *painter,
if (as == 0)
as = 360;
QRect rect(lightRect(pos, start.range ? start.range : 6));
QRect rect(lightRect(pos, start.range));
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine,
Qt::FlatCap));
@ -492,8 +492,8 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
TextPointItem *item = new TextPointItem(pos + offset, label, fnt, img,
color, hcolor, 0, ICON_PADDING);
if (item->isValid() && (point.lights.isSectorLight()
|| !item->collides(textItems))) {
if (point.lights.isSectorLight()
|| (item->isValid() && !item->collides(textItems))) {
textItems.append(item);
if (point.lights.color && !point.lights.isSectorLight())
textItems.append(new TextPointItem(pos + style->lightOffset(),