-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save the GMT->common.R structure in a new GMT->hidden.common_R so that it can be accessed by externals #4618
Conversation
…t it can be accessed by externals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the return &R of a local structure declared inside a function. Don't you either need to pass in a pointer to a valid structure or allocate and return the pointer to one?
…R (void *V_API, struct COMMON_R *R)'
I see your point but it actually worked pretty well with the |
OK, and just so I understand why you want this: You want to implement the auto-J in Julia even though we will do exactly the same in GMT C? Would it not be better to help getting that implementation done? |
This is not for auto-J in the sense that Kristof asked. It's for not needing -J at all and let it guess from coords only. Also, if implemented in Julia it will available to all GMT >= 6.0 versions and not only future 6.2 |
... unless you were willing to make -J optional at times. Seems too drastic as a new feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will approve this to not be a roadblock for you. However, I do have serious concerns:
- Adding these tricks adds more places where we have to be careful with changes as it can break Julia. Not a good design.
- The excuse that you can implement something in Julia now (so it works with GMT 6.0) instead of strengthening GMT core so it works for all (GMT plus all externals) is weak and will just lead to repeated work down the road.
- This is using the Julia wrapper to make changes Julia-specific in GMT core rather than considering generic solutions across all wrappers. We should look for changes in GMT that benefit all externals. Your impatience with getting this to work in Julia today severely breaks that idea.
- We already have GMT_Get_Common which can give you w/e/s/n and that is a cross-all function anyone can use.
-J is already optional; it is just that we only have two default choices: -JX or -JQ regardless of -R. |
There is nothing Julia specific in this PR. Only a way store and allow inquiring last w/e/s/n which is cleared from the lib memory at the end of a module run (in If
because if consulted after a module finish the
|
I see. Well, the full -R has lots of loose parts; would you be OK with just betting w/e/s/n via GMT_Get_Common instead? We would place that in the API struct and have GMT_Get_Common return those values. |
Yes, wesn and perhaps inc would be the only important pieces. But this made me realize that probably many things in
|
Yes, that seems true - not tested much of course. OK, I can imagine a fix to this where we keep a snapshot of the whole common args and report from that instead. |
In middle of testing another branch but I can implement a fix for the GMT_Get_Common soon. |
Closing as addressed by #4621 |
In order to be able to guess a reasonable projection from the map limits it is necessary to know, for example, what -RDE has turned to in terms of lon/lat. Currently I use the trick of asking
gmt2kml
the boundingbox only and then parse the output kml. But this is cumbersome and slow.This PR adds a new struct,
GMT->common.R
toGMT->hidden
and a new functionvoid *gmtlib_get_common_R (void *V_API)
that allows easy access to the R settings from Julia. Possibly a similar solution forcommon.J
would be interesting too but I have not yet add a need for it.