mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:20:06 +00:00 
			
		
		
		
	Placefile text animation support
This commit is contained in:
		
							parent
							
								
									e013b9a77f
								
							
						
					
					
						commit
						4cc1a2b310
					
				
					 14 changed files with 89 additions and 1 deletions
				
			
		|  | @ -95,6 +95,8 @@ public: | |||
|    bool dirty_ {false}; | ||||
|    bool thresholded_ {false}; | ||||
| 
 | ||||
|    std::chrono::system_clock::time_point selectedTime_ {}; | ||||
| 
 | ||||
|    std::mutex iconMutex_; | ||||
| 
 | ||||
|    boost::unordered_flat_map<std::size_t, PlacefileIconInfo> | ||||
|  | @ -139,6 +141,12 @@ PlacefileIcons::~PlacefileIcons() = default; | |||
| PlacefileIcons::PlacefileIcons(PlacefileIcons&&) noexcept            = default; | ||||
| PlacefileIcons& PlacefileIcons::operator=(PlacefileIcons&&) noexcept = default; | ||||
| 
 | ||||
| void PlacefileIcons::set_selected_time( | ||||
|    std::chrono::system_clock::time_point selectedTime) | ||||
| { | ||||
|    p->selectedTime_ = selectedTime; | ||||
| } | ||||
| 
 | ||||
| void PlacefileIcons::set_thresholded(bool thresholded) | ||||
| { | ||||
|    p->thresholded_ = thresholded; | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ public: | |||
|    PlacefileIcons(PlacefileIcons&&) noexcept; | ||||
|    PlacefileIcons& operator=(PlacefileIcons&&) noexcept; | ||||
| 
 | ||||
|    void set_selected_time(std::chrono::system_clock::time_point selectedTime); | ||||
|    void set_thresholded(bool thresholded); | ||||
| 
 | ||||
|    void Initialize() override; | ||||
|  |  | |||
|  | @ -77,6 +77,8 @@ public: | |||
|    bool dirty_ {false}; | ||||
|    bool thresholded_ {false}; | ||||
| 
 | ||||
|    std::chrono::system_clock::time_point selectedTime_ {}; | ||||
| 
 | ||||
|    std::mutex imageMutex_; | ||||
| 
 | ||||
|    boost::unordered_flat_map<std::string, PlacefileImageInfo> | ||||
|  | @ -117,6 +119,12 @@ PlacefileImages::PlacefileImages(PlacefileImages&&) noexcept = default; | |||
| PlacefileImages& | ||||
| PlacefileImages::operator=(PlacefileImages&&) noexcept = default; | ||||
| 
 | ||||
| void PlacefileImages::set_selected_time( | ||||
|    std::chrono::system_clock::time_point selectedTime) | ||||
| { | ||||
|    p->selectedTime_ = selectedTime; | ||||
| } | ||||
| 
 | ||||
| void PlacefileImages::set_thresholded(bool thresholded) | ||||
| { | ||||
|    p->thresholded_ = thresholded; | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ public: | |||
|    PlacefileImages(PlacefileImages&&) noexcept; | ||||
|    PlacefileImages& operator=(PlacefileImages&&) noexcept; | ||||
| 
 | ||||
|    void set_selected_time(std::chrono::system_clock::time_point selectedTime); | ||||
|    void set_thresholded(bool thresholded); | ||||
| 
 | ||||
|    void Initialize() override; | ||||
|  |  | |||
|  | @ -75,6 +75,8 @@ public: | |||
|    bool dirty_ {false}; | ||||
|    bool thresholded_ {false}; | ||||
| 
 | ||||
|    std::chrono::system_clock::time_point selectedTime_ {}; | ||||
| 
 | ||||
|    std::mutex lineMutex_ {}; | ||||
| 
 | ||||
|    std::size_t currentNumLines_ {}; | ||||
|  | @ -109,6 +111,12 @@ PlacefileLines::~PlacefileLines() = default; | |||
| PlacefileLines::PlacefileLines(PlacefileLines&&) noexcept            = default; | ||||
| PlacefileLines& PlacefileLines::operator=(PlacefileLines&&) noexcept = default; | ||||
| 
 | ||||
| void PlacefileLines::set_selected_time( | ||||
|    std::chrono::system_clock::time_point selectedTime) | ||||
| { | ||||
|    p->selectedTime_ = selectedTime; | ||||
| } | ||||
| 
 | ||||
| void PlacefileLines::set_thresholded(bool thresholded) | ||||
| { | ||||
|    p->thresholded_ = thresholded; | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ public: | |||
|    PlacefileLines(PlacefileLines&&) noexcept; | ||||
|    PlacefileLines& operator=(PlacefileLines&&) noexcept; | ||||
| 
 | ||||
|    void set_selected_time(std::chrono::system_clock::time_point selectedTime); | ||||
|    void set_thresholded(bool thresholded); | ||||
| 
 | ||||
|    void Initialize() override; | ||||
|  |  | |||
|  | @ -91,6 +91,8 @@ public: | |||
|    bool dirty_ {false}; | ||||
|    bool thresholded_ {false}; | ||||
| 
 | ||||
|    std::chrono::system_clock::time_point selectedTime_ {}; | ||||
| 
 | ||||
|    boost::container::stable_vector<TessVertexArray> tessCombineBuffer_ {}; | ||||
| 
 | ||||
|    std::mutex           bufferMutex_ {}; | ||||
|  | @ -126,6 +128,12 @@ PlacefilePolygons::PlacefilePolygons(PlacefilePolygons&&) noexcept = default; | |||
| PlacefilePolygons& | ||||
| PlacefilePolygons::operator=(PlacefilePolygons&&) noexcept = default; | ||||
| 
 | ||||
| void PlacefilePolygons::set_selected_time( | ||||
|    std::chrono::system_clock::time_point selectedTime) | ||||
| { | ||||
|    p->selectedTime_ = selectedTime; | ||||
| } | ||||
| 
 | ||||
| void PlacefilePolygons::set_thresholded(bool thresholded) | ||||
| { | ||||
|    p->thresholded_ = thresholded; | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ public: | |||
|    PlacefilePolygons(PlacefilePolygons&&) noexcept; | ||||
|    PlacefilePolygons& operator=(PlacefilePolygons&&) noexcept; | ||||
| 
 | ||||
|    void set_selected_time(std::chrono::system_clock::time_point selectedTime); | ||||
|    void set_thresholded(bool thresholded); | ||||
| 
 | ||||
|    void Initialize() override; | ||||
|  |  | |||
|  | @ -46,6 +46,8 @@ public: | |||
| 
 | ||||
|    bool thresholded_ {false}; | ||||
| 
 | ||||
|    std::chrono::system_clock::time_point selectedTime_ {}; | ||||
| 
 | ||||
|    std::uint32_t textId_ {}; | ||||
|    glm::vec2     mapScreenCoordLocation_ {}; | ||||
|    float         mapScale_ {1.0f}; | ||||
|  | @ -77,6 +79,12 @@ void PlacefileText::set_placefile_name(const std::string& placefileName) | |||
|    p->placefileName_ = placefileName; | ||||
| } | ||||
| 
 | ||||
| void PlacefileText::set_selected_time( | ||||
|    std::chrono::system_clock::time_point selectedTime) | ||||
| { | ||||
|    p->selectedTime_ = selectedTime; | ||||
| } | ||||
| 
 | ||||
| void PlacefileText::set_thresholded(bool thresholded) | ||||
| { | ||||
|    p->thresholded_ = thresholded; | ||||
|  | @ -117,7 +125,15 @@ void PlacefileText::Impl::RenderTextDrawItem( | |||
|    const QMapLibreGL::CustomLayerRenderParameters&           params, | ||||
|    const std::shared_ptr<const gr::Placefile::TextDrawItem>& di) | ||||
| { | ||||
|    if (!thresholded_ || mapDistance_ <= di->threshold_) | ||||
|    // If no time has been selected, use the current time
 | ||||
|    std::chrono::system_clock::time_point selectedTime = | ||||
|       (selectedTime_ == std::chrono::system_clock::time_point {}) ? | ||||
|          std::chrono::system_clock::now() : | ||||
|          selectedTime_; | ||||
| 
 | ||||
|    if ((!thresholded_ || mapDistance_ <= di->threshold_) && | ||||
|        (di->startTime_ == std::chrono::system_clock::time_point {} || | ||||
|         (di->startTime_ <= selectedTime && selectedTime < di->endTime_))) | ||||
|    { | ||||
|       const auto screenCoordinates = (util::maplibre::LatLongToScreenCoordinate( | ||||
|                                          {di->latitude_, di->longitude_}) - | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ public: | |||
|    PlacefileText& operator=(PlacefileText&&) noexcept; | ||||
| 
 | ||||
|    void set_placefile_name(const std::string& placefileName); | ||||
|    void set_selected_time(std::chrono::system_clock::time_point selectedTime); | ||||
|    void set_thresholded(bool thresholded); | ||||
| 
 | ||||
|    void Initialize() override; | ||||
|  |  | |||
|  | @ -46,6 +46,8 @@ public: | |||
|    bool dirty_ {false}; | ||||
|    bool thresholded_ {false}; | ||||
| 
 | ||||
|    std::chrono::system_clock::time_point selectedTime_ {}; | ||||
| 
 | ||||
|    std::mutex bufferMutex_ {}; | ||||
| 
 | ||||
|    std::vector<GLfloat> currentBuffer_ {}; | ||||
|  | @ -76,6 +78,12 @@ PlacefileTriangles::PlacefileTriangles(PlacefileTriangles&&) noexcept = default; | |||
| PlacefileTriangles& | ||||
| PlacefileTriangles::operator=(PlacefileTriangles&&) noexcept = default; | ||||
| 
 | ||||
| void PlacefileTriangles::set_selected_time( | ||||
|    std::chrono::system_clock::time_point selectedTime) | ||||
| { | ||||
|    p->selectedTime_ = selectedTime; | ||||
| } | ||||
| 
 | ||||
| void PlacefileTriangles::set_thresholded(bool thresholded) | ||||
| { | ||||
|    p->thresholded_ = thresholded; | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ public: | |||
|    PlacefileTriangles(PlacefileTriangles&&) noexcept; | ||||
|    PlacefileTriangles& operator=(PlacefileTriangles&&) noexcept; | ||||
| 
 | ||||
|    void set_selected_time(std::chrono::system_clock::time_point selectedTime); | ||||
|    void set_thresholded(bool thresholded); | ||||
| 
 | ||||
|    void Initialize() override; | ||||
|  |  | |||
|  | @ -839,6 +839,15 @@ void MainWindowImpl::ConnectAnimationSignals() | |||
|            timelineManager_.get(), | ||||
|            &manager::TimelineManager::AnimationStepEnd); | ||||
| 
 | ||||
|    connect(timelineManager_.get(), | ||||
|            &manager::TimelineManager::SelectedTimeUpdated, | ||||
|            [this]() | ||||
|            { | ||||
|               for (auto map : maps_) | ||||
|               { | ||||
|                  map->update(); | ||||
|               } | ||||
|            }); | ||||
|    connect(timelineManager_.get(), | ||||
|            &manager::TimelineManager::VolumeTimeUpdated, | ||||
|            [this](std::chrono::system_clock::time_point dateTime) | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| #include <scwx/qt/gl/draw/placefile_triangles.hpp> | ||||
| #include <scwx/qt/gl/draw/placefile_text.hpp> | ||||
| #include <scwx/qt/manager/placefile_manager.hpp> | ||||
| #include <scwx/qt/manager/timeline_manager.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| 
 | ||||
| #include <boost/asio/post.hpp> | ||||
|  | @ -58,6 +59,8 @@ public: | |||
|    std::shared_ptr<gl::draw::PlacefilePolygons>  placefilePolygons_; | ||||
|    std::shared_ptr<gl::draw::PlacefileTriangles> placefileTriangles_; | ||||
|    std::shared_ptr<gl::draw::PlacefileText>      placefileText_; | ||||
| 
 | ||||
|    std::chrono::system_clock::time_point selectedTime_ {}; | ||||
| }; | ||||
| 
 | ||||
| PlacefileLayer::PlacefileLayer(const std::shared_ptr<MapContext>& context, | ||||
|  | @ -80,6 +83,7 @@ PlacefileLayer::~PlacefileLayer() = default; | |||
| void PlacefileLayer::Impl::ConnectSignals() | ||||
| { | ||||
|    auto placefileManager = manager::PlacefileManager::Instance(); | ||||
|    auto timelineManager  = manager::TimelineManager::Instance(); | ||||
| 
 | ||||
|    QObject::connect(placefileManager.get(), | ||||
|                     &manager::PlacefileManager::PlacefileUpdated, | ||||
|  | @ -91,6 +95,12 @@ void PlacefileLayer::Impl::ConnectSignals() | |||
|                           self_->ReloadData(); | ||||
|                        } | ||||
|                     }); | ||||
| 
 | ||||
|    QObject::connect(timelineManager.get(), | ||||
|                     &manager::TimelineManager::SelectedTimeUpdated, | ||||
|                     self_, | ||||
|                     [this](std::chrono::system_clock::time_point dateTime) | ||||
|                     { selectedTime_ = dateTime; }); | ||||
| } | ||||
| 
 | ||||
| std::string PlacefileLayer::placefile_name() const | ||||
|  | @ -137,6 +147,13 @@ void PlacefileLayer::Render( | |||
|       p->placefilePolygons_->set_thresholded(thresholded); | ||||
|       p->placefileTriangles_->set_thresholded(thresholded); | ||||
|       p->placefileText_->set_thresholded(thresholded); | ||||
| 
 | ||||
|       p->placefileIcons_->set_selected_time(p->selectedTime_); | ||||
|       p->placefileImages_->set_selected_time(p->selectedTime_); | ||||
|       p->placefileLines_->set_selected_time(p->selectedTime_); | ||||
|       p->placefilePolygons_->set_selected_time(p->selectedTime_); | ||||
|       p->placefileTriangles_->set_selected_time(p->selectedTime_); | ||||
|       p->placefileText_->set_selected_time(p->selectedTime_); | ||||
|    } | ||||
| 
 | ||||
|    DrawLayer::Render(params); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat