/***********************************************************************
* 
*               *****   ***    ***
*                  *   *   *  *   *
*                 *     ***    ***
*                *     *   *  *   *
*               *****   ***    ***
*
* A FREE Finite Elements Analysis Program in ANSI C for the UNIX OS.
*
* Composed and edited and copyright by 
* Professor Dr.-Ing. Frank Rieg, University of Bayreuth, Germany
*
* eMail: 
* frank.rieg@uni-bayreuth.de
* dr.frank.rieg@t-online.de
* 
* V9.0  November 9, 1998
*
* Z88 should compile and run under any UNIX OS and Motif 2.0.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING.  If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
***********************************************************************/ 
/*****************************************************************************
*  vp88
*  15.7.2002 Rieg
*****************************************************************************/
/*****************************************************************************
* UNIX
*****************************************************************************/
#ifdef FR_UNIX
#include <z88p.h>
#include <stdlib.h>  /* exit */
#include <string.h>  /* strlen,strcpy,strcat */
#include <stdio.h>   /* fopen, fprintf, fclose, sprintf */
#include <Xm/XmAll.h>
#endif

/****************************************************************************
*  Start vp88
****************************************************************************/
int vp88(Widget hcallw)
{
extern GC hgc[];

extern FR_DOUBLE rotx,roty,rotz;

extern FR_INT4AY ityp;
extern FR_INT4AY koffs;
extern FR_INT4AY koi;
extern FR_INT4AY kx;
extern FR_INT4AY ky;

extern FR_INT4 ne,nkp;

extern int IX_DRAWAR,IY_DRAWAR;
extern int iflabe,ifverf,ifstala,ifansi;

GC gc;

FR_INT4 k,i;

int idigit= 4;
int ix[21],iy[21],itx,ity; 

size_t laeng,laengx,laengy,laengz;

char cst[6],crotx[20],croty[20],crotz[20],crx[30],cry[30],crz[30];  

/***********************************************************************
*  Grafikkontext waehlen
***********************************************************************/
if(ifverf== IDM_UNVERFORMT) gc= hgc[0];
else                        gc= hgc[1];

/***********************************************************************
*  grosse elementschleife
***********************************************************************/
for(k= 1L; k <= ne; k++)
  {  

/*----------------------------------------------------------------------
* 8 punkte fuer 8-k hexaeder
*---------------------------------------------------------------------*/
  if(ityp[k]== 1)
    {
    for(i= 1; i <= 8; i++)
      {
      ix[i]= kx[koi[koffs[k]+i-1]];
      iy[i]= ky[koi[koffs[k]+i-1]];
      }

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[2],iy[2]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[3],iy[3]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[4],iy[4]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[4],iy[4],ix[1],iy[1]);

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[5],iy[5]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[6],iy[6]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[7],iy[7]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[4],iy[4],ix[8],iy[8]);

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[5],iy[5],ix[6],iy[6]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[6],iy[6],ix[7],iy[7]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[7],iy[7],ix[8],iy[8]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[8],iy[8],ix[5],iy[5]);

    if( (iflabe== IDM_ELEMENTE || iflabe== IDM_ALLES) &&
         ifstala == ID_ENABLELABELS)
      {
/*======================================================================
*     elementnummern plotten
*=====================================================================*/
      itx= (int) ((ix[1] + ix[7])*0.5); 
      ity= (int) ((iy[1] + iy[7])*0.5); 

      sprintf(cst,"%ld",k);
      laeng= strlen(cst);

      XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                  hgc[3],itx,ity,cst,(int)laeng);
      }
    }

/*----------------------------------------------------------------------
* 2 punkte fuer raeuml stab, ebenen stab, balken & welle
*---------------------------------------------------------------------*/
  else if(ityp[k]== 2 || ityp[k]== 4 || ityp[k]== 5 ||
          ityp[k]== 9 || ityp[k]== 13)
    {
    for(i= 1; i <= 2; i++)
      {
      ix[i]= kx[koi[koffs[k]+i-1]];
      iy[i]= ky[koi[koffs[k]+i-1]];
      }

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[2],iy[2]);

    if( (iflabe== IDM_ELEMENTE || iflabe== IDM_ALLES) &&
         ifstala == ID_ENABLELABELS)
      {
/*======================================================================
*     elementnummern plotten
*=====================================================================*/
      itx= (int) ((ix[1] + ix[2])*0.5); 
      ity= (int) ((iy[1] + iy[2])*0.5); 

      sprintf(cst,"%ld",k);
      laeng= strlen(cst);

      XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                  hgc[3],itx,ity,cst,(int)laeng);
                  
      }
    }

/*----------------------------------------------------------------------
* 6 punkte fuer 6-k scheibe + torus + platte 
*---------------------------------------------------------------------*/
  else if(ityp[k]== 3 || ityp[k]== 14 || ityp[k]== 15 || ityp[k]== 18)
    {
    for(i= 1; i <= 6; i++)
      {
      ix[i]= kx[koi[koffs[k]+i-1]];
      iy[i]= ky[koi[koffs[k]+i-1]];
      }
 
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[4],iy[4]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[4],iy[4],ix[2],iy[2]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[5],iy[5]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[5],iy[5],ix[3],iy[3]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[6],iy[6]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[6],iy[6],ix[1],iy[1]);

    if( (iflabe== IDM_ELEMENTE || iflabe== IDM_ALLES) &&
         ifstala == ID_ENABLELABELS)
      {
/*======================================================================
*     elementnummern plotten
*=====================================================================*/
      itx= (int) ((ix[1] + ix[2] + ix[3])*0.333); 
      ity= (int) ((iy[1] + iy[2] + iy[3])*0.333); 

      sprintf(cst,"%ld",k);
      laeng= strlen(cst);

      XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                  hgc[3],itx,ity,cst,(int)laeng);
                  
      }
    }

/*----------------------------------------------------------------------
* 3 punkte fuer 3-k torus 
*---------------------------------------------------------------------*/
  else if(ityp[k]== 6)
    {
    for(i= 1; i <= 3; i++)
      {
      ix[i]= kx[koi[koffs[k]+i-1]];
      iy[i]= ky[koi[koffs[k]+i-1]];
      }

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[2],iy[2]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[3],iy[3]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[1],iy[1]);

    if( (iflabe== IDM_ELEMENTE || iflabe== IDM_ALLES) &&
         ifstala == ID_ENABLELABELS)
      {
/*======================================================================
*     elementnummern plotten
*=====================================================================*/
      itx= (int) ((ix[1] + ix[2] + ix[3])*0.333); 
      ity= (int) ((iy[1] + iy[2] + iy[3])*0.333); 

      sprintf(cst,"%ld",k);
      laeng= strlen(cst);

      XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                  hgc[3],itx,ity,cst,(int)laeng);
                  
      }
    }

/*----------------------------------------------------------------------
* 8 punkte fuer 8-k serendipity-scheibe & -torus und platte 20
*---------------------------------------------------------------------*/
  if(ityp[k]== 7 || ityp[k]== 8|| ityp[k]== 20)
    {
    for(i= 1; i <= 8; i++)
      {
      ix[i]= kx[koi[koffs[k]+i-1]];
      iy[i]= ky[koi[koffs[k]+i-1]];
      }

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[5],iy[5]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[5],iy[5],ix[2],iy[2]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[6],iy[6]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[6],iy[6],ix[3],iy[3]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[7],iy[7]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[7],iy[7],ix[4],iy[4]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[4],iy[4],ix[8],iy[8]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[8],iy[8],ix[1],iy[1]);

    if( (iflabe== IDM_ELEMENTE || iflabe== IDM_ALLES) &&
         ifstala == ID_ENABLELABELS)
      {
/*======================================================================
*     elementnummern plotten
*=====================================================================*/
      itx= (int) ((ix[1] + ix[3])*0.5); 
      ity= (int) ((iy[1] + iy[3])*0.5); 

      sprintf(cst,"%ld",k);
      laeng= strlen(cst);

      XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                  hgc[3],itx,ity,cst,(int)laeng);
                  
      }
    }

/*----------------------------------------------------------------------
* 20 punkte fuer 20-k hexaeder
*---------------------------------------------------------------------*/
  else if(ityp[k]== 10)
    {
    for(i= 1; i <= 20; i++)
      {
      ix[i]= kx[koi[koffs[k]+i-1]];
      iy[i]= ky[koi[koffs[k]+i-1]];
      }

/*======================================================================
* obere ebene
*=====================================================================*/
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[9],iy[9]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[9],iy[9],ix[2],iy[2]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[10],iy[10]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[10],iy[10],ix[3],iy[3]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[11],iy[11]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[11],iy[11],ix[4],iy[4]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[4],iy[4],ix[12],iy[12]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[12],iy[12],ix[1],iy[1]);

/*======================================================================
* untere ebene
*=====================================================================*/
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[5],iy[5],ix[13],iy[13]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[13],iy[13],ix[6],iy[6]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[6],iy[6],ix[14],iy[14]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[14],iy[14],ix[7],iy[7]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[7],iy[7],ix[15],iy[15]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[15],iy[15],ix[8],iy[8]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[8],iy[8],ix[16],iy[16]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[16],iy[16],ix[5],iy[5]);

/*======================================================================
* mittlere ebene
*=====================================================================*/
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[17],iy[17]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[17],iy[17],ix[5],iy[5]);

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[18],iy[18]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[18],iy[18],ix[6],iy[6]);

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[19],iy[19]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[19],iy[19],ix[7],iy[7]);

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[4],iy[4],ix[20],iy[20]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[20],iy[20],ix[8],iy[8]);

    if( (iflabe== IDM_ELEMENTE || iflabe== IDM_ALLES) &&
         ifstala == ID_ENABLELABELS)
      {
/*======================================================================
*     elementnummern plotten
*=====================================================================*/
      itx= (int) ((ix[1] + ix[7])*0.5); 
      ity= (int) ((iy[1] + iy[7])*0.5); 

      sprintf(cst,"%ld",k);
      laeng= strlen(cst);

      XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                  hgc[3],itx,ity,cst,(int)laeng);
                  
      }
    }

/*----------------------------------------------------------------------
* 12 punkte fuer 12-k serendipity-scheibe & -torus
*---------------------------------------------------------------------*/
  else if(ityp[k]== 11 || ityp[k]== 12)
    {
    for(i= 1; i <= 12; i++)
      {
      ix[i]= kx[koi[koffs[k]+i-1]];
      iy[i]= ky[koi[koffs[k]+i-1]];
      }

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[5],iy[5]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[5],iy[5],ix[6],iy[6]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[6],iy[6],ix[2],iy[2]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[7],iy[7]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[7],iy[7],ix[8],iy[8]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[8],iy[8],ix[3],iy[3]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[9],iy[9]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[9],iy[9],ix[10],iy[10]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[10],iy[10],ix[4],iy[4]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[4],iy[4],ix[11],iy[11]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[11],iy[11],ix[12],iy[12]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[12],iy[12],ix[1],iy[1]);

    if( (iflabe== IDM_ELEMENTE || iflabe== IDM_ALLES) &&
         ifstala == ID_ENABLELABELS)
      {
/*======================================================================
*     elementnummern plotten
*=====================================================================*/
      itx= (int) ((ix[1] + ix[3])*0.5); 
      ity= (int) ((iy[1] + iy[3])*0.5); 

      sprintf(cst,"%ld",k);
      laeng= strlen(cst);

      XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                  hgc[3],itx,ity,cst,(int)laeng);
                  
      }
    }

/*----------------------------------------------------------------------
* 12 punkte fuer 16-k lagrange platte
*---------------------------------------------------------------------*/
  else if(ityp[k]== 19)
    {
    for(i= 1; i <= 16; i++)
      {
      ix[i]= kx[koi[koffs[k]+i-1]];
      iy[i]= ky[koi[koffs[k]+i-1]];
      }

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[2],iy[2]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[3],iy[3]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[4],iy[4]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[4],iy[4],ix[8],iy[8]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[8],iy[8],ix[12],iy[12]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[12],iy[12],ix[16],iy[16]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[16],iy[16],ix[15],iy[15]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[15],iy[15],ix[14],iy[14]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[14],iy[14],ix[13],iy[13]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[13],iy[13],ix[9],iy[9]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[9],iy[9],ix[5],iy[5]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[5],iy[5],ix[1],iy[1]);

    if( (iflabe== IDM_ELEMENTE || iflabe== IDM_ALLES) &&
         ifstala == ID_ENABLELABELS)
      {
/*======================================================================
*     elementnummern plotten
*=====================================================================*/
      itx= (int) ((ix[1] + ix[16])*0.5); 
      ity= (int) ((iy[1] + iy[16])*0.5); 

      sprintf(cst,"%ld",k);
      laeng= strlen(cst);

      XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                  hgc[3],itx,ity,cst,(int)laeng);
                  
      }
    }

/*----------------------------------------------------------------------
* 4 punkte fuer 4-k tetraeder
*---------------------------------------------------------------------*/
  else if(ityp[k]== 17)
    {
    for(i= 1; i <= 4; i++)
      {
      ix[i]= kx[koi[koffs[k]+i-1]];
      iy[i]= ky[koi[koffs[k]+i-1]];
      }

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[2],iy[2]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[3],iy[3]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[1],iy[1]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[4],iy[4]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[4],iy[4]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[4],iy[4]);

    if( (iflabe== IDM_ELEMENTE || iflabe== IDM_ALLES) &&
         ifstala == ID_ENABLELABELS)
      {
/*======================================================================
*     elementnummern plotten
*=====================================================================*/
      itx= (int) ((ix[1] + ix[2] + ix[3] + ix[4])*0.25); 
      ity= (int) ((iy[1] + iy[2] + iy[3] + iy[4])*0.25); 

      sprintf(cst,"%ld",k);
      laeng= strlen(cst);

      XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                  hgc[3],itx,ity,cst,(int)laeng);
                  
      }
    }

/*----------------------------------------------------------------------
* 10 punkte fuer 10-k tetraeder
*---------------------------------------------------------------------*/
  else if(ityp[k]== 16)
    {
    for(i= 1; i <= 10; i++)
      {
      ix[i]= kx[koi[koffs[k]+i-1]];
      iy[i]= ky[koi[koffs[k]+i-1]];
      }

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[5],iy[5]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[5],iy[5],ix[2],iy[2]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[6],iy[6]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[6],iy[6],ix[3],iy[3]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[7],iy[7]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[7],iy[7],ix[1],iy[1]);

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[1],iy[1],ix[10],iy[10]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[10],iy[10],ix[4],iy[4]);

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[2],iy[2],ix[8],iy[8]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[8],iy[8],ix[4],iy[4]);

    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[3],iy[3],ix[9],iy[9]);
    XDrawLine(XtDisplay(hcallw),XtWindow(hcallw),gc,ix[9],iy[9],ix[4],iy[4]);

    if( (iflabe== IDM_ELEMENTE || iflabe== IDM_ALLES) &&
         ifstala == ID_ENABLELABELS)
      {
/*======================================================================
*     elementnummern plotten
*=====================================================================*/
      itx= (int) ((ix[1] + ix[2] + ix[3] + ix[4])*0.25); 
      ity= (int) ((iy[1] + iy[2] + iy[3] + iy[4])*0.25); 

      sprintf(cst,"%ld",k);
      laeng= strlen(cst);

      XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                  hgc[3],itx,ity,cst,(int)laeng);
                  
      }
    }


  } /* ende grosse elementschleife */

/***********************************************************************
*  ggf knotennummern plotten
***********************************************************************/ 
if((iflabe== IDM_KNOTEN || iflabe== IDM_ALLES) &&
    ifstala == ID_ENABLELABELS)
  {
  for(i= 1L; i <= nkp; i++)
    {
    itx= kx[i];
    ity= ky[i];

    sprintf(cst,"%ld",i);
    laeng= strlen(cst);

    XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                hgc[2],itx,ity,cst,(int)laeng);
    }
  }

if(ifansi== IDM_3DIM)
  {
  gcvt(rotx,idigit,crotx);
  gcvt(roty,idigit,croty);
  gcvt(rotz,idigit,crotz);
  strcpy(crx,"ROTX= ");
  strcpy(cry,"ROTY= ");
  strcpy(crz,"ROTZ= ");
  strcat(crx,crotx);
  strcat(cry,croty);
  strcat(crz,crotz);
  laengx= strlen(crx);
  laengy= strlen(cry);
  laengz= strlen(crz);
  
  itx= IX_DRAWAR+10;
  ity= IY_DRAWAR+20;

  XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                hgc[0],itx,ity,crx,(int)laengx);

  itx= IX_DRAWAR+10;
  ity= IY_DRAWAR+35;
  XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                hgc[0],itx,ity,cry,(int)laengy);

  itx= IX_DRAWAR+10;
  ity= IY_DRAWAR+50;
  XDrawString(XtDisplay(hcallw),XtWindow(hcallw),
                hgc[0],itx,ity,crz,(int)laengz);
  }

return 0;
}

