From fa2a426396c9031a5379c746a665c3a5dd4af8e4 Mon Sep 17 00:00:00 2001 From: Don Pellegrino Date: Thu, 23 Jul 2009 18:09:48 +0000 Subject: Moved model geometry into a subdirectory of model. Modified highlight for selection to draw a yello circle around the selected proteins rather than change their fill color to black. This preserves the fill color of selected items. --- diff --git a/src/Makefile.am b/src/Makefile.am index 6e20122..38626c7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,10 +12,11 @@ exp004viz_SOURCES = \ controller/set_ortho.c \ db/dbconnect.c \ exp004viz.c \ - model/density_legend_geometry.c \ model/exp004base.c \ - model/map_geometry.c \ - model/protein_geometry.c \ + model/geometry/density_legend_geometry.c \ + model/geometry/map_geometry.c \ + model/geometry/protein_geometry.c \ + model/geometry/protein_selected_geometry.c \ model/selection_info_init.c \ model/zoom_info_init.c \ util/ati_meminfo.c \ @@ -39,11 +40,12 @@ noinst_HEADERS = \ controller/selsave.h \ controller/set_ortho.h \ db/dbconnect.h \ - model/density_legend_geometry.h \ model/exp004base.h \ model/exp004state.h \ - model/map_geometry.h \ - model/protein_geometry.h \ + model/geometry/density_legend_geometry.h \ + model/geometry/protein_geometry.h \ + model/geometry/protein_selected_geometry.h \ + model/geometry/map_geometry.h \ model/selection_info.h \ model/selection_info_init.h \ model/selection_purposes.h \ diff --git a/src/controller/clear_selection.sqc b/src/controller/clear_selection.sqc index ec98b4c..b4ff0a3 100644 --- a/src/controller/clear_selection.sqc +++ b/src/controller/clear_selection.sqc @@ -1,6 +1,6 @@ #define GL_GLEXT_PROTOTYPES #include "clear_selection.h" -#include "../model/map_geometry.h" +#include "../model/geometry/map_geometry.h" #include "../view/exp004state0.h" #include #include "sqlca.h" diff --git a/src/controller/exp004processhits.c b/src/controller/exp004processhits.c index 72daa2f..c9ae080 100644 --- a/src/controller/exp004processhits.c +++ b/src/controller/exp004processhits.c @@ -1,6 +1,6 @@ #define GL_GLEXT_PROTOTYPES #include "../view/exp004state0.h" -#include "../model/map_geometry.h" +#include "../model/geometry/map_geometry.h" #include "exp004processhits.h" #include "selsave.h" @@ -14,7 +14,7 @@ * [Angel,2008,pp80-81]. */ void -exp004processhits (const GLint hits, const GLuint* hitlist) +exp004processhits (const GLint hits, const GLuint * hitlist) { for (unsigned int i = 0; i < hits; i++) { @@ -24,10 +24,12 @@ exp004processhits (const GLint hits, const GLuint* hitlist) * Add the hits to the selection. */ S.selection.set[*hitlist] = true; + /* S.base_colors_data[*hitlist][0] = SELECT_COLOR_R; S.base_colors_data[*hitlist][1] = SELECT_COLOR_G; S.base_colors_data[*hitlist][2] = SELECT_COLOR_B; S.base_colors_data[*hitlist][3] = SELECT_COLOR_A; + */ hitlist++; } diff --git a/src/controller/exp004processhits.h b/src/controller/exp004processhits.h index b0e088a..0cc9e4b 100644 --- a/src/controller/exp004processhits.h +++ b/src/controller/exp004processhits.h @@ -3,6 +3,6 @@ #include -void exp004processhits (const GLint hits, const GLuint *hitlist); +void exp004processhits (const GLint hits, const GLuint * hitlist); #endif // EXP004PROCESSHITS_H diff --git a/src/controller/exp004reshape.c b/src/controller/exp004reshape.c index 891de08..a127e46 100644 --- a/src/controller/exp004reshape.c +++ b/src/controller/exp004reshape.c @@ -1,7 +1,7 @@ #include "exp004reshape.h" #include "set_ortho.h" #include "../view/exp004state0.h" -#include "../model/density_legend_geometry.h" +#include "../model/geometry/density_legend_geometry.h" #include #define S exp004state0 diff --git a/src/controller/selection_from_db.sqc b/src/controller/selection_from_db.sqc index 3bde460..755c9c9 100644 --- a/src/controller/selection_from_db.sqc +++ b/src/controller/selection_from_db.sqc @@ -1,6 +1,6 @@ #define GL_GLEXT_PROTOTYPES #include "selection_from_db.h" -#include "../model/map_geometry.h" +#include "../model/geometry/map_geometry.h" #include "../view/exp004state0.h" #include "../util/check_error.h" #include diff --git a/src/model/exp004state.h b/src/model/exp004state.h index 6f9aad7..f6e99c0 100644 --- a/src/model/exp004state.h +++ b/src/model/exp004state.h @@ -24,7 +24,8 @@ #define SELECT_COLOR_A 0.75 typedef enum -{ PROTEIN_GEOMETRY, DENSITY_LEGEND_GEOMETRY, MAP_GEOMETRY } LISTS; +{ PROTEIN_GEOMETRY, PROTEIN_SELECTED_GEOMETRY, DENSITY_LEGEND_GEOMETRY, + MAP_GEOMETRY } LISTS; #define NUM_LISTS 2 /* diff --git a/src/model/density_legend_geometry.c b/src/model/geometry/density_legend_geometry.c index 7e30de8..83f34d9 100644 --- a/src/model/density_legend_geometry.c +++ b/src/model/geometry/density_legend_geometry.c @@ -1,6 +1,6 @@ #include "density_legend_geometry.h" -#include "../view/exp004state0.h" -#include "../controller/exp004reshape.h" +#include "../../view/exp004state0.h" +#include "../../controller/exp004reshape.h" #include #define S exp004state0 diff --git a/src/model/density_legend_geometry.h b/src/model/geometry/density_legend_geometry.h index 4745ac0..4745ac0 100644 --- a/src/model/density_legend_geometry.h +++ b/src/model/geometry/density_legend_geometry.h diff --git a/src/model/geometry/map_geometry.c b/src/model/geometry/map_geometry.c new file mode 100644 index 0000000..63e409d --- a/dev/null +++ b/src/model/geometry/map_geometry.c @@ -0,0 +1,40 @@ +#include "map_geometry.h" +#include "../../view/exp004state0.h" +#include + +#define S exp004state0 + +void +map_geometry (void) +{ + glNewList (S.list_offset + MAP_GEOMETRY, GL_COMPILE); + glPolygonMode (GL_FRONT, GL_FILL); + + for (int i = 0; i < ROWS; i++) + { + glLoadName (i); + + // Draw the protein geometry. + glPushMatrix (); + glTranslatef (S.base_vertices_data[i][0], + S.base_vertices_data[i][1], 0.0); + glColor4fv (S.base_colors_data[i]); + glCallList (S.list_offset + PROTEIN_GEOMETRY); + glPopMatrix (); + + // If the object is selected, draw the selection geometry. + if (S.selection.set[i]) + { + glPushMatrix (); + glTranslatef (S.base_vertices_data[i][0], + S.base_vertices_data[i][1], 0.0); + glColor4f (0.5, 0.5, 0.5, 1.0); + glCallList (S.list_offset + PROTEIN_SELECTED_GEOMETRY); + glPopMatrix (); + } + } + + glEndList (); + + return; +} diff --git a/src/model/map_geometry.h b/src/model/geometry/map_geometry.h index f5b6701..f5b6701 100644 --- a/src/model/map_geometry.h +++ b/src/model/geometry/map_geometry.h diff --git a/src/model/protein_geometry.c b/src/model/geometry/protein_geometry.c index dc71a4e..30a4350 100644 --- a/src/model/protein_geometry.c +++ b/src/model/geometry/protein_geometry.c @@ -1,5 +1,5 @@ #include "protein_geometry.h" -#include "../view/exp004state0.h" +#include "../../view/exp004state0.h" #include #define S exp004state0 diff --git a/src/model/protein_geometry.h b/src/model/geometry/protein_geometry.h index e9ac0db..e9ac0db 100644 --- a/src/model/protein_geometry.h +++ b/src/model/geometry/protein_geometry.h diff --git a/src/model/geometry/protein_selected_geometry.c b/src/model/geometry/protein_selected_geometry.c new file mode 100644 index 0000000..fb37085 --- a/dev/null +++ b/src/model/geometry/protein_selected_geometry.c @@ -0,0 +1,30 @@ +#include "protein_selected_geometry.h" +#include "../../view/exp004state0.h" +#include + +#define S exp004state0 + +void +protein_selected_geometry (void) +{ + GLUquadricObj *obj = gluNewQuadric (); + gluQuadricDrawStyle (obj, GLU_FILL); + + glNewList (S.list_offset + PROTEIN_SELECTED_GEOMETRY, GL_COMPILE); + + glColor4f (255.0, 255.0, 0.0, 0.8); + + /* + * The radius of this disk is relative to the radius of the sphere + * used for the protein geometry however this dependency is not captured + * in the code. Perhaps a variable radius for the proteins should be + * defined in the state object. + */ + gluDisk (obj, 0.04, 0.05, 20, 20); + + glEndList (); + + gluDeleteQuadric (obj); + + return; +} diff --git a/src/model/geometry/protein_selected_geometry.h b/src/model/geometry/protein_selected_geometry.h new file mode 100644 index 0000000..16cf956 --- a/dev/null +++ b/src/model/geometry/protein_selected_geometry.h @@ -0,0 +1,9 @@ +#ifndef PROTEIN_SELECTED_GEOMETRY_H +#define PROTEIN_SELECTED_GEOMETRY_H + +/* + * Geometry to use for proteins in the active selection. + */ +void protein_selected_geometry (void); + +#endif // PROTEIN_SELECTED_GEOMETRY_H diff --git a/src/model/map_geometry.c b/src/model/map_geometry.c deleted file mode 100644 index 055eb83..0000000 --- a/src/model/map_geometry.c +++ b/dev/null @@ -1,27 +0,0 @@ -#include "map_geometry.h" -#include "../view/exp004state0.h" -#include - -#define S exp004state0 - -void -map_geometry (void) -{ - glNewList (S.list_offset + MAP_GEOMETRY, GL_COMPILE); - glPolygonMode (GL_FRONT, GL_FILL); - - for (int i = 0; i < ROWS; i++) - { - glLoadName (i); - glPushMatrix (); - glTranslatef (S.base_vertices_data[i][0], - S.base_vertices_data[i][1], 0.0); - glColor4fv (S.base_colors_data[i]); - glCallList (S.list_offset + PROTEIN_GEOMETRY); - glPopMatrix (); - } - - glEndList (); - - return; -} diff --git a/src/model/selection_info_init.c b/src/model/selection_info_init.c index aea2b07..33b3bb5 100644 --- a/src/model/selection_info_init.c +++ b/src/model/selection_info_init.c @@ -3,7 +3,7 @@ void selection_info_init (SELECTION_INFO * s) -{ +{ memset (s->set, 0, sizeof (bool) * ROWS); s->active = false; s->purpose = SET; diff --git a/src/view/exp004init.c b/src/view/exp004init.c index 78311e6..30d8d96 100644 --- a/src/view/exp004init.c +++ b/src/view/exp004init.c @@ -1,8 +1,9 @@ #include "exp004init.h" #include "exp004state0.h" -#include "../model/density_legend_geometry.h" -#include "../model/map_geometry.h" -#include "../model/protein_geometry.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 @@ -18,6 +19,7 @@ exp004init (void) S.list_offset = glGenLists (NUM_LISTS); protein_geometry (); + protein_selected_geometry (); density_legend_geometry (); map_geometry (); -- cgit v0.8.3.1-22-g547a