org.esa.beam.framework.datamodel.GeoCoding.canGetPixelPos()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(82)

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

GeoCoding.canGetPixelPos介绍

[英]Checks whether or not this geo-coding can determine the pixel position from a geodetic position.
[中]

代码示例

代码示例来源:origin: bcdev/beam

@Override
@Deprecated
public PixelPos updatePixelPos(GeoCoding geoCoding, GeoPos geoPos, PixelPos pixelPos) {
  if (geoCoding == null || !geoCoding.canGetPixelPos() || geoPos == null) {
    return pixelPos;
  }
  return geoCoding.getPixelPos(geoPos, pixelPos);
}

代码示例来源:origin: bcdev/beam

/**
 * Checks whether or not this geo-coding can determine the pixel position from a geodetic position.
 *
 * @return <code>true</code>, if so
 */
@Override
public boolean canGetPixelPos() {
  return getGeoCoding().canGetPixelPos();
}

代码示例来源:origin: bcdev/beam

@Override
@Deprecated
public PixelPos updatePixelPos(GeoCoding geoCoding, GeoPos geoPos, PixelPos pixelPos) {
  if (geoCoding == null || !geoCoding.canGetPixelPos() || geoPos == null) {
    return pixelPos;
  }
  return geoCoding.getPixelPos(geoPos, pixelPos);
}

代码示例来源:origin: bcdev/beam

/**
 * Returns whether or not a product can return a pixel position from a given geographical position.
 *
 * @param product the product to be checked
 *
 * @return <code>true</code> if the given product can return a pixel position
 */
public static boolean canGetPixelPos(Product product) {
  return product != null
      && product.getGeoCoding() != null
      && product.getGeoCoding().canGetPixelPos();
}

代码示例来源:origin: bcdev/beam

/**
 * Returns whether or not a raster can return a pixel position from a given geographical position.
 *
 * @param raster the raster to be checked
 *
 * @return <code>true</code> if the given raster can return a pixel position
 */
public static boolean canGetPixelPos(final RasterDataNode raster) {
  return raster != null
      && raster.getGeoCoding() != null
      && raster.getGeoCoding().canGetPixelPos();
}

代码示例来源:origin: bcdev/beam

private void removePPL(ProductSceneView view) {
  GeoCoding geoCoding = view.getProduct().getGeoCoding();
  if (geoCoding != null && geoCoding.canGetPixelPos()) {
    ViewPPL ppl = viewPplMap.get(view);
    viewPplMap.remove(view);
    view.removePixelPositionListener(ppl);
  }
}

代码示例来源:origin: bcdev/beam

@Override
  public boolean accept(Product product) {
    final GeoCoding geoCoding = product.getGeoCoding();
    return geoCoding != null && geoCoding.canGetGeoPos() && geoCoding.canGetPixelPos();
  }
}

代码示例来源:origin: bcdev/beam

private boolean canUseGeoCoordinates(Product product) {
  final GeoCoding geoCoding = product.getGeoCoding();
  return geoCoding != null && geoCoding.canGetPixelPos() && geoCoding.canGetGeoPos();
}

代码示例来源:origin: bcdev/beam

private void addPPL(ProductSceneView view) {
  GeoCoding geoCoding = view.getProduct().getGeoCoding();
  if (geoCoding != null && geoCoding.canGetPixelPos()) {
    psvOverlayMap.put(view, null);
    ViewPPL ppl = new ViewPPL(view);
    viewPplMap.put(view, ppl);
    view.addPixelPositionListener(ppl);
  }
}

代码示例来源:origin: bcdev/beam

private boolean isAbleToExtractPixels(Product product) {
  final Logger logger = getLogger();
  if (product == null) {
    return false;
  }
  final GeoCoding geoCoding = product.getGeoCoding();
  if (geoCoding == null) {
    final String msgPattern = "Product [%s] refused. Cause: Product is not geo-coded.";
    logger.warning(String.format(msgPattern, product.getFileLocation()));
    return false;
  }
  if (!geoCoding.canGetPixelPos()) {
    final String msgPattern = "Product [%s] refused. Cause: Pixel position can not be determined.";
    logger.warning(String.format(msgPattern, product.getFileLocation()));
    return false;
  }
  return true;
}

代码示例来源:origin: bcdev/beam

private boolean containsGeoCodingWithReverseOperationSupport(Product product) {
  GeoCoding geoCoding = product.getGeoCoding();
  if (geoCoding == null) {
    logSkipped("The product '" + product.getName() + "' does not contain a geo coding.");
    return false;
  }
  if (!geoCoding.canGetPixelPos()) {
    logSkipped("The geo-coding of the product '" + product.getName() + "' can not determine the pixel position from a geodetic position.");
    return false;
  }
  return true;
}

代码示例来源:origin: bcdev/beam

private boolean productsIntersect(Product timeSeriesSourceProduct, Product collocationProduct) {
    if (collocationProduct.getGeoCoding() == null) {
      return false;
    }
    final GeoCoding geoCoding = collocationProduct.getGeoCoding();
    if (geoCoding.canGetGeoPos() && geoCoding.canGetPixelPos()
      && ((geoCoding instanceof CrsGeoCoding)||(geoCoding instanceof MapGeoCoding))) {
      final GeneralPath[] sourcePaths = ProductUtils.createGeoBoundaryPaths(timeSeriesSourceProduct);
      final GeneralPath[] collocationPaths = ProductUtils.createGeoBoundaryPaths(collocationProduct);
      for (GeneralPath sourcePath : sourcePaths) {
        for (GeneralPath collocationPath : collocationPaths) {
          final Area sourceArea = new Area(sourcePath);
          final Area collocationArea = new Area(collocationPath);
          collocationArea.intersect(sourceArea);
          if (!collocationArea.isEmpty()) {
            return true;
          }
        }
      }
    }
    return false;
  }
}

代码示例来源:origin: bcdev/beam

@Override
public void updateState(final CommandEvent event) {
  ProductSceneView view = VisatApp.getApp().getSelectedProductSceneView();
  GeoCoding geoCoding = null;
  if (view != null && view.getProduct() != null) {
    geoCoding = view.getProduct().getGeoCoding();
  }
  setEnabled(geoCoding != null && geoCoding.canGetPixelPos());
}

代码示例来源:origin: bcdev/beam

@Override
public void updateState(CommandEvent event) {
  final Product product = VisatApp.getApp().getSelectedProduct();
  setEnabled(product != null && product.getGeoCoding() != null && product.getGeoCoding().canGetGeoPos() && product.getGeoCoding().canGetPixelPos());
}

代码示例来源:origin: bcdev/beam

@Override
  public boolean accept(Product collocationProduct) {
    final Product referenceProduct = getReferenceProduct();
    if (referenceProduct == collocationProduct ||
      collocationProduct.getGeoCoding() == null) {
      return false;
    }
    if (referenceProduct == null) {
      return true;
    }
    final GeoCoding geoCoding = collocationProduct.getGeoCoding();
    if (geoCoding.canGetGeoPos() && geoCoding.canGetPixelPos() && (geoCoding instanceof CrsGeoCoding)) {
      final GeneralPath[] sourcePath = ProductUtils.createGeoBoundaryPaths(referenceProduct);
      final GeneralPath[] collocationPath = ProductUtils.createGeoBoundaryPaths(collocationProduct);
      for (GeneralPath path : sourcePath) {
        Rectangle bounds = path.getBounds();
        for (GeneralPath colPath : collocationPath) {
          if (colPath.getBounds().intersects(bounds)) {
            return true;
          }
        }
      }
    }
    return false;
  }
}

代码示例来源:origin: bcdev/beam

&& geoPos != null
  && geoCoding != null
  && geoCoding.canGetPixelPos()) {
imagePos = geoCoding.getPixelPos(geoPos, imagePos);

代码示例来源:origin: bcdev/beam

final GeoCoding thisGeoCoding = thisRaster.getGeoCoding();
final GeoCoding thatGeoCoding = thatRaster.getGeoCoding();
if (thisGeoCoding != null && thatGeoCoding != null && thisGeoCoding.canGetGeoPos() && thatGeoCoding.canGetPixelPos()) {
  final Viewport thisViewport = layerCanvas.getViewport();
  final Viewport thatViewport = thatView.layerCanvas.getViewport();

代码示例来源:origin: bcdev/beam

@Override
public void paintOverlay(LayerCanvas canvas, Rendering rendering) {
  if (geoPosition == null || !geoPosition.isValid()) {
    return;
  }
  final GeoCoding geoCoding = sceneView.getRaster().getGeoCoding();
  if (!geoCoding.canGetPixelPos()) {
    return;
  }
  final Product product = sceneView.getRaster().getProduct();
  final PixelPos pixelPos = geoCoding.getPixelPos(geoPosition, null);
  if (!pixelPos.isValid() || !product.containsPixel(pixelPos)) {
    return;
  }
  final Viewport viewport = canvas.getViewport();
  drawCursor(rendering.getGraphics(), viewport, pixelPos);
}

代码示例来源:origin: bcdev/beam

private void assertEquality(final GeoCoding gc1, final GeoCoding gc2, float accuracy) {
  assertNotNull(gc2);
  assertEquals(gc1.canGetGeoPos(), gc2.canGetGeoPos());
  assertEquals(gc1.canGetPixelPos(), gc2.canGetPixelPos());
  assertEquals(gc1.isCrossingMeridianAt180(), gc2.isCrossingMeridianAt180());
  if (gc1 instanceof CrsGeoCoding) {
    assertEquals(CrsGeoCoding.class, gc2.getClass());
    CRS.equalsIgnoreMetadata(gc1, gc2);
  } else if (gc1 instanceof TiePointGeoCoding) {
    assertEquals(TiePointGeoCoding.class, gc2.getClass());
  }
  final int width = outProduct.getSceneRasterWidth();
  final int height = outProduct.getSceneRasterHeight();
  GeoPos geoPos1 = null;
  GeoPos geoPos2 = null;
  final String msgPattern = "%s at [%d,%d] is not equal:";
  for (int i = 0; i < width; i++) {
    for (int j = 0; j < height; j++) {
      final PixelPos pixelPos = new PixelPos(i, j);
      geoPos1 = gc1.getGeoPos(pixelPos, geoPos1);
      geoPos2 = gc2.getGeoPos(pixelPos, geoPos2);
      assertEquals(String.format(msgPattern, "Latitude", i, j), geoPos1.lat, geoPos2.lat, accuracy);
      assertEquals(String.format(msgPattern, "Longitude", i, j), geoPos1.lon, geoPos2.lon, accuracy);
    }
  }
}

代码示例来源:origin: bcdev/beam

final Rectangle destArea) {
Guardian.assertNotNull("sourceGeoCoding", sourceGeoCoding);
Guardian.assertEquals("sourceGeoCoding.canGetPixelPos()", sourceGeoCoding.canGetPixelPos(), true);
Guardian.assertNotNull("destGeoCoding", destGeoCoding);
Guardian.assertEquals("destGeoCoding.canGetGeoPos()", destGeoCoding.canGetGeoPos(), true);

相关文章