diff --git a/build.sh b/build.sh index 51087ef..302041d 100755 --- a/build.sh +++ b/build.sh @@ -44,6 +44,7 @@ if [ "$1" = "mac" ] && [ "$DEBUG" = "1" ] then echo "Building dSYM" /opt/osxcross/target/bin/osxcross-llvm-dsymutil X-Plane/GAConnector/mac.xpl + /opt/osxcross/target/bin/osxcross-llvm-dsymutil X-Plane/GAConnector/libixwebsocket.dylib fi diff --git a/file/include/simdata/runway.hpp b/file/include/simdata/runway.hpp index 7733f5b..d248af9 100644 --- a/file/include/simdata/runway.hpp +++ b/file/include/simdata/runway.hpp @@ -71,32 +71,9 @@ namespace file : designator(designator), bounds(bounds), width(width), length(length), trueHeading(trueHeading){}; - inline bool containsPoint(geodata::point point) + inline bool containsPoint(const geodata::point point) const { - bool flag = false; - double udegrees1 = this->bounds.topRight.latitude + 90; - double udegrees2 = this->bounds.bottomLeft.latitude + 90; - double udegrees3 = this->bounds.topLeft.latitude + 90; - double udegrees4 = this->bounds.bottomRight.latitude + 90; - double udegrees5 = this->bounds.topRight.longitude + 180; - double udegrees6 = this->bounds.bottomLeft.longitude + 180; - double udegrees7 = this->bounds.topLeft.longitude + 180; - double udegrees8 = this->bounds.bottomRight.longitude + 180; - double udegrees9 = point.longitude + 180; - double udegrees10 = point.latitude + 90; - if (udegrees9 > udegrees5 + (udegrees6 - udegrees5) / - (udegrees1 - udegrees2) * - (udegrees1 - udegrees10) && - udegrees9 < udegrees8 + (udegrees7 - udegrees8) / - (udegrees4 - udegrees3) * - (udegrees4 - udegrees10) && - udegrees10 > udegrees2 + (udegrees3 - udegrees2) / - (udegrees7 - udegrees6) * - (udegrees9 - udegrees6)) - flag = udegrees10 < udegrees1 + (udegrees4 - udegrees1) / - (udegrees8 - udegrees5) * - (udegrees9 - udegrees5); - return flag; + return false; } inline void toFile(std::ofstream &out) const diff --git a/xplugin/main.cpp b/xplugin/main.cpp index 0cd7b3d..e36e450 100644 --- a/xplugin/main.cpp +++ b/xplugin/main.cpp @@ -283,6 +283,9 @@ void recordingWorker() germanairlinesva::file::recording::RecordingEntry lastPath; std::uint32_t segment = 0; + auto ap = (*database)["EDDF"]; + auto rwys = ap.second; + while (!wantsExit) { germanairlinesva::websocket::data copy; { @@ -300,6 +303,12 @@ void recordingWorker() if (strcmp(copy.path, "") != 0 && copy.pause && lastPath != currentPath) { p.addEntry(currentPath); lastPath = currentPath; + + for (const auto &it : rwys) { + if (it.containsPoint({copy.lat, copy.lon})) { + toLog("On Runway: " + it.to_string()); + } + } } segment++;