#include "input.hxx"
+#include <Scenery/scenery.hxx>
+#include <Main/renderer.hxx>
+#include <plib/ssg.h>
+#include <simgear/math/sg_geodesy.hxx>
+
SG_USING_STD(ifstream);
SG_USING_STD(string);
SG_USING_STD(vector);
return;
else if (fgHandle3DPanelMouseEvent(b, updown, x, y))
return;
+ else {
+ // pui and the panel didn't want the click event so compute a
+ // terrain intersection point corresponding to the mouse click
+ // and be happy. This should eventually get written into a set
+ // of properties so that some other [future] subsystems can do
+ // something useful with the information.
+ FGScenery* scenery = globals->get_scenery();
+ sgdVec3 start, dir, hit;
+ if (FGRenderer::getPickInfo(start, dir, x, y) &&
+ scenery->get_cart_ground_intersection(start, dir, hit)) {
+
+ Point3D geod = sgCartToGeod(Point3D(hit[0], hit[1], hit[2]));
+
+ std::cout << "lon = " << geod.lon()*SGD_RADIANS_TO_DEGREES
+ << " deg, lat = " << geod.lat()*SGD_RADIANS_TO_DEGREES
+ << " deg, elev = " << geod.elev()
+ << " m" << std::endl;
+ } else {
+ std::cout << "Cannot find intersection point" << std::endl;
+ }
+ }
}
// OK, PUI and the panel didn't want the click