public Layer[] getLayers() { JSObject jsObjects = MapImpl.getLayers(getJSObject()); JObjectArray jObjectArray = JObjectArray.narrowToJObjectArray(jsObjects); Layer[] layers = new Layer[jObjectArray.length()]; for (int i = 0; i < jObjectArray.length(); i++) { layers[i] = Layer.narrowToLayer(jObjectArray.get(i)); } return layers; }
public void addLayers(Layer[] layers) { JSObject[] jsObjects = new JSObject[layers.length]; for (int i = 0; i < layers.length; i++) { jsObjects[i] = layers[i].getJSObject(); } JObjectArray array = new JObjectArray(jsObjects); MapImpl.addLayers(getJSObject(), array.getJSObject()); }