-
-
Notifications
You must be signed in to change notification settings - Fork 871
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!: support of solid, dotted, dashed styles for polygons, with optimized rendering #1865
Conversation
…imized rendering New files: * `pixel_hiker.dart`: Pixel hikers that list the visible items on the way. Code used to be in `polyline_layer/painter.dart`, but was heavily refactored with fleaflet#1854 in mind * `visible_segment.dart`: Cohen-Sutherland algorithm to clip segments as visible into a canvas. Code used to be in `polygon_layer/painter.dart`, and was lightly refactored. Impacted files: * `polygon_layer/painter.dart`: now using new file `pixel_hiker.dart` for optimized rendering; moved "clip code" to new file `visible_segment.dart`; minor refactoring about parameter order consistency * `polyline_layer/painter.dart`: now using new file `pixel_hiker.dart` for optimized rendering; moved "pixel hiker" to new file `pixel_hiker.dart` * `pages/polygon.dart`: replaced `bool isDotted` with `PolylinePattern pattern` and in one case replaced it with "dashed" * `polygon_layer/polygon.dart`: BREAKING - replaced `bool isDotted` with `PolylinePattern pattern` * `polygon_layer/polygon_layer.dart`: minor refactoring * `polyline_layer/polyline_layer.dart`: minor refactoring
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.
Untested, going to make some minor file organisation changes, but just just this one comment to consider for now.
This is looking amazing though, and the new painter code is so much simpler!
Re-organised file structure
@JaffaKetchup Thank you! The complexity of the dots or dash patterns multiplied by the "visible?" question asked for those changes. |
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 I'm fine with all your code organization improvements.
Co-authored-by: monsieurtanuki <[email protected]>
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.
Thanks for the pull request @monsieurtanuki. I did a quick test on web with chrome and didn't experience any problems, nice work!
The directory /src/layer/general
makes sense to me, but could we have it's name be in line with /src/misc
by renaming one of these folders please?
Co-authored-by: Joscha <[email protected]>
Co-authored-by: Joscha <[email protected]>
Co-authored-by: Joscha <[email protected]>
@JaffaKetchup I have no strong opinion on the subject and I'm notoriously neither regarding nor imaginative when it comes to folder and file names, so feel free to move files to a more appropriate folder. |
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.
Looks good to me. @JaffaKetchup I assume you want to test the changes yourself before we merge?
Bit short on time, so if you're happy, that sounds good to me! |
What
DottedPixelHiker
that returns the visible dots (and only them)DashedPixelHiker
that returns the visible segments (and only them)Polygon
s #1854Screenshot
Files
New files:
pixel_hiker.dart
: Pixel hikers that list the visible items on the way. Code used to be inpolyline_layer/painter.dart
, but was heavily refactored with fix: prevent crash when zooming far intoPolygon
s #1854 in mindvisible_segment.dart
: Cohen-Sutherland algorithm to clip segments as visible into a canvas. Code used to be inpolygon_layer/painter.dart
, and was lightly refactored.Impacted files:
polygon_layer/painter.dart
: now using new filepixel_hiker.dart
for optimized rendering; moved "clip code" to new filevisible_segment.dart
; minor refactoring about parameter order consistencypolyline_layer/painter.dart
: now using new filepixel_hiker.dart
for optimized rendering; moved "pixel hiker" to new filepixel_hiker.dart
pages/polygon.dart
: replacedbool isDotted
withPolylinePattern pattern
and in one case replaced it with "dashed"polygon_layer/polygon.dart
: BREAKING - replacedbool isDotted
withPolylinePattern pattern
polygon_layer/polygon_layer.dart
: minor refactoringpolyline_layer/polyline_layer.dart
: minor refactoring