/** * Returns the preferred resolution. A {@code null} value means that the * best available resolution should be used. */ public Dimension2D getPreferredResolution() { if (radioPrefRes.isSelected()) { return new XDimension2D.Double(doubleValue(xres), doubleValue(yres)); } return null; }
ensureNonNull("factory", factory); final PathIterator iterator = shape.getPathIterator(null, ShapeUtilities.getFlatness(shape)); final double[] buffer = new double[6]; final List coords = new ArrayList();
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); } }
XRectangle2D.intersect(coverageRequestedRasterArea, coverageRasterArea, coverageRequestedRasterArea);
final XRectangle2D rasterBounds_=new XRectangle2D(raster.getMinX()+0.5, raster.getMinY()+0.5, raster.getWidth()-1, raster.getHeight()-1); try { bounds = new ReferencedEnvelope(CRS.transform(mt2D, rasterBounds_, null),gc2d.getCoordinateReferenceSystem2D());
maximumSize = new XDimension2D.Float((float)maxWidth, (float)maxHeight);
private Rectangle createQueryGridEnvelope(DirectPosition pos) { final AbstractGridCoverage2DReader reader = sourceRef.get(); try { MathTransform worldToGridTransform = reader.getOriginalGridToWorld(PixelInCell.CELL_CORNER).inverse(); DirectPosition midPos = worldToGridTransform.transform(pos, null); int x = (int) midPos.getOrdinate(0); int y = (int) midPos.getOrdinate(1); int halfWidth = CACHED_RASTER_WIDTH / 2; final Rectangle queryRect = new Rectangle( x - halfWidth, y - halfWidth, CACHED_RASTER_WIDTH, CACHED_RASTER_WIDTH); GridEnvelope gridEnv = reader.getOriginalGridRange(); Rectangle rect = new Rectangle( gridEnv.getLow(0), gridEnv.getLow(1), gridEnv.getSpan(0), gridEnv.getSpan(1)); XRectangle2D.intersect(queryRect, rect, queryRect); return queryRect; } catch (Exception ex) { throw new RuntimeException(ex); } }
if (boundingBox == null) { final Envelope envelope = getEnvelope(); Rectangle2D geographicArea = XRectangle2D.createFromExtremums( envelope.getMinimum(xDimension), envelope.getMinimum(yDimension),
/** * Returns the preferred pixel size for a close zoom. For image rendering, the preferred pixel * size is the image's pixel size in logical units. For other kinds of rendering, this "pixel" * size should be some reasonable resolution. The default implementation computes a default * value from {@link #getArea}. */ protected Dimension2D getPreferredPixelSize() { final Rectangle2D area = getArea(); if (isValid(area)) { return new XDimension2D.Double(area.getWidth () / (10 * getWidth ()), area.getHeight() / (10 * getHeight())); } else { return new Dimension(1, 1); } }
final Rectangle tempRect = finalRange.toRectangle(); XRectangle2D.intersect(tempRect, requestedDim, tempRect); requestedDim.setRect(tempRect); } catch (TransformException te) {
new XDimension2D.Double(maxWidth, maxHeight)); path = getPathIterator(glyphs.getOutline((float)bounds.getMinX(), (float)bounds.getMaxY()));
XRectangle2D.intersect(sourceArea, selectedlevel.rasterDimensions, sourceArea);//make sure roundings don't bother us
XRectangle2D.intersect(imageBounds, rasterBounds, imageBounds);
XRectangle2D.intersect(destinationRasterArea, requestedRasterArea, destinationRasterArea); } catch (NoninvertibleTransformException e) { throw new DataSourceException(e);
XRectangle2D.intersect(destinationRasterArea, requestedRasterArea, destinationRasterArea); } catch (NoninvertibleTransformException e) { throw new DataSourceException(e);
XRectangle2D.intersect( destinationRasterArea, requestedRasterArea, destinationRasterArea); } catch (NoninvertibleTransformException e) {
XRectangle2D.intersect(sourceArea, selectedlevel.rasterDimensions, sourceArea);//make sure roundings don't bother us
XRectangle2D.intersect(levelRasterArea, rasterBounds, rasterBounds);
? (GridEnvelope2D) gridEnvelope : new Rectangle(); XRectangle2D.intersect(integerRasterArea, originalArea, integerRasterArea);