Detailed Description
This is an example of how to use the WinProp API to preprocess a database for IRT. The full example is distributed with the installation.
#include <stdio.h>
#include <string>
#include <iostream>
#include "IRT_preprocess.h"
#ifndef API_DATA_FOLDER
#define API_DATA_FOLDER "../../api/winprop/data/"
#endif // !API_DATA_FOLDER
int main(int argc, char** argv)
{
int Error = 0;
WinProp_PrePro PreproPara;
WinProp_Callback Callback;
WinProp_Structure_Init_PrePro(&PreproPara);
Callback.Percentage = CallbackProgress;
Callback.Message = CallbackMessage;
Callback.Error = CallbackError;
PreproPara.NrHeights = 1;
PreproPara.Heights = (double*)malloc(sizeof(double) * PreproPara.NrHeights);
PreproPara.Heights[0] = 1.5;
PreproPara.Resolution = 2.0;
PreproPara.AdaptiveResolution = 1;
PreproPara.AdaptiveResolutionFactor = 2;
PreproPara.MultipleInteractions = 0;
PreproPara.ExcludeDiffractions = 1;
PreproPara.OnlyPixelsInsideBuilding = 1;
PreproPara.TileLength = 10.0;
PreproPara.SegmentLength = 10.0;
char* my_indoor_vector_database = API_DATA_FOLDER "/indoor/IndoorVectordatabase.ida";
char* my_preprocessed_output_database = API_DATA_FOLDER "/indoor/IRT_Preprocessed_database";
Error = WinProp_PreProcessIndoor(
my_indoor_vector_database,
my_preprocessed_output_database,
&PreproPara,
&Callback
);
return 0;
}
int _STD_CALL CallbackMessage(const char * Text)
{
if (Text == nullptr)
return 0;
std::cout << "\n" << Text;
return(0);
}
int _STD_CALL CallbackError(const char * Text, int Error)
{
if (Text == nullptr)
return 0;
std::cout << "\n";
#ifdef __LINUX
std::cout << "\033[31m" << "Error (" << Error << "): ";
#else
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, FOREGROUND_RED);
std::cout << "Error (" << Error << "): ";
#endif // __LINUX
std::cout << Text;
#ifdef __LINUX
std::cout << "\033[0m";
#else
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN);
#endif // __LINUX
return 0;
}
int _STD_CALL CallbackProgress(int value, const char* text)
{
char Line[200];
sprintf(Line, "\n%d%% %s", value, text);
std::cout << Line;
return(0);
}