mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 03:40:05 +00:00
Location markers part2 clang-format fixes
This commit is contained in:
parent
e62ef3a7f3
commit
cac89129af
9 changed files with 79 additions and 76 deletions
|
|
@ -903,7 +903,7 @@ bool GeoIcons::RunMousePicking(
|
|||
const QPointF& mouseGlobalPos,
|
||||
const glm::vec2& mouseCoords,
|
||||
const common::Coordinate& /* mouseGeoCoords */,
|
||||
std::shared_ptr<types::EventHandler>& eventHandler )
|
||||
std::shared_ptr<types::EventHandler>& eventHandler)
|
||||
{
|
||||
std::unique_lock lock {p->iconMutex_};
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ public:
|
|||
class MarkerManager::Impl::MarkerRecord
|
||||
{
|
||||
public:
|
||||
|
||||
MarkerRecord(const types::MarkerInfo& info) :
|
||||
markerInfo_ {info}
|
||||
{
|
||||
|
|
@ -93,7 +92,6 @@ public:
|
|||
util::color::ToArgbString(record->markerInfo_.iconColor)}};
|
||||
}
|
||||
|
||||
|
||||
friend MarkerRecord tag_invoke(boost::json::value_to_tag<MarkerRecord>,
|
||||
const boost::json::value& jv)
|
||||
{
|
||||
|
|
@ -112,7 +110,8 @@ public:
|
|||
|
||||
if (jo.contains(kIconColorName_) && jo.at(kIconName_).is_string())
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
iconColor = util::color::ToRgba8PixelT(
|
||||
boost::json::value_to<std::string>(jv.at(kIconColorName_)));
|
||||
}
|
||||
|
|
@ -181,7 +180,6 @@ void MarkerManager::Impl::ReadMarkerSettings()
|
|||
{
|
||||
// For each marker entry
|
||||
auto& markerArray = markerJson.as_array();
|
||||
//std::vector<std::string> fileNames {};
|
||||
markerRecords_.reserve(markerArray.size());
|
||||
idToIndex_.reserve(markerArray.size());
|
||||
for (auto& markerEntry : markerArray)
|
||||
|
|
@ -206,13 +204,13 @@ void MarkerManager::Impl::ReadMarkerSettings()
|
|||
}
|
||||
|
||||
util::TextureAtlas& textureAtlas = util::TextureAtlas::Instance();
|
||||
textureAtlas.BuildAtlas(2048, 2048); // Should this code be moved to ResourceManager?
|
||||
textureAtlas.BuildAtlas(
|
||||
2048, 2048); // Should this code be moved to ResourceManager?
|
||||
|
||||
logger_->debug("{} location marker entries", markerRecords_.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Q_EMIT self_->MarkersUpdated();
|
||||
}
|
||||
|
||||
|
|
@ -457,7 +455,8 @@ void MarkerManager::add_icon(const std::string& name, bool startup)
|
|||
if (!startup)
|
||||
{
|
||||
util::TextureAtlas& textureAtlas = util::TextureAtlas::Instance();
|
||||
textureAtlas.BuildAtlas(2048, 2048); // Should this code be moved to ResourceManager?
|
||||
textureAtlas.BuildAtlas(
|
||||
2048, 2048); // Should this code be moved to ResourceManager?
|
||||
Q_EMIT IconAdded(name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ signals:
|
|||
void IconsReady();
|
||||
void IconAdded(std::string name);
|
||||
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> p;
|
||||
|
|
|
|||
|
|
@ -133,7 +133,8 @@ QVariant MarkerModel::data(const QModelIndex& index, int role) const
|
|||
{
|
||||
std::optional<types::MarkerIconInfo> icon =
|
||||
p->markerManager_->get_icon(markerInfo->iconName);
|
||||
if (icon) {
|
||||
if (icon)
|
||||
{
|
||||
return util::modulateColors(icon->qIcon,
|
||||
QSize(iconSize_, iconSize_),
|
||||
QColor(markerInfo->iconColor[0],
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ struct MarkerInfo
|
|||
{
|
||||
}
|
||||
|
||||
MarkerId id{0};
|
||||
MarkerId id {0};
|
||||
std::string name;
|
||||
double latitude;
|
||||
double longitude;
|
||||
|
|
@ -39,16 +39,17 @@ struct MarkerInfo
|
|||
boost::gil::rgba8_pixel_t iconColor;
|
||||
};
|
||||
|
||||
struct MarkerIconInfo {
|
||||
struct MarkerIconInfo
|
||||
{
|
||||
explicit MarkerIconInfo(types::ImageTexture texture,
|
||||
std::int32_t hotX,
|
||||
std::int32_t hotY) :
|
||||
name{types::GetTextureName(texture)},
|
||||
path{types::GetTexturePath(texture)},
|
||||
hotX{hotX},
|
||||
hotY{hotY},
|
||||
qIcon{QIcon(QString::fromStdString(path))},
|
||||
image{}
|
||||
name {types::GetTextureName(texture)},
|
||||
path {types::GetTexturePath(texture)},
|
||||
hotX {hotX},
|
||||
hotY {hotY},
|
||||
qIcon {QIcon(QString::fromStdString(path))},
|
||||
image {}
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -56,12 +57,12 @@ struct MarkerIconInfo {
|
|||
std::int32_t hotX,
|
||||
std::int32_t hotY,
|
||||
std::shared_ptr<boost::gil::rgba8_image_t> image) :
|
||||
name{path},
|
||||
path{path},
|
||||
hotX{hotX},
|
||||
hotY{hotY},
|
||||
qIcon{QIcon(QString::fromStdString(path))},
|
||||
image{image}
|
||||
name {path},
|
||||
path {path},
|
||||
hotX {hotX},
|
||||
hotY {hotY},
|
||||
qIcon {QIcon(QString::fromStdString(path))},
|
||||
image {image}
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,14 +46,12 @@ static const std::unordered_map<ImageTexture, TextureInfo> imageTextureInfo_ {
|
|||
{ImageTexture::LocationMarker,
|
||||
{"images/location-marker", ":/res/textures/images/location-marker.svg"}},
|
||||
{ImageTexture::LocationPin,
|
||||
{"images/location-pin",
|
||||
":/res/icons/font-awesome-6/location-pin.svg"}},
|
||||
{"images/location-pin", ":/res/icons/font-awesome-6/location-pin.svg"}},
|
||||
{ImageTexture::LocationStar,
|
||||
{"images/location-star",
|
||||
":/res/icons/font-awesome-6/star-solid-white.svg"}},
|
||||
{ImageTexture::LocationTent,
|
||||
{"images/location-tent",
|
||||
":/res/icons/font-awesome-6/tent-solid.svg"}},
|
||||
{"images/location-tent", ":/res/icons/font-awesome-6/tent-solid.svg"}},
|
||||
{ImageTexture::MapboxLogo,
|
||||
{"images/mapbox-logo", ":/res/textures/images/mapbox-logo.svg"}},
|
||||
{ImageTexture::MapTilerLogo,
|
||||
|
|
|
|||
|
|
@ -30,10 +30,7 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
|||
class EditMarkerDialog::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl(EditMarkerDialog* self) :
|
||||
self_{self}
|
||||
{
|
||||
}
|
||||
explicit Impl(EditMarkerDialog* self) : self_ {self} {}
|
||||
|
||||
void show_color_dialog();
|
||||
void show_icon_file_dialog();
|
||||
|
|
@ -54,7 +51,7 @@ public:
|
|||
manager::MarkerManager::Instance();
|
||||
types::MarkerId editId_;
|
||||
bool adding_;
|
||||
std::string setIconOnAdded_{""};
|
||||
std::string setIconOnAdded_ {""};
|
||||
};
|
||||
|
||||
QIcon EditMarkerDialog::Impl::get_colored_icon(
|
||||
|
|
@ -114,8 +111,7 @@ void EditMarkerDialog::setup(double latitude, double longitude)
|
|||
|
||||
void EditMarkerDialog::setup(types::MarkerId id)
|
||||
{
|
||||
std::optional<types::MarkerInfo> marker =
|
||||
p->markerManager_->get_marker(id);
|
||||
std::optional<types::MarkerInfo> marker = p->markerManager_->get_marker(id);
|
||||
if (!marker)
|
||||
{
|
||||
return;
|
||||
|
|
@ -270,7 +266,6 @@ void EditMarkerDialog::Impl::set_icon_color(const std::string& color)
|
|||
|
||||
auto* iconComboBox = self_->ui->iconComboBox;
|
||||
|
||||
|
||||
self_->ui->iconComboBox->clear();
|
||||
for (auto& markerIcon : markerManager_->get_icons())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ private:
|
|||
Ui::EditMarkerDialog* ui;
|
||||
};
|
||||
|
||||
|
||||
} // namespace ui
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
#include <condition_variable>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
|
|
@ -37,7 +36,6 @@ static const boost::gil::rgba8_pixel_t defaultIconColor =
|
|||
util::color::ToRgba8PixelT("#ffff0000");
|
||||
static const std::string defaultIconName = "images/location-marker";
|
||||
|
||||
|
||||
void CompareFiles(const std::string& file1, const std::string& file2)
|
||||
{
|
||||
std::ifstream ifs1 {file1};
|
||||
|
|
@ -57,7 +55,8 @@ void CopyFile(const std::string& from, const std::string& to)
|
|||
CompareFiles(from, to);
|
||||
}
|
||||
|
||||
using TestFunction = void (std::shared_ptr<manager::MarkerManager>, MarkerModel &);
|
||||
using TestFunction = void(std::shared_ptr<manager::MarkerManager>,
|
||||
MarkerModel&);
|
||||
|
||||
void RunTest(const std::string& filename, TestFunction testFunction)
|
||||
{
|
||||
|
|
@ -126,7 +125,10 @@ TEST(MarkerModelTest, AddRemove)
|
|||
|
||||
RunTest(ONE_MARKERS_FILE,
|
||||
[](std::shared_ptr<manager::MarkerManager> manager, MarkerModel&)
|
||||
{ manager->add_marker(types::MarkerInfo("Null", 0, 0, defaultIconName, defaultIconColor)); });
|
||||
{
|
||||
manager->add_marker(types::MarkerInfo(
|
||||
"Null", 0, 0, defaultIconName, defaultIconColor));
|
||||
});
|
||||
RunTest(
|
||||
EMPTY_MARKERS_FILE,
|
||||
[](std::shared_ptr<manager::MarkerManager> manager, MarkerModel& model)
|
||||
|
|
@ -150,11 +152,16 @@ TEST(MarkerModelTest, AddFive)
|
|||
RunTest(FIVE_MARKERS_FILE,
|
||||
[](std::shared_ptr<manager::MarkerManager> manager, MarkerModel&)
|
||||
{
|
||||
manager->add_marker(types::MarkerInfo("Null", 0, 0, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo("North", 90, 0, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo("South", -90, 0, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo("East", 0, 90, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo("West", 0, -90, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo(
|
||||
"Null", 0, 0, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo(
|
||||
"North", 90, 0, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo(
|
||||
"South", -90, 0, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo(
|
||||
"East", 0, 90, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo(
|
||||
"West", 0, -90, defaultIconName, defaultIconColor));
|
||||
});
|
||||
|
||||
std::filesystem::remove(TEMP_MARKERS_FILE);
|
||||
|
|
@ -168,10 +175,14 @@ TEST(MarkerModelTest, AddFour)
|
|||
RunTest(FIVE_MARKERS_FILE,
|
||||
[](std::shared_ptr<manager::MarkerManager> manager, MarkerModel&)
|
||||
{
|
||||
manager->add_marker(types::MarkerInfo("North", 90, 0, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo("South", -90, 0, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo("East", 0, 90, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo("West", 0, -90, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo(
|
||||
"North", 90, 0, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo(
|
||||
"South", -90, 0, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo(
|
||||
"East", 0, 90, defaultIconName, defaultIconColor));
|
||||
manager->add_marker(types::MarkerInfo(
|
||||
"West", 0, -90, defaultIconName, defaultIconColor));
|
||||
});
|
||||
|
||||
std::filesystem::remove(TEMP_MARKERS_FILE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue