I am new to javascript, so in this example there is geometrycontrols.js (for global controls) and markercontrol.js (for marker controls)
my problem is defining arrays where the "data" is stored ...
in the link, I see the savedata function, but I have no idea how to work with this function ...
on the other hand, in test.html, if I have access to run Glog and output "data", and let me think that this comes from an array ...
My goal is to save the coordinates and other attributes of the mysql database, and when I find out where the "data" is the easy part.
if someone worked with this example (or not), can help me, I am grateful
ps: i'm really new to javascript: P
edit1: I was away for a while, and now I'm concentrated in the field of geometrycontrols.js specifically in: GeometryControls.prototype.saveData = function(opts){
var me = this;
if(opts.allData === true){
//me.saveAllData();
} else {
//construct a json data record
var geomInfo = opts.geomInfo, index = opts.geomInfo.index;
var record = geomInfo.storage[index];
var recordJSON = {};
recordJSON.type = record.type;
recordJSON.coordinates = [];
if(record.type === "point"){
recordJSON.coordinates.push({lat:record.geometry.getLatLng().lat(),lng:record.geometry.getLatLng().lng()});
alert(recordJSON.coordinates);
} else {
alert("is not point");
var vertex;
for(var i=0;i<record.geometry.getVertexCount();i++){
vertex = record.geometry.getVertex(i);
recordJSON.coordinates.push({lat:vertex.lat(),lng:vertex.lng()});
}
}
recordJSON.title = record.title[0];
recordJSON.description = record.description[0];
recordJSON.style = "";
me.debug(data);
};postData(me.serialize(recordJSON));}; `
When I warn (recordJSON.coordinates), outupt is [object Object], and I don't know why, theoretically this array contains coordinates ...