Comments on: X-Plane 11 Map API Sample https:/code-sample/x-plane-11-map/ Developer resources for the X-Plane flight simulator Thu, 08 Oct 2020 14:01:32 +0000 hourly 1 https://wordpress.org/?v=6.6.1 By: Octavius https:/code-sample/x-plane-11-map/#comment-38985 Thu, 08 Oct 2020 14:01:32 +0000 http://developer.x-plane.com/?post_type=code-sample&p=7748#comment-38985 Hello, I´d like to draw a polygonum lines (rectangle) to delaminate certain area. This rectangle must not be solid, i.e. just the lines of its border must be shown. I have no previous experience in doing this, is it possible? If so, could you please give some hints and examples of how to perform this? Much appreciate! Thanks

]]>
By: Peter Buckner https:/code-sample/x-plane-11-map/#comment-36888 Tue, 12 May 2020 16:54:53 +0000 http://developer.x-plane.com/?post_type=code-sample&p=7748#comment-36888 In reply to Tyler Young.

11.41 also, for what it’s worth.

]]>
By: Tyler Young https:/code-sample/x-plane-11-map/#comment-36887 Tue, 12 May 2020 16:33:56 +0000 http://developer.x-plane.com/?post_type=code-sample&p=7748#comment-36887 In reply to Peter Buckner.

Uh… yikes, I see the issue. Filing a bug for 11.50.

]]>
By: Peter Buckner https:/code-sample/x-plane-11-map/#comment-36885 Tue, 12 May 2020 15:54:46 +0000 http://developer.x-plane.com/?post_type=code-sample&p=7748#comment-36885 will_be_deleted() doesn’t appear to make sense:

Ignoring all the actual drawing and focusing on just the create/prep/delete callbacks:
You’ll get
1) createOurMapLayer(), when map is first opened (or, if already opened)
2) immediate call to prep_cache()

Move aircraft on map such that map loads new scenery and you’ll get
3) another call to prep_cache() — makes sense, there are new bounds
4) call to will_be_deleted() — huh?

Continue to move aircraft and you’ll get more prep_cache() followed by will_be_deleted().

The layer provided on every call is the same, so it’s not like you’re deleting one layer to create another layer.

In the example code, will_be_deleted() simple sets global g_layer to null, but since that’s not actually used or referenced for drawing, it doesn’t really accomplish much.

Documentation says “Optional callback to inform you this layer is being deleted (due to its owning map being destroyed).” But the map isn’t being destroyed when the aircraft is merely moved (if it were, then we should be seeing another Create).

]]>
By: Matthew Carlson https:/code-sample/x-plane-11-map/#comment-34533 Thu, 21 Nov 2019 02:32:48 +0000 http://developer.x-plane.com/?post_type=code-sample&p=7748#comment-34533 Hello,

Is there a way to draw the map in an EFIS panel, and customize the terrain colors?

Thanks

]]>
By: Tyler Young https:/code-sample/x-plane-11-map/#comment-32987 Wed, 30 Jan 2019 16:17:21 +0000 http://developer.x-plane.com/?post_type=code-sample&p=7748#comment-32987 In reply to Peter.

Um… I’m not an OpenGL expert, but I don’t know that it’s possible to create something like an OpenGL projection to replace mapping the coordinates, just because cartographic projections are “weird.”

I’d write a wrapper function to do the projection into map coordinates once, then use it everywhere.

]]>
By: Peter https:/code-sample/x-plane-11-map/#comment-32986 Wed, 30 Jan 2019 10:25:29 +0000 http://developer.x-plane.com/?post_type=code-sample&p=7748#comment-32986 In reply to Tyler Young.

Thanks. I was afraid of that 🙂

I have a number of objects I want to put on the map, but they only have local coordinates. It seems like a lot of extra processing to convert them to lon/lat format first, and then one more time to map coordinates.

Would a direct projection function be a possibility in the future?

]]>
By: Tyler Young https:/code-sample/x-plane-11-map/#comment-32973 Mon, 28 Jan 2019 20:42:36 +0000 http://developer.x-plane.com/?post_type=code-sample&p=7748#comment-32973 In reply to Peter.

XPLMLocalToWorld() in the XPLMGraphics header converts from OpenGL coordinates to latitude, longitude, and elevation in meters MSL which you can then pass into the map projection function (XPLMMapProject()).

]]>
By: Peter https:/code-sample/x-plane-11-map/#comment-32945 Sat, 26 Jan 2019 10:19:38 +0000 http://developer.x-plane.com/?post_type=code-sample&p=7748#comment-32945 What if we want to draw objects which only have local OpenGL coordinates? How do we project those to Map coordinates?

]]>
By: Tyler Young https:/code-sample/x-plane-11-map/#comment-27827 Tue, 10 Apr 2018 11:48:41 +0000 http://developer.x-plane.com/?post_type=code-sample&p=7748#comment-27827 In reply to ikz.

There is not. At present, we only support drawing fixed map layers.

]]>