Updating point feature problem qt/qml

2767
4
02-25-2016 05:17 AM
tanerkoka1
Occasional Contributor

Hi,

I'm using GeodatabaseFeatureServiceTable service to update point feature in online side. But I can't update my point feature to another place.Point moves to other place but can't apply feature edits back to the service and applyFeatureEditsErrors  object is undefined when trigger onApplyFeatureEditsErrorsChanged event in GeodatabaseFeatureServiceTable  .Are there any wrong code in my app.Here is the app and console output below.

Thanks.

import QtQuick.Controls.Styles 1.2

import ArcGIS.Extras 1.0

import QtQuick 2.3

import QtQuick.Controls 1.2

import ArcGIS.Runtime 10.26

ApplicationWindow {

    id: appWindow

    width: 800

    height: 600

    title: "Test"

    property double scaleFactor: System.displayScaleFactor

    property int fontSize: 15 * scaleFactor

    property string featuresUrl: "http://........................./arcgis/rest/services/....................../.........................."

    property var selectedFeatureId: null

    Envelope  {

      id: sfExtent

        xMin: 3430342.171241454

        yMin: 4671974.99845585

        xMax: 3775017.817877803

        yMax: 4976536.316803186

    }

    Map {

        id: mainMap

        anchors.fill: parent

        extent: sfExtent

        focus: true

        ArcGISTiledMapServiceLayer

        {

            url: "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"

            opacity: 0.5

        }

        ArcGISDynamicMapServiceLayer

        {

            url: "http://........................................./arcgis/rest/services/................../.............."

        }

        FeatureLayer {

           id: onlineNumaratajLayer

           featureTable: featureServiceNumaratajTable

           selectionColor: "cyan"

            function hitTestFeatures(x,y) {

                var tolerance = Qt.platform.os === "ios" || Qt.platform.os === "android" ? 4 : 1;

                var featureIds = onlineNumaratajLayer.findFeatures(x, y, tolerance * scaleFactor, 1);

                if (featureIds.length > 0) {

                    selectedFeatureId = featureIds[0];

                    selectFeature(selectedFeatureId);

                    statusText.text = "Feature Selected.Please Update Point";

                }

            }

        }

        onMouseClicked:

        {

            if (onlineNumaratajLayer.isFeatureSelected(selectedFeatureId))

            {

                var featureToEdit = onlineNumaratajLayer.featureTable.feature(selectedFeatureId);

                featureToEdit.geometry = mouse.mapPoint;

                onlineNumaratajLayer.featureTable.updateFeature(selectedFeatureId, featureToEdit);

                onlineNumaratajLayer.unselectFeature(selectedFeatureId);

         

               featureServiceNumaratajTable.applyFeatureEdits();

         

               statusText.text="Editing is complated";

                selectedFeatureId = null;

            } else

                onlineNumaratajLayer.hitTestFeatures(mouse.x,mouse.y);

        }

    }

    GeodatabaseFeatureServiceTable {

        id: featureServiceNumaratajTable

        url: featuresUrl + "/1"

     

onApplyFeatureEditsErrorsChanged:

   console.log("Error Edit Operation String :"+applyFeatureEditsErrors.editOperationString);

    console.log("Error Edit Operation :"+applyFeatureEditsErrors.editOperation);

  }

  

}

    Rectangle {

        id: textStatusRectangle

        anchors {

            fill: statusText

            margins: -10 * scaleFactor

        }

        visible: statusText.text.length > 0

        color: "lightgrey"

        radius: 5

        border.color: "black"

        opacity: 0.77

    }

    Text {

        id: statusText

        anchors {

            left: parent.left

            right: parent.right

            bottom: parent.bottom

            margins: 20 * scaleFactor

        }

        wrapMode: Text.WordWrap

        color: "black"

    }

    Rectangle {

        anchors.fill: parent

        color: "transparent"

        border {

            width: 0.5 * scaleFactor

            color: "black"

        }

    }

}

Console output:

Starting D:\Projects\Packages\QT\build-OfflineNumtest-Desktop_Qt_5_4_2_MSVC2013_64bit-Release\release\OfflineNumtest.exe...

Initializing application

ArcGIS.Extras.Plugin: void __cdecl ArcGISExtrasPlugin::registerTypes(const char *) ArcGIS.Extras

ArcGIS.Extras.Plugin: void __cdecl ArcGISExtrasPlugin::registerTypes(const char *) Registering Singleton Types

ArcGIS.Extras.Core: void __cdecl TkTypes::registerTypes(const char *) ArcGIS.Extras

int __cdecl main(int,char *[]) ApplicationWindow_QMLTYPE_12_QML_15(0x21c40d0)

qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method

qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method

qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method

qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method

qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto

qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb

qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated

qml: Error Edit Operation String :undefined

qml: Error Edit Operation :undefined

Tags (2)
0 Kudos
4 Replies
LucasDanzinger
Esri Frequent Contributor

Taner-

Instead of

console.log("Error Edit Operation String :"+applyFeatureEditsErrors.editOperationString);
console.log("Error Edit Operation :"+applyFeatureEditsErrors.editOperation);

Can you do

console.log("Error Edit Operation :"+applyFeatureEditsErrors.error.description);

Instead?

Maybe that will give more ideas.

-Luke

tanerkoka1
Occasional Contributor

Hi,

Here is the consoe output of console.log("Error Edit Operation :"+applyFeatureEditsErrors.error.description); code:

qrc:/qml/main.qml:122: TypeError: Cannot read property 'description' of undefined

0 Kudos
tanerkoka1
Occasional Contributor

I add also onApplyFeatureEditsStatusChanged event in GeodatabaseFeatureServiceTable  like below.When I update feature applyFeatureEditsStatus status is  2 (Complatet) but my feature is the same location on the server.

App:

onApplyFeatureEditsStatusChanged:

{

console.log(applyFeatureEditsStatus);

}

Console Olutput:

qml: 2

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Perhaps you could use Fiddler to capture the http network traffic and see if the proper information is being sent to the server? Note that you will need to set up proxy to point to local host in order to do this -- ArcGIS Runtime SDK for Qt QML API: ArcGISRuntime Class Reference

0 Kudos