mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 00:50:05 +00:00 
			
		
		
		
	Placefile polygon rendering
This commit is contained in:
		
							parent
							
								
									d9a53ea8d7
								
							
						
					
					
						commit
						cdef5a9938
					
				
					 8 changed files with 547 additions and 5 deletions
				
			
		|  | @ -729,17 +729,30 @@ void Placefile::Impl::ProcessElementEnd() | |||
| { | ||||
|    if (currentStatement_ == DrawingStatement::Polygon) | ||||
|    { | ||||
|       auto di = std::static_pointer_cast<PolygonDrawItem>(currentDrawItem_); | ||||
| 
 | ||||
|       // Complete the current contour when ending the Polygon statement
 | ||||
|       if (!currentPolygonContour_.empty()) | ||||
|       { | ||||
|          auto& contours = | ||||
|             std::static_pointer_cast<PolygonDrawItem>(currentDrawItem_) | ||||
|                ->contours_; | ||||
|          auto& contours = di->contours_; | ||||
| 
 | ||||
|          auto& newContour = | ||||
|             contours.emplace_back(std::vector<PolygonDrawItem::Element> {}); | ||||
|          newContour.swap(currentPolygonContour_); | ||||
|       } | ||||
| 
 | ||||
|       if (!di->contours_.empty()) | ||||
|       { | ||||
|          std::vector<common::Coordinate> coordinates {}; | ||||
|          std::transform(di->contours_[0].cbegin(), | ||||
|                         di->contours_[0].cend(), | ||||
|                         std::back_inserter(coordinates), | ||||
|                         [](auto& element) { | ||||
|                            return common::Coordinate {element.latitude_, | ||||
|                                                       element.longitude_}; | ||||
|                         }); | ||||
|          di->center_ = GetCentroid(coordinates); | ||||
|       } | ||||
|    } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat