本文整理汇总了Java中edu.uci.ics.jung.visualization.control.CrossoverScalingControl类的典型用法代码示例。如果您正苦于以下问题:Java CrossoverScalingControl类的具体用法?Java CrossoverScalingControl怎么用?Java CrossoverScalingControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CrossoverScalingControl类属于edu.uci.ics.jung.visualization.control包,在下文中一共展示了CrossoverScalingControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configVisualizationViewer
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
@Override
public void configVisualizationViewer(final LayerViewer<V, E> vv) {
PluggableGraphMouse mouse = new PluggableGraphMouse();
mouse.add(new ScalingGraphMousePlugin(
new CrossoverScalingControl(), Event.CTRL_MASK, 1 / 1.1f,
1.1f));
mouse.add(new PickingGraphMousePlugin<V, E>());
mouse.add(new MyEditingPopupGraphMousePlugin<T, V, E, N>(vv, scenario));
vv.setGraphMouse(mouse);
vv.getRenderContext().setVertexFillPaintTransformer(
new NodeFillPaintTransformer<V>(vv.getPickedVertexState()));
vv.setVertexToolTipTransformer(nodeTTT);
vv.getRenderContext().setVertexLabelTransformer(nodeLT);
vv.getRenderer().getVertexLabelRenderer()
.setPosition(Position.AUTO);
vv.setEdgeToolTipTransformer(linkTTT);
vv.getRenderContext().setEdgeLabelTransformer(linkLT);
vv.getRenderContext().getEdgeLabelRenderer()
.setRotateEdgeLabels(true);
vv.getRenderContext().setEdgeDrawPaintTransformer(
new LinkDrawPaintTransformer<E>(vv.getPickedEdgeState()));
}
示例2: prepareImage
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
private BufferedImage prepareImage() {
// Center layout
NetworkPanel.centerGraph(vv, network, layout, null);
// NetworkPanel.centerGraph(vv, network, layout, null);
// Scale to image size
ScalingControl scaler = new CrossoverScalingControl();
Point2D center = vv.getCenter();
float amount = getScaleFactor(dimensions.width, dimensions.height);
scaler.scale(vv, amount, center);
vv.repaint();
System.out.println("Painting");
BufferedImage img = new BufferedImage(dimensions.width,
dimensions.height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = img.createGraphics();
vv.paint(g);
g.dispose();
return img;
}
示例3: setUpView
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
private void setUpView(Graph graph)
{
// layout = new SpringLayout2(graph);
layout = new KKLayout(graph);
//layout.setSize(new Dimension(700,700));
vv = new VisualizationViewer(layout);
vv.setPreferredSize(new Dimension(900,900));
vv.setBackground( Color.white );
// Tell the renderer to use our own customized label rendering
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
getContentPane().add(new GraphZoomScrollPane(vv), BorderLayout.CENTER);
/*Mouse controller plugins*/
PluggableGraphMouse gm = new PluggableGraphMouse();
gm.add(new TranslatingGraphMousePlugin(MouseEvent.BUTTON3_MASK));
gm.add(new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, 1.1f, 0.9f));
gm.add(new PickingGraphMousePlugin());
vv.setGraphMouse(gm);
}
示例4: init
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void init() {
try {
this.chosenDate = new Date(0L);
this.entitySourceName = "";
this.sceneIds = new ArrayList();
this.involvedTags = new HashSet();
this.scaler = new CrossoverScalingControl();
try {
Internal internal = BookUtil.get(this.mainFrame, SbConstants.BookKey.MEMORIA_BALLOON, Boolean.valueOf(true));
this.showBalloonLayout = internal.getBooleanValue().booleanValue();
} catch (Exception exc) {
this.showBalloonLayout = true;
}
} catch (Exception exc2) {
SbApp.error("MemoriaPanel.init()",exc2);
}
}
示例5: configVisualizationViewer
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
@Override
public void configVisualizationViewer(final LayerViewer<V, E> vv) {
PluggableGraphMouse mouse = new PluggableGraphMouse();
mouse.add(new ScalingGraphMousePlugin(
new CrossoverScalingControl(), Event.CTRL_MASK, 1 / 1.1f,
1.1f));
mouse.add(new PickingGraphMousePlugin<V, E>());
mouse.add(new MyEditingPopupGraphMousePlugin<T, V, E, N>(vv));
vv.setGraphMouse(mouse);
vv.getRenderContext().setVertexFillPaintTransformer(
new NodeFillPaintTransformer<V>(vv.getPickedVertexState()));
vv.setVertexToolTipTransformer(nodeTTT);
vv.getRenderContext().setVertexLabelTransformer(nodeLT);
vv.getRenderer().getVertexLabelRenderer()
.setPosition(Position.AUTO);
vv.setEdgeToolTipTransformer(linkTTT);
vv.getRenderContext().setEdgeLabelTransformer(linkLT);
vv.getRenderContext().getEdgeLabelRenderer().setRotateEdgeLabels(
true);
vv.getRenderContext().setEdgeDrawPaintTransformer(
new LinkDrawPaintTransformer<E>(vv.getPickedEdgeState()));
}
示例6: loadPlugins
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
protected void loadPlugins() {
pickingPlugin = new HecataeusPickingGraphMousePlugin();
animatedPickingPlugin = new AnimatedPickingGraphMousePlugin<VisualNode,VisualEdge>();
// add an additional translating plugin
// for middle mouse button that is never removed by other modes
translatingPluginMiddleButton = new TranslatingGraphMousePlugin(InputEvent.BUTTON2_MASK);
popupEditingPlugin = new HecataeusPopupGraphMousePlugin();
translatingPlugin = new TranslatingGraphMousePlugin(InputEvent.BUTTON1_MASK);
scalingPlugin = new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, in, out);
rotatingPlugin = new RotatingGraphMousePlugin();
shearingPlugin = new ShearingGraphMousePlugin();
add(scalingPlugin);
add(translatingPluginMiddleButton);
add(popupEditingPlugin);
/** @author pmanousi changed from Mode.TRANSFORMING to Mode.PICKING */
setMode(Mode.PICKING);
}
示例7: autoZoomViewer
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
public static void autoZoomViewer(VisualizationViewer<?, ?> vv,
LayerViewer<?, ?> home, Directions direction) {
if (vv == null || home == null)
return;
// reset transforms
MutableTransformer layoutTrans = vv.getRenderContext()
.getMultiLayerTransformer()
.getTransformer(edu.uci.ics.jung.visualization.Layer.LAYOUT);
layoutTrans.setToIdentity();
MutableTransformer viewTrans = vv.getRenderContext()
.getMultiLayerTransformer()
.getTransformer(edu.uci.ics.jung.visualization.Layer.VIEW);
viewTrans.setToIdentity();
Dimension dim = vv.getSize();
Rectangle2D.Double graphBounds = home.getGraphBoundsCache();
CrossoverScalingControl scaler = new CrossoverScalingControl();
// Scale using crossover scaler, so vertices will not grow
// larger than they are in original
double factor = Double.POSITIVE_INFINITY;
if (direction == Directions.HORIZONTAL || direction == Directions.BOTH)
factor = dim.getWidth() / graphBounds.width;
if (direction == Directions.VERTICAL || direction == Directions.BOTH
|| Double.isInfinite(factor))
factor = Math.min(factor, dim.getHeight() / graphBounds.height);
scaler.scale(vv, (float) factor, vv.getCenter());
// Translate center of graph to center of vv.
Point2D lvc = vv.getRenderContext().getMultiLayerTransformer()
.inverseTransform(vv.getCenter());
double dx = (lvc.getX() - graphBounds.getCenterX());
double dy = (lvc.getY() - graphBounds.getCenterY());
layoutTrans.translate(dx, dy);
}
示例8: MyMouseContext
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
public MyMouseContext(GraphPanel<MyL, LayerViewer<MyV, MyE>> owner) {
super(owner);
mouse = new PluggableGraphMouse();
mouse.add(new ScalingGraphMousePlugin(
new CrossoverScalingControl(), Event.CTRL_MASK, 1 / 1.1f,
1.1f));
mouse.add(new PickingGraphMousePlugin<MyV, MyE>());
}
示例9: loadPlugins
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
@Override
protected void loadPlugins() {
super.loadPlugins();
remove(scalingPlugin);
scalingPlugin = new SatelliteScalingGraphMousePlugin(new CrossoverScalingControl(), 0, in, out);
add(scalingPlugin);
}
示例10: MapperEngine
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
public MapperEngine() {
graph = new SparseMultigraph<Room, Exit>();
mapperLayout = new MapperLayout( graph );
mapperLayout.setSize( new Dimension( 500, 500 ) ); //????
vv = new VisualizationViewer<Room, Exit>( mapperLayout );
pickedState = vv.getPickedVertexState();
pickedState.addItemListener( this );
vv.setPreferredSize( new Dimension( 500, 500 ) ); //????
RenderContext<Room, Exit> rc = vv.getRenderContext();
rc.setEdgeLabelTransformer( new ToStringLabeller<Exit>() );
rc.setEdgeLabelRenderer( new ExitLabelRenderer() );
rc.setEdgeShapeTransformer( new EdgeShape.QuadCurve<Room, Exit>() );
rc.setEdgeShapeTransformer( new EdgeShape.Wedge<Room, Exit>( 30 ) );
rc.setEdgeFillPaintTransformer( new ExitPaintTransformer( vv ) );
rc.setVertexShapeTransformer( new RoomShape( graph ) );
rc.setVertexIconTransformer( new RoomIconTransformer() );
vv.getRenderContext().setLabelOffset( 5 );
PluggableGraphMouse pgm = new PluggableGraphMouse();
pgm.add( new MapperPickingGraphMousePlugin<Room, Exit>( MouseEvent.BUTTON1_MASK, MouseEvent.BUTTON3_MASK ) );
pgm.add( new TranslatingGraphMousePlugin( MouseEvent.BUTTON1_MASK ) );
scaler = new ScalingGraphMousePlugin( new CrossoverScalingControl(), 0, 1 / 1.1f, 1.1f );
pgm.add( scaler );
mousePlugin = new MapperEditingGraphMousePlugin( this );
pgm.add( mousePlugin );
vv.setGraphMouse( pgm );
panel = new MapperPanel( this );
}
示例11: loadPlugins
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
/**
* Create and load the plugins to use.
*
*/
protected void loadPlugins() {
pickingPlugin = new ExtendedPickingGraphMousePlugin<V, E>();
pickingPlugin.setRectangleSelectionEnabled(false);
translatingPlugin = new TranslatingGraphMousePlugin(InputEvent.BUTTON1_MASK);
scalingPlugin = new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, in, out);
add(pickingPlugin);
add(translatingPlugin);
add(scalingPlugin);
}
示例12: zoomOutMenuItemActionPerformed
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
private void zoomOutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomOutMenuItemActionPerformed
if(newDataModel != null) {
PhyloTreeAnalyser activeWindow = (PhyloTreeAnalyser) extendDesk.getSelectedFrame();
List<DrawPhyloTreeGraph> list = activeWindow.getDrawedPhyloTreeList();
final ScalingControl scaler = new CrossoverScalingControl();
for( DrawPhyloTreeGraph ll: list) {
ll.getPhyloTreePanel().zoomOut();;
}
} else {
JOptionPane.showMessageDialog(this,
"You have to import at first PhyloXML- and MetaML-files!",
"Warning",
JOptionPane.WARNING_MESSAGE, new javax.swing.ImageIcon(getClass().getResource("/icons/alert_3_32x32.png")));
}
}
示例13: loadPlugins
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
/**
* create the plugins, and load the plugins for TRANSFORMING mode
*
*/
@Override
protected void loadPlugins() {
pickingPlugin = new PickingGraphMousePlugin<String,String>();
scalingPlugin = new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, in, out);
editingPlugin = new RoleGraphEditingPlugin();
add(scalingPlugin);
setMode(Mode.EDITING);
}
示例14: autoZoomViewer
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
public static void autoZoomViewer(VisualizationViewer<?, ?> vv,
LayerViewer<?, ?> home, Directions direction) {
if (vv == null || home == null)
return;
// reset transforms
MutableTransformer layoutTrans = vv.getRenderContext()
.getMultiLayerTransformer()
.getTransformer(edu.uci.ics.jung.visualization.Layer.LAYOUT);
layoutTrans.setToIdentity();
MutableTransformer viewTrans = vv.getRenderContext()
.getMultiLayerTransformer()
.getTransformer(edu.uci.ics.jung.visualization.Layer.VIEW);
viewTrans.setToIdentity();
Dimension dim = vv.getSize();
Rectangle2D.Double graphBounds = home.getGraphBoundsCache();
CrossoverScalingControl scaler = new CrossoverScalingControl();
// Scale using crossover scaler, so vertices will not grow
// larger than they are in original
double factor = Double.POSITIVE_INFINITY;
if (direction == Directions.HORIZONTAL || direction == Directions.BOTH)
factor = dim.getWidth() / graphBounds.width;
if (direction == Directions.VERTICAL || direction == Directions.BOTH
|| Double.isInfinite(factor))
factor = Math.min(factor, dim.getHeight() / graphBounds.height);
scaler.scale(vv, (float) factor, vv.getCenter());
// Translate center of graph to center of vv.
Point2D lvc = vv.getRenderContext().getMultiLayerTransformer()
.inverseTransform(vv.getCenter());
double dx = (lvc.getX() - graphBounds.getCenterX());
double dy = (lvc.getY() - graphBounds.getCenterY());
layoutTrans.translate(dx, dy);
}
示例15: MyMouseContext
import edu.uci.ics.jung.visualization.control.CrossoverScalingControl; //导入依赖的package包/类
public MyMouseContext(GraphPanel<MyL, LayerViewer<MyV, MyE>> owner) {
super(owner);
mouse = new PluggableGraphMouse();
mouse.add(new ScalingGraphMousePlugin(
new CrossoverScalingControl(), Event.CTRL_MASK, 1 / 1.1f,
1.1f));
mouse.add(new PickingGraphMousePlugin<MyV, MyE>());
}