org.esa.snap.core.datamodel.GeoCoding.getPixelPos()方法的使用及代码示例

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

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

GeoCoding.getPixelPos介绍

暂无

代码示例

代码示例来源:origin: senbox-org/s1tbx

private static boolean pixelPosValid(final GeoCoding geoCoding, final GeoPos geoPos, final PixelPos pixelPos,
                   final int width, final int height) {
  geoCoding.getPixelPos(geoPos, pixelPos);
  return (pixelPos.isValid() && pixelPos.x >= 0 && pixelPos.x < width &&
      pixelPos.y >= 0 && pixelPos.y < height);
}

代码示例来源:origin: senbox-org/s1tbx

private static void getPixelPos(final double lat, final double lon, final GeoCoding srcGeoCoding, final PixelPos pixelPos) {
  srcGeoCoding.getPixelPos(new GeoPos(lat, lon), pixelPos);
}

代码示例来源:origin: senbox-org/snap-desktop

private static SimpleFeature createFeature(SimpleFeatureType type, GeoCoding geoCoding, int pointIndex, float lat, float lon, double data) {
  PixelPos pixelPos = geoCoding.getPixelPos(new GeoPos(lat, lon), null);
  if (!pixelPos.isValid()) {
    return null;
  }
  SimpleFeatureBuilder fb = new SimpleFeatureBuilder(type);
  GeometryFactory gf = new GeometryFactory();
  /*0*/
  fb.add(gf.createPoint(new Coordinate(pixelPos.x, pixelPos.y)));
  /*1*/
  fb.add(gf.createPoint(new Coordinate(lon, lat)));
  /*2*/
  fb.add(data);
  return fb.buildFeature(String.format("ID%08d", pointIndex));
}

代码示例来源:origin: senbox-org/s2tbx

@Override
public synchronized double getLandCover(GeoPos geoPos) throws Exception {
  try {
    FileLandCoverTile tile = loadTile(geoPos);
    if (tile != null && tile.getTileGeocoding() != null) {
      final PixelPos pix = tile.getTileGeocoding().getPixelPos(geoPos, null);
      resampling.computeIndex(pix.x, pix.y, tile.getWidth(), tile.getHeight(), resamplingIndex);
      final double value = resampling.resample(tile, resamplingIndex);
      if (Double.isNaN(value)) {
        return tile.getNoDataValue();
      }
      return value;
    } else {
      return Double.NaN;
    }
  } catch (Exception e) {
    throw new Exception("Problem reading : " + e.getMessage());
  }
}

代码示例来源:origin: senbox-org/snap-desktop

private void updateXYParams(GeoPos geoPos1, GeoPos geoPos2) {
  final GeoCoding geoCoding = product.getSceneGeoCoding();
  final PixelPos pixelPos1 = geoCoding.getPixelPos(geoPos1, null);
  if (!pixelPos1.isValid()) {
    pixelPos1.setLocation(0, 0);
  }
  final PixelPos pixelPos2 = geoCoding.getPixelPos(geoPos2, null);
  if (!pixelPos2.isValid()) {
    pixelPos2.setLocation(product.getSceneRasterWidth(),
               product.getSceneRasterHeight());
  }
  final Rectangle.Float region = new Rectangle.Float();
  region.setFrameFromDiagonal(pixelPos1.x, pixelPos1.y, pixelPos2.x, pixelPos2.y);
  final Rectangle.Float productBounds = new Rectangle.Float(0, 0,
                               product.getSceneRasterWidth(),
                               product.getSceneRasterHeight());
  Rectangle2D finalRegion = productBounds.createIntersection(region);
  paramX1.setValue((int) finalRegion.getMinX(), null);
  paramY1.setValue((int) finalRegion.getMinY(), null);
  paramX2.setValue((int) finalRegion.getMaxX() - 1, null);
  paramY2.setValue((int) finalRegion.getMaxY() - 1, null);
}

代码示例来源:origin: senbox-org/s1tbx

@Override
public void readValues(final ImageLayer imageLayer, final GeoPos geoPos, final int level) {
  resetData();
  for (Band band : selectedBands) {
    final int index = getTimeIndex(band);
    if (index >= 0) {
      final PixelPos pix = band.getGeoCoding().getPixelPos(geoPos, null);
      dataPoints[index] = getPixelDouble(band, (int) pix.getX(), (int) pix.getY());
      if (dataPoints[index] == band.getNoDataValue()) {
        dataPoints[index] = Double.NaN;
      }
    }
  }
  Range.computeRangeDouble(dataPoints, IndexValidator.TRUE, dataPointRange, ProgressMonitor.NULL);
  // no invalidate() call here, SpectrumDiagram does this
}

代码示例来源:origin: senbox-org/s1tbx

final GeoPos geo2 = new GeoPos((float) env.getMaxY(), (float) env.getMaxX());
topLeft = bandGC.getPixelPos(geo1, null);
bottomRight = bandGC.getPixelPos(geo2, null);

代码示例来源:origin: senbox-org/s2tbx

private void setInvalidTargetSamples(Map<Band, Tile> targetTiles, int x, int y) {
  float[] latLon = getLatLon(x, y, pixelWindow, sourceProduct);
  for (Tile t : targetTiles.values()) {
    if (t.getRasterDataNode() == latBand) {
      targetTiles.get(targetProduct.getBand("latitude")).setSample(x, y, latLon[0]);
    } else if (t.getRasterDataNode() == lonBand) {
      targetTiles.get(targetProduct.getBand("longitude")).setSample(x, y, latLon[1]);
    } else if (t.getRasterDataNode() == aotBand) {
      if (aodDefault != null && aodDefault.getGeoCoding() != null) {
        final PixelPos pixelPos =
            aodDefault.getGeoCoding().getPixelPos(new GeoPos(latLon[0], latLon[1]), new PixelPos());
        t.setSample(x, y, aodDefault.getSampleFloat((int) pixelPos.getX(), (int) pixelPos.getY()));
      } else {
        t.setSample(x, y, t.getRasterDataNode().getNoDataValue());
      }
    } else {
      t.setSample(x, y, t.getRasterDataNode().getNoDataValue());
    }
  }
}

代码示例来源:origin: senbox-org/snap-desktop

final GeoPos geoCenter = new GeoPos();
thisGeoCoding.getGeoPos(imageCenter, geoCenter);
thatGeoCoding.getPixelPos(geoCenter, imageCenter);
if (imageCenter.isValid()) {
  thatView.getBaseImageLayer().getImageToModelTransform().transform(imageCenter, modelCenter);

代码示例来源:origin: senbox-org/s1tbx

@Override
public void readValues(final ImageLayer imageLayer, final GeoPos geoPos, final int level) {
  resetData();
  if (placemark != null) {
    for (Band band : selectedBands) {
      final int index = getTimeIndex(band);
      if (index >= 0) {
        final PixelPos pix = band.getGeoCoding().getPixelPos(placemark.getGeoPos(), null);
        /*final MultiLevelModel multiLevelModel = ImageManager.getMultiLevelModel(band);
        final AffineTransform i2mTransform = multiLevelModel.getImageToModelTransform(0);
        final AffineTransform m2iTransform = multiLevelModel.getModelToImageTransform(level);
        final Point2D modelPixel = i2mTransform.transform(placemark.getPixelPos(), null);
        final Point2D imagePixel = m2iTransform.transform(modelPixel, null);
        final int pixX = (int) Math.floor(imagePixel.getX());
        final int pixY = (int) Math.floor(imagePixel.getY());   */
        dataPoints[index] = ProductUtils.getGeophysicalSampleAsLong(band, (int) pix.getX(), (int) pix.getY(), level);
        if (dataPoints[index] == band.getNoDataValue()) {
          dataPoints[index] = Double.NaN;
        }
      }
    }
  }
  Range.computeRangeDouble(dataPoints, IndexValidator.TRUE, dataPointRange, ProgressMonitor.NULL);
  // no invalidate() call here, SpectrumDiagram does this
}

代码示例来源:origin: senbox-org/snap-desktop

@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: senbox-org/s1tbx

mstGeoCoding.getPixelPos(geoPos, pixPos);

代码示例来源:origin: senbox-org/s2tbx

public float getAerosolType(GeoPos geoPos) {
  final PixelPos pixelPos = new PixelPos();
  geoCoding.getPixelPos(geoPos, pixelPos);
  int startX = pixelPos.getX() - 0.5 < 0 ? 359 : (int) (pixelPos.getX() - 0.5);
  int endX = (startX + 1) % 359;

代码示例来源:origin: senbox-org/snap-desktop

pixelPos1.setLocation(x + offset[0], y + offset[1]);
product.getSceneGeoCoding().getGeoPos(pixelPos1, geoPos);
product.getSceneGeoCoding().getPixelPos(geoPos, pixelPos2);
double dx = pixelPos2.x - pixelPos1.x;
double dy = pixelPos2.y - pixelPos1.y;

相关文章