本文整理汇总了Java中prefuse.util.GraphicsLib.expand方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsLib.expand方法的具体用法?Java GraphicsLib.expand怎么用?Java GraphicsLib.expand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类prefuse.util.GraphicsLib
的用法示例。
在下文中一共展示了GraphicsLib.expand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zoomToFit
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
/**
* Zooms to fit.
*/
public void zoomToFit() {
Visualization vis = display.getVisualization();
Rectangle2D bounds = vis.getBounds(Visualization.ALL_ITEMS);
GraphicsLib.expand(bounds, 50 + (int)(1/display.getScale()));
DisplayLib.fitViewToBounds(display, bounds, duration);
}
示例2: run
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
@Override
public void run( double frac )
{
int duration = 20;
int margin = 50;
Visualization vis = getVisualization();
Rectangle2D bounds = vis.getBounds( Visualization.ALL_ITEMS );
GraphicsLib.expand( bounds, margin + (int) ( 1 / getScale() ) );
DisplayLib.fitViewToBounds( TreeGraphDisplay.this, bounds, duration );
}
示例3: getZoomToFitAction
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
private Action getZoomToFitAction() {
return(new Action() {
@Override
public void run(double frac) {
Rectangle2D bounds = m_vis.getBounds(Visualization.ALL_ITEMS);
Display display = m_vis.getDisplay(0);
GraphicsLib.expand(bounds, 50 + (int)(1/display.getScale()));
DisplayLib.fitViewToBounds(display, bounds, 2000);
}
});
}
示例4: itemBoundsChanged
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
public void itemBoundsChanged(Display d) {
d.getItemBounds(m_temp);
GraphicsLib.expand(m_temp, 25/d.getScale());
double dd = m_d/d.getScale();
double xd = Math.abs(m_temp.getMinX()-m_bounds.getMinX());
double yd = Math.abs(m_temp.getMinY()-m_bounds.getMinY());
double wd = Math.abs(m_temp.getWidth()-m_bounds.getWidth());
double hd = Math.abs(m_temp.getHeight()-m_bounds.getHeight());
if ( xd>dd || yd>dd || wd>dd || hd>dd ) {
m_bounds.setFrame(m_temp);
DisplayLib.fitViewToBounds(d, m_bounds, 0);
}
}
示例5: onDoubleTap
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
@Override
public boolean onDoubleTap(MotionEvent e)
{
Visualization vis = display.getVisualization();
Rectangle2D bounds = vis.getBounds(m_group);
GraphicsLib.expand(bounds, m_margin + (int) (1 / display.getScale()));
DisplayLib.fitViewToBounds(display, bounds, m_duration);
display.invalidate();
return true;
}
示例6: zoomToFit
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
/**
* Zoom to fit.
*
* @param display
* the display
*/
private void zoomToFit(Display display) {
if (!display.isTranformInProgress()) {
Visualization vis = display.getVisualization();
Rectangle2D bounds = vis.getBounds(Visualization.ALL_ITEMS);
GraphicsLib.expand(bounds, 300 + (int) (1 / display.getScale()));
DisplayLib.fitViewToBounds(display, bounds, 1000);
m_vis.run("layout");
}
}
示例7: zoomToFit
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
/**
* Zoom to fit.
*
* @param display
* the display
*/
public void zoomToFit(Display display) {
if (!display.isTranformInProgress()) {
Visualization vis = display.getVisualization();
Rectangle2D bounds = vis.getBounds(Visualization.ALL_ITEMS);
GraphicsLib.expand(bounds, 300 + (int) (1 / display.getScale()));
DisplayLib.fitViewToBounds(display, bounds, 1000);
m_vis.run("layout");
}
}
示例8: mouseClicked
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
/**
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
*/
public void mouseClicked(MouseEvent e) {
Display display = (Display)e.getComponent();
if ( !display.isTranformInProgress() &&
e.getClickCount()==2 )
{
Visualization vis = display.getVisualization();
Rectangle2D bounds = vis.getBounds(m_group);
//System.out.println("ZTO: " + bounds.getHeight());
GraphicsLib.expand(bounds, m_margin + (int)(1/display.getScale()));
DisplayLib.fitViewToBounds(display, bounds, m_duration);
}
}
示例9: ZoomToFit
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
private void ZoomToFit() {
if (!display.isTranformInProgress()) {
long m_duration = 2000;
int m_margin = 50;
Visualization vis = display.getVisualization();
Rectangle2D bounds = vis.getBounds(Visualization.ALL_ITEMS);
GraphicsLib.expand(bounds, m_margin + (int) (1 / display.getScale()));
DisplayLib.fitViewToBounds(display, bounds, m_duration);
}
}
示例10: itemBoundsChanged
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
public void itemBoundsChanged(Display d) {
d.getItemBounds(m_temp);
GraphicsLib.expand(m_temp, 25/d.getScale());
double dd = m_d/d.getScale();
double xd = Math.abs(m_temp.getMinX()-m_bounds.getMinX());
double yd = Math.abs(m_temp.getMinY()-m_bounds.getMinY());
double wd = Math.abs(m_temp.getWidth()-m_bounds.getWidth());
double hd = Math.abs(m_temp.getHeight()-m_bounds.getHeight());
if ( xd>dd || yd>dd || wd>dd || hd>dd ) {
m_bounds.setFrame(m_temp);
DisplayLib.fitViewToBounds(d, m_bounds, 0);
}
}
示例11: centerGraph
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
public void centerGraph() {
synchronized (mVis) {
if (!isTranformInProgress()) {
Rectangle2D bounds = mVis.getBounds(Visualization.ALL_ITEMS);
GraphicsLib.expand(bounds, 50 + (int) (1 / getScale()));
DisplayLib.fitViewToBounds(this, bounds, 1000);
}
}
}
示例12: exportImage
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
private boolean exportImage(Display display, OutputStream output, String format) throws Exception {
String m_group = Visualization.ALL_ITEMS;
try {
display.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
// Now comes the nice part
// Get the bounding box
Rectangle2D bounds = display.getVisualization().getBounds(m_group);
// Some little extra spacing
GraphicsLib.expand(bounds, 10 + (int) (1 /* / display.getScale() */));
// Get a buffered image to draw into
BufferedImage img = getNewOffscreenBuffer(display, (int) (bounds.getWidth() * display.getScale()), (int) (bounds.getHeight() * display.getScale()));
Graphics2D g = (Graphics2D)img.getGraphics();
/*
* Set up the display, render, then revert to normal settings
*/
// The zoom point, zooming should not change anything else than the scale
// Point2D zoomPoint = new Point2D.Double(0, 0);
// Get and remember the current scaling
Double scale = display.getScale();
// Change scale to normal (1)
// display.zoom(zoomPoint, 1/scale);
boolean isHighQuality = display.isHighQuality();
display.setHighQuality(true);
// Remember the current point
Point2D currentPoint = new Point2D.Double(display.getDisplayX(), display.getDisplayY());
// Now pan so the most left element is at the left side of the display and
// the highest element is at the top.
display.panToAbs(new Point2D.Double(bounds.getMinX() + display.getWidth()/scale/2,
bounds.getMinY() + display.getHeight()/scale/2));
// Now lets prefuse to the actual painting
display.paintDisplay(g, new Dimension((int) (bounds.getWidth() * scale), (int) (bounds.getHeight() * scale)));
// Undo the panning, zooming and reset the quality mode
display.panToAbs(new Point2D.Double((currentPoint.getX() + display.getWidth()/2)/scale,
(currentPoint.getY() + display.getHeight()/2)/scale));
display.setHighQuality(isHighQuality);
// display.zoom(zoomPoint, scale); // also takes care of damage report
// Save the image and return
ImageIO.write(img, format, output);
return true;
} finally {
display.setCursor(Cursor.getDefaultCursor());
}
}
示例13: zoomToFit
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
public void zoomToFit() {
Rectangle2D bounds = m_vis.getBounds(Visualization.ALL_ITEMS);
Display display = m_vis.getDisplay(0);
GraphicsLib.expand(bounds, 50 + (int)(1/display.getScale()));
DisplayLib.fitViewToBounds(display, bounds, 1000);
}
示例14: zoomToFit
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
public void zoomToFit() {
Rectangle2D bounds = m_vis.getBounds(Visualization.ALL_ITEMS);
Display display = m_vis.getDisplay(0);
GraphicsLib.expand(bounds, 50 + (int)(1/display.getScale()));
DisplayLib.fitViewToBounds(display, bounds, 2000);
}
示例15: fitToBounds
import prefuse.util.GraphicsLib; //导入方法依赖的package包/类
/**
* Zooms in the view for the specified display so that the view encompasses all items
* in the specified group, with the given margin from the display's edges. Animated over
* the specified duration.
*
* @param display
* the display to zoom
* @param group
* the group of items to zoom in to
* @param margin
* the bounds that should be visible in the Display view
* @param duration
* the duration of an animated transition. A value of zero will result in an instantaneous change.
*/
public static void fitToBounds( Display display, String group, int margin, int duration )
{
Visualization vis = display.getVisualization();
Rectangle2D bounds = vis.getBounds( group );
GraphicsLib.expand( bounds, margin + (int)( 1 / display.getScale() ) );
DisplayLib.fitViewToBounds( display, bounds, duration );
}