-
-
Notifications
You must be signed in to change notification settings - Fork 860
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2fdccb4
commit 9e07d1f
Showing
5 changed files
with
96 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
part of 'polygon_layer.dart'; | ||
|
||
@immutable | ||
class _ProjectedPolygon { | ||
final Polygon polygon; | ||
final List<DoublePoint> points; | ||
final List<List<DoublePoint>>? holePoints; | ||
|
||
const _ProjectedPolygon._({ | ||
required this.polygon, | ||
required this.points, | ||
this.holePoints, | ||
}); | ||
|
||
_ProjectedPolygon.fromPolygon(Projection projection, Polygon polygon) | ||
: this._( | ||
polygon: polygon, | ||
points: List<DoublePoint>.generate( | ||
polygon.points.length, | ||
(j) { | ||
final (x, y) = projection.projectXY(polygon.points[j]); | ||
return DoublePoint(x, y); | ||
}, | ||
growable: false, | ||
), | ||
holePoints: () { | ||
final holes = polygon.holePointsList; | ||
if (holes == null) return null; | ||
|
||
return List<List<DoublePoint>>.generate( | ||
holes.length, | ||
(j) { | ||
final points = holes[j]; | ||
return List<DoublePoint>.generate( | ||
points.length, | ||
(k) { | ||
final (x, y) = projection.projectXY(points[k]); | ||
return DoublePoint(x, y); | ||
}, | ||
growable: false, | ||
); | ||
}, | ||
growable: false, | ||
); | ||
}(), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters