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

Add multiselect flag for geometry layers (fill, line) #582

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

maurhofer-ubique
Copy link
Contributor

@maurhofer-ubique maurhofer-ubique commented Jan 26, 2024

Summary by CodeRabbit

  • New Features
    • Introduced multi-select functionality across various vector layer types, enhancing user interaction capabilities.
    • Added support for multi-selection in both Android and iOS platforms, ensuring a consistent experience.
  • Enhancements
    • Extended vector layer descriptions to include a multi-select option, allowing for more flexible layer configurations.
  • Bug Fixes
    • Adjusted selection logic in line and polygon tiles to correctly handle multi-select scenarios.

Copy link
Contributor

coderabbitai bot commented Jan 26, 2024

Walkthrough

The updates across various files introduce multi-select functionality for layer features in a mapping application. This involves adding a new method to handle multi-selection, updating existing classes to support this feature, and ensuring that the multi-select state is passed through constructors and used in selection logic. The changes span across Android and iOS bridging layers, JNI implementations, and shared public descriptions, enhancing the app's interactive capabilities with vector layers.

Changes

File Path Change Summary
.../Tiled2dMapVectorLayerSelectionCallbackInterface.kt
.../NativeTiled2dMapVectorLayerSelectionCallbackInterface.cpp
.../NativeTiled2dMapVectorLayerSelectionCallbackInterface.h
.../MCTiled2dMapVectorLayerSelectionCallbackInterface+Private.mm
.../Tiled2dMapVectorLayerSelectionCallbackInterface.h
Added didMultiSelectLayerFeatures method to handle multi-selection of layer features.
.../vector/tiled_vector_layer.djinni Introduced a new method for multi-selection in the interface definition.
.../BackgroundVectorLayerDescription.h
.../LineVectorLayerDescription.h
.../PolygonVectorLayerDescription.h
.../RasterVectorLayerDescription.h
.../SymbolVectorLayerDescription.h
.../VectorLayerDescription.h
Added a multiselect boolean parameter to constructors and updated related logic.
.../Tiled2dMapVectorTile.h
.../Tiled2dMapVectorLayerParserHelper.cpp
.../Tiled2dMapVectorTile.cpp
Included multi-select functionality and initialization logic.
.../Tiled2dMapVectorLineTile.cpp
.../Tiled2dMapVectorPolygonPatternTile.cpp
.../Tiled2dMapVectorPolygonTile.cpp
Modified methods to support multi-select functionality during layer feature selection.

🐇🌟
In the land of code and map tiles wide,
A rabbit hopped with a multi-select stride.
"Now pick ye many, not just one side,"
It cheered, as layers complied with pride.
🌍✨

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@maurhofer-ubique maurhofer-ubique marked this pull request as ready for review January 26, 2024 08:07
@maurhofer-ubique maurhofer-ubique merged commit b191d91 into develop Jan 26, 2024
2 checks passed
@maurhofer-ubique maurhofer-ubique deleted the feature/multiselect branch January 26, 2024 08:07
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between aaf1f32 and d446ed0.
Files selected for processing (19)
  • bridging/android/java/io/openmobilemaps/mapscore/shared/map/layers/tiled/vector/Tiled2dMapVectorLayerSelectionCallbackInterface.kt (2 hunks)
  • bridging/android/jni/map/layers/tiled/vector/NativeTiled2dMapVectorLayerSelectionCallbackInterface.cpp (2 hunks)
  • bridging/android/jni/map/layers/tiled/vector/NativeTiled2dMapVectorLayerSelectionCallbackInterface.h (2 hunks)
  • bridging/ios/MCTiled2dMapVectorLayerSelectionCallbackInterface+Private.mm (2 hunks)
  • bridging/ios/MCTiled2dMapVectorLayerSelectionCallbackInterface.h (1 hunks)
  • djinni/map/layers/tiled/vector/tiled_vector_layer.djinni (1 hunks)
  • shared/public/BackgroundVectorLayerDescription.h (1 hunks)
  • shared/public/LineVectorLayerDescription.h (1 hunks)
  • shared/public/PolygonVectorLayerDescription.h (1 hunks)
  • shared/public/RasterVectorLayerDescription.h (1 hunks)
  • shared/public/SymbolVectorLayerDescription.h (1 hunks)
  • shared/public/Tiled2dMapVectorLayerSelectionCallbackInterface.h (2 hunks)
  • shared/public/Tiled2dMapVectorTile.h (1 hunks)
  • shared/public/VectorLayerDescription.h (2 hunks)
  • shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cpp (5 hunks)
  • shared/src/map/layers/tiled/vector/tiles/Tiled2dMapVectorTile.cpp (1 hunks)
  • shared/src/map/layers/tiled/vector/tiles/line/Tiled2dMapVectorLineTile.cpp (1 hunks)
  • shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonPatternTile.cpp (1 hunks)
  • shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonTile.cpp (1 hunks)
Additional comments: 25
shared/public/Tiled2dMapVectorLayerSelectionCallbackInterface.h (1)
  • 18-18: The addition of didMultiSelectLayerFeatures method in Tiled2dMapVectorLayerSelectionCallbackInterface is aligned with the PR's objective to support multi-selection of layer features. Ensure corresponding implementations handle this new method correctly.
bridging/ios/MCTiled2dMapVectorLayerSelectionCallbackInterface.h (1)
  • 15-18: The addition of didMultiSelectLayerFeatures method in MCTiled2dMapVectorLayerSelectionCallbackInterface for iOS bridging is consistent with the PR's goal to enable multi-selection functionality. Ensure the iOS implementation correctly handles the array of MCVectorLayerFeatureInfo.
shared/public/VectorLayerDescription.h (2)
  • 29-29: The addition of the multiselect boolean member in VectorLayerDescription is crucial for enabling or disabling multi-selection on vector layers. This change is necessary for the feature's implementation.
  • 62-72: The constructor of VectorLayerDescription now includes the multiselect parameter, ensuring that layer descriptions can specify whether they support multi-selection. This change is essential for the feature's flexibility.
shared/src/map/layers/tiled/vector/tiles/Tiled2dMapVectorTile.cpp (1)
  • 30-30: Initializing the multiselect member variable in Tiled2dMapVectorTile's constructor with the value from the description parameter is a necessary change to support the new multi-selection feature.
bridging/android/java/io/openmobilemaps/mapscore/shared/map/layers/tiled/vector/Tiled2dMapVectorLayerSelectionCallbackInterface.kt (2)
  • 13-14: The addition of didMultiSelectLayerFeatures as an abstract function in Tiled2dMapVectorLayerSelectionCallbackInterface for Kotlin is aligned with the PR's objective to support multi-selection of layer features on Android. Ensure the Android implementation correctly handles the ArrayList of VectorLayerFeatureInfo.
  • 38-43: The implementation of didMultiSelectLayerFeatures in the CppProxy class within Tiled2dMapVectorLayerSelectionCallbackInterface.kt ensures that the multi-selection functionality is correctly bridged to the native code. This is a critical part of enabling the feature on Android.
shared/public/BackgroundVectorLayerDescription.h (1)
  • 68-68: The modification to include the multiselect parameter in the constructor call of BackgroundVectorLayerDescription is necessary for specifying multi-selection capability at the layer level. This change is consistent with the feature's requirements.
bridging/android/jni/map/layers/tiled/vector/NativeTiled2dMapVectorLayerSelectionCallbackInterface.h (2)
  • 37-37: The declaration of didMultiSelectLayerFeatures in NativeTiled2dMapVectorLayerSelectionCallbackInterface is a necessary addition to support the new multi-selection functionality in the JNI layer for Android.
  • 46-46: The JNI method ID for didMultiSelectLayerFeatures is correctly obtained, ensuring that the new multi-selection functionality can be invoked from the native code on Android.
shared/public/Tiled2dMapVectorTile.h (1)
  • 80-80: The addition of the multiselect boolean member variable in Tiled2dMapVectorTile is essential for tracking the multi-selection state of vector tiles. This change supports the feature's implementation.
shared/public/PolygonVectorLayerDescription.h (1)
  • 101-109: The inclusion of the multiselect parameter in the constructor of PolygonVectorLayerDescription and its subsequent passing to the VectorLayerDescription constructor is a necessary change to support multi-selection for polygon vector layers.
djinni/map/layers/tiled/vector/tiled_vector_layer.djinni (1)
  • 95-95: The addition of did_multi_select_layer_features to the tiled_2d_map_vector_layer_selection_callback_interface in the Djinni interface definition file is crucial for enabling multi-selection functionality across different platforms. This change ensures that the feature is accessible through the generated bindings.
bridging/ios/MCTiled2dMapVectorLayerSelectionCallbackInterface+Private.mm (2)
  • 47-57: The implementation of didMultiSelectLayerFeatures in MCTiled2dMapVectorLayerSelectionCallbackInterface+Private.mm correctly bridges the multi-selection functionality from Objective-C to C++. This ensures that the feature works as expected on iOS.
  • 83-91: The C++ proxy implementation for didMultiSelectLayerFeatures correctly handles the conversion from Objective-C types to C++ types, enabling the multi-selection feature's functionality within the native code on iOS.
shared/public/LineVectorLayerDescription.h (1)
  • 136-144: The inclusion of the multiselect parameter in the constructor of LineVectorLayerDescription and its subsequent passing to the VectorLayerDescription constructor is a necessary change to support multi-selection for line vector layers. This ensures that the feature is correctly implemented at the layer level.
bridging/android/jni/map/layers/tiled/vector/NativeTiled2dMapVectorLayerSelectionCallbackInterface.cpp (2)
  • 30-40: The implementation of didMultiSelectLayerFeatures in NativeTiled2dMapVectorLayerSelectionCallbackInterface.cpp correctly bridges the multi-selection functionality from Java to C++. This ensures that the feature works as expected on Android.
  • 69-78: The JNI function Java_io_openmobilemaps_mapscore_shared_map_layers_tiled_vector_Tiled2dMapVectorLayerSelectionCallbackInterface_00024CppProxy_native_1didMultiSelectLayerFeatures correctly handles the conversion from Java types to C++ types, enabling the multi-selection feature's functionality within the native code on Android.
shared/public/RasterVectorLayerDescription.h (1)
  • 147-147: The addition of a false parameter to the VectorLayerDescription constructor within RasterVectorLayerDescription correctly implements the multiselect functionality as disabled by default for raster vector layers. Ensure that all existing calls to this constructor are reviewed and updated if necessary to accommodate the new parameter.
shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonTile.cpp (1)
  • 330-345: The modifications to the onClickConfirmed method to support multiselect functionality are correctly implemented. The method now collects selected features into a vector when multiselect is enabled and appropriately delegates the selection logic based on the state of the multiselect flag. This change aligns with the objective of enabling multiselect functionality for polygon tiles.
shared/src/map/layers/tiled/vector/tiles/line/Tiled2dMapVectorLineTile.cpp (1)
  • 412-428: The modifications to the onClickConfirmed method to support multiselect functionality for line tiles are correctly implemented. The method now collects selected features into a vector when multiselect is enabled and appropriately delegates the selection logic based on the state of the multiselect flag. This change aligns with the objective of enabling multiselect functionality for line tiles.
shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonPatternTile.cpp (1)
  • 413-428: The modifications to the onClickConfirmed method to support multiselect functionality for polygon pattern tiles are correctly implemented. The method now collects selected features into a vector when multiselect is enabled and appropriately delegates the selection logic based on the state of the multiselect flag. This change aligns with the objective of enabling multiselect functionality for polygon pattern tiles.
shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cpp (3)
  • 233-241: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [226-238]

The implementation correctly introduces a layerMultiselect boolean variable to capture the multiselect metadata from the style JSON. However, it's important to ensure that this variable is utilized effectively in all relevant layer descriptions where multiselect functionality is applicable.

  • 308-309: The layerMultiselect variable is correctly passed to the LineVectorLayerDescription constructor, enabling multiselect functionality for line vector layers as intended.
  • 387-388: The layerMultiselect variable is correctly passed to the PolygonVectorLayerDescription constructor, enabling multiselect functionality for polygon vector layers as intended.

@@ -510,7 +510,7 @@ class SymbolVectorLayerDescription: public VectorLayerDescription {
SymbolVectorStyle style,
std::optional<int32_t> renderPassIndex,
std::shared_ptr<Value> interactable):
VectorLayerDescription(identifier, source, sourceId, minZoom, maxZoom, filter, renderPassIndex, interactable),
VectorLayerDescription(identifier, source, sourceId, minZoom, maxZoom, filter, renderPassIndex, interactable, false),
Copy link
Contributor

Choose a reason for hiding this comment

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

The constructor of SymbolVectorLayerDescription initializes VectorLayerDescription with a hardcoded false for the multiselect parameter. This contradicts the PR objectives of adding multiselect functionality.

- VectorLayerDescription(identifier, source, sourceId, minZoom, maxZoom, filter, renderPassIndex, interactable, false),
+ VectorLayerDescription(identifier, source, sourceId, minZoom, maxZoom, filter, renderPassIndex, interactable, true),

Consider making multiselect a parameter of SymbolVectorLayerDescription's constructor to allow dynamic control over this feature.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
VectorLayerDescription(identifier, source, sourceId, minZoom, maxZoom, filter, renderPassIndex, interactable, false),
VectorLayerDescription(identifier, source, sourceId, minZoom, maxZoom, filter, renderPassIndex, interactable, true),

@@ -360,7 +365,7 @@ Tiled2dMapVectorLayerParserResult Tiled2dMapVectorLayerParserHelper::parseStyleJ
filter,
style,
renderPassIndex,
interactable);
interactable); // in-layer layerMultiselect not yet supported
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment indicates that in-layer layerMultiselect support is not yet implemented for SymbolVectorLayerDescription. This is a missed opportunity to fully integrate multiselect functionality across all layer types. Consider extending the multiselect support to symbol vector layers as well.

-                                                                            interactable); // in-layer layerMultiselect not yet supported
+                                                                            interactable, layerMultiselect);

Ensure that the SymbolVectorLayerDescription constructor and class definition are updated accordingly to support this parameter.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
interactable); // in-layer layerMultiselect not yet supported
interactable, layerMultiselect);

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.

2 participants