1 /***********************************************************************
12 HISTORIQUE DES MODIFICATIONS :
13 --------------------------------
14 xx-xx-xx : xxx ; Creation.
15 11-03-96 : FMN ; Correction warning compilation
16 01-04-96 : CAL ; Integration MINSK portage WNT
17 08-07-96 : BGN ; (PRO4768) suppression du cas particulier TEL_PM_DOT.
18 21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c
19 19-10-96 : CAL ; Restauration du cas particulier TEL_PM_DOT mais
20 avec la correction sur la mise a jour du pointSize.
22 ************************************************************************/
24 /*----------------------------------------------------------------------*/
30 #include <OpenGl_tgl_all.hxx>
39 #include <OpenGl_cmn_varargs.hxx>
40 #include <OpenGl_telem_attri.hxx>
41 #include <OpenGl_tsm.hxx>
42 #include <OpenGl_telem.hxx>
43 #include <OpenGl_telem_highlight.hxx>
44 #include <OpenGl_telem_inquire.hxx>
46 static TStatus MarkerSetDisplay( TSM_ELEM_DATA, Tint, cmn_key* );
47 static TStatus MarkerSetAdd( TSM_ELEM_DATA, Tint, cmn_key* );
48 static TStatus MarkerSetDelete( TSM_ELEM_DATA, Tint, cmn_key* );
49 static TStatus MarkerSetPrint( TSM_ELEM_DATA, Tint, cmn_key* );
50 static TStatus MarkerSetInquire( TSM_ELEM_DATA, Tint, cmn_key* );
53 extern GLuint GetListIndex(int);
55 static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
57 MarkerSetDisplay, /* PickTraverse */
67 TelMarkerSetInitClass( TelType* el )
73 extern GLuint markerBase;
75 MarkerSetAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
82 data = new TEL_POINT_DATA();
86 data->data = new TEL_POINT[num];
90 for( i=0, ptr=(tel_point)(k[0]->data.pdata); i<num; i++ )
92 data->data[i] = ptr[i];
96 ((tsm_elem_data)(d.pdata))->pdata = data;
103 MarkerSetDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k )
108 CMN_KEY key1, key2, key3;
112 key1.id = TelPolymarkerColour;
113 key1.data.pdata = &colour;
115 key2.id = TelPolymarkerType;
116 key3.id = TelPolymarkerSize;
117 TsmGetAttri( 3, &key1, &key2, &key3 );
119 if( k[0]->id == TOn )
120 { /* Use highlight colours */
123 key1.id = TelHighlightIndex;
124 TsmGetAttri( 1, &key1 );
125 if( TelGetHighlightRep( TglActiveWs, key1.data.ldata, &hrep )
130 TelGetHighlightRep( TglActiveWs, 0, &hrep );
135 glColor3fv( colour.rgb );
136 d = (tel_point_data)data.pdata;
139 if( key2.data.ldata == TEL_PM_DOT )
141 glPointSize( key3.data.fdata );
142 glBegin( GL_POINTS );
143 for( i=0; i<d->num; i++, ptr++ )
144 glVertex3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] );
150 glGetIntegerv( GL_RENDER_MODE, &mode );
152 if( key2.data.ldata == TEL_PM_USERDEFINED )
154 for( i=0; i<d->num; i++, ptr++ )
156 glRasterPos3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] );
157 glCallList( GetListIndex( (int)key3.data.fdata ) );
158 if( mode==GL_FEEDBACK )
160 glBegin( GL_POINTS );
161 glVertex3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] );
163 /* it is necessary to indicate end of marker information */
169 str = TelGetStringForPM( key2.data.ldata, key3.data.fdata );
170 glListBase(markerBase);
171 for( i=0; i<d->num; i++, ptr++ )
173 glRasterPos3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] );
174 glCallLists(strlen( (char*)str ), GL_UNSIGNED_BYTE, (GLubyte *) str );
176 if( mode==GL_FEEDBACK )
178 glBegin( GL_POINTS );
179 glVertex3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] );
191 MarkerSetDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k )
202 MarkerSetPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
207 p = (tel_point_data)data.pdata;
209 fprintf( stdout, "TelMarkerSet. Number of points: %d\n", p->num );
210 for( i = 0; i < p->num; i++ )
212 fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, p->data[i].xyz[0],
213 p->data[i].xyz[1], p->data[i].xyz[2] );
215 fprintf( stdout, "\n" );
222 MarkerSetInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
227 TStatus status = TSuccess;
229 d = (tel_point_data)data.pdata;
231 size_reqd = d->num * sizeof( TEL_POINT );
233 for( i = 0; i < n; i++ )
237 case INQ_GET_SIZE_ID:
239 k[i]->data.ldata = size_reqd;
243 case INQ_GET_CONTENT_ID:
248 c = (tel_inq_content)k[i]->data.pdata;
249 c->act_size = size_reqd;
252 if( c->size >= size_reqd )
254 w->pts3 = (tel_point)(c->buf);
256 for( j = 0; j < d->num; j++ )
257 w->pts3[j] = d->data[j];