Skip to content

Move geometry package to core:domain#3601

Merged
andreia-ferreira merged 7 commits intomasterfrom
andreia/move-domain-geometry-classes
Mar 10, 2026
Merged

Move geometry package to core:domain#3601
andreia-ferreira merged 7 commits intomasterfrom
andreia/move-domain-geometry-classes

Conversation

@andreia-ferreira
Copy link
Collaborator

Towards #3585 ; #3600

This PR moves the geometry package to :core:domain. These classes will be needed for the new feature to share geometry by QR code, which will have its usecase in the domain module.

Most changes listed are import updates, the only 'real' changes are:

  • Move area out of Geometry and to GmsExt, since it relies on google maps logic which is an android dependency at the moment
  • Update centerOrError method inside Geometry to only use Kotlin logic to achieve the same that was done by the maps-specific logic LatLngBounds.center()
  • Extract UiFormatUtil from PolygonUtil (which was moved to domain). PolygonUtil is then focused on calculations, while UiFormatUtil handles formatting area values to be presented in the UI

@shobhitagarwal1612 PTAL?

@auto-assign auto-assign bot requested a review from hassan-nsubuga March 9, 2026 17:01
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request undertakes a significant architectural refactoring by relocating the geometry package to a new :core:domain module. This move is crucial for an upcoming feature that requires geometry sharing via QR code, necessitating a domain-level representation. The changes primarily involve updating import paths across the codebase, alongside strategic modifications to decouple Android-specific logic from the core geometry models. This ensures a cleaner separation of concerns and enhances the reusability of the geometry components.

Highlights

  • Geometry Package Relocation: The core geometry package has been moved from app/src/main/java/org/groundplatform/android/model/geometry to a new domain module at core/domain/src/commonMain/kotlin/org/groundplatform/domain/model/geometry. This refactoring decouples core geometry logic from Android-specific dependencies, making it reusable across different platforms.
  • Decoupling Area Calculation: The area property was removed from the Geometry interface in the domain module. Area calculation, which relies on Google Maps logic, has been moved to an extension function area() within GmsExt.kt in the Android-specific ui.map.gms package. This ensures that the domain layer remains pure Kotlin and free of Android dependencies.
  • Pure Kotlin Center Calculation: The centerOrError method within the Geometry interface (now in the domain module) has been updated to use pure Kotlin logic for calculating the center of a bounding box, removing its previous dependency on Google Maps' LatLngBounds.center() method.
  • UI Formatting Extraction: The UiFormatUtil class has been extracted from PolygonUtil and moved to app/src/main/java/org/groundplatform/android/ui/util/UiFormatUtil.kt. This separates UI-specific formatting concerns (like getFormattedArea) from core geometric calculations, allowing PolygonUtil (now in the domain module) to focus solely on computational logic.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • app/src/main/java/org/groundplatform/android/data/local/room/converter/ConverterExt.kt
    • Updated imports to use java.util.Date explicitly and replaced android.model.geometry imports with domain.model.geometry.
  • app/src/main/java/org/groundplatform/android/data/local/room/converter/GeometryWrapperTypeConverter.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/data/local/room/converter/ValueJsonConverter.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/data/local/room/entity/GeometryWrapper.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/data/remote/firebase/protobuf/ModelToProtoExt.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/data/remote/firebase/schema/CaptureLocationResultConverter.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/data/remote/firebase/schema/GeometryConverter.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/model/locationofinterest/LocationOfInterest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/model/map/Bounds.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/model/map/CameraPosition.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/model/mutation/LocationOfInterestMutation.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/model/submission/CaptureLocationTaskData.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/model/submission/GeometryTaskData.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/repository/LocationOfInterestRepository.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/system/GeocodingManager.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/system/SettingsClient.kt
    • Removed an unused import for com.google.android.gms.location.SettingsClient.
  • app/src/main/java/org/groundplatform/android/ui/common/AbstractMapContainerFragment.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/common/BaseMapViewModel.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/common/LocationOfInterestHelper.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/datacollection/DataCollectionInitializer.kt
    • Added an import for DataCollectionInitializer.Companion.TASK_POSITION_ID.
  • app/src/main/java/org/groundplatform/android/ui/datacollection/tasks/location/CaptureLocationTaskViewModel.kt
    • Removed unused kotlin.lazy import and updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/datacollection/tasks/point/DropPinTaskViewModel.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/datacollection/tasks/polygon/DrawAreaTaskViewModel.kt
    • Updated geometry imports to reference the new domain.model.geometry packageanddomain.util` for polygon calculations.
  • app/src/main/java/org/groundplatform/android/ui/home/mapcontainer/HomeScreenMapContainerViewModel.kt
    • Added org.groundplatform.android.ui.map.gms.GmsExt.area import and updated calls to geometry.area().
  • app/src/main/java/org/groundplatform/android/ui/home/mapcontainer/jobs/LoiJobSheet.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/CameraUpdateRequest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/Feature.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/MapFragment.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/gms/CachingUpscalingTileProvider.kt
    • Added an import for CachingUpscalingTileProvider.Companion.DEFAULT_TILE_SIZE.
  • app/src/main/java/org/groundplatform/android/ui/map/gms/ConverterExt.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/gms/GmsExt.kt
    • Added com.google.maps.android.SphericalUtil.computeArea import and introduced an area() extension function for Geometry types.
  • app/src/main/java/org/groundplatform/android/ui/map/gms/GoogleMapsFragment.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/gms/features/LineStringRenderer.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/gms/features/MapsItemManager.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/gms/features/MapsItemRenderer.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/gms/features/PointRenderer.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/gms/features/PolygonRenderer.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/map/gms/mog/TileCoordinates.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/main/java/org/groundplatform/android/ui/signin/SignInScreen.kt
    • Removed an unused import for org.groundplatform.android.proto.style.
  • app/src/main/java/org/groundplatform/android/ui/util/UiFormatUtil.kt
    • Added a new file containing the getFormattedArea function and related constants for UI formatting.
  • app/src/main/java/org/groundplatform/android/util/CoordinatesExt.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/FakeData.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/data/local/LocalLocationOfInterestStoreTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/data/local/LocalSubmissionStoreTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/data/local/room/converter/ValueJsonConverterTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/data/remote/firebase/protobuf/LoiMutationConverterTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/data/remote/firebase/protobuf/ModelToProtoExtKtTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/data/remote/firebase/schema/GeometryConverterTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/data/remote/firebase/schema/LoiConverterTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/data/remote/firebase/schema/SubmissionMutationConverterTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/data/sync/LocalMutationSyncWorkerTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/model/geometry/GeometryTest.kt
    • Renamed to core/domain/src/commonTest/kotlin/org/groundplatform/domain/model/geometry/GeometryTest.kt, updated package, and adjusted area property calls to area() function calls.
  • app/src/test/java/org/groundplatform/android/repository/LocationOfInterestRepositoryTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/system/GeocodingManagerTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/datacollection/DataCollectionFragmentTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/datacollection/tasks/location/CaptureLocationTaskFragmentTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/datacollection/tasks/point/DropPinTaskFragmentTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/datacollection/tasks/point/DropPinTaskViewModelTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/datacollection/tasks/polygon/DrawAreaTaskFragmentTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/datacollection/tasks/polygon/DrawAreaTaskViewModelTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/home/mapcontainer/HomeScreenMapContainerViewModelTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/home/mapcontainer/jobs/LoiJobSheetTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/map/gms/mog/MogClientTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/map/gms/mog/TileCoordinatesTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/offlineareas/selector/OfflineAreaSelectorViewModelTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/ui/syncstatus/SyncStatusFragmentTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/usecases/submission/SubmitDataUseCaseTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/usecases/survey/RemoveOfflineSurveyUseCaseTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/util/CoordinatesExtTest.kt
    • Updated geometry imports to reference the new domain.model.geometry package.
  • app/src/test/java/org/groundplatform/android/util/UiFormatUtilTest.kt
    • Added a new test file for UiFormatUtil.
  • core/domain/src/commonMain/kotlin/org/groundplatform/domain/model/geometry/Coordinates.kt
    • Renamed from app/src/main/java/org/groundplatform/android/model/geometry/Coordinates.kt and updated package declaration.
  • core/domain/src/commonMain/kotlin/org/groundplatform/domain/model/geometry/Geometry.kt
    • Renamed from app/src/main/java/org/groundplatform/android/model/geometry/Geometry.kt, updated package, removed area property, and refactored centerOrError to use pure Kotlin logic.
  • core/domain/src/commonMain/kotlin/org/groundplatform/domain/model/geometry/InvalidGeometryException.kt
    • Renamed from app/src/main/java/org/groundplatform/android/model/geometry/InvalidGeometryException.kt and updated package declaration.
  • core/domain/src/commonMain/kotlin/org/groundplatform/domain/util/PolygonUtil.kt
    • Renamed from app/src/main/java/org/groundplatform/android/ui/util/PolygonUtil.kt, updated package, and removed UI formatting functions.
  • core/domain/src/commonTest/kotlin/org/groundplatform/domain/util/UiFormatUtilTest.kt
    • Renamed from app/src/test/java/org/groundplatform/android/util/PolygonUtilTest.kt, updated package, and removed tests for UI formatting functions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

…-geometry-classes

# Conflicts:
#	app/src/main/java/org/groundplatform/android/ui/home/mapcontainer/jobs/LoiJobSheet.kt
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a significant refactoring that moves the geometry package into the :core:domain module, successfully decoupling domain models from Android-specific dependencies. The changes are well-executed, including moving files, updating imports, and refactoring code to eliminate dependencies on the Google Maps SDK from the domain layer. Key changes like moving the area calculation to GmsExt.kt and re-implementing centerOrError in pure Kotlin are commendable. I have one suggestion to improve the naming of a test file for better code clarity and maintainability.

Note: Security Review is unavailable for this PR.

andreia-ferreira and others added 3 commits March 9, 2026 18:36
…il/UiFormatUtilTest.kt

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 69.59%. Comparing base (519599b) to head (9c6930a).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...va/org/groundplatform/android/ui/map/gms/GmsExt.kt 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3601      +/-   ##
============================================
- Coverage     69.69%   69.59%   -0.11%     
- Complexity     1811     1814       +3     
============================================
  Files           349      346       -3     
  Lines          9675     9583      -92     
  Branches       1060     1028      -32     
============================================
- Hits           6743     6669      -74     
+ Misses         2298     2291       -7     
+ Partials        634      623      -11     
Files with missing lines Coverage Δ
.../android/data/local/room/converter/ConverterExt.kt 84.76% <ø> (ø)
...cal/room/converter/GeometryWrapperTypeConverter.kt 60.00% <ø> (ø)
...id/data/local/room/converter/ValueJsonConverter.kt 64.15% <ø> (ø)
.../android/data/local/room/entity/GeometryWrapper.kt 85.71% <ø> (ø)
...d/data/remote/firebase/protobuf/ModelToProtoExt.kt 84.84% <ø> (ø)
.../firebase/schema/CaptureLocationResultConverter.kt 0.00% <ø> (ø)
...d/data/remote/firebase/schema/GeometryConverter.kt 80.00% <ø> (ø)
...oid/model/locationofinterest/LocationOfInterest.kt 90.00% <ø> (ø)
...ava/org/groundplatform/android/model/map/Bounds.kt 64.28% <ø> (ø)
...groundplatform/android/model/map/CameraPosition.kt 83.87% <ø> (ø)
... and 29 more

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andreia-ferreira andreia-ferreira merged commit e880abd into master Mar 10, 2026
9 checks passed
@andreia-ferreira andreia-ferreira deleted the andreia/move-domain-geometry-classes branch March 10, 2026 09:56
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