# Coverage details for edu.uci.ics.jung.visualization.control.AbsoluteCrossoverScalingControl

Line | Hits | Source
--- | --- | ---
1 |  | `/*`
2 |  | `* Copyright (c) 2003, the JUNG Project and the Regents of the University of`
3 |  | `* California All rights reserved.`
4 |  | `*`
5 |  | `* This software is open-source under the BSD license; see either "license.txt"`
6 |  | `* or http://jung.sourceforge.net/license.txt for a description.`
7 |  | `*`
8 |  | `*/`
9 |  | `package edu.uci.ics.jung.visualization.control;`
10 |  | ``
11 |  | `import java.awt.geom.Point2D;`
12 |  | ``
13 |  | `import edu.uci.ics.jung.visualization.VisualizationViewer;`
14 |  | `import edu.uci.ics.jung.visualization.transform.MutableTransformer;`
15 |  | ``
16 |  | `/**`
17 |  | `* scales to the absolute value passed as an argument.`
18 |  | `* It first resets the scaling transformers, then uses`
19 |  | `* the relative CrossoverScalingControl to achieve the`
20 |  | `* abolute value.`
21 |  | `*`
22 |  | `* @author Tom Nelson - RABA Technologies`
23 |  | `*`
24 |  | `*/`
25 | 0 | `public class AbsoluteCrossoverScalingControl extends CrossoverScalingControl`
26 |  | `implements ScalingControl {`
27 |  | ``
28 |  | `/**`
29 |  | `* scale to the absolute value passed as 'amount'.`
30 |  | `*`
31 |  | `*/`
32 |  | `public void scale(VisualizationViewer vv, float amount, Point2D at) {`
33 | 0 | `MutableTransformer layoutTransformer = vv.getLayoutTransformer();`
34 | 0 | `MutableTransformer viewTransformer = vv.getViewTransformer();`
35 | 0 | `double modelScale = layoutTransformer.getScale();`
36 | 0 | `double viewScale = viewTransformer.getScale();`
37 | 0 | `double inverseModelScale = Math.sqrt(crossover)/modelScale;`
38 | 0 | `double inverseViewScale = Math.sqrt(crossover)/viewScale;`
39 |  | ``
40 | 0 | `Point2D transformedAt = vv.inverseViewTransform(at);`
41 |  | ``
42 |  | `// return the transformers to 1.0`
43 | 0 | `layoutTransformer.scale(inverseModelScale, inverseModelScale, transformedAt);`
44 | 0 | `viewTransformer.scale(inverseViewScale, inverseViewScale, at);`
45 |  | ``
46 | 0 | `super.scale(vv, amount, at);`
47 | 0 | `}`
48 |  | `}`

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.