move glsequence into "alg" component
authorDiane Trout <diane@caltech.edu>
Tue, 28 Feb 2006 21:57:09 +0000 (21:57 +0000)
committerDiane Trout <diane@caltech.edu>
Tue, 28 Feb 2006 21:57:09 +0000 (21:57 +0000)
I decided to try to make the opengl rendering code toolkit independent
this makes it easier to test some of these components as then I can
just use boost.unittest to verify them.

Also when I python wrap parts it might make sense for the gl components
to be the part that ends up getting exported as the python package.

Makefile.noqt
alg/glsequence.cxx [deleted file]
alg/glsequence.h [deleted file]
alg/module.mk
alg/test/module.mk
alg/test/test_glsequence.cxx
mussagl.pro
qui/GlSequence.cxx [new file with mode: 0644]
qui/GlSequence.h [new file with mode: 0644]
qui/PathScene.cxx
qui/PathScene.h

index 0db92db9ed9bcff779d87b3ca636ca3e08f967cf..572619fdd83c70e24f13bac05120d7d77fa67ad1 100644 (file)
@@ -20,8 +20,8 @@ SRC :=
 all: targets
 
 include alg/module.mk
-include alg/test/module.mk
 include gui/module.mk
+include test/module.mk
 include module.mk
 
 # process what the module.mks defined
diff --git a/alg/glsequence.cxx b/alg/glsequence.cxx
deleted file mode 100644 (file)
index 81b6042..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-#include "alg/glsequence.h"
-
-#include <iostream>
-using namespace std;
-
-GlSequence::GlSequence(const Sequence &s) 
-  : seq(s),
-    seq_x(0.0), 
-    seq_y(0.0), 
-    seq_z(1.0), 
-    seq_width(s.size()),
-    seq_height(gl_track_height) 
-{
-}
-
-GlSequence::GlSequence(const GlSequence &s) 
-  : seq(s.seq),
-    seq_x(s.seq_x),
-    seq_y(s.seq_y),
-    seq_z(s.seq_z),
-    seq_width(s.seq_width),
-    seq_height(s.seq_height)
-{
-}
-
-GlSequence &GlSequence::operator=(const GlSequence & s)
-{
-  if (this != &s) {
-    const_cast<Sequence &>(seq) = s.seq;
-    seq_x = s.seq_x;
-    seq_y = s.seq_y;
-    seq_z = s.seq_z;
-    seq_width = s.seq_width;
-    seq_height = s.seq_height;
-  }
-  return *this;
-}
-
-const Sequence &GlSequence::sequence() const
-{
-  return seq;
-}
-
-void GlSequence::setX(GLfloat value)
-{
-  seq_x = value;
-}
-
-GLfloat GlSequence::x() const
-{
-  return seq_x;
-}
-
-void GlSequence::setY(GLfloat value)
-{
-  seq_y = value;
-}
-
-GLfloat GlSequence::y() const
-{
-  return seq_y;
-}
-
-void GlSequence::setWidth(GLfloat value)
-{
-  seq_width = value;
-}
-
-GLfloat GlSequence::width() const
-{
-  return seq_width;
-}
-
-
-void GlSequence::draw() const
-{
-  glLineWidth(seq_height);
-  glColor3f(0.0, 0.0, 0.0);
-  // draw main sequence track
-  glBegin(GL_LINES);
-    glVertex3f(seq_x,           seq_y, seq_z);
-    glVertex3f(seq_x+seq_width, seq_y, seq_z);
-    clog << "drawing " << seq_x << " " << seq_y << " " << seq_width
-         << std::endl;
-  glEnd();
-  // draw annotations
-  GLfloat annotation_z = seq_z + 1.0;
-  std::list<annot> annots = seq.annotations();
-  for (std::list<annot>::const_iterator annot_itor = annots.begin();
-       annot_itor != annots.end();
-       ++annot_itor, ++annotation_z)
-  {
-    glColor3f(0.0, 0.5, 0.0);
-    glBegin(GL_LINES);
-      glVertex3f(annot_itor->start, seq_y, annotation_z);
-      glVertex3f(annot_itor->end  , seq_y, annotation_z);
-    glEnd();
-  }
-}
diff --git a/alg/glsequence.h b/alg/glsequence.h
deleted file mode 100644 (file)
index 4fb37da..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef _GL_SEQUENCE_H_
-#define _GL_SEQUENCE_H_
-
-#include "alg/sequence.hh"
-#include <GL/gl.h>
-
-//! Manage rendering a mussa sequence track
-/*! The idea is this will keep track of the location of where the sequence
- *  is being rendered, and handle displaying annotations on that track
- */
-class GlSequence
-{
-public: 
-  GlSequence(const Sequence & s);
-  GlSequence(const GlSequence & s);
-  GlSequence &operator=(const GlSequence &s);
-
-  void draw() const;
-
-  const Sequence &sequence() const;
-  void setX(GLfloat);
-  GLfloat x() const;
-  void setY(GLfloat);
-  GLfloat y() const;
-  void setWidth(GLfloat);
-  GLfloat width() const;
-
-private:
-  const Sequence& seq;
-  GLfloat seq_x;
-  GLfloat seq_y;
-  GLfloat seq_z;
-  GLfloat seq_width;
-  GLfloat seq_height;
-};
-
-const float gl_track_height = 10.0;
-
-#endif
index b4458fa28b26b040cf65b47eed5c598ec34cdb2d..338fd4b434f1fe3783ba1c1caafb017454e7f9ce 100644 (file)
@@ -2,7 +2,6 @@ CURDIR := $(BASEDIR)alg/
 
 SOURCES.cxx := flp.cxx \
                flp_seqcomp.cxx \
-               glsequence.cxx \
                mussa_class.cxx \
                nway_paths.cxx \
                nway_entropy.cxx \
index 97f1ed1077d1f1f1aab7be2dc92b3e0f845a7951..d418c41dfc9b3c88ba3040fa71cc0faaf423d968 100644 (file)
@@ -1,11 +1,12 @@
-CURDIR := $(BASEDIR)alg/test/
+CURDIR := $(BASEDIR)test/
 
 SOURCES.cxx := test_flp.cxx \
                test_glsequence.cxx \
                test_main.cxx \
                test_mussa.cxx \
                test_nway.cxx \
-               test_sequence.cxx 
+               test_sequence.cxx \
+               ../qui/GlSequence.cxx
 
 TESTSRC := $(addprefix $(CURDIR), $(SOURCES.cxx))
 
index f0369c930630d880e852d669caea9a16feb15881..0c4681200380c89a04a0c3c927354e6c26eb5a24 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <string>
 
-#include "alg/glsequence.h"
+#include "qui/GlSequence.h"
 #include "alg/sequence.hh"
 
 using namespace std;
index 2cd8f34db3c3a82a197049c31f15d4443a23bd2e..e4e0e08a2c239e7ab492448b448103407fe2b6dc 100644 (file)
@@ -12,17 +12,18 @@ INCLUDEPATH += . alg qui
 
 # Input
 HEADERS += mussa_exceptions.hh \
+           qui/GlSequence.h \
            qui/PathWindow.h \
            qui/PathScene.h \
            qui/ThresholdWidget.h \
            qui/ImageScaler.h \
            qui/ImageSaveDialog.h \
            alg/flp.hh \
-           alg/glsequence.h \
            alg/mussa_class.hh \
            alg/nway_paths.hh \
            alg/sequence.hh
 SOURCES += mussagl.cxx \
+           qui/GlSequence.cxx \
            qui/PathWindow.cxx \
            qui/PathScene.cxx \
            qui/ThresholdWidget.cxx \
@@ -30,7 +31,6 @@ SOURCES += mussagl.cxx \
            qui/ImageSaveDialog.cxx \
            alg/flp.cxx \
            alg/flp_seqcomp.cxx \
-           alg/glsequence.cxx \
            alg/mussa_class.cxx \
            alg/nway_entropy.cxx \
            alg/nway_other.cxx \
diff --git a/qui/GlSequence.cxx b/qui/GlSequence.cxx
new file mode 100644 (file)
index 0000000..a44235f
--- /dev/null
@@ -0,0 +1,99 @@
+#include "qui/GlSequence.h"
+
+#include <iostream>
+using namespace std;
+
+GlSequence::GlSequence(const Sequence &s) 
+  : seq(s),
+    seq_x(0.0), 
+    seq_y(0.0), 
+    seq_z(1.0), 
+    seq_width(s.size()),
+    seq_height(gl_track_height) 
+{
+}
+
+GlSequence::GlSequence(const GlSequence &s) 
+  : seq(s.seq),
+    seq_x(s.seq_x),
+    seq_y(s.seq_y),
+    seq_z(s.seq_z),
+    seq_width(s.seq_width),
+    seq_height(s.seq_height)
+{
+}
+
+GlSequence &GlSequence::operator=(const GlSequence & s)
+{
+  if (this != &s) {
+    const_cast<Sequence &>(seq) = s.seq;
+    seq_x = s.seq_x;
+    seq_y = s.seq_y;
+    seq_z = s.seq_z;
+    seq_width = s.seq_width;
+    seq_height = s.seq_height;
+  }
+  return *this;
+}
+
+const Sequence &GlSequence::sequence() const
+{
+  return seq;
+}
+
+void GlSequence::setX(GLfloat value)
+{
+  seq_x = value;
+}
+
+GLfloat GlSequence::x() const
+{
+  return seq_x;
+}
+
+void GlSequence::setY(GLfloat value)
+{
+  seq_y = value;
+}
+
+GLfloat GlSequence::y() const
+{
+  return seq_y;
+}
+
+void GlSequence::setWidth(GLfloat value)
+{
+  seq_width = value;
+}
+
+GLfloat GlSequence::width() const
+{
+  return seq_width;
+}
+
+
+void GlSequence::draw() const
+{
+  glLineWidth(seq_height);
+  glColor3f(0.0, 0.0, 0.0);
+  // draw main sequence track
+  glBegin(GL_LINES);
+    glVertex3f(seq_x,           seq_y, seq_z);
+    glVertex3f(seq_x+seq_width, seq_y, seq_z);
+    clog << "drawing " << seq_x << " " << seq_y << " " << seq_width
+         << std::endl;
+  glEnd();
+  // draw annotations
+  GLfloat annotation_z = seq_z + 1.0;
+  std::list<annot> annots = seq.annotations();
+  for (std::list<annot>::const_iterator annot_itor = annots.begin();
+       annot_itor != annots.end();
+       ++annot_itor, ++annotation_z)
+  {
+    glColor3f(0.0, 0.5, 0.0);
+    glBegin(GL_LINES);
+      glVertex3f(annot_itor->start, seq_y, annotation_z);
+      glVertex3f(annot_itor->end  , seq_y, annotation_z);
+    glEnd();
+  }
+}
diff --git a/qui/GlSequence.h b/qui/GlSequence.h
new file mode 100644 (file)
index 0000000..4fb37da
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef _GL_SEQUENCE_H_
+#define _GL_SEQUENCE_H_
+
+#include "alg/sequence.hh"
+#include <GL/gl.h>
+
+//! Manage rendering a mussa sequence track
+/*! The idea is this will keep track of the location of where the sequence
+ *  is being rendered, and handle displaying annotations on that track
+ */
+class GlSequence
+{
+public: 
+  GlSequence(const Sequence & s);
+  GlSequence(const GlSequence & s);
+  GlSequence &operator=(const GlSequence &s);
+
+  void draw() const;
+
+  const Sequence &sequence() const;
+  void setX(GLfloat);
+  GLfloat x() const;
+  void setY(GLfloat);
+  GLfloat y() const;
+  void setWidth(GLfloat);
+  GLfloat width() const;
+
+private:
+  const Sequence& seq;
+  GLfloat seq_x;
+  GLfloat seq_y;
+  GLfloat seq_z;
+  GLfloat seq_width;
+  GLfloat seq_height;
+};
+
+const float gl_track_height = 10.0;
+
+#endif
index e1faa342daf022913589060f044c07f85953b298..4cdf4bd78c536ccce0674c60f2d3de361145c26f 100644 (file)
@@ -8,7 +8,7 @@
 #include <GL/gl.h>
 #include <math.h>
 
-#include "alg/glsequence.h"
+#include "qui/GlSequence.h"
 
 using namespace std;
 
index 5f4bd7f2d243297e1d70f45ec1a45dc1e0df5c7c..98cc7a35ebefa182f707ae220370f2c7a391897b 100644 (file)
@@ -7,7 +7,7 @@
 #include <vector>
 
 #include "alg/mussa_class.hh"
-#include "alg/glsequence.h"
+#include "qui/GlSequence.h"
 
 class QMouseEvent;
 class QRubberBand;