Package org.opengis.geometry

Examples of org.opengis.geometry.DirectPosition


        CoordinateReferenceSystem crs1 = factory.createCoordinateReferenceSystem("4326");
        CoordinateReferenceSystem crs2 = factory.createCoordinateReferenceSystem("3005");

        // reproject
        MathTransform transform = CRS.findMathTransform(crs1, crs2,true);
        DirectPosition pos = new DirectPosition2D(48.417, 123.35);
        transform.transform(pos, null);       
    }
View Full Code Here


                    CoordinateReferenceSystem crs2 = acquireCRS(code2);

                    // reproject
                    MathTransform transform = CRS.findMathTransform(crs1, crs2,
                            true);
                    DirectPosition pos = new DirectPosition2D(48.417, 123.35);
                    try {
                         transform.transform(pos, null);
                    } catch (Exception e) {
                        // chomp
                    }
View Full Code Here

        CoordinateReferenceSystem crs1 = factory.createCoordinateReferenceSystem("4326");
        CoordinateReferenceSystem crs2 = factory.createCoordinateReferenceSystem("3005");

        // reproject
        MathTransform transform = CRS.findMathTransform(crs1, crs2,true);
        DirectPosition pos = new DirectPosition2D(48.417, 123.35);
        transform.transform(pos, null);
    }
View Full Code Here

                // continue;
                // }
            }
        }
        if (requestedEnvelope != null && dim != null) {
            DirectPosition lowerCorner = requestedEnvelope.getLowerCorner();
            double[] westSouth = lowerCorner.getCoordinate();
            DirectPosition upperCorner = requestedEnvelope.getUpperCorner();
            double[] eastNorth = upperCorner.getCoordinate();
            JGrassRegion region = new JGrassRegion(westSouth[0], eastNorth[0], westSouth[1], eastNorth[1], dim.height, dim.width);
            return readRaster(region);
        }

        return readRaster((JGrassRegion) null);
View Full Code Here

            }
        }
       
      protected boolean compareDirectPositionResult(DirectPosition result) {
            if (expectedResult instanceof DirectPosition) {
              DirectPosition expect = (DirectPosition)expectedResult;
                return result.equals(expect);
            } else {
                return false;
            }
      }
View Full Code Here

         * @param b Geometry Object (not used)
         * @return a boolean indicating whether the result matched the expectation
         */
        public boolean doOperation(Geometry a, Geometry b) {
            Geometry geom1 = setGeomArg(arg1, a, b);
            DirectPosition result = geom1.getCentroid();
            return compareDirectPositionResult(result);
        }
View Full Code Here

         * @param b Geometry Object (not used)
         * @return a boolean indicating whether the result matched the expectation
         */
        public boolean doOperation(Geometry a, Geometry b) {
            Geometry geom1 = setGeomArg(arg1, a, b);
            DirectPosition result = geom1.getRepresentativePoint();
            return compareDirectPositionResult(result);
        }
View Full Code Here

      Assert.assertEquals(p0.inverse().transform(
          new GeneralDirectPosition(new double[] { 0.5 }), null)
          .getOrdinate(0), 0.5, 0.0);
      Assert.assertEquals(p0.derivative(1.0), 1.0, 0.0);
      final DirectPosition1D inDP = new DirectPosition1D(0.6);
      final DirectPosition outDP= p0.transform(inDP, null);
      Assert.assertTrue(outDP.getOrdinate(0)==0.6);
      try{
   
        p0.transform(new double[]{0.5},0,(double[])null,0,0);
        Assert.assertFalse(true);
      }
      catch (UnsupportedOperationException e) {
        // TODO: handle exception
      }
     
      try{
   
        p0.transform(new float[]{0.5f},0,(float[])null,0,0);
        Assert.assertFalse(true);
      }
      catch (UnsupportedOperationException e) {
        // TODO: handle exception
      }
     
     
      try{
        p0.toWKT();
        Assert.assertFalse(true);
      }
      catch (UnsupportedOperationException e) {
        // TODO: handle exception
      }
      Matrix m= p0.derivative(inDP);
      Assert.assertTrue(m.getNumCol()==1);
      Assert.assertTrue(m.getNumRow()==1);
      Assert.assertTrue(m.getElement(0, 0)==1);
     
      ////
      //
      //testing the transform
      //
      ////
      final DefaultPiecewiseTransform1D<DefaultPiecewiseTransform1DElement> piecewise =
          new DefaultPiecewiseTransform1D<DefaultPiecewiseTransform1DElement>(new DefaultPiecewiseTransform1DElement[] { p0 },11);
   
      Assert.assertEquals(piecewise.getApproximateDomainRange().getMinimum(), 0.0, 0.0);
      Assert.assertEquals(piecewise.getApproximateDomainRange().getMaximum(), 1.0, 0.0);
      Assert.assertEquals(piecewise.transform(0.5), 0.5, 0.0);
      Assert.assertEquals(piecewise.transform(
          new GeneralDirectPosition(new double[] { 0.5 }), null)
          .getOrdinate(0), 0.5, 0.0);
      Assert.assertEquals(piecewise.transform(1.5), 0.0, 11.0);
     
      try{
   
        piecewise.transform(new double[]{0.5},0,(double[])null,0,0);
        Assert.assertFalse(true);
      }
      catch (UnsupportedOperationException e) {
        // TODO: handle exception
      }
     
      try{
   
        piecewise.transform(new float[]{0.5f},0,(float[])null,0,0);
        Assert.assertFalse(true);
      }
      catch (UnsupportedOperationException e) {
        // TODO: handle exception
      }
     
     
      try{
        piecewise.toWKT();
        Assert.assertFalse(true);
      }
      catch (UnsupportedOperationException e) {
        // TODO: handle exception
      }
     
      try{
        m= piecewise.derivative(inDP);
        Assert.assertFalse(true);
      }
      catch (UnsupportedOperationException e) {
        // TODO: handle exception
      }
     
      ////
      //
      //testing the passthrough through indirect instantion
      //
      ////
      final DefaultPassthroughPiecewiseTransform1DElement p1 = new DefaultPassthroughPiecewiseTransform1DElement(
          "p1");
      Assert.assertEquals(p1.getTargetDimensions(), 1);
      Assert.assertEquals(p1.getSourceDimensions(), 1);
      Assert.assertTrue(p1.isIdentity());
      Assert.assertEquals(p1.inverse(), LinearTransform1D.IDENTITY);
      Assert.assertEquals(p1.transform(0.5), 0.5, 0.0);
      Assert.assertEquals(p1.transform(111.5), 111.5, 0.0);
      Assert.assertEquals(p1.transform(
          new GeneralDirectPosition(new double[] { 123.5 }), null)
          .getOrdinate(0), 123.5, 0.0);
      Assert.assertEquals(p1.inverse().transform(
          new GeneralDirectPosition(new double[] { 657.5 }), null)
          .getOrdinate(0), 657.5, 0.0);
      Assert.assertEquals(p1.derivative(1.0), 1.0, 0.0);
      final DirectPosition1D inDP1 = new DirectPosition1D(0.6);
      final DirectPosition outDP1= p1.transform(inDP1, null);
      Assert.assertTrue(outDP1.getOrdinate(0)==0.6);
      try{
   
        p1.transform(new double[]{1233444.5},0,(double[])null,0,0);
        Assert.assertFalse(true);
      }
View Full Code Here

        assertTrue(CoverageUtilities.hasRenderingCategories(gc));

        checkMatrixEqual(gc.getRenderedImage(), mapData, 0);

        Envelope envelope = gc.getEnvelope();
        DirectPosition lowerCorner = envelope.getLowerCorner();
        double[] westSouth = lowerCorner.getCoordinate();
        DirectPosition upperCorner = envelope.getUpperCorner();
        double[] eastNorth = upperCorner.getCoordinate();

        GridGeometry2D gridGeometry = gc.getGridGeometry();
        GridEnvelope2D gridRange = gridGeometry.getGridRange2D();
        int height = gridRange.height;
        int width = gridRange.width;
View Full Code Here

                    dim = gg.getGridRange2D().getBounds();
                    continue;
                }
            }
            if (requestedEnvelope != null && dim != null) {
                DirectPosition lowerCorner = requestedEnvelope.getLowerCorner();
                double[] westSouth = lowerCorner.getCoordinate();
                DirectPosition upperCorner = requestedEnvelope.getUpperCorner();
                double[] eastNorth = upperCorner.getCoordinate();
                writeRegion = new JGrassRegion(westSouth[0], eastNorth[0], westSouth[1],
                        eastNorth[1], dim.height, dim.width);
            }
        }
View Full Code Here

TOP

Related Classes of org.opengis.geometry.DirectPosition

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.