Initialize the datatip structure associated with the given polyline.
ok=datatipInitStruct(curve_handle,varargin)
:curve_handle A handle on an entity compatible with datatips : :varargin A sequence of pairs (<field name>,<field value>) used to
add or customize fields of the datatips data structure.
:
This function is called by `datatipCreate`_to create a data structure for tips stored in the polyline entity user_data field.
This function as to be called only is one want to customize the datatips data structure fields
The datatips data structure is a tlist of type “datatips” with at least the following fields.
:
Others fields can be added by the programmer to the datatips data structure through the datatipInitStruct varargin optional arguments.
t=`linspace`_(0,10,1000);
`clf`_();
`plot`_(t.*`sin`_(t),t.*`cos`_(t),1.5*t.*`sin`_(t),1.5*t.*`cos`_(1.5*t));
e=`gce`_();
p1=e.children(1);//get the handle on the polyline
p2=e.children(2);//get the handle on the polyline
function str=mytipfmt(curve, pt, index)
ds=`datatipGetStruct`_(curve)
if index<>[] then
t=ds.param(index);
else //interpolated
[d,ptp,i,c]=`orthProj`_(curve.data,pt);
t=ds.param(i)+(ds.param(i+1)-ds.param(i))*c;
end
str=`msprintf`_("%s\nt=%-0.3g",ds.name,t);
endfunction
ok=datatipInitStruct(p1,"formatfunction","mytipfmt","param",t,"name","curve");
ok=datatipInitStruct(p2,"formatfunction","mytipfmt","param",t,"name","spiral","style",[2 0]);
`datatipCreate`_(p1,500);
`datatipCreate`_(p1,900);
`datatipCreate`_(p2,750);