本文整理汇总了Java中prefuse.util.GraphicsLib类的典型用法代码示例。如果您正苦于以下问题:Java GraphicsLib类的具体用法?Java GraphicsLib怎么用?Java GraphicsLib使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphicsLib类属于prefuse.util包,在下文中一共展示了GraphicsLib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import prefuse.util.GraphicsLib; //导入依赖的package包/类
/**
* @see prefuse.render.Renderer#render(java.awt.Graphics2D, prefuse.visual.VisualItem)
*/
public synchronized void render(AndroidGraphics2D g, VisualItem item) {
Shape s = getShape(item);
GraphicsLib.paint(g, item, m_line, getStroke(item), getRenderType(item));
// check if we have a text label, if so, render it
if ( item.canGetString(VisualItem.LABEL) ) {
float x = (float)m_box.getMinX();
float y = (float)m_box.getMinY() + m_ascent;
// draw label background
GraphicsLib.paint(g, item, s, null, RENDER_TYPE_FILL);
String str = item.getString(VisualItem.LABEL);
AffineTransform origTransform = g.getTransform();
AffineTransform transform = this.getTransform(item);
if ( transform != null ) g.setTransform(transform);
g.setFont(item.getFont());
g.setColor(ColorLib.getColor(item.getTextColor()));
g.drawString(str, x, y);
if ( transform != null ) g.setTransform(origTransform);
}
}
示例2: initializeWindowCharacteristics
import prefuse.util.GraphicsLib; //导入依赖的package包/类
/**
* This sets up various things about the window, including the size.
* TODO include the size in the constructor
*/
private void initializeWindowCharacteristics()
{
setBorder( BorderFactory.createEmptyBorder() );
// main display controls
addComponentListener(
new ComponentAdapter() {
public void componentResized( ComponentEvent e )
{
if ( !isTranformInProgress() ) {
int margin = 10;
Rectangle2D bounds = m_vis.getBounds( Visualization.ALL_ITEMS );
double barWidth = bounds.getWidth() / m_histoTable.getBinCount();
GraphicsLib.expand( bounds, margin + (int)( 1 / getScale() ) );
DisplayLib.fitViewToBounds( HistogramGraph.this, bounds, 0 );
setBarWidth( barWidth );
}
}
}
);
// addControlListener(new ZoomToFitControl());
setHighQuality( true );
initializeLayoutBoundsForDisplay();
m_shapeR.setBounds( m_dataB );
}
示例3: 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);
}
示例4: 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 );
}
示例5: 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);
}
});
}
示例6: 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);
}
}
示例7: getRawShape
import prefuse.util.GraphicsLib; //导入依赖的package包/类
/**
* @see prefuse.render.AbstractShapeRenderer#getRawShape(prefuse.visual.VisualItem)
*/
protected Shape getRawShape(VisualItem item) {
float[] poly = (float[])item.get(m_polyfield);
if ( poly == null ) { return null; }
float x = (float)item.getX();
float y = (float)item.getY();
// initialize the path
m_path.reset();
m_path.moveTo(x+poly[0],y+poly[1]);
if ( m_polyType == Constants.POLY_TYPE_LINE )
{
// create a polygon
for ( int i=2; i<poly.length; i+=2 ) {
if ( Float.isNaN(poly[i]) ) break;
m_path.lineTo(x+poly[i],y+poly[i+1]);
}
}
else if ( m_polyType == Constants.POLY_TYPE_CURVE )
{
// interpolate the polygon points with a cardinal spline
return GraphicsLib.cardinalSpline(m_path, poly,
m_slack, m_closed, x, y);
}
else if ( m_polyType == Constants.POLY_TYPE_STACK )
{
// used curved lines, except for non-sloping segments
return GraphicsLib.stackSpline(m_path, poly,
m_epsilon, m_slack, m_closed, x, y);
}
if ( m_closed ) m_path.closePath();
return m_path;
}
示例8: setBounds
import prefuse.util.GraphicsLib; //导入依赖的package包/类
/**
* @see prefuse.render.Renderer#setBounds(prefuse.visual.VisualItem)
*/
public void setBounds(VisualItem item) {
if ( !m_manageBounds ) return;
Shape shape = getShape(item);
if ( shape == null ) {
item.setBounds(item.getX(), item.getY(), 0, 0);
return;
}
GraphicsLib.setBounds(item, shape, getStroke(item));
if ( m_curArrow != null ) {
Rectangle2D bbox = (Rectangle2D)item.get(VisualItem.BOUNDS);
Rectangle2D.union(bbox, m_curArrow.getBounds2D(), bbox);
}
}
示例9: setBounds
import prefuse.util.GraphicsLib; //导入依赖的package包/类
/**
* @see prefuse.render.Renderer#setBounds(prefuse.visual.VisualItem)
*/
public void setBounds(VisualItem item) {
if ( !m_manageBounds ) return;
Shape shape = getShape(item);
if ( shape == null ) {
item.setBounds(item.getX(), item.getY(), 0, 0);
} else {
GraphicsLib.setBounds(item, shape, getStroke(item));
}
}
示例10: setBounds
import prefuse.util.GraphicsLib; //导入依赖的package包/类
/**
* @see prefuse.render.Renderer#setBounds(prefuse.visual.VisualItem)
*/
public void setBounds(VisualItem item) {
if ( !m_manageBounds ) return;
Shape shape = getShape(item);
if ( shape == null ) {
item.setBounds(item.getX(), item.getY(), 0, 0);
} else if ( shape == m_line ) {
GraphicsLib.setBounds(item, shape, getStroke(item));
} else {
m_box.add(m_line.getX1(),m_line.getY1());
m_box.add(m_line.getX2(),m_line.getY2());
item.setBounds(m_box.getMinX(), m_box.getMinY(),
m_box.getWidth(), m_box.getHeight());
}
}
示例11: 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;
}
示例12: 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");
}
}
示例13: 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");
}
}
示例14: 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);
}
}
示例15: 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);
}
}