本文整理汇总了Java中edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator类的典型用法代码示例。如果您正苦于以下问题:Java MutableTransformerDecorator类的具体用法?Java MutableTransformerDecorator怎么用?Java MutableTransformerDecorator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MutableTransformerDecorator类属于edu.uci.ics.jung.visualization.transform包,在下文中一共展示了MutableTransformerDecorator类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: vertexHit
import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
protected boolean vertexHit(RenderContext<V, E> rc, Shape s) {
JComponent vv = rc.getScreenDevice();
Rectangle deviceRectangle = null;
if (vv != null) {
Dimension d = vv.getSize();
deviceRectangle = new Rectangle(0, 0, d.width, d.height);
}
if (deviceRectangle != null) {
MutableTransformer vt = rc.getMultiLayerTransformer().getTransformer(Layer.VIEW);
if (vt instanceof MutableTransformerDecorator) {
vt = ((MutableTransformerDecorator) vt).getDelegate();
}
return vt.transform(s).intersects(deviceRectangle);
} else {
return false;
}
}
示例2: paint
import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
public void paint(Graphics g) {
g.setColor(Color.gray);
Graphics2D g2d = (Graphics2D)g;
Ellipse2D ellipse = new Ellipse2D.Double();
for(String v : layout.getGraph().getVertices()) {
Double radius = layout.getRadii().get(v);
if(radius == null) continue;
Point2D p = layout.transform(v);
ellipse.setFrame(-radius, -radius, 2*radius, 2*radius);
AffineTransform at = AffineTransform.getTranslateInstance(p.getX(), p.getY());
Shape shape = at.createTransformedShape(ellipse);
MutableTransformer viewTransformer =
vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
if(viewTransformer instanceof MutableTransformerDecorator) {
shape = vv.getRenderContext().getMultiLayerTransformer().transform(shape);
} else {
shape = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT,shape);
}
g2d.draw(shape);
}
}
示例3: vertexHit
import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
protected boolean vertexHit(RenderContext<V,E> rc, Shape s) {
JComponent vv = rc.getScreenDevice();
Rectangle deviceRectangle = null;
if(vv != null) {
Dimension d = vv.getSize();
deviceRectangle = new Rectangle(
0,0,
d.width,d.height);
}
if (deviceRectangle != null) {
MutableTransformer vt = rc.getMultiLayerTransformer().getTransformer(Layer.VIEW);
if(vt instanceof MutableTransformerDecorator) {
vt = ((MutableTransformerDecorator)vt).getDelegate();
}
return vt.transform(s).intersects(deviceRectangle);
} else {
return false;
}
}
示例4: paint
import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
public void paint(Graphics g) {
g.setColor(Color.gray);
Graphics2D g2d = (Graphics2D)g;
Ellipse2D ellipse = new Ellipse2D.Double();
for(DBCMVertex v : (Iterable<DBCMVertex>) layout.getGraph().getVertices()) {
Double radius = (Double) ((BalloonLayout)layout).getRadii().get(v);
if(radius == null) continue;
Point2D p = (Point2D) layout.transform(v);
ellipse.setFrame(-radius, -radius, 2*radius, 2*radius);
AffineTransform at = AffineTransform.getTranslateInstance(p.getX(), p.getY());
Shape shape = at.createTransformedShape(ellipse);
MutableTransformer viewTransformer =
vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
if(viewTransformer instanceof MutableTransformerDecorator) {
shape = vv.getRenderContext().getMultiLayerTransformer().transform(shape);
} else {
shape = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT,shape);
}
g2d.draw(shape);
}
}
示例5: paint
import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
/**
* Method paint. Paints the rings on the graph.
*
* @param g Graphics - the graphics to be painted.
*/
@Override
public void paint( Graphics g ) {
Collection<Double> depths = getDepths();
g.setColor( Color.gray );
Graphics2D g2d = (Graphics2D) g;
Point2D center = radialLayout.getCenter();
Ellipse2D ellipse = new Ellipse2D.Double();
for ( double d : depths ) {
ellipse.setFrameFromDiagonal( center.getX() - d, center.getY() - d,
center.getX() + d, center.getY() + d );
AffineTransform at = AffineTransform.getTranslateInstance( 0, 0 );
Shape shape = at.createTransformedShape( ellipse );
//Shape shape =
// vv.getRenderContext().getMultiLayerTransformer().transform(ellipse);
// vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).transform(ellipse);
MutableTransformer viewTransformer
= vv.getRenderContext().getMultiLayerTransformer().getTransformer( Layer.VIEW );
if ( viewTransformer instanceof MutableTransformerDecorator ) {
shape = vv.getRenderContext().getMultiLayerTransformer().transform( shape );
}
else {
shape = vv.getRenderContext().getMultiLayerTransformer().transform( Layer.LAYOUT, shape );
}
g2d.draw( shape );
}
}
示例6: paint
import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
/**
* Method paint. Paints the rings on the graph.
*
* @param g Graphics - the graphics to be painted.
*/
@Override
public void paint( Graphics g ) {
g.setColor( Color.gray );
Graphics2D g2d = (Graphics2D) g;
Ellipse2D ellipse = new Ellipse2D.Double();
for ( SEMOSSVertex v : layout.getGraph().getVertices() ) {
Double radius = layout.getRadii().get( v );
if ( radius == null ) {
continue;
}
Point2D p = layout.apply( v );
ellipse.setFrame( -radius, -radius, 2 * radius, 2 * radius );
AffineTransform at = AffineTransform.getTranslateInstance( p.getX(), p.getY() );
Shape shape = at.createTransformedShape( ellipse );
MutableTransformer viewTransformer
= vv.getRenderContext().getMultiLayerTransformer().getTransformer( Layer.VIEW );
if ( viewTransformer instanceof MutableTransformerDecorator ) {
shape = vv.getRenderContext().getMultiLayerTransformer().transform( shape );
}
else {
shape = vv.getRenderContext().getMultiLayerTransformer().transform( Layer.LAYOUT, shape );
}
g2d.draw( shape );
}
}
示例7: getVertices
import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
/**
* returns the vertices that are contained in the passed shape.
* The shape is in screen coordinates, and the graph vertices
* are transformed to screen coordinates before they are tested
* for inclusion
*/
public Collection<V> getVertices(Layout<V, E> layout, Shape rectangle) {
Set<V> pickedVertices = new HashSet<V>();
// remove the view transform from the rectangle
rectangle = ((MutableTransformerDecorator)vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)).getDelegate().inverseTransform(rectangle);
while(true) {
try {
for(V v : getFilteredVertices(layout)) {
Point2D p = layout.transform(v);
if(p == null) continue;
// get the shape
Shape shape = vv.getRenderContext().getVertexShapeTransformer().transform(v);
AffineTransform xform =
AffineTransform.getTranslateInstance(p.getX(), p.getY());
shape = xform.createTransformedShape(shape);
shape = vv.getRenderContext().getMultiLayerTransformer().transform(shape);
Rectangle2D bounds = shape.getBounds2D();
p.setLocation(bounds.getCenterX(),bounds.getCenterY());
if(rectangle.contains(p)) {
pickedVertices.add(v);
}
}
break;
} catch(ConcurrentModificationException cme) {}
}
return pickedVertices;
}
示例8: vertexHit
import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
protected boolean vertexHit(RenderContext<V,E> rc, Shape s) {
JComponent vv = rc.getScreenDevice();
Rectangle deviceRectangle = null;
if(vv != null) {
Dimension d = vv.getSize();
deviceRectangle = new Rectangle(
0,0,
d.width,d.height);
}
MutableTransformer vt = rc.getMultiLayerTransformer().getTransformer(Layer.VIEW);
if(vt instanceof MutableTransformerDecorator) {
vt = ((MutableTransformerDecorator)vt).getDelegate();
}
return vt.transform(s).intersects(deviceRectangle);
}
示例9: paint
import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
public void paint(Graphics g) {
getDepths();
g.setColor(Color.gray);
Graphics2D g2d = (Graphics2D)g;
Point2D center = radialLayout.getCenter();
Ellipse2D ellipse = new Ellipse2D.Double();
for(double d : depths) {
ellipse.setFrameFromDiagonal(center.getX()-d, center.getY()-d,
center.getX()+d, center.getY()+d);
AffineTransform at = AffineTransform.getTranslateInstance(0, 0);
Shape shape = at.createTransformedShape(ellipse);
//Shape shape =
// vv.getRenderContext().getMultiLayerTransformer().transform(ellipse);
// vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT).transform(ellipse);
MutableTransformer viewTransformer =
vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
if(viewTransformer instanceof MutableTransformerDecorator) {
shape = vv.getRenderContext().getMultiLayerTransformer().transform(shape);
} else {
shape = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT,shape);
}
g2d.draw(shape);
}
}
示例10: getVertex
import edu.uci.ics.jung.visualization.transform.MutableTransformerDecorator; //导入依赖的package包/类
/**
* Iterates over Vertices, checking to see if x,y is contained in the
* Vertex's Shape. If (x,y) is contained in more than one vertex, use
* the vertex whose center is closest to the pick point.
* @see edu.uci.ics.jung.visualization.picking.PickSupport#getVertex(double, double)
*/
public V getVertex(Layout<V, E> layout, double x, double y) {
V closest = null;
double minDistance = Double.MAX_VALUE;
Point2D ip = ((MutableTransformerDecorator)vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)).getDelegate().inverseTransform(new Point2D.Double(x,y));
x = ip.getX();
y = ip.getY();
while(true) {
try {
for(V v : getFilteredVertices(layout)) {
// get the shape
Shape shape = vv.getRenderContext().getVertexShapeTransformer().transform(v);
// transform the vertex location to screen coords
Point2D p = layout.transform(v);
if(p == null) continue;
AffineTransform xform =
AffineTransform.getTranslateInstance(p.getX(), p.getY());
shape = xform.createTransformedShape(shape);
// use the LAYOUT transform to move the shape center without
// modifying the actual shape
Point2D lp = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT, p);
AffineTransform xlate = AffineTransform.getTranslateInstance(
lp.getX()-p.getX(),lp.getY()-p.getY());
shape = xlate.createTransformedShape(shape);
// now use the VIEW transform to modify the actual shape
shape = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.VIEW, shape);
//vv.getRenderContext().getMultiLayerTransformer().transform(shape);
// see if this vertex center is closest to the pick point
// among any other containing vertices
if(shape.contains(x, y)) {
if(style == Style.LOWEST) {
// return the first match
return v;
} else if(style == Style.HIGHEST) {
// will return the last match
closest = v;
} else {
Rectangle2D bounds = shape.getBounds2D();
double dx = bounds.getCenterX() - x;
double dy = bounds.getCenterY() - y;
double dist = dx * dx + dy * dy;
if (dist < minDistance) {
minDistance = dist;
closest = v;
}
}
}
}
break;
} catch(ConcurrentModificationException cme) {}
}
return closest;
}