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)
J'affiche une info-bulle sur une carte OpenLayers. Cette infobulle affiche les valeurs d'un marqueur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20function 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
Tout se passe bien sauf que QMyMarker.LayerName me retourne [object Object] au lieu du contenu.
cdlt
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23function 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); ...
Ci-dessous: fichier HTML incriminé









Répondre avec citation
Partager