mirror of
				https://gitlab.com/Trygve/contour-creator.git
				synced 2025-10-31 00:40:46 +00:00 
			
		
		
		
	changed to create a vector
This commit is contained in:
		
							parent
							
								
									33dd409c43
								
							
						
					
					
						commit
						d046e18c43
					
				
							
								
								
									
										12
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/main.cpp
									
									
									
									
									
								
							| @ -13,7 +13,7 @@ | |||||||
| #include <gdal/gdal_frmts.h> | #include <gdal/gdal_frmts.h> | ||||||
| #include <omp.h> | #include <omp.h> | ||||||
| 
 | 
 | ||||||
| CellMap produce_cellmap(HeightMap* heightmap, float z) | std::vector<Point> produce_cellmap(HeightMap* heightmap, float z) | ||||||
| { | { | ||||||
|     int length = (heightmap->width-1)*(heightmap->height-1); |     int length = (heightmap->width-1)*(heightmap->height-1); | ||||||
|     uint8_t *cells = (uint8_t *) CPLMalloc(sizeof(uint8_t)*length); |     uint8_t *cells = (uint8_t *) CPLMalloc(sizeof(uint8_t)*length); | ||||||
| @ -27,24 +27,24 @@ CellMap produce_cellmap(HeightMap* heightmap, float z) | |||||||
|         (heightmap->get_pixel(x,y+1)>z)*8; |         (heightmap->get_pixel(x,y+1)>z)*8; | ||||||
|         if (result != 0 and result != 15 ) { |         if (result != 0 and result != 15 ) { | ||||||
|             points.push_back(Point(x, y, result)); |             points.push_back(Point(x, y, result)); | ||||||
|              | 
 | ||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     return CellMap(heightmap->width-1, heightmap->height-1, cells, heightmap->reference_system, heightmap->geotransform); |     return points; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| std::vector<CellMap> vector_cellmap(HeightMap* heightmap, int interval) | std::vector<std::vector<Point>> vector_cellmap(HeightMap* heightmap, int interval) | ||||||
| { | { | ||||||
|     int num_contours = (heightmap->max - heightmap->min)/interval; |     int num_contours = (heightmap->max - heightmap->min)/interval; | ||||||
|     std::vector<CellMap> vector_contours; |     std::vector<std::vector<Point>> vector_contours; | ||||||
|     omp_set_num_threads(12); |     omp_set_num_threads(12); | ||||||
| 
 | 
 | ||||||
|     #pragma omp parallel |     #pragma omp parallel | ||||||
|     { |     { | ||||||
|         std::vector<CellMap> vec_private; |         std::vector<std::vector<Point>> vec_private; | ||||||
|         #pragma omp for |         #pragma omp for | ||||||
|         for (int i = 1; i <= num_contours; i++)  |         for (int i = 1; i <= num_contours; i++)  | ||||||
|         { |         { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user