Rename lines to geoLines as appropriate

This commit is contained in:
Dan Paulat 2024-07-13 23:46:57 -05:00
parent 0b64a8eae3
commit c7023f9cd2

View file

@ -75,7 +75,6 @@ public:
std::unique_lock lock(alertMutex_); std::unique_lock lock(alertMutex_);
} }
// NOTE: iterators are no longer stable if the stable vector moves
std::unordered_map< std::unordered_map<
std::pair<awips::Phenomenon, bool>, std::pair<awips::Phenomenon, bool>,
boost::container::stable_vector<std::shared_ptr<SegmentRecord>>, boost::container::stable_vector<std::shared_ptr<SegmentRecord>>,
@ -110,8 +109,8 @@ public:
explicit Impl(std::shared_ptr<MapContext> context, explicit Impl(std::shared_ptr<MapContext> context,
awips::Phenomenon phenomenon) : awips::Phenomenon phenomenon) :
phenomenon_ {phenomenon}, phenomenon_ {phenomenon},
lines_ {{false, std::make_shared<gl::draw::GeoLines>(context)}, geoLines_ {{false, std::make_shared<gl::draw::GeoLines>(context)},
{true, std::make_shared<gl::draw::GeoLines>(context)}} {true, std::make_shared<gl::draw::GeoLines>(context)}}
{ {
auto& paletteSettings = settings::PaletteSettings::Instance(); auto& paletteSettings = settings::PaletteSettings::Instance();
@ -134,7 +133,7 @@ public:
const std::shared_ptr<AlertLayerHandler::SegmentRecord>& segmentRecord); const std::shared_ptr<AlertLayerHandler::SegmentRecord>& segmentRecord);
void ConnectSignals(); void ConnectSignals();
static void AddLine(std::shared_ptr<gl::draw::GeoLines>& lines, static void AddLine(std::shared_ptr<gl::draw::GeoLines>& geoLines,
std::shared_ptr<gl::draw::GeoLineDrawItem>& di, std::shared_ptr<gl::draw::GeoLineDrawItem>& di,
const common::Coordinate& p1, const common::Coordinate& p1,
const common::Coordinate& p2, const common::Coordinate& p2,
@ -143,7 +142,7 @@ public:
std::chrono::system_clock::time_point startTime, std::chrono::system_clock::time_point startTime,
std::chrono::system_clock::time_point endTime); std::chrono::system_clock::time_point endTime);
static void static void
AddLines(std::shared_ptr<gl::draw::GeoLines>& lines, AddLines(std::shared_ptr<gl::draw::GeoLines>& geoLines,
const std::vector<common::Coordinate>& coordinates, const std::vector<common::Coordinate>& coordinates,
boost::gil::rgba32_pixel_t color, boost::gil::rgba32_pixel_t color,
float width, float width,
@ -155,7 +154,7 @@ public:
std::unique_ptr<QObject> receiver_ {std::make_unique<QObject>()}; std::unique_ptr<QObject> receiver_ {std::make_unique<QObject>()};
std::unordered_map<bool, std::shared_ptr<gl::draw::GeoLines>> lines_; std::unordered_map<bool, std::shared_ptr<gl::draw::GeoLines>> geoLines_;
std::unordered_map<bool, boost::gil::rgba8_pixel_t> lineColor_; std::unordered_map<bool, boost::gil::rgba8_pixel_t> lineColor_;
@ -168,9 +167,9 @@ AlertLayer::AlertLayer(std::shared_ptr<MapContext> context,
{ {
for (auto alertActive : {false, true}) for (auto alertActive : {false, true})
{ {
auto& lines = p->lines_.at(alertActive); auto& geoLines = p->geoLines_.at(alertActive);
AddDrawItem(lines); AddDrawItem(geoLines);
} }
} }
@ -184,10 +183,10 @@ void AlertLayer::Initialize()
for (auto alertActive : {false, true}) for (auto alertActive : {false, true})
{ {
auto& lines = p->lines_.at(alertActive); auto& geoLines = p->geoLines_.at(alertActive);
lines->StartLines(); geoLines->StartLines();
lines->FinishLines(); geoLines->FinishLines();
} }
} }
@ -197,7 +196,7 @@ void AlertLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
for (auto alertActive : {false, true}) for (auto alertActive : {false, true})
{ {
p->lines_.at(alertActive)->set_selected_time(p->selectedTime_); p->geoLines_.at(alertActive)->set_selected_time(p->selectedTime_);
} }
DrawLayer::Render(params); DrawLayer::Render(params);
@ -337,14 +336,16 @@ void AlertLayer::Impl::AddAlert(
auto& endTime = segmentRecord->segmentEnd_; auto& endTime = segmentRecord->segmentEnd_;
auto& lineColor = lineColor_.at(alertActive); auto& lineColor = lineColor_.at(alertActive);
auto& lines = lines_.at(alertActive); auto& geoLines = geoLines_.at(alertActive);
const auto& coordinates = segment->codedLocation_->coordinates(); const auto& coordinates = segment->codedLocation_->coordinates();
std::vector<std::shared_ptr<gl::draw::GeoLineDrawItem>> drawItems {}; std::vector<std::shared_ptr<gl::draw::GeoLineDrawItem>> drawItems {};
AddLines(lines, coordinates, kBlack_, 5.0f, startTime, endTime, drawItems); AddLines(
AddLines(lines, coordinates, lineColor, 3.0f, startTime, endTime, drawItems); geoLines, coordinates, kBlack_, 5.0f, startTime, endTime, drawItems);
AddLines(
geoLines, coordinates, lineColor, 3.0f, startTime, endTime, drawItems);
} }
void AlertLayer::Impl::UpdateAlert( void AlertLayer::Impl::UpdateAlert(
@ -355,13 +356,14 @@ void AlertLayer::Impl::UpdateAlert(
} }
void AlertLayer::Impl::AddLines( void AlertLayer::Impl::AddLines(
std::shared_ptr<gl::draw::GeoLines>& lines, std::shared_ptr<gl::draw::GeoLines>& geoLines,
const std::vector<common::Coordinate>& coordinates, const std::vector<common::Coordinate>& coordinates,
boost::gil::rgba32_pixel_t color, boost::gil::rgba32_pixel_t color,
float width, float width,
std::chrono::system_clock::time_point startTime, std::chrono::system_clock::time_point startTime,
std::chrono::system_clock::time_point endTime, std::chrono::system_clock::time_point endTime,
std::vector<std::shared_ptr<gl::draw::GeoLineDrawItem>>& drawItems) boost::container::stable_vector<std::shared_ptr<gl::draw::GeoLineDrawItem>>&
drawItems)
{ {
for (std::size_t i = 0, j = 1; i < coordinates.size(); ++i, ++j) for (std::size_t i = 0, j = 1; i < coordinates.size(); ++i, ++j)
{ {
@ -376,8 +378,8 @@ void AlertLayer::Impl::AddLines(
} }
} }
auto di = lines->AddLine(); auto di = geoLines->AddLine();
AddLine(lines, AddLine(geoLines,
di, di,
coordinates[i], coordinates[i],
coordinates[j], coordinates[j],
@ -390,7 +392,7 @@ void AlertLayer::Impl::AddLines(
} }
} }
void AlertLayer::Impl::AddLine(std::shared_ptr<gl::draw::GeoLines>& lines, void AlertLayer::Impl::AddLine(std::shared_ptr<gl::draw::GeoLines>& geoLines,
std::shared_ptr<gl::draw::GeoLineDrawItem>& di, std::shared_ptr<gl::draw::GeoLineDrawItem>& di,
const common::Coordinate& p1, const common::Coordinate& p1,
const common::Coordinate& p2, const common::Coordinate& p2,
@ -399,12 +401,12 @@ void AlertLayer::Impl::AddLine(std::shared_ptr<gl::draw::GeoLines>& lines,
std::chrono::system_clock::time_point startTime, std::chrono::system_clock::time_point startTime,
std::chrono::system_clock::time_point endTime) std::chrono::system_clock::time_point endTime)
{ {
lines->SetLineLocation( geoLines->SetLineLocation(
di, p1.latitude_, p1.longitude_, p2.latitude_, p2.longitude_); di, p1.latitude_, p1.longitude_, p2.latitude_, p2.longitude_);
lines->SetLineModulate(di, color); geoLines->SetLineModulate(di, color);
lines->SetLineWidth(di, width); geoLines->SetLineWidth(di, width);
lines->SetLineStartTime(di, startTime); geoLines->SetLineStartTime(di, startTime);
lines->SetLineEndTime(di, endTime); geoLines->SetLineEndTime(di, endTime);
} }
AlertLayerHandler& AlertLayerHandler::Instance() AlertLayerHandler& AlertLayerHandler::Instance()