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