Вычисление параметров полигона.
#include <gis/gis_surfacemanager.h>int gis_render_sm_calculate_polygon( gis_render_sm_context_t sm_ctx, double_point_t *points, uint32_t n_points, double *area, double *perimeter );
surfacemanager
Функция вычисляет площадь и периметр полигона, описанного градусными точками.
QApplication app(argc, argv);gis_core_connection_t connection;gis_core_request_parameters_t map;gis_data_engine_context_t data_engine_ctx;gis_render_sm_context_t sm_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_engine_alloc( 800, 600, GIS_DATA_ENGINE_MODE_SM, GIS_DATA_ENGINE_BPP_32, &connection, &data_engine_ctx );gis_render_sm_alloc( &sm_ctx, data_engine_ctx, 1000, 0.5, 0 );vector<double_point_t> degree_vector;double area = 0, perimeter = 0;double_point_t pnt;pnt.x = 10;pnt.y = 10;degree_vector.push_back( pnt );pnt.x = 10;pnt.y = 11;degree_vector.push_back( pnt );pnt.x = 11;pnt.y = 11;degree_vector.push_back( pnt );pnt.x = 11;pnt.y = 10;degree_vector.push_back( pnt );gis_render_sm_calculate_polygon( sm_ctx, degree_vector.data(), degree_vector.size(), &area, &perimeter );if ( fabs( perimeter - 440149 ) > 10 ){printf( "gis_render_sm_calculate_polygon() failed\n" );return 1;}gis_render_sm_free( &sm_ctx );gis_data_engine_free( &data_engine_ctx );gis_core_databuffer_detach();gis_core_link_destroy( &connection, true );
ПК ЦКИ для ЗОСРВ «Нейтрино»
gis_render_sm_context_t, gis_render_sm_calculate_distance()
Предыдущий раздел: Описание API картографического фреймворка