Skip to content
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

Use point in map APIs #33308

Merged
merged 14 commits into from
Aug 17, 2019
Merged

Use point in map APIs #33308

merged 14 commits into from
Aug 17, 2019

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: Infrastructure "2D API functions on map now take point objects rather than x, y coordinates"

Purpose of change

My ongoing campaign to make more use of point and tripoint for improved type safety and code clarity.

Describe the solution

Convert member functions of map, and the functions in drawing_primitives.h, to use point and tripoint rather than individual int coordinates.

I'm not sure I caught every relevant function in those places, but I changed most of them.

Perform associated refactoring around calls to and implementations of these functions.

This is a fairly massive change. But as usual most of these changes were automated, so hopefully the chance of introducing a bug is small.

I think map has the most of these types of functions (relative to other classes). Hopefully this refactoring effort gets easier from here...

Describe alternatives you've considered

We ultimately want to get rid of many of these functions entirely, I think, in favour of the 3D overloads taking tripoints. But I think it makes sense to use this as a step in that direction, rather than avoiding it because we want to make a different change in the long term.

For example, after these changes, many of the calls to these functions can be switched to the 3D overloads simply by removing .xy() (whether it would be correct to do so is an entirely different question, of course).

Additional context

In support of #32017.

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Aug 17, 2019
@jbytheway jbytheway changed the title Point in map Use point in map APIs Aug 17, 2019
@ZhilkinSerg ZhilkinSerg merged commit cb3e2db into CleverRaven:master Aug 17, 2019
@jbytheway jbytheway deleted the point_in_map branch August 17, 2019 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants