edu.uci.ics.jung.visualization.control.TransformSupport Maven / Gradle / Ivy
package edu.uci.ics.jung.visualization.control;
import edu.uci.ics.jung.visualization.MultiLayerTransformer;
import edu.uci.ics.jung.visualization.VisualizationServer;
import edu.uci.ics.jung.visualization.transform.MutableAffineTransformer;
import java.awt.*;
import java.awt.geom.Point2D;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** @author Tom Nelson */
public class TransformSupport extends MutableAffineTransformer {
private static final Logger log = LoggerFactory.getLogger(TransformSupport.class);
/**
* Overriden to apply lens effects to the transformation from view to layout coordinates
*
* @param vv
* @param p
* @return
*/
public Point2D inverseTransform(VisualizationServer vv, Point2D p) {
MultiLayerTransformer multiLayerTransformer = vv.getRenderContext().getMultiLayerTransformer();
return multiLayerTransformer.inverseTransform(p);
}
/**
* Overriden to perform lens effects when transforming from Layout to view. Used when projecting
* the selection Lens (the rectangular area drawn with the mouse) back into the view.
*
* @param vv
* @param p
* @return
*/
public Point2D transform(VisualizationServer vv, Point2D p) {
MultiLayerTransformer multiLayerTransformer = vv.getRenderContext().getMultiLayerTransformer();
return multiLayerTransformer.transform(p);
}
/**
* Overriden to perform lens effects when transforming from Layout to view. Used when projecting
* the selection Lens (the rectangular area drawn with the mouse) back into the view.
*
* @param vv
* @param shape
* @return
*/
public Shape transform(VisualizationServer vv, Shape shape) {
MultiLayerTransformer multiLayerTransformer = vv.getRenderContext().getMultiLayerTransformer();
return multiLayerTransformer.transform(shape);
}
/**
* Overriden to perform lens effects when inverse transforming from view to layout.
*
* @param vv
* @param shape
* @return
*/
public Shape inverseTransform(VisualizationServer vv, Shape shape) {
MultiLayerTransformer multiLayerTransformer = vv.getRenderContext().getMultiLayerTransformer();
return multiLayerTransformer.inverseTransform(shape);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy