当前位置: 首页>>代码示例>>Java>>正文


Java PickedState.getPicked方法代码示例

本文整理汇总了Java中edu.uci.ics.jung.visualization.picking.PickedState.getPicked方法的典型用法代码示例。如果您正苦于以下问题:Java PickedState.getPicked方法的具体用法?Java PickedState.getPicked怎么用?Java PickedState.getPicked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.uci.ics.jung.visualization.picking.PickedState的用法示例。


在下文中一共展示了PickedState.getPicked方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mouseDragged

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
/**
 * If the mouse is over a picked vertex, drag the picked vertex with the mouse
 * plus all vertexes in its group, if the vertex implements the interface VertexGroup.
 */
@SuppressWarnings("unchecked")
public void mouseDragged(MouseEvent e) {
    VisualizationViewer<V, E> vv = (VisualizationViewer) e.getSource();
    if (vertex != null) {
        e.consume();
        Point p = e.getPoint();
        Point2D graphPoint = vv.getRenderContext()
                        .getMultiLayerTransformer().inverseTransform(p);
        Point2D graphDown = vv.getRenderContext()
                        .getMultiLayerTransformer().inverseTransform(down);
        Layout<V, E> layout = vv.getGraphLayout();
        double dx = graphPoint.getX() - graphDown.getX();
        double dy = graphPoint.getY() - graphDown.getY();
        PickedState<V> ps = vv.getPickedVertexState();

        for (V v : ps.getPicked()) {
            Point2D vp = layout.transform(v);
            vp.setLocation(vp.getX() + dx, vp.getY() + dy);
            layout.setLocation(v, vp);
        }
        down = p;
    }
    vv.repaint();
}
 
开发者ID:joe42,项目名称:nubisave,代码行数:29,代码来源:VertexPicker.java

示例2: mouseReleased

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
/**
 * clean up settings from mousePressed
 */
@Override
public void mouseReleased(MouseEvent e) {
    if(vertex != null) {
        VisualizationViewer<V, E> vv = (VisualizationViewer) e.getSource();
        PickedState<V> ps = vv.getPickedVertexState();
        Point2D p = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint());
        int x = (int) p.getX();
        int y = (int) p.getY();
        for (V v : ps.getPicked()) {
            if(v instanceof AbstractNubisaveComponent){
                ((AbstractNubisaveComponent)v).setGraphLocation(new Point(x,y));
                System.out.println("setting graph location");
            }
        }
    }
    super.mouseReleased(e);
}
 
开发者ID:joe42,项目名称:nubisave,代码行数:21,代码来源:StorageServicePicker.java

示例3: mouseDraggedSuperAction

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
/**
 * This is the MouseDragged super action of the super class (because of several exceptions).
 * @param me the MouseEvent
 */
private void mouseDraggedSuperAction(MouseEvent me) {

	if(locked == false) {
           VisualizationViewer<GraphNode,GraphEdge> vv = this.basicGraphGUI.getVisualizationViewer();
           if(vertex != null) {
               Point p = me.getPoint();
               Point2D graphPoint = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(p);
               Point2D graphDown = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
               Layout<GraphNode,GraphEdge> layout = vv.getGraphLayout();
               double dx = graphPoint.getX()-graphDown.getX();
               double dy = graphPoint.getY()-graphDown.getY();
               PickedState<GraphNode> ps = vv.getPickedVertexState();
               
               for(GraphNode v : ps.getPicked()) {
                   Point2D vp = layout.transform(v);
                   vp.setLocation(vp.getX()+dx, vp.getY()+dy);
                   layout.setLocation(v, vp);
               }
               down = p;
               me.consume();
               vv.repaint();
               
           } else {
               Point2D out = me.getPoint();
               if(me.getModifiers() == this.addToSelectionModifiers || me.getModifiers() == modifiers) {
                   if (down!=null) {
                   	rect.setFrameFromDiagonal(down,out);
                   	vv.repaint();
                   }
               }
           }
       }
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:38,代码来源:GraphEnvironmentMousePlugin.java

示例4: getPickedNodes

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
/**
 * Gets the Set<GraphNode> of picked nodes.
 * @return the picked nodes
 */
public Set<GraphNode> getPickedNodes() {
	PickedState<GraphNode> nodesPicked = this.getVisualizationViewer().getPickedVertexState();
	if (nodesPicked!=null) {
		return nodesPicked.getPicked();
	}
	return null;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:12,代码来源:BasicGraphGui.java

示例5: getPickedEdges

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
/**
 * Gets the Set<GraphEdge> of picked edges.
 * @return the picked edges
 */
public Set<GraphEdge> getPickedEdges() {
	PickedState<GraphEdge> edgesPicked = this.getVisualizationViewer().getPickedEdgeState();
	if (edgesPicked!=null) {
		return edgesPicked.getPicked();
	}
	return null;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:12,代码来源:BasicGraphGui.java

示例6: mouseDragged

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
/**
 * If the mouse is over a picked vertex, drag all picked
 * vertices with the mouse.
 * If the mouse is not over a Vertex, draw the rectangle
 * to select multiple Vertices
 */
@SuppressWarnings("unchecked")
public void mouseDragged( MouseEvent e ) {
    if (locked == false) {
        VisualizationViewer<Room, Exit> vv = (VisualizationViewer) e.getSource();
        if (room != null) {
            Point p = e.getPoint();
            Point2D graphPoint = vv.getRenderContext().getMultiLayerTransformer().inverseTransform( p );
            Point2D graphDown = vv.getRenderContext().getMultiLayerTransformer().inverseTransform( down );
            Layout<Room, Exit> layout = vv.getGraphLayout();
            double dx = graphPoint.getX() - graphDown.getX();
            double dy = graphPoint.getY() - graphDown.getY();
            PickedState<Room> ps = vv.getPickedVertexState();

            for (Room v : ps.getPicked()) {
                Point2D vp = layout.transform( v );
                vp.setLocation( vp.getX() + dx, vp.getY() + dy );
                layout.setLocation( v, vp );
            }
            down = p;

        } else {
            Point2D out = e.getPoint();
            if (e.getModifiers() == this.addToSelectionModifiers ||
                    e.getModifiers() == modifiers) {
                rect.setFrameFromDiagonal( down, out );
            }
        }
        if (room != null) e.consume();
        vv.repaint();
    }
}
 
开发者ID:lauriholmas,项目名称:batmapper,代码行数:38,代码来源:MapperPickingGraphMousePlugin.java

示例7: mouseDragged

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
/**
 * If the mouse is over a picked vertex, drag all picked vertices with the mouse. If the mouse
 * is not over a Vertex, draw the rectangle to select multiple Vertices
 *
 */
@Override
@SuppressWarnings("unchecked")
public void mouseDragged(MouseEvent e) {
	if (locked == false) {
		VisualizationViewer<V, E> vv = (VisualizationViewer<V, E>) e.getSource();
		if (vertex != null) {
			Point p = e.getPoint();
			Point2D graphPoint = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(p);
			Point2D graphDown = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
			Layout<V, E> layout = vv.getGraphLayout();
			double dx = graphPoint.getX() - graphDown.getX();
			double dy = graphPoint.getY() - graphDown.getY();
			PickedState<V> ps = vv.getPickedVertexState();

			for (V v : ps.getPicked()) {
				Point2D vp = layout.transform(v);
				vp.setLocation(vp.getX() + dx, vp.getY() + dy);
				layout.setLocation(v, vp);
			}
			down = p;

		} else {
			if (rectangleSelectionEnabled) {
				Point2D out = e.getPoint();
				if (e.getModifiers() == this.addToSelectionModifiers || e.getModifiers() == modifiers) {
					rect.setFrameFromDiagonal(down, out);
				}
			}
		}
		if (vertex != null) {
			e.consume();
		}
		vv.repaint();
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:41,代码来源:ExtendedPickingGraphMousePlugin.java

示例8: getSelectedVertices

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
public Set<Object> getSelectedVertices() {
    final PickedState<Object> pickedVertexState = _visualizationViewer.getPickedVertexState();
    if (pickedVertexState == null) {
        return null;
    }
    return pickedVertexState.getPicked();
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:8,代码来源:JobGraphContext.java

示例9: mouseDragged

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void mouseDragged(MouseEvent e) {
	BetterVisualizationViewer<V, E> vv = (BetterVisualizationViewer<V, E>) e.getSource();
       
	if (vertex != null) {
		if (allowMovingNodes && down != null) {
			Point2D graphPoint = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(e.getPoint());
			Point2D graphDown = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
			Point2D move = PointUtils.substractPoints(graphPoint, graphDown);
			Layout<V, E> layout = vv.getGraphLayout();
			
			PickedState<V> ps = vv.getPickedVertexState();

			for (V v : ps.getPicked()) {
				if(!layout.isLocked(v)) {
					layout.setLocation(v, PointUtils.addPoints(layout.transform(v), move));
					nodesMoved = true;
				}
			}

			if(nodesMoved) vv.repaint();
		}

		down = e.getPoint();
	} else if (edge != null) {
		down = e.getPoint();
	} else if (down != null) {
		rect.setFrameFromDiagonal(down, e.getPoint());
		vv.drawRect(rect);
	} else {
		down = e.getPoint();
	}
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:35,代码来源:BetterPickingGraphMousePlugin.java

示例10: mouseDragged

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
/**
* If the mouse is over a picked vertex, drag all picked
* vertices with the mouse.
* If the mouse is not over a Vertex, draw the rectangle
* to select multiple Vertices
* 
*/
  @SuppressWarnings("unchecked")
  public void mouseDragged(MouseEvent e) {
      if(locked == false) {
          VisualizationViewer<V,E> vv = (VisualizationViewer)e.getSource();
          if(vertex != null) {
              Point p = e.getPoint();
              Point2D graphPoint = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(p);
              Point2D graphDown = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(down);
              Layout<V,E> layout = vv.getGraphLayout();
              double dx = graphPoint.getX()-graphDown.getX();
              double dy = graphPoint.getY()-graphDown.getY();
              PickedState<V> ps = vv.getPickedVertexState();
              
              for(V v : ps.getPicked()) {
                  Point2D vp = layout.transform(v);
                  vp.setLocation(vp.getX()+dx, vp.getY()+dy);
                  layout.setLocation(v, vp);
              }
              down = p;

          } else {
              Point2D out = e.getPoint();
              if(e.getModifiers() == this.addToSelectionModifiers ||
                      e.getModifiers() == modifiers) {
                  rect.setFrameFromDiagonal(down,out);
              }
          }
          if(vertex != null) e.consume();
          vv.repaint();
      }
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:39,代码来源:PickingGraphMousePlugin.java

示例11: getPickedState

import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
private State getPickedState() {
    PickedState<State> pickedVertexState = visualizationViewer.getPickedVertexState();
    Set<State> pickedStates = pickedVertexState.getPicked();
    return pickedStates.isEmpty() ? null : pickedStates.iterator().next();
}
 
开发者ID:tomaszi1,项目名称:petri-nets-simulator,代码行数:6,代码来源:ReachabilityGraphPanel.java


注:本文中的edu.uci.ics.jung.visualization.picking.PickedState.getPicked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。