Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Edit features with feature-linked annotation implementation #928

Merged
merged 75 commits into from
Aug 25, 2020

Conversation

vquach2404
Copy link
Collaborator

Implementation of Edit features with feature-linked annotation implementation. Looking forward to feedback!

@vquach2404 vquach2404 requested a review from yo1995 August 5, 2020 01:20
@vquach2404 vquach2404 self-assigned this Aug 5, 2020
Copy link
Collaborator

@yo1995 yo1995 left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this sample! There are a few things to fix and to discuss. I can give another review before getting to Phil.

Comment on lines 27 to 28
private var selectedFeature: AGSFeature?
private var selectedFeatureIsPolyline = false
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's OK to keep them private, but Phil might ask to remove them. Let's wait for his response.

vquach2404 and others added 6 commits August 5, 2020 12:56
…nked annotation/README.md

Co-authored-by: Ting Chen <tchen@esri.com>
…nked annotation/README.md

Co-authored-by: Ting Chen <tchen@esri.com>
…nked annotation/README.metadata.json

Co-authored-by: Ting Chen <tchen@esri.com>
…nked annotation/EditFeaturesWithFeatureLinkedAnnotationViewController.swift

Co-authored-by: Ting Chen <tchen@esri.com>
@vquach2404
Copy link
Collaborator Author

@yo1995 Thanks for the suggestions! I made some changes and it is ready for another review.

Copy link
Collaborator

@yo1995 yo1995 left a comment

Choose a reason for hiding this comment

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

For the identify workflow, here is my version

        mapView.identifyLayers(atScreenPoint: screenPoint, tolerance: 10.0, returnPopupsOnly: false) { (results: [AGSIdentifyLayerResult]?, error: Error?) in
            if let error = error {
                self.presentAlert(error: error)
                return
            }
            results?.forEach { (result) in
                guard let featureLayer = result.layerContent as? AGSFeatureLayer, let featureToSelect = result.geoElements[0] as? AGSFeature else { return }
                switch featureToSelect.geometry?.geometryType {
                case .point:
                    self.showEditableAttributes(selectedFeature: featureToSelect)
                case .polyline:
                    let polyline = featureToSelect.geometry as! AGSPolyline
                    let polylineArray = polyline.parts.array()
                    for part in polylineArray {
                        if part.pointCount > 2 {
                            self.selectedFeature = nil
                            self.presentAlert(title: "Make a different selection", message: "Select straight (single segment) polylines only.")
                            return
                        }
                    }
                    self.selectedFeatureIsPolyline = true
                default:
                    return
                }
                featureLayer.select(featureToSelect)
                self.selectedFeature = featureToSelect
            }
        }

This includes all the suggestion I made in early reviews. Feel free to make some changes.

As the day is coming to an end, I'll leave more comments tomorrow. 👋

Copy link
Collaborator

@yo1995 yo1995 left a comment

Choose a reason for hiding this comment

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

A few small issues. Ready for Phil's review! 👍

…nked annotation/EditFeaturesWithFeatureLinkedAnnotationViewController.swift

Co-authored-by: Ting Chen <tchen@esri.com>
Co-authored-by: Philip Ridgeway <pridgeway@esri.com>
@vquach2404 vquach2404 dismissed stale reviews from yo1995 via 686e98c August 20, 2020 22:27
vquach2404 and others added 4 commits August 20, 2020 15:34
…nked annotation/EditFeaturesWithFeatureLinkedAnnotationViewController.swift

Co-authored-by: Philip Ridgeway <pridgeway@esri.com>
@vquach2404 vquach2404 requested a review from philium August 20, 2020 23:10
philium
philium previously approved these changes Aug 20, 2020
Copy link
Contributor

@philium philium left a comment

Choose a reason for hiding this comment

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

@vquach2404 Looks good! Thanks for making all those changes. This is now ready for @saratchandrakarumuri to look at.

yo1995
yo1995 previously approved these changes Aug 21, 2020
Copy link
Contributor

@saratchandrakarumuri saratchandrakarumuri left a comment

Choose a reason for hiding this comment

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

None of the edits are getting save

  • If I change attributes on point feature, they are not reflected in the respective annotation
  • If I try to move a line segment feature, I get this error

IMG_35B140D746A9-1

@vquach2404 vquach2404 dismissed stale reviews from yo1995 and philium via 7aa83d5 August 24, 2020 22:13
@yo1995
Copy link
Collaborator

yo1995 commented Aug 24, 2020

@saratchandrakarumuri Just now I gave it a test and it seems to work fine. Are you using the geodatabase file downloaded by the sample viewer? We are not sure what caused this problem. 🤔

no-issue

@saratchandrakarumuri
Copy link
Contributor

@yo1995 I cleared downloaded geodatabase and tried again with fresh install and ran into it again on couple of devices. But the same thing worked on a sim. So looks like the issue is exclusive with physical devices

@philium
Copy link
Contributor

philium commented Aug 25, 2020

@vquach2404 The location of the geodatabase is readonly on device. I didn't think about that. To fix that, you'll need to copy the geodatabase into a temporary directory. Here is how one sample does the same thing with a mobile map package.

@vquach2404 vquach2404 requested a review from yo1995 August 25, 2020 16:34
@yo1995
Copy link
Collaborator

yo1995 commented Aug 25, 2020

@vquach2404 With this change, the edits are not persisted from session to session as the temp replica is removed after deinit. Should we mention in README?

Copy link
Collaborator

@yo1995 yo1995 left a comment

Choose a reason for hiding this comment

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

The updates LGTM. Looking forward to Sarat's re-review.

@vquach2404 vquach2404 requested a review from philium August 25, 2020 17:46
@vquach2404
Copy link
Collaborator Author

@vquach2404 With this change, the edits are not persisted from session to session as the temp replica is removed after deinit. Should we mention in README?

I don't think this is necessary since most samples behave similarly (e.g. a sample refreshing to a default layer after previously selecting different layers) and the geodatabase is not an online source.

Copy link
Contributor

@saratchandrakarumuri saratchandrakarumuri left a comment

Choose a reason for hiding this comment

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

Now I am able to edit features. Sample is working as expected

@vquach2404 vquach2404 merged commit 63e1a92 into v.next Aug 25, 2020
@vquach2404 vquach2404 deleted the Viv/EditFeaturesWFeatureLinkedAnnotation_vNext branch August 25, 2020 18:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants