Skip to content
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

Merged
merged 12 commits into from
Dec 13, 2020

Conversation

alebinson
Copy link
Collaborator

Related Issues:
MapColonies/discrete-layer-client#23

Checklist

  • Tests
  • Stories
  • Lint
  • Prettier

What I did

  • BREAKING CHANGE
  • feature request
  • bug fix
  • documentation

More information:

Comment on lines 110 to 111
default:
break;
Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one, DONE

Comment on lines 65 to 107
(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),
});
},
Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +125 to +130
drawEntity.coordinates !== undefined
? drawEntity.coordinates
: geoJSONToPrimitive(
drawEntity.type,
drawEntity.geojson as FeatureCollection
);
Copy link
Contributor

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?

Copy link
Collaborator Author

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

@alebinson alebinson requested a review from syncush December 13, 2020 06:44
Copy link
Contributor

@asafMasa asafMasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job 👍

@alebinson alebinson requested a review from asafMasa December 13, 2020 13:20
@alebinson alebinson merged commit d85c123 into master Dec 13, 2020
@alebinson alebinson deleted the cesium_draw_by_primitive_or_geojson branch December 13, 2020 14:19
@acun87 acun87 linked an issue Apr 15, 2022 that may be closed by this pull request
Copy link

@acun87 acun87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restore and disable bug
4 participants