# Coverage details for edu.uci.ics.jung.visualization.VertexLocationUtils

Line | Hits | Source
--- | --- | ---
1 |  | `/*`
2 |  | `* Created on Jul 22, 2005`
3 |  | `*`
4 |  | `* Copyright (c) 2005, the JUNG Project and the Regents of the University`
5 |  | `* of California`
6 |  | `* All rights reserved.`
7 |  | `*`
8 |  | `* This software is open-source under the BSD license; see either`
9 |  | `* "license.txt" or`
10 |  | `* http://jung.sourceforge.net/license.txt for a description.`
11 |  | `*/`
12 |  | `package edu.uci.ics.jung.visualization;`
13 |  | ``
14 |  | `import java.awt.geom.AffineTransform;`
15 |  | `import java.awt.geom.Point2D;`
16 |  | `import java.util.Iterator;`
17 |  | ``
18 |  | `import edu.uci.ics.jung.graph.ArchetypeVertex;`
19 |  | ``
20 | 0 | `public class VertexLocationUtils`
21 |  | `{`
22 |  | `public static VertexLocationFunction scale(VertexLocationFunction vld, double dx, double dy)`
23 |  | `{`
24 | 0 | `SettableVertexLocationFunction out = new DefaultSettableVertexLocationFunction();`
25 |  | `// get the max x and max y locations`
26 | 0 | `double max_x = 0;`
27 | 0 | `double max_y = 0;`
28 | 0 | `for (Iterator iter = vld.getVertexIterator(); iter.hasNext(); )`
29 |  | `{`
30 | 0 | `ArchetypeVertex v = (ArchetypeVertex)iter.next();`
31 | 0 | `Point2D location = vld.getLocation(v);`
32 | 0 | `max_x = Math.max(max_x, location.getX());`
33 | 0 | `max_y = Math.max(max_y, location.getY());`
34 |  | `}`
35 | 0 | `AffineTransform at = AffineTransform.getScaleInstance(dx / max_x, dy / max_y);`
36 | 0 | `for (Iterator iter = vld.getVertexIterator(); iter.hasNext(); )`
37 |  | `{`
38 | 0 | `ArchetypeVertex v = (ArchetypeVertex)iter.next();`
39 | 0 | `Point2D location = vld.getLocation(v);`
40 | 0 | `Point2D new_location = new Point2D.Double();`
41 | 0 | `at.transform(location, new_location);`
42 | 0 | `out.setLocation(v, new_location);`
43 |  | `}`
44 | 0 | `return out;`
45 |  | `}`
46 |  | `}`

this report was generated by version 1.0.5 of jcoverage. visit www.jcoverage.com for updates. | copyright © 2003, jcoverage ltd. all rights reserved. Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.