[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob org/nongnu/libvob/buoy/impl/BuoyOnCircle...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] libvob org/nongnu/libvob/buoy/impl/BuoyOnCircle... |
Date: |
Wed, 13 Aug 2003 08:08:29 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Tuomas J. Lukka <address@hidden> 03/08/13 08:08:29
Modified files:
org/nongnu/libvob/buoy/impl: BuoyOnCircleGeometer.java
FlatMarginGeometer.java
vob/buoy : buoymanager.py
Added files:
org/nongnu/libvob/buoy: NadirManager.java
Log message:
Move nadir from buoymanager to geometers for increased flexibility
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/buoy/NadirManager.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/buoy/impl/FlatMarginGeometer.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/buoy/buoymanager.py.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
Patches:
Index: libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java
diff -u libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java:1.5
libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java:1.6
--- libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java:1.5 Mon Aug
11 08:10:35 2003
+++ libvob/org/nongnu/libvob/buoy/impl/BuoyOnCircleGeometer.java Wed Aug
13 08:08:29 2003
@@ -50,6 +50,11 @@
*/
public float shiftFactor = 18;
+ /** If non-null, this class will be used to generate
+ * nadir coordinate systems.
+ */
+ public NadirManager nadirManager;
+
public int buoyCS(VobScene vs, int anchor, int direction,
Object key,
int index, int total,
@@ -85,6 +90,9 @@
int inBuoy = vs.coords.orthoBox(buoy,
-100, -w/2 * scale, -h/2 * scale,
scale, scale, w, h);
+
+ if(nadirManager != null)
+ inBuoy = nadirManager.makeNadired(vs, inBuoy);
vs.matcher.add(this.buoyinto, inBuoy, key);
Index: libvob/org/nongnu/libvob/buoy/impl/FlatMarginGeometer.java
diff -u libvob/org/nongnu/libvob/buoy/impl/FlatMarginGeometer.java:1.2
libvob/org/nongnu/libvob/buoy/impl/FlatMarginGeometer.java:1.3
--- libvob/org/nongnu/libvob/buoy/impl/FlatMarginGeometer.java:1.2 Mon Aug
11 04:59:21 2003
+++ libvob/org/nongnu/libvob/buoy/impl/FlatMarginGeometer.java Wed Aug 13
08:08:29 2003
@@ -50,6 +50,11 @@
float xcenter = marginfraction * size[0];
if(direction > 0) xcenter = size[0] - xcenter;
+ // Change scale -- we always fit exactly to the given fraction
+ float desiredw = size[0] * marginfraction * 2;
+ if(scale * w > desiredw)
+ scale = desiredw / w;
+
// Create coordinate system
int buoyCS = vs.orthoBoxCS(
this.into, key, -50,
Index: libvob/vob/buoy/buoymanager.py
diff -u libvob/vob/buoy/buoymanager.py:1.54 libvob/vob/buoy/buoymanager.py:1.55
--- libvob/vob/buoy/buoymanager.py:1.54 Wed Aug 13 02:47:03 2003
+++ libvob/vob/buoy/buoymanager.py Wed Aug 13 08:08:29 2003
@@ -91,13 +91,8 @@
def getMainNode(self):
return self.mainNode
- def _nadir(self, cs):
- n = self.vs.coords.nadirUnitSq(cs, self.nadirCS)
- self.vs.matcher.add(cs, n, "NADIR")
- return n
- def drawscene(self, vs, mainboxinto, into, buoyinto, nadirCS):
+ def drawscene(self, vs, mainboxinto, into, buoyinto):
self.vs = vs
- self.nadirCS = nadirCS
self.buoyinto = buoyinto
self.cs = { }
@@ -168,7 +163,6 @@
dbg1 = self.vs.unitSqCS(into, "U")
self.vs.put(coloredQuad((0,1,0)), dbg1)
- into = self._nadir(into)
self.vs.activate(into)
### Render the buoy, get back anchor cs
@@ -177,6 +171,8 @@
self.cs[into] = (otherNode, linkId, otherAnchor, into)
if anchorCS >= 0:
+ # anchorCS < 0 when there is no anchor, e.g., for ttconnector
+ # in FenPDF
self.vs.map.put(lineconn, self.vs.unitSqCS(anchorCS, "UN"),
self.vs.unitSqCS(otherAnchorCS, "UN"))
@@ -258,22 +254,15 @@
return sc
self.vs = vs
- nadirCS = vs.translateCS(0, "NADIRORIGIN",
- .5 * vs.size.width,
- 3.0 * vs.size.height)
-
vs.put(background((.36, .74, 1.0)))
- # XXX Should we take these geometries through nadir?
-
geoms = self.geometer.place(vs)
for i in range(0, len(self.singles)):
self.singles[i].drawscene(vs,
geoms[i][0],
geoms[i][1],
- geoms[i][2],
- nadirCS)
+ geoms[i][2])
def mouse(self, ev):
""" Returns true if buoymanager has eaten the event ;)"""