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

LineHitsSource
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  */
250public 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) {
330        MutableTransformer layoutTransformer = vv.getLayoutTransformer();
340        MutableTransformer viewTransformer = vv.getViewTransformer();
350        double modelScale = layoutTransformer.getScale();
360        double viewScale = viewTransformer.getScale();
370        double inverseModelScale = Math.sqrt(crossover)/modelScale;
380        double inverseViewScale = Math.sqrt(crossover)/viewScale;
39         
400        Point2D transformedAt = vv.inverseViewTransform(at);
41         
42         // return the transformers to 1.0
430        layoutTransformer.scale(inverseModelScale, inverseModelScale, transformedAt);
440        viewTransformer.scale(inverseViewScale, inverseViewScale, at);
45  
460        super.scale(vv, amount, at);
470    }
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.