-
Notifications
You must be signed in to change notification settings - Fork 18
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
Get Indexed Layers / Restrict Camera Visible Rect #592
Get Indexed Layers / Restrict Camera Visible Rect #592
Conversation
WalkthroughThe recent updates introduce new functionalities across the map and camera interfaces, focusing on indexed layers and bounds restrictions. These changes enhance the map's capabilities by allowing better layer management and control over the visible map area. The introduction of Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
8586653
to
2f77f6c
Compare
2f77f6c
to
dbd0a9f
Compare
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
djinni/yaml/indexed_layer.yaml
is excluded by:!**/*.yaml
djinni/yaml/indexed_layer_interface.yaml
is excluded by:!**/*.yaml
Files selected for processing (24)
- bridging/android/java/io/openmobilemaps/mapscore/shared/map/IndexedLayerInterface.kt (1 hunks)
- bridging/android/java/io/openmobilemaps/mapscore/shared/map/MapCamera2dInterface.kt (2 hunks)
- bridging/android/java/io/openmobilemaps/mapscore/shared/map/MapInterface.kt (2 hunks)
- bridging/android/jni/map/NativeIndexedLayerInterface.cpp (1 hunks)
- bridging/android/jni/map/NativeIndexedLayerInterface.h (1 hunks)
- bridging/android/jni/map/NativeMapCamera2dInterface.cpp (1 hunks)
- bridging/android/jni/map/NativeMapInterface.cpp (2 hunks)
- bridging/ios/MCIndexedLayerInterface+Private.h (1 hunks)
- bridging/ios/MCIndexedLayerInterface+Private.mm (1 hunks)
- bridging/ios/MCIndexedLayerInterface.h (1 hunks)
- bridging/ios/MCMapCamera2dInterface+Private.mm (1 hunks)
- bridging/ios/MCMapCamera2dInterface.h (1 hunks)
- bridging/ios/MCMapInterface+Private.mm (2 hunks)
- bridging/ios/MCMapInterface.h (2 hunks)
- djinni/map/core.djinni (3 hunks)
- shared/public/IndexedLayerInterface.h (1 hunks)
- shared/public/MapCamera2dInterface.h (1 hunks)
- shared/public/MapInterface.h (2 hunks)
- shared/src/map/MapScene.cpp (3 hunks)
- shared/src/map/MapScene.h (1 hunks)
- shared/src/map/camera/MapCamera2d.cpp (11 hunks)
- shared/src/map/camera/MapCamera2d.h (3 hunks)
- shared/src/map/layers/IndexedLayer.cpp (1 hunks)
- shared/src/map/layers/IndexedLayer.h (1 hunks)
Files skipped from review due to trivial changes (3)
- bridging/ios/MCIndexedLayerInterface+Private.h
- bridging/ios/MCIndexedLayerInterface.h
- shared/public/IndexedLayerInterface.h
Additional comments: 37
shared/src/map/layers/IndexedLayer.h (1)
- 1-26: LGTM!
shared/src/map/layers/IndexedLayer.cpp (1)
- 1-22: LGTM!
bridging/android/java/io/openmobilemaps/mapscore/shared/map/IndexedLayerInterface.kt (1)
- 1-41: LGTM!
bridging/android/jni/map/NativeIndexedLayerInterface.h (1)
- 1-47: LGTM!
bridging/ios/MCMapCamera2dInterface.h (1)
- 95-95: LGTM!
shared/public/MapCamera2dInterface.h (1)
- 88-88: LGTM!
bridging/android/jni/map/NativeIndexedLayerInterface.cpp (1)
- 1-59: LGTM!
bridging/ios/MCMapInterface.h (1)
- 59-59: LGTM!
bridging/ios/MCIndexedLayerInterface+Private.mm (1)
- 1-102: LGTM!
shared/src/map/MapScene.h (1)
- 50-50: LGTM!
shared/public/MapInterface.h (1)
- 59-59: LGTM!
bridging/ios/MCMapInterface+Private.mm (1)
- 155-160: LGTM!
djinni/map/core.djinni (3)
- 42-42: LGTM!
- 71-74: LGTM!
- 170-170: LGTM!
shared/src/map/camera/MapCamera2d.h (3)
- 134-134: LGTM!
- 183-183: LGTM!
- 223-223: LGTM!
bridging/ios/MCMapCamera2dInterface+Private.mm (1)
- 276-280: LGTM!
bridging/android/java/io/openmobilemaps/mapscore/shared/map/MapInterface.kt (2)
- 43-44: LGTM!
- 167-172: LGTM!
bridging/android/jni/map/NativeMapInterface.cpp (2)
- 9-9: LGTM!
- 163-171: LGTM!
shared/src/map/MapScene.cpp (1)
- 98-105: LGTM!
bridging/android/java/io/openmobilemaps/mapscore/shared/map/MapCamera2dInterface.kt (2)
- 81-82: The addition of
setBoundsRestrictWholeVisibleRect
aligns with the PR objectives to enhance camera control functionalities by allowing the restriction of the camera's visible rectangle. Ensure corresponding implementations handle this new abstract method appropriately.- 300-305: The implementation of
setBoundsRestrictWholeVisibleRect
in the CppProxy class correctly asserts object validity before calling the native method. This ensures the method is not called on a destroyed object, aligning with the error handling pattern used throughout the class.bridging/android/jni/map/NativeMapCamera2dInterface.cpp (1)
- 317-323: The addition of
native_setBoundsRestrictWholeVisibleRect
correctly implements the JNI bridge for the newly addedsetBoundsRestrictWholeVisibleRect
method in the Kotlin interface. The use of::djinni::Bool::toCpp
for converting the JNI boolean parameter to C++ is consistent with the rest of the file.shared/src/map/camera/MapCamera2d.cpp (10)
- 76-82: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [79-98]
The use of structured bindings for
positionMapSystem
andadjustedZoom
fromgetBoundsCorrectedCoords
is a good practice for readability and maintainability. However, ensure that all calls tosetZoom
within the class now correctly useadjustedZoom
to maintain consistency.
- 111-117: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [114-133]
Similar to the previous comment, the structured bindings usage here is consistent and improves code clarity. It's important to verify that the animation logic correctly handles the adjusted position and zoom, especially in the completion handlers where the final state is set.
- 263-269: The adjustment of
coordAnimation
andzoomAnimation
end values based on padding corrections is a critical update for ensuring animations reflect the actual visible area considering padding. This change enhances the responsiveness and accuracy of camera movements. Ensure that similar logic is applied consistently wherever animations are used.- 279-285: This segment mirrors the adjustments made for
setPaddingLeft
, applied tosetPaddingRight
. Consistency in handling padding adjustments for all sides is crucial for maintaining a uniform user experience. Verify that padding values are validated to prevent negative or excessively large values that could distort the camera view.- 295-301: The adjustments for
setPaddingTop
follow the same pattern as for other padding setters, ensuring that the camera's view is correctly adjusted for padding at the top. Consistency in handling across different padding directions is maintained. Again, validate padding inputs.- 311-317: Adjustments in
setPaddingBottom
are consistent with the handling of other padding directions. This ensures that the camera's view accounts for bottom padding correctly. It's important to maintain this consistency across all padding setters for a coherent user experience.- 821-823: The call to
getBoundsCorrectedCoords
withinsetBounds
ensures that when the map bounds are updated, the camera's center position and zoom are also adjusted accordingly to remain within the new bounds. This is crucial for preventing the camera from displaying areas outside the defined map bounds.- 843-893: The
getBoundsCorrectedCoords
method's implementation to handle both scenarios ofconfig.boundsRestrictWholeVisibleRect
being true or false is comprehensive. However, ensure that the calculations fortargetScaleDiffFactorX
andtargetScaleDiffFactorY
correctly account for the visible area's aspect ratio to prevent distortion. Additionally, verify that the adjustments made tonewPosition
andnewZoom
are accurate and maintain the intended view within bounds.- 927-929: The call to
getBoundsCorrectedCoords
withinclampCenterToPaddingCorrectedBounds
ensures that any adjustments to the camera's position or zoom factor due to changes in padding or bounds are correctly applied. This method's invocation in various setters helps maintain the camera's view within the desired constraints.- 937-940: The addition of
setBoundsRestrictWholeVisibleRect
allows for dynamic toggling of how bounds restrictions are applied to the visible rectangle. This flexibility is beneficial for different mapping scenarios. Ensure that this setting is correctly applied across all relevant camera adjustments to maintain consistent behavior.
Summary by CodeRabbit