Package org.locationtech.udig.catalog

Examples of org.locationtech.udig.catalog.IGeoResource


    public void testLayerWithNoBounds() throws Exception {
        SimpleFeature[] features = UDIGTestUtil.createTestFeatures("testNoBounds_Viewport", new Geometry[]{ //$NON-NLS-1$
        }
        , null, DefaultGeographicCRS.WGS84);
       
        IGeoResource resource = MapTests.createGeoResource(features, false );
        Map map = MapTests.createNonDynamicMapAndRenderer(resource, new Dimension(1024,1024));
        map.getViewportModelInternal().setCRS(DefaultGeographicCRS.WGS84);
       
        createContext(map);
       
View Full Code Here


        // to test that a listener is only added once
        prop.addListener(l);
       
        URL id = layer.getID();
        ICatalog localCatalog = CatalogPlugin.getDefault().getLocalCatalog();
        IGeoResource resource = localCatalog.getById(IGeoResource.class, new ID(id), new NullProgressMonitor());
        IService parent = resource.service(new NullProgressMonitor());
        localCatalog.replace(parent.getID(), parent);
       
        assertEquals(0, changed[0]);
       
        assertTrue(prop.isTrue(layer, "Polygon")); //$NON-NLS-1$
View Full Code Here

    public void lookupExample() {
        IRepository local = CatalogPlugin.getDefault().getLocal();

        final ID GRID_ID = new ID("mapgraphic:///localhost/mapgraphic#grid", null);
        IGeoResource gridResource = local.getById(IGeoResource.class, GRID_ID, new NullProgressMonitor());
        // You can then use this with the AddLayersCommand
    }
View Full Code Here

        if (updatedObject instanceof List) {
            String text = null;
            List< ? > layers = (List< ? >) updatedObject;
            for( Object layer : layers ) {
                if (layer instanceof IGeoResource) {
                    IGeoResource geoResource = (IGeoResource) layer;
                    try {
                        GridGeometry2D gridGeometry = null;
                        if (geoResource.canResolve(GridGeometry2D.class)) {
                            gridGeometry = geoResource.resolve(GridGeometry2D.class, new NullProgressMonitor());
                        } else if (geoResource.canResolve(GridCoverage.class)) {
                            GridCoverage2D gridCoverage = (GridCoverage2D) geoResource.resolve(GridCoverage.class,
                                    new NullProgressMonitor());
                            gridGeometry = gridCoverage.getGridGeometry();
                        }
                        if (gridGeometry != null)
                            setWidgetsToWindow(OmsBoxUtils.gridGeometry2ProcessingRegion(gridGeometry));
View Full Code Here

        features[0] = SimpleFeatureBuilder.build(ft,new Object[]{line[0], attrValues[0]}, Integer.toString(0));
        features[1] = SimpleFeatureBuilder.build(ft,new Object[]{line[1], attrValues[1]}, Integer.toString(1));
        features[2] = SimpleFeatureBuilder.build(ft,new Object[]{line[2], attrValues[2]}, Integer.toString(2));
        features[3] = SimpleFeatureBuilder.build(ft,new Object[]{line[3], attrValues[3]}, Integer.toString(3));

        IGeoResource resource = MapTests.createGeoResource(features, true);
        Map map = MapTests.createNonDynamicMapAndRenderer(resource, new Dimension(500, 512));
        ValidateOverlaps validator = new ValidateOverlaps();
        validator.op(Display.getDefault(), map.getLayersInternal().get(0),
                new NullProgressMonitor());
        assertEquals(1, validator.genericResults.failedFeatures.size()); //only line[0] and line[1] should fail (counts as 1)
View Full Code Here

        }
        if (iselection instanceof IStructuredSelection) {
            IStructuredSelection selection = (IStructuredSelection) iselection;
            for( Iterator< ? > iterator = selection.iterator(); iterator.hasNext(); ) {
                Object resource = iterator.next();
                IGeoResource iGeoResource = itemsMap.get(resource);
                if (iGeoResource != null)
                    selectedResources.add(iGeoResource);
            }
        }
    }
View Full Code Here

    private void getCoverageResources() throws IOException {
        IMap activeMap = ApplicationGIS.getActiveMap();
        List<ILayer> mapLayers = activeMap.getMapLayers();
        itemsMap.clear();
        for( ILayer layer : mapLayers ) {
            IGeoResource geoResource = layer.getGeoResource();
            if (geoResource.canResolve(GridCoverage.class)) {
                itemsMap.put(geoResource.getTitle(), geoResource);
            }
        }
    }
View Full Code Here

    }

    private void addLegend() {
        Map map = ApplicationGISInternal.getActiveMap();
        try {
            IGeoResource legendResource = null;

            URL url = new URL(MapGraphicService.SERVICE_URL, "#" + getExtensionID()); //$NON-NLS-1$
            List<IGeoResource> matches = CatalogPlugin.getDefault().getLocalCatalog().find(IGeoResource.class,
                url, ProgressManager.instance().get());
            if (!matches.isEmpty())
View Full Code Here

    public void testGeometryOp() throws Exception {
        SimpleFeature[] features = UDIGTestUtil.createDefaultTestFeatures("someType", 5); //$NON-NLS-1$
        Geometry geometry = (Geometry) features[0].getDefaultGeometry();
    geometry.getCoordinates()[0].x = 2;
        //features[0].setDefaultGeometry(null);
        IGeoResource resource = MapTests.createGeoResource(features, true);
        Map map = MapTests.createNonDynamicMapAndRenderer(resource, new Dimension(500,512));
        ValidateGeometry isValidGeometry = new ValidateGeometry();
        isValidGeometry.op(Display.getDefault(), map.getLayersInternal().get(0), new NullProgressMonitor());
        assertEquals(1,isValidGeometry.results.failedFeatures.size());
        map.sendCommandSync(new AbstractCommand(){
View Full Code Here

        SimpleFeature[] features=new SimpleFeature[2];
        // add lines
        features[0]=SimpleFeatureBuilder.build(ft,new Object[]{line[0], attrValues[0]}, Integer.toString(0));   
        features[1]=SimpleFeatureBuilder.build(ft,new Object[]{line[1], attrValues[1]}, Integer.toString(1));   
       
        IGeoResource resource = MapTests.createGeoResource(features, true);
        Map map = MapTests.createNonDynamicMapAndRenderer(resource, new Dimension(500,512));
        ValidateLineMustBeASinglePart isValidLine = new ValidateLineMustBeASinglePart();
        isValidLine.op(Display.getDefault(), map.getLayersInternal().get(0), new NullProgressMonitor());
        //System.out.println(isValidLine.genericResults.failedFeatures.size()+" failed feature");
        assertEquals(1,isValidLine.results.failedFeatures.size());
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.IGeoResource

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.