Runway Contains
Logbook Flags
This commit is contained in:
parent
e677a345e0
commit
f344ffb727
@ -20,32 +20,32 @@ namespace file
|
|||||||
* ---------+---------------+----------+-------------
|
* ---------+---------------+----------+-------------
|
||||||
* DATE | FLIGHT NUMBER | AIRCRAFT | REGISTRATION
|
* DATE | FLIGHT NUMBER | AIRCRAFT | REGISTRATION
|
||||||
|
|
||||||
* Departure Airport Name (2...256)
|
* Departure Airport Name (1...257)
|
||||||
* UINT8 | CHAR[]
|
* UINT8 | CHAR[]
|
||||||
* -------+-------
|
* -------+-------
|
||||||
* STRLEN | STRING
|
* STRLEN | STRING
|
||||||
|
|
||||||
* Departure Gate Name (2...256)
|
* Departure Gate Name (1...257)
|
||||||
* UINT8 | CHAR[]
|
* UINT8 | CHAR[]
|
||||||
* -------+-------
|
* -------+-------
|
||||||
* STRLEN | STRING
|
* STRLEN | STRING
|
||||||
|
|
||||||
* Departure Runway Name (2...256)
|
* Departure Runway Name (1...257)
|
||||||
* UINT8 | CHAR[]
|
* UINT8 | CHAR[]
|
||||||
* -------+-------
|
* -------+-------
|
||||||
* STRLEN | STRING
|
* STRLEN | STRING
|
||||||
|
|
||||||
* Arrival Airport Name (2...256)
|
* Arrival Airport Name (1...257)
|
||||||
* UINT8 | CHAR[]
|
* UINT8 | CHAR[]
|
||||||
* -------+-------
|
* -------+-------
|
||||||
* STRLEN | STRING
|
* STRLEN | STRING
|
||||||
|
|
||||||
* Arrival Gate Name (2...256)
|
* Arrival Gate Name (1...257)
|
||||||
* UINT8 | CHAR[]
|
* UINT8 | CHAR[]
|
||||||
* -------+-------
|
* -------+-------
|
||||||
* STRLEN | STRING
|
* STRLEN | STRING
|
||||||
|
|
||||||
* Arrival Runway Name (2...256)
|
* Arrival Runway Name (1...257)
|
||||||
* UINT8 | CHAR[]
|
* UINT8 | CHAR[]
|
||||||
* -------+-------
|
* -------+-------
|
||||||
* STRLEN | STRING
|
* STRLEN | STRING
|
||||||
@ -70,7 +70,7 @@ namespace file
|
|||||||
* ---------+---------- +------------
|
* ---------+---------- +------------
|
||||||
* MAX RATE | TOUCHDOWNS | MAX G-FORCE
|
* MAX RATE | TOUCHDOWNS | MAX G-FORCE
|
||||||
|
|
||||||
* Recording Filename (2...256)
|
* Recording Filename (1...257)
|
||||||
* UINT8 | CHAR[]
|
* UINT8 | CHAR[]
|
||||||
* -------+-------
|
* -------+-------
|
||||||
* STRLEN | STRING
|
* STRLEN | STRING
|
||||||
@ -81,9 +81,9 @@ namespace file
|
|||||||
* POINTS | FLAGS
|
* POINTS | FLAGS
|
||||||
|
|
||||||
* Flags Bitfield
|
* Flags Bitfield
|
||||||
* 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
|
* 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
|
||||||
* ----+-----+-----+-----+-----+-----+-----+------
|
* ----+-----+-----+-----+------+------+--------+------
|
||||||
* NIL | NIL | NIL | NIL | NIL | NIL | NIL | FILED
|
* NIL | NIL | NIL | NIL | SYNC | IVAO | VATSIM | FILED
|
||||||
*/
|
*/
|
||||||
class LogbookEntry
|
class LogbookEntry
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "geodata.hpp"
|
#include "geodata.hpp"
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
@ -73,7 +74,37 @@ namespace file
|
|||||||
|
|
||||||
inline bool containsPoint(const geodata::point point) const
|
inline bool containsPoint(const geodata::point point) const
|
||||||
{
|
{
|
||||||
return false;
|
size_t j = 3;
|
||||||
|
bool c = false;
|
||||||
|
std::vector<geodata::point> poly{this->bounds.topLeft,
|
||||||
|
this->bounds.topRight,
|
||||||
|
this->bounds.bottomRight,
|
||||||
|
this->bounds.bottomLeft};
|
||||||
|
|
||||||
|
for (size_t i = 0; i < poly.size(); i++) {
|
||||||
|
if ((point.latitude == poly[i].latitude) &&
|
||||||
|
(point.longitude == poly[i].longitude)) {
|
||||||
|
// point is a corner
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (((poly[i].longitude > point.longitude) !=
|
||||||
|
(poly[j].longitude > point.longitude))) {
|
||||||
|
double slope = (point.latitude - poly[i].latitude) *
|
||||||
|
(poly[j].longitude - poly[i].longitude) -
|
||||||
|
(poly[j].latitude - poly[i].latitude) *
|
||||||
|
(point.longitude - poly[i].longitude);
|
||||||
|
if (slope == 0) {
|
||||||
|
// point is on boundary
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ((slope < 0) != (poly[j].longitude < poly[i].longitude)) {
|
||||||
|
c = !c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
j = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void toFile(std::ofstream &out) const
|
inline void toFile(std::ofstream &out) const
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user