/** * This is not an OpenLayers native function. Will remove all overlays * from the this Map. */ public void removeOverlayLayers() { Layer[] layers = getLayers(); for (int i = 0; i < layers.length; i++ ) { if(layers[i].isBaseLayer() == false ) { removeLayer(layers[i]); } } }
public void execute() { getMap().updateSize(); } });
public static Map narrowToMap(JSObject object) { return (object == null)? null: new Map(object); }
/** * See also {@link MapUnits}. * * @return String - the units used by the projection */ public String getUnits(){ return MapImpl.getUnits(getJSObject()); }
public LonLat getLonLat(){ Map map = Map.narrowToMap(this.getSourceJSObject()); Pixel pixel = Pixel.narrowToPixel(getJSObject().getProperty("xy")); return (pixel != null)? map.getLonLatFromPixel(pixel):null; } }
public Map getSource() { JSObject object = getSourceJSObject(); return (object != null) ? Map.narrowToMap(object) : null; }
public OverviewMap(OverviewMapController controller) { super("270px"); // XXX map needs explicit px height this.controller = controller; map.addLayer(this.markerLayer); new OverviewMapEventBroker(); }
/** * Rebuild vector layer. */ public void rebuildVectorLayer() { this.map.removeLayer(this.vector); this.initVectorLayer(); }
/** * This is not an OpenLayers native function. OpenLayers has getLayersByName * that returns all layers matching the name. * * @param name - the name of a layer or part of it * @return Layer - the first layer that matches the name (so, if there are more layers * matching the name then only one is returned) or null if no layer matches */ public Layer getLayerByName(String name){ //FIXME: this function goes wrong if getLayersByName returns null // fix - let getLayersByName return empty array + update javadoc Layer[] layers = this.getLayersByName(name); if(layers != null && layers.length > 0){return layers[0];}else{return null;} }
/** * * @param name - the name of a layer or part of it * @return Layer[] - all layers with a name that fully or partially * matches the input name or null if no layer matches */ public Layer[] getLayersByName(String name){ String regex= ".*" + name + ".*"; Layer[] layers = this.getLayers(); List<Layer> layersFound = new ArrayList<Layer>(); for(int i = 0, max = layers.length; i < max;i++){ if(layers[i].getName().matches(regex)){ layersFound.add(layers[i]); } } if(layersFound.size()>0){ int max = layersFound.size(); Layer[] found = new Layer[max]; for(int j = 0; j < max;j++ ){ found[j] = (Layer) layersFound.get(j); } return found; }else{ return null; } }
public LonLat getCenter() { return map.getCenter(); }
/** * This function should be called by any external code which dynamically * changes the size of the map div. It can also be called when experiencing * the problem of the single small tile in the upper left corner (doesn't * work in all situations thought) */ public void updateSize() { MapImpl.updateSize(getJSObject()); }
public LonLat getLonLat() { Map map = Map.narrowToMap(this.getSourceJSObject()); Pixel pixel = Pixel.narrowToPixel(getJSObject().getProperty("xy")); return (pixel != null) ? map.getLonLatFromPixel(pixel) : null; }
public Map getSource(){ JSObject object = getSourceJSObject(); return (object!=null)?Map.narrowToMap(object):null; }
/** * Creates the osm. */ private void createOSM() { this.osm = OSM.THIS("OpenStreetMap Preview", OpenLayers.getProxyHost() + "http://tile.openstreetmap.org/${z}/${x}/${y}.png", new OSMOptions()); ; // OSM.Mapnik("OpenStreetMap Preview"); this.map.addLayer(osm); }
/** * This is not an OpenLayers native function. OpenLayers has getLayersByName * that returns all layers matching the name. * * @param name - the name of a layer or part of it * * @return Layer - the first layer that matches the name (so, if there are * more layers matching the name then only one is returned) or null if no * layer matches */ public Layer getLayerByName(String name) { //FIXME: this function goes wrong if getLayersByName returns null // fix - let getLayersByName return empty array + update javadoc Layer[] layers = this.getLayersByName(name); if (layers != null && layers.length > 0) { return layers[0]; } else { return null; } }
/** * * @param name - the name of a layer or part of it * * @return Layer[] - all layers with a name that fully or partially matches * the input name or null if no layer matches */ public Layer[] getLayersByName(String name) { String regex = ".*" + name + ".*"; Layer[] layers = this.getLayers(); List<Layer> layersFound = new ArrayList<Layer>(); for (int i = 0, max = layers.length; i < max; i++) { if (layers[i].getName().matches(regex)) { layersFound.add(layers[i]); } } if (layersFound.size() > 0) { int max = layersFound.size(); Layer[] found = new Layer[max]; for (int j = 0; j < max; j++) { found[j] = (Layer) layersFound.get(j); } return found; } else { return null; } }
/** * zoom in with one step. */ public void zoomIn() { MapImpl.zoomIn(getJSObject()); }
/** * This is not an OpenLayers native function. Will remove all overlays from * the this Map. */ public void removeOverlayLayers() { Layer[] layers = getLayers(); for (int i = 0; i < layers.length; i++) { if (layers[i].isBaseLayer() == false) { removeLayer(layers[i]); } } }