Examples of IBlackboard


Examples of org.locationtech.udig.project.IBlackboard

  private int imageWidth;
  private int imageHeight; // size of glyph image

  public void draw(MapGraphicContext context) {

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

    Rectangle locationStyle = (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.backgroundColour;
    this.foregroundColour = legendStyle.foregroundColour;
    this.horizontalMargin = legendStyle.horizontalMargin;
View Full Code Here

Examples of org.locationtech.udig.project.IBlackboard

public class RefreshLayersBehaviour implements Behaviour {

    public UndoableMapCommand getCommand( EditToolHandler handler ) {
        List<ILayer> layer = handler.getContext().getMapLayers();
        for( ILayer layer2 : layer ) {
            IBlackboard properties = layer2.getBlackboard();
            if( properties.get(ProjectBlackboardConstants.MAP__RENDERING_FILTER)!=null ){
                Envelope env=new Envelope();
                Set<String> fids=new HashSet<String>();
                for( EditGeom geom : handler.getEditBlackboard(layer2).getGeoms() ) {
                    if( env.isNull() ){
                        env.init(geom.getShell().getEnvelope() );
View Full Code Here

Examples of org.locationtech.udig.project.IBlackboard

        }
    }   

    public void draw( MapGraphicContext context ) {
        // get this map's flock and listener
        IBlackboard blackboard = getActiveBlackBoard(context);
        List<SeagullFlock> flocks = (List<SeagullFlock>) blackboard.get(SeagullFlock.BLACKBOARD_KEY);
        TrackingItemListenerImpl listener = (TrackingItemListenerImpl) blackboard.get(LISTENER_BLACKBOARD_KEY);
      
        // if no flocks, nothing to draw
        if (flocks == null) {
            return; // no seagull flocks to draw
        }  
        // if no listener, or the old one points to a different layer, then create a new one
        boolean isNewListener = false;
        TrackingItemListenerImpl oldListener = null;
        if (listener == null || listener.getLayer() != context.getLayer()) {
            oldListener = listener;
            ILayer layer = context.getLayer();
            listener = new TrackingItemListenerImpl(layer);
            blackboard.put(LISTENER_BLACKBOARD_KEY, listener);
            isNewListener = true;
        }
       
        // for each flock, draw it and ensure it has our listener added (new flocks
        // added since the last draw will not have them yet)
        for (SeagullFlock flock : flocks) {
           flock.draw(context);
           // if there is a new listener, remove any previous one first
           if (isNewListener) {
               flock.removeListener(oldListener);
           }
           flock.addListener(listener); // won't be added if it already has it
        }
       
        // set the graphic to look at refreshing every 0.5 secs if it is not already
        CheckRefreshJob job = (CheckRefreshJob) blackboard.get(REFRESHJOB_BLACKBOARD_KEY);
        if (job != null) {
            job.cancel();
        }
        long delay = 500;
        job = new CheckRefreshJob(context.getLayer(), null, delay);
        blackboard.put(REFRESHJOB_BLACKBOARD_KEY, job);
        job.schedule(delay);      
    }
View Full Code Here

Examples of org.locationtech.udig.project.IBlackboard

        job.schedule(delay);      
    }
   
    private IBlackboard getActiveBlackBoard(MapGraphicContext context) {
        //get the layer blackboard
        IBlackboard blackboard;
        if (context == null) {
            IMap map = ApplicationGIS.getActiveMap();
            if (map == null)
                return null;
           
View Full Code Here

Examples of org.locationtech.udig.project.IBlackboard

            // check the blackboard of the given layer to see if it should be refreshed
            if (layer == null) {
                return Status.OK_STATUS;  // we have no valid layer
            }
           
            IBlackboard blackboard = layer.getBlackboard();     
            Boolean needsRefresh = (Boolean) blackboard.get(NEEDSREFRESH_BLACKBOARD_KEY);
           
            // remove this job from the blackboard since it is now running
            blackboard.put(REFRESHJOB_BLACKBOARD_KEY, null);
           
            if (needsRefresh == null) {
                // reschedule this job to go again
                //rescheduleJob();               
                return Status.OK_STATUS; // no refresh needed
            }  
           
            // refresh if needed and reset the blackboard value
            if (needsRefresh) {
                layer.refresh(bounds);
                needsRefresh = false;
                blackboard.put(NEEDSREFRESH_BLACKBOARD_KEY, needsRefresh);
            }
           
            // reschedule this job to go again
            //rescheduleJob();
View Full Code Here

Examples of org.locationtech.udig.project.IBlackboard

            //Envelope bounds = trackingItem.getBounds();
            //System.out.println("redrawing map: " + layer.getMap().getID()); //$NON-NLS-1$
           
            // set the layer to be refreshed
            if (layer != null) {
                IBlackboard blackboard = layer.getBlackboard();     
                Boolean needsRefresh = true;
                blackboard.put(NEEDSREFRESH_BLACKBOARD_KEY, needsRefresh);
            }
            else if (trackingItem != null) {
                // Layer is gone, remove listener
                trackingItem.removeListener(this);
            }
            // double check that the layer/map is still displayed
            if (layer.getMap() == null || layer.getMap().getProject() == null) {
                // Layer is gone, remove listener
                trackingItem.removeListener(this);
                if (layer != null) {
                    IBlackboard blackboard = layer.getBlackboard();
                    blackboard.put(LISTENER_BLACKBOARD_KEY, null);
                }
            }
        }
View Full Code Here

Examples of org.locationtech.udig.project.IBlackboard

        // stick our test flock on the blackboard
        IMap map = (IMap) target;  //ApplicationGIS.getActiveMap();
        if (map == null)
            return
       
        IBlackboard blackboard = map.getBlackboard();
        List<SeagullFlock> flocks = new ArrayList<SeagullFlock>();
        flocks.add(flock);
        blackboard.put(SeagullFlock.BLACKBOARD_KEY, flocks)
       
        //System.out.println("created segaulls for map: " + map.getID()); //$NON-NLS-1$
       
        // refresh any trackinggraphic layers to show the new flock
        //map.getRenderManager().refresh(null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.