Esempio n. 1
0
  /**
   * tell this layer where to plot itself
   *
   * @param map
   */
  public void setMap(MapContent map) {
    clearMap();

    // remember the map
    _myMap = map;

    // read ourselves in
    File openFile = new File(super.getFilename());
    if (openFile != null && openFile.exists()) {
      _myLayer = loadLayer(openFile);
    } else {
      CorePlugin.logError(Status.WARNING, "GeoTools file not found:" + super.getFilename(), null);
      CorePlugin.showMessage(
          "Load GIS dataset", "Sorry, can't find the file:\n" + super.getFilename());
    }

    // ok, add ourselves to the map
    if (_myLayer != null) {
      // sort out the visibility
      _myLayer.setVisible(this.getVisible());

      _myLayer.setTitle(super.getName());
      _myMap.addLayer(_myLayer);
    }
  }
Esempio n. 2
0
 /**
  * It sets the visibility of the layer. If the visibility changed, then the map will be refreshed.
  *
  * @param visible
  */
 public void setVisible(boolean visible) {
   for (Layer mapLayer : this.mapLayers) {
     if (mapLayer.isVisible() != visible) {
       mapLayer.setVisible(visible);
     }
   }
 }
Esempio n. 3
0
  @Override
  public void setVisible(boolean visible) {
    super.setVisible(visible);

    if (_myLayer != null) _myLayer.setVisible(visible);
  }