import { Polygon, Sketch, MultiPolygon, SketchCollection, FeatureCollection, } from "../../types/index.js"; import { genSampleSketch, genSampleSketchCollection, genSampleSketchCollectionFromSketches, } from "../../helpers/index.js"; /** * Zero polygon geometry sketch. Generated by functions like clipToGeography in place of creating a null geometry */ const zero: Sketch = genSampleSketch({ type: "Polygon", coordinates: [ [ [0, 0], [0, 0], [0, 0], ], ], }); const outer: Sketch = genSampleSketch({ type: "Polygon", coordinates: [ [ [0, 0], [0, 20], [20, 20], [20, 0], [0, 0], ], ], }); const bottomLeftPoly: Sketch = genSampleSketch({ type: "Polygon", coordinates: [ [ [2, 2], [2, 8], [8, 8], [8, 2], [2, 2], ], ], }); const topRightPoly: Sketch = genSampleSketch({ type: "Polygon", coordinates: [ [ [12, 12], [12, 18], [18, 18], [18, 12], [12, 12], ], ], }); const twoPolyInsideFC: FeatureCollection = { type: "FeatureCollection", features: [bottomLeftPoly, topRightPoly], }; const twoPolyInsideSC: SketchCollection = genSampleSketchCollection(twoPolyInsideFC); const wholePoly: Sketch = genSampleSketch({ type: "Polygon", coordinates: [ [ [2, 2], [2, 20], [20, 20], [20, 2], [2, 2], ], ], }); const wholeMultipoly: Sketch = genSampleSketch({ type: "MultiPolygon", coordinates: [ [ [ [2, 2], [2, 20], [20, 20], [20, 2], [2, 2], ], ], ], }); const wholeMixedFC: FeatureCollection = { type: "FeatureCollection", features: [wholePoly, wholeMultipoly], }; const wholeMixedSC: SketchCollection = genSampleSketchCollection(wholeMixedFC); // hole in bottom left const holeBlPoly: Sketch = genSampleSketch( { type: "Polygon", coordinates: [ [ [2, 2], [2, 20], [20, 20], [20, 2], [2, 2], ], [ [2, 2], [2, 8], [8, 8], [8, 2], [2, 2], ], ], }, "holeBotLeft", ); // hole in top right const holeTrMultipoly: Sketch = genSampleSketch( { type: "MultiPolygon", coordinates: [ [ [ [2, 2], [2, 20], [20, 20], [20, 2], [2, 2], ], [ [12, 12], [12, 18], [18, 18], [18, 12], [12, 12], ], ], ], }, "holeTopRight", ); /** * Sketch collection with a whole polygon with a hole in the bottom left and a whole multipolygon with a hole in the top-right * These two features have 100% overlap except for their holes which don't overlap at all. */ const holeMixedSC: SketchCollection = genSampleSketchCollectionFromSketches( [holeBlPoly, holeTrMultipoly], "holeSC", ); export default { zero, outer, bottomLeftPoly, topRightPoly, twoPolyInsideFC, twoPolyInsideSC, wholePoly, wholeMultipoly, wholeMixedFC, wholeMixedSC, holeBlPoly, holeTrMultipoly, holeMixedSC, };