Package org.opengis.referencing.operation

Examples of org.opengis.referencing.operation.MathTransform2D


            rects.put((Integer)sf.getAttribute("value"),
                      ((Geometry) sf.getDefaultGeometry()).getEnvelopeInternal());
        }

        try {
            MathTransform2D mt = cov.getGridGeometry().getGridToCRS2D(PixelOrientation.CENTER);
            Point gridP = new Point();
            Point2D.Double geoP = new Point2D.Double();
            int[] covValue = new int[1];
            for (gridP.y = 0; gridP.y < gridDim.height; gridP.y++) {
                for (gridP.x = 0; gridP.x < gridDim.width; gridP.x++) {
                    mt.transform(gridP, geoP);
                }

                cov.evaluate(geoP, covValue);
                if (covValue[0] != 0) {
                    assertTrue(rects.get(covValue[0]).contains(geoP.x, geoP.y));
View Full Code Here


                    LOGGER.info("Horizontal domain is null");
                  else{
                    // print the horizontal domain elements
                    final CoordinateReferenceSystem crs2D=horizontalDomain.getCoordinateReferenceSystem2D();
                    assert crs2D!=null;
                    final MathTransform2D g2w=horizontalDomain.getGridToWorldTransform(null);
                    assert g2w !=null;
                    final Set<? extends BoundingBox> spatialElements = horizontalDomain.getSpatialElements(true,null);
                    assert spatialElements!=null&& !spatialElements.isEmpty();
                   
                    final StringBuilder buf= new StringBuilder();
View Full Code Here

            GeoTiffAccess access) throws IOException {

          // get the request elements
          final BoundingBox bbox = request.getGeographicArea();
          final Rectangle rasterArea = request.getRasterArea();
          final MathTransform2D g2w = request
              .getGridToWorldTransform();

          final GridCoverage2D coverage;
          if (g2w != null || rasterArea != null || g2w != null) {
            final ParameterValue<GridGeometry2D> readParameter = AbstractGridFormat.READ_GRIDGEOMETRY2D
View Full Code Here

          numberOfCoverages = reader.getGridCoverageCount();
 
          final GeneralEnvelope envelope = reader.getOriginalEnvelope();
          final CoordinateReferenceSystem crs = reader.getCrs();
          final GridEnvelope range = reader.getOriginalGridRange();
          final MathTransform2D g2w = (MathTransform2D) reader
              .getOriginalGridToWorld(PixelInCell.CELL_CENTER);
 
          name = new NameImpl(reader.getCoverageName());
          Info info = new Info( name );
          info.setGeometry( new GridGeometry2D(range, g2w, crs) );
View Full Code Here

        if(listener!=null)
          listener.started();
        if(listener!=null&&listener.isCanceled())
          return null;
        try{
          final MathTransform2D g2w=access.gridGeometry2DMap.get(HDF4Source.this.name).getGridToCRS2D(PixelOrientation.CENTER);
          return g2w;
        }catch (Throwable e) {
          listener.exceptionOccurred(e);
          return null;
        }
View Full Code Here

        response.setRequest(request);

        final Rectangle sourceRasterRegion = new Rectangle();
        GeneralEnvelope adjustedRequestedEnvelope2D;
        final GeneralEnvelope requestedEnvelope2D = new GeneralEnvelope(requestedBoundingBox);
        final MathTransform2D grid2WorldTransform = request.getGridToWorldTransform();
        final ImageReadParam imageReadParam = new ImageReadParam();
        try {
            // //
            //
            // Set envelope and source region
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();

        target = CRS.decode("EPSG:3005");

        MathTransform2D tx = (MathTransform2D) ReferencingFactoryFinder
                .getCoordinateOperationFactory(null).createOperation(crs, target)
                .getMathTransform();
        transformer = new GeometryCoordinateSequenceTransformer();
        transformer.setMathTransform(tx);
    }
View Full Code Here

 
    target = CRS.parseWKT(
      "PROJCS[\"BC_Albers\",GEOGCS[\"GCS_North_American_1983\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS_1980\",6378137,298.257222101],TOWGS84[0,0,0]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]],PROJECTION[\"Albers_Conic_Equal_Area\"],PARAMETER[\"False_Easting\",1000000],PARAMETER[\"False_Northing\",0],PARAMETER[\"Central_Meridian\",-126],PARAMETER[\"Standard_Parallel_1\",50],PARAMETER[\"Standard_Parallel_2\",58.5],PARAMETER[\"Latitude_Of_Origin\",45],UNIT[\"Meter\",1],AUTHORITY[\"EPSG\",\"42102\"]]" 
    );
   
    MathTransform2D tx = (MathTransform2D) ReferencingFactoryFinder.getCoordinateOperationFactory(null)
    .createOperation(crs,target).getMathTransform();
    transformer = new GeometryCoordinateSequenceTransformer();
    transformer.setMathTransform( tx );
                transformer.setCoordinateReferenceSystem( target );
  }
View Full Code Here

         */
        resampleToCommonGeometry(sources, null, null, hints);
        GridCoverage2D coverage = sources[PRIMARY_SOURCE_INDEX];
        final CoordinateReferenceSystem crs = coverage.getCoordinateReferenceSystem2D();
        // TODO: remove the cast when we will be allowed to compile for J2SE 1.5.
        final MathTransform2D gridToCRS = coverage.getGridGeometry().getGridToCRS2D();
        for (int i=0; i<sources.length; i++) {
            if (sources[i] == null) {
                continue;
            }
            final GridCoverage2D source = sources[i];
View Full Code Here

    public final GridEnvelope2D worldToGrid(final Envelope2D envelope)
            throws TransformException, InvalidGridGeometryException {

        // get the upper left corner transform (this is cached by the
        // GridGeometry2D object)
        MathTransform2D mt = getCRSToGrid2D(PixelOrientation.UPPER_LEFT);

        CoordinateReferenceSystem sourceCRS = envelope.getCoordinateReferenceSystem();
        if (sourceCRS != null) {
            CoordinateReferenceSystem targetCRS = getCoordinateReferenceSystem();
            if (!CRS.equalsIgnoreMetadata(sourceCRS, targetCRS)) {
                throw new IllegalArgumentException(
                        Errors.format(ErrorKeys.ILLEGAL_COORDINATE_SYSTEM_FOR_CRS_$2,
                                      sourceCRS, targetCRS));
            }
        }

        Point2D lc = toPoint2D(envelope.getLowerCorner());
        Point lcGrid = new Point();
        mt.transform(lc, lcGrid);

        Point2D uc = toPoint2D(envelope.getUpperCorner());
        Point ucGrid = new Point();
        mt.transform(uc, ucGrid);

        GridEnvelope2D gridEnv = new GridEnvelope2D(
                Math.min(lcGrid.x, ucGrid.x),
                Math.min(lcGrid.y, ucGrid.y),
                Math.abs(lcGrid.x - ucGrid.x),
View Full Code Here

TOP

Related Classes of org.opengis.referencing.operation.MathTransform2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.