2 pièce(s) jointe(s)
[object Object] à la place du contenu d'une propriété d'objet
Bjr,
Assez novice en JS, et par nécessité, je bute sur un problème ch*** +++
J'ai un TJSMarker qui possède une propriété .LayerName (string contenant le nom d'une couche)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
function TJSMarker(QLayerName, QNativeCoordoX, QNativeCoordoY, QNativeCoordoZ, QLat, QLon, QEtiquette, QDesignation, QDescription, QObservations, QTypeMarker, QSize, QLineColor, QFillColor, QFillOpacity, QPhoto)
{
this.LayerName = QLayerName;
this.NativeCoordoX = QNativeCoordoX;
this.NativeCoordoY = QNativeCoordoY;
this.NativeCoordoZ = QNativeCoordoZ;
this.Lat = QLat;
this.Lon = QLon;
this.Etiquette = QEtiquette;
this.Designation = QDesignation;
this.Description = QDescription;
this.Observations = QObservations;
this.TypeMarker = QTypeMarker;
this.Size = QSize;
this.LineColor = QLineColor;
this.FillColor = QFillColor;
this.FillOpacity = QFillOpacity;
this.Photo = QPhoto;
} // TJSMarker |
J'affiche une info-bulle sur une carte OpenLayers. Cette infobulle affiche les valeurs d'un marqueur
Tout se passe bien sauf que QMyMarker.LayerName me retourne [object Object] au lieu du contenu.
Pièce jointe 634370
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
function DrawMarker(QMyMap, QL, QMyMarker)
{
var QDemiLargeurRectangle = 0.0000089940 * QMyMarker.Size;
var QDemiHauteurRectangle = 0.0000089940 * QMyMarker.Size * 0.71;
var QContentPopUp = "";
if (QMyMarker.Photo.length > 3) //
{
QContentPopUp += "<IMG width='300' SRC= '" + QMyMarker.Photo + "'</IMG>";
} //
QContentPopUp += "<B>" + QMyMarker.Designation + "</B><BR>" +
QMyMarker.Etiquette +
"<HR>" +
"<P>" + QMyMarker.Description + "</P>" +
"<P>" + QMyMarker.Observations + "</P>" +
"<HR>" +
"X = " + QMyMarker.NativeCoordoX + // OK
" - Y = " + QMyMarker.NativeCoordoY +
" - Z = " + QMyMarker.NativeCoordoZ +
"<HR><B> Layer: " + QMyMarker.LayerName + "</B>"; // ce fdp me retourne [object Object]
QContentPopUp += "<HR>" +
"Lat: " + QMyMarker.Lat.toFixed(8) + " - Lon: " + QMyMarker.Lon.toFixed(8);
... |
cdlt
Ci-dessous: fichier HTML incriminé