Package org.opengis.referencing.crs

Examples of org.opengis.referencing.crs.CoordinateReferenceSystem


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

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

            ReferencedEnvelope bounds = getRenderBounds();
            monitor.subTask("connecting");
           
View Full Code Here


            PreferenceDialog pdialog = new PreferenceDialog(getSite().getShell(), mgr);
            ZoomingDialog dialog = new ZoomingDialog(getSite().getShell(), pdialog, ZoomingDialog
                    .calculateBounds(button));
            dialog.open();
            */
            CoordinateReferenceSystem crs = getMap().getViewportModel().getCRS();           
            CRSChooserDialog dialog = new CRSChooserDialog( getSite().getShell(), crs );
            int code = dialog.open();
            if( Window.OK == code ){
                CoordinateReferenceSystem result = dialog.getResult();
                if( !result.equals(crs)){
                    getMap().sendCommandSync(new ChangeCRSCommand(result));
                    updateCRS();
                }
            }

View Full Code Here

        }
        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!
          }
View Full Code Here

    public void render( Graphics2D g2d, IProgressMonitor monitor ) throws RenderException {
        try {
            final IRenderContext currentContext = getContext();
            currentContext.setStatus(ILayer.WAIT);
            CoordinateReferenceSystem destinationCRS = currentContext.getCRS();

            // the bounds of the visible area in world coordinates
            // get the envelope and the screen extent
            Envelope envelope = getRenderBounds();
            if (envelope == null || envelope.isNull()) {
                envelope = context.getImageBounds();
            }

            Point upperLeft = currentContext.worldToPixel(new Coordinate(envelope.getMinX(), envelope.getMinY()));
            Point bottomRight = currentContext.worldToPixel(new Coordinate(envelope.getMaxX(), envelope.getMaxY()));
            Rectangle screenSize = new Rectangle(upperLeft);
            screenSize.add(bottomRight);

            final IGeoResource resource = getContext().getGeoResource();
            if (resource == null || !resource.canResolve(JGrassMapGeoResource.class)) {
                return;
            }
            JGrassMapGeoResource grassMapGeoResource = resource.resolve(JGrassMapGeoResource.class, monitor);

            JGrassRegion fileWindow = new JGrassRegion(grassMapGeoResource.getFileWindow());
            JGrassMapsetGeoResource parent = (JGrassMapsetGeoResource) grassMapGeoResource.parent(new NullProgressMonitor());
            CoordinateReferenceSystem grassCrs = parent.getLocationCrs();
            JGrassRegion screenDrawWindow = new JGrassRegion(envelope.getMinX(), envelope.getMaxX(), envelope.getMinY(),
                    envelope.getMaxY(), fileWindow.getRows(), fileWindow.getCols());

            // to intersect with the data window, we transform the screen window
            JGrassRegion reprojectedScreenDrawWindow = screenDrawWindow;
View Full Code Here

  private  LineString getSplittingLineInMapCRS(final EditToolHandler handler)
    throws SplitFeaturesCommandException {

      final PrimitiveShape currentShape = handler.getCurrentShape();
      final LineString lineInLayerCrs = GeometryCreationUtil.createGeom(LineString.class, currentShape, false);
      final CoordinateReferenceSystem mapCrs = MapUtil.getCRS(handler.getContext().getMap());

      LineString splittingLine = reprojectSplitLine(lineInLayerCrs, mapCrs);

      return splittingLine;
  }
View Full Code Here

   */
  private  LineString reprojectSplitLine(final LineString lineInLayerCrs, final CoordinateReferenceSystem targetCrs) throws SplitFeaturesCommandException {
     
      try{
         
            CoordinateReferenceSystem splitLineCrs = (CoordinateReferenceSystem) lineInLayerCrs.getUserData();
         
          if(splitLineCrs == null){
             
              final ILayer selectedLayer = this.handler.getContext().getSelectedLayer();
              final CoordinateReferenceSystem layerCrs = LayerUtil.getCrs(selectedLayer);

              assert this.handler.getCurrentShape() != null;
              assert layerCrs != null;
             
              splitLineCrs = layerCrs;
View Full Code Here

          Filter filter = selectedLayer.getFilter();
          FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
          Intersects intersectsFilter;

      final CoordinateReferenceSystem layerCrs = LayerUtil.getCrs(selectedLayer);
      final Geometry splitLineGeom = reprojectSplitLine(splittingLine, layerCrs);

      SimpleFeatureType schema = selectedLayer.getSchema();
      String geomName = schema.getGeometryDescriptor().getLocalName();
View Full Code Here

    ProjectPlugin.log(className + " - Split original: " + splitterInMapCrs.toText()); //$NON-NLS-1$
 
    final EditCommandFactory cmdFac = EditCommandFactory.getInstance();
    final FeatureIterator<SimpleFeature> featureToSplitIterator = featuresToSplit.features();
    final CoordinateReferenceSystem mapCRS = handler.getContext().getCRS();

    try {
     
      List<SimpleFeature> originalFeatureList = asList(featureToSplitIterator);
     
            if(originalFeatureList.isEmpty()){
                throw new SplitFeaturesCommandException(Messages.SplitFeaturesCommand_did_not_apply_to_any_feature);
            }
          ProjectPlugin.log(className + " - Split using CRS: " + mapCRS.toString()); //$NON-NLS-1$

      SplitFeatureBuilder builder = SplitFeatureBuilder.newInstance(originalFeatureList, splitterInMapCrs, mapCRS);
      try {
        builder.buildSplit();
      } catch (CannotSplitException e) {
View Full Code Here

                                    pm.worked(1);
                                }

                                String code = null;
                                try {
                                    CoordinateReferenceSystem jGrassCrs = grassMapEnvironment.getCoordinateReferenceSystem();
                                    try {
                                        Integer epsg = CRS.lookupEpsgCode(jGrassCrs, true);
                                        code = "EPSG:" + epsg;
                                    } catch (Exception e) {
                                        // try non epsg
View Full Code Here

        }

        public CoordinateReferenceSystem getCRS() {
            if( layer.cRS!=null )
                return layer.cRS;
            CoordinateReferenceSystem crs = info.getCRS();
            if (crs == null) {
                return DefaultEngineeringCRS.GENERIC_2D;
            }
            return crs;
        }
View Full Code Here

TOP

Related Classes of org.opengis.referencing.crs.CoordinateReferenceSystem

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.