org.orbisgis.view.background.ZoomToSelection类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.orbisgis.view.background.ZoomToSelection类的一些代码示例,展示了ZoomToSelection类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoomToSelection类的具体详情如下:
包路径:org.orbisgis.view.background.ZoomToSelection
类名称:ZoomToSelection

ZoomToSelection介绍

[英]Zoom to provided layer selection
[中]缩放到提供的图层选择

代码示例

代码示例来源:origin: org.orbisgis/mapeditor

/**
 * The user click on the button Zoom to selection
 */
public void onZoomToAllSelection() {
  ArrayList<ILayer> selectedLayers = new ArrayList<ILayer>();
  for (ILayer iLayer : mapContext.getLayers()) {
    if (!iLayer.getSelection().isEmpty()) {
      selectedLayers.add(iLayer);
    }
  }
  if (!selectedLayers.isEmpty()) {
    BackgroundManager bm = Services.getService(BackgroundManager.class);
    bm.backgroundOperation(new ZoomToSelection(mapContext, selectedLayers.toArray(new ILayer[selectedLayers.size()])));
  } else {
    GUILOGGER.warn(I18N.tr("There is any selection available."));
  }
}

代码示例来源:origin: org.orbisgis/orbisgis-view

@Override
public void run(ProgressMonitor pm) {
  try {
    Envelope selectionEnvelope = new Envelope();
    for(ILayer layer : layers) {
      if(layer.isVisible()) {
        Set<Long> data = layer.getSelection();
        if(!data.isEmpty()){
        Envelope layerEnv = getLayerSelectionEnvelope(pm, data, layer.getTableReference());
        if(layerEnv!=null) {
          selectionEnvelope.expandToInclude(layerEnv);
        }
        if(pm.isCancelled()) {
          return;
        }
        }
      }
    }
    if(!selectionEnvelope.isNull()) {
      mapContext.setBoundingBox(selectionEnvelope);
    }
  } catch (SQLException ex ){
    LOGGER.error(ex.getLocalizedMessage(), ex);
  }
}

代码示例来源:origin: org.orbisgis/toc

/**
 * The user click on the Zoom To Layer selection menu
 */
public void zoomToLayerSelection() {
    ILayer[] selectedLayers = mapContext.getSelectedLayers();
    ZoomToSelection zoomJob = new ZoomToSelection(mapContext, selectedLayers);
    BackgroundManager bm = Services.getService(BackgroundManager.class);
    bm.backgroundOperation(zoomJob);
}
/**

代码示例来源:origin: org.orbisgis/mapeditor

/**
 * Zoom on selected geometries of each selected layers
 */    
public void onZoomToLayerSelection(){
  ILayer[] selectedLayers = getMapControl().getToolManager().getSelectedLayerAndStyle();
  // Loop through all selected layers.
  if (selectedLayers == null || selectedLayers.length == 0) {
    GUILOGGER.warn(I18N.tr("Please select a layer or a style in the TOC"));
  } else {
    BackgroundManager bm = Services.getService(BackgroundManager.class);
    bm.backgroundOperation(new ZoomToSelection(mapContext, selectedLayers));
  }
}

相关文章

ZoomToSelection类方法