-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(engine): enhance GeometryLodFilter with target_lods parameter and update processing logic #665
Conversation
…d update processing logic
WalkthroughThe changes in this pull request involve modifications to the Changes
Possibly related PRs
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
✅ Deploy Preview for reearth-flow canceled.
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
engine/runtime/action-processor/src/geometry/lod_filter.rs (3)
135-139
: Consider elevating log level for missing CityGML geometries.Currently logging at the info level when a feature lacks a CityGML geometry:
ctx.event_hub.info_log( None, format!("Feature {} does not have a citygml geometry", feature.id), );If this situation is unexpected or indicative of an issue, consider using a warning level to draw more attention.
145-146
: Default values formax_lod
andmin_lod
may lead to unintended behavior.Using default values of
max_lod = 4
andmin_lod = 0
might result in features with higher LODs being unfiltered unintentionally. Review whether these defaults align with the expected use cases, or consider making these parameters mandatory.
191-193
: Add unit tests fortarget_lods
functionality.The current tests do not cover scenarios where
target_lods
is specified. Adding unit tests will help ensure that the filtering logic based ontarget_lods
works as intended.Example Test Case:
- Test with
target_lods
containing specific LODs and verify that only geometries with those LODs are retained.- Test with
target_lods
set to an empty vector to check handling of no LODs specified.Would you like assistance in writing these tests?
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
engine/runtime/action-processor/src/geometry/lod_filter.rs
(8 hunks)
🔇 Additional comments (5)
engine/runtime/action-processor/src/geometry/lod_filter.rs (5)
83-87
: Fields in GeometryLodFilter
are correctly initialized.
The fields max_lod
, min_lod
, and target_lods
are properly assigned from the parameters.
95-97
: target_lods
field added to GeometryLodFilterParam
struct.
The new field target_lods
has been correctly added with the appropriate type Option<Vec<u8>>
.
102-104
: target_lods
field added to GeometryLodFilter
struct.
The addition of target_lods
to the struct is correct and matches the corresponding parameter.
113-124
: Potential exclusion of geometries without LOD values.
In the filtering logic, geometries without an LOD value are currently being discarded:
if let Some(lod) = g.lod {
target_lods.contains(&lod)
} else {
false
}
If it is acceptable or desired to retain geometries without LODs, consider modifying the condition:
if let Some(lod) = g.lod {
target_lods.contains(&lod)
} else {
- false
+ true // Retain geometries without LOD values
}
Alternatively, if geometries without LODs should be discarded, consider logging this scenario for better visibility.
Line range hint 159-164
: Review LOD comparison logic for correctness.
The condition:
if highest_lod <= max_lod && lowest_lod >= min_lod {
//...
}
Ensure that this logic correctly handles all edge cases, especially when highest_lod
or lowest_lod
is equal to max_lod
or min_lod
. There might be scenarios where features are incorrectly filtered due to strict inequality.
Suggestion:
Consider adding unit tests to cover these edge cases and confirm the behavior is as intended.
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
engine/schema/actions.json (1)
1759-1769
: Consider documenting the relationship between targetLods and min/maxLodWhile the schema is technically correct, it would be beneficial to document how
targetLods
interacts with the existingminLod
andmaxLod
properties. For example:
- Are
targetLods
filtered byminLod
andmaxLod
?- What happens if a target LOD is outside the min-max range?
- Which takes precedence in filtering?
Consider adding a description field to clarify the behavior:
"targetLods": { + "description": "Specific LOD values to filter for. If specified, only features with these LOD values will be included, subject to minLod and maxLod constraints if they are also specified.", "type": [ "array", "null" ], "items": { "type": "integer", "format": "uint8", "minimum": 0.0 } }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (1)
engine/docs/mdbook/src/action.md
is excluded by!**/*.md
📒 Files selected for processing (1)
engine/schema/actions.json
(1 hunks)
🔇 Additional comments (1)
engine/schema/actions.json (1)
1759-1769
: LGTM: Well-structured schema definition for targetLods
The schema definition for the new targetLods
property is well-structured and consistent with the existing LOD-related properties:
- Correctly defined as an optional array (can be null)
- Proper type constraints for array items (uint8 with minimum 0)
- Maintains consistency with
minLod
andmaxLod
property definitions
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.
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
engine/runtime/geometry/src/algorithm/coords_iter.rs (2)
Line range hint
341-343
: Implement thecoords_iter
method for RectThe
coords_iter
method is currently unimplemented and will panic at runtime. Based on the type signature andcoords_count
, it should return an iterator over the 8 coordinates of the rectangle.Consider implementing it like this:
- fn coords_iter(&self) -> Self::Iter<'_> { - todo!() - } + fn coords_iter(&self) -> Self::Iter<'_> { + iter::once(self.min()) + .chain(iter::once(Coordinate::new(self.max_x(), self.min_y(), self.min_z()))) + .chain(iter::once(self.max())) + .chain(iter::once(Coordinate::new(self.min_x(), self.max_y(), self.max_z()))) + }
Line range hint
24-31
: Consider adding documentation for exterior vs regular iterationThe trait defines both regular (
coords_iter
) and exterior (exterior_coords_iter
) coordinate iteration, but the distinction between these methods isn't documented. Consider adding documentation to explain when to use each method, particularly for complex types like Polygon and MultiPolygon where the difference is significant.Add documentation like this:
pub trait CoordsIter { + /// Iterator type for all coordinates in the geometry, including interior rings type Iter<'a>: Iterator<Item = Coordinate<Self::ScalarXY, Self::ScalarZ>> where Self: 'a; + /// Iterator type for coordinates forming the exterior boundary of the geometry type ExteriorIter<'a>: Iterator<Item = Coordinate<Self::ScalarXY, Self::ScalarZ>> where Self: 'a;
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
engine/runtime/geometry/src/algorithm/coords_iter.rs
(13 hunks)
🔇 Additional comments (1)
engine/runtime/geometry/src/algorithm/coords_iter.rs (1)
43-52
: LGTM: Improved type signature formatting
The reformatting of type signatures with explicit where
clauses improves code readability while maintaining the same functionality. The changes are consistent across all implementations.
Also applies to: 75-84, 109-118, 146-155, 185-194, 217-226, 252-261, 284-293, 325-334, 356-365, 390-399, 461-470, 492-501
Overview
What I've done
What I haven't done
How I tested
Screenshot
Which point I want you to review particularly
Memo
Summary by CodeRabbit
New Features
targetLods
parameter for theGeometryLodFilter
, allowing users to specify multiple target Levels of Detail (LOD) for enhanced geometry filtering.Bug Fixes
Refactor
CoordsIter
trait implementations across various geometry types without altering their functionality.