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

svg output point-symbol=line and -style rotate= #300

Open
wants to merge 576 commits into
base: master
Choose a base branch
from

Conversation

cedricsam
Copy link
Contributor

  • added support for drawing a line as a point-symbol= on svg output
  • added support to rotate a point symbol using data
    • could clash with desired software design, by adding an attribute on the point feature called rotate=... I did it that way, because I wanted to be able to use expressions and layer data to provide an arbitrary rotation based on data. The immediate desire was to let people use an r= that remains a radius, which has to be positive and generally the Math.sqrt() of a numeric value we want to represent.
  • the line starts at the feature's specified point, and goes in the direction of the rotation
  • refactored the square point-symbol
    • now a polygon instead of a rect, so that it can be rotated without having to use transform() and much weirdness in the maths (since the origin isn't the point itself, but the whole svg).
    • instead, we use Math.cos() and Math.sin() to translate the coordinates of the four vertices
    • the square is actually "standing up" and we apply a 45-degree rotation by default to make the square with its side perpendicular and parallel with the canvas'.
  • tried outputting a test SVG using U.S. counties and some data in the MY_DATA_FIELD column:
    • test -style command is: -style r='Math.sqrt(Math.abs(MY_DATA_FIELD))' rotate='MY_DATA_FIELD >= 0 ? -90 : 90' stroke='COLOR' opacity='.5' fill='none' target=POINTS_LAYER
    • try with point-symbol=line in the -output command
    • in Illustrator, I was able to select lines and apply an a arrow style (the right side arrow in the Illustrator stroke dialog was applied on the side of the x2, y2 point, so pointing away from the point's center)
  • there was a previous iteration of this that worked where I had point-symbol-rotate= (and a numeric degree value as argument) in -output, but I couldn't find how to evaluate expressions...

@cedricsam
Copy link
Contributor Author

Was resubmitted to branch out from 0.4.105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants