drawFecEntity.c File Reference

#include "drawFecEntity.h"
#include "MALLOC.h"
#include "GetProperty.h"
#include "Xcall1.h"
#include "periScreen.h"
#include "sciCall.h"
#include "sciprint.h"
#include "PloEch.h"
#include "axesScale.h"
#include "Fec.h"
#include "Vertices.h"

Include dependency graph for drawFecEntity.c:

Go to the source code of this file.

Functions

int drawFecEntity (sciPointObj *pObj)


Function Documentation

int drawFecEntity ( sciPointObj pObj  ) 

Routine which draw a fec object

Parameters:
pObj the pointer on the fec object

Definition at line 21 of file drawFecEntity.c.

References C2F, sciFec::colminmax, sciFec::colout, dr(), FREE, i, L, MALLOC, MaybeSetWinhdc(), newfec(), sciFec::Nnode, sciFec::Ntr, NULL, PD0, pFEC_FEATURE, sciFec::pfun, PI0, sciFec::pnoeud, sciFec::pvecx, sciFec::pvecy, ReleaseWinHdc(), ReverseDataFor3DXonly(), ReverseDataFor3DYonly(), sciGetIs3d(), sciGetParentSubwin(), sciGetVisibility(), sciprint(), trans3d(), sciFec::with_mesh, XScale(), YScale(), and sciFec::zminmax.

Referenced by sciDrawObj().

00022 {
00023   sciFec      * ppFec        = pFEC_FEATURE(pObj)       ;
00024   sciPointObj * parentSubWin = sciGetParentSubwin(pObj) ;
00025   int           curLineStyle = 0                        ;
00026   int           lineStyle    = 1                        ;
00027   int           verbose      = 0                        ;
00028   int           nbNode       = ppFec->Nnode             ;
00029   int         * xCoords      = NULL                     ;
00030   int         * yCoords      = NULL                     ;
00031   int           narg         = 1                        ;
00032   int           i                                       ;
00033 
00034   if ( !sciGetVisibility( pObj ) ) { return 0 ; }
00035 
00036   xCoords = MALLOC( nbNode * sizeof(int) ) ;
00037   if ( xCoords == NULL )
00038   {
00039     sciprint("Can not allocate temporary vector, memory full.\n") ;
00040     return -1 ;
00041   }
00042 
00043   yCoords = MALLOC( nbNode * sizeof(int) ) ;
00044   if ( yCoords == NULL )
00045   {
00046     FREE( xCoords ) ;
00047     sciprint("Can not allocate temporary vector, memory full.\n") ;
00048     return -1 ;
00049   }
00050 
00051   if ( sciGetIs3d( parentSubWin ) )
00052   {
00053     double * xVect = NULL;
00054     double * yVect = NULL;
00055 
00056     xVect = MALLOC ( nbNode * sizeof(double) ) ;
00057     if ( xVect == NULL )
00058     {
00059       FREE( xCoords ) ;
00060       FREE( yCoords ) ;
00061       return -1 ;
00062     }
00063 
00064     yVect = MALLOC ( nbNode * sizeof(double) ) ;
00065     if ( yVect == NULL )
00066     {
00067       FREE( xVect   ) ;
00068       FREE( xCoords ) ;
00069       FREE( yCoords ) ;
00070       return -1 ;
00071     }
00072 
00073     for( i = 0 ; i < nbNode ; i++ )
00074     {
00075       xVect[i] = ppFec->pvecx[i];
00076       yVect[i] = ppFec->pvecy[i];
00077     }
00078 
00079     ReverseDataFor3DXonly( parentSubWin, xVect, nbNode ) ;
00080     ReverseDataFor3DYonly( parentSubWin, yVect, nbNode ) ;
00081 
00082     trans3d( parentSubWin, nbNode, xCoords, yCoords, xVect, yVect, NULL ) ;
00083 
00084     FREE(xVect) ;
00085     FREE(yVect) ;
00086   }
00087   else
00088   {
00089     for ( i = 0 ; i < nbNode ; i++ )
00090     {
00091       xCoords[i] = XScale( ppFec->pvecx[i] ) ; 
00092       yCoords[i] = YScale( ppFec->pvecy[i] ) ;
00093     }
00094   }
00095 
00096 #ifdef _MSC_VER
00097   flag_DO = MaybeSetWinhdc();
00098 #endif
00099 
00100   /* need to put line style to plain otherwise bug 1872 occurs */
00101   C2F(dr)("xget","line style",&verbose,&curLineStyle,&narg,PI0,PI0,PI0,PD0,PD0,PD0,PD0,0L,0L);
00102   C2F(dr)("xset", "line style", &lineStyle, PI0, PI0, PI0, PI0, PI0, PD0, PD0, PD0, PD0, 0L, 0L);
00103 
00104   newfec( xCoords,yCoords,ppFec->pnoeud,ppFec->pfun,
00105     &ppFec->Nnode,&ppFec->Ntr,
00106     ppFec->zminmax,ppFec->colminmax,
00107     ppFec->colout, ppFec->with_mesh ) ;
00108 
00109   C2F(dr)("xset", "line style", &curLineStyle, PI0, PI0, PI0, PI0, PI0, PD0, PD0, PD0, PD0, 0L, 0L);
00110 
00111 #ifdef _MSC_VER
00112   if ( flag_DO == 1) { ReleaseWinHdc() ; }
00113 #endif
00114 
00115   FREE( xCoords ) ;
00116   FREE( yCoords ) ;
00117 
00118   return 0 ;
00119 
00120 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Sun Mar 4 15:47:19 2007 for Scilab [trunk] by  doxygen 1.5.1