aboutsummaryrefslogtreecommitdiff
path: root/src/graph/view3D/contour_panel3d.c.out
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
committerdos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
commitab8cc85adde879fb963c94d15675783f2cf4b183 (patch)
treec202482327f474583b750b2c45dedfc4e4312b1d /src/graph/view3D/contour_panel3d.c.out
downloadopen-axiom-ab8cc85adde879fb963c94d15675783f2cf4b183.tar.gz
Initial population.
Diffstat (limited to 'src/graph/view3D/contour_panel3d.c.out')
-rwxr-xr-xsrc/graph/view3D/contour_panel3d.c.out760
1 files changed, 760 insertions, 0 deletions
diff --git a/src/graph/view3D/contour_panel3d.c.out b/src/graph/view3D/contour_panel3d.c.out
new file mode 100755
index 00000000..45709849
--- /dev/null
+++ b/src/graph/view3D/contour_panel3d.c.out
@@ -0,0 +1,760 @@
+ /***********************************************************************
+ contour_panel.c
+
+ begun 25 November 1992, Jim Wen
+ ***********************************************************************/
+
+#include "header.h"
+#include "cpanel.h"
+#include "draw.h"
+#include "../include/purty/volume.bitmap"
+#include "../include/purty/volume.mask"
+#include "../include/purty/slicer.bitmap"
+
+#define use_fat
+
+#define gStuff_NOT
+
+#define contourWinDEBUG
+#define drawDEBUG
+#define contourDEBUG
+
+#define stickColor moColor(orange2, pastel)
+
+ /*=====================================================================*
+ Static Variables
+ *=====================================================================*/
+XImage slicer_image_stuff, *slicer_image = &slicer_image_stuff;
+int last_tip_long_x, last_tip_long_y;
+int last_tip_lat_x, last_tip_lat_y;
+
+ /*=====================================================================*
+ Local Functions
+ *=====================================================================*/
+int initContourButtons();
+
+ /*---------------------------------------------------------------------*
+ makeContourPanel()
+ *---------------------------------------------------------------------*/
+int makeContourPanel()
+{
+
+ int i;
+ XSetWindowAttributes cwAttrib, controlAttrib;
+ XSizeHints sizehint;
+ Pixmap contourbits, contourmask, slicer_pixmap;
+ XColor foreColor, backColor;
+
+ contourbits = XCreateBitmapFromData(dsply,rtWindow,volumeBitmap_bits,
+ volumeBitmap_width,volumeBitmap_height);
+ contourmask = XCreateBitmapFromData(dsply,rtWindow,volumeMask_bits,
+ volumeMask_width,volumeMask_height);
+ cwAttrib.background_pixel = backgroundColor;
+ cwAttrib.border_pixel = foregroundColor;
+ cwAttrib.event_mask = contourMASK;
+ cwAttrib.colormap = colorMap;
+ cwAttrib.override_redirect = overrideManager;
+ foreColor.pixel = contourCursorForeground;
+ XQueryColor(dsply,colorMap,&foreColor);
+ backColor.pixel = contourCursorBackground;
+ XQueryColor(dsply,colorMap,&backColor);
+ cwAttrib.cursor = XCreatePixmapCursor(dsply,contourbits,contourmask,
+ &foreColor,&backColor,
+ volumeBitmap_x_hot,
+ volumeBitmap_y_hot);
+
+#define slicer_pixmap_FG moColor(yellow1,normal)
+#define slicer_pixmap_BG backgroundColor
+ slicer_pixmap = XCreatePixmapFromBitmapData(dsply, control->controlWindow,
+ slicer_bits, slicer_width, slicer_height,
+ slicer_pixmap_FG, slicer_pixmap_BG,
+ DefaultDepthOfScreen
+ (DefaultScreenOfDisplay(dsply)));
+ slicer_image = XGetImage(dsply, slicer_pixmap, 0, 0, slicer_width, slicer_height,
+ AllPlanes, ZPixmap);
+
+
+ contourWindow = XCreateWindow(dsply,control->controlWindow,
+ -3,-3,controlWidth,controlHeight,3,
+ CopyFromParent,InputOutput,CopyFromParent,
+ controlCreateMASK,&cwAttrib);
+
+ sizehint.flags = USPosition | USSize;
+ sizehint.x = 0;
+ sizehint.y = 0;
+ sizehint.width = controlWidth;
+ sizehint.height = controlHeight;
+ /*** the None stands for icon pixmap ***/
+ XSetNormalHints(dsply,contourWindow,&sizehint);
+ XSetStandardProperties(dsply,contourWindow,"Control Panel 3D",
+ "Contour Slicing",None,NULL,0,&sizehint);
+
+ /*** volume frustrum window ***/
+
+ /*** do contour buttons ***/
+ initContourButtons(control->buttonQueue);
+ for (i=contourButtonsStart; i<(contourButtonsEnd); i++) {
+ controlAttrib.event_mask = (control->buttonQueue[i]).mask;
+ (control->buttonQueue[i]).self =
+ XCreateWindow(dsply,contourWindow,
+ (control->buttonQueue[i]).buttonX,
+ (control->buttonQueue[i]).buttonY,
+ (control->buttonQueue[i]).buttonWidth,
+ (control->buttonQueue[i]).buttonHeight,
+ 0,0,InputOnly,CopyFromParent,
+ buttonCreateMASK,&controlAttrib);
+ XMakeAssoc(dsply,table,(control->buttonQueue[i]).self,
+ &((control->buttonQueue[i]).buttonKey));
+ XMapWindow(dsply,(control->buttonQueue[i]).self);
+ }
+
+} /* makeContourPanel() */
+
+
+int initContourButtons(contourButtons)
+
+buttonStruct *contourButtons;
+{
+
+ int ii, num = 0;
+
+ ii = contourReturn;
+ contourButtons[ii].buttonX = 154;
+ contourButtons[ii].buttonY = 370;
+ contourButtons[ii].buttonWidth = 110;
+ contourButtons[ii].buttonHeight = 24;
+ contourButtons[ii].buttonKey = ii;
+ contourButtons[ii].pot = no;
+ contourButtons[ii].mask = buttonMASK;
+ contourButtons[ii].text = "Return";
+ contourButtons[ii].textColor = return_FG;
+ contourButtons[ii].xHalf = contourButtons[ii].buttonWidth/2;
+ contourButtons[ii].yHalf = contourButtons[ii].buttonHeight/2;
+ ++num;
+
+ ii = contourXY;
+ contourButtons[ii].buttonX = contourPlaneXY_X;
+ contourButtons[ii].buttonY = contourPlaneXY_Y;
+ contourButtons[ii].buttonWidth = contourLittleButt_W;
+ contourButtons[ii].buttonHeight = contourLittleButt_H;
+ contourButtons[ii].buttonKey = ii;
+ contourButtons[ii].pot = no;
+ contourButtons[ii].mask = buttonMASK;
+ contourButtons[ii].text = "XY";
+ contourButtons[ii].textColor = littleButt_FG;
+ contourButtons[ii].xHalf = contourButtons[ii].buttonWidth/2;
+ contourButtons[ii].yHalf = contourButtons[ii].buttonHeight/2;
+ ++num;
+
+ ii = contourXZ;
+ contourButtons[ii].buttonX = contourPlaneXZ_X;
+ contourButtons[ii].buttonY = contourPlaneXZ_Y;
+ contourButtons[ii].buttonWidth = contourLittleButt_W;
+ contourButtons[ii].buttonHeight = contourLittleButt_H;
+ contourButtons[ii].buttonKey = ii;
+ contourButtons[ii].pot = no;
+ contourButtons[ii].mask = buttonMASK;
+ contourButtons[ii].text = "XZ";
+ contourButtons[ii].textColor = littleButt_FG;
+ contourButtons[ii].xHalf = contourButtons[ii].buttonWidth/2;
+ contourButtons[ii].yHalf = contourButtons[ii].buttonHeight/2;
+ ++num;
+
+ ii = contourYZ;
+ contourButtons[ii].buttonX = contourPlaneYZ_X;
+ contourButtons[ii].buttonY = contourPlaneYZ_Y;
+ contourButtons[ii].buttonWidth = contourLittleButt_W;
+ contourButtons[ii].buttonHeight = contourLittleButt_H;
+ contourButtons[ii].buttonKey = ii;
+ contourButtons[ii].pot = no;
+ contourButtons[ii].mask = buttonMASK;
+ contourButtons[ii].text = "YZ";
+ contourButtons[ii].textColor = littleButt_FG;
+ contourButtons[ii].xHalf = contourButtons[ii].buttonWidth/2;
+ contourButtons[ii].yHalf = contourButtons[ii].buttonHeight/2;
+ ++num;
+
+ ii = contourFlatView;
+ contourButtons[ii].buttonX = contourFlatView_X;
+ contourButtons[ii].buttonY = contourFlatView_Y;
+ contourButtons[ii].buttonWidth = contourBigButt_W;
+ contourButtons[ii].buttonHeight = contourBigButt_H;
+ contourButtons[ii].buttonKey = ii;
+ contourButtons[ii].pot = no;
+ contourButtons[ii].mask = potMASK;
+ contourButtons[ii].text = "Flat View Upon Return";
+ contourButtons[ii].textColor = bigButt_FG;
+ contourButtons[ii].xHalf = contourButtons[ii].buttonWidth/2;
+ contourButtons[ii].yHalf = contourButtons[ii].buttonHeight/2;
+ ++num;
+
+ ii = contourAppendSegs;
+ contourButtons[ii].buttonX = contourAppendSegs_X;
+ contourButtons[ii].buttonY = contourAppendSegs_Y;
+ contourButtons[ii].buttonWidth = contourBigButt_W;
+ contourButtons[ii].buttonHeight = contourBigButt_H;
+ contourButtons[ii].buttonKey = ii;
+ contourButtons[ii].pot = no;
+ contourButtons[ii].mask = potMASK;
+ contourButtons[ii].text = "Append Contours";
+ contourButtons[ii].textColor = bigButt_FG;
+ contourButtons[ii].xHalf = contourButtons[ii].buttonWidth/2;
+ contourButtons[ii].yHalf = contourButtons[ii].buttonHeight/2;
+ ++num;
+
+ ii = contourLongitude;
+ contourButtons[ii].buttonX = contourLongitude_X;
+ contourButtons[ii].buttonY = contourLongitude_Y;
+ contourButtons[ii].buttonWidth = contourLongitude_W;
+ contourButtons[ii].buttonHeight = contourLongitude_H;
+ contourButtons[ii].buttonKey = ii;
+ contourButtons[ii].pot = yes;
+ contourButtons[ii].mask = potMASK;
+ contourButtons[ii].text = "XZ";
+ contourButtons[ii].textColor = long_FG;
+ contourButtons[ii].xHalf = contourButtons[ii].buttonWidth/2;
+ contourButtons[ii].yHalf = contourButtons[ii].buttonHeight/2;
+ ++num;
+
+ ii = contourLatitude;
+ contourButtons[ii].buttonX = contourLatitude_X;
+ contourButtons[ii].buttonY = contourLatitude_Y;
+ contourButtons[ii].buttonWidth = contourLatitude_W;
+ contourButtons[ii].buttonHeight = contourLatitude_H;
+ contourButtons[ii].buttonKey = ii;
+ contourButtons[ii].pot = yes;
+ contourButtons[ii].mask = potMASK;
+ contourButtons[ii].text = "XZ";
+ contourButtons[ii].textColor = lat_FG;
+ contourButtons[ii].xHalf = contourButtons[ii].buttonWidth/2;
+ contourButtons[ii].yHalf = contourButtons[ii].buttonHeight/2;
+ ++num;
+
+ ii = contourSliceNum;
+ contourButtons[ii].buttonX = contourSliceNum_X;
+ contourButtons[ii].buttonY = contourSliceNum_Y;
+ contourButtons[ii].buttonWidth = contourSliceNum_W;
+ contourButtons[ii].buttonHeight = contourSliceNum_H;
+ contourButtons[ii].buttonKey = ii;
+ contourButtons[ii].pot = yes;
+ contourButtons[ii].mask = potMASK;
+ contourButtons[ii].text = "XZ";
+ contourButtons[ii].textColor = slice_FG;
+ contourButtons[ii].xHalf = contourButtons[ii].buttonWidth/2;
+ contourButtons[ii].yHalf = contourButtons[ii].buttonHeight/2;
+ ++num;
+
+ ii = contourAbort;
+ contourButtons[ii].buttonX = 36;
+ contourButtons[ii].buttonY = 370;
+ contourButtons[ii].buttonWidth = 110;
+ contourButtons[ii].buttonHeight = 24;
+ contourButtons[ii].buttonKey = ii;
+ contourButtons[ii].pot = no;
+ contourButtons[ii].mask = buttonMASK;
+ contourButtons[ii].text = "Abort";
+ contourButtons[ii].textColor = abort_FG;
+ contourButtons[ii].xHalf = contourButtons[ii].buttonWidth/2;
+ contourButtons[ii].yHalf = contourButtons[ii].buttonHeight/2;
+ ++num;
+
+
+ return(num);
+
+} /* initContourButtons() */
+
+
+void drawContourPanel()
+{
+
+ int i,strlength;
+
+ /*---------------------------------------------------*
+ Set the function to copy for first painting
+ *---------------------------------------------------*/
+ XSetFunction(dsply, contourGC, GXcopy);
+
+ /* Draw some lines for the contour panel, break up da space */
+ GSetForeground(contourGC /* ZZZ */,(float)foregroundColor,X);
+ GSetLineAttributes(contourGC /* ZZZ */,3,LineSolid,CapButt,JoinMiter,X);
+ GDrawLine(contourGC /* ZZZ */, contourWindow, 0, potA, controlWidth, potA, X);
+
+
+ GSetLineAttributes(contourGC /* ZZZ */,2,LineSolid,CapButt,JoinMiter,X);
+ GDrawLine(contourGC /* ZZZ */, contourWindow, 0, contourTitleA, controlWidth,
+ contourTitleA, X);
+ GDrawLine(contourGC /* ZZZ */, contourWindow, 0, contourTitleB, controlWidth,
+ contourTitleB, X);
+
+ writeControlTitle(contourWindow);
+ s = "Contour Slicing Panel";
+ strlength = strlen(s);
+ GSetForeground(anotherGC,(float)contourTitleColor,X);
+ GDrawString(anotherGC,contourWindow,
+ centerX(anotherGC,s,strlength,controlWidth),
+ contourTitleA+18,s,strlength,X);
+
+ for (i=contourButtonsStart; i<(contourButtonsEnd); i++) {
+ /*---------------------------------------------------*
+ NOTE: different from other control panels in that
+ the "monoColor" is defined in the button
+ and "moColor" is used there
+ *---------------------------------------------------*/
+ GSetForeground(contourGC /* ZZZ */,
+#ifdef oldie
+ (float)monoColor((control->buttonQueue[i]).textColor),X);
+#else
+ (float)((control->buttonQueue[i]).textColor),X);
+#endif
+ switch (i) {
+
+ case contourFlatView:
+ case contourAppendSegs:
+ GSetForeground(contourGC,
+ (float)((control->buttonQueue[i]).textColor),X);
+ GDrawRectangle(contourGC,contourWindow,
+ (control->buttonQueue[i]).buttonX,
+ (control->buttonQueue[i]).buttonY,
+ (control->buttonQueue[i]).buttonWidth,
+ (control->buttonQueue[i]).buttonHeight,X);
+ GDrawString(contourGC,contourWindow,
+ (control->buttonQueue[i]).buttonX +
+ (control->buttonQueue[i]).buttonWidth + 4,
+ (control->buttonQueue[i]).buttonY +
+ centerY(contourGC,(control->buttonQueue[i]).buttonHeight),
+ (control->buttonQueue[i]).text,
+ strlen(control->buttonQueue[i].text),X);
+ if (i==contourFlatView && contour_flat_view_flag)
+ GDrawString(contourGC,contourWindow,
+ (control->buttonQueue[i]).buttonX +
+ centerX(contourGC,"x",1,
+ (control->buttonQueue[i]).buttonWidth),
+ (control->buttonQueue[i]).buttonY +
+ centerY(contourGC,(control->buttonQueue[i]).buttonHeight),
+ "x",1,X);
+ else if (i==contourAppendSegs && contour_append_lists_flag)
+ GDrawString(contourGC,contourWindow,
+ (control->buttonQueue[i]).buttonX +
+ centerX(contourGC,"x",1,
+ (control->buttonQueue[i]).buttonWidth),
+ (control->buttonQueue[i]).buttonY +
+ centerY(contourGC,(control->buttonQueue[i]).buttonHeight),
+ "x",1,X);
+ break;
+
+ case contourLongitude:
+ GDrawRectangle(contourGC /* ZZZ */,contourWindow,
+ (control->buttonQueue[i]).buttonX,
+ (control->buttonQueue[i]).buttonY,
+ (control->buttonQueue[i]).buttonWidth,
+ (control->buttonQueue[i]).buttonHeight,X);
+ draw_contour_longitude();
+ break;
+
+ case contourLatitude:
+#ifdef oldie
+ GDrawRectangle(contourGC /* ZZZ */,contourWindow,
+ (control->buttonQueue[i]).buttonX,
+ (control->buttonQueue[i]).buttonY,
+ (control->buttonQueue[i]).buttonWidth,
+ (control->buttonQueue[i]).buttonHeight,X);
+#else
+ XDrawRectangle(dsply,contourWindow, contourGC /* ZZZ */,
+ (control->buttonQueue[i]).buttonX,
+ (control->buttonQueue[i]).buttonY,
+ (control->buttonQueue[i]).buttonWidth,
+ (control->buttonQueue[i]).buttonHeight);
+#endif
+ draw_contour_latitude();
+ break;
+
+ case contourSliceNum:
+ GDrawRectangle(contourGC /* ZZZ */,contourWindow,
+ (control->buttonQueue[i]).buttonX,
+ (control->buttonQueue[i]).buttonY,
+ (control->buttonQueue[i]).buttonWidth,
+ (control->buttonQueue[i]).buttonHeight,X);
+ draw_contour_slicing();
+ break;
+
+ default:
+ GDrawRectangle(contourGC /* ZZZ */,contourWindow,
+ (control->buttonQueue[i]).buttonX,
+ (control->buttonQueue[i]).buttonY,
+ (control->buttonQueue[i]).buttonWidth,
+ (control->buttonQueue[i]).buttonHeight,X);
+ s = (control->buttonQueue[i]).text;
+ strlength = strlen(s);
+ GSetForeground(contourGC /* ZZZ */,
+#ifdef oldie
+ (float)monoColor((control->buttonQueue[i]).textColor),X);
+#else
+ (float)((control->buttonQueue[i]).textColor),X);
+#endif
+ GDrawString(trashGC /* ZZZ */,contourWindow,
+ (control->buttonQueue[i]).buttonX +
+ centerX(processGC,s,strlength,
+ (control->buttonQueue[i]).buttonWidth),
+ (control->buttonQueue[i]).buttonY +
+ centerY(processGC,(control->buttonQueue[i]).buttonHeight),
+ s,strlen(s),X);
+ break;
+ } /* switch on i */
+ } /* for contour buttons */
+
+ /*---------------------------------------------------*
+ Set the function to XOR for updating
+ *---------------------------------------------------*/
+ XSetFunction(dsply, contourGC, GXxor);
+ update_contour_longitude(); /* to get the xor stuff going */
+ update_contour_latitude(); /* to get the xor stuff going */
+
+} /* drawContourPanel() */
+
+
+ /*---------------------------------------------------------------------*
+ draw_contour_longitude()
+ *---------------------------------------------------------------------*/
+void draw_contour_longitude()
+{
+
+ int tip_x, tip_y;
+ char stringo[20];
+
+
+ /*---------------------------------------------------*
+ print out the longitude in degrees
+ *---------------------------------------------------*/
+ sprintf(stringo,"Longitude: %d",(int)(rot_theta * DEGREES));
+ XClearArea(dsply, contourWindow, long_str_X, long_str_Y - 12,
+ long_W + 50, 18, False);
+ XDrawString(dsply, contourWindow, anotherGC,
+ long_str_X, long_str_Y,
+ stringo, strlen(stringo));
+
+ /*---------------------------------------------------*
+ draw the background artwork
+ *---------------------------------------------------*/
+ XClearArea(dsply, contourWindow,
+ contourLongitude_X, contourLongitude_Y,
+ contourLongitude_W, contourLongitude_H,
+ False);
+#ifdef use_fat
+ XSetForeground(dsply, contourGC /* ZZZ */, long_FG);
+ XDrawArc(dsply, contourWindow, contourGC /* ZZZ */,
+ long_corner_X, long_corner_Y,
+ long_W, long_H,
+ 0, 360*64);
+#else
+ XSetForeground(dsply, contourGC, long_FG);
+ XSetForeground(dsply, trashGC, long_FG);
+ XDrawArc(dsply, contourWindow, trashGC /* ZZZ */,
+ long_corner_X, long_corner_Y,
+ long_W, long_H,
+ 0, 360*64);
+#endif
+
+ /*---------------------------------------------------*
+ some spokes to make it look purty
+ *---------------------------------------------------*/
+ {
+ float a, xp, yp;
+ for (a=0; a<pi; a+=pi/8) {
+ xp = long_RADIUS*cos(a);
+ yp = long_RADIUS*sin(a);
+ XDrawLine(dsply, contourWindow,
+#ifdef use_fat
+ contourGC,
+#else
+ trashGC,
+#endif
+ (int)(xp + long_center_X), (int)(yp + long_center_Y),
+ (int)(-xp + long_center_X), (int)(-yp + long_center_Y));
+ }
+ }
+
+ /*---------------------------------------------------*
+ calculate and draw the longitudal pointer
+ *---------------------------------------------------*/
+ XSetFunction(dsply, contourGC, GXxor);
+ tip_x = (int)(cos(rot_theta) * (long_RADIUS + dotExt)) + long_center_X;
+ tip_y = (int)(-sin(rot_theta) * (long_RADIUS + dotExt)) + long_center_Y;
+ last_tip_long_x = tip_x;
+ last_tip_long_y = tip_y;
+ GSetForeground(contourGC,(float)stickColor,X);
+ GDrawLine(contourGC /* ZZZ */, contourWindow,
+ long_center_X, long_center_Y,
+ tip_x, tip_y, X);
+ GSetForeground(contourGC,(float)dotColor,X);
+ XFillArc(dsply, contourWindow, contourGC /* ZZZ */,
+ tip_x - (dotSize>>1), tip_y - (dotSize>>1),
+ dotSize, dotSize,
+ 0, 360*64);
+ XSetFunction(dsply, contourGC, GXcopy);
+
+} /* draw_contour_longitude() */
+
+
+ /*---------------------------------------------------------------------*
+ draw_contour_latitude()
+ *---------------------------------------------------------------------*/
+void draw_contour_latitude()
+{
+
+ int tip_x, tip_y;
+ char stringo[20];
+
+ /*---------------------------------------------------*
+ print out the latitude in degrees
+ *---------------------------------------------------*/
+ sprintf(stringo,"Latitude: %d",(int)(rot_phi * DEGREES));
+ XClearArea(dsply, contourWindow, lat_str_X, lat_str_Y - 12,
+ lat_W, 18, False);
+ XDrawString(dsply, contourWindow, anotherGC,
+ lat_str_X, lat_str_Y,
+ stringo, strlen(stringo));
+
+ /*---------------------------------------------------*
+ draw the background superduper work of art
+ *---------------------------------------------------*/
+ XClearArea(dsply, contourWindow,
+ contourLatitude_X, contourLatitude_Y,
+ contourLatitude_W, contourLatitude_H,
+ False);
+ XSetForeground(dsply, contourGC /* ZZZ */, lat_FG);
+ XDrawArc(dsply, contourWindow, contourGC /* ZZZ */,
+ lat_corner_X, lat_corner_Y,
+ lat_W, lat_H,
+ 0, 90*64);
+ XDrawLine(dsply, contourWindow, contourGC,
+ lat_quad_X, lat_quad_Y,
+ lat_quad_X, lat_quad_Y - lat_RADIUS);
+ XDrawLine(dsply, contourWindow, contourGC,
+ lat_quad_X, lat_quad_Y,
+ lat_quad_X + lat_RADIUS, lat_quad_Y);
+
+ /*---------------------------------------------------*
+ purty leettle tabs
+ *---------------------------------------------------*/
+ {
+ float a, xp, yp;
+ for (a=0; a<pi_half; a+=pi/16) {
+ xp = cos(a);
+ yp = -sin(a);
+ XDrawLine(dsply, contourWindow, contourGC,
+ (int)((lat_RADIUS-3) * xp + lat_quad_X),
+ (int)((lat_RADIUS-3) * yp + lat_quad_Y),
+ (int)((lat_RADIUS+3) * xp + lat_quad_X),
+ (int)((lat_RADIUS+3) * yp + lat_quad_Y));
+ }
+ }
+
+ /*---------------------------------------------------*
+ calculate and draw the latitudal pointer
+ *---------------------------------------------------*/
+ XSetFunction(dsply, contourGC, GXxor);
+ tip_x = (int)(sin(rot_phi) * (lat_RADIUS + dotExt)) + lat_quad_X;
+ tip_y = (int)(-cos(rot_phi) * (lat_RADIUS + dotExt)) + lat_quad_Y;
+ last_tip_lat_x = tip_x;
+ last_tip_lat_y = tip_y;
+ GSetForeground(contourGC,(float)stickColor,X);
+ GDrawLine(contourGC /* ZZZ */, contourWindow,
+ lat_quad_X, lat_quad_Y,
+ tip_x, tip_y, X);
+ XSetForeground(dsply, contourGC, dotColor);
+ XFillArc(dsply, contourWindow, contourGC /* ZZZ */,
+ tip_x - (dotSize>>1), tip_y - (dotSize>>1),
+ dotSize, dotSize,
+ 0, 360*64);
+ XSetFunction(dsply, contourGC, GXcopy);
+
+} /* draw_contour_latitude() */
+
+
+
+ /*---------------------------------------------------------------------*
+ draw_contour_slicing()
+ *---------------------------------------------------------------------*/
+void draw_contour_slicing()
+{
+
+ int tip_y, cut_spacing;
+#ifdef oldie
+ XDrawString(dsply, contourWindow, anotherGC,
+ slice_str_X, slice_str_Y,
+ "Slicer", 6);
+#else
+ char stringo[20];
+
+ sprintf(stringo,"Cuts: %d",max_cuts);
+ XClearArea(dsply, contourWindow,
+ slice_str_X,
+ slice_str_Y - 12,
+ contourSliceNum_W, 16, False);
+ XDrawString(dsply, contourWindow, anotherGC,
+ slice_str_X, slice_str_Y,
+ stringo, strlen(stringo));
+#endif
+
+ /*---------------------------------------------------*
+ put up the piece de resistance
+ *---------------------------------------------------*/
+ XClearArea(dsply, contourWindow,
+ contourSliceNum_X, contourSliceNum_Y,
+ contourSliceNum_W, contourSliceNum_H,
+ False);
+ XPutImage(dsply, contourWindow, contourGC,
+ slicer_image,
+ 0, 0,
+ slicer_image_X,
+ slicer_image_Y,
+ slicer_width, slicer_height);
+
+ /*---------------------------------------------------*
+ draw the number of slices
+ *---------------------------------------------------*/
+#define cuts_X (contourSliceNum_X + 15)
+#define cuts_Y (contourSliceNum_Y + 15)
+#define cuts_W 20
+#define cuts_H 85
+
+ XSetLineAttributes(dsply, trashGC, 1, LineSolid, CapButt, JoinMiter);
+ XClearArea(dsply, contourWindow,
+ cuts_X, cuts_Y, cuts_W, cuts_H, False);
+#ifdef oldie
+ cut_spacing = ( -(max_cuts - 1) + MAX_SLICES ) * cuts_H / MAX_SLICES;
+#else
+ {
+ float tmp;
+ tmp = (float)(-(max_cuts - 1) + MAX_SLICES) / MAX_SLICES;
+ cut_spacing = tmp*tmp * cuts_H;
+ if (cut_spacing < 1) cut_spacing = 1;
+ else if (cut_spacing > cuts_H) cut_spacing = cuts_H;
+ }
+#endif
+
+ XSetForeground(dsply, trashGC, moColor(violet0, pastel));
+ for (tip_y=cuts_Y+cuts_H; tip_y>=cuts_Y; tip_y-=cut_spacing) {
+ XDrawLine(dsply, contourWindow, trashGC,
+ cuts_X, tip_y,
+ cuts_X + cuts_W, tip_y);
+ }
+
+#define slide_Y (contourSliceNum_Y + 30)
+#define slide_H 55
+ {
+ float where;
+ int here;
+ where = (float)max_cuts/MAX_SLICES; /* [0..1] */
+ here = where * slide_H + slide_Y;
+ XSetForeground(dsply, contourGC, moColor(red1, normal));
+ XDrawLine(dsply, contourWindow, contourGC,
+ cuts_X + 45, here,
+ cuts_X + 55, here);
+ }
+
+} /* draw_contour_slicing() */
+
+
+ /*---------------------------------------------------------------------*
+ update_contour_longitude()
+
+ To be called for all subsequent updates after the contour window has
+ been mapped and drawn.
+ *---------------------------------------------------------------------*/
+void update_contour_longitude()
+{
+
+ int tip_x, tip_y;
+ char stringo[20];
+
+ /*---------------------------------------------------*
+ print out the longitude in degrees
+ *---------------------------------------------------*/
+ sprintf(stringo,"Longitude: %d",(int)(rot_theta * DEGREES));
+ XClearArea(dsply, contourWindow, long_str_X, long_str_Y - 12,
+ long_W + 50, 18, False);
+ XDrawString(dsply, contourWindow, anotherGC,
+ long_str_X, long_str_Y,
+ stringo, strlen(stringo));
+
+
+ /*---------------------------------------------------*
+ calculate and draw the longitudal pointer
+ *---------------------------------------------------*/
+ GSetForeground(contourGC,(float)stickColor,X);
+ GDrawLine(contourGC /* ZZZ */, contourWindow,
+ long_center_X, long_center_Y,
+ last_tip_long_x, last_tip_long_y, X);
+ GSetForeground(contourGC,(float)dotColor,X);
+ XFillArc(dsply, contourWindow, contourGC /* ZZZ */,
+ last_tip_long_x - (dotSize>>1), last_tip_long_y - (dotSize>>1),
+ dotSize, dotSize,
+ 0, 360*64);
+ tip_x = (int)(cos(rot_theta) * (long_RADIUS + dotExt)) + long_center_X;
+ tip_y = (int)(-sin(rot_theta) * (long_RADIUS + dotExt)) + long_center_Y;
+ last_tip_long_x = tip_x;
+ last_tip_long_y = tip_y;
+ GSetForeground(contourGC,(float)stickColor,X);
+ GDrawLine(contourGC /* ZZZ */, contourWindow,
+ long_center_X, long_center_Y,
+ tip_x, tip_y, X);
+ GSetForeground(contourGC,(float)dotColor,X);
+ XFillArc(dsply, contourWindow, contourGC /* ZZZ */,
+ tip_x - (dotSize>>1), tip_y - (dotSize>>1),
+ dotSize, dotSize,
+ 0, 360*64);
+
+} /* update_contour_longitude() */
+
+
+ /*---------------------------------------------------------------------*
+ update_contour_latitude()
+
+ To be called for all subsequent updates after the contour window has
+ been mapped and drawn.
+ *---------------------------------------------------------------------*/
+void update_contour_latitude()
+{
+
+ int tip_x, tip_y;
+ char stringo[20];
+
+ /*---------------------------------------------------*
+ print out the latitude in degrees
+ *---------------------------------------------------*/
+ sprintf(stringo,"Latitude: %d",(int)(rot_phi * DEGREES));
+ XClearArea(dsply, contourWindow, lat_str_X, lat_str_Y - 12,
+ lat_W, 18, False);
+ XDrawString(dsply, contourWindow, anotherGC,
+ lat_str_X, lat_str_Y,
+ stringo, strlen(stringo));
+
+ /*---------------------------------------------------*
+ calculate and draw the latitudal pointer
+ *---------------------------------------------------*/
+ GSetForeground(contourGC,(float)stickColor,X);
+ GDrawLine(contourGC /* ZZZ */, contourWindow,
+ lat_quad_X, lat_quad_Y,
+ last_tip_lat_x, last_tip_lat_y, X);
+ XSetForeground(dsply, contourGC, dotColor);
+ XFillArc(dsply, contourWindow, contourGC /* ZZZ */,
+ last_tip_lat_x - (dotSize>>1),
+ last_tip_lat_y - (dotSize>>1),
+ dotSize, dotSize,
+ 0, 360*64);
+ tip_x = (int)(sin(rot_phi) * (lat_RADIUS + dotExt)) + lat_quad_X;
+ tip_y = (int)(-cos(rot_phi) * (lat_RADIUS + dotExt)) + lat_quad_Y;
+ last_tip_lat_x = tip_x;
+ last_tip_lat_y = tip_y;
+ GSetForeground(contourGC,(float)stickColor,X);
+ GDrawLine(contourGC /* ZZZ */, contourWindow,
+ lat_quad_X, lat_quad_Y,
+ tip_x, tip_y, X);
+ XSetForeground(dsply, contourGC, dotColor);
+ XFillArc(dsply, contourWindow, contourGC /* ZZZ */,
+ tip_x - (dotSize>>1), tip_y - (dotSize>>1),
+ dotSize, dotSize,
+ 0, 360*64);
+
+} /* update_contour_latitude() */