本文整理汇总了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();
}
示例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);
}
示例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();
}
}
}
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}