-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cesium-draw): draw by primitive or geojson #80
Conversation
default: | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would throw an Error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one, DONE
(drawHelper as any).startDrawingPolygon({ | ||
callback: (positions: PrimitiveCoordinates) => { | ||
//// MAKE polygon editable example | ||
// var polygon = new DrawHelper.PolygonPrimitive({ | ||
// positions: positions, | ||
// width: 5, | ||
// geodesic: true | ||
// }); | ||
// mapViewer.scene.primitives.add(polygon); | ||
// polygon.setStrokeStyle(Color.AQUA,1); | ||
// polygon.setEditable(); | ||
// polygon.addListener('onEdited', function(event) { | ||
// console.log('Polygone edited, ' + event.positions.length + ' points'); | ||
// }); | ||
drawState.handler({ | ||
primitive: positions, | ||
type: DrawType.POLYGON, | ||
geojson: polygonToGeoJSON(positions as Cartesian3[]), | ||
}); | ||
}, | ||
}); | ||
break; | ||
case DrawType.BOX: | ||
// eslint-disable-next-line | ||
(drawHelper as any).startDrawingExtent({ | ||
callback: (positions: PrimitiveCoordinates) => { | ||
//// MAKE box editable example | ||
// var extentPrimitive = new DrawHelper.ExtentPrimitive({ | ||
// extent: positions, | ||
// material: Cesium.Material.fromType(Cesium.Material.StripeType) | ||
// }); | ||
// mapViewer.scene.primitives.add(extentPrimitive); | ||
// extentPrimitive.setStrokeStyle(Color.AQUA,1); | ||
// extentPrimitive.setEditable(); | ||
// extentPrimitive.addListener('onEdited', function(event) { | ||
// console.log('Extent edited: extent is (N: ' + event.extent.north.toFixed(3) + ', E: ' + event.extent.east.toFixed(3) + ', S: ' + event.extent.south.toFixed(3) + ', W: ' + event.extent.west.toFixed(3) + ')'); | ||
// }); | ||
drawState.handler({ | ||
primitive: positions, | ||
type: DrawType.BOX, | ||
geojson: rectangleToGeoJSON(positions as Rectangle), | ||
}); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in each case you do (drawHelper as any)
I would extract that code into a new casted variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
drawEntity.coordinates !== undefined | ||
? drawEntity.coordinates | ||
: geoJSONToPrimitive( | ||
drawEntity.type, | ||
drawEntity.geojson as FeatureCollection | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why suppressing @typescript-eslint/no-unnecessary-condition
? is it an unnecessary condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Local linting problems,
"Eagle eye", DONE
packages/react-components/src/lib/cesium-map/tools/draw/drawHelper.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job 👍
packages/react-components/src/lib/cesium-map/data-sources/drawings.data-source.stories.tsx
Show resolved
Hide resolved
packages/react-components/src/lib/cesium-map/data-sources/drawings.data-source.stories.tsx
Show resolved
Hide resolved
packages/react-components/src/lib/cesium-map/data-sources/drawings.data-source.stories.tsx
Show resolved
Hide resolved
packages/react-components/src/lib/cesium-map/tools/draw/drawHelper.ts
Outdated
Show resolved
Hide resolved
packages/react-components/src/lib/cesium-map/tools/geojson/geojson-to-primitive.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related Issues:
MapColonies/discrete-layer-client#23
Checklist
What I did
More information: