Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add scale-in option for vector layer polygons #585

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

maurhofer-ubique
Copy link
Contributor

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

Summary by CodeRabbit

  • New Features

    • Introduced enhancements in shader and rendering logic to support fading in patterns for a more dynamic visual experience.
    • Added functionality for converting map coordinates to screen positions, enabling more accurate interactions.
    • Implemented click event handling for raster and polygon tiles, improving user interaction with map elements.
  • Refactor

    • Updated method signatures and interfaces across Android, iOS, and shared codebases to include new parameters and methods for enhanced functionality.
  • Documentation

    • Updated public interfaces and source files documentation to reflect new functionalities and method usages.

Copy link
Contributor

coderabbitai bot commented Jan 26, 2024

Walkthrough

The recent updates focus on enhancing shader logic and rendering techniques for Android and iOS platforms, introducing fadeInPattern functionality for dynamic visual effects, and improving interaction with map elements through screen position conversions and click event handling. These changes span across graphics rendering, shader management, and map interaction layers, aiming to provide a richer, more responsive user experience in mapping applications.

Changes

Files Change Summary
.../cpp/graphics/objects/PolygonPatternGroup2dOpenGl.cpp
.../cpp/graphics/shader/PolygonPatternGroup2dShaderOpenGl.cpp
.../cpp/graphics/shader/PolygonPatternGroup2dShaderOpenGl.h
.../cpp/graphics/shader/ShaderFactoryOpenGl.cpp & .h
.../java/io/openmobilemaps/mapscore/graphics/GLThread.kt
.../java/io/openmobilemaps/.../shader/ShaderFactoryInterface.kt
.../jni/graphics/shader/NativeShaderFactoryInterface.cpp & .h
.../java/io/openmobilemaps/.../map/MapCamera2dInterface.kt
.../jni/map/NativeMapCamera2dInterface.cpp
.../java/io/openmobilemaps/.../vector/Tiled2dMapVectorLayerInterface.kt
.../jni/map/layers/tiled/vector/NativeTiled2dMapVectorLayerInterface.cpp
.../ios/MCMapCamera2dInterface+Private.mm & .h
.../ios/MCShaderFactoryInterface+Private.mm & .h
.../ios/MCTiled2dMapVectorLayerInterface+Private.mm & .h
djinni/.../shader.djinni
djinni/map/core.djinni
djinni/.../tiled_vector_layer.djinni
ios/graphics/Model/Polygon/PolygonPatternGroup2d.swift
ios/graphics/Pipelines/PipelineLibrary.swift
ios/graphics/Shader/Metal/PolygonGroupShader.metal
ios/graphics/Shader/PolygonPatternGroupShader.swift
ios/graphics/Shader/ShaderFactory.swift
shared/public/* & shared/src/map/*
Introduced fadeInPattern for dynamic effects, added screen position conversion and click handling in map elements, and updated shader logic and rendering techniques.

Poem

In the land of code and sprite,
Where pixels dance in day and night,
A rabbit hopped, with joy it twirled,
Celebrating a world, newly unfurled.
🌍✨🐰💫

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

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (invoked as PR comments)

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

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

CodeRabbit Configration File (.coderabbit.yaml)

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

CodeRabbit Discord Community

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

Base automatically changed from feature/self-masking to develop February 1, 2024 08:27
@zimmermannubique
Copy link
Contributor

@maurhofer-ubique Da wäre iOS auch noch gemacht. Könnte man mergen.

@maurhofer-ubique maurhofer-ubique marked this pull request as ready for review February 5, 2024 07:44
@maurhofer-ubique maurhofer-ubique merged commit 771f29d into develop Feb 5, 2024
2 checks passed
@maurhofer-ubique maurhofer-ubique deleted the feature/fading-pattern branch February 5, 2024 07:44
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 8

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between df94302 and dad152a.
Files selected for processing (53)
  • android/src/main/cpp/graphics/objects/PolygonPatternGroup2dOpenGl.cpp (1 hunks)
  • android/src/main/cpp/graphics/shader/PolygonPatternGroup2dShaderOpenGl.cpp (4 hunks)
  • android/src/main/cpp/graphics/shader/PolygonPatternGroup2dShaderOpenGl.h (2 hunks)
  • android/src/main/cpp/graphics/shader/ShaderFactoryOpenGl.cpp (1 hunks)
  • android/src/main/cpp/graphics/shader/ShaderFactoryOpenGl.h (1 hunks)
  • android/src/main/java/io/openmobilemaps/mapscore/graphics/GLThread.kt (1 hunks)
  • bridging/android/java/io/openmobilemaps/mapscore/shared/graphics/shader/ShaderFactoryInterface.kt (2 hunks)
  • bridging/android/java/io/openmobilemaps/mapscore/shared/map/MapCamera2dInterface.kt (2 hunks)
  • bridging/android/java/io/openmobilemaps/mapscore/shared/map/layers/tiled/vector/Tiled2dMapVectorLayerInterface.kt (2 hunks)
  • bridging/android/jni/graphics/shader/NativeShaderFactoryInterface.cpp (3 hunks)
  • bridging/android/jni/graphics/shader/NativeShaderFactoryInterface.h (2 hunks)
  • bridging/android/jni/map/NativeMapCamera2dInterface.cpp (1 hunks)
  • bridging/android/jni/map/layers/tiled/vector/NativeTiled2dMapVectorLayerInterface.cpp (2 hunks)
  • bridging/ios/MCMapCamera2dInterface+Private.mm (1 hunks)
  • bridging/ios/MCMapCamera2dInterface.h (1 hunks)
  • bridging/ios/MCShaderFactoryInterface+Private.mm (2 hunks)
  • bridging/ios/MCShaderFactoryInterface.h (1 hunks)
  • bridging/ios/MCTiled2dMapVectorLayerInterface+Private.mm (2 hunks)
  • bridging/ios/MCTiled2dMapVectorLayerInterface.h (2 hunks)
  • djinni/graphics/shader/shader.djinni (1 hunks)
  • djinni/map/core.djinni (1 hunks)
  • djinni/map/layers/tiled/vector/tiled_vector_layer.djinni (1 hunks)
  • ios/graphics/Model/Polygon/PolygonPatternGroup2d.swift (5 hunks)
  • ios/graphics/Pipelines/PipelineLibrary.swift (5 hunks)
  • ios/graphics/Shader/Metal/PolygonGroupShader.metal (2 hunks)
  • ios/graphics/Shader/PolygonPatternGroupShader.swift (1 hunks)
  • ios/graphics/Shader/ShaderFactory.swift (1 hunks)
  • shared/public/MapCamera2dInterface.h (1 hunks)
  • shared/public/PolygonVectorLayerDescription.h (2 hunks)
  • shared/public/ShaderFactoryInterface.h (1 hunks)
  • shared/public/Tiled2dMapVectorLayer.h (1 hunks)
  • shared/public/Tiled2dMapVectorLayerInterface.h (2 hunks)
  • shared/public/Tiled2dMapVectorTile.h (1 hunks)
  • shared/src/map/camera/MapCamera2d.cpp (2 hunks)
  • shared/src/map/camera/MapCamera2d.h (2 hunks)
  • shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayer.cpp (1 hunks)
  • shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.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/sourcemanagers/Tiled2dMapVectorSourceTileDataManager.h (2 hunks)
  • shared/src/map/layers/tiled/vector/sublayers/background/Tiled2dMapVectorBackgroundSubLayer.cpp (1 hunks)
  • shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorInteractionManager.cpp (1 hunks)
  • shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorInteractionManager.h (1 hunks)
  • shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.cpp (4 hunks)
  • shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.h (1 hunks)
  • shared/src/map/layers/tiled/vector/tiles/line/Tiled2dMapVectorLineTile.cpp (3 hunks)
  • shared/src/map/layers/tiled/vector/tiles/line/Tiled2dMapVectorLineTile.h (1 hunks)
  • shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonPatternTile.cpp (3 hunks)
  • shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonPatternTile.h (2 hunks)
  • shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonTile.cpp (1 hunks)
  • shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonTile.h (1 hunks)
  • shared/src/map/layers/tiled/vector/tiles/raster/Tiled2dMapVectorRasterTile.cpp (1 hunks)
  • shared/src/map/layers/tiled/vector/tiles/raster/Tiled2dMapVectorRasterTile.h (1 hunks)
Files not reviewed due to errors (1)
  • shared/src/map/layers/tiled/vector/tiles/Tiled2dMapVectorLineTile.cpp (no review received)
Additional comments: 53
android/src/main/cpp/graphics/shader/ShaderFactoryOpenGl.cpp (1)
  • 53-54: Implementation of createPolygonPatternGroupShader(bool fadeInPattern) correctly passes the fadeInPattern parameter to the shader constructor. This change aligns with the header file modification.
shared/public/Tiled2dMapVectorLayerInterface.h (2)
  • 6-6: Include directive for "Coord.h" is correctly added to support the new performClick method.
  • 70-70: The addition of the performClick virtual function with a Coord parameter is correctly implemented to handle click events within vector layers.
bridging/ios/MCTiled2dMapVectorLayerInterface.h (2)
  • 4-4: Import statement for "MCCoord.h" correctly added to support the new performClick: method in the iOS bridging interface.
  • 75-75: The addition of the performClick: method with an MCCoord parameter in the MCTiled2dMapVectorLayerInterface protocol is correctly implemented to handle click events within vector layers on iOS.
shared/public/PolygonVectorLayerDescription.h (3)
  • 23-29: The addition of the fadeInPattern parameter to the PolygonVectorStyle constructor is correctly implemented to support fading in patterns for vector layer polygons.
  • 35-36: The addition of the fadeInPattern parameter to the copy constructor of the PolygonVectorStyle class is correctly implemented, ensuring that the fading pattern feature is correctly copied.
  • 83-84: The addition of the fadeInPattern member variable in the PolygonVectorStyle class is correctly implemented to store the state of the fading in pattern feature.
bridging/android/jni/graphics/shader/NativeShaderFactoryInterface.h (1)
  • 42-42: The addition of the fadeInPattern parameter to the createPolygonPatternGroupShader method in the NativeShaderFactoryInterface class is correctly implemented to support fading in patterns for vector layer polygons on Android.
djinni/map/core.djinni (1)
  • 159-159: The addition of the screen_pos_from_coord method to the map_camera_2d_interface is correctly implemented to support converting coordinates to screen positions, enhancing interactive capabilities.
bridging/android/java/io/openmobilemaps/mapscore/shared/graphics/shader/ShaderFactoryInterface.kt (1)
  • 23-23: The addition of the fadeInPattern parameter to the createPolygonPatternGroupShader method in the ShaderFactoryInterface Kotlin interface is correctly implemented to support fading in patterns for vector layer polygons on Android.
djinni/map/layers/tiled/vector/tiled_vector_layer.djinni (1)
  • 67-67: The addition of the perform_click method to the TiledVectorLayer interface is correctly implemented to support handling click events within vector layers.
ios/graphics/Shader/Metal/PolygonGroupShader.metal (3)
  • 60-61: The addition of posOffset as a constant buffer parameter is correctly implemented. Ensure that the corresponding Metal shader invocation on the iOS side is updated to pass this new parameter.
  • 62-64: Correct calculation of pixelPosition using the new posOffset parameter. This change aligns with the PR objectives to enhance visual representation by adjusting calculations based on real-world measurements.
  • 95-163: The new polygonPatternGroupFadeInFragmentShader function is correctly added to handle fragment shader operations with fading in patterns. Ensure that the corresponding iOS code invoking this shader is updated to use this new function where necessary.
shared/src/map/camera/MapCamera2d.h (2)
  • 23-23: The inclusion of "Vec2F.h" is correctly added to support the new screenPosFromCoord method, ensuring the necessary types are available.
  • 124-125: The screenPosFromCoord method is correctly declared. Ensure that its implementation correctly converts map coordinates to screen positions, considering the current camera zoom, rotation, and pan state.
bridging/android/java/io/openmobilemaps/mapscore/shared/map/layers/tiled/vector/Tiled2dMapVectorLayerInterface.kt (2)
  • 43-44: The performClick method is correctly declared in the Tiled2dMapVectorLayerInterface. Ensure that its implementation in both the native and proxy classes correctly handles click events on vector layers.
  • 132-136: The implementation of performClick in the CppProxy class is correctly added. Ensure that the native method native_performClick is correctly implemented to handle click events on vector layers.
ios/graphics/Model/Polygon/PolygonPatternGroup2d.swift (3)
  • 26-26: The renderPassStencilState property is correctly added to support different stencil states during rendering. Ensure that this property is properly utilized in rendering logic to handle masked passes.
  • 33-34: The posOffset property is correctly added. Ensure that its value is correctly calculated and set before rendering, based on vertex data.
  • 71-117: > 📝 NOTE

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

The modifications in the render method to handle the renderPass parameter and additional logic for masked passes are correctly implemented. Ensure that the rendering logic correctly applies the renderPassStencilState and posOffset during rendering operations.

bridging/ios/MCTiled2dMapVectorLayerInterface+Private.mm (2)
  • 9-9: The inclusion of "MCCoord+Private.h" is correctly added to support the new performClick method, ensuring the necessary types are available for bridging.
  • 159-163: The performClick method is correctly implemented in the Objective-C bridging layer. Ensure that it correctly translates the MCCoord parameter and calls the corresponding C++ method.
android/src/main/cpp/graphics/objects/PolygonPatternGroup2dOpenGl.cpp (1)
  • 169-172: The introduction of the uScreenPixelAsRealMeterFactor uniform variable is correctly implemented. Ensure that the corresponding shader code on the Android side is updated to utilize this new variable for accurate scale-in effects.
shared/src/map/layers/tiled/vector/sublayers/background/Tiled2dMapVectorBackgroundSubLayer.cpp (1)
  • 45-45: Ensure the hardcoded false value passed to createPolygonPatternGroupShader aligns with the intended shader behavior. Consider if this should be dynamically determined based on some condition.
bridging/ios/MCShaderFactoryInterface+Private.mm (1)
  • 88-90: The update to pass fadeInPattern from Objective-C to C++ in createPolygonPatternGroupShader is correctly implemented.
android/src/main/cpp/graphics/shader/PolygonPatternGroup2dShaderOpenGl.cpp (4)
  • 19-21: The constructor correctly initializes fadeInPattern and programName based on the provided boolean. This dynamic naming strategy is a good practice for managing different shader behaviors.
  • 54-67: Ensure the conditional logic for fadeInPattern in the vertex shader correctly implements the intended behavior for both fading in patterns and the default behavior. The separation of logic based on fadeInPattern is clear and well-structured.
  • 82-84: The fragment shader's conditional inclusion of uniforms based on fadeInPattern is correctly implemented. This approach ensures that only necessary uniforms are declared, optimizing shader performance.
  • 109-168: The complex conditional logic in the fragment shader for handling fadeInPattern is well-structured. However, ensure that the calculations for spacing, totalSize, and texture coordinates accurately achieve the desired visual effects, especially in edge cases.
bridging/ios/MCMapCamera2dInterface+Private.mm (1)
  • 250-255: The addition of screenPosFromCoord method correctly bridges Objective-C to C++, enabling coordinate to screen position conversions. Ensure the underlying C++ logic accurately performs the conversion.
android/src/main/java/io/openmobilemaps/mapscore/graphics/GLThread.kt (1)
  • 393-393: Adding requestRender() in onWindowResize is correctly implemented to ensure the GL surface is updated immediately after a size change. This is crucial for responsive rendering.
bridging/android/jni/map/layers/tiled/vector/NativeTiled2dMapVectorLayerInterface.cpp (2)
  • 6-6: Including "NativeCoord.h" is necessary for the new native_performClick function to work with NativeCoord objects.
  • 160-166: The implementation of native_performClick correctly translates the JNI environment and object references to call the performClick method on the Tiled2dMapVectorLayerInterface. The usage of ::djinni_generated::NativeCoord::toCpp for parameter conversion is appropriate.
shared/public/Tiled2dMapVectorLayer.h (1)
  • 158-159: The addition of the performClick method with a Coord parameter is consistent with the class's functionality to handle click events on vector layers. This method enhances interactive capabilities.
bridging/android/jni/graphics/shader/NativeShaderFactoryInterface.cpp (3)
  • 5-5: Including "Marshal.hpp" is necessary for the conversion functions used in the modified createPolygonPatternGroupShader method.
  • 77-82: Modifying createPolygonPatternGroupShader to accept a bool c_fadeInPattern parameter allows for the creation of shaders with optional fade-in patterns, aligning with the feature enhancements described.
  • 188-192: The JNI method native_createPolygonPatternGroupShader correctly accepts a jboolean j_fadeInPattern and translates it for use in the modified createPolygonPatternGroupShader method. This change supports the new fade-in pattern functionality.
shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonTile.cpp (2)
  • 323-328: Refactoring the click handling logic into performClick and checking for camera existence in onClickConfirmed improves code modularity and clarity. This change ensures that click events are only processed when a camera is available.
  • 330-351: The implementation of performClick correctly processes click events based on coordinates, enhancing the class's interactive capabilities. The method's logic for feature selection and multi-selection is consistent with expected behavior.
bridging/android/java/io/openmobilemaps/mapscore/shared/map/MapCamera2dInterface.kt (1)
  • 73-74: LGTM!
bridging/android/jni/map/NativeMapCamera2dInterface.cpp (1)
  • 283-290: LGTM!
shared/src/map/layers/tiled/vector/tiles/polygon/Tiled2dMapVectorPolygonPatternTile.cpp (2)
  • 31-32: Initialization of fadeInPattern in the constructor is correct and follows best practices.
  • 417-438: The performClick method correctly implements logic for handling click events based on coordinates. It properly locks the map interface and checks for a strong selection delegate before proceeding, which is a good practice for thread safety and ensuring the presence of necessary components.
shared/src/map/layers/tiled/vector/sourcemanagers/Tiled2dMapVectorSourceTileDataManager.cpp (1)
  • 420-442: The performClick method is implemented correctly, iterating over tiles and sub-tiles to handle click events based on coordinates. It properly checks for interactable layers and visibility before attempting to perform click actions, which is essential for accurate event handling.
shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayerParserHelper.cpp (1)
  • 383-384: The addition of fadeInPattern to the PolygonVectorStyle constructor is implemented correctly. It checks for the presence of fadeInPattern in the layout and correctly initializes the style parameter based on its value. This change supports the new functionality for fading in patterns as intended.
shared/src/map/camera/MapCamera2d.cpp (3)
  • 737-764: The method screenPosFromCoord correctly calculates the screen position from map coordinates considering the current zoom, angle, and center position. However, ensure that the conversion logic aligns with the expected coordinate system and rendering context, especially regarding the angle's sign and the viewport size's impact on the final screen position.
  • 734-768: > 📝 NOTE

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

The method mapUnitsFromPixels correctly calculates the map units from pixels using the screenPixelAsRealMeterFactor and the current zoom level. This implementation is efficient and straightforward.

  • 19-25: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [770-771]

The method getScalingFactor is a simple wrapper around mapUnitsFromPixels(1.0), effectively returning the scaling factor for a single pixel. This is a clear and efficient way to expose this functionality.

shared/src/map/layers/tiled/vector/symbol/Tiled2dMapVectorSourceSymbolDataManager.cpp (2)
  • 754-765: The onClickConfirmed method correctly locks the shared pointer to this, acquires necessary interfaces, and then calls performClick with the converted coordinates. Ensure that all necessary null checks are performed before using the objects.
  • 788-788: The use of a delegate to handle feature selection upon a click is a good practice, promoting decoupling and flexibility in handling different actions upon selection.
shared/src/map/layers/tiled/vector/Tiled2dMapVectorLayer.cpp (1)
  • 1123-1133: The performClick method correctly converts a coordinate to a screen position and then calls onClickConfirmed with the screen position. This logic is sound for simulating a click event based on a map coordinate. However, ensure that onClickConfirmed is designed to handle programmatically generated events in addition to user-generated events, as this could affect application behavior.

@@ -19,6 +19,7 @@
#include "Vec2D.h"
#include "Vec2DHelper.h"
#include "Vec2FHelper.h"
#include "Logger.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Including "Logger.h" without using any logging functionality in the provided changes. Ensure that logging is either implemented where necessary or remove the unused include.

Comment on lines 774 to 780
return false;
}

Coord clickCoords = camera->coordFromScreenPosition(posScreen);
Coord clickCoordsRenderCoord = conversionHelper->convertToRenderSystem(clickCoords);
Coord clickCoordsRenderCoord = conversionHelper->convertToRenderSystem(coord);

double clickPadding = camera->mapUnitsFromPixels(16);
CircleD clickHitCircle(clickCoordsRenderCoord.x, clickCoordsRenderCoord.y, clickPadding);
Copy link
Contributor

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 [767-788]

In performClick, the method efficiently filters out non-interactable layers and layers not included in the layers set. It then iterates over symbol groups to find a hit. Consider optimizing the loop for large numbers of symbol groups or tiles, potentially by spatial indexing or early exit strategies if a hit is found.

@@ -760,8 +774,7 @@
return false;
}

Coord clickCoords = camera->coordFromScreenPosition(posScreen);
Coord clickCoordsRenderCoord = conversionHelper->convertToRenderSystem(clickCoords);
Coord clickCoordsRenderCoord = conversionHelper->convertToRenderSystem(coord);
Copy link
Contributor

Choose a reason for hiding this comment

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

The click padding is hardcoded to 16 pixels. Consider making this value configurable or adaptive to screen density and zoom levels to improve usability across different devices.

@@ -21,6 +21,8 @@ class PolygonPatternGroup2dShaderOpenGl : public BaseShaderProgramOpenGl,
public std::enable_shared_from_this<ShaderProgramInterface> {

public:
PolygonPatternGroup2dShaderOpenGl(bool fadeInPattern);
Copy link
Contributor

Choose a reason for hiding this comment

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

Constructor PolygonPatternGroup2dShaderOpenGl(bool fadeInPattern) introduces a boolean parameter to control fading in patterns. Ensure all shader instances are correctly initialized with this new parameter.

Comment on lines +35 to +36
const bool fadeInPattern;
const std::string programName;
Copy link
Contributor

Choose a reason for hiding this comment

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

Member variable const bool fadeInPattern correctly stores the fading pattern state. However, const std::string programName should be initialized in the constructor or have a default value to ensure it's always in a valid state.

override init() {
// MARK: - Variables

let fadeInPattern : Bool
Copy link
Contributor

Choose a reason for hiding this comment

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

Variable fadeInPattern correctly captures the fading pattern state. Ensure it is used consistently across the class to control shader behavior.

}
guard pipeline == nil else { return }

let t : PipelineType = fadeInPattern ? .polygonPatternFadeInGroupShader : .polygonPatternGroupShader
Copy link
Contributor

Choose a reason for hiding this comment

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

Modification in setupProgram to conditionally set the pipeline based on fadeInPattern is correct. Verify that all shader pipelines correctly support this conditional logic.

@@ -27,7 +27,7 @@ class ShaderFactoryOpenGl : public ShaderFactoryInterface {

std::shared_ptr<PolygonGroupShaderInterface> createPolygonGroupShader() override;

std::shared_ptr<PolygonPatternGroupShaderInterface> createPolygonPatternGroupShader() override;
std::shared_ptr<PolygonPatternGroupShaderInterface> createPolygonPatternGroupShader(bool fadeInPattern) override;
Copy link
Contributor

Choose a reason for hiding this comment

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

Method signature update to include bool fadeInPattern in createPolygonPatternGroupShader is correct. Ensure downstream usage of this method correctly passes the new parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants