Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Strongly type geomEach function to GeoJSONObject #29

Merged
merged 2 commits into from
Nov 23, 2021
Merged

Conversation

baparham
Copy link
Member

No description provided.

@baparham baparham mentioned this pull request Nov 22, 2021
20 tasks
@tobrun
Copy link
Collaborator

tobrun commented Nov 22, 2021

Closes #29

@baparham
Copy link
Member Author

tests passed locally and in ci, so I'll see if I can at least refactor this to be more maintainable/readable

@baparham
Copy link
Member Author

Question for discussion: How critical should we consider the comment about speed an efficiency in the geomEach turf.js implementation? I'm not sure if turf.js has any benchmarks out there for measuring performance that we could run against our dart implementation to ensure we maintain performance.

The only thing I think I'd change is to basically have a few more if branches deeper in my refactored implementation, rather than passing around several unnecessary arguments. I'll push a new commit that does this for thoughts and review.

@lukas-h
Copy link
Member

lukas-h commented Nov 22, 2021

@baparham
Copy link
Member Author

I rebased this on top of #25 and squashed the commits down to one

@baparham baparham marked this pull request as ready for review November 22, 2021 21:19
@baparham
Copy link
Member Author

baparham commented Nov 22, 2021

Closes #29

@tobrun Did you mean another issue here? I don't see an issue that this closes, but it relates to #27 at least

This commit also renames Geometry to GeometryObject
@baparham
Copy link
Member Author

@lukas-h @tobrun does this refactor work for you guys? Anything you'd like to do differently?

Map<String, dynamic> featureProperties,
BBox? featureBBox,
dynamic featureId) {
switch (currentGeometry.type) {
Copy link
Member

@lukas-h lukas-h Nov 23, 2021

Choose a reason for hiding this comment

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

In PR #33, I used the is operator instead of checking the .type attribute in a switch case, which could save us some lines of code. Don't know if type checking is more efficient than this.

like this:

if(currentGeometry is GeometryType) {
// ...
} else if(currentGeometry is GeometryCollection) {
// ...
} else {
    throw Exception('Unknown Geometry Type');
}

}
}

void _runGeomEachCallbacks(
Copy link
Member

Choose a reason for hiding this comment

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

tried to merge this function with _forEachGeomInGeometryObject in my PR #33, please give me a feedback.

@lukas-h
Copy link
Member

lukas-h commented Nov 23, 2021

@lukas-h @tobrun does this refactor work for you guys? Anything you'd like to do differently?

Looks much cleaner now! 😄 I tried to make it even a little smaller here: #33

@baparham
Copy link
Member Author

@lukas-h @tobrun does this refactor work for you guys? Anything you'd like to do differently?

Looks much cleaner now! 😄 I tried to make it even a little smaller here: #33

thanks! approved and merged in here

@baparham baparham merged commit 6494415 into main Nov 23, 2021
@baparham baparham deleted the update-geomeach branch November 24, 2021 07:17
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants