|
|
@ -83,8 +83,9 @@ function getImage(name, situation) { |
|
|
|
} |
|
|
|
|
|
|
|
function buildPolygonsObject(response, name) { |
|
|
|
var r = JSON.parse(response); |
|
|
|
var coordinate = []; |
|
|
|
var formsanswersgeom = response.formsanswersgeom; |
|
|
|
var formsanswersgeom = r.formsanswersgeom; |
|
|
|
const arrayCoordinates = JSON.parse(formsanswersgeom)["coordinates"][0]; |
|
|
|
var n = Object.keys(arrayCoordinates).length; |
|
|
|
|
|
|
@ -94,11 +95,11 @@ function buildPolygonsObject(response, name) { |
|
|
|
coordinate.push([lat, lon]); |
|
|
|
} |
|
|
|
var polygonObject = { |
|
|
|
ID: response.formsanswersid, |
|
|
|
ID: r.formsanswersid, |
|
|
|
name: name, |
|
|
|
title: "Titulo", //response.fieldsanswerssituation
|
|
|
|
address: "Endereço", //response.fieldsanswerseventaddress,
|
|
|
|
coordinate: { coordinate }, |
|
|
|
coordinate: coordinate, |
|
|
|
date: "data" + " | " + "hora", //response.fieldsanswerseventdate + " | " + response.fieldsanswerseventtime,
|
|
|
|
description: "comentário", //response.fielsanswercomment,
|
|
|
|
logo: custom_assets.pluviometer, |
|
|
@ -127,7 +128,7 @@ function buildMarkerObject(response, name) { |
|
|
|
description: "comentário", //response.fielsanswercomment,
|
|
|
|
logo: custom_assets.pluviometer, |
|
|
|
pictures: null, |
|
|
|
image: getImage(name, "situação"), //getMarkerImage(answer.name),
|
|
|
|
image: getImage(name, "situacão"), //getMarkerImage(answer.name),
|
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
@ -141,7 +142,7 @@ function verifyResponse(response, name) { |
|
|
|
|
|
|
|
answer.responseData.array_to_json.forEach((r) => |
|
|
|
r.formcode == "FLOODZONES_OFFICIAL" |
|
|
|
? markers.push(buildPolygonsObject(r, name)) |
|
|
|
? markers.push(buildPolygonsObject(JSON.stringify(r), name)) |
|
|
|
: markers.push(buildMarkerObject(JSON.stringify(r), name)) |
|
|
|
); |
|
|
|
} |
|
|
|