// WHEN THE USER CLICKS THE MAP THIS IS CALLED WHICH IN TUNR CALLS THIS FUNCTION: geoElementsGetElements(result);
onIdentifyLayersStatusChanged: {
if (identifyLayersStatus !== Enums.TaskStatusCompleted)
return;
msgvobjectid = "";
msgvidcount = "";
msgvuserid = "";
msgvSurveyed = "";
msgvclass = "";
// loop through the results
var results = mapView.identifyLayersResults;
for (var i = 0; i < results.length; i++) {
var result = results[i];
var count = geoElementsCountFromResult(result);
var layerName = result.layerContent.name;
var returnarray = geoElementsGetElements(result);
for (var e = 0; e < returnarray.length; e++) {
msgvobjectid = returnarray[e].objectid;
msgvidcount = returnarray[e].userid;
msgvuserid = returnarray[e].idcount;
msgvSurveyed = returnarray[e].Surveyed;
msgvclass = returnarray[e].class;
speedModel.append({objectid:msgvobjectid,idcount:msgvidcount,userid:msgvuserid,Surveyed:msgvSurveyed});
}
}
// FUNCTION THAT IS CALLED THAT CREATES THE ARRAY AND SENDS BACK
function geoElementsGetElements(identifyLayerResult) {
// create temp array
var tempResults = [identifyLayerResult];
var vobjectid = "";
var vidcount = "";
var vuserid = "";
var vSurveyed = "";
var vclass = "";
var arrayName = [];
var identifyResult2 = tempResults[index];
// DEFINE ARRAY VARIABLES
var arr = [];
for (var i = 0; i < identifyResult2.geoElements.length; i++){
var elem = identifyResult2.geoElements[i];
identifiedObjects.push(elem);
vobjectid = identifyResult2.geoElements[i].attributes.attributeValue("objectid")
vidcount = identifyResult2.geoElements[i].attributes.attributeValue("PublicPrivate")
vuserid = identifyResult2.geoElements[i].attributes.attributeValue("Item")
vSurveyed = identifyResult2.geoElements[i].attributes.attributeValue("Comments")
vclass = identifyResult2.geoElements[i].attributes.attributeValue("CaseNum")
arrayName = [vobjectid, vidcount, vuserid, vSurveyed, vclass]
// BUILD THE ARRAY
var obj = {};
obj['objectid'] = vobjectid;
obj['idcount'] = vidcount;
obj['userid'] = vuserid;
obj['Surveyed'] = vSurveyed;
obj['class'] = vclass;
arr.push(obj);
}
return arr
}
// CREATE THE LIST MODEL
ListModel {
id: speedModel
Component.onCompleted: {
[
{"objectid":0,
"idcount":"",
"userid":"",
"Surveyed":""}
]
}
}
// CREATE THE DIALOG AND LISTVIEW THAT WILL SHOW THE RECORDS
Dialog {
id: msgDialog
modal: true
title: headerCount
font.pixelSize: 10
//standardButtons: Dialog.Ok
//property alias text : textLabel.text
width: 300
height: 250
// POSITION OF msgDialog
x: Math.round(parent.width - width) / 2
y: Math.round(parent.height - height) / 2
Rectangle {
id: inside
width: msgDialog.width * .9; height: 180
anchors.fill: parent
border.color: "black"
border.width: 5
Component {
id: contactDelegate
Item {
width: 180; height: 160
Column {
Text { text: '<b>ObjectID:</b> ' + objectid }
Text { text: '<b>idcount: </b> ' + idcount }
Text { text: '<b>userid: </b> ' + userid }
Text { text: '<b>idcount: </b> ' + Surveyed }
Text { text: '-------------' }
}
}
}
ListView {
anchors.fill: inside
flickableDirection: Flickable.VerticalFlick
model: speedModel
delegate: contactDelegate
//highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
focus: true
}
}
}
Bookmarks