Package org.locationtech.udig.project

Examples of org.locationtech.udig.project.IBlackboard


    }

    private void checkStyle() {
        IMap activeMap = ApplicationGIS.getActiveMap();

        IBlackboard styleBlackboard = activeMap.getBlackboard();
        if (style == null) {
            style = (RasterLegendStyle) styleBlackboard.get(RasterLegendStyleContent.ID);
        }
        if (style == null) {
            style = RasterLegendStyleContent.createDefault();
            styleBlackboard.put(RasterLegendStyleContent.ID, style);
            // styleBlackboard.setSelected(new String[]{RasterLegendStyleContent.ID});
        }
    }
View Full Code Here


        updateBlackboard();
    }

    private void updateBlackboard() {
        IMap activeMap = ApplicationGIS.getActiveMap();
        IBlackboard styleBlackboard = activeMap.getBlackboard();
        style = (RasterLegendStyle) styleBlackboard.get(RasterLegendStyleContent.ID);

        if (style == null) {
            style = RasterLegendStyleContent.createDefault();
            styleBlackboard.put(RasterLegendStyleContent.ID, style);
            // styleBlackboard.setSelected(new String[]{RasterLegendStyleContent.ID});
        }

        RGB bg = backgroundColour.getColorValue();
        try {
            int bAlpha = Integer.parseInt(backgroundAlphaText.getText());
            style.backgroundColor = new Color(bg.red, bg.green, bg.blue, bAlpha);
        } catch (Exception e) {
            style.backgroundColor = new Color(bg.red, bg.green, bg.blue);
        }
        bg = foregroundColor.getColorValue();
        try {
            int fAlpha = Integer.parseInt(forgroundAlphaText.getText());
            style.foregroundColor = new Color(bg.red, bg.green, bg.blue, fAlpha);
        } catch (Exception e) {
            style.foregroundColor = new Color(bg.red, bg.green, bg.blue);
        }
        bg = fontColour.getColorValue();
        style.fontColor = new Color(bg.red, bg.green, bg.blue);

        style.titleString = titleText.getText();
        style.xPos = Integer.parseInt(xposText.getText());
        style.yPos = Integer.parseInt(yposText.getText());
        style.legendHeight = Integer.parseInt(legHeightText.getText());
        style.legendWidth = Integer.parseInt(legWidthText.getText());
        style.boxWidth = Integer.parseInt(boxWidthText.getText());
        style.isRoundedRectangle = isroundedButton.getSelection();

        styleBlackboard.put(RasterLegendStyleContent.ID, style);
    }
View Full Code Here

        if (configBean.getWidth() <= 0) throw new IllegalArgumentException("ScaleDenomMapGraphicBean width must be a positive number"); //$NON-NLS-1$
        if (configBean.getHeight() <= 0) throw new IllegalArgumentException("ScaleDenomMapGraphicBean height must be a positive number"); //$NON-NLS-1$
        if (configBean.getLabel() == null) throw new NullPointerException("ScaleDenomMapGraphicBean label must not be null"); //$NON-NLS-1$
       
        ViewportGraphics g = context.getGraphics();
        IBlackboard mapblackboard = context.getMap().getBlackboard();
       
        double scaleDenom = context.getViewportModel().getScaleDenominator();
       
        Object value = mapblackboard.get("scale"); // scale may be set by printing engine       
        if( value != null && value instanceof Double ){
            scaleDenom = ((Double)value).doubleValue();
        }
       
        if (configBean.getBackgroundColor() != null) {
View Full Code Here

  }
 
  /** Replace w/ lookup to style black board when the time comes */
  private Point start(MapGraphicContext context) {
    Point point = null;   
    IBlackboard style = context.getLayer().getStyleBlackboard();
    try {
      point = (Point) style.get( NorthArrowTool.STYLE_BLACKBOARD_KEY );
    }
    catch( Exception evil ){
      evil.printStackTrace();
    }
    if( point == null ){ // default!
      point = new Point( 25,25 );
      style.put(NorthArrowTool.STYLE_BLACKBOARD_KEY, point );
    }
    return point;
  }
View Full Code Here

    @Override
    public void mouseReleased( MapMouseEvent e ) {
      command.setValid( false );
      getContext().getViewportPane().repaint();

      IBlackboard styleBlackboard = getContext().getSelectedLayer().getStyleBlackboard();
     
      styleBlackboard.put( STYLE_BLACKBOARD_KEY, e.getPoint() );
      getContext().getSelectedLayer().refresh( null );
    }
View Full Code Here

        /* 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;
            }
        }
View Full Code Here

    }

    @Override
    protected void refresh() {
        try {
            IBlackboard blackboard = getLayer().getMap().getBlackboard();

            style = (ActiveRegionStyle) blackboard.get(ActiveregionStyleContent.ID);

            if (style == null) {
                style = ActiveregionStyleContent.createDefault();
                blackboard.put(ActiveregionStyleContent.ID, style);
                // ((StyleBlackboard) styleBlackboard).setSelected(new
                // String[]{ActiveregionStyleContent.ID});
            }

            // first time choose the mapset
View Full Code Here

    @SuppressWarnings("unchecked")
    private Node findClosest( Coordinate coord ) {
        Node closest = null;
        double minDist = 0.0;

        IBlackboard mapboard = context.getMap().getBlackboard();
        if ( !mapboard.contains( "graph" ) ) {
            return null;
        }
        Graph graph = (Graph) mapboard.get( "graph" );
        Collection<Node> nodes = (Collection<Node>) graph.getNodes();
        for ( Node node : nodes ) {
            Point p = (Point ) node.getObject();
            double d = getDist( coord, p );
            if ( closest == null || d < minDist ) {
View Full Code Here

    public void onMousePressed( MapMouseEvent e ) {
        Coordinate clickPt = getContext().pixelToWorld( e.x, e.y );
        final Node n = findClosest( clickPt );
        if ( n != null ) {
            IBlackboard mapboard = context.getMap().getBlackboard();
            if ( !mapboard.contains( "waypoints" ) ) {
                mapboard.put( "waypoints", new ArrayList<Node>() );
            }
            ArrayList<Node> list = (ArrayList<Node> ) mapboard.get( "waypoints" );
            list.add( n );
            final int len = list.size();

            getContext().getSelectedLayer().refresh( null );
View Full Code Here

   
    public GraphMapGraphic() {
    }

    public void draw( MapGraphicContext context ) {
        IBlackboard mapboard = context.getMap().getBlackboard();
        if( !mapboard.contains("graph")){
            return;
        }
        List<Node> waypoints = (List<Node>) mapboard.get("waypoints");
        if( waypoints == null ){
            waypoints = Collections.emptyList();
        }
        List<Edge> path = (List<Edge>) mapboard.get("path");
        if( path == null ){
            path = Collections.emptyList();
        }       
        Graph graph = (Graph) mapboard.get("graph");
        ViewportGraphics graphics = context.getGraphics();
        graphics.setColor( Color.LIGHT_GRAY );
        Collection<Node> nodes = graph.getNodes();
        for( Node node : nodes ){
            if( waypoints.contains(node)){
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.