Получение данных блока растровых данных
#include <gis/gis_raw.h>int gis_data_raw_get_raster_data( const gis_data_raw_context_t ctx, uint32_t index, double *block_data );
gishelper
Функция заполняет массив данных block_data данными из указанного блока текущей выбранной растровой карты в разделяемой области памяти.
gis_core_connection_t connection;gis_core_request_parameters_t map;gis_data_raw_context_t raw_ctx;gis_core_link_init( &connection );gis_core_link_connect( &connection, 777 );gis_core_databuffer_attach( &connection );gis_core_request_parameters_init( &map );gis_core_databuffer_data_request( &connection, &map, 1 );gis_data_raw_ctx_alloc( &raw_ctx );gis_data_raw_ctx_import_databuffer( raw_ctx );gis_data_raw_select_first_map( raw_ctx );do {if ( ! GIS_IS_CORE_MAP_DATA_SOURCE_VECTOR( gis_data_raw_map_get_data_source( raw_ctx ) ) )break;} while ( gis_data_raw_select_next_map( raw_ctx ) == EOK);size_t block_number = 0;gis_data_raw_get_raster_block_count( raw_ctx, &block_number );uint32_t block_width = 0;uint32_t block_height = 0;gis_data_raw_get_raster_block_height( raw_ctx, 0, &block_height );gis_data_raw_get_raster_block_width( raw_ctx, 0, &block_width );size_t block_size = block_width * block_height;double *block_data = (double*)calloc( block_size, sizeof( *block_data ) );if ( !block_data ){printf( "Failed to allocate memory\n" );gis_data_raw_ctx_free( &raw_ctx );gis_core_databuffer_detach();gis_core_link_destroy( &connection, true );return 1;}if ( gis_data_raw_get_raster_data( raw_ctx, 0, block_data ) != EOK ){printf( "Failed to get data\n" );free( block_data );gis_data_raw_ctx_free( &raw_ctx );gis_core_databuffer_detach();gis_core_link_destroy( &connection, true );return 1;}printf( "%lf %lf %lf %lf", *block_data, *(block_data+1), *(block_data+2), *(block_data+3) );free( block_data );gis_data_raw_ctx_free( &raw_ctx );gis_core_databuffer_detach();gis_core_link_destroy( &connection, true );
ПК ЦКИ для ЗОСРВ «Нейтрино»
gis_data_raw_context_t, gis_data_raw_get_raster_block_count(), gis_data_raw_get_raster_block_height().
1.1.0
Предыдущий раздел: Описание API картографического фреймворка