-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
feat!: added PolylinePattern
with support for solid
, dotted
, dashed
styles
#1855
Conversation
Impacted files: * `pages/polyline.dart`: added a dashed polyline as example * `polyline_layer/polyline.dart`: added the `dashValues` field for `Polyline` * `painter.dart`: now handling the dashed polylines
Deprecated `Polyline.isDotted` Removed `Polyline.segmentSpacingFactor`
Hey, this looks great! Huge thanks for ticking this off the list.
Yes, I agree with this. I've added a
We generally try to avoid including these generic tools publicly, the major exception being the simplification tools. For now, I'm happy to keep this internal, and we can always make it public in future.
Yep, we should deal with this. I'm not quite sure the best way to do this, so if you have something in mind, please go ahead! |
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.
Thank you @JaffaKetchup for your improvements!
Oh it's already an internal method, and the point was to keep it that way.
The idea would be to say:
Now that I'm thinking, we could also have "smart dashes" polyline pattern, something like:
|
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.
@JaffaKetchup Looks good to me!
Still pending: what to do with the last point of a dashed line? I suggest a dot - would you like me to work on it? (I could start only this week-end).
And the "if solid / if dashed / if dotted" sequence is a bit clumsy but it's not very important - except that we have similar algorithms coded twice for dashed and dotted.
Not important suggestion: we could make a dot part of a dashed line, like Morse code (dash-space-dot-space-dash...)
@JaffaKetchup I've just fixed the side effect problem: /// The idea is that we need to be able to display the dash pattern completely
/// n times (at least once), plus once the initial dash segment. That's the
/// way we deal with the "ending" side-effect.
|
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.
LGTM, thanks! Not entirely sure what you did in that last bit, but it seems to have worked and looks nice.
Any other maintainers want to have a review?
PolylinePattern
with support for solid
, dotted
, dashed
styles
@JaffaKetchup As explained, there's a side-effect with dash pattern - as there is obviously with dotted pattern: if the dash pattern is 50+20 pixels, what do we do if the polyline length is 60 pixels? Just display the first 50 pixels and nothing else, so that the last point (presumably very important) is not displayed at all? |
Hey, thanks for continuing to work on this. Option one is unnacceptable (I agree), but I feel like option 2 and 3 are both valid. Additionally, rather than option 2, if there are enough dashes, we could do it so that it just dashes as normal, then truncates short the last dash (if it isn't a gap). Not sure how difficult this could be to implement. If you've got time, and it's not too complex, I guess allowing the user to pick between them all with some sort of For dotted lines, I guess only option 3 makes sense (scaling the factor), because otherwise it will look a bit strange? Again, The PR is breaking because it removes the |
@JaffaKetchup I've just introduced the new
|
Improved documentation
@monsieurtanuki I've run with those changes (thanks for those :)) with a couple more options, just so we can give users every option. It doesn't add too much complexity. Let me know what you think! |
@JaffaKetchup Thank you for your rewritings! My comments... I'm not convinced with I don't believe your
For
Working on it... |
@JaffaKetchup Latest push:
|
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.
LGTM! Huge thanks for your efforts :)
I'm not going to wait for another review, I'm pretty confident it's all good.
(Yep, that was a good catch. I hadn't properly considered the extension fit.)
Thank you @JaffaKetchup for your reviews and comments! |
Impacted files:
pages/polyline.dart
: added a dashed polyline as examplepolyline_layer/polyline.dart
: added thedashValues
field forPolyline
painter.dart
: now handling the dashed polylinesScreenshot (new dashed polyline between Paris and Nice):
What now?
isDotted
/segmentSpacingFactor
/dashValues
fields is a bit clumsy=> we would be better off with a unique field
=> new class
PolylineStyle
with "plain", "dotted(space)", "dashed(dashvalues)"?getDistanceOffset
used for "dashed style" (something like: give me the offset of the point on this [A,B] segment distant from A by n pixels)