Example usage for java.awt.geom Point2D setLocation

List of usage examples for java.awt.geom Point2D setLocation

Introduction

In this page you can find the example usage for java.awt.geom Point2D setLocation.

Prototype

public void setLocation(Point2D p) 

Source Link

Document

Sets the location of this Point2D to the same coordinates as the specified Point2D object.

Usage

From source file:edu.uci.ics.jung.algorithms.layout.AbstractLayout.java

public void setLocation(V picked, Point2D p) {
    Point2D coord = getCoordinates(picked);
    coord.setLocation(p);
}

From source file:lcmc.common.ui.ResourceGraph.java

/** Returns positions of the vertices (by value). */
final public void getPositions(final Map<String, Point2D> positions) {
    mGraphLock.lock();/* w  ww.j av a  2s .  c  o m*/
    try {
        for (final Vertex v : graph.getVertices()) {
            final Info info = getInfo(v);
            final Point2D p = new Point2D.Double();
            final Point2D loc = layout.transform(v);
            if (loc == null) {
                continue;
            }
            p.setLocation(loc);
            p.setLocation(p.getX() + (getDefaultVertexWidth(v) - getVertexWidth(v)) / 2,
                    p.getY() + (getDefaultVertexHeight(v) - getVertexHeight(v)) / 2);
            if (info != null) {
                final String id = getId(info);
                if (id != null) {
                    positions.put(id, p);
                }
            }
        }
    } finally {
        mGraphLock.unlock();
    }
}

From source file:lcmc.gui.ResourceGraph.java

/** Returns positions of the vertices (by value). */
final void getPositions(final Map<String, Point2D> positions) {
    mGraphLock.lock();// w w  w . ja  v a2 s.  c  o  m
    try {
        for (final Vertex v : graph.getVertices()) {
            final Info info = getInfo(v);
            final Point2D p = new Point2D.Double();
            final Point2D loc = layout.transform(v);
            if (loc == null) {
                continue;
            }
            p.setLocation(loc);
            p.setLocation(p.getX() + (getDefaultVertexWidth(v) - getVertexWidth(v)) / 2,
                    p.getY() + (getDefaultVertexHeight(v) - getVertexHeight(v)) / 2);
            if (info != null) {
                final String id = getId(info);
                if (id != null) {
                    positions.put(id, p);
                }
            }
        }
    } finally {
        mGraphLock.unlock();
    }
}