mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:50:05 +00:00
Reformat marker formats after rename
This commit is contained in:
parent
31940441ed
commit
74f3a15eb2
3 changed files with 19 additions and 26 deletions
|
|
@ -33,16 +33,15 @@ public:
|
||||||
explicit Impl(MarkerManager* self) : self_ {self} {}
|
explicit Impl(MarkerManager* self) : self_ {self} {}
|
||||||
~Impl() {}
|
~Impl() {}
|
||||||
|
|
||||||
std::string markerSettingsPath_ {};
|
std::string markerSettingsPath_ {};
|
||||||
std::vector<std::shared_ptr<MarkerRecord>> markerRecords_ {};
|
std::vector<std::shared_ptr<MarkerRecord>> markerRecords_ {};
|
||||||
|
|
||||||
MarkerManager* self_;
|
MarkerManager* self_;
|
||||||
|
|
||||||
void InitializeMarkerSettings();
|
void InitializeMarkerSettings();
|
||||||
void ReadMarkerSettings();
|
void ReadMarkerSettings();
|
||||||
void WriteMarkerSettings();
|
void WriteMarkerSettings();
|
||||||
std::shared_ptr<MarkerRecord> GetMarkerByName(const std::string& name);
|
std::shared_ptr<MarkerRecord> GetMarkerByName(const std::string& name);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MarkerManager::Impl::MarkerRecord
|
class MarkerManager::Impl::MarkerRecord
|
||||||
|
|
@ -58,7 +57,7 @@ public:
|
||||||
double longitude_;
|
double longitude_;
|
||||||
|
|
||||||
friend void tag_invoke(boost::json::value_from_tag,
|
friend void tag_invoke(boost::json::value_from_tag,
|
||||||
boost::json::value& jv,
|
boost::json::value& jv,
|
||||||
const std::shared_ptr<MarkerRecord>& record)
|
const std::shared_ptr<MarkerRecord>& record)
|
||||||
{
|
{
|
||||||
jv = {{kNameName_, record->name_},
|
jv = {{kNameName_, record->name_},
|
||||||
|
|
@ -67,7 +66,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
friend MarkerRecord tag_invoke(boost::json::value_to_tag<MarkerRecord>,
|
friend MarkerRecord tag_invoke(boost::json::value_to_tag<MarkerRecord>,
|
||||||
const boost::json::value& jv)
|
const boost::json::value& jv)
|
||||||
{
|
{
|
||||||
return MarkerRecord(
|
return MarkerRecord(
|
||||||
boost::json::value_to<std::string>(jv.at(kNameName_)),
|
boost::json::value_to<std::string>(jv.at(kNameName_)),
|
||||||
|
|
@ -76,7 +75,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void MarkerManager::Impl::InitializeMarkerSettings()
|
void MarkerManager::Impl::InitializeMarkerSettings()
|
||||||
{
|
{
|
||||||
std::string appDataPath {
|
std::string appDataPath {
|
||||||
|
|
@ -165,7 +163,7 @@ MarkerManager::MarkerManager() : p(std::make_unique<Impl>(this))
|
||||||
p->InitializeMarkerSettings();
|
p->InitializeMarkerSettings();
|
||||||
|
|
||||||
// Read Marker settings on startup
|
// Read Marker settings on startup
|
||||||
//main::Application::WaitForInitialization();
|
// main::Application::WaitForInitialization();
|
||||||
p->ReadMarkerSettings();
|
p->ReadMarkerSettings();
|
||||||
}
|
}
|
||||||
catch (const std::exception& ex)
|
catch (const std::exception& ex)
|
||||||
|
|
@ -210,8 +208,8 @@ void MarkerManager::set_marker(size_t index, const types::MarkerInfo& marker)
|
||||||
markerRecord->longitude_ = marker.longitude_;
|
markerRecord->longitude_ = marker.longitude_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkerManager::set_marker(const std::string& name,
|
void MarkerManager::set_marker(const std::string& name,
|
||||||
const types::MarkerInfo& marker)
|
const types::MarkerInfo& marker)
|
||||||
{
|
{
|
||||||
std::shared_ptr<MarkerManager::Impl::MarkerRecord> markerRecord =
|
std::shared_ptr<MarkerManager::Impl::MarkerRecord> markerRecord =
|
||||||
p->GetMarkerByName(name);
|
p->GetMarkerByName(name);
|
||||||
|
|
@ -235,9 +233,7 @@ void MarkerManager::move_marker(size_t from, size_t to)
|
||||||
std::shared_ptr<MarkerManager::Impl::MarkerRecord> markerRecord =
|
std::shared_ptr<MarkerManager::Impl::MarkerRecord> markerRecord =
|
||||||
p->markerRecords_[from];
|
p->markerRecords_[from];
|
||||||
|
|
||||||
if (from == to)
|
if (from == to) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
else if (from < to)
|
else if (from < to)
|
||||||
{
|
{
|
||||||
for (size_t i = from; i < to; i++)
|
for (size_t i = from; i < to; i++)
|
||||||
|
|
@ -260,11 +256,12 @@ std::shared_ptr<MarkerManager> MarkerManager::Instance()
|
||||||
{
|
{
|
||||||
static std::weak_ptr<MarkerManager> markerManagerReference_ {};
|
static std::weak_ptr<MarkerManager> markerManagerReference_ {};
|
||||||
|
|
||||||
std::shared_ptr<MarkerManager> markerManager = markerManagerReference_.lock();
|
std::shared_ptr<MarkerManager> markerManager =
|
||||||
|
markerManagerReference_.lock();
|
||||||
|
|
||||||
if (markerManager == nullptr)
|
if (markerManager == nullptr)
|
||||||
{
|
{
|
||||||
markerManager = std::make_shared<MarkerManager>();
|
markerManager = std::make_shared<MarkerManager>();
|
||||||
markerManagerReference_ = markerManager;
|
markerManagerReference_ = markerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,10 @@ public:
|
||||||
explicit MarkerManager();
|
explicit MarkerManager();
|
||||||
~MarkerManager();
|
~MarkerManager();
|
||||||
|
|
||||||
size_t marker_count();
|
size_t marker_count();
|
||||||
types::MarkerInfo get_marker(size_t index);
|
types::MarkerInfo get_marker(size_t index);
|
||||||
types::MarkerInfo get_marker(const std::string& name);
|
types::MarkerInfo get_marker(const std::string& name);
|
||||||
void set_marker(size_t index, const types::MarkerInfo& marker);
|
void set_marker(size_t index, const types::MarkerInfo& marker);
|
||||||
void set_marker(const std::string& name, const types::MarkerInfo& marker);
|
void set_marker(const std::string& name, const types::MarkerInfo& marker);
|
||||||
void add_marker(const types::MarkerInfo& marker);
|
void add_marker(const types::MarkerInfo& marker);
|
||||||
void move_marker(size_t from, size_t to);
|
void move_marker(size_t from, size_t to);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ namespace map
|
||||||
static const std::string logPrefix_ = "scwx::qt::map::marker_layer";
|
static const std::string logPrefix_ = "scwx::qt::map::marker_layer";
|
||||||
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||||
|
|
||||||
|
|
||||||
class MarkerLayer::Impl
|
class MarkerLayer::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -30,7 +29,7 @@ public:
|
||||||
const std::string& markerIconName_ {
|
const std::string& markerIconName_ {
|
||||||
types::GetTextureName(types::ImageTexture::Cursor17)};
|
types::GetTextureName(types::ImageTexture::Cursor17)};
|
||||||
|
|
||||||
std::shared_ptr<gl::draw::GeoIcons> geoIcons_;
|
std::shared_ptr<gl::draw::GeoIcons> geoIcons_;
|
||||||
};
|
};
|
||||||
|
|
||||||
void MarkerLayer::Impl::ReloadMarkers()
|
void MarkerLayer::Impl::ReloadMarkers()
|
||||||
|
|
@ -51,8 +50,7 @@ void MarkerLayer::Impl::ReloadMarkers()
|
||||||
}
|
}
|
||||||
|
|
||||||
MarkerLayer::MarkerLayer(const std::shared_ptr<MapContext>& context) :
|
MarkerLayer::MarkerLayer(const std::shared_ptr<MapContext>& context) :
|
||||||
DrawLayer(context),
|
DrawLayer(context), p(std::make_unique<MarkerLayer::Impl>(context))
|
||||||
p(std::make_unique<MarkerLayer::Impl>(context))
|
|
||||||
{
|
{
|
||||||
AddDrawItem(p->geoIcons_);
|
AddDrawItem(p->geoIcons_);
|
||||||
}
|
}
|
||||||
|
|
@ -69,10 +67,9 @@ void MarkerLayer::Initialize()
|
||||||
p->geoIcons_->FinishIconSheets();
|
p->geoIcons_->FinishIconSheets();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkerLayer::Render(
|
void MarkerLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
const QMapLibre::CustomLayerRenderParameters& params)
|
|
||||||
{
|
{
|
||||||
//auto markerManager = manager::MarkerManager::Instance();
|
// auto markerManager = manager::MarkerManager::Instance();
|
||||||
gl::OpenGLFunctions& gl = context()->gl();
|
gl::OpenGLFunctions& gl = context()->gl();
|
||||||
|
|
||||||
// TODO. do not redo this every time
|
// TODO. do not redo this every time
|
||||||
|
|
@ -93,4 +90,3 @@ void MarkerLayer::Deinitialize()
|
||||||
} // namespace map
|
} // namespace map
|
||||||
} // namespace qt
|
} // namespace qt
|
||||||
} // namespace scwx
|
} // namespace scwx
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue