From 01e44bf7b80598a8318ae286fcf10b5b2dd0737d Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Thu, 23 Mar 2017 15:08:39 +0100 Subject: [PATCH] Add YASim tag reporting --- utils/xmlgrep/metadata.c | 195 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) diff --git a/utils/xmlgrep/metadata.c b/utils/xmlgrep/metadata.c index 0d8f305c9..443e5c379 100644 --- a/utils/xmlgrep/metadata.c +++ b/utils/xmlgrep/metadata.c @@ -299,6 +299,195 @@ update_metadata_jsb(char *path, char *aero) /* -- Yasim ----------------------------------------------------------------- */ +const char* +yasim_wing_tag(void *xid) +{ + void *xwid = xmlNodeGet(xid, "airplane/wing"); + void *xcid = xmlNodeGet(xid, "airplane/cockpit"); + double wing_z = 0.0; + double eye_z = 0.0; + + if (xwid) + { + wing_z = xmlAttributeGetDouble(xwid, "z"); + xmlFree(xwid); + } + + if (xcid) + { + eye_z = xmlAttributeGetDouble(xcid, "z"); + xmlFree(xcid); + } + + if (wing_z > eye_z) return "high-wing"; + else return "low-wing"; +} + +const char* +yasim_gear_tag(void *xid) +{ + void *xaid = xmlNodeGet(xid, "airplane"); + void *xgid = xmlMarkId(xaid); + double nose_x = 0.0; + double main_x = 0.0; + int gears = 0; + int i, num; + + num = xmlNodeGetNum(xaid, "gear"); + for (i=0; i nose_x) return "tail-dragger"; + return "tricycle"; +} + +const char* +yasim_gear_retract_tag(void *xid) +{ + void *xaid = xmlNodeGet(xid, "airplane"); + void *xgid = xmlMarkId(xaid); + char *rv = "fixed-gear"; + int found = 0; + int i, num; + + num = xmlNodeGetNum(xaid, "gear"); + for (i=0; i\n"); printf(" %s\n", strlwr(aero)); + printf(" %s\n", yasim_wing_tag(xid)); + printf(" %s\n", yasim_gear_tag(xid)); + printf(" %s\n", yasim_gear_retract_tag(xid)); + printf(" %s\n", yasim_gear_steering_tag(xid)); + printf(" %s\n", yasim_engines_tag(xid)); + printf(" %s\n", yasim_engine_tag(xid, path)); printf(" \n");