本文整理汇总了Java中edu.uci.ics.jung.visualization.picking.PickedState.pick方法的典型用法代码示例。如果您正苦于以下问题:Java PickedState.pick方法的具体用法?Java PickedState.pick怎么用?Java PickedState.pick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uci.ics.jung.visualization.picking.PickedState
的用法示例。
在下文中一共展示了PickedState.pick方法的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: 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();
}
}
示例5: 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);
}
}
}
示例6: 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);
}
}
}
}
示例7: 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);
}
}
}
}
示例8: graphClicked
import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
@Override
public void graphClicked(State state, MouseEvent me) {
PickedState<State> pickedVertexState = visualizationViewer.getPickedVertexState();
pickedVertexState.clear();
pickedVertexState.pick(state, true);
listener.publish(state);
graphPanel.updateColoring();
}
示例9: SetPickedStates
import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
public void SetPickedStates(Set<String> vertexes) {
PickedState<String> ps = new MultiPickedState<String>();
Iterator it = vertexes.iterator();
while (it.hasNext()) {
Object element = it.next();
ps.pick(element.toString(), true);
}
vv.setPickedVertexState(ps);
}
示例10: mouseReleased
import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void mouseReleased(MouseEvent e) {
BetterVisualizationViewer<V, E> vv = (BetterVisualizationViewer<V, E>) e.getSource();
PickedState<V> pickedVertexState = vv.getPickedVertexState();
GraphElementAccessor<V, E> pickSupport = vv.getPickSupport();
if (down != null && down.distance(e.getPoint()) > 5 && e.getButton() == MouseEvent.BUTTON1) {
rect.setFrameFromDiagonal(down, e.getPoint());
if (!e.isShiftDown()) {
pickedVertexState.clear();
}
for (V v : pickSupport.getVertices(vv.getGraphLayout(), rect)) {
pickedVertexState.pick(v, true);
}
call(l -> l.nodePickingFinished());
}
if (nodesMoved) {
call(l -> l.nodeMovementFinished());
}
down = null;
nodesMoved = false;
vertex = null;
edge = null;
rect.setFrame(0, 0, 0, 0);
vv.drawRect(null);
vv.repaint();
}
示例11: processClickOnEmptySpace
import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
@Override
public void processClickOnEmptySpace(MouseEvent e) {
System.out.println("make new component");
AbstractNubisaveComponent newVertex = null;
newVertex = vertexFactory.create();
if(newVertex != null){
newVertex.addToGraph((VisualizationViewer<NubiSaveVertex, NubiSaveEdge>) vv, e.getPoint());
PickedState<NubiSaveVertex> pickedVertexState = vv.getPickedVertexState();
pickedVertexState.clear();
Set<NubiSaveVertex> picked = ((VertexGroup<NubiSaveVertex>) newVertex).getVertexGroupMembers();
for (NubiSaveVertex v : picked) {
pickedVertexState.pick((NubiSaveVertex)v, true);
}
}
}
示例12: SetPickedState
import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
public void SetPickedState(String vertex) {
PickedState<String> ps = new MultiPickedState<String>();
ps.pick(vertex, true);
vv.setPickedVertexState(ps);
}
示例13: SetEdgePickedState
import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
public void SetEdgePickedState(String edge) {
PickedState<String> ps = new MultiPickedState<String>();
ps.pick(edge, true);
vv.setPickedEdgeState(ps);
}
示例14: mousePressed
import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
previousNode = null;
travelThroughEdge = null;
down = e.getPoint();
VisualizationViewer<BooleanNode,TravelEdge> vv = (VisualizationViewer)e.getSource();
GraphElementAccessor<BooleanNode,TravelEdge> pickSupport = vv.getPickSupport();
PickedState<BooleanNode> pickedVertexState = vv.getPickedVertexState();
PickedState<TravelEdge> pickedEdgeState = vv.getPickedEdgeState();
if(pickSupport != null && pickedVertexState != null) {
Layout<BooleanNode,TravelEdge> layout = vv.getGraphLayout();
Point2D ip = e.getPoint();
vertex = pickSupport.getVertex(layout, ip.getX(), ip.getY());
if(vertex != null){
if(pickedVertexState.isPicked(vertex) == false) {
pickedVertexState.clear();
pickedVertexState.pick(vertex, true);
}
Graph<BooleanNode, TravelEdge> graph = layout.getGraph();
Collection<TravelEdge> inEdges = graph.getInEdges(vertex);
Collection<TravelEdge> outEdges = graph.getOutEdges(vertex);
TravelEdge[] inEdgesArray = inEdges.toArray(new TravelEdge[inEdges.size()]);
TravelEdge[] outEdgesArray = outEdges.toArray(new TravelEdge[outEdges.size()]);
checkEdge(inEdgesArray, graph);
if (previousNode == null){
checkEdge(outEdgesArray, graph);
}
if ((previousNode != null) && !(previousNode.equals(vertex))){
if ((inEdges.contains(travelThroughEdge) && travelThroughEdge.canTravelDownwards) || (outEdges.contains(travelThroughEdge) && travelThroughEdge.canTravelUpwards)){
previousNode.setCurrentNode(false);
previousNode.setStartNode(true);
vertex.setCurrentNode(true);
SeparationGame.incrementValidMoves();
vv.repaint();
if (vertex.isEndNode()){
System.out.println("End node reached!");
SeparationGame.endNodeReached();
}
} else {
System.out.println("Cannot travel there!");
SeparationGame.incrementInvalidMoves();
}
}
/*
boolean verstate = vertex.getObserved();
vertex.setObserved(!verstate);
vv.repaint();
*/
}
}
}
示例15: mousePressed
import edu.uci.ics.jung.visualization.picking.PickedState; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void mousePressed(MouseEvent e) {
down = e.getPoint();
nodesMoved = false;
PickedState<V> pickedVertexState = ((VisualizationViewer<V, E>) e.getSource()).getPickedVertexState();
PickedState<E> pickedEdgeState = ((VisualizationViewer<V, E>) e.getSource()).getPickedEdgeState();
if (e.getButton() == MouseEvent.BUTTON1) {
rect.setFrameFromDiagonal(down, down);
if (!e.isShiftDown()) {
if ((vertex = getPickedNode(e)) != null) {
if (!pickedVertexState.isPicked(vertex)) {
pickedVertexState.clear();
pickedVertexState.pick(vertex, true);
call(l -> l.nodePickingFinished());
}
} else if ((edge = getPickedEdge(e)) != null) {
if (!pickedEdgeState.isPicked(edge)) {
pickedEdgeState.clear();
pickedEdgeState.pick(edge, true);
call(l -> l.edgePickingFinished());
}
} else {
boolean nodesPicked = !pickedVertexState.getPicked().isEmpty();
boolean edgesPicked = !pickedEdgeState.getPicked().isEmpty();
if (nodesPicked && edgesPicked) {
pickedVertexState.clear();
pickedEdgeState.clear();
call(l -> l.pickingFinished());
} else if (nodesPicked) {
pickedVertexState.clear();
call(l -> l.nodePickingFinished());
} else if (edgesPicked) {
pickedEdgeState.clear();
call(l -> l.edgePickingFinished());
}
}
} else {
if ((vertex = getPickedNode(e)) != null) {
if (pickedVertexState.pick(vertex, !pickedVertexState.isPicked(vertex))) {
vertex = null;
}
call(l -> l.nodePickingFinished());
} else if ((edge = getPickedEdge(e)) != null) {
if (pickedEdgeState.pick(edge, !pickedEdgeState.isPicked(edge))) {
edge = null;
}
call(l -> l.edgePickingFinished());
}
}
}
}