Package org.locationtech.udig.project

Examples of org.locationtech.udig.project.ILayer


   * @param object layer
   * @param ket key to test
   * @returns true if the associated value is not null
   */
  public boolean isTrue(Object object, String key) {
    ILayer layer = (ILayer) object;
    return layer.getStyleBlackboard().get( key ) != null;
  }
View Full Code Here


        // this is the entry point for non printing
        /* For non-printing we will have a layer and can
         * used the cached image on the layer. 
         */
        List<IOException> exceptions = new ArrayList<IOException>();
        ILayer layer = context.getLayer();
        IBlackboard blackboard = layer.getBlackboard();
        BlackboardItem cached = (BlackboardItem) blackboard.get(BLACKBOARD_IMAGE_KEY);
        if (cached != null){
            if (!cached.layersEqual(getContext().getLayers())){
                cached = null;
            }
        }
   
        if (cached == null){
            Object values[] = backgroundRenderImage(getContext(), exceptions);
            cached = new BlackboardItem((BufferedImage)values[0], (ReferencedEnvelope)values[1], getContext().getLayers());
            layer.getBlackboard().put(BLACKBOARD_IMAGE_KEY, cached);
           
        }
        BufferedImage cache = cached.image;
        ReferencedEnvelope imageBounds = cached.env;
       
View Full Code Here

            addMapMouseListener();
        }

        if (isProcessing()) {
            addRegionListener();
            ILayer processingRegionLayer = OmsBoxPlugin.getDefault().getProcessingRegionMapGraphic();
            IStyleBlackboard blackboard = processingRegionLayer.getStyleBlackboard();
            Object object = blackboard.get(ProcessingRegionStyleContent.ID);
            if (object instanceof ProcessingRegionStyle) {
                ProcessingRegionStyle processingStyle = (ProcessingRegionStyle) object;
                setRegion(processingStyle);
            }
View Full Code Here

        viewportPane.addMouseListener(currentMapMouseListener);
    }

    private void removeRegionListener() {
        if (currentBlackboardListener != null) {
            ILayer processingRegionLayer = OmsBoxPlugin.getDefault().getProcessingRegionMapGraphic();
            IStyleBlackboard blackboard = processingRegionLayer.getStyleBlackboard();
            blackboard.removeListener(currentBlackboardListener);
        }
    }
View Full Code Here

            blackboard.removeListener(currentBlackboardListener);
        }
    }

    private void addRegionListener() {
        ILayer processingRegionLayer = OmsBoxPlugin.getDefault().getProcessingRegionMapGraphic();
        IStyleBlackboard blackboard = processingRegionLayer.getStyleBlackboard();
        currentBlackboardListener = new IBlackboardListener(){
            public void blackBoardCleared( IBlackboard source ) {
            }
            public void blackBoardChanged( BlackboardEvent event ) {
                Object key = event.getKey();
View Full Code Here

public class FindPathOp implements IOp {

    public void op( Display display, Object target, IProgressMonitor monitor ) throws Exception {
        long start = System.nanoTime();

        ILayer layer = (ILayer) target;
        IBlackboard mapboard = layer.getMap().getBlackboard();

        if ( !mapboard.contains( "graph" ) || !mapboard.contains( "waypoints" ) ) {
            return;
        }

        Graph graph = (Graph ) mapboard.get( "graph" );
        ArrayList<Node> list = (ArrayList<Node> ) mapboard.get( "waypoints" );
        if ( list.size() < 2 ) {
            return;
        }

        DijkstraIterator.EdgeWeighter weighter = new DijkstraIterator.EdgeWeighter() {
            public double getWeight( Edge e ) {
                Point a = (Point ) e.getNodeA().getObject();
                Point b = (Point ) e.getNodeB().getObject();
                double dx = a.getX() - b.getX();
                double dy = a.getY() - b.getY();

                return Math.sqrt( dx * dx + dy * dy );
            }
        };

        List<Edge> edgeList = new ArrayList<Edge>();
        for ( int i = 0; i < list.size() - 1; i++ ) {
            DijkstraShortestPathFinder pf = new DijkstraShortestPathFinder( graph, list.get( i ), weighter );
            pf.calculate();
            Path path = pf.getPath( list.get( i + 1 ) );
            if ( path != null ) {
                edgeList.addAll( path.getEdges() );
            }
        }
        mapboard.put( "path", edgeList );
        layer.refresh( null );

        monitor.done();
        long end = System.nanoTime();
        System.out.println( Double.toString( ((end - start) / 1000) / 1000.0 ) + "ms" );
    }
View Full Code Here

                String value = labelProvider.getText(domain);
                itemNames.add(value);
            }
            itemLayers = new ArrayList<IGeoResource>();
            for( String name : itemNames ) {
                ILayer tmpLayer = itemsMap.get(name);
                if (tmpLayer != null) {
                    if (tmpLayer.getGeoResource().canResolve(JGrassMapGeoResource.class)) {
                        JGrassMapGeoResource rasterMapResource = null;
                        try {
                            rasterMapResource = tmpLayer.getGeoResource().resolve(JGrassMapGeoResource.class, null);
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                        if (rasterMapResource != null) {
                            itemLayers.add(rasterMapResource);
View Full Code Here

    /**
     * @see org.locationtech.udig.project.command.MapCommand#run()
     */
    public void run( IProgressMonitor monitor ) throws Exception {
        ILayer layer = editLayer.get(monitor);
        if( layer==null ){
            System.err.println("class "+editLayer.getClass().getName()+" is returning null")//$NON-NLS-1$//$NON-NLS-2$
            return;
        }
        FeatureStore<SimpleFeatureType, SimpleFeature> resource = layer.getResource(FeatureStore.class, null);
        SimpleFeature feature2 = editFeature.get(monitor);

        FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
    Id fidFilter = filterFactory.id(
                FeatureUtils.stringToId(filterFactory,feature2.getID()));

    // for loop to get the old values
    for(int i = 0; i < xpath.length; i++){
        oldValue[i] = feature2.getAttribute(xpath[i]);
    }
   
    // update the new values with another for loop
    for(int i = 0; i < xpath.length; i++){
        feature2.setAttribute(xpath[i],value[i]);
    }
       
        List<AttributeDescriptor> attributeList = new ArrayList<AttributeDescriptor>();
        SimpleFeatureType schema = layer.getSchema();
        for( String name : xpath ){
            attributeList.add( schema.getDescriptor( name ));
        }
        AttributeDescriptor[] array = attributeList.toArray( new AttributeDescriptor[attributeList.size()]);
        resource.modifyFeatures(array, value, fidFilter);
View Full Code Here

        // need another for loop
        for ( int i = 0; i > xpath.length; i++){
            feature.setAttribute(xpath[i], oldValue[i]);
        }

        ILayer layer = editLayer.get(monitor);
        FeatureStore<SimpleFeatureType, SimpleFeature> resource = layer.getResource(FeatureStore.class, null);
       
        // need another for loop
       
        List<AttributeDescriptor> attributeList = new ArrayList<AttributeDescriptor>();
        SimpleFeatureType schema = layer.getSchema();
        for( String name : xpath ){
            attributeList.add( schema.getDescriptor( name ));
        }
        AttributeDescriptor[] array = attributeList.toArray( new AttributeDescriptor[attributeList.size()]);
       
View Full Code Here

    }
   
   
    public static FeatureIssue createFeatureIssue(String id) throws Exception {
        IMap map=MapTests.createDefaultMap("testMap", 1, true, new java.awt.Dimension(10,10)); //$NON-NLS-1$
        ILayer layer=map.getMapLayers().get(0);
        FeatureCollection<SimpleFeatureType, SimpleFeature> collection = layer.getResource(FeatureSource.class, null).getFeatures();
        SimpleFeature feature=collection.features().next();
        FeatureIssue issue=new FeatureIssue(Priority.WARNING, "test description", layer, feature, "groupID"); //$NON-NLS-1$ //$NON-NLS-2$
        issue.setId(id);
        return issue;
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.ILayer

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.