Skip to content

Commit 79e02b9

Browse files
hud10837puneet-pdxgunt0001shubham7109changanxian
authored
don't normalize viewpoints before persisting (#357)
* Implements setting and modifying a map/layers (#136) * changes to display a map * remove unnecessary line * add viewmodel to the micro app * Revert "add viewmodel to the micro app" This reverts commit cfc6b0b. * address code review feedback * remove unused imports * add overlay support (#143) * add overlay support * add doc * remove the fillmaxsize modifier * remove MapState * add viewpointChangedLambda (#159) * add viewpointChangedLambda * address code review feedback * Support LocationDisplay (#160) * add location display micro app * add location permissions * add support for location display * screen to start/stop a location display * fix typo * show error message if location display fails to start * add AppBar and auto pan mode options * fix type of key * improve doc * add readme * adjust screen shot size * adjust screen shot size * set MapView properties in the update callback * use by remember for mutable state * set error message when LDS fails to start when toggling switch * fix doc references to composable Map * Compose Map InteractionOptions (#163) * Rename - Compose MapView (#165) * Compose MapView: Geometry editor (#170) * Compose MapView: SelectionProperties (#173) * add support for WrapAroundMode (#176) * Compose MapView: ViewLabelProperties (#174) * add implementation for gesture events (#172) * add implementation for gesture events * update SDK dependency add Events exposed on GeoView * address code review comment * address code review comments * refactor mapView.viewpointChanged * Compose Map - graphics overlay (#166) * moved GraphicsOverlaysUpdater (#183) * added grid & backgroundGrid impl (#192) * Draw Status (#186) * Geometry editor micro-app (#178) * added invoke (#197) * Update MapView doc pattern (#191) * add support for attribution text (#187) * add support for attribution text * combine attribution bar properties/events in a state object * refactor mapview parameter list * update collect lambda * Update doc * update doc * Add spatialreference changed callback (#193) * invoke currentOnInteractingChanged with initial value of isInteracting * add callback to mapview * rm initial value calls * change ?.let calls to ?.invoke * move parameter above onInteractingChanged * move launch statement above onInteracitngChanged * MapView Rotation & Scale (#195) * Add inset support (#182) * add mapview inset app * add app to settings.gradle * WIP * update formatting * address code review comments * update setViewInset values * add readme * Update README.md * add doc * address code review feedback * rename mapinsets to insets * rename mapinsets * update doc * address code review comments * Add mapview proxy (#190) * create MapViewOperator class * add param to MapView composable * add locationToScreen and doc * more doc * refactor MapView composable to remove unnecessary code * move mapoperator mapview setting to own disposable effect * don't use synchronize for operations * Eof newline * make MapViewOperator derive from a new GeoViewOperator * eof newline * return null if nan from locationToScreen * add copyrights * fix doc * fix doc * rename operator to proxy * rm overlay param again * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/GeoViewProxy.kt Co-authored-by: Gunther Heppner <[email protected]> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/MapView.kt Co-authored-by: Gunther Heppner <[email protected]> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/MapViewProxy.kt Co-authored-by: Gunther Heppner <[email protected]> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/MapViewProxy.kt Co-authored-by: Gunther Heppner <[email protected]> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/MapViewProxy.kt Co-authored-by: Gunther Heppner <[email protected]> * Apply doc fixes from code review Co-authored-by: Puneet Prakash <[email protected]> * mv param below geometry editor * fix doc line length * fix param doc * fix param doc --------- Co-authored-by: Gunther Heppner <[email protected]> Co-authored-by: Puneet Prakash <[email protected]> * update the copyright to the apache License (#203) * add support for onNavigationChanged (#199) * add support for onNavigationChanged * add doc * MapView TimeExtent (#194) * Support for setting Viewpoint on MapView (#202) * support for ViewpointOperation - initial commit * MapViewpointOperation - prototyping * implement await() on MapViewpointOperation, remove onCompleted callbacks * renaming * add execute extension for remaining operations * rename Bounding to SetBoundingGeometry * add set bookmark * add remaining operations to when statement * make execute an abstract fun on MapViewpointOperation * Add set viewpoint app * fix typo * add dependency to microapp on geocompose * add simple app to set viewpoint with different options * add progress indicator to demonstrate await pattern * extract bookmark to remembered val * make abstract fun an extension fun instead * add doc * add readme to microapp * eof newline * fix readme title * rever locationdisplayapp changes * update screenshot * update readme wording * use a simple list instead of reflection * add doc to MainScreen * add dash to project app name * naming and doc changes * mv onViewpointChanged parameter * change dfeautl animate duration to 0.25 * update microapp module namw --------- Co-authored-by: Hudson Miears <[email protected]> * Refactor mapview insets app (#206) * update all since tags in geo-compose module (#227) * Geo-compose: add identify methods and microapp (#223) * add methods to geoviewproxy * rename identifyLayer and identifyGraphicsOverlay to identify as overloads * add prototype app * fix recursive bug * refactor app to separate subcomponents * make one source of truth for geoview in geoviewproxy * make one source of truth for geoview in geoviewproxy * mv business logic to view model class * update doc * add doc to microapp * add top bar * add readme and screenshot * adjust readme description * adjust string resources and error messages * modify identify method to be cancellable and consolidate logic * adjust bottom sheet to only expand to half screen height and move map viewpoint * rename EventDetails -> IdentifyDetails * nullGEoViewErrorMessage no longer uses a getter * rework caching of mapview in proxy to match previous implementation * change doc DIPS -> Dp * fix tolerance parameter types -> Dp * use nullable maximumResults to match swift * sanitize max results * rm yield * add doc enhancements * extract maximum results fun * clamp 0 values for maximumResults * rm throws doc * adjust insets on bottom sheet state change * rm insets behavior * fix doc references * fix doc 200.4.0 * update screenshot * rename className prop * make details height a const * Rename MapView-related microapps to have MapView prefix (#226) * Rename MapView-related microapps to have MapView prefix * Rename all other instances with mapview prefix * rename names in readmes * rename files * rename test directories * add onUnitsPerDipChanged callback lambda (#232) * Add exportImage fun to GeoViewProxy (#233) * Add exportImage fun to GeoViewProxy * update doc * update doc * add isWrapAroundEnabled property to GeoViewProxy (#231) * add isWrapAroundEnabled property to GeoViewProxy * update @SInCE * add doc * Geo-compose: add basic SceneView function (#230) * add SceneView function * eof newline * fix doc and copyright * don't use fully qualified sceneview * added compose BOM (#237) * add ViewPointState (#234) * add ViewPointState * address code review feedback * update doc * Hud10837/layer view state (#228) * add methods to geoviewproxy * rename identifyLayer and identifyGraphicsOverlay to identify as overloads * add prototype app * fix recursive bug * refactor app to separate subcomponents * make one source of truth for geoview in geoviewproxy * make one source of truth for geoview in geoviewproxy * mv business logic to view model class * update doc * add doc to microapp * add top bar * add readme and screenshot * adjust readme description * adjust string resources and error messages * modify identify method to be cancellable and consolidate logic * adjust bottom sheet to only expand to half screen height and move map viewpoint * rename EventDetails -> IdentifyDetails * nullGEoViewErrorMessage no longer uses a getter * rework caching of mapview in proxy to match previous implementation * change doc DIPS -> Dp * fix tolerance parameter types -> Dp * use nullable maximumResults to match swift * sanitize max results * rm yield * add doc enhancements * extract maximum results fun * clamp 0 values for maximumResults * rm throws doc * adjust insets on bottom sheet state change * add layerviewstatechanged callback * add getLayerViewState * move getLayerViewState * mv param position and fix identify mainscreen * SceneView: add sceneview gesture events (#241) * add SceneView function * eof newline * fix doc and copyright * add gesture events * fix param doc" * SceneView: create SceneViewProxy (#246) * create initial SceneViewProxy class * add disposal logic to proxy class * add sceneViewProxy to SceneView * add copyright * SceneView: graphics overlays (#245) * extract graphicsoverlayupdater * eof newline * SceneView: add scene viewpoint operation (#240) * create SceneViewpointOperation * add operation to sceneview * add all operations for sceneview * add doc * eof newline * eof newline * Don't use named params on viewpoint updater * use kotlinx cancellation exception * add copyright * use duration in viewpoint operations * doc * rename durationSeconds and fix microapp * Update feature branch with v.next (#243) * add navigationchanged to sceneview (#248) * SceneView: add ViewLabelProperties (#249) * add viewlabelproperties to sceneview' * fix doc --------- Co-authored-by: Gunther Heppner <[email protected]> * SceneView: attribution (#247) * mv AttributionStateHandler function to AttributionState.kt * add attributionState param to SceneView * add @SInCE tag --------- Co-authored-by: Gunther Heppner <[email protected]> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt (#253) Co-authored-by: Gunther Heppner <[email protected]> * shared the ViewpointChangedState with SceneView (#261) * SceneView TimeExtent (#260) * shared the ViewpointChangedState with SceneView * review update * merge with the feature branch * SceneView spatial reference changed (#258) * add spatial ref changed support * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <[email protected]> * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <[email protected]> * shared the ViewpointChangedState with SceneView --------- Co-authored-by: Puneet Prakash <[email protected]> * shared the ViewpointChangedState with SceneView (#257) * add layerViewStateChanged to SceneView (#262) * The view property needs to be assigned in ViewProxy class (#264) * add cameraController oaram to sceneview (#265) * add onDrawStatusChanged to SceneView (#266) * add FieldOfView (#270) * SceneView: add sunLighting and sunTime (#275) * add sunLighting and sunTime * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <[email protected]> --------- Co-authored-by: Puneet Prakash <[email protected]> * SceneView current viewpoint camera (#256) * add getCurrentViewpointCamera in proxy * expose the currentViewpoint property * impls current view camera * adds a space for lambda * merged with feature branch. * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <[email protected]> --------- Co-authored-by: Puneet Prakash <[email protected]> * add atmosphereEffect (#278) * Add funs for screen coordinate conversion (#272) * Add funs for screen coordinate conversion * update doc * update doc for SceneView Suntime and SunLighting (#282) * SceneView: AnalysisOverlayCollection (#269) * create AnalysisOverlayCollection * mv factory for graphics overlay collection * add analysis to scene view * eof newlines * add doc * Fix doc that mentions graphics overlays Co-authored-by: Puneet Prakash <[email protected]> * mv factory function to SceneView file * address doc comments * mv updater to SceneView file * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <[email protected]> --------- Co-authored-by: Puneet Prakash <[email protected]> * Add space effects on the scene view (#281) * add space effects on scene view * update the comment * SceneView: ambient light color (#279) * add sceneview ambientLightColor param * fix doc * rm full stop * SceneView: add manual rendering funs to SceneViewProxy (#280) * add manual rendering funs to SceneViewProxy * Fix doc * fix doc * SceneView: ImageOverlays (#274) * add ImageOverlayCollection and property * mv factory function to SceneView file * fix doc comments * mv updater to sceneview.kt * Update toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/SceneView.kt Co-authored-by: Puneet Prakash <[email protected]> * use data object for Cleared event * use data object for cleared even tin AnalysisOverlayCollection * use data object for cleared event in GraphicsOverlayCollection --------- Co-authored-by: Puneet Prakash <[email protected]> * SceneView: lighting options microapp (#286) * add sceneview ambientLightColor param * add space effects on scene view * update the comment * fix doc * create lighting options microapp base * set up dropdown menu * add sun time options * add lighting mode options * add Ambient light color options * add atmosphere effect options * add space effect options * change viewpoint and fix sun time picker * clean up code * use sliders instead of textfields for rgb colors * add doc * add readme and screenshot * eof newline * add doc to components * add missing imports * Add doc DropdownMenuAlertDialog * add missing copyright headers * add doc RgbaSlider * add remaining doc * Update microapps/SceneViewLightingOptionsApp/README.md Co-authored-by: Gunther Heppner <[email protected]> --------- Co-authored-by: Changan Shi <[email protected]> Co-authored-by: Gunther Heppner <[email protected]> * bumping sdk to 4122 (#300) Co-authored-by: Soren Roth <[email protected]> * add maven publishing to geo-compose (#301) Co-authored-by: Soren Roth <[email protected]> * Scene view camera controller app (#288) * init implementation for camera controller * add gitignore * adds comments and remove view model. * update the doc and png image * update the comment * add the extra space line * update the screenshot * review update * update the 2023 comment * update the comment * review update * v next merge to geo compose (#303) * change name of Licesne file in preparation for migration to Esri * revert change to license file name * remove extra license file * Update README.md images (#102) * holder commit * Update README.md update link * upload screenshot image * add images to the micro app * Update README.md * Update README.md * use updated name of the auth dependency in README * Create t9nmanifest.txt (#167) * removed module and microapp (#208) * Update gradle.properties (#211) * Update build.gradle.kts (#212) * updates client id and redirect Uri (#216) * Take out build numbers for publishing (#219) * update dependency section of readme for 200.3.0 (#220) * Improve WebView Display (#213) * Update gradle.properties (#238) * Update dependency versions (#235) * kdoc project to doc the released toolkit components. (#284) * kdoc project to doc the released toolkit components. * add dependencies on the dependencies of the released projects. * Update kdoc/build.gradle.kts Co-authored-by: Erick Lopez Solis <[email protected]> --------- Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]> * add kdoc project! --------- Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Puneet Prakash <[email protected]> Co-authored-by: Rama Chintapalli <[email protected]> Co-authored-by: Shubham Sharma <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]> Co-authored-by: Gunther Heppner <[email protected]> Co-authored-by: hud10837 <[email protected]> * Micro app - sceneview viewpoint navigation (#291) * add micro app * update doc * add readme, screenshot. Remove use of spinner * update readme * update doc * update readme * update screenshot * update image, add new location remove unused imports * Geo-Compose: Add module README (#294) * add readme and screenshot to geo-compose module * use table for screenshot * reduce screenshot size * reduce screenshot size * reduce screenshot size * increase screenshot size * reduce screenshot size * Deprecate composable-map (#293) * changes for authentication and compass app * update floorfilter micro app * deprecate composable map * update deprecated annotation * add deprecation annotation to public components * update template-app to use geo-compose module * remove unused import reformat code * Add missing doc to geo-compose classes (#307) * added attribution bar changes (#309) * Geo-compose: Remove ViewpointChangedEvent (#310) * modify mapview with new params * modify sceneview with new params * delete viewpointchangedstate * Geo-compose: Remove ViewpointOperations (#316) * rm MapViewpointOperation * rm SceneViewpointOperation * add mapviewproxy methods * add sceneviewproxy methods * update mapview set viewpoint app * refactor sceneview setviewpointapp * refactor mapview setviewpointapp to match structure of sceneview app * update readmes * rm progress indicator from sceneview app * address pr comments * address pr comments * Compose doc improvements (#315) * Add @stable annotation #319 * Update SceneViewCameraController app to use SceneViewProxy (#325) * Update SceneViewCameraController app to use SceneViewProxy setViewPointCameraAnimated function * update floorFilterApp * Merge v.next into feature-branches/geo-compose (#327) * change name of Licesne file in preparation for migration to Esri * revert change to license file name * remove extra license file * Update README.md images (#102) * holder commit * Update README.md update link * upload screenshot image * add images to the micro app * Update README.md * Update README.md * use updated name of the auth dependency in README * Create t9nmanifest.txt (#167) * removed module and microapp (#208) * Update gradle.properties (#211) * Update build.gradle.kts (#212) * updates client id and redirect Uri (#216) * Take out build numbers for publishing (#219) * update dependency section of readme for 200.3.0 (#220) * Improve WebView Display (#213) * Update gradle.properties (#238) * Update dependency versions (#235) * kdoc project to doc the released toolkit components. (#284) * kdoc project to doc the released toolkit components. * add dependencies on the dependencies of the released projects. * Update kdoc/build.gradle.kts Co-authored-by: Erick Lopez Solis <[email protected]> --------- Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]> * Add version to API ref (#314) --------- Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Rama Chintapalli <[email protected]> Co-authored-by: Shubham Sharma <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]> Co-authored-by: Gunther Heppner <[email protected]> Co-authored-by: hud10837 <[email protected]> * Revisit GraphicsOverlayCollection, AnalysisOverlayCollection and ImageOverlayCollection (#320) * Remove GraphicsOverlaysCollection and its usage Add parameter to MapView to take graphicsOverlays as List * update mapView and SceneView to use arrays for image overlays and analysis overlays update micro app * update geometry editor micro app * remove all graphics overlays, rather than just clear graphics * Update param type to List * remove comma * update doc * update micro app * remember emptylist() * use it instead of mapView * use it instead of sceneView * use it instead of sceneView * use it instead of sceneView --------- Co-authored-by: Gunther Heppner <[email protected]> * modify compass microapp to use mapViewProxy for viewpoints (#337) * Composable MapView/SceneView: remember default parameters (#330) * add remember to default parameters in mapview * add remember to default parameters in sceneview * add circular progress indicator to sceneview setviewpoint microapp * fix lighting options app * use defaults for sceneview * add mapviewdefaults * add doc * Update map and scene parameters to be non-nullable (#331) * SceneView: analysis overlay microapp (#306) * add readme and screenshot to geo-compose module * create microapp module * add prototype version * clean up implementation * add readme * update screenshot * revert screenshot for GeoCompose * update GraphicOverlays and AnalysisOverlay to use latest implementation * update ReadMe * fix typo * add description doc for MainScreen() --------- Co-authored-by: Puneet Prakash <[email protected]> * Composable GeoViews: Viewpoint Persistence (#343) * prototype persistence enum * move viewpoint related code to separate function * ensure persistence type changes are monitored * persist camera for sceneview * initialize sceneview with default matrix * add doc * always set persisted viewpoint even when null * use when statement * mv visible area changed invocation * rename viewpoint persistence * permit nullable persisted camera on sceneview * Rename viewpoint persistence and make it sealed class with overwritten equals and hashcode. This is needed in case we want to add some property to the class later on. * simplify getting current viewpoint and setting to persisted viewpoint * normalize point on save * only normalize viewpoint if sr is pannable or geographic' git push * use mapviewdefaults for default viewpoint persistence value * use normalized geometry as point or polygon depending on viewpoint type * persist non normalized viewpoint if normalized viewpoint is null * rename value from restore in sceneview * add explanatory comments * refactor extension fun mapview.getviewpointbypersistence * Add comments * fix template app still using viewpoint operation * use expression syntax * add viewpoint persistence doc * mv parameter higher * rm cast to polygon for bounding geometry on restoration * factor out normalize function * use early return style for readability' * rename viewpointtopersist -> normalizedviewpoint * use expression syntax for hashcode and equals * convert tryNormalizeViewpoint to extension fun on Viewpoint * don't normalize viewpoints before persisting * update sdk build number --------- Co-authored-by: Puneet Prakash <[email protected]> Co-authored-by: Gunther Heppner <[email protected]> Co-authored-by: Shubham Sharma <[email protected]> Co-authored-by: Changan Shi <[email protected]> Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Soren Roth <[email protected]> Co-authored-by: Rama Chintapalli <[email protected]> Co-authored-by: Erick Lopez Solis <[email protected]>
1 parent 1dd1d78 commit 79e02b9

File tree

1 file changed

+1
-43
lines changed
  • toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose

1 file changed

+1
-43
lines changed

toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/MapView.kt

+1-43
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ import androidx.compose.ui.semantics.contentDescription
3737
import androidx.compose.ui.semantics.semantics
3838
import androidx.compose.ui.viewinterop.AndroidView
3939
import com.arcgismaps.ArcGISEnvironment
40-
import com.arcgismaps.geometry.GeometryEngine
41-
import com.arcgismaps.geometry.Point
4240
import com.arcgismaps.geometry.Polygon
4341
import com.arcgismaps.geometry.SpatialReference
4442
import com.arcgismaps.mapping.ArcGISMap
@@ -424,11 +422,7 @@ private fun ViewpointHandler(
424422
var persistedViewpoint by rememberSaveable(
425423
saver = Saver(
426424
save = {
427-
val viewpoint = it.value ?: return@Saver null
428-
// Normalize the viewpoint before persisting it as restoring it after rotation
429-
// may fail if the viewpoint has crossed the central meridian
430-
val viewpointToPersist = viewpoint.tryNormalize()
431-
viewpointToPersist.toJson()
425+
it.value?.toJson()
432426
},
433427
restore = {
434428
mutableStateOf(Viewpoint.fromJsonOrNull(it))
@@ -478,42 +472,6 @@ private fun ViewpointHandler(
478472
}
479473
}
480474

481-
/**
482-
* Normalizes this viewpoint's target geometry.
483-
*
484-
* If the spatial reference is null or not pannable or geographic, the viewpoint is returned as is.
485-
* Otherwise, the viewpoint's target geometry is normalized and a new viewpoint is created with the
486-
* normalized geometry.
487-
*
488-
* @since 200.4.0
489-
*/
490-
private fun Viewpoint.tryNormalize(): Viewpoint {
491-
// Normalization should only be done with pannable or geographic spatial references.
492-
val sr = targetGeometry.spatialReference ?: return this
493-
if (!sr.isPannable && !sr.isGeographic) return this
494-
// if normalization fails, just return the viewpoint as is
495-
val normalizedGeometry =
496-
GeometryEngine.normalizeCentralMeridian(targetGeometry) ?: return this
497-
498-
val normalizedViewpoint = when (viewpointType) {
499-
ViewpointType.CenterAndScale -> {
500-
Viewpoint(
501-
center = normalizedGeometry as Point,
502-
scale = targetScale,
503-
rotation = rotation
504-
)
505-
}
506-
507-
ViewpointType.BoundingGeometry -> {
508-
Viewpoint(
509-
boundingGeometry = normalizedGeometry,
510-
rotation = rotation
511-
)
512-
}
513-
}
514-
return normalizedViewpoint
515-
}
516-
517475
/**
518476
* Returns the current viewpoint of the [MapView] with the appropriate [ViewpointType] based on [viewpointPersistence].
519477
*

0 commit comments

Comments
 (0)