mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-11-04 14:20:06 +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
				
			
		| 
						 | 
				
			
			@ -28,11 +28,11 @@ namespace manager
 | 
			
		|||
static const std::string logPrefix_ = "scwx::qt::manager::marker_manager";
 | 
			
		||||
static const auto        logger_    = scwx::util::Logger::Create(logPrefix_);
 | 
			
		||||
 | 
			
		||||
static const std::string kNameName_       = "name";
 | 
			
		||||
static const std::string kLatitudeName_   = "latitude";
 | 
			
		||||
static const std::string kLongitudeName_  = "longitude";
 | 
			
		||||
static const std::string kIconName_       = "icon";
 | 
			
		||||
static const std::string kIconColorName_  = "icon-color";
 | 
			
		||||
static const std::string kNameName_      = "name";
 | 
			
		||||
static const std::string kLatitudeName_  = "latitude";
 | 
			
		||||
static const std::string kLongitudeName_ = "longitude";
 | 
			
		||||
static const std::string kIconName_      = "icon";
 | 
			
		||||
static const std::string kIconColorName_ = "icon-color";
 | 
			
		||||
 | 
			
		||||
static const std::string defaultIconName = "images/location-marker";
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
   {
 | 
			
		||||
| 
						 | 
				
			
			@ -102,7 +100,7 @@ public:
 | 
			
		|||
 | 
			
		||||
      const boost::json::object& jo = jv.as_object();
 | 
			
		||||
 | 
			
		||||
      std::string iconName = defaultIconName;
 | 
			
		||||
      std::string               iconName  = defaultIconName;
 | 
			
		||||
      boost::gil::rgba8_pixel_t iconColor = defaultIconColor;
 | 
			
		||||
 | 
			
		||||
      if (jo.contains(kIconName_) && jo.at(kIconName_).is_string())
 | 
			
		||||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,11 +23,11 @@ public:
 | 
			
		|||
 | 
			
		||||
   size_t                           marker_count();
 | 
			
		||||
   std::optional<types::MarkerInfo> get_marker(types::MarkerId id);
 | 
			
		||||
   std::optional<size_t> get_index(types::MarkerId id);
 | 
			
		||||
   std::optional<size_t>            get_index(types::MarkerId id);
 | 
			
		||||
   void set_marker(types::MarkerId id, const types::MarkerInfo& marker);
 | 
			
		||||
   types::MarkerId add_marker(const types::MarkerInfo& marker);
 | 
			
		||||
   void remove_marker(types::MarkerId id);
 | 
			
		||||
   void move_marker(size_t from, size_t to);
 | 
			
		||||
   void            remove_marker(types::MarkerId id);
 | 
			
		||||
   void            move_marker(size_t from, size_t to);
 | 
			
		||||
 | 
			
		||||
   void add_icon(const std::string& name, bool startup = false);
 | 
			
		||||
   std::optional<types::MarkerIconInfo> get_icon(const std::string& name);
 | 
			
		||||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ public:
 | 
			
		|||
   void set_marker_settings_path(const std::string& path);
 | 
			
		||||
 | 
			
		||||
   static std::shared_ptr<MarkerManager> Instance();
 | 
			
		||||
   static const std::string& getDefaultIconName();
 | 
			
		||||
   static const std::string&             getDefaultIconName();
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
   void MarkersInitialized(size_t count);
 | 
			
		||||
| 
						 | 
				
			
			@ -51,7 +51,6 @@ signals:
 | 
			
		|||
   void IconsReady();
 | 
			
		||||
   void IconAdded(std::string name);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
   class Impl;
 | 
			
		||||
   std::unique_ptr<Impl> p;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue