Author: mes
Date: 2010-06-15 13:08:35 -0700 (Tue, 15 Jun 2010)
New Revision: 20544
Modified:
cytoscape/trunk/src/cytoscape/visual/properties/NodeCustomGraphicsProp.java
Log:
Added a scaling factor that shrinks the size of images when they're bound to
the size of nodes so that the images will fit cleanly inside of the nodes.
Modified:
cytoscape/trunk/src/cytoscape/visual/properties/NodeCustomGraphicsProp.java
===================================================================
--- cytoscape/trunk/src/cytoscape/visual/properties/NodeCustomGraphicsProp.java
2010-06-15 17:29:49 UTC (rev 20543)
+++ cytoscape/trunk/src/cytoscape/visual/properties/NodeCustomGraphicsProp.java
2010-06-15 20:08:35 UTC (rev 20544)
@@ -39,6 +39,9 @@
private static final CyCustomGraphics<CustomGraphic> NULL = new
NullCustomGraphics();
private final int index;
+ // The factor by which to shrink scaled images so that they'll fit
within nodes.
+ private static final double SHRINK = 0.9;
+
// Manages view to Custom Graphics mapping.
private Map<DNodeView, Set<CustomGraphic>> currentMap;
@@ -205,16 +208,16 @@
final AffineTransform scale;
if (whLock) {
- scale = AffineTransform.getScaleInstance(nodeW / cgW,
nodeH / cgH);
+ scale = AffineTransform.getScaleInstance(SHRINK * nodeW
/ cgW, SHRINK * nodeH / cgH);
} else {
// Case 1: node height value is larger than width
if (nodeW >= nodeH) {
- scale = AffineTransform.getScaleInstance((nodeW
/ cgW)
- * (nodeH / nodeW), nodeH / cgH);
+ scale = AffineTransform.getScaleInstance(SHRINK
* (nodeW / cgW)
+ * (nodeH / nodeW), SHRINK *
nodeH / cgH);
// scale =
AffineTransform.getScaleInstance(nodeH/nodeW, 1);
} else {
- scale = AffineTransform.getScaleInstance(nodeW
/ cgW,
- (nodeH / cgH) * (nodeW /
nodeH));
+ scale = AffineTransform.getScaleInstance(SHRINK
* nodeW / cgW,
+ SHRINK * (nodeH / cgH) * (nodeW
/ nodeH));
// scale = AffineTransform.getScaleInstance(1,
nodeW/nodeH);
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.