File |
Line |
edu/uci/ics/jung/visualization/transform/shape/HyperbolicShapeTransformer.java |
48 |
edu/uci/ics/jung/visualization/transform/shape/MagnifyShapeTransformer.java |
47 |
public MagnifyShapeTransformer(Component component, MutableTransformer delegate) {
super(component, delegate);
}
/**
* Transform the supplied shape with the overridden transform
* method so that the shape is distorted by the magnify
* transform.
* @param shape a shape to transform
* @return a GeneralPath for the transformed shape
*/
public Shape transform(Shape shape) {
return transform(shape, 0);
}
public Shape transform(Shape shape, float flatness) {
GeneralPath newPath = new GeneralPath();
float[] coords = new float[6];
PathIterator iterator = null;
if(flatness == 0) {
iterator = shape.getPathIterator(null);
} else {
iterator = shape.getPathIterator(null, flatness);
}
for( ;
iterator.isDone() == false;
iterator.next()) {
int type = iterator.currentSegment(coords);
switch(type) {
case PathIterator.SEG_MOVETO:
Point2D p = _transform(new Point2D.Float(coords[0], coords[1]));
newPath.moveTo((float)p.getX(), (float)p.getY());
break;
case PathIterator.SEG_LINETO:
p = _transform(new Point2D.Float(coords[0], coords[1]));
newPath.lineTo((float)p.getX(), (float) p.getY());
break;
case PathIterator.SEG_QUADTO:
p = _transform(new Point2D.Float(coords[0], coords[1]));
Point2D q = _transform(new Point2D.Float(coords[2], coords[3]));
newPath.quadTo((float)p.getX(), (float)p.getY(), (float)q.getX(), (float)q.getY());
break;
case PathIterator.SEG_CUBICTO:
p = _transform(new Point2D.Float(coords[0], coords[1]));
q = _transform(new Point2D.Float(coords[2], coords[3]));
Point2D r = _transform(new Point2D.Float(coords[4], coords[5]));
newPath.curveTo((float)p.getX(), (float)p.getY(),
(float)q.getX(), (float)q.getY(),
(float)r.getX(), (float)r.getY());
break;
case PathIterator.SEG_CLOSE:
newPath.closePath();
break;
}
}
return newPath;
}
public Shape inverseTransform(Shape shape) {
GeneralPath newPath = new GeneralPath();
float[] coords = new float[6];
for(PathIterator iterator=shape.getPathIterator(null);
iterator.isDone() == false;
iterator.next()) {
int type = iterator.currentSegment(coords);
switch(type) {
case PathIterator.SEG_MOVETO:
Point2D p = _inverseTransform(new Point2D.Float(coords[0], coords[1]));
newPath.moveTo((float)p.getX(), (float)p.getY());
break;
case PathIterator.SEG_LINETO:
p = _inverseTransform(new Point2D.Float(coords[0], coords[1]));
newPath.lineTo((float)p.getX(), (float) p.getY());
break;
case PathIterator.SEG_QUADTO:
p = _inverseTransform(new Point2D.Float(coords[0], coords[1]));
Point2D q = _inverseTransform(new Point2D.Float(coords[2], coords[3]));
newPath.quadTo((float)p.getX(), (float)p.getY(), (float)q.getX(), (float)q.getY());
break;
case PathIterator.SEG_CUBICTO:
p = _inverseTransform(new Point2D.Float(coords[0], coords[1]));
q = _inverseTransform(new Point2D.Float(coords[2], coords[3]));
Point2D r = _inverseTransform(new Point2D.Float(coords[4], coords[5]));
newPath.curveTo((float)p.getX(), (float)p.getY(),
(float)q.getX(), (float)q.getY(),
(float)r.getX(), (float)r.getY());
break;
case PathIterator.SEG_CLOSE:
newPath.closePath();
break;
}
}
return newPath;
}
/**
*
*/
private Point2D _transform(Point2D graphPoint) {
if(graphPoint == null) return null;
Point2D viewCenter = getViewCenter();
double viewRadius = getViewRadius();
double ratio = getRatio();
// transform the point from the graph to the view
Point2D viewPoint = graphPoint;
// delegate.transform(graphPoint);
// calculate point from center
double dx = viewPoint.getX() - viewCenter.getX();
double dy = viewPoint.getY() - viewCenter.getY();
// factor out ellipse
dx *= ratio;
Point2D pointFromCenter = new Point2D.Double(dx, dy);
PolarPoint polar = PolarPoint.cartesianToPolar(pointFromCenter);
double theta = polar.getTheta();
double radius = polar.getRadius();
if(radius > viewRadius) return viewPoint;
double mag = magnification;
|
File |
Line |
edu/uci/ics/jung/visualization/FourPassImageShaper.java |
49 |
edu/uci/ics/jung/visualization/PivotingImageShaper.java |
54 |
public static Shape getShape(String fileName) {
return getShape(fileName, Integer.MAX_VALUE);
}
public static Shape getShape(String fileName, int max) {
BufferedImage image = null;
try {
image = ImageIO.read(FourPassImageShaper.class.getResource(fileName));
} catch(IOException ex) {
ex.printStackTrace();
}
return getShape(image, max);
}
/**
* Given an image, possibly with a transparent background, return
* the Shape of the opaque part of the image
* @param image
* @return the Shape
*/
public static Shape getShape(Image image) {
return getShape(image, Integer.MAX_VALUE);
}
public static Shape getShape(Image image, int max) {
BufferedImage bi =
new BufferedImage(image.getWidth(null), image.getHeight(null),
BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.createGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
return getShape(bi, max);
}
/**
* Given an image, possibly with a transparent background, return
* the Shape of the opaque part of the image
* @param image
* @return the Shape
*/
public static Shape getShape(BufferedImage image, int max) {
float width = image.getWidth();
float height = image.getHeight();
if(width > max || height > max) {
BufferedImage smaller =
new BufferedImage(max, max, BufferedImage.TYPE_INT_ARGB);
Graphics g = smaller.createGraphics();
AffineTransform at = AffineTransform.getScaleInstance(max/width,max/height);
AffineTransform back = AffineTransform.getScaleInstance(width/max,height/max);
Graphics2D g2 = (Graphics2D)g;
g2.drawImage(image, at, null);
g2.dispose();
return back.createTransformedShape(getShape(smaller));
} else {
return getShape(image);
}
}
/**
* Given an image, possibly with a transparent background, return
* the Shape of the opaque part of the image
* @param image
* @return the Shape
*/
public static Shape getShape(BufferedImage image) {
|
File |
Line |
edu/uci/ics/jung/visualization/annotations/AnnotatingModalGraphMouse.java |
184 |
edu/uci/ics/jung/visualization/control/AbstractModalGraphMouse.java |
205 |
public JMenu getModeMenu() {
if(modeMenu == null) {
modeMenu = new JMenu();// {
Icon icon = BasicIconFactory.getMenuArrowIcon();
modeMenu.setIcon(BasicIconFactory.getMenuArrowIcon());
modeMenu.setPreferredSize(new Dimension(icon.getIconWidth()+10,
icon.getIconHeight()+10));
final JRadioButtonMenuItem transformingButton =
new JRadioButtonMenuItem(Mode.TRANSFORMING.toString());
transformingButton.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED) {
setMode(Mode.TRANSFORMING);
}
}});
final JRadioButtonMenuItem pickingButton =
new JRadioButtonMenuItem(Mode.PICKING.toString());
pickingButton.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED) {
setMode(Mode.PICKING);
}
}});
ButtonGroup radio = new ButtonGroup();
radio.add(transformingButton);
radio.add(pickingButton);
transformingButton.setSelected(true);
modeMenu.add(transformingButton);
modeMenu.add(pickingButton);
modeMenu.setToolTipText("Menu for setting Mouse Mode");
addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED) {
if(e.getItem() == Mode.TRANSFORMING) {
transformingButton.setSelected(true);
} else if(e.getItem() == Mode.PICKING) {
pickingButton.setSelected(true);
}
}
}});
}
return modeMenu;
}
/**
* add a listener for mode changes
*/
public void addItemListener(ItemListener aListener) {
|
File |
Line |
edu/uci/ics/jung/visualization/renderers/DefaultEdgeLabelRenderer.java |
119 |
edu/uci/ics/jung/visualization/renderers/DefaultVertexLabelRenderer.java |
100 |
if(isSelected) setForeground(pickedVertexLabelColor);
super.setBackground(vv.getBackground());
if(font != null) {
setFont(font);
} else {
setFont(vv.getFont());
}
setIcon(null);
setBorder(noFocusBorder);
setValue(value);
return this;
}
/*
* The following methods are overridden as a performance measure to
* to prune code-paths are often called in the case of renders
* but which we know are unnecessary. Great care should be taken
* when writing your own renderer to weigh the benefits and
* drawbacks of overriding methods like these.
*/
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public boolean isOpaque() {
Color back = getBackground();
Component p = getParent();
if (p != null) {
p = p.getParent();
}
boolean colorMatch = (back != null) && (p != null) &&
back.equals(p.getBackground()) &&
p.isOpaque();
return !colorMatch && super.isOpaque();
}
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public void validate() {}
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public void revalidate() {}
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public void repaint(long tm, int x, int y, int width, int height) {}
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public void repaint(Rectangle r) { }
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
// Strings get interned...
if (propertyName=="text") {
super.firePropertyChange(propertyName, oldValue, newValue);
}
}
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { }
/**
* Sets the <code>String</code> object for the cell being rendered to
* <code>value</code>.
*
* @param value the string value for this cell; if value is
* <code>null</code> it sets the text value to an empty string
* @see JLabel#setText
*
*/
protected void setValue(Object value) {
setText((value == null) ? "" : value.toString());
}
}
|
File |
Line |
edu/uci/ics/jung/visualization/picking/LayoutLensShapePickSupport.java |
168 |
edu/uci/ics/jung/visualization/picking/ViewLensShapePickSupport.java |
194 |
Point2D p2 = layout.transform(v2);
//vv.getRenderContext().getBasicTransformer().transform(layout.transform(v2));
if(p1 == null || p2 == null) continue;
float x1 = (float) p1.getX();
float y1 = (float) p1.getY();
float x2 = (float) p2.getX();
float y2 = (float) p2.getY();
// translate the edge to the starting vertex
AffineTransform xform = AffineTransform.getTranslateInstance(x1, y1);
Shape edgeShape =
vv.getRenderContext().getEdgeShapeTransformer().transform(Context.<Graph<V,E>,E>getInstance(vv.getGraphLayout().getGraph(),e));
if(isLoop) {
// make the loops proportional to the size of the vertex
Shape s2 = vv.getRenderContext().getVertexShapeTransformer().transform(v2);
Rectangle2D s2Bounds = s2.getBounds2D();
xform.scale(s2Bounds.getWidth(),s2Bounds.getHeight());
// move the loop so that the nadir is centered in the vertex
xform.translate(0, -edgeShape.getBounds2D().getHeight()/2);
} else {
float dx = x2 - x1;
float dy = y2 - y1;
// rotate the edge to the angle between the vertices
double theta = Math.atan2(dy,dx);
xform.rotate(theta);
// stretch the edge to span the distance between the vertices
float dist = (float) Math.sqrt(dx*dx + dy*dy);
xform.scale(dist, 1.0f);
}
// transform the edge to its location and dimensions
edgeShape = xform.createTransformedShape(edgeShape);
|
File |
Line |
edu/uci/ics/jung/visualization/picking/LayoutLensShapePickSupport.java |
170 |
edu/uci/ics/jung/visualization/picking/ShapePickSupport.java |
322 |
float x1 = (float) p1.getX();
float y1 = (float) p1.getY();
float x2 = (float) p2.getX();
float y2 = (float) p2.getY();
// translate the edge to the starting vertex
AffineTransform xform = AffineTransform.getTranslateInstance(x1, y1);
Shape edgeShape =
vv.getRenderContext().getEdgeShapeTransformer().transform(Context.<Graph<V,E>,E>getInstance(vv.getGraphLayout().getGraph(),e));
if(isLoop) {
// make the loops proportional to the size of the vertex
Shape s2 = vv.getRenderContext().getVertexShapeTransformer().transform(v2);
Rectangle2D s2Bounds = s2.getBounds2D();
xform.scale(s2Bounds.getWidth(),s2Bounds.getHeight());
// move the loop so that the nadir is centered in the vertex
xform.translate(0, -edgeShape.getBounds2D().getHeight()/2);
} else {
float dx = x2 - x1;
float dy = y2 - y1;
// rotate the edge to the angle between the vertices
double theta = Math.atan2(dy,dx);
xform.rotate(theta);
// stretch the edge to span the distance between the vertices
float dist = (float) Math.sqrt(dx*dx + dy*dy);
xform.scale(dist, 1.0f);
}
// transform the edge to its location and dimensions
edgeShape = xform.createTransformedShape(edgeShape);
|
File |
Line |
edu/uci/ics/jung/visualization/annotations/AnnotationRenderer.java |
102 |
edu/uci/ics/jung/visualization/renderers/DefaultVertexLabelRenderer.java |
107 |
setIcon(null);
setBorder(noFocusBorder);
setValue(value);
return this;
}
/*
* The following methods are overridden as a performance measure to
* to prune code-paths are often called in the case of renders
* but which we know are unnecessary. Great care should be taken
* when writing your own renderer to weigh the benefits and
* drawbacks of overriding methods like these.
*/
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public boolean isOpaque() {
Color back = getBackground();
Component p = getParent();
if (p != null) {
p = p.getParent();
}
boolean colorMatch = (back != null) && (p != null) &&
back.equals(p.getBackground()) &&
p.isOpaque();
return !colorMatch && super.isOpaque();
}
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public void validate() {}
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public void revalidate() {}
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public void repaint(long tm, int x, int y, int width, int height) {}
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public void repaint(Rectangle r) { }
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
// Strings get interned...
if (propertyName=="text") {
super.firePropertyChange(propertyName, oldValue, newValue);
}
}
/**
* Overridden for performance reasons.
* See the <a href="#override">Implementation Note</a>
* for more information.
*/
@Override
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { }
/**
* Sets the <code>String</code> object for the cell being rendered to
* <code>value</code>.
*
* @param value the string value for this cell; if value is
* <code>null</code> it sets the text value to an empty string
* @see JLabel#setText
*
*/
protected void setValue(Object value) {
setText((value == null) ? "" : value.toString());
}
}
|
File |
Line |
edu/uci/ics/jung/visualization/annotations/AnnotatingModalGraphMouse.java |
171 |
edu/uci/ics/jung/visualization/control/EditingModalGraphMouse.java |
165 |
modeBox = new JComboBox(new Mode[]{Mode.TRANSFORMING, Mode.PICKING, Mode.EDITING, Mode.ANNOTATING});
modeBox.addItemListener(getModeListener());
}
modeBox.setSelectedItem(mode);
return modeBox;
}
/**
* create (if necessary) and return a menu that will change
* the mode
* @return the menu
*/
@Override
public JMenu getModeMenu() {
if(modeMenu == null) {
modeMenu = new JMenu();// {
Icon icon = BasicIconFactory.getMenuArrowIcon();
modeMenu.setIcon(BasicIconFactory.getMenuArrowIcon());
modeMenu.setPreferredSize(new Dimension(icon.getIconWidth()+10,
icon.getIconHeight()+10));
final JRadioButtonMenuItem transformingButton =
new JRadioButtonMenuItem(Mode.TRANSFORMING.toString());
transformingButton.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED) {
setMode(Mode.TRANSFORMING);
}
}});
final JRadioButtonMenuItem pickingButton =
new JRadioButtonMenuItem(Mode.PICKING.toString());
pickingButton.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED) {
setMode(Mode.PICKING);
}
}});
|
File |
Line |
edu/uci/ics/jung/visualization/transform/HyperbolicTransformer.java |
63 |
edu/uci/ics/jung/visualization/transform/shape/HyperbolicShapeTransformer.java |
162 |
double dx = viewPoint.getX() - viewCenter.getX();
double dy = viewPoint.getY() - viewCenter.getY();
// factor out ellipse
dx *= ratio;
Point2D pointFromCenter = new Point2D.Double(dx, dy);
PolarPoint polar = PolarPoint.cartesianToPolar(pointFromCenter);
double theta = polar.getTheta();
double radius = polar.getRadius();
if(radius > viewRadius) return viewPoint;
double mag = Math.tan(Math.PI/2*magnification);
radius *= mag;
radius = Math.min(radius, viewRadius);
radius /= viewRadius;
radius *= Math.PI/2;
radius = Math.abs(Math.atan(radius));
radius *= viewRadius;
Point2D projectedPoint = PolarPoint.polarToCartesian(theta, radius);
projectedPoint.setLocation(projectedPoint.getX()/ratio, projectedPoint.getY());
Point2D translatedBack = new Point2D.Double(projectedPoint.getX()+viewCenter.getX(),
projectedPoint.getY()+viewCenter.getY());
return translatedBack;
}
|
File |
Line |
edu/uci/ics/jung/visualization/renderers/CenterEdgeArrowRenderingSupport.java |
27 |
edu/uci/ics/jung/visualization/renderers/CenterEdgeArrowRenderingSupport.java |
80 |
boolean passedGo) {
GeneralPath path = new GeneralPath(edgeShape);
float[] seg = new float[6];
Point2D p1=null;
Point2D p2=null;
AffineTransform at = new AffineTransform();
// count the segments.
int middleSegment = 0;
int current = 0;
for(PathIterator i=path.getPathIterator(null,1); !i.isDone(); i.next()) {
current++;
}
middleSegment = current/2;
// find the middle segment
current = 0;
for(PathIterator i=path.getPathIterator(null,1); !i.isDone(); i.next()) {
current++;
int ret = i.currentSegment(seg);
if(ret == PathIterator.SEG_MOVETO) {
p2 = new Point2D.Float(seg[0],seg[1]);
} else if(ret == PathIterator.SEG_LINETO) {
p1 = p2;
p2 = new Point2D.Float(seg[0],seg[1]);
}
if(current > middleSegment) { // done
at = getReverseArrowTransform(rc, new Line2D.Float(p1,p2),vertexShape);
|
File |
Line |
edu/uci/ics/jung/visualization/decorators/EdgeShape.java |
164 |
edu/uci/ics/jung/visualization/decorators/EdgeShape.java |
222 |
private static CubicCurve2D instance = new CubicCurve2D.Float();
protected EdgeIndexFunction<V,E> parallelEdgeIndexFunction;
@SuppressWarnings("unchecked")
public void setEdgeIndexFunction(EdgeIndexFunction<V,E> parallelEdgeIndexFunction) {
this.parallelEdgeIndexFunction = parallelEdgeIndexFunction;
loop.setEdgeIndexFunction(parallelEdgeIndexFunction);
}
/**
* @return the parallelEdgeIndexFunction
*/
public EdgeIndexFunction<V, E> getEdgeIndexFunction() {
return parallelEdgeIndexFunction;
}
/**
* Get the shape for this edge, returning either the
* shared instance or, in the case of self-loop edges, the
* Loop shared instance.
*/
@SuppressWarnings("unchecked")
public Shape transform(Context<Graph<V,E>,E> context) {
Graph<V,E> graph = context.graph;
E e = context.element;
Pair<V> endpoints = graph.getEndpoints(e);
if(endpoints != null) {
boolean isLoop = endpoints.getFirst().equals(endpoints.getSecond());
if (isLoop) {
return loop.transform(context);
}
}
int index = 1;
if(parallelEdgeIndexFunction != null) {
index = parallelEdgeIndexFunction.getIndex(graph, e);
}
float controlY = control_offset_increment
+ control_offset_increment * index;
instance.setCurve(0.0f, 0.0f, 0.33f, 2 * controlY, .66f, -controlY,
|
File |
Line |
edu/uci/ics/jung/visualization/renderers/BasicEdgeRenderer.java |
223 |
edu/uci/ics/jung/visualization/renderers/ReshapingEdgeRenderer.java |
159 |
edgeArrowRenderingSupport.getArrowTransform(rc, new GeneralPath(edgeShape), destVertexShape);
if(at == null) return;
Shape arrow = rc.getEdgeArrowTransformer().transform(Context.<Graph<V,E>,E>getInstance(graph, e));
arrow = at.createTransformedShape(arrow);
g.setPaint(rc.getArrowFillPaintTransformer().transform(e));
g.fill(arrow);
g.setPaint(rc.getArrowDrawPaintTransformer().transform(e));
g.draw(arrow);
}
if (graph.getEdgeType(e) == EdgeType.UNDIRECTED) {
Shape vertexShape =
rc.getVertexShapeTransformer().transform(graph.getEndpoints(e).getFirst());
xf = AffineTransform.getTranslateInstance(x1, y1);
vertexShape = xf.createTransformedShape(vertexShape);
arrowHit = rc.getMultiLayerTransformer().getTransformer(Layer.VIEW).transform(vertexShape).intersects(deviceRectangle);
if(arrowHit) {
AffineTransform at = edgeArrowRenderingSupport.getReverseArrowTransform(rc, new GeneralPath(edgeShape), vertexShape, !isLoop);
|
File |
Line |
edu/uci/ics/jung/visualization/decorators/EdgeShape.java |
102 |
edu/uci/ics/jung/visualization/decorators/EdgeShape.java |
222 |
private static QuadCurve2D instance = new QuadCurve2D.Float();
protected EdgeIndexFunction<V,E> parallelEdgeIndexFunction;
@SuppressWarnings("unchecked")
public void setEdgeIndexFunction(EdgeIndexFunction<V,E> parallelEdgeIndexFunction) {
this.parallelEdgeIndexFunction = parallelEdgeIndexFunction;
loop.setEdgeIndexFunction(parallelEdgeIndexFunction);
}
/**
* @return the parallelEdgeIndexFunction
*/
public EdgeIndexFunction<V, E> getEdgeIndexFunction() {
return parallelEdgeIndexFunction;
}
/**
* Get the shape for this edge, returning either the
* shared instance or, in the case of self-loop edges, the
* Loop shared instance.
*/
@SuppressWarnings("unchecked")
public Shape transform(Context<Graph<V,E>,E> context) {
Graph<V,E> graph = context.graph;
E e = context.element;
Pair<V> endpoints = graph.getEndpoints(e);
if(endpoints != null) {
boolean isLoop = endpoints.getFirst().equals(endpoints.getSecond());
if (isLoop) {
return loop.transform(context);
}
}
int index = 1;
if(parallelEdgeIndexFunction != null) {
index = parallelEdgeIndexFunction.getIndex(graph, e);
}
float controlY = control_offset_increment +
control_offset_increment * index;
instance.setCurve(0.0f, 0.0f, 0.5f, controlY, 1.0f, 0.0f);
|
File |
Line |
edu/uci/ics/jung/visualization/control/RotatingGraphMousePlugin.java |
99 |
edu/uci/ics/jung/visualization/control/ShearingGraphMousePlugin.java |
96 |
g.drawLine(right-2,bottom-5,right-4,bottom-7);
g.dispose();
cursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImage, new Point(), "RotateCursor");
}
/**
*
* @param e the event
*/
public void mousePressed(MouseEvent e) {
VisualizationViewer vv = (VisualizationViewer)e.getSource();
boolean accepted = checkModifiers(e);
down = e.getPoint();
if(accepted) {
vv.setCursor(cursor);
}
}
/**
*
*/
public void mouseReleased(MouseEvent e) {
VisualizationViewer vv = (VisualizationViewer)e.getSource();
down = null;
vv.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
/**
*
*
*
*
*/
public void mouseDragged(MouseEvent e) {
if(down == null) return;
VisualizationViewer vv = (VisualizationViewer)e.getSource();
boolean accepted = checkModifiers(e);
if(accepted) {
MutableTransformer modelTransformer =
vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
vv.setCursor(cursor);
Point2D q = down;
|
File |
Line |
edu/uci/ics/jung/visualization/picking/LayoutLensShapePickSupport.java |
199 |
edu/uci/ics/jung/visualization/picking/ViewLensShapePickSupport.java |
228 |
edgeShape = vv.getRenderContext().getMultiLayerTransformer().transform(edgeShape);
// because of the transform, the edgeShape is now a GeneralPath
// see if this edge is the closest of any that intersect
if(edgeShape.intersects(pickArea)) {
float cx=0;
float cy=0;
float[] f = new float[6];
PathIterator pi = new GeneralPath(edgeShape).getPathIterator(null);
if(pi.isDone()==false) {
pi.next();
pi.currentSegment(f);
cx = f[0];
cy = f[1];
if(pi.isDone()==false) {
pi.currentSegment(f);
cx = f[0];
cy = f[1];
}
}
float dx = (float) (cx - x);
float dy = (float) (cy - y);
float dist = dx * dx + dy * dy;
if (dist < minDistance) {
minDistance = dist;
closest = e;
}
}
}
break;
} catch(ConcurrentModificationException cme) {}
}
return closest;
}
}
|
File |
Line |
edu/uci/ics/jung/visualization/control/AbstractModalGraphMouse.java |
205 |
edu/uci/ics/jung/visualization/control/EditingModalGraphMouse.java |
178 |
public JMenu getModeMenu() {
if(modeMenu == null) {
modeMenu = new JMenu();// {
Icon icon = BasicIconFactory.getMenuArrowIcon();
modeMenu.setIcon(BasicIconFactory.getMenuArrowIcon());
modeMenu.setPreferredSize(new Dimension(icon.getIconWidth()+10,
icon.getIconHeight()+10));
final JRadioButtonMenuItem transformingButton =
new JRadioButtonMenuItem(Mode.TRANSFORMING.toString());
transformingButton.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED) {
setMode(Mode.TRANSFORMING);
}
}});
final JRadioButtonMenuItem pickingButton =
new JRadioButtonMenuItem(Mode.PICKING.toString());
pickingButton.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED) {
setMode(Mode.PICKING);
}
}});
|
File |
Line |
edu/uci/ics/jung/visualization/picking/LayoutLensShapePickSupport.java |
203 |
edu/uci/ics/jung/visualization/picking/ShapePickSupport.java |
273 |
if(edgeShape.intersects(pickArea)) {
float cx=0;
float cy=0;
float[] f = new float[6];
PathIterator pi = new GeneralPath(edgeShape).getPathIterator(null);
if(pi.isDone()==false) {
pi.next();
pi.currentSegment(f);
cx = f[0];
cy = f[1];
if(pi.isDone()==false) {
pi.currentSegment(f);
cx = f[0];
cy = f[1];
}
}
float dx = (float) (cx - x);
float dy = (float) (cy - y);
float dist = dx * dx + dy * dy;
if (dist < minDistance) {
minDistance = dist;
closest = e;
}
}
}
break;
} catch(ConcurrentModificationException cme) {}
}
return closest;
}
|
File |
Line |
edu/uci/ics/jung/visualization/transform/shape/HyperbolicShapeTransformer.java |
181 |
edu/uci/ics/jung/visualization/transform/shape/MagnifyShapeTransformer.java |
177 |
Point2D projectedPoint = PolarPoint.polarToCartesian(theta, radius);
projectedPoint.setLocation(projectedPoint.getX()/ratio, projectedPoint.getY());
Point2D translatedBack = new Point2D.Double(projectedPoint.getX()+viewCenter.getX(),
projectedPoint.getY()+viewCenter.getY());
return translatedBack;
}
/**
* override base class to un-project the fisheye effect
*/
private Point2D _inverseTransform(Point2D viewPoint) {
viewPoint = delegate.inverseTransform(viewPoint);
Point2D viewCenter = getViewCenter();
double viewRadius = getViewRadius();
double ratio = getRatio();
double dx = viewPoint.getX() - viewCenter.getX();
double dy = viewPoint.getY() - viewCenter.getY();
// factor out ellipse
dx *= ratio;
Point2D pointFromCenter = new Point2D.Double(dx, dy);
PolarPoint polar = PolarPoint.cartesianToPolar(pointFromCenter);
double radius = polar.getRadius();
if(radius > viewRadius) return viewPoint;
|
File |
Line |
edu/uci/ics/jung/visualization/renderers/BasicEdgeRenderer.java |
95 |
edu/uci/ics/jung/visualization/renderers/ReshapingEdgeRenderer.java |
81 |
boolean isLoop = v1.equals(v2);
Shape s2 = rc.getVertexShapeTransformer().transform(v2);
Shape edgeShape = rc.getEdgeShapeTransformer().transform(Context.<Graph<V,E>,E>getInstance(graph, e));
boolean edgeHit = true;
boolean arrowHit = true;
Rectangle deviceRectangle = null;
JComponent vv = rc.getScreenDevice();
if(vv != null) {
Dimension d = vv.getSize();
deviceRectangle = new Rectangle(0,0,d.width,d.height);
}
AffineTransform xform = AffineTransform.getTranslateInstance(x1, y1);
if(isLoop) {
// this is a self-loop. scale it is larger than the vertex
// it decorates and translate it so that its nadir is
// at the center of the vertex.
Rectangle2D s2Bounds = s2.getBounds2D();
xform.scale(s2Bounds.getWidth(),s2Bounds.getHeight());
xform.translate(0, -edgeShape.getBounds2D().getWidth()/2);
} else {
|
File |
Line |
edu/uci/ics/jung/visualization/transform/AffineTransformer.java |
179 |
edu/uci/ics/jung/visualization/transform/shape/HyperbolicShapeTransformer.java |
95 |
Point2D r = _transform(new Point2D.Float(coords[4], coords[5]));
newPath.curveTo((float)p.getX(), (float)p.getY(),
(float)q.getX(), (float)q.getY(),
(float)r.getX(), (float)r.getY());
break;
case PathIterator.SEG_CLOSE:
newPath.closePath();
break;
}
}
return newPath;
}
public Shape inverseTransform(Shape shape) {
GeneralPath newPath = new GeneralPath();
float[] coords = new float[6];
for(PathIterator iterator=shape.getPathIterator(null);
iterator.isDone() == false;
iterator.next()) {
int type = iterator.currentSegment(coords);
switch(type) {
case PathIterator.SEG_MOVETO:
Point2D p = _inverseTransform(new Point2D.Float(coords[0], coords[1]));
|
File |
Line |
edu/uci/ics/jung/visualization/transform/HyperbolicTransformer.java |
82 |
edu/uci/ics/jung/visualization/transform/MagnifyTransformer.java |
77 |
Point2D projectedPoint = PolarPoint.polarToCartesian(theta, radius);
projectedPoint.setLocation(projectedPoint.getX()/ratio, projectedPoint.getY());
Point2D translatedBack = new Point2D.Double(projectedPoint.getX()+viewCenter.getX(),
projectedPoint.getY()+viewCenter.getY());
return translatedBack;
}
/**
* override base class to un-project the fisheye effect
*/
public Point2D inverseTransform(Point2D viewPoint) {
Point2D viewCenter = getViewCenter();
double viewRadius = getViewRadius();
double ratio = getRatio();
double dx = viewPoint.getX() - viewCenter.getX();
double dy = viewPoint.getY() - viewCenter.getY();
// factor out ellipse
dx *= ratio;
Point2D pointFromCenter = new Point2D.Double(dx, dy);
PolarPoint polar = PolarPoint.cartesianToPolar(pointFromCenter);
double radius = polar.getRadius();
if(radius > viewRadius) return delegate.inverseTransform(viewPoint);
|
File |
Line |
edu/uci/ics/jung/visualization/control/RotatingGraphMousePlugin.java |
71 |
edu/uci/ics/jung/visualization/control/RotatingGraphMousePlugin.java |
87 |
g.setStroke(new BasicStroke(1));
// top bent line
g.drawLine(left+2,top+6,right/2+1,top);
g.drawLine(right/2+1,top,right-2,top+5);
// bottom bent line
g.drawLine(left+2,bottom-6,right/2,bottom);
g.drawLine(right/2,bottom,right-2,bottom-6);
// top arrow
g.drawLine(left+2,top+6,left+5,top+6);
g.drawLine(left+2,top+6,left+2,top+3);
// bottom arrow
g.drawLine(right-2,bottom-6,right-6,bottom-6);
g.drawLine(right-2, bottom-6,right-2,bottom-3);
g.dispose();
|
File |
Line |
edu/uci/ics/jung/visualization/transform/MagnifyTransformer.java |
62 |
edu/uci/ics/jung/visualization/transform/shape/MagnifyShapeTransformer.java |
162 |
double dx = viewPoint.getX() - viewCenter.getX();
double dy = viewPoint.getY() - viewCenter.getY();
// factor out ellipse
dx *= ratio;
Point2D pointFromCenter = new Point2D.Double(dx, dy);
PolarPoint polar = PolarPoint.cartesianToPolar(pointFromCenter);
double theta = polar.getTheta();
double radius = polar.getRadius();
if(radius > viewRadius) return viewPoint;
double mag = magnification;
radius *= mag;
radius = Math.min(radius, viewRadius);
Point2D projectedPoint = PolarPoint.polarToCartesian(theta, radius);
projectedPoint.setLocation(projectedPoint.getX()/ratio, projectedPoint.getY());
Point2D translatedBack = new Point2D.Double(projectedPoint.getX()+viewCenter.getX(),
projectedPoint.getY()+viewCenter.getY());
return translatedBack;
}
|
File |
Line |
edu/uci/ics/jung/visualization/decorators/EdgeShape.java |
301 |
edu/uci/ics/jung/visualization/decorators/EdgeShape.java |
390 |
private static Rectangle2D instance = new Rectangle2D.Float();
protected EdgeIndexFunction<V,E> parallelEdgeIndexFunction;
public void setEdgeIndexFunction(EdgeIndexFunction<V,E> parallelEdgeIndexFunction) {
this.parallelEdgeIndexFunction = parallelEdgeIndexFunction;
}
/**
* @return the parallelEdgeIndexFunction
*/
public EdgeIndexFunction<V, E> getEdgeIndexFunction() {
return parallelEdgeIndexFunction;
}
/**
* Get the shape for this edge, modifying the diameter in the
* case of parallel edges, so they do not overlap
*/
public Shape transform(Context<Graph<V,E>,E> context) {
Graph<V,E> graph = context.graph;
E e = context.element;
int count = 1;
if(parallelEdgeIndexFunction != null) {
count = parallelEdgeIndexFunction.getIndex(graph, e);
}
float x = -.5f;
float y = -.5f;
float diam = 1.f;
diam += diam*count/2;
x += x*count/2;
y += y*count/2;
instance.setFrame(x,y,diam,diam);
return instance;
}
}
/**
* An edge shape that renders as a bent-line between the
* vertex endpoints.
*/
public static class Orthogonal<V,E>
|
File |
Line |
edu/uci/ics/jung/visualization/picking/LayoutLensShapePickSupport.java |
133 |
edu/uci/ics/jung/visualization/picking/ShapePickSupport.java |
236 |
if(shape.contains(p)) {
pickedVertices.add(v);
}
}
break;
} catch(ConcurrentModificationException cme) {}
}
return pickedVertices;
}
/**
* Returns an edge whose shape intersects the 'pickArea' footprint of the passed
* x,y, coordinates.
*/
public E getEdge(Layout<V, E> layout, double x, double y) {
Point2D ip = vv.getRenderContext().getMultiLayerTransformer().inverseTransform(Layer.VIEW, new Point2D.Double(x,y));
x = ip.getX();
y = ip.getY();
// as a Line has no area, we can't always use edgeshape.contains(point) so we
// make a small rectangular pickArea around the point and check if the
// edgeshape.intersects(pickArea)
Rectangle2D pickArea =
new Rectangle2D.Float((float)x-pickSize/2,(float)y-pickSize/2,pickSize,pickSize);
E closest = null;
double minDistance = Double.MAX_VALUE;
while(true) {
try {
for(E e : getFilteredEdges(layout)) {
|
File |
Line |
edu/uci/ics/jung/visualization/util/VertexShapeFactory.java |
133 |
edu/uci/ics/jung/visualization/util/VertexShapeFactory.java |
186 |
prev = thePolygon.getCurrentPoint();
thePolygon.lineTo((float)prev.getX() + delta_x, (float)prev.getY() + delta_y);
}
thePolygon.closePath();
// scale polygon to be right size, translate to center at (0,0)
Rectangle2D r = thePolygon.getBounds2D();
double scale_x = width / r.getWidth();
double scale_y = height / r.getHeight();
float translationX = (float) (r.getMinX() + r.getWidth()/2);
float translationY = (float) (r.getMinY() + r.getHeight()/2);
AffineTransform at = AffineTransform.getScaleInstance(scale_x, scale_y);
at.translate(-translationX, -translationY);
Shape shape = at.createTransformedShape(thePolygon);
return shape;
}
|
File |
Line |
edu/uci/ics/jung/visualization/picking/LayoutLensShapePickSupport.java |
87 |
edu/uci/ics/jung/visualization/picking/ViewLensShapePickSupport.java |
99 |
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;
}
/**
* 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>();
|
File |
Line |
edu/uci/ics/jung/visualization/renderers/BasicEdgeRenderer.java |
80 |
edu/uci/ics/jung/visualization/renderers/ReshapingEdgeRenderer.java |
57 |
TransformingGraphics g = (TransformingGraphics)rc.getGraphicsContext();
Graph<V,E> graph = layout.getGraph();
Pair<V> endpoints = graph.getEndpoints(e);
V v1 = endpoints.getFirst();
V v2 = endpoints.getSecond();
Point2D p1 = layout.transform(v1);
Point2D p2 = layout.transform(v2);
p1 = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, p1);
p2 = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, p2);
float x1 = (float) p1.getX();
float y1 = (float) p1.getY();
float x2 = (float) p2.getX();
float y2 = (float) p2.getY();
|
File |
Line |
edu/uci/ics/jung/visualization/renderers/BasicVertexLabelRenderer.java |
56 |
edu/uci/ics/jung/visualization/renderers/VertexLabelAsShapeRenderer.java |
48 |
}
public Component prepareRenderer(RenderContext<V,E> rc, VertexLabelRenderer graphLabelRenderer, Object value,
boolean isSelected, V vertex) {
return rc.getVertexLabelRenderer().<V>getVertexLabelRendererComponent(rc.getScreenDevice(), value,
rc.getVertexFontTransformer().transform(vertex), isSelected, vertex);
}
/**
* Labels the specified vertex with the specified label.
* Uses the font specified by this instance's
* <code>VertexFontFunction</code>. (If the font is unspecified, the existing
* font for the graphics context is used.) If vertex label centering
* is active, the label is centered on the position of the vertex; otherwise
* the label is offset slightly.
*/
public void labelVertex(RenderContext<V,E> rc, Layout<V,E> layout, V v, String label) {
Graph<V,E> graph = layout.getGraph();
if (rc.getVertexIncludePredicate().evaluate(Context.<Graph<V,E>,V>getInstance(graph,v)) == false) {
return;
}
|
File |
Line |
edu/uci/ics/jung/visualization/transform/shape/MagnifyImageLensSupport.java |
76 |
edu/uci/ics/jung/visualization/transform/shape/ViewLensSupport.java |
56 |
this.reshapingEdgeRenderer.setEdgeArrowRenderingSupport(savedEdgeRenderer.getEdgeArrowRenderingSupport());
}
public void activate() {
lensTransformer.setDelegate(vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW));
if(lens == null) {
lens = new Lens(lensTransformer);
}
if(lensControls == null) {
lensControls = new LensControls(lensTransformer);
}
renderContext.setPickSupport(new ViewLensShapePickSupport<V,E>(vv));
lensTransformer.setDelegate(vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW));
vv.getRenderContext().getMultiLayerTransformer().setTransformer(Layer.VIEW, lensTransformer);
this.renderContext.setGraphicsContext(lensGraphicsDecorator);
vv.getRenderer().setEdgeRenderer(reshapingEdgeRenderer);
vv.prependPreRenderPaintable(lens);
|
File |
Line |
edu/uci/ics/jung/visualization/renderers/BasicEdgeArrowRenderingSupport.java |
26 |
edu/uci/ics/jung/visualization/renderers/BasicEdgeArrowRenderingSupport.java |
61 |
boolean passedGo) {
GeneralPath path = new GeneralPath(edgeShape);
float[] seg = new float[6];
Point2D p1=null;
Point2D p2=null;
AffineTransform at = new AffineTransform();
for(PathIterator i=path.getPathIterator(null,1); !i.isDone(); i.next()) {
int ret = i.currentSegment(seg);
if(ret == PathIterator.SEG_MOVETO) {
p2 = new Point2D.Float(seg[0],seg[1]);
} else if(ret == PathIterator.SEG_LINETO) {
p1 = p2;
p2 = new Point2D.Float(seg[0],seg[1]);
if(passedGo == false && vertexShape.contains(p2)) {
|
File |
Line |
edu/uci/ics/jung/visualization/picking/LayoutLensShapePickSupport.java |
148 |
edu/uci/ics/jung/visualization/picking/ViewLensShapePickSupport.java |
173 |
Point2D ip = ((MutableTransformerDecorator)vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)).getDelegate().inverseTransform(new Point2D.Double(x,y));
x = ip.getX();
y = ip.getY();
// as a Line has no area, we can't always use edgeshape.contains(point) so we
// make a small rectangular pickArea around the point and check if the
// edgeshape.intersects(pickArea)
Rectangle2D pickArea =
new Rectangle2D.Float((float)x-pickSize/2,(float)y-pickSize/2,pickSize,pickSize);
E closest = null;
double minDistance = Double.MAX_VALUE;
while(true) {
try {
for(E e : getFilteredEdges(layout)) {
Pair<V> pair = layout.getGraph().getEndpoints(e);
V v1 = pair.getFirst();
V v2 = pair.getSecond();
boolean isLoop = v1.equals(v2);
Point2D p1 = layout.transform(v1);
|
File |
Line |
edu/uci/ics/jung/visualization/control/ShearingGraphMousePlugin.java |
81 |
edu/uci/ics/jung/visualization/control/ShearingGraphMousePlugin.java |
90 |
g2.setStroke(new BasicStroke(1));
g.drawLine(left+2,top+5,right-2,top+5);
g.drawLine(left+2,bottom-5,right-2,bottom-5);
g.drawLine(left+2,top+5,left+4,top+3);
g.drawLine(left+2,top+5,left+4,top+7);
g.drawLine(right-2,bottom-5,right-4,bottom-3);
g.drawLine(right-2,bottom-5,right-4,bottom-7);
g.dispose();
|
File |
Line |
edu/uci/ics/jung/visualization/transform/HyperbolicTransformer.java |
50 |
edu/uci/ics/jung/visualization/transform/MagnifyTransformer.java |
49 |
}
/**
* override base class transform to project the fisheye effect
*/
public Point2D transform(Point2D graphPoint) {
if(graphPoint == null) return null;
Point2D viewCenter = getViewCenter();
double viewRadius = getViewRadius();
double ratio = getRatio();
// transform the point from the graph to the view
Point2D viewPoint = delegate.transform(graphPoint);
// calculate point from center
double dx = viewPoint.getX() - viewCenter.getX();
double dy = viewPoint.getY() - viewCenter.getY();
// factor out ellipse
dx *= ratio;
Point2D pointFromCenter = new Point2D.Double(dx, dy);
PolarPoint polar = PolarPoint.cartesianToPolar(pointFromCenter);
double theta = polar.getTheta();
double radius = polar.getRadius();
if(radius > viewRadius) return viewPoint;
double mag = magnification;
|
File |
Line |
edu/uci/ics/jung/visualization/FourPassImageShaper.java |
119 |
edu/uci/ics/jung/visualization/PivotingImageShaper.java |
120 |
}
private static Point2D detectLine(Point2D p1, Point2D p2, Point2D p,
Line2D line, GeneralPath path) {
if(p2 == null) {
p2 = p;
line.setLine(p1,p2);
}
// check for line
else if(line.ptLineDistSq(p) < 1) { // its on the line
// make it p2
p2.setLocation(p);
} else { // its not on the current line
p1.setLocation(p2);
p2.setLocation(p);
line.setLine(p1,p2);
path.lineTo((float)p1.getX(), (float)p1.getY());
}
return p2;
}
/**
* trace the left side of the image
* @param image
* @param path
* @return
*/
private static Shape leftEdge(BufferedImage image, GeneralPath path) {
|
File |
Line |
edu/uci/ics/jung/visualization/renderers/BasicEdgeArrowRenderingSupport.java |
196 |
edu/uci/ics/jung/visualization/renderers/CenterEdgeArrowRenderingSupport.java |
158 |
}
/**
* divide a Line2D into 2 new Line2Ds that are returned
* in the passed left and right instances, if non-null
* @param src the line to divide
* @param left the left side, or null
* @param right the right side, or null
*/
protected void subdivide(Line2D src,
Line2D left,
Line2D right) {
double x1 = src.getX1();
double y1 = src.getY1();
double x2 = src.getX2();
double y2 = src.getY2();
double mx = x1 + (x2-x1)/2.0;
double my = y1 + (y2-y1)/2.0;
if (left != null) {
left.setLine(x1, y1, mx, my);
}
if (right != null) {
right.setLine(mx, my, x2, y2);
}
}
}
|
File |
Line |
edu/uci/ics/jung/visualization/annotations/AnnotatingModalGraphMouse.java |
244 |
edu/uci/ics/jung/visualization/control/EditingModalGraphMouse.java |
253 |
this.a = a;
this.graphMouse = graphMouse;
}
@Override
public void keyTyped(KeyEvent event) {
char keyChar = event.getKeyChar();
if(keyChar == t) {
((Component)event.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
graphMouse.setMode(Mode.TRANSFORMING);
} else if(keyChar == p) {
((Component)event.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
graphMouse.setMode(Mode.PICKING);
} else if(keyChar == e) {
|
File |
Line |
edu/uci/ics/jung/visualization/transform/HyperbolicTransformer.java |
109 |
edu/uci/ics/jung/visualization/transform/shape/HyperbolicShapeTransformer.java |
209 |
radius /= viewRadius;
radius = Math.abs(Math.tan(radius));
radius /= Math.PI/2;
radius *= viewRadius;
double mag = Math.tan(Math.PI/2*magnification);
radius /= mag;
polar.setRadius(radius);
Point2D projectedPoint = PolarPoint.polarToCartesian(polar);
projectedPoint.setLocation(projectedPoint.getX()/ratio, projectedPoint.getY());
Point2D translatedBack = new Point2D.Double(projectedPoint.getX()+viewCenter.getX(),
projectedPoint.getY()+viewCenter.getY());
return translatedBack;
|
File |
Line |
edu/uci/ics/jung/visualization/picking/LayoutLensShapePickSupport.java |
161 |
edu/uci/ics/jung/visualization/picking/ShapePickSupport.java |
313 |
private Shape getTransformedEdgeShape(Layout<V, E> layout, E e) {
Pair<V> pair = layout.getGraph().getEndpoints(e);
V v1 = pair.getFirst();
V v2 = pair.getSecond();
boolean isLoop = v1.equals(v2);
Point2D p1 = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT, layout.transform(v1));
Point2D p2 = vv.getRenderContext().getMultiLayerTransformer().transform(Layer.LAYOUT, layout.transform(v2));
if(p1 == null || p2 == null)
|
File |
Line |
edu/uci/ics/jung/visualization/control/SatelliteShearingGraphMousePlugin.java |
52 |
edu/uci/ics/jung/visualization/control/ShearingGraphMousePlugin.java |
136 |
vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
vv.setCursor(cursor);
Point2D q = down;
Point2D p = e.getPoint();
float dx = (float) (p.getX()-q.getX());
float dy = (float) (p.getY()-q.getY());
Dimension d = vv.getSize();
float shx = 2.f*dx/d.height;
float shy = 2.f*dy/d.width;
Point2D center = vv.getCenter();
|
File |
Line |
edu/uci/ics/jung/visualization/annotations/AnnotatingModalGraphMouse.java |
245 |
edu/uci/ics/jung/visualization/control/DefaultModalGraphMouse.java |
94 |
this.graphMouse = graphMouse;
}
@Override
public void keyTyped(KeyEvent event) {
char keyChar = event.getKeyChar();
if(keyChar == t) {
((Component)event.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
graphMouse.setMode(Mode.TRANSFORMING);
} else if(keyChar == p) {
((Component)event.getSource()).setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
graphMouse.setMode(Mode.PICKING);
}
|