summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@coffee.donpellegrino.com>2009-08-17 18:01:28 (GMT)
committer Don Pellegrino <don@coffee.donpellegrino.com>2009-08-17 18:01:28 (GMT)
commita27f8789e66518fe772083cc4687a408e8e3c2f6 (patch) (side-by-side diff)
tree479872cfa467577f06214e48acf4c67e118853bc
parente415bcfa0167c72529af8f80f25e6dfcd6ecfca0 (diff)
downloadexp005-a27f8789e66518fe772083cc4687a408e8e3c2f6.zip
exp005-a27f8789e66518fe772083cc4687a408e8e3c2f6.tar.gz
exp005-a27f8789e66518fe772083cc4687a408e8e3c2f6.tar.bz2
Removed the exp004 moniker from the objects. The objects now have
generic names based on their function in this program. They are not generally designed for reuse in other visualization programs which seems okay at the moment. I'll leave it up to OpenGL and the APIs to be general while these objects are specific to the task of interactive visualization of a map of influenza.
-rw-r--r--src/Makefile.am30
-rw-r--r--src/controller/actions/clear_selection.sqc4
-rw-r--r--src/controller/actions/process_hits.c4
-rw-r--r--src/controller/actions/sel_save.c6
-rw-r--r--src/controller/actions/sel_save.sqc4
-rw-r--r--src/controller/actions/selection_from_db.sqc4
-rw-r--r--src/controller/actions/set_ortho.c4
-rw-r--r--src/controller/actions/zoom.c4
-rw-r--r--src/controller/callbacks/display.c4
-rw-r--r--src/controller/callbacks/keyboard.c4
-rw-r--r--src/controller/callbacks/mouse.c8
-rw-r--r--src/controller/callbacks/reshape.c4
-rw-r--r--src/flumap.c (renamed from src/exp004viz.c)4
-rw-r--r--src/model/base.c417
-rw-r--r--src/model/base.h9
-rw-r--r--src/model/base.sqc (renamed from src/model/exp004base.sqc)8
-rw-r--r--src/model/exp004base.h9
-rw-r--r--src/model/geometry/density_legend_geometry.c4
-rw-r--r--src/model/geometry/map_geometry.c4
-rw-r--r--src/model/geometry/protein_geometry.c4
-rw-r--r--src/model/geometry/protein_selected_geometry.c4
-rw-r--r--src/model/state.h (renamed from src/model/exp004state.h)8
-rw-r--r--src/view/exp004geometry.h8
-rw-r--r--src/view/exp004init.h9
-rw-r--r--src/view/exp004state0.h8
-rw-r--r--src/view/exp004view.h6
-rw-r--r--src/view/geometry.c (renamed from src/view/exp004geometry.c)8
-rw-r--r--src/view/geometry.h8
-rw-r--r--src/view/init.c (renamed from src/view/exp004init.c)12
-rw-r--r--src/view/init.h9
-rw-r--r--src/view/state0.h8
-rw-r--r--src/view/view.c (renamed from src/view/exp004view.c)10
-rw-r--r--src/view/view.h6
33 files changed, 530 insertions, 113 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 1ccb4f8..e2a3b72 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
-bin_PROGRAMS = exp004viz
+bin_PROGRAMS = flumap
-exp004viz_SOURCES = \
+flumap_SOURCES = \
controller/actions/clear_selection.c \
controller/actions/pan.c \
controller/actions/process_hits.c \
@@ -14,8 +14,8 @@ exp004viz_SOURCES = \
controller/callbacks/mouse_wheel.c \
controller/callbacks/reshape.c \
db/dbconnect.c \
- exp004viz.c \
- model/exp004base.c \
+ flumap.c \
+ model/base.c \
model/geometry/density_legend_geometry.c \
model/geometry/map_geometry.c \
model/geometry/protein_geometry.c \
@@ -26,11 +26,11 @@ exp004viz_SOURCES = \
util/check_error.c \
util/pick_convert.c \
util/sqlinfoprint.c \
- view/exp004geometry.c \
- view/exp004init.c \
- view/exp004view.c
+ view/geometry.c \
+ view/init.c \
+ view/view.c
-exp004viz_LDADD = ${GLUT_LIBS}
+flumap_LDADD = ${GLUT_LIBS}
noinst_HEADERS = \
controller/actions/clear_selection.h \
@@ -47,8 +47,8 @@ noinst_HEADERS = \
controller/callbacks/mouse_wheel.h \
controller/callbacks/reshape.h \
db/dbconnect.h \
- model/exp004base.h \
- model/exp004state.h \
+ model/base.h \
+ model/state.h \
model/geometry/density_legend_geometry.h \
model/geometry/map_geometry.h \
model/geometry/protein_geometry.h \
@@ -62,10 +62,10 @@ noinst_HEADERS = \
util/check_error.h \
util/pick_convert.h \
util/sqlinfoprint.h \
- view/exp004geometry.h \
- view/exp004init.h \
- view/exp004state0.h \
- view/exp004view.h
+ view/geometry.h \
+ view/init.h \
+ view/state0.h \
+ view/view.h
# The Linux non-free driver does not appear to include the
# implementations of the AMD_performance_monitor functions.
@@ -86,4 +86,4 @@ CLEANFILES = \
controller/actions/selection_from_db.c \
controller/actions/sel_save.c \
db/dbconnect.c \
- model/exp004base.c
+ model/base.c
diff --git a/src/controller/actions/clear_selection.sqc b/src/controller/actions/clear_selection.sqc
index e527c30..c496546 100644
--- a/src/controller/actions/clear_selection.sqc
+++ b/src/controller/actions/clear_selection.sqc
@@ -1,7 +1,7 @@
#define GL_GLEXT_PROTOTYPES
#include "clear_selection.h"
#include "../../model/geometry/map_geometry.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include <GL/glut.h>
#include "sqlca.h"
extern struct sqlca sqlca;
@@ -9,7 +9,7 @@ extern struct sqlca sqlca;
/*
* A simple alias to make the code more readable.
*/
-#define S exp004state0
+#define S state0
void
clear_selection (void)
diff --git a/src/controller/actions/process_hits.c b/src/controller/actions/process_hits.c
index 4a76d1c..319ce6c 100644
--- a/src/controller/actions/process_hits.c
+++ b/src/controller/actions/process_hits.c
@@ -1,5 +1,5 @@
#define GL_GLEXT_PROTOTYPES
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include "../../model/geometry/map_geometry.h"
#include "process_hits.h"
#include "sel_save.h"
@@ -7,7 +7,7 @@
/*
* A simple alias to make the code more readable.
*/
-#define S exp004state0
+#define S state0
/*
* The implementation of this function is based on
diff --git a/src/controller/actions/sel_save.c b/src/controller/actions/sel_save.c
index 424f101..9690459 100644
--- a/src/controller/actions/sel_save.c
+++ b/src/controller/actions/sel_save.c
@@ -1,6 +1,6 @@
static char sqla_program_id[292] =
{
- 172,0,65,69,65,78,65,73,108,65,118,119,77,82,73,90,48,49,49,49,
+ 172,0,65,69,65,78,65,73,79,66,73,55,78,82,73,90,48,49,49,49,
49,32,50,32,32,32,32,32,32,32,32,32,8,0,68,79,78,32,32,32,
32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -29,7 +29,7 @@ static const short sqlIsInputHvar = SQL_IS_INPUT_HVAR;
#line 1 "sel_save.sqc"
#include "../../util/check_error.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include "sel_save.h"
#include "sqlca.h"
#include <string.h>
@@ -38,7 +38,7 @@ extern struct sqlca sqlca;
/*
* A simple alias to make the code more readable.
*/
-#define S exp004state0
+#define S state0
void
sel_save (void)
diff --git a/src/controller/actions/sel_save.sqc b/src/controller/actions/sel_save.sqc
index 5fa614f..79fa3de 100644
--- a/src/controller/actions/sel_save.sqc
+++ b/src/controller/actions/sel_save.sqc
@@ -1,5 +1,5 @@
#include "../../util/check_error.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include "sel_save.h"
#include "sqlca.h"
#include <string.h>
@@ -8,7 +8,7 @@ extern struct sqlca sqlca;
/*
* A simple alias to make the code more readable.
*/
-#define S exp004state0
+#define S state0
void
sel_save (void)
diff --git a/src/controller/actions/selection_from_db.sqc b/src/controller/actions/selection_from_db.sqc
index 442f7c2..675bc2c 100644
--- a/src/controller/actions/selection_from_db.sqc
+++ b/src/controller/actions/selection_from_db.sqc
@@ -1,7 +1,7 @@
#define GL_GLEXT_PROTOTYPES
#include "selection_from_db.h"
#include "../../model/geometry/map_geometry.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include "../../util/check_error.h"
#include <GL/glut.h>
#include "sqlca.h"
@@ -10,7 +10,7 @@ extern struct sqlca sqlca;
/*
* A simple alias to make the code more readable.
*/
-#define S exp004state0
+#define S state0
void
selection_from_db (void)
diff --git a/src/controller/actions/set_ortho.c b/src/controller/actions/set_ortho.c
index 83b42f4..4309c76 100644
--- a/src/controller/actions/set_ortho.c
+++ b/src/controller/actions/set_ortho.c
@@ -1,8 +1,8 @@
#include "set_ortho.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include <GL/glut.h>
-#define S exp004state0
+#define S state0
void
set_ortho (void)
diff --git a/src/controller/actions/zoom.c b/src/controller/actions/zoom.c
index e33dcb8..d7f4140 100644
--- a/src/controller/actions/zoom.c
+++ b/src/controller/actions/zoom.c
@@ -1,14 +1,14 @@
#include "zoom.h"
#include "../callbacks/reshape.h"
#include "../../util/check_error.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include <GL/glut.h>
#include <math.h>
/*
* A simple alias to make the code more readable.
*/
-#define S exp004state0
+#define S state0
void
zoom (int x1, int y1, int x2, int y2)
diff --git a/src/controller/callbacks/display.c b/src/controller/callbacks/display.c
index 68211b5..b9a76a6 100644
--- a/src/controller/callbacks/display.c
+++ b/src/controller/callbacks/display.c
@@ -1,12 +1,12 @@
#include "display.h"
-#include "../../view/exp004geometry.h"
+#include "../../view/geometry.h"
#include <GL/glut.h>
void
display (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- exp004geometry (GL_RENDER);
+ geometry (GL_RENDER);
glutSwapBuffers ();
return;
diff --git a/src/controller/callbacks/keyboard.c b/src/controller/callbacks/keyboard.c
index 1187bce..28bea81 100644
--- a/src/controller/callbacks/keyboard.c
+++ b/src/controller/callbacks/keyboard.c
@@ -2,10 +2,10 @@
#include "../actions/clear_selection.h"
#include "../actions/selection_from_db.h"
#include "reshape.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include <GL/glut.h>
-#define S exp004state0
+#define S state0
void
keyboard (unsigned char key, int x, int y)
diff --git a/src/controller/callbacks/mouse.c b/src/controller/callbacks/mouse.c
index fc48eff..16e8b8b 100644
--- a/src/controller/callbacks/mouse.c
+++ b/src/controller/callbacks/mouse.c
@@ -1,7 +1,7 @@
#include "../../util/check_error.h"
#include "../../util/pick_convert.h"
-#include "../../view/exp004geometry.h"
-#include "../../view/exp004state0.h"
+#include "../../view/geometry.h"
+#include "../../view/state0.h"
#include "../actions/process_hits.h"
#include "../actions/set_ortho.h"
#include "../actions/zoom.h"
@@ -14,7 +14,7 @@
/*
* A simple alias to make the code more readable.
*/
-#define S exp004state0
+#define S state0
void
mouse (int button, int state, int x, int y)
@@ -94,7 +94,7 @@ mouse (int button, int state, int x, int y)
* manipulate the name stack so that each primitive of interest
* has appropriate names assigned [Redbook]."
*/
- exp004geometry (GL_SELECT);
+ geometry (GL_SELECT);
glMatrixMode (GL_PROJECTION);
glPopMatrix ();
diff --git a/src/controller/callbacks/reshape.c b/src/controller/callbacks/reshape.c
index da2e2bf..95e9329 100644
--- a/src/controller/callbacks/reshape.c
+++ b/src/controller/callbacks/reshape.c
@@ -1,10 +1,10 @@
#include "../../model/geometry/density_legend_geometry.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include "../actions/set_ortho.h"
#include "reshape.h"
#include <GL/glut.h>
-#define S exp004state0
+#define S state0
void
reshape (int w, int h)
diff --git a/src/exp004viz.c b/src/flumap.c
index 08d5953..6da9c34 100644
--- a/src/exp004viz.c
+++ b/src/flumap.c
@@ -1,5 +1,5 @@
#include <GL/glut.h>
-#include "view/exp004view.h"
+#include "view/view.h"
int
main (int argc, char **argv)
@@ -7,7 +7,7 @@ main (int argc, char **argv)
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
- exp004view ();
+ view ();
glutMainLoop ();
diff --git a/src/model/base.c b/src/model/base.c
new file mode 100644
index 0000000..649fec3
--- a/dev/null
+++ b/src/model/base.c
@@ -0,0 +1,417 @@
+static char sqla_program_id[292] =
+{
+ 172,0,65,69,65,78,65,73,86,65,78,55,78,82,73,90,48,49,49,49,
+ 49,32,50,32,32,32,32,32,32,32,32,32,8,0,68,79,78,32,32,32,
+ 32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,8,0,66,65,83,69,32,32,32,32,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0
+};
+
+#include "sqladef.h"
+
+static struct sqla_runtime_info sqla_rtinfo =
+{{'S','Q','L','A','R','T','I','N'}, sizeof(wchar_t), 0, {' ',' ',' ',' '}};
+
+
+static const short sqlIsLiteral = SQL_IS_LITERAL;
+static const short sqlIsInputHvar = SQL_IS_INPUT_HVAR;
+
+
+#line 1 "base.sqc"
+/* I seem to need this for glGenBuffers as per
+ http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */
+#define GL_GLEXT_PROTOTYPES
+
+#include "base.h"
+#include "../view/state0.h"
+#include "../util/check_error.h"
+#include <GL/glut.h>
+#include <string.h>
+#include <stdlib.h>
+#include "sqlca.h"
+extern struct sqlca sqlca;
+
+/*
+ * A simple alias to make the code more readable.
+ */
+#define S state0
+
+void
+base (void)
+{
+ /*
+ * This implementation can be improved by mapping the video memory
+ * directly rather than loading into system memory and then copying
+ * into video memory.
+ */
+
+ /*
+ * db2dclgn -d exp004 -t coordinates
+ */
+
+/*
+EXEC SQL BEGIN DECLARE SECTION;
+*/
+
+#line 31 "base.sqc"
+
+
+/*
+EXEC SQL INCLUDE 'model/coordinates.h';
+*/
+
+#line 1 "/home/don/projects/Research/Experiments/exp005/src/model/coordinates.h"
+struct
+{
+ sqlint32 coord_id;
+ struct
+ {
+ short length;
+ char data[50];
+ } gi;
+ double x;
+ double y;
+} coordinates;
+
+#line 32 "base.sqc"
+
+ sqlint32 rows;
+
+/*
+EXEC SQL END DECLARE SECTION;
+*/
+
+#line 34 "base.sqc"
+
+
+ /* Determine how many nodes have coordinates assigned to them. */
+
+/*
+EXEC SQL SELECT COUNT (*) INTO:rows FROM coordinates;
+*/
+
+{
+#line 37 "base.sqc"
+ sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
+#line 37 "base.sqc"
+ sqlaaloc(3,1,1,0L);
+ {
+ struct sqla_setdata_list sql_setdlist[1];
+#line 37 "base.sqc"
+ sql_setdlist[0].sqltype = 496; sql_setdlist[0].sqllen = 4;
+#line 37 "base.sqc"
+ sql_setdlist[0].sqldata = (void*)&rows;
+#line 37 "base.sqc"
+ sql_setdlist[0].sqlind = 0L;
+#line 37 "base.sqc"
+ sqlasetdata(3,0,1,sql_setdlist,0L,0L);
+ }
+#line 37 "base.sqc"
+ sqlacall((unsigned short)24,1,0,3,0L);
+#line 37 "base.sqc"
+ sqlastop(0L);
+}
+
+#line 37 "base.sqc"
+
+
+ /* Free any existing coordinates and allocate memory to store the
+ new values. */
+ S.rows = rows;
+
+ free (S.selection.set);
+ S.selection.set = calloc (rows, sizeof (bool));
+
+ free (S.gi_data);
+ S.gi_data = calloc (rows, sizeof (char) * 20);
+
+ free (S.base_vertices_data);
+ S.base_vertices_data = calloc (rows, sizeof (float) * 2);
+
+ free (S.base_colors_data);
+ S.base_colors_data = calloc (rows, sizeof (float) * 4);
+
+
+/*
+EXEC SQL DECLARE c2 CURSOR FOR SELECT *FROM coordinates;
+*/
+
+#line 55 "base.sqc"
+
+
+
+/*
+EXEC SQL OPEN c2;
+*/
+
+{
+#line 57 "base.sqc"
+ sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
+#line 57 "base.sqc"
+ sqlacall((unsigned short)26,2,0,0,0L);
+#line 57 "base.sqc"
+ sqlastop(0L);
+}
+
+#line 57 "base.sqc"
+
+
+ /*
+ * Initialize the bounding box of the points.
+ */
+ S.bb.min_x = 0.0;
+ S.bb.max_x = 0.0;
+ S.bb.min_y = 0.0;
+ S.bb.max_y = 0.0;
+
+
+/*
+EXEC SQL FETCH c2 INTO:coordinates;
+*/
+
+{
+#line 67 "base.sqc"
+ sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
+#line 67 "base.sqc"
+ sqlaaloc(3,4,2,0L);
+ {
+ struct sqla_setdata_list sql_setdlist[4];
+#line 67 "base.sqc"
+ sql_setdlist[0].sqltype = 496; sql_setdlist[0].sqllen = 4;
+#line 67 "base.sqc"
+ sql_setdlist[0].sqldata = (void*)&coordinates.coord_id;
+#line 67 "base.sqc"
+ sql_setdlist[0].sqlind = 0L;
+#line 67 "base.sqc"
+ sql_setdlist[1].sqltype = 448; sql_setdlist[1].sqllen = 50;
+#line 67 "base.sqc"
+ sql_setdlist[1].sqldata = (void*)&coordinates.gi;
+#line 67 "base.sqc"
+ sql_setdlist[1].sqlind = 0L;
+#line 67 "base.sqc"
+ sql_setdlist[2].sqltype = 480; sql_setdlist[2].sqllen = 8;
+#line 67 "base.sqc"
+ sql_setdlist[2].sqldata = (void*)&coordinates.x;
+#line 67 "base.sqc"
+ sql_setdlist[2].sqlind = 0L;
+#line 67 "base.sqc"
+ sql_setdlist[3].sqltype = 480; sql_setdlist[3].sqllen = 8;
+#line 67 "base.sqc"
+ sql_setdlist[3].sqldata = (void*)&coordinates.y;
+#line 67 "base.sqc"
+ sql_setdlist[3].sqlind = 0L;
+#line 67 "base.sqc"
+ sqlasetdata(3,0,4,sql_setdlist,0L,0L);
+ }
+#line 67 "base.sqc"
+ sqlacall((unsigned short)25,2,0,3,0L);
+#line 67 "base.sqc"
+ sqlastop(0L);
+}
+
+#line 67 "base.sqc"
+
+ while (sqlca.sqlcode != 100)
+ {
+ int i = coordinates.coord_id - 1;
+
+ strncpy (S.gi_data + i, coordinates.gi.data, sizeof (S.gi_data[i]));
+
+ float *v = S.base_vertices_data + (i * 2);
+ *v = coordinates.x;
+ v++;
+ *v = coordinates.y;
+
+ v = S.base_vertices_data + (i * 2);
+ if (*v < S.bb.min_x)
+ S.bb.min_x = *v;
+ if (*v > S.bb.max_x)
+ S.bb.max_x = *v;
+
+ v++;
+ if (*v < S.bb.min_y)
+ S.bb.min_y = *v;
+ if (*v > S.bb.max_y)
+ S.bb.max_y = *v;
+
+ /*
+ * Deselected by default.
+ */
+ S.selection.set[i] = false;
+
+ float *c = S.base_colors_data + (i * 4);
+ *c = DEFAULT_COLOR_R;
+ c++;
+ *c = DEFAULT_COLOR_G;
+ c++;
+ *c = DEFAULT_COLOR_B;
+ c++;
+ *c = DEFAULT_COLOR_A;
+
+
+/*
+EXEC SQL FETCH c2 INTO:coordinates;
+*/
+
+{
+#line 105 "base.sqc"
+ sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
+#line 105 "base.sqc"
+ sqlaaloc(3,4,3,0L);
+ {
+ struct sqla_setdata_list sql_setdlist[4];
+#line 105 "base.sqc"
+ sql_setdlist[0].sqltype = 496; sql_setdlist[0].sqllen = 4;
+#line 105 "base.sqc"
+ sql_setdlist[0].sqldata = (void*)&coordinates.coord_id;
+#line 105 "base.sqc"
+ sql_setdlist[0].sqlind = 0L;
+#line 105 "base.sqc"
+ sql_setdlist[1].sqltype = 448; sql_setdlist[1].sqllen = 50;
+#line 105 "base.sqc"
+ sql_setdlist[1].sqldata = (void*)&coordinates.gi;
+#line 105 "base.sqc"
+ sql_setdlist[1].sqlind = 0L;
+#line 105 "base.sqc"
+ sql_setdlist[2].sqltype = 480; sql_setdlist[2].sqllen = 8;
+#line 105 "base.sqc"
+ sql_setdlist[2].sqldata = (void*)&coordinates.x;
+#line 105 "base.sqc"
+ sql_setdlist[2].sqlind = 0L;
+#line 105 "base.sqc"
+ sql_setdlist[3].sqltype = 480; sql_setdlist[3].sqllen = 8;
+#line 105 "base.sqc"
+ sql_setdlist[3].sqldata = (void*)&coordinates.y;
+#line 105 "base.sqc"
+ sql_setdlist[3].sqlind = 0L;
+#line 105 "base.sqc"
+ sqlasetdata(3,0,4,sql_setdlist,0L,0L);
+ }
+#line 105 "base.sqc"
+ sqlacall((unsigned short)25,2,0,3,0L);
+#line 105 "base.sqc"
+ sqlastop(0L);
+}
+
+#line 105 "base.sqc"
+
+ }
+
+
+/*
+EXEC SQL CLOSE c2;
+*/
+
+{
+#line 108 "base.sqc"
+ sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
+#line 108 "base.sqc"
+ sqlacall((unsigned short)20,2,0,0,0L);
+#line 108 "base.sqc"
+ sqlastop(0L);
+}
+
+#line 108 "base.sqc"
+
+
+
+/*
+EXEC SQL COMMIT;
+*/
+
+{
+#line 110 "base.sqc"
+ sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca);
+#line 110 "base.sqc"
+ sqlacall((unsigned short)21,0,0,0,0L);
+#line 110 "base.sqc"
+ sqlastop(0L);
+}
+
+#line 110 "base.sqc"
+
+
+ /*
+ * Find the largest axis and use it to setup the projection. This
+ * is done to preserve the aspect ratio. The aspect ratio should be
+ * preserved since relative distance is a meaningful indicator in
+ * the map.
+ */
+
+ // Min of min x or min y.
+ if (S.bb.min_x <= S.bb.min_y)
+ S.ortho_min = S.bb.min_x;
+ else
+ S.ortho_min = S.bb.min_y;
+ S.ortho_min--;
+
+ // Max of max x or max y.
+ if (S.bb.max_x >= S.bb.max_y)
+ S.ortho_max = S.bb.max_x;
+ else
+ S.ortho_max = S.bb.max_y;
+ S.ortho_max++;
+
+ // Invert the y coordinate to match up with the LGL Java viewer.
+ float *v = S.base_vertices_data;
+ for (int i = 0; i < S.rows; i++)
+ {
+ v++;
+ *v = S.ortho_max - *v;
+ v++;
+ }
+
+ // Move the origin (0,0) to the center of the data.
+ S.ortho_min = 0.0;
+ S.ortho_max = 0.0;
+
+ v = S.base_vertices_data;
+ for (int i = 0; i < S.rows; i++)
+ {
+ *v = *v - (0.5 * (S.bb.max_x - S.bb.min_x));
+
+ if (S.ortho_min > *v)
+ S.ortho_min = *v;
+
+ if (S.ortho_max < *v)
+ S.ortho_max = *v;
+
+ v++;
+
+ *v = *v - (0.5 * (S.bb.max_y - S.bb.min_y));
+
+ if (S.ortho_min > *v)
+ S.ortho_min = *v;
+
+ if (S.ortho_max < *v)
+ S.ortho_max = *v;
+
+ v++;
+ }
+
+ glGenBuffers (2, S.buffers);
+
+ glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_VERTICES]);
+ glVertexPointer (2, GL_FLOAT, 0, 0);
+ glBufferData (GL_ARRAY_BUFFER,
+ sizeof (S.base_vertices_data), S.base_vertices_data,
+ GL_STATIC_DRAW);
+
+ glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]);
+ glColorPointer (4, GL_FLOAT, 0, 0);
+ glBufferData (GL_ARRAY_BUFFER,
+ sizeof (S.base_colors_data), S.base_colors_data,
+ GL_STATIC_DRAW);
+
+ return;
+}
diff --git a/src/model/base.h b/src/model/base.h
new file mode 100644
index 0000000..5b7bd0b
--- a/dev/null
+++ b/src/model/base.h
@@ -0,0 +1,9 @@
+#ifndef BASE_H
+#define BASE_H
+
+/*
+ * Build the base layer of the map.
+ */
+void base (void);
+
+#endif // BASE_H
diff --git a/src/model/exp004base.sqc b/src/model/base.sqc
index 4f3d06c..901ccd7 100644
--- a/src/model/exp004base.sqc
+++ b/src/model/base.sqc
@@ -2,8 +2,8 @@
http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */
#define GL_GLEXT_PROTOTYPES
-#include "exp004base.h"
-#include "../view/exp004state0.h"
+#include "base.h"
+#include "../view/state0.h"
#include "../util/check_error.h"
#include <GL/glut.h>
#include <string.h>
@@ -14,10 +14,10 @@ extern struct sqlca sqlca;
/*
* A simple alias to make the code more readable.
*/
-#define S exp004state0
+#define S state0
void
-exp004base (void)
+base (void)
{
/*
* This implementation can be improved by mapping the video memory
diff --git a/src/model/exp004base.h b/src/model/exp004base.h
deleted file mode 100644
index 4f8492d..0000000
--- a/src/model/exp004base.h
+++ b/dev/null
@@ -1,9 +0,0 @@
-#ifndef EXP004BASE_H
-#define EXP004BASE_H
-
-/*
- * Build the base layer of the map.
- */
-void exp004base (void);
-
-#endif // EXP004BASE_H
diff --git a/src/model/geometry/density_legend_geometry.c b/src/model/geometry/density_legend_geometry.c
index ed34b8d..c437517 100644
--- a/src/model/geometry/density_legend_geometry.c
+++ b/src/model/geometry/density_legend_geometry.c
@@ -1,9 +1,9 @@
#include "../../controller/callbacks/reshape.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include "density_legend_geometry.h"
#include <GL/glut.h>
-#define S exp004state0
+#define S state0
void
density_legend_geometry (void)
diff --git a/src/model/geometry/map_geometry.c b/src/model/geometry/map_geometry.c
index 72bc747..8bc79a3 100644
--- a/src/model/geometry/map_geometry.c
+++ b/src/model/geometry/map_geometry.c
@@ -1,8 +1,8 @@
#include "map_geometry.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include <GL/glut.h>
-#define S exp004state0
+#define S state0
void
map_geometry (void)
diff --git a/src/model/geometry/protein_geometry.c b/src/model/geometry/protein_geometry.c
index 30a4350..f2b3e4f 100644
--- a/src/model/geometry/protein_geometry.c
+++ b/src/model/geometry/protein_geometry.c
@@ -1,8 +1,8 @@
#include "protein_geometry.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include <GL/glut.h>
-#define S exp004state0
+#define S state0
void
protein_geometry (void)
diff --git a/src/model/geometry/protein_selected_geometry.c b/src/model/geometry/protein_selected_geometry.c
index fb37085..abc1706 100644
--- a/src/model/geometry/protein_selected_geometry.c
+++ b/src/model/geometry/protein_selected_geometry.c
@@ -1,8 +1,8 @@
#include "protein_selected_geometry.h"
-#include "../../view/exp004state0.h"
+#include "../../view/state0.h"
#include <GL/glut.h>
-#define S exp004state0
+#define S state0
void
protein_selected_geometry (void)
diff --git a/src/model/exp004state.h b/src/model/state.h
index 1173f87..71185c8 100644
--- a/src/model/exp004state.h
+++ b/src/model/state.h
@@ -1,5 +1,5 @@
-#ifndef EXP004STATE_H
-#define EXP004STATE_H
+#ifndef STATE_H
+#define STATE_H
#include "selection_info.h"
#include "zoom_info.h"
@@ -114,6 +114,6 @@ typedef struct
*/
bool legend;
-} EXP004STATE;
+} STATE;
-#endif // EXP004STATE_H
+#endif // STATE_H
diff --git a/src/view/exp004geometry.h b/src/view/exp004geometry.h
deleted file mode 100644
index 582be48..0000000
--- a/src/view/exp004geometry.h
+++ b/dev/null
@@ -1,8 +0,0 @@
-#ifndef EXP004GEOMETRY_H
-#define EXP004GEOMETRY_H
-
-#include <GL/glut.h>
-
-void exp004geometry (GLenum mode);
-
-#endif // EXP004GEOMETRY_H
diff --git a/src/view/exp004init.h b/src/view/exp004init.h
deleted file mode 100644
index 5431c9f..0000000
--- a/src/view/exp004init.h
+++ b/dev/null
@@ -1,9 +0,0 @@
-#ifndef EXP004INIT_H
-#define EXP004INIT_H
-
-/*
- * Initialize state variables to default values.
- */
-void exp004init (void);
-
-#endif // EXP004INIT
diff --git a/src/view/exp004state0.h b/src/view/exp004state0.h
deleted file mode 100644
index 2b60ce9..0000000
--- a/src/view/exp004state0.h
+++ b/dev/null
@@ -1,8 +0,0 @@
-#ifndef EXP004STATE0_H
-#define EXP004STATE0_H
-
-#include "../model/exp004state.h"
-
-EXP004STATE exp004state0;
-
-#endif // EXP004STATE0_H
diff --git a/src/view/exp004view.h b/src/view/exp004view.h
deleted file mode 100644
index 0086f53..0000000
--- a/src/view/exp004view.h
+++ b/dev/null
@@ -1,6 +0,0 @@
-#ifndef EXP004VIEW_H
-#define EXP004VIEW_H
-
-void exp004view (void);
-
-#endif // EXP004VIEW_H
diff --git a/src/view/exp004geometry.c b/src/view/geometry.c
index 76f39bb..7a3ed36 100644
--- a/src/view/exp004geometry.c
+++ b/src/view/geometry.c
@@ -1,12 +1,12 @@
#define GL_GLEXT_PROTOTYPES
-#include "exp004geometry.h"
-#include "exp004state0.h"
+#include "geometry.h"
+#include "state0.h"
#include <GL/glut.h>
-#define S exp004state0
+#define S state0
void
-exp004geometry (GLenum mode)
+geometry (GLenum mode)
{
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
diff --git a/src/view/geometry.h b/src/view/geometry.h
new file mode 100644
index 0000000..e4d0e48
--- a/dev/null
+++ b/src/view/geometry.h
@@ -0,0 +1,8 @@
+#ifndef GEOMETRY_H
+#define GEOMETRY_H
+
+#include <GL/glut.h>
+
+void geometry (GLenum mode);
+
+#endif // GEOMETRY_H
diff --git a/src/view/exp004init.c b/src/view/init.c
index af66623..e32a75e 100644
--- a/src/view/exp004init.c
+++ b/src/view/init.c
@@ -1,18 +1,18 @@
-#include "exp004init.h"
-#include "exp004state0.h"
+#include "init.h"
+#include "state0.h"
#include "../model/geometry/density_legend_geometry.h"
#include "../model/geometry/map_geometry.h"
#include "../model/geometry/protein_geometry.h"
#include "../model/geometry/protein_selected_geometry.h"
#include "../model/selection_info_init.h"
#include "../model/zoom_info_init.h"
-#include "../model/exp004base.h"
+#include "../model/base.h"
#include <GL/glut.h>
-#define S exp004state0
+#define S state0
void
-exp004init (void)
+init (void)
{
/*
* Initialize default values, zero memory and NULL pointers.
@@ -28,7 +28,7 @@ exp004init (void)
/*
* Load the data.
*/
- exp004base ();
+ base ();
/*
* Create the geometry based on the data.
diff --git a/src/view/init.h b/src/view/init.h
new file mode 100644
index 0000000..eeacf19
--- a/dev/null
+++ b/src/view/init.h
@@ -0,0 +1,9 @@
+#ifndef INIT_H
+#define INIT_H
+
+/*
+ * Initialize state variables to default values.
+ */
+void init (void);
+
+#endif // INIT_H
diff --git a/src/view/state0.h b/src/view/state0.h
new file mode 100644
index 0000000..071e3ff
--- a/dev/null
+++ b/src/view/state0.h
@@ -0,0 +1,8 @@
+#ifndef STATE0_H
+#define STATE0_H
+
+#include "../model/state.h"
+
+STATE state0;
+
+#endif // STATE0_H
diff --git a/src/view/exp004view.c b/src/view/view.c
index b16597d..db3be6d 100644
--- a/src/view/exp004view.c
+++ b/src/view/view.c
@@ -4,15 +4,15 @@
#include "../controller/callbacks/mouse_wheel.h"
#include "../controller/callbacks/reshape.h"
#include "../db/dbconnect.h"
-#include "exp004init.h"
-#include "exp004state0.h"
-#include "exp004view.h"
+#include "init.h"
+#include "state0.h"
+#include "view.h"
#include <GL/freeglut.h>
#include <GL/freeglut_ext.h>
#include <GL/glut.h>
void
-exp004view (void)
+view (void)
{
// Connect to the database.
dbconnect ();
@@ -42,7 +42,7 @@ exp004view (void)
glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
// Initialize the model.
- exp004init ();
+ init ();
// Callbacks
glutDisplayFunc (display);
diff --git a/src/view/view.h b/src/view/view.h
new file mode 100644
index 0000000..29161c7
--- a/dev/null
+++ b/src/view/view.h
@@ -0,0 +1,6 @@
+#ifndef VIEW_H
+#define VIEW_H
+
+void view (void);
+
+#endif // VIEW_H

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.