0

Yandex Map 定義を含む JS ファイル:

public class Ymap {  
  public static final native Object getMap() /*-{
    var myMap;

    function init() {
        // Creating an instance of the map and binding it to the container with the specified ID
        // ("map").
        myMap = new ymaps.Map('map', {
            center : [ 55.010251, 82.958437 ], // Новосибирск
            zoom : 9
        }, {
            searchControlProvider : 'yandex#search'
        });

    }
    YMaps.load(init);

    return myMap; 
 }-*/; 
}

そして、この js コードを別のファイルで呼び出して、マップを smartgwt レイアウトに配置します。

  Canvas canvas = new Canvas();
  canvas.addChild((Canvas)Ymap.getMap());

  layoutRight.addMember(canvas);

しかし、ブラウザーで参照エラーが発生しています: Ymaps が定義されていません

4

1 に答える 1