[cig-commits] commit: making the lucTitle coder cleaner - and adding the ability to move the title up and down.
Mercurial
hg at geodynamics.org
Mon Nov 24 11:29:39 PST 2008
changeset: 84:9dac68cbae64
user: rob at hijiki.maths.monash.edu.au
date: Fri Oct 17 17:44:02 2008 +1100
files: Base/src/DrawingObject.c Base/src/DrawingObject.h DrawingObjects/src/Isosurface.meta DrawingObjects/src/OpenGLDrawingObject.meta DrawingObjects/src/SwarmViewerBase.meta DrawingObjects/src/Title.c DrawingObjects/src/Title.h DrawingObjects/src/Title.meta DrawingObjects/src/VectorArrowCrossSection.meta DrawingObjects/src/VectorArrows.meta RenderingEngines/src/RenderingEngineGL.meta
description:
making the lucTitle coder cleaner - and adding the ability to move the title up and down.
Filling out meta files:
./gLucifer/DrawingObjects/src/Isosurface.meta
./gLucifer/DrawingObjects/src/ColourBar.meta
./gLucifer/DrawingObjects/src/TextureMap.meta
./gLucifer/DrawingObjects/src/FieldVariableBorder.meta
./gLucifer/DrawingObjects/src/Title.meta
./gLucifer/DrawingObjects/src/OpenGLDrawingObject.meta
./gLucifer/DrawingObjects/src/VectorArrows.meta
./gLucifer/DrawingObjects/src/VectorArrowCrossSection.meta
diff -r 193c1ca844e0 -r 9dac68cbae64 Base/src/DrawingObject.c
--- a/Base/src/DrawingObject.c Thu Oct 09 15:36:15 2008 +1100
+++ b/Base/src/DrawingObject.c Fri Oct 17 17:44:02 2008 +1100
@@ -214,8 +214,8 @@ void lucDrawingObjectMask_Construct( luc
maskTypeName = Stg_ComponentFactory_GetString( cf, drawingObjectName, "maskType", "GreaterThan" );
if ( strcasecmp( maskTypeName, "GreaterThan" ) == 0 )
self->type = GreaterThan;
- else if ( strcasecmp( maskTypeName, "LesserThan" ) == 0 )
- self->type = LesserThan;
+ else if ( strcasecmp( maskTypeName, "LesserThan" ) == 0 || strcasecmp( maskTypeName, "LessThan" ) == 0 )
+ self->type = LessThan;
else if ( strcasecmp( maskTypeName, "EqualTo" ) == 0 )
self->type = EqualTo;
else {
@@ -232,7 +232,7 @@ Bool lucDrawingObjectMask_Test( lucDrawi
if (value > maskValue)
return True;
return False;
- case LesserThan:
+ case LessThan:
if (value < maskValue)
return True;
return False;
diff -r 193c1ca844e0 -r 9dac68cbae64 Base/src/DrawingObject.h
--- a/Base/src/DrawingObject.h Thu Oct 09 15:36:15 2008 +1100
+++ b/Base/src/DrawingObject.h Fri Oct 17 17:44:02 2008 +1100
@@ -105,7 +105,7 @@ void _lucDrawingObject_Construct( void*
void lucDrawingObject_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* context ) ;
void lucDrawingObject_CleanUp( void* drawingObject, void* context ) ;
- typedef enum { GreaterThan, LesserThan, EqualTo } lucDrawingObjectMask_Type;
+ typedef enum { GreaterThan, LessThan, EqualTo } lucDrawingObjectMask_Type;
typedef struct {
lucDrawingObjectMask_Type type;
double value;
diff -r 193c1ca844e0 -r 9dac68cbae64 DrawingObjects/src/Isosurface.meta
--- a/DrawingObjects/src/Isosurface.meta Thu Oct 09 15:36:15 2008 +1100
+++ b/DrawingObjects/src/Isosurface.meta Fri Oct 17 17:44:02 2008 +1100
@@ -3,7 +3,7 @@
<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
<param name="Name">lucIsosurface</param>
-<param name="Author">...</param>
+<param name="Author">Robert Turnbull</param>
<param name="Organisation">MCC</param>
<param name="Project">gLucifer</param>
<param name="Location">./gLucifer/DrawingObjects/src/</param>
@@ -11,9 +11,9 @@
<param name="Copyright">Copyright (c) 2005, Monash Cluster Computing</param>
<param name="License">http://www.opensource.org/licenses/bsd-license.php</param>
<param name="Parent">lucOpenGLDrawingObject</param>
-<param name="Reference">...</param>
+<param name="Reference">Lorensen, William and Harvey E. Cline. Marching Cubes: A High Resolution 3D Surface Construction Algorithm. Computer Graphics (SIGGRAPH 87 Proceedings) 21(4) July 1987, p. 163-170)</param>
<param name="Summary">...</param>
-<param name="Description">Visualises a scalar field in 3D by the use of a surface over which all the values of the field are constant (an isosurface). It gets the value of the field on a 3D grid and uses the Marching Cubes algorithm to construct the surface. This algorithm is described in Lorensen, William and Harvey E. Cline. Marching Cubes: A High Resolution 3D Surface Construction Algorithm. Computer Graphics (SIGGRAPH 87 Proceedings) 21(4) July 1987, p. 163-170)</param>
+<param name="Description">Visualises a scalar field in 3D by the use of a surface over which all the values of the field are constant (an isosurface). It gets the value of the field on a 3D grid and uses the Marching Cubes algorithm to construct the surface. This algorithm is described in Lorensen et al.</param>
<!--Now the interesting stuff-->
<list name="Params">
@@ -77,7 +77,24 @@
<param name="Default">"White"</param>
<param name="Description">The colour of the isosurface. (If a lucColourMap is given - then this colour will not be used)</param>
</struct>
-
+ <struct>
+ <param name="Name">maskType</param>
+ <param name="Type">String</param>
+ <param name="Default">GreaterThan</param>
+ <param name="Description">When testing whether to draw a triangle in the surface - this mask compares the value of a field at the verticies of the triangle and compares it to a value. This is the nature of the comparison. It can be "GreaterThan", "LessThan" or "EqualTo".</param>
+ </struct>
+ <struct>
+ <param name="Name">maskValue</param>
+ <param name="Type">Double</param>
+ <param name="Default">0.0</param>
+ <param name="Description">The value to compare against the mask field.</param>
+ </struct>
+ <struct>
+ <param name="Name">maskTolerance</param>
+ <param name="Type">Double</param>
+ <param name="Default">0.001</param>
+ <param name="Description">If the maskType is set to 'EqualTo', the mask is activated with the value of the mask field is within this tolerance to the mask value.</param>
+ </struct>
</list>
<list name="Dependencies">
@@ -105,11 +122,19 @@
<param name="Essential">No</param>
<param name="Name">MaskField</param>
<param name="Type">FieldVariable</param>
- <param name="Description">...</param>
+ <param name="Description">The surface will not be drawn in certain regions depending on the value of this field and the masking parameters specified.</param>
</struct>
</list>
<!-- Add an exmaple XML if possible -->
-<param name="Example">...</param>
+<param name="Example">
+ <struct name="temperatureIsosurface">
+ <param name="Type">lucIsosurface</param>
+ <param name="IsosurfaceField">TemperatureField</param>
+ <param name="ColourMap">temperatureColourMap</param>
+ <param name="isovalue">0.5</param>
+ <param name="drawWalls">false</param>
+ </struct>
+</param>
</StGermainData>
diff -r 193c1ca844e0 -r 9dac68cbae64 DrawingObjects/src/OpenGLDrawingObject.meta
--- a/DrawingObjects/src/OpenGLDrawingObject.meta Thu Oct 09 15:36:15 2008 +1100
+++ b/DrawingObjects/src/OpenGLDrawingObject.meta Fri Oct 17 17:44:02 2008 +1100
@@ -3,7 +3,7 @@
<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
<param name="Name">lucOpenGLDrawingObject</param>
-<param name="Author">...</param>
+<param name="Author">Robert Turnbull</param>
<param name="Organisation">MCC</param>
<param name="Project">gLucifer</param>
<param name="Location">./gLucifer/DrawingObjects/src/</param>
@@ -16,16 +16,13 @@
<param name="Description">An abstract class to setup specific things to do with an OpenGL Drawing Object</param>
<!--Now the interesting stuff-->
-
-
<list name="Params">
-
</list>
<list name="Dependencies">
+</list>
-</list>
<!-- Add an exmaple XML if possible -->
-<param name="Example">...</param>
+<param name="Example">N/A</param>
</StGermainData>
diff -r 193c1ca844e0 -r 9dac68cbae64 DrawingObjects/src/SwarmViewerBase.meta
--- a/DrawingObjects/src/SwarmViewerBase.meta Thu Oct 09 15:36:15 2008 +1100
+++ b/DrawingObjects/src/SwarmViewerBase.meta Fri Oct 17 17:44:02 2008 +1100
@@ -16,29 +16,14 @@
<param name="Description">SwarmViewerBase is an abstract class. It provides the main functionaily for a variable on a Swarm to be viewed as output.</param>
<!--Now the interesting stuff-->
+<list name="Params">
+ <struct>
+ <param name="Name">pointSize</param>
+ <param name="Type">Double</param>
+ <param name="Default">1.0</param>
+ <param name="Description">Size of particle dots</param>
+ </struct>
-
-<list name="Params">
-
- <struct>
- <param name="Name">MaskType</param>
- <param name="Type">String</param>
- <param name="Default">GreaterThan</param>
- <param name="Description">The type of mask that will be used. Options are: GreaterThan, LesserThen, EqualTo</param>
- </struct>
- <struct>
- <param name="Name">MaskValue</param>
- <param name="Type">double</param>
- <param name="Default">0.0</param>
- <param name="Description">Value of the MaskType</param>
- </struct>
- <struct>
- <param name="Name">MaskTolerance</param>
- <param name="Type">double</param>
- <param name="Default">0.001</param>
- <param name="Description">Tolerance of the masking condition in the case it's a floating point operation.</param>
- </struct>
-
<struct>
<param name="Name">drawParticleNumber</param>
<param name="Type">Bool</param>
@@ -99,11 +84,25 @@
<param name="Default">100000.0</param>
<param name="Description">Depened on positionRange and sets the volume this swarm viewer operates in</param>
</struct>
+
+
<struct>
- <param name="Name">pointSize</param>
- <param name="Type">Double</param>
- <param name="Default">1.0</param>
- <param name="Description">Size of particle dots</param>
+ <param name="Name">maskType</param>
+ <param name="Type">String</param>
+ <param name="Default">GreaterThan</param>
+ <param name="Description">When testing whether to draw a particle - this mask compares the value of a SwarmVariable and compares it to a value. This is the nature of the comparison. It can be "GreaterThan", "LessThan" or "EqualTo".</param>
+ </struct>
+ <struct>
+ <param name="Name">maskValue</param>
+ <param name="Type">double</param>
+ <param name="Default">0.0</param>
+ <param name="Description">The value to compare against the mask SwarmVariable</param>
+ </struct>
+ <struct>
+ <param name="Name">maskTolerance</param>
+ <param name="Type">double</param>
+ <param name="Default">0.001</param>
+ <param name="Description">If the maskType is set to 'EqualTo', the mask is activated with the value of the mask Variable is within this tolerance to the mask value.</param>
</struct>
</list>
@@ -143,5 +142,5 @@
</list>
<!-- Add an exmaple XML if possible -->
-<param name="Example">...</param>
+<param name="Example">N/A</param>
diff -r 193c1ca844e0 -r 9dac68cbae64 DrawingObjects/src/Title.c
--- a/DrawingObjects/src/Title.c Thu Oct 09 15:36:15 2008 +1100
+++ b/DrawingObjects/src/Title.c Fri Oct 17 17:44:02 2008 +1100
@@ -81,11 +81,12 @@ lucTitle* lucTitle_New(
lucTitle* lucTitle_New(
Name name,
char * titleString,
- lucColour colour )
+ lucColour colour,
+ int yPos )
{
lucTitle* self = (lucTitle*) _lucTitle_DefaultNew( name );
- lucTitle_InitAll( self, titleString, colour);
+ lucTitle_InitAll( self, titleString, colour, yPos );
return self;
}
@@ -136,26 +137,28 @@ lucTitle* _lucTitle_New(
}
void lucTitle_Init(
- lucTitle* self,
- char* titleString,
- lucColour colour )
+ lucTitle* self,
+ char* titleString,
+ lucColour colour,
+ int yPos )
{
self->titleString = Memory_Alloc_Array( char, (strlen(titleString) + 1), "self->titleString" );
strcpy( self->titleString, titleString );
- memcpy( &(self->colour), &colour, sizeof(lucColour) );
-
+ memcpy( &(self->colour), &colour, sizeof(lucColour) );
+ self->yPos = yPos;
}
void lucTitle_InitAll(
void* title,
char* titleString,
- lucColour colour )
+ lucColour colour,
+ int yPos )
{
lucTitle* self = title;
/* TODO Init parent */
- lucTitle_Init( self, titleString, colour );
+ lucTitle_Init( self, titleString, colour, yPos );
}
void _lucTitle_Delete( void* drawingObject ) {
@@ -217,8 +220,9 @@ void _lucTitle_Construct( void* title, S
lucColour_FromString( &self->colour, colourName );
lucTitle_InitAll( self,
- Stg_ComponentFactory_GetString( cf, self->name, "string", "NULL"),
- self->colour);
+ Stg_ComponentFactory_GetString( cf, self->name, "string", "" ),
+ self->colour,
+ Stg_ComponentFactory_GetInt( cf, self->name, "yPos", 13 ) );
}
@@ -231,10 +235,12 @@ void _lucTitle_Setup( void* drawingObjec
lucTitle* self = (lucTitle*)drawingObject;
_lucOpenGLDrawingObject_Setup( self, _context );
}
+
void _lucTitle_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
- lucTitle* self = (lucTitle*)drawingObject;
- lucViewport* viewport = viewportInfo->viewport;
- int stringWidth = 0;
+ lucTitle* self = (lucTitle*)drawingObject;
+ lucViewport* viewport = viewportInfo->viewport;
+ int stringWidth = 0;
+ char* title;
/* Set up 2D Viewer the size of the viewport */
glMatrixMode(GL_PROJECTION);
@@ -242,38 +248,23 @@ void _lucTitle_Draw( void* drawingObject
glLoadIdentity();
gluOrtho2D((GLfloat) 0.0, (GLfloat) viewportInfo->width, (GLfloat) 0.0, (GLfloat) viewportInfo->height );
glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ glLoadIdentity();
/* Disable lighting because we don't want a 3D effect */
glDisable(GL_LIGHTING);
- /* Set the colour so that it'll show up against the background */
- lucColour_SetComplimentaryOpenGLColour( &window->backgroundColour );
+ /* Set title */
+ title = strlen( self->titleString ) ? self->titleString : viewport->name;
+ stringWidth = lucStringWidth( title );
+
+ /* Set the colour */
+ lucColour_SetOpenGLColour( &self->colour );
+
+ /* Set the postition */
+ glRasterPos2i( viewportInfo->width/2 - stringWidth/2, viewportInfo->height - self->yPos );
/* Print Title */
- if(strcmp(self->titleString, "NULL")) { /* The user has entered a string to be drawn*/
- /* Set the colour */
- glColor4f(
- self->colour.red,
- self->colour.green,
- self->colour.blue,
- self->colour.opacity );
-
- glRasterPos2i( viewportInfo->width/2, viewportInfo->height - 13 );
- stringWidth = lucStringWidth( self->titleString );
- lucMoveRaster( - stringWidth/2, 0 );
- lucPrintString(self->titleString);
- }
- else { /* No specific title, will display the viewport name by default */
- /* Set the colour so that it'll show up against the background */
- lucColour_SetComplimentaryOpenGLColour( &window->backgroundColour );
-
- glRasterPos2i( viewportInfo->width/2, viewportInfo->height - 13 );
- stringWidth = lucStringWidth( viewport->name );
- lucMoveRaster( - stringWidth/2, 0 );
-
- lucPrintString( viewport->name );
- }
+ lucPrintString( title );
/* Put back settings */
glEnable(GL_LIGHTING);
diff -r 193c1ca844e0 -r 9dac68cbae64 DrawingObjects/src/Title.h
--- a/DrawingObjects/src/Title.h Thu Oct 09 15:36:15 2008 +1100
+++ b/DrawingObjects/src/Title.h Fri Oct 17 17:44:02 2008 +1100
@@ -52,8 +52,9 @@
#define __lucTitle \
__lucOpenGLDrawingObject \
- char* titleString; \
- lucColour colour;
+ char* titleString; \
+ lucColour colour; \
+ int yPos;
struct lucTitle {__lucTitle};
@@ -61,7 +62,8 @@
lucTitle* lucTitle_New(
Name name,
char* string,
- lucColour colour );
+ lucColour colour,
+ int yPos );
lucTitle* _lucTitle_New(
SizeT sizeOfSelf,
@@ -83,13 +85,15 @@
void lucTitle_InitAll(
void* title,
- char* string,
- lucColour colour);
+ char* string,
+ lucColour colour,
+ int yPos );
void _lucTitle_Init(
void* title,
- char* string,
- lucColour colour);
+ char* string,
+ lucColour colour,
+ int yPos );
void _lucTitle_Setup( void* drawingObject, void* _context );
diff -r 193c1ca844e0 -r 9dac68cbae64 DrawingObjects/src/Title.meta
--- a/DrawingObjects/src/Title.meta Thu Oct 09 15:36:15 2008 +1100
+++ b/DrawingObjects/src/Title.meta Fri Oct 17 17:44:02 2008 +1100
@@ -3,7 +3,7 @@
<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
<param name="Name">lucTitle</param>
-<param name="Author">...</param>
+<param name="Author">Cecile Duboz</param>
<param name="Organisation">MCC</param>
<param name="Project">gLucifer</param>
<param name="Location">./</param>
@@ -13,7 +13,7 @@
<param name="Parent">lucOpenGLDrawingObject</param>
<param name="Reference">...</param>
<param name="Summary">...</param>
-<param name="Description">Allows to diaply a title</param>
+<param name="Description">Displays a title at the top of a viewport.</param>
<!--Now the interesting stuff-->
@@ -23,13 +23,19 @@
<param name="Name">colour</param>
<param name="Type">String</param>
<param name="Default">"Black"</param>
- <param name="Description">Colour used to draw the title</param>
+ <param name="Description">Colour used to draw the title.</param>
+ </struct>
+ <struct>
+ <param name="Name">yPos</param>
+ <param name="Type">Int</param>
+ <param name="Default">13</param>
+ <param name="Description">Distance from the top of the viewport for the bottom of the text (in pixels).</param>
</struct>
<struct>
<param name="Name">string</param>
<param name="Type">String</param>
- <param name="Default">"NULL"</param>
- <param name="Description">String that will constitute the title. If this string is NULL, then the striong used by default is the viewport's name</param>
+ <param name="Default"></param>
+ <param name="Description">String that will constitute the title. If this string is empty, then it will use viewport's name</param>
</struct>
</list>
@@ -38,5 +44,11 @@
</list>
<!-- Add an exmaple XML if possible -->
-<param name="Example">...</param>
+<param name="Example">
+ <struct name="tempandVelTitle" mergeType="replace">
+ <param name="Type">lucTitle</param>
+ <param name="color">grey</param>
+ <param name="string">TemperatureField and Velocity Arrows</param>
+ </struct>
+</param>
diff -r 193c1ca844e0 -r 9dac68cbae64 DrawingObjects/src/VectorArrowCrossSection.meta
--- a/DrawingObjects/src/VectorArrowCrossSection.meta Thu Oct 09 15:36:15 2008 +1100
+++ b/DrawingObjects/src/VectorArrowCrossSection.meta Fri Oct 17 17:44:02 2008 +1100
@@ -3,7 +3,7 @@
<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
<param name="Name">lucVectorArrowCrossSection</param>
-<param name="Author">...</param>
+<param name="Author">Robert Turnbull</param>
<param name="Organisation">MCC</param>
<param name="Project">gLucifer</param>
<param name="Location">./gLucifer/DrawingObjects/src/</param>
@@ -105,6 +105,16 @@
</list>
<!-- Add an exmaple XML if possible -->
-<param name="Example">...</param>
+<param name="Example">
+ <struct name="velocityArrowsCrossSection">
+ <param name="Type">lucVectorArrowCrossSection</param>
+ <param name="VectorVariable">VelocityField</param>
+ <param name="crossSection">y=0.4</param>
+ <param name="colour">Black</param>
+ <param name="arrowHeadSize">0.1</param>
+ <param name="lengthScale">0.4</param>
+ <param name="resolution">10</param>
+ </struct>
+</param>
</StGermainData>
diff -r 193c1ca844e0 -r 9dac68cbae64 DrawingObjects/src/VectorArrows.meta
--- a/DrawingObjects/src/VectorArrows.meta Thu Oct 09 15:36:15 2008 +1100
+++ b/DrawingObjects/src/VectorArrows.meta Fri Oct 17 17:44:02 2008 +1100
@@ -3,7 +3,7 @@
<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
<param name="Name">lucVectorArrows</param>
-<param name="Author">...</param>
+<param name="Author">Robert Turnbull</param>
<param name="Organisation">MCC</param>
<param name="Project">gLucifer</param>
<param name="Location">./gLucifer/DrawingObjects/src/</param>
@@ -13,7 +13,7 @@
<param name="Parent">lucVectorArrowCrossSection</param>
<param name="Reference">...</param>
<param name="Summary">...</param>
-<param name="Description">Samples the values of a vector field in a grid and draws arrows to represent the direction and scaled to represent the magnitude.</param>
+<param name="Description">Samples the values of a vector field in a grid and draws arrows to represent the direction and scaled to represent the magnitude. (For more information about partameters and dependencies look at parent class lucVectorArrowCrossSection)</param>
<!--Now the interesting stuff-->
<list name="Params">
@@ -21,9 +21,18 @@
</list>
<list name="Dependencies">
+</list>
-</list>
<!-- Add an exmaple XML if possible -->
-<param name="Example">...</param>
+<param name="Example">
+ <struct name="velocityArrows">
+ <param name="Type">lucVectorArrows</param>
+ <param name="VectorVariable">VelocityField</param>
+ <param name="colour">Black</param>
+ <param name="arrowHeadSize">0.1</param>
+ <param name="lengthScale">0.4</param>
+ <param name="resolution">10</param>
+ </struct>
+</param>
</StGermainData>
diff -r 193c1ca844e0 -r 9dac68cbae64 RenderingEngines/src/RenderingEngineGL.meta
--- a/RenderingEngines/src/RenderingEngineGL.meta Thu Oct 09 15:36:15 2008 +1100
+++ b/RenderingEngines/src/RenderingEngineGL.meta Fri Oct 17 17:44:02 2008 +1100
@@ -3,7 +3,7 @@
<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
<param name="Name">lucRenderingEngineGL</param>
-<param name="Author">...</param>
+<param name="Author">Robert Turnbull</param>
<param name="Organisation">MCC</param>
<param name="Project">gLucifer</param>
<param name="Location">./gLucifer/RenderingEngines/src/</param>
@@ -13,19 +13,19 @@
<param name="Parent">lucRenderingEngine</param>
<param name="Reference">...</param>
<param name="Summary">...</param>
-<param name="Description">An implementation of the lucRenderingEngine Class that uses OpenGL</param>
-
-<!--Now the interesting stuff-->
-
+<param name="Description">An implementation of the lucRenderingEngine Class that uses OpenGL.</param>
<list name="Params">
-
</list>
<list name="Dependencies">
+</list>
-</list>
<!-- Add an exmaple XML if possible -->
-<param name="Example">...</param>
+<param name="Example">
+ <struct name="renderingEngine">
+ <param name="Type">lucRenderingEngineGL</param>
+ </struct>
+</param>
</StGermainData>
More information about the CIG-COMMITS
mailing list