Examples of ReferencedEnvelope


Examples of org.geotools.geometry.jts.ReferencedEnvelope

        // We are building a envelope at (0/0) with the size of the first tile
        // to calculate the scale
        double halfWidth = tileSizeDegrees / 2.0;
        double halfHeight = tileSizeDegrees / 2.0;
       
        ReferencedEnvelope boundsAtEquator = new ReferencedEnvelope(-halfWidth, halfWidth,
                -halfHeight, halfHeight, DefaultGeographicCRS.WGS84);
                           
        int dpi = 96;
        try{
            dpi = Display.getDefault().getDPI().x;
View Full Code Here

Examples of org.geotools.geometry.jts.ReferencedEnvelope

            double maxY = getNumericValueFromChild(bboxElement.getChild("North")); //$NON-NLS-1$
            double minY = getNumericValueFromChild(bboxElement.getChild("South")); //$NON-NLS-1$
            double minX = getNumericValueFromChild(bboxElement.getChild("West")); //$NON-NLS-1$
            double maxX = getNumericValueFromChild(bboxElement.getChild("East")); //$NON-NLS-1$
           
            ReferencedEnvelope bounds = new ReferencedEnvelope(minX, maxX, minY, maxY,
                    DefaultGeographicCRS.WGS84);
           
            this.bbox = bounds;
        } catch (Exception exc) {
            WMTPlugin.log("[QuadTileSet.parseBbox] Getting the BBox failed", exc); //$NON-NLS-1$
View Full Code Here

Examples of org.geotools.geometry.jts.ReferencedEnvelope

            double minX = latLonBoundingBox.getAttribute("minx").getDoubleValue(); //$NON-NLS-1$
            double maxX = latLonBoundingBox.getAttribute("maxx").getDoubleValue(); //$NON-NLS-1$
            double minY = latLonBoundingBox.getAttribute("miny").getDoubleValue(); //$NON-NLS-1$
            double maxY = latLonBoundingBox.getAttribute("maxy").getDoubleValue(); //$NON-NLS-1$
           
            bounds = new ReferencedEnvelope(minX, maxX, minY, maxY, DefaultGeographicCRS.WGS84);           
        } catch(Exception exc) {
            WMTPlugin.log("[NASASource.setBounds] Failed: " + getName(), exc); //$NON-NLS-1$
           
            bounds = new ReferencedEnvelope(-180, 180, -90, 90, DefaultGeographicCRS.WGS84);
        }
    }
View Full Code Here

Examples of org.geotools.geometry.jts.ReferencedEnvelope

            CoordinateReferenceSystem dataCRS = layer.getCRS();
            CoordinateReferenceSystem worldCRS = context.getCRS();
            MathTransform dataToWorld = CRS.findMathTransform(dataCRS, worldCRS, false);

            ReferencedEnvelope bounds = getRenderBounds();
            monitor.subTask("connecting");
           
            CSV csv = resource.resolve(CSV.class, new SubProgressMonitor(monitor, 10) );
            reader = csv.reader();
           
            int nameIndex = csv.getHeader("name");

            IProgressMonitor drawMonitor = new SubProgressMonitor(monitor, 90);
            Coordinate worldLocation = new Coordinate();
           
            drawMonitor.beginTask("draw "+csv.toString(), csv.getSize());           
            String [] row;
            while ((row = reader.readNext()) != null) {
                Point point = csv.getPoint(row);
                Coordinate dataLocation = point.getCoordinate();
                try {
                    JTS.transform(dataLocation, worldLocation, dataToWorld);
                } catch (TransformException e) {
                    continue;
                }               
                if (bounds != null && !bounds.contains(worldLocation)) {
                    continue; // optimize!
                }               
                java.awt.Point p = getContext().worldToPixel(worldLocation);
                g.fillOval(p.x, p.y, 10, 10);
                String name = row[nameIndex];
View Full Code Here

Examples of org.geotools.geometry.jts.ReferencedEnvelope

     * which is smaller.
     *
     * @return smaller of viewport bounds or getRenderBounds()
     */
    public ReferencedEnvelope getBounds() {
        ReferencedEnvelope renderBounds = getRenderBounds();
        ReferencedEnvelope viewportBounds = context.getViewportModel().getBounds();
        if (renderBounds == null) {
            return viewportBounds;
        }
        if (viewportBounds == null) {
            return renderBounds;
        }
        if (viewportBounds.contains((BoundingBox)renderBounds)) {
            return renderBounds;
        } else if (renderBounds.contains((BoundingBox)viewportBounds)) {
            return viewportBounds;
        }
        return renderBounds;
View Full Code Here

Examples of org.geotools.geometry.jts.ReferencedEnvelope

            ILayer layer = getContext().getLayer();
            IGeoResource resource = layer.findGeoResource(CSV.class);
            if (resource == null)
                return;

            ReferencedEnvelope bounds = getRenderBounds();
            monitor.subTask("connecting");

            CSV csv = resource.resolve(CSV.class, new SubProgressMonitor(monitor, 10));
            reader = csv.reader();
           
            monitor.subTask("drawing");
            int nameIndex = csv.getHeader("name");
            Coordinate worldLocation = new Coordinate();
            String [] row;
            while ((row = reader.readNext()) != null) {
                Point point = csv.getPoint(row);
                worldLocation = point.getCoordinate();
                if (bounds != null && !bounds.contains(worldLocation)) {
                    continue; // optimize!
                }
                java.awt.Point p = getContext().worldToPixel(worldLocation);
                g.fillOval(p.x, p.y, 10, 10);
                String name = row[nameIndex];
View Full Code Here

Examples of org.geotools.geometry.jts.ReferencedEnvelope

        return Status.OK_STATUS;
    }
   
    private synchronized ReferencedEnvelope combineRequests() throws TransformException, FactoryException {
        CoordinateReferenceSystem targetCRS = getExecutor().getContext().getCRS();
      ReferencedEnvelope bounds = new ReferencedEnvelope( targetCRS );
      try{
        for( ReferencedEnvelope env : requests ) {
          CoordinateReferenceSystem envCRS = env.getCoordinateReferenceSystem();
          if( env.isNull() || env.isEmpty() || envCRS == null){
            // these are "invalid" requests and we will skip them
            System.out.println("We are skipping an empty request");
            continue; // skip!
          }
         
          //Vitalus: fix for deadlock in RenderJob because of MismatchedReferenceSystemException
          //during transforming from DefaultEngineeringCRS.GENERIC_2D
          //to EPSG projection.  (DefaultEngineeringCRS.GENERIC_2D to EPSG 2393 e.g.)
          if (envCRS != DefaultEngineeringCRS.GENERIC_2D
              && envCRS != DefaultEngineeringCRS.GENERIC_3D
              && envCRS != DefaultEngineeringCRS.CARTESIAN_2D
              && envCRS != DefaultEngineeringCRS.CARTESIAN_3D) {

            if (!CRS.equalsIgnoreMetadata(envCRS, targetCRS)) {
              env = env.transform(targetCRS, true);
            }
          }
          if( bounds.isNull() ){
            bounds.init((Envelope)env);
          }
          else {
            bounds.include(env);             
            // bounds.expandToInclude(env);
          }
        }
      }finally{
        requests.clear();
View Full Code Here

Examples of org.geotools.geometry.jts.ReferencedEnvelope

        GeneralParameterValue[] readParams = new GeneralParameterValue[1];
        Parameter<GridGeometry2D> readGG = new Parameter<GridGeometry2D>(AbstractGridFormat.READ_GRIDGEOMETRY2D);
        GridEnvelope2D gridEnvelope = new GridEnvelope2D(0, 0, width, height);
        Envelope env;
        if (crs != null) {
            env = new ReferencedEnvelope(west, east, south, north, crs);
        } else {
            DirectPosition2D minDp = new DirectPosition2D(west, south);
            DirectPosition2D maxDp = new DirectPosition2D(east, north);
            env = new Envelope2D(minDp, maxDp);
        }
View Full Code Here

Examples of org.geotools.geometry.jts.ReferencedEnvelope

            this.title = this.name;
            this.description = "JGrass Mapset (" + getIdentifier() + ")"; //$NON-NLS-1$ //$NON-NLS-2$

            // calculate bounds
            JGrassRegion activeRegionWindow = getActiveRegionWindow();
            this.bounds = new ReferencedEnvelope(activeRegionWindow.getEnvelope(), getCRS());
            super.icon = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.CATALOG_OBJ);
        }
View Full Code Here

Examples of org.geotools.geometry.jts.ReferencedEnvelope

  public void run() {
    ILayer selectedLayer = getContext().getSelectedLayer();
    Filter selectionFilter = selectedLayer.getFilter();
    try {
      SimpleFeatureSource source = selectedLayer.getResource(SimpleFeatureSource.class, ProgressManager.instance().get());
      ReferencedEnvelope bounds = source.getFeatures(selectionFilter).getBounds();
      getContext().sendASyncCommand(new SetViewportBBoxCommand(bounds, true));
    } catch (IOException e) {
      e.printStackTrace();
    }
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.