mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 13:20:06 +00:00 
			
		
		
		
	Delegate retrieval of moment data to view class
This commit is contained in:
		
							parent
							
								
									5cbe986734
								
							
						
					
					
						commit
						7747e869ba
					
				
					 3 changed files with 32 additions and 12 deletions
				
			
		|  | @ -129,11 +129,7 @@ void RadarProductLayer::UpdateSweep() | ||||||
| 
 | 
 | ||||||
|    boost::timer::cpu_timer timer; |    boost::timer::cpu_timer timer; | ||||||
| 
 | 
 | ||||||
|    const std::vector<float>&   vertices = p->radarProductView_->vertices(); |    const std::vector<float>& vertices = p->radarProductView_->vertices(); | ||||||
|    const std::vector<uint8_t>& dataMoments8 = |  | ||||||
|       p->radarProductView_->data_moments8(); |  | ||||||
|    const std::vector<uint16_t>& dataMoments16 = |  | ||||||
|       p->radarProductView_->data_moments16(); |  | ||||||
| 
 | 
 | ||||||
|    // Bind a vertex array object
 |    // Bind a vertex array object
 | ||||||
|    gl.glBindVertexArray(p->vao_); |    gl.glBindVertexArray(p->vao_); | ||||||
|  | @ -158,19 +154,19 @@ void RadarProductLayer::UpdateSweep() | ||||||
|    // Buffer data moments
 |    // Buffer data moments
 | ||||||
|    const GLvoid* data; |    const GLvoid* data; | ||||||
|    GLsizeiptr    dataSize; |    GLsizeiptr    dataSize; | ||||||
|  |    size_t        componentSize; | ||||||
|    GLenum        type; |    GLenum        type; | ||||||
| 
 | 
 | ||||||
|    if (dataMoments8.size() > 0) |    std::tie(data, dataSize, componentSize) = | ||||||
|  |       p->radarProductView_->GetMomentData(); | ||||||
|  | 
 | ||||||
|  |    if (componentSize == 1) | ||||||
|    { |    { | ||||||
|       data     = static_cast<const GLvoid*>(dataMoments8.data()); |       type = GL_UNSIGNED_BYTE; | ||||||
|       dataSize = dataMoments8.size() * sizeof(GLubyte); |  | ||||||
|       type     = GL_UNSIGNED_BYTE; |  | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       data     = static_cast<const GLvoid*>(dataMoments16.data()); |       type = GL_UNSIGNED_SHORT; | ||||||
|       dataSize = dataMoments16.size() * sizeof(GLushort); |  | ||||||
|       type     = GL_UNSIGNED_SHORT; |  | ||||||
|    } |    } | ||||||
| 
 | 
 | ||||||
|    gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[1]); |    gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[1]); | ||||||
|  |  | ||||||
|  | @ -96,6 +96,28 @@ void RadarProductView::Initialize() | ||||||
|    UpdatePlot(); |    UpdatePlot(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | std::tuple<const void*, size_t, size_t> RadarProductView::GetMomentData() | ||||||
|  | { | ||||||
|  |    const void* data; | ||||||
|  |    size_t      dataSize; | ||||||
|  |    size_t      componentSize; | ||||||
|  | 
 | ||||||
|  |    if (p->dataMoments8_.size() > 0) | ||||||
|  |    { | ||||||
|  |       data          = p->dataMoments8_.data(); | ||||||
|  |       dataSize      = p->dataMoments8_.size() * sizeof(uint8_t); | ||||||
|  |       componentSize = 1; | ||||||
|  |    } | ||||||
|  |    else | ||||||
|  |    { | ||||||
|  |       data          = p->dataMoments16_.data(); | ||||||
|  |       dataSize      = p->dataMoments16_.size() * sizeof(uint16_t); | ||||||
|  |       componentSize = 2; | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    return std::tie(data, dataSize, componentSize); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void RadarProductView::LoadColorTable( | void RadarProductView::LoadColorTable( | ||||||
|    std::shared_ptr<common::ColorTable> colorTable) |    std::shared_ptr<common::ColorTable> colorTable) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -37,6 +37,8 @@ public: | ||||||
|    const std::vector<boost::gil::rgba8_pixel_t>& color_table() const; |    const std::vector<boost::gil::rgba8_pixel_t>& color_table() const; | ||||||
| 
 | 
 | ||||||
|    void Initialize(); |    void Initialize(); | ||||||
|  | 
 | ||||||
|  |    std::tuple<const void*, size_t, size_t> GetMomentData(); | ||||||
|    void LoadColorTable(std::shared_ptr<common::ColorTable> colorTable); |    void LoadColorTable(std::shared_ptr<common::ColorTable> colorTable); | ||||||
| 
 | 
 | ||||||
|    std::chrono::system_clock::time_point PlotTime(); |    std::chrono::system_clock::time_point PlotTime(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat