Aus öffentlichen Paketdaten erstellte Orientierung.
Poly ist eine Dart-Bibliothek, die dazu dient festzustellen, ob ein oder mehrere Punkte innerhalb eines Polygons liegen. Sie bietet effiziente geometrische Berechnungen für Punkt-in-Polygon-Tests, die nützlich sind bei der räumlichen Datenanalyse, Kartenanwendungen und interaktiven Grafiken. Die Bibliothek unterstützt sowohl einfache als auch komplexe Polygone, einschließlich solcher mit Löchern. Sie ist leichtgewichtig, einfach über den Flutter-Paketmanager zu integrieren und ideal für Anwendungen, die Echtzeit-Geodatenabfragen erfordern. Der Quellcode ist öffentlich auf GitHub verfügbar, um Transparenz und Anpassungsmöglichkeiten zu gewährleisten.
Anwendungsfälle
Geospatial-Anwendungen
Interaktive Kartenfunktionen
Spieldesign
Kollisionsdetektion
Datenvisualisierung
Hauptmerkmale
Punkt-in-Polygon-Test
Unterstützung für komplexe Polygone
Leicht und schnell
Einfache Integration mit Flutter
Open Source auf GitHub
Geeignet für
Flutter-Entwickler, die mit Karten arbeiten
Anwendungen, die räumliche Logik erfordern
Spiele mit Treffererkennung
Werkzeuge für die Geodatenverarbeitung
Hinweise
Unterstützt keine 3D-Polygone
Keine integrierten Polygonerstellungswerkzeuge
Beschränkt auf zweidimensionale Ebene Geometrie
Benötigt manuelle Polygondefinition
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
poly
A library for checking if given point(s) is present inside Polygon or not.
type List<dynamic> is not a subtype of type List<num> in type cast
with as List<List<num>> -
type List<List<dynamic>> is not a subtype of type List<List<num>> in type cast
Note: Instead of casting, use toListNum() & toListListNum()
Use toListNum() for List<dynamic> => List<num>
Use toListListNum() forList<List<dynamic>> => List<List<num>>
Function List
Conversion Type
List<num> to Point(x,y) : use toPoint()
i.e. [x,y] -> Point(x,y)
Point can be created passing List<num>toPoint().
List must have exact 2 elements, else will throw WrongSizeForPoint exception
Point(x,y) to List<num> : use pointToList()
i.e. Point(x,y) -> [x,y]
List can be created passing Point(x,y)pointToList().
List<List<num>> to List<Point<num>> : use toListOfPoint()
i.e. [ [x1,y1],[x2,y2],... ] -> [ Point(x1,y1), Point(x2,y2),... ]
List of Points can be created from List<List<num>> by passing it to toListOfPoint()
List<Point<num>> to List<List<num>> : use pointsToList()
i.e. [ Point(x1,y1), Point(x2,y2),... ] -> [ [x1,y1],[x2,y2],... ]
List can be created passing List<Point<num>>pointsToList().
List<List<num>> to Polygon : use toPolyFromListOfList()
i.e. [ [x1,y1],[x2,y2],... ] -> Polygon( Point(x1,y1), Point(x2,y2),... )
Polygon can be returned from List<List<num>> by passing it to toPolyFromListOfList()
List<List<num>> to Polygon : use listOfList()
i.e. [ [x1,y1],[x2,y2],... ] from Polygon( Point(x1,y1), Point(x2,y2),... )
List<List<num>> can be returned from Polygon by passing it to listOfList()
List<dynamic> to List<num> : use toListNum()
Returns List<num> from a List<dynamic>
Can be used with [toPoly] as it accepts List<num>
Optional Parameters -
sizeTwo
Default value true
When set false, Output List can have more than 2 elements
replaceWithZero
Default value false
When set true, elements with type String or bool will be replaced with 0, rather than being removed
reverseIt
Default value false
When set true, List will be reversed
List<List<dynamic>> to List<List<num>> : use toListListNum()
Returns List<List<num>> from a List<List<dynamic>>
Can be used with functions like [areAllPointsInsidePolygon_List] , [getList_IsListOfListInside] , [toPolyFromListOfList] , [toListOfPoint] which accepts List<List<num>>
Optional Parameters -
replaceWithZero
Default value false
When set true, elements with type String or bool will be replaced with 0, rather than being removed
swapXAndY
Default value false
When set true, xi will be swapped with yi
i.e. [ [x1,y1], [x2,y2], ...] -> [ [y1,x1], [y2,x2], ...]
is Point(s) inside
Check if Single Point is inside
Get Status by passing x and y to contains
returns true if (x,y) is present inside Polygon
Get Status by passing Point(x,y) to isPointInside
returns true if Point is present inside Polygon
Check if Single Point is inside Polygon with tolerance of T meter
Get Status by passing Point(x,y) and Tolerance T to isPointInside