mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 02:10:05 +00:00 
			
		
		
		
	Split layer types from map types
This commit is contained in:
		
							parent
							
								
									2fe3facbd2
								
							
						
					
					
						commit
						7cd1cd0681
					
				
					 6 changed files with 119 additions and 89 deletions
				
			
		|  | @ -1,6 +1,6 @@ | |||
| #include <scwx/qt/model/layer_model.hpp> | ||||
| #include <scwx/qt/manager/placefile_manager.hpp> | ||||
| #include <scwx/qt/types/map_types.hpp> | ||||
| #include <scwx/qt/types/layer_types.hpp> | ||||
| #include <scwx/qt/types/qt_types.hpp> | ||||
| #include <scwx/qt/util/json.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
|  |  | |||
							
								
								
									
										77
									
								
								scwx-qt/source/scwx/qt/types/layer_types.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								scwx-qt/source/scwx/qt/types/layer_types.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,77 @@ | |||
| #include <scwx/qt/types/layer_types.hpp> | ||||
| 
 | ||||
| #include <unordered_map> | ||||
| 
 | ||||
| #include <boost/algorithm/string.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
| { | ||||
| namespace types | ||||
| { | ||||
| 
 | ||||
| static const std::unordered_map<LayerType, std::string> layerTypeName_ { | ||||
|    {LayerType::Map, "Map"}, | ||||
|    {LayerType::Radar, "Radar"}, | ||||
|    {LayerType::Alert, "Alert"}, | ||||
|    {LayerType::Placefile, "Placefile"}, | ||||
|    {LayerType::Information, "Information"}, | ||||
|    {LayerType::Unknown, "?"}}; | ||||
| 
 | ||||
| static const std::unordered_map<Layer, std::string> layerName_ { | ||||
|    {Layer::MapOverlay, "Map Overlay"}, | ||||
|    {Layer::ColorTable, "Color Table"}, | ||||
|    {Layer::MapSymbology, "Map Symbology"}, | ||||
|    {Layer::MapUnderlay, "Map Underlay"}, | ||||
|    {Layer::Unknown, "?"}}; | ||||
| 
 | ||||
| LayerType GetLayerType(const std::string& name) | ||||
| { | ||||
|    auto result = | ||||
|       std::find_if(layerTypeName_.cbegin(), | ||||
|                    layerTypeName_.cend(), | ||||
|                    [&](const std::pair<LayerType, std::string>& pair) -> bool | ||||
|                    { return boost::iequals(pair.second, name); }); | ||||
| 
 | ||||
|    if (result != layerTypeName_.cend()) | ||||
|    { | ||||
|       return result->first; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       return LayerType::Unknown; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| std::string GetLayerTypeName(LayerType layerType) | ||||
| { | ||||
|    return layerTypeName_.at(layerType); | ||||
| } | ||||
| 
 | ||||
| Layer GetLayer(const std::string& name) | ||||
| { | ||||
|    auto result = | ||||
|       std::find_if(layerName_.cbegin(), | ||||
|                    layerName_.cend(), | ||||
|                    [&](const std::pair<Layer, std::string>& pair) -> bool | ||||
|                    { return boost::iequals(pair.second, name); }); | ||||
| 
 | ||||
|    if (result != layerName_.cend()) | ||||
|    { | ||||
|       return result->first; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       return Layer::Unknown; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| std::string GetLayerName(Layer layer) | ||||
| { | ||||
|    return layerName_.at(layer); | ||||
| } | ||||
| 
 | ||||
| } // namespace types
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
							
								
								
									
										39
									
								
								scwx-qt/source/scwx/qt/types/layer_types.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								scwx-qt/source/scwx/qt/types/layer_types.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,39 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <string> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
| { | ||||
| namespace types | ||||
| { | ||||
| 
 | ||||
| enum class LayerType | ||||
| { | ||||
|    Map, | ||||
|    Radar, | ||||
|    Alert, | ||||
|    Placefile, | ||||
|    Information, | ||||
|    Unknown | ||||
| }; | ||||
| 
 | ||||
| enum class Layer | ||||
| { | ||||
|    MapOverlay, | ||||
|    ColorTable, | ||||
|    MapSymbology, | ||||
|    MapUnderlay, | ||||
|    Unknown | ||||
| }; | ||||
| 
 | ||||
| LayerType   GetLayerType(const std::string& name); | ||||
| std::string GetLayerTypeName(LayerType layerType); | ||||
| 
 | ||||
| Layer       GetLayer(const std::string& name); | ||||
| std::string GetLayerName(Layer layer); | ||||
| 
 | ||||
| } // namespace types
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
|  | @ -2,8 +2,6 @@ | |||
| 
 | ||||
| #include <unordered_map> | ||||
| 
 | ||||
| #include <boost/algorithm/string.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
|  | @ -11,70 +9,9 @@ namespace qt | |||
| namespace types | ||||
| { | ||||
| 
 | ||||
| static const std::unordered_map<LayerType, std::string> layerTypeName_ { | ||||
|    {LayerType::Map, "Map"}, | ||||
|    {LayerType::Radar, "Radar"}, | ||||
|    {LayerType::Alert, "Alert"}, | ||||
|    {LayerType::Placefile, "Placefile"}, | ||||
|    {LayerType::Information, "Information"}, | ||||
|    {LayerType::Unknown, "?"}}; | ||||
| 
 | ||||
| static const std::unordered_map<Layer, std::string> layerName_ { | ||||
|    {Layer::MapOverlay, "Map Overlay"}, | ||||
|    {Layer::ColorTable, "Color Table"}, | ||||
|    {Layer::MapSymbology, "Map Symbology"}, | ||||
|    {Layer::MapUnderlay, "Map Underlay"}, | ||||
|    {Layer::Unknown, "?"}}; | ||||
| 
 | ||||
| static const std::unordered_map<MapTime, std::string> mapTimeName_ { | ||||
|    {MapTime::Live, "Live"}, {MapTime::Archive, "Archive"}}; | ||||
| 
 | ||||
| LayerType GetLayerType(const std::string& name) | ||||
| { | ||||
|    auto result = | ||||
|       std::find_if(layerTypeName_.cbegin(), | ||||
|                    layerTypeName_.cend(), | ||||
|                    [&](const std::pair<LayerType, std::string>& pair) -> bool | ||||
|                    { return boost::iequals(pair.second, name); }); | ||||
| 
 | ||||
|    if (result != layerTypeName_.cend()) | ||||
|    { | ||||
|       return result->first; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       return LayerType::Unknown; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| std::string GetLayerTypeName(LayerType layerType) | ||||
| { | ||||
|    return layerTypeName_.at(layerType); | ||||
| } | ||||
| 
 | ||||
| Layer GetLayer(const std::string& name) | ||||
| { | ||||
|    auto result = | ||||
|       std::find_if(layerName_.cbegin(), | ||||
|                    layerName_.cend(), | ||||
|                    [&](const std::pair<Layer, std::string>& pair) -> bool | ||||
|                    { return boost::iequals(pair.second, name); }); | ||||
| 
 | ||||
|    if (result != layerName_.cend()) | ||||
|    { | ||||
|       return result->first; | ||||
|    } | ||||
|    else | ||||
|    { | ||||
|       return Layer::Unknown; | ||||
|    } | ||||
| } | ||||
| 
 | ||||
| std::string GetLayerName(Layer layer) | ||||
| { | ||||
|    return layerName_.at(layer); | ||||
| } | ||||
| 
 | ||||
| std::string GetMapTimeName(MapTime mapTime) | ||||
| { | ||||
|    return mapTimeName_.at(mapTime); | ||||
|  |  | |||
|  | @ -9,25 +9,6 @@ namespace qt | |||
| namespace types | ||||
| { | ||||
| 
 | ||||
| enum class LayerType | ||||
| { | ||||
|    Map, | ||||
|    Radar, | ||||
|    Alert, | ||||
|    Placefile, | ||||
|    Information, | ||||
|    Unknown | ||||
| }; | ||||
| 
 | ||||
| enum class Layer | ||||
| { | ||||
|    MapOverlay, | ||||
|    ColorTable, | ||||
|    MapSymbology, | ||||
|    MapUnderlay, | ||||
|    Unknown | ||||
| }; | ||||
| 
 | ||||
| enum class AnimationState | ||||
| { | ||||
|    Play, | ||||
|  | @ -48,12 +29,6 @@ enum class NoUpdateReason | |||
|    InvalidData | ||||
| }; | ||||
| 
 | ||||
| LayerType   GetLayerType(const std::string& name); | ||||
| std::string GetLayerTypeName(LayerType layerType); | ||||
| 
 | ||||
| Layer       GetLayer(const std::string& name); | ||||
| std::string GetLayerName(Layer layer); | ||||
| 
 | ||||
| std::string GetMapTimeName(MapTime mapTime); | ||||
| 
 | ||||
| } // namespace types
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat