How to use OutdoorPlugIn_ReadPredictionArea in Winprop API

User: "Tianhang Yu_20657"
Altair Community Member
Updated by Tianhang Yu_20657
Hi,
 
I attempted to utilize OutdoorPlugIn_ReadPredictionArea in order to obtain the lower left and upper right corners of the prediction area within an odb file. I set NumberCorners to 2 but only received one corner. Below are both my code and the result. Would you be able to assist me in identifying which parameter is causing the issue?
 
Thank you,
Tianhang Yu

Code:

// Prediction heights
int              NrPredictionHeights = 1;
double           PredictionHeights[1] = { 1.5 };
const char* my_odb_database = API_DATA_FOLDER "odbdata/map1";
 
// Size of matrix with results.
GeneralParameters.Resolution = 5.0;                        // Resolution in meter
GeneralParameters.NrLayers = NrPredictionHeights;          // Number of prediction heights
GeneralParameters.PredictionHeights = PredictionHeights;   // Prediction height in meter
 
//// Get prediction area.
 
int *NumberCorners = new int(2);
int DatabaseFileType = DATABASE_TYPE_WINPROP_ODB;
struct COORDPOINT point1;
struct COORDPOINT point2;
struct COORDPOINT * coord[2] = { &point1, &point2 };
struct COORDPOINT** Polygon = coord;
double* Resolution = &GeneralParameters.Resolution;
int* NumberHeights = &GeneralParameters.NrLayers;
double** Heights = &GeneralParameters.PredictionHeights;
int* PolygonUsed = new int(1);
 
OutdoorPlugIn_ReadPredictionArea(my_odb_database, NumberCorners, Polygon, DatabaseFileType, Resolution, NumberHeights, Heights, PolygonUsed);
 
std::cout << "Polygon DEBUG:" << Polygon[0]->x << std::endl;
std::cout << "Polygon DEBUG:" << Polygon[0]->y << std::endl;
std::cout << "Polygon DEBUG:" << Polygon[0]->z << std::endl;

std::cout << "Polygon DEBUG:" << Polygon[1]->x << std::endl;
std::cout << "Polygon DEBUG:" << Polygon[1]->y << std::endl;
std::cout << "Polygon DEBUG:" << Polygon[1]->z << std::endl;
 

Result:

Polygon DEBUG:610532
Polygon DEBUG:4.26688e+06
Polygon DEBUG:0

Polygon DEBUG:-9.25596e+61
Polygon DEBUG:-9.25596e+61
Polygon DEBUG:-9.25596e+61

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Reiner_Hoppe"
    Altair Employee
    Accepted Answer
    Updated by Reiner_Hoppe

    Please use the following code which should work:


        int NumberCorners;
        int DatabaseFileType = DATABASE_TYPE_WINPROP_ODB;
        struct COORDPOINT* Polygon;
        double* Resolution = &GeneralParameters.Resolution;
        int NumberHeights = 0;
        int PolygonUsed = 0;

      OutdoorPlugIn_ReadPredictionArea(my_odb_database, &NumberCorners, &Polygon, DatabaseFileType, Resolution, &NumberHeights, nullptr, &PolygonUsed);