poly
指定された点が多角形内にあるかどうかを確認するためのライブラリです。
指定された点が多角形内にあるかどうかを確認するためのDartライブラリです。
^4.0.3^1.14.11^1.0.0^1.0.0以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
A library for checking if given point(s) is present inside Polygon or not.
toListNum() & toListListNum()To install poly for your Dart project, simply add poly to your pub dependencies.
dependencies:
poly^ 1.0.5
List<Point>Polygon have same vertices i.e. points : using hasSamePoint()hasSamePoint(), isPointInside(Point( )), contains(x,y), areAllPointsInsidePolygon_ListPoint() & getList_IsListOfPointInside() are used.List <=> Point, List<Point> <=> List<List> & othertoPoint() & pointToList()
toPoint() converts List<num> to Point<num>pointToList() converts Point<num> to List<num>toListOfPoint() & pointsToList()
toListOfPoint() converts List<List<num>> to List<Point<num>>pointsToList() converts List<Point<num>> to List<List<num>>toPolyFromListOfList() & listOfList()
toPolyFromListOfList() converts List<List<num>> to PolygonlistOfList() returns Polygon.points as List<List<num>>toPolyFromListOfList() gives Polygon & backToListC2() gives back List<List>getList_IsListOfListInsideList<dynamic> => List<num> and List<List<dynamic>> => List<List<num>>toListNum() returns List<num> from a List<dynamic>toListListNum() returns List<List<num>> from a List<List<dynamic>>toListNum()
replaceWithZero: true and sizeTwo: falsesizeTwo: falsetoListListNum()
swapXAndY: truereplaceWithZero: truereplaceWithZero: true and swapXAndY: trueExample of IsInsideResultWithXY_ToCSVString
ArePointsInside Results to "IsInside.csv"
includeHeader isnt passed as false`diffNameThanIsInside:"Example String" is passed,latitude,longitude,Example StringExample of toCSVString
Polygon.points to "Polygon.csv"
includeHeader isnt passed as false`useXY is passed as truex,yExample of csvToResult
xY_IsInside_ToCSVString returned String with headerheader was not set to falseExample of csvToPoly
NeedsAtLeastThreePoints is thrown if Polygon.points contains less than 3 pointsWrongSizeForPoint is thrown if toPoint() has more or less than 2 element. Point has only x and y.TypeError is thrown if List<dynamic> is passed instead of List<num>
List<dynamic> to List<num> print(toPoint([1,2]));
List<dynamic>[1,2].cast<num>()CastError example - wrongly casting List<num> to List<List<num>List<dynamic> to List<num> TypeErroris thrownCorrect casting
List<dynamic> to List<num>List<dynamic> to List<List<num>>Passing List instead of List<List>
List instead of List<List> & casting it : throws CastError as shown below :
type
intis not a subtype of typeList<num>in type cast
List instead of List<List> but, without casting it : throws TypeError as shown below :
type
List<dynamic>is not a subtype of typeList<List<num>>
List<List<dynamic>> to List<List<num>> gives following CastError exception:
as List<List<num>> -type
List<dynamic>is not a subtype of typeList<num>in type cast
as List<List<num>> -type
List<List<dynamic>>is not a subtype of typeList<List<num>>in type cast
toListNum() & toListListNum()toListNum() for List<dynamic> => List<num>toListListNum() forList<List<dynamic>> => List<List<num>>List<num> to Point(x,y) : use toPoint()[x,y] -> Point(x,y)List<num> toPoint().WrongSizeForPoint exceptionPoint(x,y) to List<num> : use pointToList()Point(x,y) -> [x,y]Point(x,y) pointToList().List<List<num>> to List<Point<num>> : use toListOfPoint()[ [x1,y1],[x2,y2],... ] -> [ Point(x1,y1), Point(x2,y2),... ]List<List<num>> by passing it to toListOfPoint()List<Point<num>> to List<List<num>> : use pointsToList()[ Point(x1,y1), Point(x2,y2),... ] -> [ [x1,y1],[x2,y2],... ]List<Point<num>> pointsToList().List<List<num>> to Polygon : use toPolyFromListOfList()[ [x1,y1],[x2,y2],... ] -> Polygon( Point(x1,y1), Point(x2,y2),... )List<List<num>> by passing it to toPolyFromListOfList()List<List<num>> to Polygon : use listOfList()[ [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()List<num> from a List<dynamic>List<num>sizeTwo
truefalse, Output List can have more than 2 elementsreplaceWithZero
falsetrue, elements with type String or bool will be replaced with 0, rather than being removedreverseIt
falsetrue, List will be reversedList<List<dynamic>> to List<List<num>> : use toListListNum()List<List<num>> from a List<List<dynamic>>List<List<num>>replaceWithZero
falsetrue, elements with type String or bool will be replaced with 0, rather than being removedswapXAndY
falsetrue, xi will be swapped with yi
[ [x1,y1], [x2,y2], ...] -> [ [y1,x1], [y2,x2], ...]Point is insidex and y to containstrue if (x,y) is present inside PolygonPoint(x,y) to isPointInsidetrue if Point is present inside PolygonPoint is inside Polygon with tolerance of T meterPoint(x,y) and Tolerance T to isPointInsidegetList_IsListOfListInside(List<List<num>>) returns List<bool>getList_IsListOfPointInside(List<Point<num>>) returns List<bool>areAllPointsInsidePolygon_List((List<List<num>>) returns true or falseareAllPointsInsidePolygon_ListPoint(List<Point<num>>) returns true or falsePolygon have same vertices i.e. pointshasSamePoints()Get result(s) along with lat, lang as a CSV String : IsInsideResultWithXY_ToCSVString()ArePointsInside as CSV String which can be later saved or displayedlatitude,longitude,isInsidebool useXY
useXY as true, header will be x,y instead of latitude,longitudeuseXY is falseString includeHeader
includeHeader is passed as false, returning String will not contain header rowString diffNameThanIsInside
isInside) will be used by passing optional parameter: diffNameThanIsInsideGet Polygon as CSV String : toCSVString()Polygon as CSV String which can be later saved or displayedlatitude,longitudebool useXY
useXY as true, header will be x,y instead of latitude,longitudeuseXY is falseString includeHeader
includeHeader is is passed as false, returning String will not contain header rowGet Futurebased oncsvString : csvToPoly()Future<Polygon> based on csvStringcsvString may or may not contain header rowlatitude,longitude or x,y are reversed
Polygon will be Polygon(latitude,longitude), instead of Polygon(longitude,latitude)isReversed as trueisReversed
isReversed has default value = falsecsvToListOfList()Future<List<List>> based on csvString
Polygonbool noHeader
noHeader as true, Resulting List will not contain header rowfalseNeedsAtLeastThreePoints is thrown if Polygon.points contains less than 3 pointsWrongSizeForPoint is thrown if toPoint() has more or less than 2 element. Point has only x and y._TypeError is thrown if List<dynamic> is passed instead of List<num>
List<dynamic> to List<num> print(toPoint([1,2]));
List<dynamic>[1,2].cast<num>()_CastError example - casting List<num> to List<List<num>Please file feature requests and bugs at the issue tracker.
Implemented contains function logic from StageXL - A fast and universal 2D rendering engine for HTML5 and Dart
As, StageXL imports dart:html, it can not be used in console application or in aqueduct back-end.
Also, function distanceInMeter is implemented by using formulas for Algorithm & it's NOAA online calculator
Created from templates made available by Stagehand under a BSD-style license.