void TransPolygon::TransformWay(const Projection& projection, bool optimize, const std::vector<Point>& nodes) { if (nodes.empty()) { length=0; return; } length=nodes.size(); if (pointsSize<length) { delete [] points; points=new TransPoint[length]; pointsSize=length; } if (optimize) { InitializeDraw(); TransformGeoToPixel(projection, nodes); DropSimilarPoints(); DropRedundantPoints(); length=0; start=nodes.size(); end=0; // Calculate start & end for (size_t i=0; i<nodes.size(); i++) { if (points[i].draw) { length++; if (i<start) { start=i; } end=i; } } } else { start=0; end=nodes.size()-1; length=nodes.size(); for (size_t i=0; i<nodes.size(); i++) { points[i].draw=true; projection.GeoToPixel(nodes[i].lon, nodes[i].lat, points[i].x, points[i].y); } } }
void TransPolygon::TransformGeoToPixel(const Projection& projection, const std::vector<Point>& nodes) { for (size_t i=0; i<length; i++) { if (points[i].draw) { projection.GeoToPixel(nodes[i].lon,nodes[i].lat, points[i].x,points[i].y); } } }