Skip to content

Commit

Permalink
Merge pull request #16 from chrispahm/error-handling-_r
Browse files Browse the repository at this point in the history
Fix error handling  - switch to _r methods
  • Loading branch information
chrispahm authored Aug 5, 2023
2 parents 1e09e52 + ae180b9 commit 4e525b5
Show file tree
Hide file tree
Showing 26 changed files with 775 additions and 537 deletions.
230 changes: 2 additions & 228 deletions GEOS_EMCC_FLAGS.mk

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions createTypes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function createFunctionString (identifier, returnType, functionName, params) {
// Create a TypeScript interface property for each function as a string, in the format
// function(param1: string, param2: number): number;
const allFunctionsTypes = templateData.map((identifier) => {
if (identifier.kind === 'member' && identifier.name.includes('GEOS')) {
if ((identifier.kind === 'member' || identifier.kind === 'function') && identifier.name.includes('GEOS')) {
const params = identifier.params?.map((param) => {
return `${param.name}: ${param.type.names[0]}`
}) || []
Expand Down Expand Up @@ -65,8 +65,18 @@ interface geos {
Module: Module;
}
interface Config {
/**
* If autoInit is true, the GEOS library will be initialized when the geos object is created.
* @default true
*/
autoInit?: boolean;
errorHandler?: (message: string) => void;
noticeHandler?: (message: string) => void;
}
declare module 'geos-wasm' {
export default function initGeosJs(): Promise<geos>;
export default function initGeosJs(config?: Config): Promise<geos>;
}`

fs.writeFileSync(`${outputDir}/geos.esm.d.ts`, output)
32 changes: 16 additions & 16 deletions docs/.vitepress/cache/deps/_metadata.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,75 @@
{
"hash": "542d5595",
"browserHash": "6ab1c1cb",
"hash": "080e1c5f",
"browserHash": "50da582a",
"optimized": {
"vue": {
"src": "../../../../node_modules/vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js",
"fileHash": "9d32485d",
"fileHash": "808e22ff",
"needsInterop": false
},
"vitepress > @vue/devtools-api": {
"src": "../../../../node_modules/@vue/devtools-api/lib/esm/index.js",
"file": "vitepress___@vue_devtools-api.js",
"fileHash": "596039bd",
"fileHash": "2d1c7b85",
"needsInterop": false
},
"vitepress > minisearch": {
"src": "../../../../node_modules/minisearch/dist/es/index.js",
"file": "vitepress___minisearch.js",
"fileHash": "a20caca2",
"fileHash": "3368bed3",
"needsInterop": false
},
"@theme/index": {
"src": "../../../../node_modules/vitepress/dist/client/theme-default/index.js",
"file": "@theme_index.js",
"fileHash": "1ec9132c",
"fileHash": "27f2c1b5",
"needsInterop": false
},
"maplibre-gl": {
"src": "../../../../node_modules/maplibre-gl/dist/maplibre-gl.js",
"file": "maplibre-gl.js",
"fileHash": "f23480fc",
"fileHash": "4186f51c",
"needsInterop": true
},
"@turf/bbox": {
"src": "../../../../node_modules/@turf/bbox/dist/es/index.js",
"file": "@turf_bbox.js",
"fileHash": "aa2f773a",
"fileHash": "5b98e5f1",
"needsInterop": false
},
"@turf/center": {
"src": "../../../../node_modules/@turf/center/dist/es/index.js",
"file": "@turf_center.js",
"fileHash": "07d0fa37",
"fileHash": "edcbc434",
"needsInterop": false
},
"@turf/meta": {
"src": "../../../../node_modules/@turf/meta/dist/es/index.js",
"file": "@turf_meta.js",
"fileHash": "107aafec",
"fileHash": "bbfcafa3",
"needsInterop": false
},
"d3-geo": {
"src": "../../../../node_modules/d3-geo/src/index.js",
"file": "d3-geo.js",
"fileHash": "4d97bc50",
"fileHash": "4d13dd65",
"needsInterop": false
},
"@turf/helpers": {
"src": "../../../../node_modules/@turf/helpers/dist/es/index.js",
"file": "@turf_helpers.js",
"fileHash": "d162809b",
"fileHash": "a0092461",
"needsInterop": false
},
"buffer": {
"src": "../../../../node_modules/buffer/index.js",
"file": "buffer.js",
"fileHash": "25936a0b",
"fileHash": "05d13e5c",
"needsInterop": true
}
},
"chunks": {
"chunk-V634PGSD": {
"file": "chunk-V634PGSD.js"
},
"chunk-MMVC6BQJ": {
"file": "chunk-MMVC6BQJ.js"
},
Expand All @@ -82,6 +79,9 @@
"chunk-HE4C34TC": {
"file": "chunk-HE4C34TC.js"
},
"chunk-V634PGSD": {
"file": "chunk-V634PGSD.js"
},
"chunk-76J2PTFD": {
"file": "chunk-76J2PTFD.js"
}
Expand Down
2 changes: 1 addition & 1 deletion docs/allFunctions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"text":"Module","link":"/functions/geos.Module.md"},{"text":"GEOSArea","link":"/functions/geos.GEOSArea.md"},{"text":"GEOSBoundary","link":"/functions/geos.GEOSBoundary.md"},{"text":"GEOSBuffer","link":"/functions/geos.GEOSBuffer.md"},{"text":"GEOSBuildArea","link":"/functions/geos.GEOSBuildArea.md"},{"text":"GEOSClipByRect","link":"/functions/geos.GEOSClipByRect.md"},{"text":"GEOSConstrainedDelaunayTriangulation","link":"/functions/geos.GEOSConstrainedDelaunayTriangulation.md"},{"text":"GEOSContains","link":"/functions/geos.GEOSContains.md"},{"text":"GEOSContext","link":"/functions/geos.GEOSContext.md"},{"text":"GEOSConvexHull","link":"/functions/geos.GEOSConvexHull.md"},{"text":"GEOSCoordSeq","link":"/functions/geos.GEOSCoordSeq.md"},{"text":"GEOSCoverageUnion","link":"/functions/geos.GEOSCoverageUnion.md"},{"text":"GEOSCoveredBy","link":"/functions/geos.GEOSCoveredBy.md"},{"text":"GEOSCovers","link":"/functions/geos.GEOSCovers.md"},{"text":"GEOSCrosses","link":"/functions/geos.GEOSCrosses.md"},{"text":"GEOSDelaunayTriangulation","link":"/functions/geos.GEOSDelaunayTriangulation.md"},{"text":"GEOSDensify","link":"/functions/geos.GEOSDensify.md"},{"text":"GEOSDifference","link":"/functions/geos.GEOSDifference.md"},{"text":"GEOSDisjoint","link":"/functions/geos.GEOSDisjoint.md"},{"text":"GEOSDistance","link":"/functions/geos.GEOSDistance.md"},{"text":"GEOSEnvelope","link":"/functions/geos.GEOSEnvelope.md"},{"text":"GEOSEquals","link":"/functions/geos.GEOSEquals.md"},{"text":"GEOSFrechetDistance","link":"/functions/geos.GEOSFrechetDistance.md"},{"text":"GEOSFree","link":"/functions/geos.GEOSFree.md"},{"text":"GEOSGeoJSONReader","link":"/functions/geos.GEOSGeoJSONReader.md"},{"text":"GEOSGeoJSONWriter","link":"/functions/geos.GEOSGeoJSONWriter.md"},{"text":"GEOSGeom","link":"/functions/geos.GEOSGeom.md"},{"text":"GEOSGetCentroid","link":"/functions/geos.GEOSGetCentroid.md"},{"text":"GEOSGetExteriorRing","link":"/functions/geos.GEOSGetExteriorRing.md"},{"text":"GEOSGetGeometryN","link":"/functions/geos.GEOSGetGeometryN.md"},{"text":"GEOSGetInteriorRingN","link":"/functions/geos.GEOSGetInteriorRingN.md"},{"text":"GEOSGetNumCoordinates","link":"/functions/geos.GEOSGetNumCoordinates.md"},{"text":"GEOSGetNumGeometries","link":"/functions/geos.GEOSGetNumGeometries.md"},{"text":"GEOSGetNumInteriorRings","link":"/functions/geos.GEOSGetNumInteriorRings.md"},{"text":"GEOSGetSRID","link":"/functions/geos.GEOSGetSRID.md"},{"text":"GEOSHasZ","link":"/functions/geos.GEOSHasZ.md"},{"text":"GEOSHausdorffDistance","link":"/functions/geos.GEOSHausdorffDistance.md"},{"text":"GEOSInterpolate","link":"/functions/geos.GEOSInterpolate.md"},{"text":"GEOSIntersection","link":"/functions/geos.GEOSIntersection.md"},{"text":"GEOSIntersects","link":"/functions/geos.GEOSIntersects.md"},{"text":"GEOSLargestEmptyCircle","link":"/functions/geos.GEOSLargestEmptyCircle.md"},{"text":"GEOSLength","link":"/functions/geos.GEOSLength.md"},{"text":"GEOSLineMerge","link":"/functions/geos.GEOSLineMerge.md"},{"text":"GEOSMakeValid","link":"/functions/geos.GEOSMakeValid.md"},{"text":"GEOSMaximumInscribedCircle","link":"/functions/geos.GEOSMaximumInscribedCircle.md"},{"text":"GEOSMinimumBoundingCircle","link":"/functions/geos.GEOSMinimumBoundingCircle.md"},{"text":"GEOSMinimumClearance","link":"/functions/geos.GEOSMinimumClearance.md"},{"text":"GEOSMinimumRotatedRectangle","link":"/functions/geos.GEOSMinimumRotatedRectangle.md"},{"text":"GEOSMinimumWidth","link":"/functions/geos.GEOSMinimumWidth.md"},{"text":"GEOSNearestPoints","link":"/functions/geos.GEOSNearestPoints.md"},{"text":"GEOSNode","link":"/functions/geos.GEOSNode.md"},{"text":"GEOSNormalize","link":"/functions/geos.GEOSNormalize.md"},{"text":"GEOSOffsetCurve","link":"/functions/geos.GEOSOffsetCurve.md"},{"text":"GEOSOrientationIndex","link":"/functions/geos.GEOSOrientationIndex.md"},{"text":"GEOSOverlaps","link":"/functions/geos.GEOSOverlaps.md"},{"text":"GEOSPointOnSurface","link":"/functions/geos.GEOSPointOnSurface.md"},{"text":"GEOSPolygonize","link":"/functions/geos.GEOSPolygonize.md"},{"text":"GEOSPrepare","link":"/functions/geos.GEOSPrepare.md"},{"text":"GEOSProject","link":"/functions/geos.GEOSProject.md"},{"text":"GEOSRelate","link":"/functions/geos.GEOSRelate.md"},{"text":"GEOSReverse","link":"/functions/geos.GEOSReverse.md"},{"text":"GEOSSTRtree","link":"/functions/geos.GEOSSTRtree.md"},{"text":"GEOSSegmentIntersection","link":"/functions/geos.GEOSSegmentIntersection.md"},{"text":"GEOSSetSRID","link":"/functions/geos.GEOSSetSRID.md"},{"text":"GEOSSharedPaths","link":"/functions/geos.GEOSSharedPaths.md"},{"text":"GEOSSimplify","link":"/functions/geos.GEOSSimplify.md"},{"text":"GEOSSingleSidedBuffer","link":"/functions/geos.GEOSSingleSidedBuffer.md"},{"text":"GEOSSnap","link":"/functions/geos.GEOSSnap.md"},{"text":"GEOSSymDifference","link":"/functions/geos.GEOSSymDifference.md"},{"text":"GEOSTopologyPreserveSimplify","link":"/functions/geos.GEOSTopologyPreserveSimplify.md"},{"text":"GEOSTouches","link":"/functions/geos.GEOSTouches.md"},{"text":"GEOSUnaryUnion","link":"/functions/geos.GEOSUnaryUnion.md"},{"text":"GEOSUnion","link":"/functions/geos.GEOSUnion.md"},{"text":"GEOSVoronoiDiagram","link":"/functions/geos.GEOSVoronoiDiagram.md"},{"text":"GEOSWKBReader","link":"/functions/geos.GEOSWKBReader.md"},{"text":"GEOSWKBWriter","link":"/functions/geos.GEOSWKBWriter.md"},{"text":"GEOSWKTReader","link":"/functions/geos.GEOSWKTReader.md"},{"text":"GEOSWKTWriter","link":"/functions/geos.GEOSWKTWriter.md"},{"text":"GEOSWithin","link":"/functions/geos.GEOSWithin.md"},{"text":"GEOS_getWKBByteOrder","link":"/functions/geos.GEOS_getWKBByteOrder.md"},{"text":"GEOS_getWKBOutputDims","link":"/functions/geos.GEOS_getWKBOutputDims.md"},{"text":"GEOS_setWKBByteOrder","link":"/functions/geos.GEOS_setWKBByteOrder.md"},{"text":"GEOS_setWKBOutputDims","link":"/functions/geos.GEOS_setWKBOutputDims.md"},{"text":"GEOSisClosed","link":"/functions/geos.GEOSisClosed.md"},{"text":"GEOSisEmpty","link":"/functions/geos.GEOSisEmpty.md"},{"text":"GEOSisRing","link":"/functions/geos.GEOSisRing.md"},{"text":"GEOSisSimple","link":"/functions/geos.GEOSisSimple.md"},{"text":"GEOSisValid","link":"/functions/geos.GEOSisValid.md"}]
[{"text":"Module","link":"/functions/geos.Module.md"},{"text":"GEOSArea","link":"/functions/geos.GEOSArea.md"},{"text":"GEOSBoundary","link":"/functions/geos.GEOSBoundary.md"},{"text":"GEOSBuffer","link":"/functions/geos.GEOSBuffer.md"},{"text":"GEOSBuildArea","link":"/functions/geos.GEOSBuildArea.md"},{"text":"GEOSClipByRect","link":"/functions/geos.GEOSClipByRect.md"},{"text":"GEOSConcaveHull","link":"/functions/geos.GEOSConcaveHull.md"},{"text":"GEOSConstrainedDelaunayTriangulation","link":"/functions/geos.GEOSConstrainedDelaunayTriangulation.md"},{"text":"GEOSContains","link":"/functions/geos.GEOSContains.md"},{"text":"GEOSContext","link":"/functions/geos.GEOSContext.md"},{"text":"GEOSConvexHull","link":"/functions/geos.GEOSConvexHull.md"},{"text":"GEOSCoordSeq","link":"/functions/geos.GEOSCoordSeq.md"},{"text":"GEOSCoverageUnion","link":"/functions/geos.GEOSCoverageUnion.md"},{"text":"GEOSCoveredBy","link":"/functions/geos.GEOSCoveredBy.md"},{"text":"GEOSCovers","link":"/functions/geos.GEOSCovers.md"},{"text":"GEOSCrosses","link":"/functions/geos.GEOSCrosses.md"},{"text":"GEOSDelaunayTriangulation","link":"/functions/geos.GEOSDelaunayTriangulation.md"},{"text":"GEOSDensify","link":"/functions/geos.GEOSDensify.md"},{"text":"GEOSDifference","link":"/functions/geos.GEOSDifference.md"},{"text":"GEOSDisjoint","link":"/functions/geos.GEOSDisjoint.md"},{"text":"GEOSDistance","link":"/functions/geos.GEOSDistance.md"},{"text":"GEOSEnvelope","link":"/functions/geos.GEOSEnvelope.md"},{"text":"GEOSEquals","link":"/functions/geos.GEOSEquals.md"},{"text":"GEOSFrechetDistance","link":"/functions/geos.GEOSFrechetDistance.md"},{"text":"GEOSFree","link":"/functions/geos.GEOSFree.md"},{"text":"GEOSGeoJSONReader","link":"/functions/geos.GEOSGeoJSONReader.md"},{"text":"GEOSGeoJSONWriter","link":"/functions/geos.GEOSGeoJSONWriter.md"},{"text":"GEOSGeom","link":"/functions/geos.GEOSGeom.md"},{"text":"GEOSGetCentroid","link":"/functions/geos.GEOSGetCentroid.md"},{"text":"GEOSGetExteriorRing","link":"/functions/geos.GEOSGetExteriorRing.md"},{"text":"GEOSGetGeometryN","link":"/functions/geos.GEOSGetGeometryN.md"},{"text":"GEOSGetInteriorRingN","link":"/functions/geos.GEOSGetInteriorRingN.md"},{"text":"GEOSGetNumCoordinates","link":"/functions/geos.GEOSGetNumCoordinates.md"},{"text":"GEOSGetNumGeometries","link":"/functions/geos.GEOSGetNumGeometries.md"},{"text":"GEOSGetNumInteriorRings","link":"/functions/geos.GEOSGetNumInteriorRings.md"},{"text":"GEOSGetSRID","link":"/functions/geos.GEOSGetSRID.md"},{"text":"GEOSHasZ","link":"/functions/geos.GEOSHasZ.md"},{"text":"GEOSHausdorffDistance","link":"/functions/geos.GEOSHausdorffDistance.md"},{"text":"GEOSInterpolate","link":"/functions/geos.GEOSInterpolate.md"},{"text":"GEOSIntersection","link":"/functions/geos.GEOSIntersection.md"},{"text":"GEOSIntersects","link":"/functions/geos.GEOSIntersects.md"},{"text":"GEOSLargestEmptyCircle","link":"/functions/geos.GEOSLargestEmptyCircle.md"},{"text":"GEOSLength","link":"/functions/geos.GEOSLength.md"},{"text":"GEOSLineMerge","link":"/functions/geos.GEOSLineMerge.md"},{"text":"GEOSMakeValid","link":"/functions/geos.GEOSMakeValid.md"},{"text":"GEOSMaximumInscribedCircle","link":"/functions/geos.GEOSMaximumInscribedCircle.md"},{"text":"GEOSMinimumBoundingCircle","link":"/functions/geos.GEOSMinimumBoundingCircle.md"},{"text":"GEOSMinimumClearance","link":"/functions/geos.GEOSMinimumClearance.md"},{"text":"GEOSMinimumRotatedRectangle","link":"/functions/geos.GEOSMinimumRotatedRectangle.md"},{"text":"GEOSMinimumWidth","link":"/functions/geos.GEOSMinimumWidth.md"},{"text":"GEOSNearestPoints","link":"/functions/geos.GEOSNearestPoints.md"},{"text":"GEOSNode","link":"/functions/geos.GEOSNode.md"},{"text":"GEOSNormalize","link":"/functions/geos.GEOSNormalize.md"},{"text":"GEOSOffsetCurve","link":"/functions/geos.GEOSOffsetCurve.md"},{"text":"GEOSOrientationIndex","link":"/functions/geos.GEOSOrientationIndex.md"},{"text":"GEOSOverlaps","link":"/functions/geos.GEOSOverlaps.md"},{"text":"GEOSPointOnSurface","link":"/functions/geos.GEOSPointOnSurface.md"},{"text":"GEOSPolygonize","link":"/functions/geos.GEOSPolygonize.md"},{"text":"GEOSPrepare","link":"/functions/geos.GEOSPrepare.md"},{"text":"GEOSProject","link":"/functions/geos.GEOSProject.md"},{"text":"GEOSRelate","link":"/functions/geos.GEOSRelate.md"},{"text":"GEOSReverse","link":"/functions/geos.GEOSReverse.md"},{"text":"GEOSSTRtree","link":"/functions/geos.GEOSSTRtree.md"},{"text":"GEOSSegmentIntersection","link":"/functions/geos.GEOSSegmentIntersection.md"},{"text":"GEOSSetSRID","link":"/functions/geos.GEOSSetSRID.md"},{"text":"GEOSSharedPaths","link":"/functions/geos.GEOSSharedPaths.md"},{"text":"GEOSSimplify","link":"/functions/geos.GEOSSimplify.md"},{"text":"GEOSSingleSidedBuffer","link":"/functions/geos.GEOSSingleSidedBuffer.md"},{"text":"GEOSSnap","link":"/functions/geos.GEOSSnap.md"},{"text":"GEOSSymDifference","link":"/functions/geos.GEOSSymDifference.md"},{"text":"GEOSTopologyPreserveSimplify","link":"/functions/geos.GEOSTopologyPreserveSimplify.md"},{"text":"GEOSTouches","link":"/functions/geos.GEOSTouches.md"},{"text":"GEOSUnaryUnion","link":"/functions/geos.GEOSUnaryUnion.md"},{"text":"GEOSUnion","link":"/functions/geos.GEOSUnion.md"},{"text":"GEOSVoronoiDiagram","link":"/functions/geos.GEOSVoronoiDiagram.md"},{"text":"GEOSWKBReader","link":"/functions/geos.GEOSWKBReader.md"},{"text":"GEOSWKBWriter","link":"/functions/geos.GEOSWKBWriter.md"},{"text":"GEOSWKTReader","link":"/functions/geos.GEOSWKTReader.md"},{"text":"GEOSWKTWriter","link":"/functions/geos.GEOSWKTWriter.md"},{"text":"GEOSWithin","link":"/functions/geos.GEOSWithin.md"},{"text":"GEOS_finish_r","link":"/functions/geos.GEOS_finish_r.md"},{"text":"GEOS_getWKBByteOrder","link":"/functions/geos.GEOS_getWKBByteOrder.md"},{"text":"GEOS_getWKBOutputDims","link":"/functions/geos.GEOS_getWKBOutputDims.md"},{"text":"GEOS_init_r","link":"/functions/geos.GEOS_init_r.md"},{"text":"GEOS_interruptCancel","link":"/functions/geos.GEOS_interruptCancel.md"},{"text":"GEOS_interruptRegisterCallback","link":"/functions/geos.GEOS_interruptRegisterCallback.md"},{"text":"GEOS_interruptRequest","link":"/functions/geos.GEOS_interruptRequest.md"},{"text":"GEOS_setWKBByteOrder","link":"/functions/geos.GEOS_setWKBByteOrder.md"},{"text":"GEOS_setWKBOutputDims","link":"/functions/geos.GEOS_setWKBOutputDims.md"},{"text":"GEOSisClosed","link":"/functions/geos.GEOSisClosed.md"},{"text":"GEOSisEmpty","link":"/functions/geos.GEOSisEmpty.md"},{"text":"GEOSisRing","link":"/functions/geos.GEOSisRing.md"},{"text":"GEOSisSimple","link":"/functions/geos.GEOSisSimple.md"},{"text":"GEOSisValid","link":"/functions/geos.GEOSisValid.md"},{"text":"GEOSjtsport","link":"/functions/geos.GEOSjtsport.md"},{"text":"GEOSversion","link":"/functions/geos.GEOSversion.md"},{"text":"finishGEOS","link":"/functions/geos.finishGEOS.md"},{"text":"initGEOS","link":"/functions/geos.initGEOS.md"}]
2 changes: 1 addition & 1 deletion docs/assets/geos.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/components/mic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ onMounted(async () => {
const radius = geos.Module.getValue(distancePtr, 'double')
// now that we have the center and radius, we can create a
// an actual circle using the center and radius
const bufferPtr = geos.GEOSBuffer(centerPtr, radius)
const bufferPtr = geos.GEOSBuffer(centerPtr, radius, 8)
// convert the mic to wkb
const micWkb = GEOSGeomToWKB(bufferPtr)
// convert the wkb to a GeoJSON geometry
Expand Down
Loading

0 comments on commit 4e525b5

Please sign in to comment.