Package org.locationtech.udig.project

Examples of org.locationtech.udig.project.IBlackboard


    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


        super();
        setSize(new Point(500, 450));
    }

    public void createPageContent( Composite parent ) {
        IBlackboard styleBlackboard = getSelectedLayer().getStyleBlackboard();
        String maskColorString = styleBlackboard.getString(COVERAGE_COLORMASK_ID);

        Group colorMaskGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
        colorMaskGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
        colorMaskGroup.setLayout(new GridLayout(2, false));
        colorMaskGroup.setText(Messages.CoverageColorMaskStyleEditorPage_0);
View Full Code Here

                                JGrassRegion newActiveRegion = JGrassRegion.adaptActiveRegionToEnvelope(bounds, currentRegion);
                                File windFile = grassMapEnvironment.getWIND();
                                JGrassRegion.writeWINDToMapset(windFile.getParent(), newActiveRegion);

                                IMap activeMap = ApplicationGIS.getActiveMap();
                                IBlackboard blackboard = activeMap.getBlackboard();
                                ActiveRegionStyle style = (ActiveRegionStyle) blackboard.get(ActiveregionStyleContent.ID);
                                if (style == null) {
                                    style = ActiveregionStyleContent.createDefault();
                                }
                                style.north = (float) newActiveRegion.getNorth();
                                style.south = (float) newActiveRegion.getSouth();
                                style.east = (float) newActiveRegion.getEast();
                                style.west = (float) newActiveRegion.getWest();
                                style.rows = newActiveRegion.getRows();
                                style.cols = newActiveRegion.getCols();
                                style.windPath = windFile.getAbsolutePath();
                                style.crsString = code;

                                blackboard.put(ActiveregionStyleContent.ID, style);

                                ILayer activeRegionMapGraphic = JGrassPlugin.getDefault().getActiveRegionMapGraphic();
                                activeRegionMapGraphic.refresh(null);

                            } catch (IOException e) {
View Full Code Here

      if( layer==null ){
        // Can't edit this layer but we don't want a shape from another layer to show up so
        // set the current shape to null;
        shapeToRestoreToCurrent = null;
      }else{
          IBlackboard blackboard = layer.getBlackboard();
      shapeToRestoreToCurrent = (PrimitiveShape)blackboard.get(EditToolHandler.STORED_CURRENT_SHAPE);
          blackboard.put(EditToolHandler.STORED_CURRENT_SHAPE, null);
      }
      handler.setCurrentShape(shapeToRestoreToCurrent);
    }
View Full Code Here

     * Store's the current state on the layer's blackboard
     * @param layer
     */
    private void storeCurrentState( ILayer layer ) {
      if( layer!=null ){
          IBlackboard blackboard = layer.getBlackboard();
          blackboard.put(EditToolHandler.STORED_CURRENT_STATE, handler.getCurrentState());
          blackboard.put( EditToolHandler.STORED_CURRENT_STATE, null );
      }
    }
View Full Code Here

        g.setColor(Color.RED);
        g.setStroke(ViewportGraphics.LINE_SOLID, 2);

        // get the map blackboard
        IMap map = context.getLayer().getMap();
        IBlackboard blackboard = context.getLayer().getMap().getBlackboard();

        List<Coordinate> coordinates = (List<Coordinate>) blackboard.get("locations");

        if (coordinates == null) {
            return; // no coordinates to draw
        }
        try {
View Full Code Here

            // check the blackboard of the given map for a current flock
            //System.out.println("update job called for map: " + map.getID()); //$NON-NLS-1$
            if (map == null)
                return Status.OK_STATUS; 
           
            IBlackboard blackboard = map.getBlackboard();     
            List<SeagullFlock> flocks = (List<SeagullFlock>) blackboard.get(SeagullFlock.BLACKBOARD_KEY);
           
            if (flocks == null) {
                return Status.OK_STATUS; // no seagull flocks to update
            }  
           
View Full Code Here

        //throw a coordinate onto the current map blackboard
        IMap map = ApplicationGIS.getActiveMap();
        if (map == null)
            return
       
        IBlackboard blackboard = map.getBlackboard();
        List<Coordinate> points =
            (List<Coordinate>) blackboard.get("locations");
        if (points == null) {
            points = new ArrayList<Coordinate>();
            blackboard.put("locations",points);
        }
       
        points.add(new Coordinate(e.x,e.y));
      
        Rectangle2D r = new Rectangle2D.Double(e.x,e.y,2,2);
View Full Code Here

        IMap currentMap = context.getLayer().getMap();
        if (!activeMap.equals(currentMap)) {
            return;
        }

        IBlackboard blackboard = context.getLayer().getStyleBlackboard();
        VectorLegendStyle legendStyle = (VectorLegendStyle) blackboard.get(VectorLegendStyleContent.ID);
        if (legendStyle == null) {
            legendStyle = VectorLegendStyleContent.createDefault();
            blackboard.put(VectorLegendStyleContent.ID, legendStyle);
        }

        Rectangle locationStyle = null;
        // (Rectangle) blackboard.get(LocationStyleContent.ID);
        if (locationStyle == null) {
            locationStyle = new Rectangle(-1, -1, -1, -1);
            blackboard.put(LocationStyleContent.ID, locationStyle);
        }

        FontStyle fontStyle = (FontStyle) blackboard.get(FontStyleContent.ID);
        if (fontStyle == null) {
            fontStyle = new FontStyle();
            blackboard.put(FontStyleContent.ID, fontStyle);
        }

        this.backgroundColour = legendStyle.backgroundColor;
        this.foregroundColour = legendStyle.foregroundColor;
        this.fontColour = legendStyle.fontColor;
View Full Code Here

         * is due to the fact that we need the mapreader here to get the
         * legend string. The mapreader is put on blackboard by the
         * raster renderer.
         */

        IBlackboard blackboard = context.getMap().getBlackboard();
        legendStyle = (RasterLegendStyle) blackboard.get(RasterLegendStyleContent.ID);
        if (legendStyle == null) {
            legendStyle = RasterLegendStyleContent.createDefault();
            blackboard.put(RasterLegendStyleContent.ID, legendStyle);
            // ((IBlackboard) blackboard).setSelected(new String[]{RasterLegendStyleContent.ID});
        }

        String mapPath = legendStyle.mapPath;
        if (mapPath == null) {
View Full Code Here

TOP

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

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.