gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] libvob include/vob/jni/Generate.hxx include/vob...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob include/vob/jni/Generate.hxx include/vob...
Date: Wed, 14 May 2003 18:03:31 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Changes by:     Tuomas J. Lukka <address@hidden>        03/05/14 18:03:31

Modified files:
        include/vob/jni: Generate.hxx 
        include/vob/poly: Dicer.hxx 
        include/vob/trans: FunctionalPrimitives.hxx LinearPrimitives.hxx 
                           Primitives.hxx leaf.hxx 
        include/vob/vobs: Paper.hxx Trivial.hxx 
        test/tools     : gfx.py 
        test/vob/gl    : glvobcoorder.test 
        vob/buoy       : buoymanager.py 

Log message:
        Buoy cleanup, dbg

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Generate.hxx.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/poly/Dicer.hxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/trans/FunctionalPrimitives.hxx.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/trans/LinearPrimitives.hxx.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/trans/Primitives.hxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/trans/leaf.hxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Paper.hxx.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/vobs/Trivial.hxx.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/tools/gfx.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/vob/gl/glvobcoorder.test.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/buoy/buoymanager.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text

Patches:
Index: libvob/include/vob/jni/Generate.hxx
diff -u libvob/include/vob/jni/Generate.hxx:1.20 
libvob/include/vob/jni/Generate.hxx:1.21
--- libvob/include/vob/jni/Generate.hxx:1.20    Sat Apr 19 15:37:32 2003
+++ libvob/include/vob/jni/Generate.hxx Wed May 14 18:03:30 2003
@@ -219,6 +219,9 @@
 
            VOB_TRANSJAVASTREAM << "}\n";
 
+           VOB_JNICXXSTREAM 
+                   << "const char *PrimitiveHierarchicalTransform<"
+                       <<className<<">::name = \""<<className<<"\";\n\n ";
            VOB_JNISTREAM << "static HierFact<"<<className<<"> "
                << className<<"__fac("<<ind<<");\n";
 
@@ -241,12 +244,18 @@
 }
 }
 
+
 #define VOB_DEFINED(x)  \
 static Templates::IfTempl<!VOB_NON_LEAF, JNI::VobJNIGenerator<x> > 
x##generator(#x);
 
 
-#define VOB_PRIMITIVETRANS_DEFINED(x, n)  \
-static Templates::IfTempl<!VOB_NON_LEAF, JNI::TransJNIGenerator<x> > 
x##generator(#x, n);
+#define VOB_PRIMITIVETRANS_DEFINED_LEAF(x, n)  \
+    static JNI::TransJNIGenerator<x> x##generator(#x, n); \
+    const char *Primitives::PrimitiveHierarchicalTransform<x>::name = #x
+
+#define VOB_PRIMITIVETRANS_DEFINED_NONLEAF(x, n)  
+
+#define VOB_PRIMITIVETRANS_DEFINED(x, n)  VOB_PRIMITIVETRANS_DEFINED_LEAF(x, n)
 
 #ifndef VOB_NON_LEAF
 #define VOB_NON_LEAF 0
Index: libvob/include/vob/poly/Dicer.hxx
diff -u libvob/include/vob/poly/Dicer.hxx:1.3 
libvob/include/vob/poly/Dicer.hxx:1.4
--- libvob/include/vob/poly/Dicer.hxx:1.3       Wed May  7 08:00:42 2003
+++ libvob/include/vob/poly/Dicer.hxx   Wed May 14 18:03:30 2003
@@ -114,6 +114,7 @@
            DBG(dbg) << "Triangler: dice\n";
            typedef std::pair<int, int> Edge;
            vector<Edge> tosplit;
+           int round = 0;
            while(1) {
                DBG(dbg) << "Triangler: dice round\n";
                for(Titer t = tris.begin(); t != tris.end(); t++) {
@@ -127,6 +128,11 @@
                for(unsigned i=0; i<tosplit.size(); i++)
                    splitEdge(tosplit[i].first, tosplit[i].second);
                tosplit.clear();
+               round ++;
+               if(round > 20) {
+                   DBG(dbg) << "OVER ROUND LIMIT! ABORTING!\n";
+                   return;
+               }
            }
        }
        void draw() {
Index: libvob/include/vob/trans/FunctionalPrimitives.hxx
diff -u libvob/include/vob/trans/FunctionalPrimitives.hxx:1.2 
libvob/include/vob/trans/FunctionalPrimitives.hxx:1.3
--- libvob/include/vob/trans/FunctionalPrimitives.hxx:1.2       Fri Apr 25 
08:30:14 2003
+++ libvob/include/vob/trans/FunctionalPrimitives.hxx   Wed May 14 18:03:30 2003
@@ -47,7 +47,8 @@
            public PrimitiveTransform,
            public PotentiallyGLPerformablePrimitiveTransform,
            public DependentPrimitiveTransform,
-           public BoxPrimitiveTransform
+           public BoxPrimitiveTransform,
+           public DumpingPrimitiveTransform
     {
        const Transform *it;
        enum { NDepends = 2 };
@@ -68,6 +69,11 @@
        typedef Concat InverseType;
        void inverse(InverseType &inv) const {
            inv.it = &(it->getInverse());
+       }
+
+        void dump(std::ostream &out) const { 
+           out << "OTHER:";
+           it->dump(out);
        }
     };
 
Index: libvob/include/vob/trans/LinearPrimitives.hxx
diff -u libvob/include/vob/trans/LinearPrimitives.hxx:1.5 
libvob/include/vob/trans/LinearPrimitives.hxx:1.6
--- libvob/include/vob/trans/LinearPrimitives.hxx:1.5   Fri Apr 25 13:16:45 2003
+++ libvob/include/vob/trans/LinearPrimitives.hxx       Wed May 14 18:03:30 2003
@@ -575,6 +575,89 @@
     };
     VOB_PRIMITIVETRANS_DEFINED(BuoyOnCircle1_Explicit, "buoyOnCircle1");
 
+    class BuoyOnCircle2 :
+       public Ortho,
+       public DependentPrimitiveTransform
+    {
+    public:
+       enum { NDepends = 2 }; // Usual super plus the anchor
+
+       /** The number of units to shift the coordsyses by default.
+        */
+       float shiftamount;
+
+       /** The direction of shift.
+        */
+       float direction;
+
+       BuoyOnCircle2() : shiftamount(10), direction(1) {
+       }
+
+       template<class SPtr> void setParams(SPtr depends) {
+           // Get the anchor in the root coordinate system
+           Pt anchor = Pt(depends[0]->getInverse().transform(
+                           depends[1]->transform(
+                               .5 * depends[1]->getSqSize())));
+           // And transform it to the square coordsys
+           Pt sq = depends[0]->getSqSize();
+           anchor.x /= sq.x;
+           anchor.y /= sq.y;
+
+           float shift = shiftamount / sq.x;
+
+           // Here, the circle center is always .5, .5
+           // and radius .5
+
+           int dir = direction > 0 ? 1 : -1;
+
+           Pt shifted(anchor.x + dir * shift, anchor.y);
+           Pt ctr(.5,.5);
+           Pt buoy;
+           if((shifted-ctr).length() >= .5) {
+               buoy = shifted;
+           } else {
+               if((anchor-ctr).length() >= .5) {
+                   buoy = anchor;
+               } else {
+                   buoy = Geom::project2circle(
+                           anchor, ctr + -dir * Pt(.5,0),
+                           ctr, .5);
+               }
+           }
+           
+           float scale = 1 - (anchor-ctr).length() / .5;
+           if(scale < shift) scale = shift;
+           this->x = buoy.x * sq.x;
+           this->y = buoy.y * sq.y;
+           this->z = -scale;
+           this->sx = scale;
+           this->sy = scale;
+       }
+    };
+
+    /** A better parametrization of buoys.
+     * The box of the first coordsys is used directly as the 
+     * circle (or ellipse). The two required numeric 
+     * parameters are the direction of projection (positive x
+     * or negative x) and the amount to shift in terms of
+     * the parent
+     * coordsys.
+     */
+    class BuoyOnCircle2_Explicit :
+       public BuoyOnCircle2,
+       public ParametrizedPrimitiveTransform {
+    public:
+       enum { NParams = 2 };
+
+       template<class SPtr, class P> void setParams(SPtr depends, P params) {
+           direction = params[0];
+           shiftamount = params[1];
+           BuoyOnCircle2::setParams(depends);
+       }
+
+    };
+
+    VOB_PRIMITIVETRANS_DEFINED(BuoyOnCircle2_Explicit, "buoyOnCircle2");
 
     /** Orthonormal transformation along with setting the box 
      * size of the coordinate system.
Index: libvob/include/vob/trans/Primitives.hxx
diff -u libvob/include/vob/trans/Primitives.hxx:1.3 
libvob/include/vob/trans/Primitives.hxx:1.4
--- libvob/include/vob/trans/Primitives.hxx:1.3 Fri Apr  4 07:34:59 2003
+++ libvob/include/vob/trans/Primitives.hxx     Wed May 14 18:03:30 2003
@@ -138,10 +138,20 @@
     class BoxPrimitiveTransform { };
 
 
+    /** A tag for a primitive transform that can print out
+     * stuff.
+     * Implies
+     * <pre>
+        void dump(std::ostream &out) const { }
+     * </pre>
+     */
+    class DumpingPrimitiveTransform { };
+
+    template<class Primitive> class PrimitiveHierarchicalTransform ;
 
     /** An inverse hierarchical transformation.
      */
-    template<class Primitive> class InverseHierarchicalTransform : 
+    template<class Primitive, class OrigPrimitive> class 
InverseHierarchicalTransform : 
            public Transform 
     {
        const Transform *super;
@@ -189,6 +199,12 @@
            return 0;
        }
 
+       void dumpParams(const DumpingPrimitiveTransform *__, std::ostream &out) 
const {
+           t.dump(out);
+       }
+       void dumpParams(const void *__, std::ostream &out) const {
+       }
+
     public:
        Primitive t;
 
@@ -233,6 +249,12 @@
        }
 
        virtual void dump(std::ostream &out) const {
+           out << "[inversetrans "<<
+               PrimitiveHierarchicalTransform<OrigPrimitive>::name
+                   << " ";
+           super->dump(out);
+           dumpParams(&t, out);
+           out <<"]";
        }
 
        virtual Pt getSqSize() const {
@@ -261,6 +283,7 @@
     template<class Primitive> class PrimitiveHierarchicalTransform : 
            public HierarchicalTransform
     {
+
        const Transform *super;
        Transform *inverse;
 
@@ -364,7 +387,14 @@
                 float *p) {
            t.setParams(p);
        }
+
+       void dumpParams(const DumpingPrimitiveTransform *__, std::ostream &out) 
const {
+           t.dump(out);
+       }
+       void dumpParams(const void *__, std::ostream &out) const {
+       }
     public:
+       static const char *name;
 
        PrimitiveHierarchicalTransform() {
            super = 0;
@@ -419,8 +449,12 @@
  
        virtual const Transform &getInverse() const {
            if(!this->inverse)  {
-               InverseHierarchicalTransform<typename Primitive::InverseType> 
*inv 
-                           = new InverseHierarchicalTransform<typename 
Primitive::InverseType>(
+               InverseHierarchicalTransform<
+                   typename Primitive::InverseType, 
+                   Primitive> *inv 
+                           = new InverseHierarchicalTransform<
+                               typename Primitive::InverseType,
+                               Primitive >(
                                        &(super->getInverse()), this);
                t.inverse(inv->t);
                ((PrimitiveHierarchicalTransform<Primitive> *)this)
@@ -430,6 +464,10 @@
        }
 
        virtual void dump(std::ostream &out) const {
+           out << "[trans "<<name<< " ";
+           super->dump(out);
+           dumpParams(&t, out);
+           out <<"]";
        }
 
        virtual Pt getSqSize() const {
Index: libvob/include/vob/trans/leaf.hxx
diff -u libvob/include/vob/trans/leaf.hxx:1.1 
libvob/include/vob/trans/leaf.hxx:1.2
--- libvob/include/vob/trans/leaf.hxx:1.1       Fri Apr  4 07:34:59 2003
+++ libvob/include/vob/trans/leaf.hxx   Wed May 14 18:03:30 2003
@@ -5,9 +5,22 @@
 #if VOB_NON_LEAF
 #include F
 #else
+
 #undef VOB_NON_LEAF
 #define VOB_NON_LEAF 1
+
+#ifdef VOB_PRIMITIVETRANS_DEFINED_NONLEAF
+#undef VOB_PRIMITIVETRANS_DEFINED
+#define VOB_PRIMITIVETRANS_DEFINED(a,b) VOB_PRIMITIVETRANS_DEFINED_NONLEAF(a,b)
+#endif
 #include F
+
+#ifdef VOB_PRIMITIVETRANS_DEFINED_NONLEAF
+#undef VOB_PRIMITIVETRANS_DEFINED
+#define VOB_PRIMITIVETRANS_DEFINED(a,b) VOB_PRIMITIVETRANS_DEFINED_LEAF(a,b)
+#endif
+
 #undef VOB_NON_LEAF
 #define VOB_NON_LEAF 0
+
 #endif
Index: libvob/include/vob/vobs/Paper.hxx
diff -u libvob/include/vob/vobs/Paper.hxx:1.8 
libvob/include/vob/vobs/Paper.hxx:1.9
--- libvob/include/vob/vobs/Paper.hxx:1.8       Tue May 13 07:48:21 2003
+++ libvob/include/vob/vobs/Paper.hxx   Wed May 14 18:03:30 2003
@@ -59,7 +59,12 @@
     }
 
     int operator() (int i, int j, float fract = .5) {
-       DBG(dbg_paperquad) << "New vertex "<<i<<" "<<j<<" "<<fract<<"\n";
+       DBG(dbg_paperquad) << "New vertex "<<i<<" "<<j<<" "<<fract<<"\n"
+           << points[i].orig <<" "
+           << points[j].orig <<" "
+           << points[i].final <<" "
+           << points[j].final <<"\n"
+           ;
        return append(
                lerp(points[i].orig, points[j].orig, fract) );
     }
@@ -116,44 +121,14 @@
     return ret;
 }
 
-/** Whether the i-j stretch should be split again
- * @return 1 = yes, 0 = no, -1 = j should be dropped
- */
-inline int split3(Verts &v, float dicelen1, float dicelen2, int i, int j, int 
k) {
-    Pt o1 = (Pt)v.points[i].final - (Pt)v.points[j].final;
-    Pt o2 = (Pt)v.points[j].final - (Pt)v.points[k].final;
-    float x1, x2;
-    if(fabs(o1.x) > fabs(o1.y)) {
-       x1 = o1.x; x2 = o2.x;
-    } else {
-       x1 = o1.y; x2 = o2.y;
-    }
-    Pt v1 = (Pt)v.points[i].final - (Pt)v.points[j].final;
-    Pt v2 = (Pt)v.points[j].final - (Pt)v.points[k].final;
-
-    float v1l = v1.length();
-    float v2l = v2.length();
-
-    if(v1l > dicelen1) return 1;
-
-    Pt v2_mapped = v2 * (x1 / x2);
-
-    float area = (v1 - v2_mapped).length();
-
-    float carea = area * v1l / (v1l + v2l);
-    DBG(dbg_paperquad) << "Split3 "<<i<<" "<<j<<" "<<
-           v.points[i].final<<" "<<v.points[j].final<<" "
-           << v.points[k].final<< " " <<area<<" "<<carea<<"\n";
-    if(area < dicelen2 / 2) return -1;
-    // The portion that is v1's worry
-    if(carea < dicelen2) return 0;
-    return 1;
-}
-
 inline int splitTri(Verts &v, float dicelen1, float dicelen2, int i, int j, 
int k) {
-    DBG(dbg_paperquad) << "SplitTri "<<i<<" "<<j<<" "<<
-           v.points[i].final<<" "<<v.points[j].final<<" "
-           << v.points[k].final<< "\n";
+    DBG(dbg_paperquad) << "SplitTri "<<i<<" "<<j<<" "<<k<<" "<<
+           v.points[i].orig<<" "<<
+           v.points[j].orig<<" "<<
+           v.points[k].orig<<" "<<
+           v.points[i].final<<" "<<
+           v.points[j].final<<" "<<
+           v.points[k].final<< "\n";
     Pt ctr = 1/3. * (
                v.points[i].orig + 
                v.points[j].orig + 
Index: libvob/include/vob/vobs/Trivial.hxx
diff -u libvob/include/vob/vobs/Trivial.hxx:1.17 
libvob/include/vob/vobs/Trivial.hxx:1.18
--- libvob/include/vob/vobs/Trivial.hxx:1.17    Tue Apr 29 07:22:41 2003
+++ libvob/include/vob/vobs/Trivial.hxx Wed May 14 18:03:30 2003
@@ -143,6 +143,7 @@
            glCallList(no.get());
        } else {
            std::cout << "Error: CallistCoorded with non-glperformable.\n";
+           t.dump(std::cout);
        }
        glPopMatrix();
     }
@@ -159,7 +160,8 @@
 
            glCallList(no.get());
        } else {
-           std::cout << "Error: CallistCoorded with non-glperformable.\n";
+           std::cout << "Error: CallisBoxtCoorded with non-glperformable.\n";
+           t.dump(std::cout);
        }
        glPopMatrix();
     }
Index: libvob/test/tools/gfx.py
diff -u libvob/test/tools/gfx.py:1.10 libvob/test/tools/gfx.py:1.11
--- libvob/test/tools/gfx.py:1.10       Tue May 13 07:48:21 2003
+++ libvob/test/tools/gfx.py    Wed May 14 18:03:30 2003
@@ -120,6 +120,8 @@
     dst = vs.coords.transformPoints3(cs, src, None)
     failUnless(dst != None)
     for i in range(0, len(src)):
+       if dstlist[i] == None:
+           continue
        if abs(dst[i]-dstlist[i]) > delta:
            raise str([srclist, dstlist, dst, i, dst[i], dstlist[i]])
     if alsoRender:
Index: libvob/test/vob/gl/glvobcoorder.test
diff -u libvob/test/vob/gl/glvobcoorder.test:1.14 
libvob/test/vob/gl/glvobcoorder.test:1.15
--- libvob/test/vob/gl/glvobcoorder.test:1.14   Fri Apr 25 13:16:45 2003
+++ libvob/test/vob/gl/glvobcoorder.test        Wed May 14 18:03:30 2003
@@ -330,5 +330,13 @@
     failUnlessEqual(wh[0], 6);
     failUnlessEqual(wh[1], 7);
     
+def testBuoy2():
+    anchor = vs.orthoBoxCS(0, "A", 0, 100, 100, 0, 0, 0, 0)
+    sea = vs.orthoBoxCS(0, "F", 0, 0, 0, 1, 1, 100, 100)
+    buoy = vs.coords.buoyOnCircle2(sea, anchor, 1, 10)
+
+    checkTrans(vs, buoy, [0, 0, 0], [110, 100, None])
+
+
 
 # : vim: set syntax=python :
Index: libvob/vob/buoy/buoymanager.py
diff -u libvob/vob/buoy/buoymanager.py:1.13 libvob/vob/buoy/buoymanager.py:1.14
--- libvob/vob/buoy/buoymanager.py:1.13 Tue May 13 07:48:22 2003
+++ libvob/vob/buoy/buoymanager.py      Wed May 14 18:03:30 2003
@@ -55,7 +55,7 @@
 
 
 pa("LOADING BUOYMANAGER")
-class RealBuoyManager(BuoyLinkListener):
+class AbstractBuoyManager(BuoyLinkListener):
     """Manage buoys through the new APIs
 
     This is a demo "scene"
@@ -74,33 +74,10 @@
        n =  self.vs.coords.nadirUnitSq(cs, self.nadirCS)
        self.vs.matcher.add(cs, n, "NADIR")
        return n
-    def scene(self, vs):
-       if self.replaceScene: 
-           sc = self.replaceScene
-           self.replaceScene = None
-           return sc
+    def drawscene(self, vs, into, buoyinto):
        self.vs = vs
        self.cs = { }
 
-       self.ctrx = vs.size.width / 2
-       self.ctry = vs.size.height * .485 # A *little* above real ctr
-
-       mainsize = vs.size.width * .6
-
-       self.nadirCS = vs.translateCS(0, "NADIRORIGIN", self.ctrx, 
-                   2.5 * vs.size.height)
-
-       vs.put(background((.36, .74, 1.0)))
-
-        # rule 1) this translate is 'FocusCenter'
-       center = vs.translateCS(0, "FocusCenter", self.ctrx, self.ctry)
-       #center = vs.affineCS(0, "FocusCenter", 0, self.ctrx, self.ctry,
-       #                       .6, .3, -.3, .9)
-
-        # rule 2) this box is 'FocusFrame'
-       into = vs.orthoBoxCS(center, "FocusFrame", 0, 
-                              -mainsize/2, -mainsize/2, 1, 1, mainsize, 
mainsize)
-
        self.vs.activate(into)
 
        self.mainNode.renderMain(vs, into)
@@ -108,7 +85,7 @@
        self.links = []
         for connector in self.connectors:
             connector.addBuoys(vs, into, self.mainNode, self)
-       for l in self.links: self._linkReally(*l)
+       for l in self.links: self._linkReally(buoyinto, *l)
        self.cs[into] = None
         
         # Interpolation : old buoy -> to new main vp
@@ -121,24 +98,11 @@
 
     def link(self, *args):
        self.links.append(args)
-    def _linkReally(self, direction, anchorCS, otherNode, linkId, otherAnchor):
+    def _linkReally(self, buoyinto, direction, anchorCS, otherNode, linkId, 
otherAnchor):
         if dbg: pa('link really')
 
-       anchorUnit = self.vs.unitSqCS(anchorCS, "UN")
-       anchorCenter = self.vs.translateCS(anchorUnit, "TR55", .5, .5)
-       x = self.ctrx
-       r = self.ctry * 1.05
-       if dbg: pa("Buoy: ",self.ctrx, self.ctry, x, r)
-       if direction > 0:
-           buoy = self.vs.coords.buoyOnCircle1(0, anchorCenter,
-                               x, self.ctry, r, 
-                               x-r, self.ctry, 
-                               .1)
-       else:
-           buoy = self.vs.coords.buoyOnCircle1(0, anchorCenter,
-                               x, self.ctry, r, 
-                               x+r, self.ctry,
-                               .1)
+       buoy = self.vs.coords.buoyOnCircle2(buoyinto, anchorCS,
+                               direction, 10)
        self.vs.matcher.add(buoy, linkId)
         if dbg: pa(otherNode)
        obj = otherNode.getSize(linkId, otherAnchor, size)
@@ -167,7 +131,7 @@
        otherAnchorCS = otherNode.renderBuoy(self.vs, into, linkId, 
otherAnchor, None)
        self.cs[into] = (otherNode, linkId, otherAnchor, into)
 
-       self.vs.map.put(lineconn, anchorUnit, 
+       self.vs.map.put(lineconn, self.vs.unitSqCS(anchorCS, "UN"), 
                         self.vs.unitSqCS(otherAnchorCS, "UN"))
 
 
@@ -231,3 +195,40 @@
         
     def getVs(self):
         return self.vs;
+
+class RealBuoyManager(AbstractBuoyManager):
+    def __init__(self, mainNode, connectors):
+       AbstractBuoyManager.__init__(self, mainNode, connectors)
+
+    def scene(self, vs):
+       if self.replaceScene: 
+           sc = self.replaceScene
+           self.replaceScene = None
+           return sc
+
+
+       self.ctrx = vs.size.width / 2
+       self.ctry = vs.size.height * .485 # A *little* above real ctr
+
+       self.nadirCS = vs.translateCS(0, "NADIRORIGIN", self.ctrx, 
+                   2.5 * vs.size.height)
+
+       vs.put(background((.36, .74, 1.0)))
+
+       center = vs.translateCS(0, "FocusCenter", self.ctrx, self.ctry)
+
+       mainsize = vs.size.width * .6
+       buoywidth = vs.size.width * .8
+       buoyheight = vs.size.height * .8
+
+       into = vs.orthoBoxCS(center, "FocusFrame", 0, 
+                              -mainsize/2, -mainsize/2, 1, 1, mainsize, 
mainsize)
+
+       buoyinto = vs.orthoBoxCS(center, "BuoyFrame", 0,
+                               -buoywidth/2, -buoyheight/2, 1, 1, 
+                                   buoywidth, buoyheight)
+
+       self.drawscene(vs, into, buoyinto)
+                       
+
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]