How to use OutdoorPlugIn_ReadPredictionArea in Winprop API
Code:
double PredictionHeights[1] = { 1.5 };
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:4.26688e+06
Polygon DEBUG:0
Polygon DEBUG:-9.25596e+61
Polygon DEBUG:-9.25596e+61
Polygon DEBUG:-9.25596e+61
Best Answer
-
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);0
Answers
-
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);0 -
reinerh said:
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);Hi Reinerh,
Thank you for your assistance. Sorry that I'm not often working with C++, so I'm not very familiar with writing this code. I still have some confusion regarding the initialization of the
Polygon
parameter and the return value ofOutdoorPlugIn_ReadPredictionArea
.-
Based on my understanding, when
NumberCorners
is set to 2,OutdoorPlugIn_ReadPredictionArea
should return two data sets of typeCOORDPOINT
, each containing values for x, y, and z. Furthermore, these two sets ofCOORDPOINT
data should be stored at the address pointed to byPolygon
. How should I initialize the address pointed to byPolygon
to store the data that will be returned? -
Assuming I've completed the first step and obtained a pointer
Polygon
pointing to two sets ofCOORDPOINT
, how can I access the coordinate data stored in these two sets ofCOORDPOINT
and then assign them to other variables?
I've tried various methods and also the code you sent me, but it seems that
Polygon
consistently only provides me with the x, y, and z values of only one set of coordinates. I would greatly appreciate it if you could help me resolve this issue.Thank you,
Tianhang Yu
0 -
-
Tianhang Yu_20657 said:
Hi Reinerh,
Thank you for your assistance. Sorry that I'm not often working with C++, so I'm not very familiar with writing this code. I still have some confusion regarding the initialization of the
Polygon
parameter and the return value ofOutdoorPlugIn_ReadPredictionArea
.-
Based on my understanding, when
NumberCorners
is set to 2,OutdoorPlugIn_ReadPredictionArea
should return two data sets of typeCOORDPOINT
, each containing values for x, y, and z. Furthermore, these two sets ofCOORDPOINT
data should be stored at the address pointed to byPolygon
. How should I initialize the address pointed to byPolygon
to store the data that will be returned? -
Assuming I've completed the first step and obtained a pointer
Polygon
pointing to two sets ofCOORDPOINT
, how can I access the coordinate data stored in these two sets ofCOORDPOINT
and then assign them to other variables?
I've tried various methods and also the code you sent me, but it seems that
Polygon
consistently only provides me with the x, y, and z values of only one set of coordinates. I would greatly appreciate it if you could help me resolve this issue.Thank you,
Tianhang Yu
Hi Tianhang Yu,
please note NumberCorners and Polygon are set inside the function, no need to allocate memory before, which is also done inside the function.
For an .odb database the NumberCorners will be set to 4 and the Polygon[0], Polygon[1], Polygon[2], Polygon[3] will be set to the LL, LR, UR, UL corners.
I tested this yesterday on my side and it worked with the mentioned code as expected.
Best regards,
Reiner0 -
-
reinerh said:
Hi Tianhang Yu,
please note NumberCorners and Polygon are set inside the function, no need to allocate memory before, which is also done inside the function.
For an .odb database the NumberCorners will be set to 4 and the Polygon[0], Polygon[1], Polygon[2], Polygon[3] will be set to the LL, LR, UR, UL corners.
I tested this yesterday on my side and it worked with the mentioned code as expected.
Best regards,
ReinerHi Reinerh,
You're correct. It's working perfectly! You've really helped me out, thank you so much.
Best regards,
Tianhang Yu
0