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

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

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

GeoCoding.isCrossingMeridianAt180介绍

[英]Checks whether or not the longitudes of this geo-coding cross the +/- 180 degree meridian.
[中]

代码示例

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

/**
 * Checks whether or not the longitudes of this geo-coding cross the +/- 180 degree meridian.
 *
 * @return <code>true</code>, if so
 */
@Override
public boolean isCrossingMeridianAt180() {
  return getGeoCoding().isCrossingMeridianAt180();
}

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

/**
 * Computes an estimation of the memory required to create an instance of this class for the given product.
 * The estimation is returned in bytes.
 *
 * @return an estimation of the required memory in bytes
 */
public static long getRequiredMemory(Product product, boolean usesValidMask) {
  final GeoCoding geoCoding = product.getGeoCoding();
  if (geoCoding == null) {
    return 0;
  }
  final long sizeofFloat = 4;
  final long pixelCount = product.getSceneRasterWidth() * product.getSceneRasterHeight();
  // lat + lon band converted to 32-bit float tie-point data
  long size = 2 * sizeofFloat * pixelCount;
  if (geoCoding.isCrossingMeridianAt180()) {
    // additional 32-bit float sine and cosine grids for to lon grid
    size += 2 * sizeofFloat * pixelCount;
  }
  if (usesValidMask) {
    // additional 1-bit data mask
    size += pixelCount / 8;
  }
  return size;
}

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

private static Rectangle2D createMapBoundary(final Product product, CoordinateReferenceSystem targetCrs) {
  try {
    final CoordinateReferenceSystem sourceCrs = product.getGeoCoding().getImageCRS();
    final int sourceW = product.getSceneRasterWidth();
    final int sourceH = product.getSceneRasterHeight();
    final Rectangle2D rect = XRectangle2D.createFromExtremums(0.5, 0.5, sourceW - 0.5, sourceH - 0.5);
    int pointsPerSide = Math.max(sourceH, sourceW) / 10;
    pointsPerSide = Math.max(9, pointsPerSide);
    final ReferencedEnvelope sourceEnvelope = new ReferencedEnvelope(rect, sourceCrs);
    final ReferencedEnvelope targetEnvelope = sourceEnvelope.transform(targetCrs, true, pointsPerSide);
    double minX = targetEnvelope.getMinX();
    double width = targetEnvelope.getWidth();
    if (product.getGeoCoding().isCrossingMeridianAt180()) {
      minX = -180.0;
      width = 360;
    }
    return new Rectangle2D.Double(minX, targetEnvelope.getMinY(), width, targetEnvelope.getHeight());
  } catch (Exception e) {
    throw new IllegalStateException(e);
  }
}

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

throw new IllegalArgumentException("searchRadius < 2");
crossingMeridianAt180 = pixelPosEstimator.isCrossingMeridianAt180();
GeoPos p0 = pixelPosEstimator.getGeoPos(new PixelPos(0.5f, 0.5f), null);
GeoPos p1 = pixelPosEstimator.getGeoPos(new PixelPos(1.5f, 0.5f), null);

代码示例来源: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

double east = lowerRightGP.getLon();
double west = upperLeftGP.getLon();
if (geoCoding.isCrossingMeridianAt180()) {
  east += 360;

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

@Test
public void testCrossing180() throws Exception {
  final Rectangle imageBounds = new Rectangle(10, 20);
  srcGeoCoding = createCrsGeoCodingCross180(imageBounds);
  assertTrue(srcGeoCoding.isCrossingMeridianAt180());
  final Band srcNode = new Band("srcDummy", ProductData.TYPE_INT8, 10, 20);
  srcNode.setGeoCoding(srcGeoCoding);
  srcScene = SceneFactory.createScene(srcNode);
  final ProductSubsetDef subsetDef = new ProductSubsetDef("subset");
  subsetDef.setRegion(2, 2, 8, 8);
  subsetDef.setSubSampling(2, 2);
  boolean transfered = srcScene.transferGeoCodingTo(destScene, subsetDef);
  assertTrue(transfered);
  assertTrue(destScene.getGeoCoding().isCrossingMeridianAt180());
  subsetDef.setRegion(2, 2, 2, 2);
  transfered = srcScene.transferGeoCodingTo(destScene, subsetDef);
  assertTrue(transfered);
  assertFalse(destScene.getGeoCoding().isCrossingMeridianAt180());
}

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

final GeoPos lowerRightGP = geoCoding.getGeoPos(lowerRightPP, null);
float eastLon = lowerRightGP.getLon();
if (geoCoding.isCrossingMeridianAt180()) {
  eastLon += 360;

相关文章