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

v.to.rast: Add points without segfault with densification flag (-d) #3440

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

HuidaeCho
Copy link
Member

This PR addresses #3105. It implements a new plot_point() function that uses the internal state in dense_line.c. Calling G_plot_point() with -d flag causes a segfault because the static state in libgis is not shared with any modules.

@HuidaeCho HuidaeCho self-assigned this Feb 20, 2024
@HuidaeCho HuidaeCho requested a review from marisn February 20, 2024 17:03
@HuidaeCho HuidaeCho force-pushed the v_to_rast_no_densification_for_point_type branch from 01b0516 to d868f5c Compare February 20, 2024 17:03
@HuidaeCho HuidaeCho added bug Something isn't working vector Related to vector data processing C Related code is in C labels Feb 20, 2024
@neteler neteler added this to the 8.4.0 milestone Feb 20, 2024
Comment on lines +278 to +280
/* point plotting, alternative to G_plot_point()
* x, y are col, row numbers */
void plot_point(double east, double north)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is an alternative, does that mean that if changes to the G_plot_point() are made, they may need to be kept in sync/compatible with the function here? If so, should we add a note in the comments of G_plot_point() to refer back here (to not forget in the future)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea.

@echoix echoix linked an issue Mar 11, 2024 that may be closed by this pull request
Comment on lines +284 to +285
x = ifloor(X(G_adjust_easting(east, &st->window)) + 0.5);
y = ifloor(Y(north) + 0.5);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why not to use G_plot_where_xy here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

st in G_plot_where_xy() is static and internal to libgis. dense_line.c has its own st.

@wenzeslaus wenzeslaus modified the milestones: 8.4.0, 8.4.1 Jun 10, 2024
@neteler neteler modified the milestones: 8.4.1, 8.5.0 Dec 25, 2024
@neteler neteler added the backport to 8.4 PR needs to be backported to release branch 8.4 label Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport to 8.4 PR needs to be backported to release branch 8.4 bug Something isn't working C Related code is in C module vector Related to vector data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v.to.rast segfault converting points
5 participants