本文整理汇总了Java中edu.uci.ics.jung.visualization.picking.PickedState类的典型用法代码示例。如果您正苦于以下问题:Java PickedState类的具体用法?Java PickedState怎么用?Java PickedState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PickedState类属于edu.uci.ics.jung.visualization.picking包,在下文中一共展示了PickedState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPositions
import edu.uci.ics.jung.visualization.picking.PickedState; //导入依赖的package包/类
/**
* Sets the positions of the GraphNodes as configured in the HashMap.
* @param nodes2Move the nodes2 move
*/
private void setPositions(HashMap<String, Point2D> nodes2Move) {
PickedState<GraphNode> ps = new MultiPickedState<GraphNode>();
this.visViewer.setPickedVertexState(ps);
for(String nodeID : nodes2Move.keySet()) {
GraphNode node = (GraphNode) this.graphController.getNetworkModel().getGraphElement(nodeID);
if (node!=null) {
node.setPosition(nodes2Move.get(nodeID));
this.visViewer.getGraphLayout().setLocation(node, node.getPosition());
ps.pick(node, true);
}
}
this.sendNodesMovedNotification();
}
示例2: pickContainedVertices
import edu.uci.ics.jung.visualization.picking.PickedState; //导入依赖的package包/类
/**
* pick the vertices inside the rectangle created from points
* 'down' and 'out'
*/
protected void pickContainedVertices( VisualizationViewer<Room, Exit> vv, Point2D down, Point2D out, boolean clear ) {
Layout<Room, Exit> layout = vv.getGraphLayout();
PickedState<Room> pickedVertexState = vv.getPickedVertexState();
Rectangle2D pickRectangle = new Rectangle2D.Double();
pickRectangle.setFrameFromDiagonal( down, out );
if (pickedVertexState != null) {
if (clear) {
pickedVertexState.clear();
}
GraphElementAccessor<Room, Exit> pickSupport = vv.getPickSupport();
Collection<Room> picked = pickSupport.getVertices( layout, pickRectangle );
for (Room v : picked) {
pickedVertexState.pick( v, true );
}
}
}
示例3: highlightIsland
import edu.uci.ics.jung.visualization.picking.PickedState; //导入依赖的package包/类
/**
* Sets the transformers based on valid edges and vertices for the playsheet.
*/
private void highlightIsland( Collection<SEMOSSVertex> islandVerts,
Collection<SEMOSSEdge> islandEdges ) {
if ( allIslands ) {
gps.getView().highlight( islandVerts, islandEdges );
}
else {
PickedState state = gps.getView().getPickedVertexState();
for ( SEMOSSVertex v : islandVerts ) {
state.pick( v, true );
}
// gps.getView().highlight( islandVerts, islandEdges );
}
}
示例4: FilterOverlayView
import edu.uci.ics.jung.visualization.picking.PickedState; //导入依赖的package包/类
/**
* <p>
* Creates a new FilterOverlayViewController with a {@link ConfigData} object. This is needed to access the database
* in order to save/remove/update filters.
* </p>
*
* @param data The data that should be bound to the table view.
* @param filterEditingMenu The filter edit menu through which filters can be created and updated.
*/
public FilterOverlayView(final ObservableList<FilterInput> data,
final FilterEditingMenuView filterEditingMenu, final PickedState<INode> pickedState) {
super("filter_menu_overlay.fxml", new EnumMap<>(FilterInteraction.class));
this.pickedState = pickedState;
this.filterEditingMenu = filterEditingMenu;
this.data = data;
//this.filterEditingMenu.setVisible(false);
// Build the table view and the filter menu
BorderPane borderPane = setUpMenu(setUpTableView());
// Add menu to overlay
this.getChildren().add(borderPane);
}
示例5: mousePressed
import edu.uci.ics.jung.visualization.picking.PickedState; //导入依赖的package包/类
/**
* If the event occurs on a Vertex, pick that single Vertex
* @param e the event
*/
@SuppressWarnings("unchecked")
public void mousePressed(MouseEvent e) {
if (e.getModifiers() == modifiers) {
VisualizationViewer<V,E> vv = (VisualizationViewer) e.getSource();
GraphElementAccessor<V, E> pickSupport = vv.getPickSupport();
PickedState<V> pickedVertexState = vv.getPickedVertexState();
Layout<V,E> layout = vv.getGraphLayout();
if (pickSupport != null && pickedVertexState != null) {
// p is the screen point for the mouse event
Point2D p = e.getPoint();
vertex = pickSupport.getVertex(layout, p.getX(), p.getY());
if (vertex != null) {
if (pickedVertexState.isPicked(vertex) == false) {
pickedVertexState.clear();
pickedVertexState.pick(vertex, true);
}
}
}
e.consume();
}
}
示例6: pickContainedVertices
import edu.uci.ics.jung.visualization.picking.PickedState; //导入依赖的package包/类
/**
* pick the vertices inside the rectangle created from points
* 'down' and 'out'
*
*/
protected void pickContainedVertices(VisualizationViewer<V,E> vv, Point2D down, Point2D out, boolean clear) {
Layout<V,E> layout = vv.getGraphLayout();
PickedState<V> pickedVertexState = vv.getPickedVertexState();
Rectangle2D pickRectangle = new Rectangle2D.Double();
pickRectangle.setFrameFromDiagonal(down,out);
if(pickedVertexState != null) {
if(clear) {
pickedVertexState.clear();
}
GraphElementAccessor<V,E> pickSupport = vv.getPickSupport();
Collection<V> picked = pickSupport.getVertices(layout, pickRectangle);
for(V v : picked) {
pickedVertexState.pick(v, true);
}
}
}
示例7: setPickedVertexState
import edu.uci.ics.jung.visualization.picking.PickedState; //导入依赖的package包/类
public void setPickedVertexState(PickedState<V> pickedVertexState) {
if(pickEventListener != null && this.pickedVertexState != null) {
this.pickedVertexState.removeItemListener(pickEventListener);
}
this.pickedVertexState = pickedVertexState;
this.renderContext.setPickedVertexState(pickedVertexState);
if(pickEventListener == null) {
pickEventListener = new ItemListener() {
public void itemStateChanged(ItemEvent e) {
repaint();
}
};
}
pickedVertexState.addItemListener(pickEventListener);
}
示例8: setPickedEdgeState
import edu.uci.ics.jung.visualization.picking.PickedState; //导入依赖的package包/类
public void setPickedEdgeState(PickedState<E> pickedEdgeState) {
if(pickEventListener != null && this.pickedEdgeState != null) {
this.pickedEdgeState.removeItemListener(pickEventListener);
}
this.pickedEdgeState = pickedEdgeState;
this.renderContext.setPickedEdgeState(pickedEdgeState);
if(pickEventListener == null) {
pickEventListener = new ItemListener() {
public void itemStateChanged(ItemEvent e) {
repaint();
}
};
}
pickedEdgeState.addItemListener(pickEventListener);
}
示例9: valueChanged
import edu.uci.ics.jung.visualization.picking.PickedState; //导入依赖的package包/类
public void valueChanged(TreeSelectionEvent event)
{
viewer.setTextToInformationArea("");
DefaultMutableTreeNode node = getTreeNode(event.getPath());
FileNode fnode = getFileNode(node);
PickedState<VisualNode> pickedVertexState = vv.getPickedVertexState();
pickedVertexState.clear();
//TODO: FIX THIS
PickedState<VisualNode> pickedVertexStateZOOM = vvZOOM.getPickedVertexState();
pickedVertexStateZOOM.clear();
if(pickedVertexState != null)
{
for(VisualNode v : g.getVertices())
{
if(fnode!=null && v.getFileName().equals(fnode.getFile().getAbsolutePath()))
{
pickedVertexState.pick(v, true);
pickedVertexStateZOOM.pick(v, true);
}
}
}
}
示例10: pickContainedVertices
import edu.uci.ics.jung.visualization.picking.PickedState; //导入依赖的package包/类
protected void pickContainedVertices(VisualizationViewer<VisualNode, VisualEdge> vv,Point2D down, Point2D out, boolean clear) {
Layout<VisualNode, VisualEdge> layout = vv.getGraphLayout();
PickedState<VisualNode> pickedVertexState = vv.getPickedVertexState();
Rectangle2D pickRectangle = new Rectangle2D.Double();
pickRectangle.setFrameFromDiagonal(down,out);
if(pickedVertexState != null) {
if(clear) {
pickedVertexState.clear();
}
GraphElementAccessor<VisualNode,VisualEdge> pickSupport = vv.getPickSupport();
Collection<VisualNode> picked = pickSupport.getVertices(layout, pickRectangle);
for(VisualNode v : picked) {
if (v.getVisible())
{
pickedVertexState.pick(v, true);
}
}
}
}
示例11: 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();
}
示例12: 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);
}
示例13: 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();
}
}
}
}
}
示例14: 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;
}
示例15: 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;
}