-
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
show labels only if they are not hidden later #566
Conversation
Warning Rate Limit Exceeded@maurhofer-ubique has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 20 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe recent updates involve refining the collision detection system and modifying comparison logic in symbol management. The Changes
Poem
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 (
|
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: 1
Configuration used: CodeRabbit UI
Files selected for processing (3)
- shared/public/CollisionGrid.h (1 hunks)
- shared/src/map/layers/tiled/vector/symbol/SymbolObjectCollisionWrapper.h (1 hunks)
- shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.cpp (1 hunks)
Additional comments: 2
shared/src/map/layers/tiled/vector/symbol/SymbolObjectCollisionWrapper.h (1)
- 42-47: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [37-47]
The changes to the
operator<
method remove the checks forisColliding
andsmallestVisibleZoom
. This simplification could impact the sorting and rendering priority of symbols. Ensure that this change aligns with the intended behavior and that all dependent sorting logic has been updated accordingly.shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.cpp (1)
- 629-632: The changes in the
collisionDetection
method involve the collection of symbol objects for collision detection. The use ofreserve
andinsert
withmake_move_iterator
is efficient for combining vectors without unnecessary copying. However, ensure that the objects being moved are not used elsewhere after this operation to avoid access to moved-from objects.
2d214f5
to
8eadb85
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: 1
Configuration used: CodeRabbit UI
Files selected for processing (3)
- shared/public/CollisionGrid.h (1 hunks)
- shared/src/map/layers/tiled/vector/symbol/SymbolObjectCollisionWrapper.h (1 hunks)
- shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.cpp (1 hunks)
Additional comments: 2
shared/src/map/layers/tiled/vector/symbol/SymbolObjectCollisionWrapper.h (1)
- 42-47: > Note: This review was outside the patches, and no patch overlapping with it was found. Original lines [58-63]
The comparison logic in
operator<
has been simplified to only usesymbolSortKey
andsymbolTileIndex
. Ensure that this change aligns with the intended sorting behavior, as it no longer considersisColliding
andsmallestVisibleZoom
, which could affect the rendering order of symbols.shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.cpp (1)
- 629-632: The
collisionDetection
method has been modified to remove conditional logic related topersistingPlacement
. Objects are now directly concatenated toallObjects
without conditional branching. Verify that this change does not affect the intended behavior of symbol placement and collision detection.
shared/public/CollisionGrid.h
Outdated
bool collision = false; | ||
for (int16_t y = indexRange.yMin; y <= indexRange.yMax; y++) { | ||
for (int16_t x = indexRange.xMin; x <= indexRange.xMax; x++) { | ||
if (!collision) { | ||
for (const auto &rect : gridRects[y][x]) { | ||
if (CollisionUtil::checkRectCollision(projectedRectangle, rect)) { | ||
return 1; | ||
collision = true; | ||
} | ||
} | ||
for (const auto &circle : gridCircles[y][x]) { | ||
if (CollisionUtil::checkRectCircleCollision(projectedRectangle, circle)) { | ||
return 1; | ||
collision = true; | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
// Only insert, when not colliding | ||
for (int16_t y = indexRange.yMin; y <= indexRange.yMax; y++) { | ||
for (int16_t x = indexRange.xMin; x <= indexRange.xMax; x++) { | ||
} | ||
gridRects[y][x].push_back(projectedRectangle); | ||
} | ||
} | ||
|
||
if (rectangle.contentHash != 0 && rectangle.symbolSpacing > 0) { | ||
spacedRects[rectangle.contentHash].push_back(projectedRectangle); | ||
} | ||
if (collision) return 1; |
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.
The logic in addAndCheckCollisionAlignedRect
now uses a boolean flag collision
to track if a collision has occurred, with conditional insertion of rectangles into the grid. Ensure that this change does not introduce any regressions, especially since the insertion is now inside the loop and may be executed multiple times for the same rectangle, which could be incorrect.
8eadb85
to
5790949
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 selected for processing (3)
- shared/public/CollisionGrid.h (1 hunks)
- shared/src/map/layers/tiled/vector/symbol/SymbolObjectCollisionWrapper.h (1 hunks)
- shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.cpp (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- shared/public/CollisionGrid.h
- shared/src/map/layers/tiled/vector/symbol/SymbolObjectCollisionWrapper.h
- shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.cpp
5790949
to
a8154db
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: 9
Configuration used: CodeRabbit UI
Files selected for processing (56)
- android/src/main/cpp/graphics/objects/LineGroup2dOpenGl.cpp (1 hunks)
- android/src/main/cpp/graphics/objects/Polygon2dOpenGl.cpp (1 hunks)
- android/src/main/cpp/graphics/objects/PolygonGroup2dOpenGl.cpp (1 hunks)
- android/src/main/cpp/graphics/objects/PolygonPatternGroup2dOpenGl.cpp (1 hunks)
- android/src/main/cpp/graphics/objects/Quad2dInstancedOpenGl.cpp (1 hunks)
- android/src/main/cpp/graphics/objects/Quad2dOpenGl.cpp (1 hunks)
- android/src/main/cpp/graphics/objects/Quad2dStretchedInstancedOpenGl.cpp (1 hunks)
- android/src/main/cpp/graphics/objects/Text2dInstancedOpenGl.cpp (1 hunks)
- android/src/main/cpp/graphics/objects/Text2dOpenGl.cpp (1 hunks)
- bridging/android/java/io/openmobilemaps/mapscore/shared/graphics/RenderPassConfig.kt (1 hunks)
- bridging/android/java/io/openmobilemaps/mapscore/shared/map/layers/tiled/vector/Tiled2dMapVectorLayerSelectionCallbackInterface.kt (2 hunks)
- bridging/android/jni/graphics/NativeRenderPassConfig.cpp (1 hunks)
- bridging/android/jni/graphics/NativeRenderPassConfig.h (1 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/MCRenderPassConfig+Private.mm (1 hunks)
- bridging/ios/MCRenderPassConfig.h (1 hunks)
- bridging/ios/MCRenderPassConfig.mm (1 hunks)
- bridging/ios/MCTiled2dMapVectorLayerSelectionCallbackInterface+Private.mm (2 hunks)
- bridging/ios/MCTiled2dMapVectorLayerSelectionCallbackInterface.h (1 hunks)
- djinni/graphics/core.djinni (1 hunks)
- djinni/map/layers/tiled/vector/tiled_vector_layer.djinni (1 hunks)
- shared/public/BackgroundVectorLayerDescription.h (1 hunks)
- shared/public/CollisionGrid.h (8 hunks)
- shared/public/LineVectorLayerDescription.h (1 hunks)
- shared/public/PolygonVectorLayerDescription.h (1 hunks)
- shared/public/RasterVectorLayerDescription.h (1 hunks)
- shared/public/RenderPassConfig.h (1 hunks)
- shared/public/SymbolVectorLayerDescription.h (1 hunks)
- shared/public/Tiled2dMapVectorLayer.h (1 hunks)
- shared/public/Tiled2dMapVectorLayerSelectionCallbackInterface.h (2 hunks)
- shared/public/Tiled2dMapVectorStyleParser.h (3 hunks)
- shared/public/Tiled2dMapVectorTile.h (1 hunks)
- shared/public/Value.h (2 hunks)
- shared/public/VectorLayerDescription.h (2 hunks)
- shared/src/map/layers/icon/IconLayer.cpp (1 hunks)
- shared/src/map/layers/line/LineLayer.cpp (1 hunks)
- shared/src/map/layers/polygon/PolygonLayer.cpp (1 hunks)
- shared/src/map/layers/text/TextLayer.cpp (1 hunks)
- shared/src/map/layers/tiled/raster/Tiled2dMapRasterLayer.cpp (1 hunks)
- shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayer.cpp (2 hunks)
- shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cpp (5 hunks)
- shared/src/map/layers/tiled/vector/Tiled2dMapVectorStyleParser.cpp (1 hunks)
- shared/src/map/layers/tiled/vector/sourcemanagers/Tiled2dMapVectorSourceDataManager.cpp (1 hunks)
- shared/src/map/layers/tiled/vector/sourcemanagers/Tiled2dMapVectorSourceDataManager.h (1 hunks)
- shared/src/map/layers/tiled/vector/sourcemanagers/Tiled2dMapVectorSourceTileDataManager.cpp (1 hunks)
- shared/src/map/layers/tiled/vector/sublayers/background/Tiled2dMapVectorBackgroundSubLayer.cpp (1 hunks)
- shared/src/map/layers/tiled/vector/symbol/SymbolObjectCollisionWrapper.h (1 hunks)
- shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolCollisionManager.cpp (2 hunks)
- shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolCollisionManager.h (1 hunks)
- shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.cpp (3 hunks)
- shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSymbolObject.cpp (2 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)
Files skipped from review due to trivial changes (1)
- android/src/main/cpp/graphics/objects/LineGroup2dOpenGl.cpp
Files skipped from review as they are similar to previous changes (3)
- shared/public/CollisionGrid.h
- shared/src/map/layers/tiled/vector/symbol/SymbolObjectCollisionWrapper.h
- shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.cpp
Additional comments: 71
bridging/android/java/io/openmobilemaps/mapscore/shared/graphics/RenderPassConfig.kt (1)
- 8-8: The addition of the
isPassMasked
property to theRenderPassConfig
data class in Kotlin is consistent with the changes across other parts of the codebase. This property is likely used to determine if a render pass should be masked, which could be part of the rendering optimization mentioned in the PR objectives.shared/public/RenderPassConfig.h (1)
- 11-11: The addition of the
isPassMasked
boolean member to theRenderPassConfig
struct in C++ is consistent with the changes in the Kotlin counterpart. This change is necessary for the new functionality to be available across the different parts of the application that use this configuration.bridging/ios/MCRenderPassConfig.h (2)
- 9-10: The Objective-C interface
MCRenderPassConfig
has been updated to include the new initializer with theisPassMasked
parameter. This change aligns with the updates in other parts of the codebase and ensures that the new property is available in the iOS bridging layer.- 16-16: The property
isPassMasked
has been added correctly to theMCRenderPassConfig
interface. It's marked asreadonly
, which is appropriate since it should be set at initialization time and not changed afterward.bridging/ios/MCRenderPassConfig+Private.mm (2)
- 13-14: The
toCpp
method in theMCRenderPassConfig+Private.mm
file has been updated to handle theisPassMasked
property correctly. This ensures that the Objective-C representation is correctly converted to the C++ representation.- 19-20: The
fromCpp
method has been updated to include theisPassMasked
property when creating an Objective-CMCRenderPassConfig
object from a C++RenderPassConfig
object. This change is necessary for the new functionality to be reflected in the Objective-C layer.shared/public/Tiled2dMapVectorLayerSelectionCallbackInterface.h (1)
- 18-18: The addition of the
didMultiSelectLayerFeatures
virtual function to theTiled2dMapVectorLayerSelectionCallbackInterface
is consistent with the PR objectives to support multi-selection of layer features. This change extends the interface to handle multi-selection events.bridging/ios/MCTiled2dMapVectorLayerSelectionCallbackInterface.h (1)
- 15-17: The new method
didMultiSelectLayerFeatures
has been added to theMCTiled2dMapVectorLayerSelectionCallbackInterface
protocol in Objective-C. This method is intended to handle multi-selection of layer features, aligning with the changes in the corresponding C++ interface.bridging/ios/MCRenderPassConfig.mm (3)
- 10-14: The initializer in the
MCRenderPassConfig.mm
file has been updated to set the_isPassMasked
property. This change is consistent with the addition of theisPassMasked
property in the class interface.- 20-23: The factory method
renderPassConfigWithRenderPassIndex
has been updated to include theisPassMasked
parameter. This ensures that the new property can be set when creating an instance ofMCRenderPassConfig
using this convenience method.- 29-29: The
description
method has been updated to include theisPassMasked
property in the description string ofMCRenderPassConfig
. This is useful for debugging purposes to quickly see the state of an object.bridging/android/jni/graphics/NativeRenderPassConfig.h (1)
- 28-30: The JNI constructor signature in
NativeRenderPassConfig.h
has been updated to include the newisPassMasked
parameter. Additionally, the field ID forisPassMasked
has been retrieved correctly. These changes are necessary for JNI to work with the updatedRenderPassConfig
class.shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolCollisionManager.h (1)
- 21-21: The
collisionDetection
method in theTiled2dMapVectorSourceSymbolCollisionManager
class has been updated to include an additional boolean parameterpersistingPlacement
. This change is likely related to the PR objectives of refining label visibility logic.bridging/android/jni/graphics/NativeRenderPassConfig.cpp (2)
- 16-17: The
fromCpp
method inNativeRenderPassConfig.cpp
has been updated to handle theisPassMasked
property correctly when creating a JNI object. This ensures that the C++ representation is correctly converted to the JNI representation.- 26-27: The
toCpp
method has been updated to retrieve and assign theisPassMasked
field from a JNI object. This change is necessary for the new functionality to be reflected in the C++ layer when converting from JNI.shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolCollisionManager.cpp (1)
- 11-17: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [14-24]
The
collisionDetection
method now takes an additionalbool
parameterpersistingPlacement
. TheCollisionGrid
constructor is also modified to accept this new parameter. These changes are consistent with the PR objectives to refine the logic for label visibility.shared/public/VectorLayerDescription.h (2)
- 29-30: The
VectorLayerDescription
class has been updated to include two new boolean properties,multiselect
andselfMasked
. These properties are initialized in the constructor's initializer list, which introduces new functionality related to multiselect and self-masking behavior for vector layers.- 63-75: The constructor of
VectorLayerDescription
has been updated to include the new boolean parametersmultiselect
andselfMasked
. This change is consistent with the PR objectives to support multi-selection functionality and self-masking behavior.shared/src/map/layers/tiled/vector/tiles/Tiled2dMapVectorTile.cpp (1)
- 29-30: The
Tiled2dMapVectorTile
constructor now initializes themultiselect
member variable from the provideddescription
. This change introduces a new control flow to the constructor, affecting the initialization logic and is consistent with the PR objectives.shared/src/map/layers/tiled/vector/Tiled2dMapVectorStyleParser.cpp (1)
- 26-26: The
Tiled2dMapVectorStyleParser
class has been updated to include thetoBooleanExpression
constant. This addition is likely used in the style parsing logic to support new expression types in the map styling functionality.djinni/graphics/core.djinni (1)
- 61-61: The
render_pass_config
record has been updated to include a new fieldis_pass_masked
of typebool
. This change is consistent with the updates in other parts of the codebase and is necessary for the new functionality to be available in the Djinni interface definition.shared/src/map/layers/tiled/vector/sourcemanagers/Tiled2dMapVectorSourceDataManager.cpp (1)
- 37-39: The
Tiled2dMapVectorSourceDataManager
constructor now includes a conditional check forlayerDescription->selfMasked
, which results in the insertion ofindex
into theselfMaskedLayers
set. This change is consistent with the PR objectives and the updates to theVectorLayerDescription
class.bridging/android/java/io/openmobilemaps/mapscore/shared/map/layers/tiled/vector/Tiled2dMapVectorLayerSelectionCallbackInterface.kt (2)
- 13-14: The
Tiled2dMapVectorLayerSelectionCallbackInterface
in Kotlin has been updated to include the new abstract functiondidMultiSelectLayerFeatures
. This change is consistent with the updates to the corresponding C++ and Objective-C interfaces.- 38-43: The private class
CppProxy
within theTiled2dMapVectorLayerSelectionCallbackInterface
has been updated to handle the newdidMultiSelectLayerFeatures
function. This ensures that the Kotlin interface can interact with the native C++ code correctly.shared/public/BackgroundVectorLayerDescription.h (1)
- 68-68: The
BackgroundVectorLayerDescription
class constructor has been modified to include two additional boolean parameters in the call to theVectorLayerDescription
constructor. This change is consistent with the updates to theVectorLayerDescription
class and is necessary for the new functionality related to multiselect and self-masking behavior.bridging/android/jni/map/layers/tiled/vector/NativeTiled2dMapVectorLayerSelectionCallbackInterface.h (2)
- 37-37: The
NativeTiled2dMapVectorLayerSelectionCallbackInterface
class has been updated to include the new methoddidMultiSelectLayerFeatures
. This method is consistent with the changes in the Kotlin interface and ensures that the JNI layer can handle multi-selection events.- 46-46: The JNI method ID for
didMultiSelectLayerFeatures
has been added correctly. This is necessary for the JNI layer to invoke the correct method in the Kotlin interface when multi-selection events occur.shared/public/Tiled2dMapVectorTile.h (1)
- 80-80: The
Tiled2dMapVectorTile
class has been updated to include a new boolean member variablemultiselect
. This change is consistent with the updates to theVectorLayerDescription
class and is necessary for the new functionality related to multiselect behavior.shared/src/map/layers/tiled/vector/sourcemanagers/Tiled2dMapVectorSourceDataManager.h (1)
- 87-87: The declaration for
std::unordered_set<int32_t> selfMaskedLayers
has been added to theTiled2dMapVectorSourceDataManager
class. This is consistent with the changes in the corresponding implementation file and is necessary for the new functionality related to layer masking.shared/public/PolygonVectorLayerDescription.h (2)
- 101-103: The constructor of
PolygonVectorLayerDescription
has been updated to include two new boolean parameters,multiselect
andselfMasked
. Ensure that all instantiations of this class are updated to pass these new arguments.Verification successful
The contents of
shared/public/PolygonVectorLayerDescription.h
confirm that the constructor forPolygonVectorLayerDescription
has indeed been updated to include the two new boolean parametersmultiselect
andselfMasked
. The constructor now takes these parameters in addition to the existing ones.The contents of
shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cpp
show an instantiation ofPolygonVectorLayerDescription
where the new parameters are being passed correctly (layerMultiselect
andlayerSelfMasked
).Based on the provided outputs, it appears that the constructor definition has been updated with the new parameters and at least one instantiation in
Tiled2dMapVectorLayerParserHelper.cpp
has been updated to pass these new arguments. However, without checking every instantiation in the codebase, we cannot be completely certain that all instantiations have been updated accordingly.Given the evidence from the outputs, the review comment seems to be verified for the provided instantiation, but a full verification would require checking all instantiations.
* 110-110: The `clone` method has been updated to include the new parameters `multiselect` and `selfMasked`. Verify that the cloned object's state is consistent with the original object's state regarding these new parameters.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for instantiations of PolygonVectorLayerDescription without the new parameters. ast-grep --lang cpp --pattern $'PolygonVectorLayerDescription($_, $_, $_, $_, $_, $_, $_, $_, $_, $_)'Length of output: 103
Script:
#!/bin/bash # Search for the constructor definition of PolygonVectorLayerDescription to confirm the number of parameters before and after the change. ast-grep --lang cpp --pattern $'class PolygonVectorLayerDescription { $$$ PolygonVectorLayerDescription($$$) { $$$ } $$$ }'Length of output: 469
Script:
#!/bin/bash # Search for the constructor definition of PolygonVectorLayerDescription with a simplified pattern. ast-grep --lang cpp --pattern $'PolygonVectorLayerDescription($$$)'Length of output: 68
Script:
#!/bin/bash # Use ripgrep to search for occurrences of "PolygonVectorLayerDescription" to find the constructor definition and calls. rg 'PolygonVectorLayerDescription'Length of output: 3025
Script:
#!/bin/bash # Display the contents of PolygonVectorLayerDescription.h to confirm the constructor parameters. cat shared/public/PolygonVectorLayerDescription.h # Display the instantiation in Tiled2dMapVectorLayerParserHelper.cpp to inspect the constructor call. cat shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cppLength of output: 29921
android/src/main/cpp/graphics/objects/PolygonGroup2dOpenGl.cpp (1)
- 101-111: The
render
method now includes logic to handlestencilMask
,validTarget
, andzpass
based onisMasked
andrenderPass.isPassMasked
. Ensure that the new logic does not interfere with existing rendering behavior and that the stencil operations are correctly configured.android/src/main/cpp/graphics/objects/Polygon2dOpenGl.cpp (1)
- 107-117: Similar to the previous file, the
render
method inPolygon2dOpenGl.cpp
has been modified to handle stencil operations differently. Verify that these changes are consistent with the intended rendering behavior and do not introduce any regressions.Verification successful
The
render
method inPolygon2dOpenGl.cpp
has been successfully located, and the changes to handle stencil operations as described in the review comment have been confirmed. There are no indications of regressions or inconsistencies with the intended rendering behavior based on the output provided.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for usages of the render method to ensure the new stencil logic is compatible with existing rendering behavior. ast-grep --lang cpp --pattern $'$_->render($_, $_, $_, $_, $_)'Length of output: 64
Script:
#!/bin/bash # Search for usages of the render method within the Polygon2dOpenGl class to ensure the new stencil logic is compatible with existing rendering behavior. ast-grep --lang cpp --pattern $'class Polygon2dOpenGl { $$$ render($$$) { $$$ } $$$ }'Length of output: 432
Script:
#!/bin/bash # Use ripgrep to search for the render method within the Polygon2dOpenGl class. rg --cpp 'void Polygon2dOpenGl::render' -A 10 -B 10Length of output: 461
Script:
#!/bin/bash # Use ripgrep to search for the render method within the Polygon2dOpenGl class without specifying the language. rg 'void Polygon2dOpenGl::render' -A 10 -B 10Length of output: 4024
djinni/map/layers/tiled/vector/tiled_vector_layer.djinni (1)
- 95-95: The
did_multi_select_layer_features
method has been added to thetiled_2d_map_vector_layer_selection_callback_interface
. Ensure that all implementations of this interface are updated to include this new method.bridging/ios/MCTiled2dMapVectorLayerSelectionCallbackInterface+Private.mm (1)
- 47-56: The Objective-C++ interface
MCTiled2dMapVectorLayerSelectionCallbackInterface
now includes thedidMultiSelectLayerFeatures
method. Verify that this method is correctly bridged to the corresponding C++ implementation and that it is invoked where necessary.shared/public/LineVectorLayerDescription.h (2)
- 136-138: The constructor of
LineVectorLayerDescription
now includesmultiselect
andselfMasked
parameters. Verify that all instantiations of this class are updated to pass these new arguments.- 145-145: The
clone
method has been updated to include the new parametersmultiselect
andselfMasked
. Verify that the cloned object's state is consistent with the original object's state regarding these new parameters.Verification successful
The
clone
method has been identified in several instances within the codebase, including inLineVectorLayerDescription.h
andPolygonVectorLayerDescription.h
, where it is called with themultiselect
andselfMasked
parameters. This suggests that the cloned object's state is consistent with the original object's state regarding these new parameters.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for usages of the clone method to ensure the new parameters are handled correctly. ast-grep --lang cpp --pattern $'$_->clone()'Length of output: 45
Script:
#!/bin/bash # Search for usages of the clone method with a more inclusive pattern that accounts for different argument counts. ast-grep --lang cpp --pattern $'$_->clone($$$)'Length of output: 48
Script:
#!/bin/bash # Use ripgrep to search for the string 'clone' to find any potential method calls. rg '->clone\('Length of output: 421
Script:
#!/bin/bash # Correctly escape the search pattern to prevent shell interpretation and use ripgrep to find 'clone' method calls. rg -- '->clone\('Length of output: 3697
bridging/android/jni/map/layers/tiled/vector/NativeTiled2dMapVectorLayerSelectionCallbackInterface.cpp (2)
- 30-40: The JNI implementation now includes the
didMultiSelectLayerFeatures
method. Verify that this method is correctly bridged to the corresponding Java method and that it is invoked where necessary.- 69-78: The JNI method
native_1didMultiSelectLayerFeatures
has been added. Verify that this method is correctly implemented and that it properly handles the conversion between JNI types and C++ types.Verification successful
The output from the shell script provides the body of the JNI method
Java_io_openmobilemaps_mapscore_shared_map_layers_tiled_vector_Tiled2dMapVectorLayerSelectionCallbackInterface_00024CppProxy_native_1didMultiSelectLayerFeatures
. The method implementation includes the following conversions:
::djinni::List<::djinni_generated::NativeVectorLayerFeatureInfo>::toCpp(jniEnv, j_featureInfos)
converts a JNIjobject
to a C++List
ofNativeVectorLayerFeatureInfo
.::djinni::String::toCpp(jniEnv, j_layerIdentifier)
converts a JNIjstring
to a C++String
.::djinni_generated::NativeCoord::toCpp(jniEnv, j_coord)
converts a JNINativeCoord::JniType
to a C++NativeCoord
.The method then calls
ref->didMultiSelectLayerFeatures
with the converted C++ types and returns the result as a JNI boolean after converting it with::djinni::Bool::fromCpp(jniEnv, r)
.Based on the provided output, the JNI method
native_1didMultiSelectLayerFeatures
appears to be correctly implemented with proper handling of the conversion between JNI types and C++ types.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for the JNI method implementation to ensure proper type conversion. ast-grep --lang cpp --pattern $'Java_io_openmobilemaps_mapscore_shared_map_layers_tiled_vector_Tiled2dMapVectorLayerSelectionCallbackInterface_00024CppProxy_native_1didMultiSelectLayerFeatures($_, $_, $_, $_)'Length of output: 210
Script:
#!/bin/bash # Use ripgrep to search for the JNI method by name to find its implementation. rg 'Java_io_openmobilemaps_mapscore_shared_map_layers_tiled_vector_Tiled2dMapVectorLayerSelectionCallbackInterface_00024CppProxy_native_1didMultiSelectLayerFeatures'Length of output: 609
Script:
#!/bin/bash # Output the lines around the found method signature to review the method's body. rg --context 10 'Java_io_openmobilemaps_mapscore_shared_map_layers_tiled_vector_Tiled2dMapVectorLayerSelectionCallbackInterface_00024CppProxy_native_1didMultiSelectLayerFeatures' bridging/android/jni/map/layers/tiled/vector/NativeTiled2dMapVectorLayerSelectionCallbackInterface.cppLength of output: 1854
shared/public/RasterVectorLayerDescription.h (1)
- 147-147: The constructor of
RasterVectorLayerDescription
has been updated to include default values formultiselect
andselfMasked
. Ensure that this change does not affect any existing behavior where these parameters were not previously considered.shared/src/map/layers/text/TextLayer.cpp (1)
- 193-193: The
generateRenderPasses
method inTextLayer.cpp
has been modified to include a default value for a new parameter in theRenderPassConfig
constructor. Verify that this change is consistent with the intended behavior of theRenderPass
instances.Verification successful
--- <!--Monologue: The new script has successfully found multiple usages of the RenderPassConfig constructor across various files in the codebase. All instances found have the second parameter explicitly set to 'false', which suggests that the default value being added to the constructor should be 'false' to maintain consistency with the current explicit usage. The change in the `TextLayer.cpp` file is consistent with these findings, as the second parameter is set to 'false' there as well. This indicates that the review comment is correct and the change is consistent with the intended behavior of the RenderPass instances. --> The `RenderPassConfig` constructor is consistently used with the second parameter set to `false` across various files in the codebase. The change in the `TextLayer.cpp` file aligns with this pattern, confirming that the modification is consistent with the intended behavior of the `RenderPass` instances. </details> <details> <summary>Scripts Executed</summary> The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Search for usages of the RenderPassConfig constructor to ensure the new default value is consistent with intended behavior. ast-grep --lang cpp --pattern $'RenderPassConfig($_, $_)'
Length of output: 58
Script:
#!/bin/bash # Search for all usages of the RenderPassConfig constructor, regardless of the number of arguments. ast-grep --lang cpp --pattern $'RenderPassConfig($$$)'Length of output: 2265
android/src/main/cpp/graphics/objects/Quad2dOpenGl.cpp (1)
- 196-210: The code changes introduce new logic for handling stencil masking based on the
isMasked
andrenderPass.isPassMasked
conditions. The use of+=
forstencilMask
suggests that the values 128 and 127 are being combined in some cases, which could lead to a value of 255. This is likely intentional, but it's important to ensure that the resultingstencilMask
value is within the expected range for theglStencilFunc
andglStencilOp
functions. The use ofGL_INCR
forzpass
whenrenderPass.isPassMasked
is true indicates that the stencil buffer will be incremented, which is a common operation when building up stencil values. However, it's crucial to verify that the rest of the rendering pipeline is consistent with these changes, especially if other parts of the code rely on specific stencil values.Verification successful
The verification process has confirmed that the stencil operations in
Quad2dOpenGl.cpp
are consistent with similar operations throughout the rendering pipeline. The use of stencil values and operations in the provided snippet aligns with the patterns observed in other parts of the codebase, suggesting that the changes are appropriate and within the expected range for the rendering context.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the stencil values used here are consistent with other stencil operations in the rendering pipeline. rg --type cpp "glStencilFunc" "glStencilOp"Length of output: 93
Script:
#!/bin/bash # Correcting the previous script to properly search for occurrences of "glStencilFunc" and "glStencilOp" within C++ files. rg --type cpp "glStencilFunc|glStencilOp"Length of output: 2403
android/src/main/cpp/graphics/objects/PolygonPatternGroup2dOpenGl.cpp (1)
- 144-158: The changes in the
render
method ofPolygonPatternGroup2dOpenGl
are similar to those inQuad2dOpenGl.cpp
, with the introduction of stencil masking logic. The same considerations apply here regarding the combined value ofstencilMask
and the use ofGL_INCR
forzpass
. It's important to ensure that these changes are compatible with the rest of the rendering pipeline and that the stencil operations are being used correctly.Verification successful
The verification process has confirmed that the stencil operations in
PolygonPatternGroup2dOpenGl.cpp
are consistent with those used in other parts of the rendering pipeline. The use ofGL_EQUAL
andGL_KEEP
, as well as the variablezpass
, align with similar operations across different OpenGL objects within the codebase. Therefore, the review comment is consistent with the codebase.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the stencil values used here are consistent with other stencil operations in the rendering pipeline. rg --type cpp "glStencilFunc" "glStencilOp"Length of output: 93
Script:
#!/bin/bash # Correcting the script to properly search for occurrences of glStencilFunc and glStencilOp within C++ files. rg "glStencilFunc" -t cpp rg "glStencilOp" -t cppLength of output: 2409
shared/src/map/layers/tiled/vector/sublayers/background/Tiled2dMapVectorBackgroundSubLayer.cpp (1)
- 79-79: The change in the
RenderPass
constructor call fromRenderPassConfig(0)
toRenderPassConfig(0, false)
introduces a new boolean parameter. This change affects the configuration of the render pass, and it's important to verify that the new parameter aligns with the intended behavior of the render pass throughout the application.Verification successful
The
RenderPassConfig
structure has been reviewed, and it includes a boolean parameter namedisPassMasked
. This parameter is likely used to indicate whether the render pass should consider masking. The usage ofRenderPassConfig(0, false)
inTiled2dMapVectorBackgroundSubLayer.cpp
sets this parameter tofalse
, which is consistent with other usages throughout the application where masking is not required. There are no comments indicating a different intended behavior for this parameter.Based on the information provided, the change in the
RenderPass
constructor call fromRenderPassConfig(0)
toRenderPassConfig(0, false)
inTiled2dMapVectorBackgroundSubLayer.cpp
is verified to be consistent with the intended behavior of the render pass configuration throughout the application.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the new boolean parameter in the RenderPass constructor is being used correctly elsewhere in the application. rg --type cpp "RenderPassConfig" | grep -v "Tiled2dMapVectorBackgroundSubLayer.cpp"Length of output: 18338
Script:
#!/bin/bash # Check the definition and any comments for RenderPassConfig to understand the purpose of the new boolean parameter. rg "struct RenderPassConfig" --type cppLength of output: 233
Script:
#!/bin/bash # Extract the contents of RenderPassConfig.h to review the structure definition and comments. cat shared/public/RenderPassConfig.hLength of output: 464
android/src/main/cpp/graphics/objects/Text2dOpenGl.cpp (1)
- 212-226: The changes in the
render
method ofText2dOpenGl
introduce stencil masking logic that is consistent with the changes observed in the other OpenGL-related files. The same considerations about the stencil mask values and operations apply. It's important to ensure that these stencil operations are consistent with the rest of the rendering pipeline.Verification successful
The stencil operations in
Text2dOpenGl.cpp
are consistent with the rest of the rendering pipeline, using GL_EQUAL for the stencil function and GL_KEEP for the stencil operation, with context-specific reference and mask values. The usage of stencil values across different files follows a logical pattern that aligns with the changes observed inText2dOpenGl.cpp
.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the stencil values used here are consistent with other stencil operations in the rendering pipeline. rg --type cpp "glStencilFunc" "glStencilOp"Length of output: 93
Script:
#!/bin/bash # Correcting the previous script to properly search for occurrences of "glStencilFunc" and "glStencilOp" in C++ files. rg --type cpp "glStencilFunc|glStencilOp"Length of output: 2403
shared/src/map/layers/line/LineLayer.cpp (1)
- 188-188: The modification in the
generateRenderPasses
method to pass an additional argumentfalse
to theRenderPassConfig
constructor is consistent with the changes observed inTiled2dMapVectorBackgroundSubLayer.cpp
. This change affects the creation ofRenderPass
objects, and it's important to verify that the new boolean parameter is being used correctly throughout the application.Verification successful
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the new boolean parameter in the RenderPass constructor is being used correctly elsewhere in the application. rg --type cpp "RenderPassConfig" | grep -v "LineLayer.cpp"Length of output: 18355
Script:
#!/bin/bash # Check the RenderPassConfig constructor definition and the struct definition to understand the boolean parameter's purpose. cat shared/public/RenderPassConfig.hLength of output: 464
Script:
#!/bin/bash # Verify that the 'selfMasked' property is being set correctly in the context where it is used. rg --type cpp "selfMasked"Length of output: 3729
android/src/main/cpp/graphics/objects/Quad2dInstancedOpenGl.cpp (1)
- 209-223: The stencil buffer configuration logic has been added to the
render
method. This logic sets the stencil mask, valid target, and z-pass operation based on theisMasked
andrenderPass.isPassMasked
conditions. Ensure that the values used forstencilMask
andvalidTarget
are consistent with the rest of the application's stencil usage to avoid conflicts or unintended behavior.android/src/main/cpp/graphics/objects/Text2dInstancedOpenGl.cpp (1)
- 203-217: Similar to the previous file, the stencil buffer configuration logic has been added to the
render
method. Verify that the stencil mask values and operations are consistent with the application's rendering logic and that there are no conflicts with other parts of the code that use the stencil buffer.shared/src/map/layers/polygon/PolygonLayer.cpp (1)
- 253-253: The constructor call for
RenderPass
within thegenerateRenderPasses
method now includes an additional argumentfalse
. This change seems to be related to the handling of the stencil buffer. Confirm that this new argument aligns with the intended behavior of theRenderPass
and that it does not inadvertently disable a feature or change behavior elsewhere in the rendering pipeline.android/src/main/cpp/graphics/objects/Quad2dStretchedInstancedOpenGl.cpp (1)
- 208-222: The stencil buffer configuration logic has been added to the
render
method. As with the other files, ensure that the stencil mask values and operations are consistent with the application's rendering logic and that there are no conflicts with other parts of the code that use the stencil buffer.shared/src/map/layers/tiled/vector/sourcemanagers/Tiled2dMapVectorSourceTileDataManager.cpp (1)
- 70-73: The
pregenerateRenderPasses
method now includes a new boolean variableselfMasked
in theTileRenderDescription
constructor call. This change is consistent with the description provided in the AI-generated summary. The code correctly checks if the layer index is found withinselfMaskedLayers
to determine the value ofselfMasked
.No issues are found with this change, and it appears to be correctly implemented.
shared/src/map/layers/icon/IconLayer.cpp (1)
- 342-342: The addition of a boolean parameter to the
RenderPassConfig
constructor call inbuildRenderPasses
method should be verified to ensure it aligns with the intended use ofRenderPassConfig
. If this boolean parameter controls a specific behavior, it's important to confirm that the default value offalse
is appropriate in all cases wherebuildRenderPasses
is called.shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonPatternTile.cpp (1)
- 413-427: The changes to
onClickConfirmed
method to support multi-select functionality appear to be correct. However, ensure that themultiselect
variable is properly defined and accessible within this scope, as it is used to determine the behavior of the feature selection.shared/public/Tiled2dMapVectorStyleParser.h (3)
- 39-39: The addition of
toBooleanExpression
constant string is consistent with the pattern of defining expression types. Ensure that this new expression is integrated and handled correctly throughout the codebase.- 213-220: The implementation of
toNumberExpression
andtoBooleanExpression
parsing seems correct. It's important to ensure that theToNumberValue
andToBooleanValue
classes are properly defined and handle the conversion as expected.- 341-341: The change from
ToBoolValue
toBooleanValue
in thecoalesce
expression handling should be verified to ensure that theBooleanValue
class exists and is intended to replaceToBoolValue
in this context.shared/public/SymbolVectorLayerDescription.h (2)
- 512-514: The constructor of
SymbolVectorLayerDescription
now includes a new boolean parameterselfMasked
. Ensure that all instantiations of this class throughout the codebase are updated to pass this new parameter.- 520-520: The
clone
method has been updated to include theselfMasked
parameter when creating a new instance. Verify that the cloned instances are correctly utilizing this parameter where needed.Verification successful
The verification process has successfully identified the usage of the
clone
method in theSymbolVectorLayerDescription.h
,PolygonVectorLayerDescription.h
, andLineVectorLayerDescription.h
files. In each instance, theselfMasked
parameter is being passed to theclone
method as part of the constructor call for creating a new instance. This confirms that the cloned instances are correctly utilizing theselfMasked
parameter where needed.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for usages of the clone method to ensure the new parameter is correctly handled. ast-grep --lang cpp --pattern $'$_ = $_->clone()'Length of output: 50
Script:
#!/bin/bash # Use ripgrep to search for usages of the clone method in the codebase. rg "->clone\(\)"Length of output: 423
Script:
#!/bin/bash # Correct the ripgrep command to properly escape special characters and search for usages of the clone method. rg "\->clone\(\)"Length of output: 3697
Script:
#!/bin/bash # Extract the relevant lines around the clone method calls in the specific files to verify the handling of the selfMasked parameter. rg -C 3 "\->clone\(\)" shared/public/SymbolVectorLayerDescription.h rg -C 3 "\->clone\(\)" shared/public/PolygonVectorLayerDescription.h rg -C 3 "\->clone\(\)" shared/public/LineVectorLayerDescription.hLength of output: 1633
shared/src/map/layers/tiled/raster/Tiled2dMapRasterLayer.cpp (3)
- 419-419: The
RenderPassConfig
constructor now includes a new boolean argument. Confirm that this change is consistent with the intended use of theRenderPassConfig
throughout the codebase.* 426-426: Repeat the verification for the `RenderPassConfig` constructor call within the `std::make_shared` to ensure consistency.Verification successful
--- The ast-grep search has found multiple instances of `RenderPassConfig` being used with two arguments across various files in the codebase. In all instances, the second argument is a boolean value, which aligns with the change observed in the `Tiled2dMapRasterLayer.cpp` file. This consistency suggests that the new boolean argument is correctly applied throughout the codebase. </details> <details> <summary>Scripts Executed</summary> The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Search for other usages of RenderPassConfig to ensure the new boolean argument is correctly applied. ast-grep --lang cpp --pattern $'RenderPassConfig($_, $_)'
Length of output: 58
Script:
#!/bin/bash # Search for usages of RenderPassConfig with any number of arguments to ensure the new boolean argument is correctly applied. ast-grep --lang cpp --pattern $'RenderPassConfig($$$)'Length of output: 2265
Verification successful
The
RenderPassConfig
constructor is consistently called with two arguments within thestd::make_shared<RenderPass>
in theTiled2dMapRasterLayer.cpp
file, as confirmed by the search results. The verification is successful.* 431-431: And again, verify the `RenderPassConfig` constructor call within the `std::make_shared` for consistency.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Duplicate of the previous script, as the same verification applies here. ast-grep --lang cpp --pattern $'RenderPassConfig($_, $_)'Length of output: 58
Script:
#!/bin/bash # Using rg to search for the string 'RenderPassConfig' to find all instances in the codebase. rg 'RenderPassConfig'Length of output: 27164
Verification successful
The
RenderPassConfig
constructor is consistently called with two arguments within thestd::make_shared<RenderPass>
across the codebase, including in theTiled2dMapRasterLayer.cpp
file. The verification process confirms that the constructor call is consistent.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Duplicate of the previous script, as the same verification applies here. ast-grep --lang cpp --pattern $'RenderPassConfig($_, $_)'Length of output: 58
Script:
#!/bin/bash # Attempting a different approach to find the RenderPassConfig constructor usage. # This time, we will use ripgrep to search for "RenderPassConfig" within the codebase. rg 'RenderPassConfig\('Length of output: 5393
shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cpp (4)
- 234-245: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [226-242]
The
parseStyleJsonFromString
method now includes handling formultiselect
andselfMasked
metadata properties. Ensure that the handling of these properties is consistent with their intended use throughout the codebase.
- 312-314: Verify that the
layerMultiselect
property is being correctly used when creating instances ofLineVectorLayerDescription
.Verification successful
The extended context provided by the latest shell script output shows the full constructor call for
LineVectorLayerDescription
inTiled2dMapVectorLayerParserHelper.cpp
. The last parameter in the constructor call islayerMultiselect
, which confirms that thelayerMultiselect
property is indeed being used when creating instances ofLineVectorLayerDescription
.Based on this information, the review comment asking to verify that the
layerMultiselect
property is being correctly used when creating instances ofLineVectorLayerDescription
can be considered as verified.* 373-374: Verify that the `layerSelfMasked` property is being correctly used when creating instances of `SymbolVectorLayerDescription`.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for instantiations of LineVectorLayerDescription to ensure the new property is correctly applied. ast-grep --lang cpp --pattern $'LineVectorLayerDescription($_, $_, $_, $_, $_, $_, $_, $_, $_, $_)'Length of output: 100
Script:
#!/bin/bash # Search for any instantiations of LineVectorLayerDescription to ensure the new property is correctly applied. ast-grep --lang cpp --pattern $'LineVectorLayerDescription($$$)'Length of output: 65
Script:
#!/bin/bash # Use ripgrep to search for the string "LineVectorLayerDescription" to find any usage within the codebase. rg 'LineVectorLayerDescription'Length of output: 1988
Script:
#!/bin/bash # Extract the lines around the instantiation of LineVectorLayerDescription in Tiled2dMapVectorLayerParserHelper.cpp rg -C 5 'std::make_shared<LineVectorLayerDescription>' shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cppLength of output: 657
Script:
#!/bin/bash # Extract more lines around the instantiation of LineVectorLayerDescription to see the full constructor call rg -C 10 'std::make_shared<LineVectorLayerDescription>' shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cppLength of output: 1149
Verification successful
The constructor signature for
SymbolVectorLayerDescription
has been successfully extracted and includes theselfMasked
parameter as the last argument. This matches the context provided in the review comment, which suggests that thelayerSelfMasked
property should be used in the creation of instances ofSymbolVectorLayerDescription
.Given the output from the script, we can confirm that the
selfMasked
parameter is indeed part of the constructor and should be correctly applied when creating instances ofSymbolVectorLayerDescription
.* 393-395: Verify that the `layerMultiselect` and `layerSelfMasked` properties are being correctly used when creating instances of `PolygonVectorLayerDescription`.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for instantiations of SymbolVectorLayerDescription to ensure the new property is correctly applied. ast-grep --lang cpp --pattern $'SymbolVectorLayerDescription($_, $_, $_, $_, $_, $_, $_, $_, $_)'Length of output: 98
Script:
#!/bin/bash # Search for the SymbolVectorLayerDescription class definition to find the correct constructor signature. ast-grep --lang cpp --pattern $'class SymbolVectorLayerDescription { $$$ }'Length of output: 421
Script:
#!/bin/bash # Broaden the search to find any constructors for SymbolVectorLayerDescription. ast-grep --lang cpp --pattern $'SymbolVectorLayerDescription($$$)'Length of output: 67
Script:
#!/bin/bash # Use ripgrep to search for the SymbolVectorLayerDescription constructor usage. rg 'SymbolVectorLayerDescription' --cppLength of output: 447
Script:
#!/bin/bash # Correct the ripgrep command to search for the SymbolVectorLayerDescription constructor usage without language-specific flags. rg 'SymbolVectorLayerDescription'Length of output: 5400
Script:
#!/bin/bash # Extract the constructor signature from the SymbolVectorLayerDescription header file. rg 'SymbolVectorLayerDescription\(.*\)' shared/public/SymbolVectorLayerDescription.hLength of output: 86
Script:
#!/bin/bash # Attempt to extract the lines from the SymbolVectorLayerDescription header file that define the constructor. rg -A 3 'SymbolVectorLayerDescription\(' shared/public/SymbolVectorLayerDescription.hLength of output: 296
Script:
#!/bin/bash # Attempt to extract more lines from the SymbolVectorLayerDescription header file to get the full constructor signature. rg -A 10 'SymbolVectorLayerDescription\(' shared/public/SymbolVectorLayerDescription.hLength of output: 789
Verification successful
The contents of
PolygonVectorLayerDescription.h
andTiled2dMapVectorLayerParserHelper.cpp
have been successfully retrieved. From the output, we can see the constructor ofPolygonVectorLayerDescription
in the header file, which includes the parametersmultiselect
andselfMasked
:PolygonVectorLayerDescription(std::string identifier, std::string source, std::string sourceId, int minZoom, int maxZoom, std::shared_ptr<Value> filter, PolygonVectorStyle style, std::optional<int32_t> renderPassIndex, std::shared_ptr<Value> interactable, bool multiselect, bool selfMasked): VectorLayerDescription(identifier, source, sourceId, minZoom, maxZoom, filter, renderPassIndex, interactable, multiselect, selfMasked), style(style) {};In the
Tiled2dMapVectorLayerParserHelper.cpp
file, we can see the instantiation ofPolygonVectorLayerDescription
where thelayerMultiselect
andlayerSelfMasked
properties are passed to the constructor:auto layerDesc = std::make_shared<PolygonVectorLayerDescription>(val["id"], val["source"], val.value("source-layer", ""), val.value("minzoom", 0), val.value("maxzoom", 24), filter, style, renderPassIndex, interactable, layerMultiselect, layerSelfMasked);This confirms that the
layerMultiselect
andlayerSelfMasked
properties are being correctly used when creating instances ofPolygonVectorLayerDescription
. The review comment has been verified with the actual codebase.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for instantiations of PolygonVectorLayerDescription to ensure the new properties are correctly applied. ast-grep --lang cpp --pattern $'PolygonVectorLayerDescription($_, $_, $_, $_, $_, $_, $_, $_, $_, $_)'Length of output: 103
Script:
#!/bin/bash # Search for any usage of PolygonVectorLayerDescription to ensure we catch all instances, regardless of the number of arguments. ast-grep --lang cpp --pattern $'PolygonVectorLayerDescription($$$)'Length of output: 68
Script:
#!/bin/bash # Use ripgrep to search for the string "PolygonVectorLayerDescription" in the codebase. rg 'PolygonVectorLayerDescription'Length of output: 3025
Script:
#!/bin/bash # Extract the constructor definition from PolygonVectorLayerDescription.h rg 'PolygonVectorLayerDescription\(.*\)' shared/public/PolygonVectorLayerDescription.h -A 2 # Extract the instantiation line from Tiled2dMapVectorLayerParserHelper.cpp rg 'std::make_shared<PolygonVectorLayerDescription>\(.*\)' shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cppLength of output: 227
Script:
#!/bin/bash # Output the contents of PolygonVectorLayerDescription.h cat shared/public/PolygonVectorLayerDescription.h # Output the contents of Tiled2dMapVectorLayerParserHelper.cpp cat shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cppLength of output: 29921
shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSymbolObject.cpp (1)
- 886-888: The logic to set
hideFromCollision
based on theoutside
flag is correctly implemented. However, it's important to ensure that thesetHideFromCollision
method handles the state change appropriately and that there are no side effects or race conditions when this state is read or modified elsewhere in the code.shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayer.cpp (5)
- 562-567: The
collisionManager.syncAccess
function call has been updated to include a new parameterpersistingPlacement
. This parameter is obtained frommapDescription->persistingSymbolPlacement
and passed to thecollisionDetection
method. Ensure that thecollisionDetection
method is correctly handling this new parameter and that all calls tosyncAccess
have been updated accordingly.Verification successful
The
collisionDetection
method has been updated to include the newpersistingPlacement
parameter, and thesyncAccess
function calls have been updated accordingly in the codebase. The verification process is successful.* 622-622: The `RenderPass` constructor call has been modified to include a new boolean argument `false`. This change is consistent across multiple calls to the `RenderPass` constructor. Ensure that the `RenderPass` class constructor and any other relevant methods are updated to handle this new argument correctly.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the collisionDetection method has been updated to handle the new parameter. ast-grep --lang cpp --pattern $'collisionDetection($_, $_, $_, $_, $_)' # Verify that all calls to syncAccess have been updated to include the new parameter. ast-grep --lang cpp --pattern $'syncAccess($$$)'Length of output: 122
Script:
#!/bin/bash # Verify that the collisionDetection method exists and has been updated to handle the new parameter. ast-grep --lang cpp --pattern $'collisionDetection($$$)' # Verify that the syncAccess function exists and check for calls with the updated parameter list. ast-grep --lang cpp --pattern $'syncAccess($$$)'Length of output: 107
Script:
#!/bin/bash # Use ripgrep to search for the string "collisionDetection" to confirm its existence and usage. rg 'collisionDetection' # Use ripgrep to search for the string "syncAccess" to confirm its existence and usage. rg 'syncAccess'Length of output: 8490
* 627-629: Another instance of the `RenderPass` constructor call has been modified to include a new boolean argument `false`. This change is consistent with the previous comment and should be verified in the same manner. * 633-633: The `RenderPass` constructor call has been modified to include a new boolean argument `description->selfMasked`. This change is consistent with the previous comments and should be verified in the same manner. * 641-641: Yet another instance of the `RenderPass` constructor call has been modified to include a new boolean argument `false`. This change is consistent with the previous comments and should be verified in the same manner.Verification successful
---
--- <!--Monologue: The output from the ripgrep command has provided us with multiple instances where the `RenderPass` constructor is called. Specifically, it shows calls to the constructor with the new boolean argument, as well as the definition of the constructor itself in `shared/src/graphics/RenderPass.cpp`. This confirms that the `RenderPass` constructor has been updated to handle the new boolean argument and that it is being used in the codebase. Given this information, I can conclude that the review comment has been verified successfully. The `RenderPass` constructor and its calls have been updated to include the new boolean argument as intended. --> The `RenderPass` constructor has been successfully updated to include the new boolean argument, and the calls to this constructor throughout the codebase have been adjusted accordingly. </details> <details> <summary>Scripts Executed</summary> The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Verify that the RenderPass constructor has been updated to handle the new boolean argument. ast-grep --lang cpp --pattern $'RenderPass($_, $_, $_)'
Length of output: 56
Script:
#!/bin/bash # Search for any instances of the RenderPass constructor to verify the new argument. ast-grep --lang cpp --pattern $'RenderPass($$$)'Length of output: 49
Script:
#!/bin/bash # Use ripgrep to search for the string "RenderPass" to find the constructor and its usage. rg 'RenderPass' --cppLength of output: 429
Script:
#!/bin/bash # Correct the ripgrep command to search for the string "RenderPass" in C++ files. rg 'RenderPass' -tcppLength of output: 46195
auto check = collisionGrid->addAndCheckCollisionCircles(*boundingCircles); | ||
willCollide = check == 1; | ||
outside = check == 2; |
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.
The introduction of the check
variable to store the result of collisionGrid->addAndCheckCollisionCircles(*boundingCircles)
is a good practice as it avoids calling the function multiple times. However, the magic numbers 1
and 2
used to determine the willCollide
and outside
flags are not self-explanatory. It would be better to use named constants or an enum to improve readability and maintainability.
// Suggested improvement using enum for clarity
enum CollisionResult {
NoCollision = 0,
WillCollide = 1,
Outside = 2
};
// Then use the enum instead of magic numbers
willCollide = check == CollisionResult::WillCollide;
outside = check == CollisionResult::Outside;
std::vector<VectorLayerFeatureInfo> featureInfos; | ||
for (auto const &[polygon, featureContext]: hitDetectionPolygons) { | ||
if (VectorTileGeometryHandler::isPointInTriangulatedPolygon(point, polygon, converter)) { | ||
if (strongSelectionDelegate->didSelectFeature(featureContext->getFeatureInfo(), description->identifier, | ||
converter->convert(CoordinateSystemIdentifiers::EPSG4326(), point))) { | ||
if (multiselect) { | ||
featureInfos.push_back(featureContext->getFeatureInfo()); | ||
} else if (strongSelectionDelegate->didSelectFeature(featureContext->getFeatureInfo(), description->identifier, | ||
converter->convert(CoordinateSystemIdentifiers::EPSG4326(),point))) { | ||
return true; | ||
} | ||
} | ||
} | ||
|
||
if (multiselect && !featureInfos.empty()) { | ||
return strongSelectionDelegate->didMultiSelectLayerFeatures(featureInfos, description->identifier, converter->convert(CoordinateSystemIdentifiers::EPSG4326(), point)); | ||
} | ||
|
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.
The method onClickConfirmed
has been updated to support multi-select functionality. The logic now includes a condition to check if multi-select is enabled and, if so, collects feature information into a vector. If multi-select is not enabled, it falls back to the previous behavior of single feature selection. The method also correctly returns the result of the delegate method didMultiSelectLayerFeatures
when multi-select is enabled and features are selected.
However, the multiselect
parameter is not declared in the method signature provided in the code snippet. This will cause a compilation error as the variable is undeclared in the scope of the function.
- bool Tiled2dMapVectorPolygonTile::onClickConfirmed(const Vec2F &posScreen) {
+ bool Tiled2dMapVectorPolygonTile::onClickConfirmed(const Vec2F &posScreen, bool multiselect) {
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.
std::vector<VectorLayerFeatureInfo> featureInfos; | |
for (auto const &[polygon, featureContext]: hitDetectionPolygons) { | |
if (VectorTileGeometryHandler::isPointInTriangulatedPolygon(point, polygon, converter)) { | |
if (strongSelectionDelegate->didSelectFeature(featureContext->getFeatureInfo(), description->identifier, | |
converter->convert(CoordinateSystemIdentifiers::EPSG4326(), point))) { | |
if (multiselect) { | |
featureInfos.push_back(featureContext->getFeatureInfo()); | |
} else if (strongSelectionDelegate->didSelectFeature(featureContext->getFeatureInfo(), description->identifier, | |
converter->convert(CoordinateSystemIdentifiers::EPSG4326(),point))) { | |
return true; | |
} | |
} | |
} | |
if (multiselect && !featureInfos.empty()) { | |
return strongSelectionDelegate->didMultiSelectLayerFeatures(featureInfos, description->identifier, converter->convert(CoordinateSystemIdentifiers::EPSG4326(), point)); | |
} | |
bool Tiled2dMapVectorPolygonTile::onClickConfirmed(const Vec2F &posScreen, bool multiselect) { | |
std::vector<VectorLayerFeatureInfo> featureInfos; | |
for (auto const &[polygon, featureContext]: hitDetectionPolygons) { | |
if (VectorTileGeometryHandler::isPointInTriangulatedPolygon(point, polygon, converter)) { | |
if (multiselect) { | |
featureInfos.push_back(featureContext->getFeatureInfo()); | |
} else if (strongSelectionDelegate->didSelectFeature(featureContext->getFeatureInfo(), description->identifier, | |
converter->convert(CoordinateSystemIdentifiers::EPSG4326(),point))) { | |
return true; | |
} | |
} | |
} | |
if (multiselect && !featureInfos.empty()) { | |
return strongSelectionDelegate->didMultiSelectLayerFeatures(featureInfos, description->identifier, converter->convert(CoordinateSystemIdentifiers::EPSG4326(), point)); | |
} | |
} |
shared/public/Value.h
Outdated
class ToBooleanValue: public Value { | ||
const std::shared_ptr<Value> value; | ||
|
||
public: | ||
ToBooleanValue(const std::shared_ptr<Value> value): value(value) {} | ||
|
||
std::unique_ptr<Value> clone() override { | ||
return std::make_unique<ToBooleanValue>(value->clone()); | ||
} | ||
|
||
UsedKeysCollection getUsedKeys() const override { | ||
return value->getUsedKeys(); | ||
} | ||
|
||
ValueVariant evaluate(const EvaluationContext &context) const override { | ||
return std::visit(overloaded { | ||
[](const std::string &val){ | ||
return !val.empty(); | ||
}, | ||
[](double val){ | ||
return val != 0.0 && !isnan(val); | ||
}, | ||
[](int64_t val){ | ||
return val != 0 && !isnan(val); | ||
}, | ||
[](bool val){ | ||
return val; | ||
}, | ||
[](const Color &val){ | ||
return true; | ||
}, | ||
[](const std::vector<float> &val){ | ||
return true; | ||
}, | ||
[](const std::vector<std::string> &val){ | ||
return true; | ||
}, | ||
[](const std::vector<FormattedStringEntry> &val){ | ||
return true; | ||
}, | ||
[](const std::monostate &val) { | ||
return false; | ||
} | ||
}, value->evaluate(context)); | ||
}; | ||
|
||
bool isEqual(const std::shared_ptr<Value>& other) const override { | ||
if (auto casted = std::dynamic_pointer_cast<ToBooleanValue>(other)) { | ||
// Compare the value member | ||
if (value && casted->value && !value->isEqual(casted->value)) { | ||
return false; | ||
} | ||
return true; // All members are equal | ||
} | ||
return false; // Not the same type or nullptr | ||
} | ||
}; |
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.
The ToBooleanValue
class has been added, which includes a method to evaluate a Value
object and return a boolean result based on the type of the value. This is a common pattern for type conversion and the implementation seems correct. However, there is a potential issue with the isnan
check for integer types on lines 1550-1551, as isnan
is not defined for integer types.
- return val != 0 && !isnan(val);
+ return val != 0;
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.
class ToBooleanValue: public Value { | |
const std::shared_ptr<Value> value; | |
public: | |
ToBooleanValue(const std::shared_ptr<Value> value): value(value) {} | |
std::unique_ptr<Value> clone() override { | |
return std::make_unique<ToBooleanValue>(value->clone()); | |
} | |
UsedKeysCollection getUsedKeys() const override { | |
return value->getUsedKeys(); | |
} | |
ValueVariant evaluate(const EvaluationContext &context) const override { | |
return std::visit(overloaded { | |
[](const std::string &val){ | |
return !val.empty(); | |
}, | |
[](double val){ | |
return val != 0.0 && !isnan(val); | |
}, | |
[](int64_t val){ | |
return val != 0 && !isnan(val); | |
}, | |
[](bool val){ | |
return val; | |
}, | |
[](const Color &val){ | |
return true; | |
}, | |
[](const std::vector<float> &val){ | |
return true; | |
}, | |
[](const std::vector<std::string> &val){ | |
return true; | |
}, | |
[](const std::vector<FormattedStringEntry> &val){ | |
return true; | |
}, | |
[](const std::monostate &val) { | |
return false; | |
} | |
}, value->evaluate(context)); | |
}; | |
bool isEqual(const std::shared_ptr<Value>& other) const override { | |
if (auto casted = std::dynamic_pointer_cast<ToBooleanValue>(other)) { | |
// Compare the value member | |
if (value && casted->value && !value->isEqual(casted->value)) { | |
return false; | |
} | |
return true; // All members are equal | |
} | |
return false; // Not the same type or nullptr | |
} | |
}; | |
class ToBooleanValue: public Value { | |
const std::shared_ptr<Value> value; | |
public: | |
ToBooleanValue(const std::shared_ptr<Value> value): value(value) {} | |
std::unique_ptr<Value> clone() override { | |
return std::make_unique<ToBooleanValue>(value->clone()); | |
} | |
UsedKeysCollection getUsedKeys() const override { | |
return value->getUsedKeys(); | |
} | |
ValueVariant evaluate(const EvaluationContext &context) const override { | |
return std::visit(overloaded { | |
[](const std::string &val){ | |
return !val.empty(); | |
}, | |
[](double val){ | |
return val != 0.0 && !isnan(val); | |
}, | |
[](int64_t val){ | |
return val != 0; | |
}, | |
[](bool val){ | |
return val; | |
}, | |
[](const Color &val){ | |
return true; | |
}, | |
[](const std::vector<float> &val){ | |
return true; | |
}, | |
[](const std::vector<std::string> &val){ | |
return true; | |
}, | |
[](const std::vector<FormattedStringEntry> &val){ | |
return true; | |
}, | |
[](const std::monostate &val) { | |
return false; | |
} | |
}, value->evaluate(context)); | |
}; | |
bool isEqual(const std::shared_ptr<Value>& other) const override { | |
if (auto casted = std::dynamic_pointer_cast<ToBooleanValue>(other)) { | |
// Compare the value member | |
if (value && casted->value && !value->isEqual(casted->value)) { | |
return false; | |
} | |
return true; // All members are equal | |
} | |
return false; // Not the same type or nullptr | |
} | |
}; |
The ToBooleanValue
class has been added, which includes a method to evaluate a Value
object and return a boolean result based on the type of the value. This is a common pattern for type conversion and the implementation seems correct. However, there is a potential issue with the isnan
check for integer types on lines 1550-1551, as isnan
is not defined for integer types.
- return val != 0 && !isnan(val);
+ return val != 0;
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.
class ToBooleanValue: public Value { | |
const std::shared_ptr<Value> value; | |
public: | |
ToBooleanValue(const std::shared_ptr<Value> value): value(value) {} | |
std::unique_ptr<Value> clone() override { | |
return std::make_unique<ToBooleanValue>(value->clone()); | |
} | |
UsedKeysCollection getUsedKeys() const override { | |
return value->getUsedKeys(); | |
} | |
ValueVariant evaluate(const EvaluationContext &context) const override { | |
return std::visit(overloaded { | |
[](const std::string &val){ | |
return !val.empty(); | |
}, | |
[](double val){ | |
return val != 0.0 && !isnan(val); | |
}, | |
[](int64_t val){ | |
return val != 0 && !isnan(val); | |
}, | |
[](bool val){ | |
return val; | |
}, | |
[](const Color &val){ | |
return true; | |
}, | |
[](const std::vector<float> &val){ | |
return true; | |
}, | |
[](const std::vector<std::string> &val){ | |
return true; | |
}, | |
[](const std::vector<FormattedStringEntry> &val){ | |
return true; | |
}, | |
[](const std::monostate &val) { | |
return false; | |
} | |
}, value->evaluate(context)); | |
}; | |
bool isEqual(const std::shared_ptr<Value>& other) const override { | |
if (auto casted = std::dynamic_pointer_cast<ToBooleanValue>(other)) { | |
// Compare the value member | |
if (value && casted->value && !value->isEqual(casted->value)) { | |
return false; | |
} | |
return true; // All members are equal | |
} | |
return false; // Not the same type or nullptr | |
} | |
}; | |
class ToBooleanValue: public Value { | |
const std::shared_ptr<Value> value; | |
public: | |
ToBooleanValue(const std::shared_ptr<Value> value): value(value) {} | |
std::unique_ptr<Value> clone() override { | |
return std::make_unique<ToBooleanValue>(value->clone()); | |
} | |
UsedKeysCollection getUsedKeys() const override { | |
return value->getUsedKeys(); | |
} | |
ValueVariant evaluate(const EvaluationContext &context) const override { | |
return std::visit(overloaded { | |
[](const std::string &val){ | |
return !val.empty(); | |
}, | |
[](double val){ | |
return val != 0.0 && !isnan(val); | |
}, | |
[](int64_t val){ | |
return val != 0; | |
}, | |
[](bool val){ | |
return val; | |
}, | |
[](const Color &val){ | |
return true; | |
}, | |
[](const std::vector<float> &val){ | |
return true; | |
}, | |
[](const std::vector<std::string> &val){ | |
return true; | |
}, | |
[](const std::vector<FormattedStringEntry> &val){ | |
return true; | |
}, | |
[](const std::monostate &val) { | |
return false; | |
} | |
}, value->evaluate(context)); | |
}; | |
bool isEqual(const std::shared_ptr<Value>& other) const override { | |
if (auto casted = std::dynamic_pointer_cast<ToBooleanValue>(other)) { | |
// Compare the value member | |
if (value && casted->value && !value->isEqual(casted->value)) { | |
return false; | |
} | |
return true; // All members are equal | |
} | |
return false; // Not the same type or nullptr | |
} | |
}; |
std::vector<VectorLayerFeatureInfo> featureInfos; | ||
for (auto const &[lineCoordinateVector, featureContext]: hitDetection) { | ||
for (auto const &coordinates: lineCoordinateVector) { | ||
auto lineWidth = lineDescription->style.getLineWidth(EvaluationContext(zoomIdentifier, dpFactor, featureContext, featureStateManager)); | ||
if (LineHelper::pointWithin(coordinates, point, lineWidth, coordinateConverter)) { | ||
if (strongSelectionDelegate->didSelectFeature(featureContext->getFeatureInfo(), description->identifier, point)) { | ||
if (multiselect) { | ||
featureInfos.push_back(featureContext->getFeatureInfo()); | ||
} else if (strongSelectionDelegate->didSelectFeature(featureContext->getFeatureInfo(), description->identifier, point)) { | ||
return true; | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (multiselect && !featureInfos.empty()) { | ||
return strongSelectionDelegate->didMultiSelectLayerFeatures(featureInfos, description->identifier, point); | ||
} |
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.
The method onClickConfirmed
has been updated to support multi-select functionality. The logic now includes a condition to check if multi-select is enabled and, if so, collects feature information into a vector. If multi-select is not enabled, it falls back to the previous behavior of single feature selection. The method also correctly returns the result of the delegate method didMultiSelectLayerFeatures
when multi-select is enabled and features are selected.
However, the multiselect
parameter is not declared in the method signature provided in the code snippet. This will cause a compilation error as the variable is undeclared in the scope of the function.
- bool Tiled2dMapVectorLineTile::onClickConfirmed(const Vec2F &posScreen) {
+ bool Tiled2dMapVectorLineTile::onClickConfirmed(const Vec2F &posScreen, bool multiselect) {
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.
std::vector<VectorLayerFeatureInfo> featureInfos; | |
for (auto const &[lineCoordinateVector, featureContext]: hitDetection) { | |
for (auto const &coordinates: lineCoordinateVector) { | |
auto lineWidth = lineDescription->style.getLineWidth(EvaluationContext(zoomIdentifier, dpFactor, featureContext, featureStateManager)); | |
if (LineHelper::pointWithin(coordinates, point, lineWidth, coordinateConverter)) { | |
if (strongSelectionDelegate->didSelectFeature(featureContext->getFeatureInfo(), description->identifier, point)) { | |
if (multiselect) { | |
featureInfos.push_back(featureContext->getFeatureInfo()); | |
} else if (strongSelectionDelegate->didSelectFeature(featureContext->getFeatureInfo(), description->identifier, point)) { | |
return true; | |
} | |
} | |
} | |
} | |
if (multiselect && !featureInfos.empty()) { | |
return strongSelectionDelegate->didMultiSelectLayerFeatures(featureInfos, description->identifier, point); | |
} | |
bool Tiled2dMapVectorLineTile::onClickConfirmed(const Vec2F &posScreen, bool multiselect) { | |
std::vector<VectorLayerFeatureInfo> featureInfos; | |
for (auto const &[lineCoordinateVector, featureContext]: hitDetection) { | |
for (auto const &coordinates: lineCoordinateVector) { | |
auto lineWidth = lineDescription->style.getLineWidth(EvaluationContext(zoomIdentifier, dpFactor, featureContext, featureStateManager)); | |
if (LineHelper::pointWithin(coordinates, point, lineWidth, coordinateConverter)) { | |
if (multiselect) { | |
featureInfos.push_back(featureContext->getFeatureInfo()); | |
} else if (strongSelectionDelegate->didSelectFeature(featureContext->getFeatureInfo(), description->identifier, point)) { | |
return true; | |
} | |
} | |
} | |
} | |
if (multiselect && !featureInfos.empty()) { | |
return strongSelectionDelegate->didMultiSelectLayerFeatures(featureInfos, description->identifier, point); | |
} | |
} |
shared/public/Value.h
Outdated
} | ||
}; | ||
|
||
class ToBoolValue: public Value { | ||
class ToBooleanValue: public Value { | ||
const std::shared_ptr<Value> value; | ||
|
||
public: | ||
ToBooleanValue(const std::shared_ptr<Value> value): value(value) {} | ||
|
||
std::unique_ptr<Value> clone() override { | ||
return std::make_unique<ToBooleanValue>(value->clone()); | ||
} | ||
|
||
UsedKeysCollection getUsedKeys() const override { | ||
return value->getUsedKeys(); | ||
} | ||
|
||
ValueVariant evaluate(const EvaluationContext &context) const override { | ||
return std::visit(overloaded { | ||
[](const std::string &val){ | ||
return !val.empty(); | ||
}, | ||
[](double val){ | ||
return val != 0.0 && !isnan(val); | ||
}, | ||
[](int64_t val){ | ||
return val != 0 && !isnan(val); | ||
}, | ||
[](bool val){ | ||
return val; | ||
}, | ||
[](const Color &val){ | ||
return true; | ||
}, | ||
[](const std::vector<float> &val){ | ||
return true; | ||
}, | ||
[](const std::vector<std::string> &val){ | ||
return true; | ||
}, | ||
[](const std::vector<FormattedStringEntry> &val){ | ||
return true; | ||
}, | ||
[](const std::monostate &val) { | ||
return false; | ||
} | ||
}, value->evaluate(context)); | ||
}; | ||
|
||
bool isEqual(const std::shared_ptr<Value>& other) const override { | ||
if (auto casted = std::dynamic_pointer_cast<ToBooleanValue>(other)) { | ||
// Compare the value member | ||
if (value && casted->value && !value->isEqual(casted->value)) { | ||
return false; | ||
} | ||
return true; // All members are equal | ||
} | ||
return false; // Not the same type or nullptr | ||
} | ||
}; | ||
|
||
class BooleanValue: public Value { | ||
const std::vector<std::shared_ptr<Value>> values; | ||
|
||
public: | ||
ToBoolValue(const std::shared_ptr<Value> value): values({ value }) {} | ||
BooleanValue(const std::shared_ptr<Value> value): values({value }) {} | ||
|
||
ToBoolValue(const std::vector<std::shared_ptr<Value>> values): values(values) {} | ||
BooleanValue(const std::vector<std::shared_ptr<Value>> values): values(values) {} | ||
|
||
std::unique_ptr<Value> clone() override { | ||
std::vector<std::shared_ptr<Value>> clonedValues; | ||
for (const auto &value: values) { | ||
clonedValues.push_back(value->clone()); | ||
} | ||
return std::make_unique<ToBoolValue>(clonedValues); | ||
return std::make_unique<BooleanValue>(clonedValues); | ||
} | ||
|
||
UsedKeysCollection getUsedKeys() const override { |
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.
📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1586-1622]
The BooleanValue
class has been added, which seems to be designed to evaluate a list of Value
objects and return a boolean result. However, the implementation on lines 1590-1622 is incorrect as it always returns false
regardless of the evaluated values. This is likely not the intended behavior, and it should be fixed to correctly evaluate the boolean logic based on the values.
- return false;
+ // Correct implementation needed here based on the intended boolean logic
📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1586-1622]
The BooleanValue
class has been added, which seems to be designed to evaluate a list of Value
objects and return a boolean result. However, the implementation on lines 1590-1622 is incorrect as it always returns false
regardless of the evaluated values. This is likely not the intended behavior, and it should be fixed to correctly evaluate the boolean logic based on the values.
- return false;
+ // Correct implementation needed here based on the intended boolean logic
shared/public/RenderPassConfig.h
Outdated
RenderPassConfig(int32_t renderPassIndex_, | ||
bool isPassMasked_) | ||
: renderPassIndex(std::move(renderPassIndex_)) | ||
, isPassMasked(std::move(isPassMasked_)) |
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.
The constructor of RenderPassConfig
has been updated to initialize the new isPassMasked
member. However, using std::move
on primitive data types like bool
and int32_t
is unnecessary and does not provide any performance benefit. It's only useful for objects that manage resources, where moving can avoid expensive deep copies.
- : renderPassIndex(std::move(renderPassIndex_)),
- isPassMasked(std::move(isPassMasked_))
+ : renderPassIndex(renderPassIndex_),
+ isPassMasked(isPassMasked_)
@@ -105,6 +105,7 @@ class Tiled2dMapVectorLayer | |||
std::vector<std::shared_ptr<::RenderObjectInterface>> renderObjects; | |||
std::shared_ptr<MaskingObjectInterface> maskingObject; | |||
bool isModifyingMask; | |||
bool selfMasked; |
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.
Tip
Codebase Verification
The verification process has identified that the selfMasked
variable is indeed used throughout the application. However, there is a lack of both documentation and automated tests concerning this variable, which is a significant concern for ensuring the correctness and maintainability of the feature it represents. It is recommended that documentation and tests be added to address these issues.
Analysis chain
The addition of the selfMasked
boolean member variable to the Tiled2dMapVectorLayer
class suggests a new feature or behavior related to masking. It's important to ensure that this new variable is integrated correctly into the layer's logic and that any new masking behavior is documented and tested.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify that the new selfMasked variable is being used correctly throughout the application.
rg --type cpp "selfMasked"
Length of output: 3729
Script:
#!/bin/bash
# Search for comments or documentation updates related to selfMasked
rg --type cpp -C 3 "selfMasked"
# Search for test files that might contain references to selfMasked
rg --type cpp "selfMasked" --glob "*Test.cpp" --glob "*test.cpp"
Length of output: 15055
Script:
#!/bin/bash
# Search for test files without relying on the naming convention to ensure all tests are included
rg --type cpp "selfMasked" --glob "*.*pp"
Length of output: 1971
Summary by CodeRabbit