Package org.locationtech.udig.mapgraphic.grid

Examples of org.locationtech.udig.mapgraphic.grid.GridMapGraphic


    public Coordinate snapToGrid( Point centerPoint, IMap map )  {
        List<ILayer> layers = map.getMapLayers();
       
        // by default choose something that will work
        ILayer found=layers.get(0);
        GridMapGraphic graphic=new GridMapGraphic();
        for( ILayer layer : layers ) {
            if( layer.hasResource(GridMapGraphic.class) ){
                found = layer;
                try {
                    graphic = layer.getResource(GridMapGraphic.class, ProgressManager.instance().get());
                } catch (IOException e) {
                    throw (RuntimeException) new RuntimeException( ).initCause( e );
                }
                break;
            }
        }
       
       
        double[] closest;
        try {
            closest = graphic.closest(centerPoint.getX(), centerPoint.getY(), found);
        } catch (FactoryException e) {
            EditPlugin.log(null, e);
            throw (RuntimeException) new RuntimeException( ).initCause( e );
        }
        return new Coordinate(closest[0], closest[1], 0);
View Full Code Here

TOP

Related Classes of org.locationtech.udig.mapgraphic.grid.GridMapGraphic

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.