本文整理汇总了TypeScript中@turf/boolean-point-on-line.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: booleanContains
/**
* Boolean-contains returns True if the second geometry is completely contained by the first geometry.
* The interiors of both geometries must intersect and, the interior and boundary of the secondary (geometry b)
* must not intersect the exterior of the primary (geometry a).
* Boolean-contains returns the exact opposite result of the `@turf/boolean-within`.
*
* @name booleanContains
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
* @returns {boolean} true/false
* @example
* var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
* var point = turf.point([1, 2]);
*
* turf.booleanContains(line, point);
* //=true
*/
export default function booleanContains(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry) {
const geom1 = getGeom(feature1);
const geom2 = getGeom(feature2);
const type1 = getType(feature1);
const type2 = getType(feature2);
const coords1 = getCoords(feature1);
const coords2 = getCoords(feature2);
switch (type1) {
case 'Point':
switch (type2) {
case 'Point':
return compareCoords(coords1, coords2);
default:
throw new Error('feature2 ' + type2 + ' geometry not supported');
}
case 'MultiPoint':
switch (type2) {
case 'Point':
return isPointInMultiPoint(geom1, geom2);
case 'MultiPoint':
return isMultiPointInMultiPoint(geom1, geom2);
default:
throw new Error('feature2 ' + type2 + ' geometry not supported');
}
case 'LineString':
switch (type2) {
case 'Point':
return isPointOnLine(geom2, geom1, {ignoreEndVertices: true});
case 'LineString':
return isLineOnLine(geom1, geom2);
case 'MultiPoint':
return isMultiPointOnLine(geom1, geom2);
default:
throw new Error('feature2 ' + type2 + ' geometry not supported');
}
case 'Polygon':
switch (type2) {
case 'Point':
return booleanPointInPolygon(geom2, geom1, {ignoreBoundary: true});
case 'LineString':
return isLineInPoly(geom1, geom2);
case 'Polygon':
return isPolyInPoly(geom1, geom2);
case 'MultiPoint':
return isMultiPointInPoly(geom1, geom2);
default:
throw new Error('feature2 ' + type2 + ' geometry not supported');
}
default:
throw new Error('feature1 ' + type1 + ' geometry not supported');
}
}
开发者ID:OlympicsORG,项目名称:turf,代码行数:70,代码来源:index.ts
示例2: booleanWithin
/**
* Boolean-within returns true if the first geometry is completely within the second geometry.
* The interiors of both geometries must intersect and, the interior and boundary of the primary (geometry a)
* must not intersect the exterior of the secondary (geometry b).
* Boolean-within returns the exact opposite result of the `@turf/boolean-contains`.
*
* @name booleanWithin
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
* @returns {boolean} true/false
* @example
* var line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
* var point = turf.point([1, 2]);
*
* turf.booleanWithin(point, line);
* //=true
*/
function booleanWithin(feature1: Feature<any> | Geometry, feature2: Feature<any> | Geometry): boolean {
var type1 = getType(feature1);
var type2 = getType(feature2);
var geom1 = getGeom(feature1);
var geom2 = getGeom(feature2);
switch (type1) {
case 'Point':
switch (type2) {
case 'MultiPoint':
return isPointInMultiPoint(geom1, geom2);
case 'LineString':
return booleanPointOnLine(geom1, geom2, {ignoreEndVertices: true});
case 'Polygon':
case 'MultiPolygon':
return booleanPointInPolygon(geom1, geom2, {ignoreBoundary: true});
default:
throw new Error('feature2 ' + type2 + ' geometry not supported');
}
case 'MultiPoint':
switch (type2) {
case 'MultiPoint':
return isMultiPointInMultiPoint(geom1, geom2);
case 'LineString':
return isMultiPointOnLine(geom1, geom2);
case 'Polygon':
case 'MultiPolygon':
return isMultiPointInPoly(geom1, geom2);
default:
throw new Error('feature2 ' + type2 + ' geometry not supported');
}
case 'LineString':
switch (type2) {
case 'LineString':
return isLineOnLine(geom1, geom2);
case 'Polygon':
case 'MultiPolygon':
return isLineInPoly(geom1, geom2);
default:
throw new Error('feature2 ' + type2 + ' geometry not supported');
}
case 'Polygon':
switch (type2) {
case 'Polygon':
case 'MultiPolygon':
return isPolyInPoly(geom1, geom2);
default:
throw new Error('feature2 ' + type2 + ' geometry not supported');
}
default:
throw new Error('feature1 ' + type1 + ' geometry not supported');
}
}
开发者ID:OlympicsORG,项目名称:turf,代码行数:70,代码来源:index.ts
示例3: featureEach
featureEach(tree.search(segment), function (match) {
if (doesOverlaps === false) {
var coordsSegment = getCoords(segment).sort();
var coordsMatch: any = getCoords(match).sort();
// Segment overlaps feature
if (equal(coordsSegment, coordsMatch)) {
doesOverlaps = true;
// Overlaps already exists - only append last coordinate of segment
if (overlapSegment) overlapSegment = concatSegment(overlapSegment, segment);
else overlapSegment = segment;
// Match segments which don't share nodes (Issue #901)
} else if (
(tolerance === 0) ?
booleanPointOnLine(coordsSegment[0], match) && booleanPointOnLine(coordsSegment[1], match) :
nearestPointOnLine(match, coordsSegment[0]).properties.dist <= tolerance &&
nearestPointOnLine(match, coordsSegment[1]).properties.dist <= tolerance) {
doesOverlaps = true;
if (overlapSegment) overlapSegment = concatSegment(overlapSegment, segment);
else overlapSegment = segment;
} else if (
(tolerance === 0) ?
booleanPointOnLine(coordsMatch[0], segment) && booleanPointOnLine(coordsMatch[1], segment) :
nearestPointOnLine(segment, coordsMatch[0]).properties.dist <= tolerance &&
nearestPointOnLine(segment, coordsMatch[1]).properties.dist <= tolerance) {
// Do not define (doesOverlap = true) since more matches can occur within the same segment
// doesOverlaps = true;
if (overlapSegment) overlapSegment = concatSegment(overlapSegment, match);
else overlapSegment = match;
}
}
});
开发者ID:Turbo87,项目名称:turf,代码行数:32,代码来源:index.ts
示例4: isLineOnLine
function isLineOnLine(lineString1, lineString2) {
var haveFoundInteriorPoint = false;
for (var i = 0; i < lineString2.coordinates.length; i++) {
if (isPointOnLine({type: 'Point', coordinates: lineString2.coordinates[i]}, lineString1, { ignoreEndVertices: true })) {
haveFoundInteriorPoint = true;
}
if (!isPointOnLine({type: 'Point', coordinates: lineString2.coordinates[i]}, lineString1, {ignoreEndVertices: false })) {
return false;
}
}
return haveFoundInteriorPoint;
}
开发者ID:OlympicsORG,项目名称:turf,代码行数:12,代码来源:index.ts
示例5: isLineOnLine
export function isLineOnLine(lineString1: LineString, lineString2: LineString) {
let haveFoundInteriorPoint = false;
for (const coords of lineString2.coordinates) {
if (isPointOnLine({type: "Point", coordinates: coords}, lineString1, { ignoreEndVertices: true })) {
haveFoundInteriorPoint = true;
}
if (!isPointOnLine({type: "Point", coordinates: coords}, lineString1, {ignoreEndVertices: false })) {
return false;
}
}
return haveFoundInteriorPoint;
}
开发者ID:Turbo87,项目名称:turf,代码行数:12,代码来源:index.ts
示例6: isMultiPointOnLine
function isMultiPointOnLine(multiPoint, lineString) {
var foundInsidePoint = false;
for (var i = 0; i < multiPoint.coordinates.length; i++) {
if (!booleanPointOnLine(multiPoint.coordinates[i], lineString)) {
return false;
}
if (!foundInsidePoint) {
foundInsidePoint = booleanPointOnLine(multiPoint.coordinates[i], lineString, {ignoreEndVertices: true});
}
}
return foundInsidePoint;
}
开发者ID:OlympicsORG,项目名称:turf,代码行数:13,代码来源:index.ts
示例7: isMultiPointOnLine
export function isMultiPointOnLine(lineString: LineString, multiPoint: MultiPoint) {
let haveFoundInteriorPoint = false;
for (const coord of multiPoint.coordinates) {
if (isPointOnLine(coord, lineString, {ignoreEndVertices: true})) {
haveFoundInteriorPoint = true;
}
if (!isPointOnLine(coord, lineString)) {
return false;
}
}
if (haveFoundInteriorPoint) {
return true;
}
return false;
}
开发者ID:Turbo87,项目名称:turf,代码行数:15,代码来源:index.ts
示例8: checkRingsForSpikesPunctures
function checkRingsForSpikesPunctures(geom) {
for (var i = 0; i < geom.length - 1; i++) {
var point = geom[i]
for (var ii = i + 1; ii < geom.length - 2; ii++) {
var seg = [geom[ii], geom[ii + 1]]
if (isPointOnLine(point, lineString(seg))) return true
}
}
return false
}
开发者ID:Turbo87,项目名称:turf,代码行数:10,代码来源:index.ts
注:本文中的@turf/boolean-point-on-line.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论