Use custom markers in annotations
iherrera
Function TagCursorA1(traceName)
//tag trace at specified point
String traceName
Variable xValue = xcsr(A)
Tag/F=0/L=0/B=1/X=0.0/Y=0.0 $traceName, xValue, "\\$PICT$name=half_emf$/PICT$"
End
//tag trace at specified point
String traceName
Variable xValue = xcsr(A)
Tag/F=0/L=0/B=1/X=0.0/Y=0.0 $traceName, xValue, "\\$PICT$name=half_emf$/PICT$"
End
How can I use the markers that I defined using the WMMarkerHookStruct procedure to obtain the same result?
Here's the code I created for the hook function using the example provided in the help
Function CirclesMarkerProc(s)
STRUCT WMMarkerHookStruct &s
if( s.marker > 3 )
return 0
endif
Variable size= s.size-s.penThick/2
if( s.opaque )
SetDrawEnv linethick=0,fillpat=-1
DrawRect s.x-size,s.y-size,s.x+size,s.y+size
SetDrawEnv linethick=s.penThick
endif
switch(s.marker)
case 0: // Up
SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
DrawOval s.x-size,s.y-size,s.x+size,s.y+size
SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
DrawArc s.x,s.y,size-s.penThick,0,180
Break
case 1: //Right
SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
DrawOval s.x-size,s.y-size,s.x+size,s.y+size
SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
DrawArc s.x,s.y,size-s.penThick,-90,90
Break
case 2: // Bottom
SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
DrawOval s.x-size,s.y-size,s.x+size,s.y+size
SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
DrawArc s.x,s.y,size-s.penThick,180,0
Break
case 3: //left
SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
DrawOval s.x-size,s.y-size,s.x+size,s.y+size
SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
DrawArc s.x,s.y,size-s.penThick,90,-90
Break
endswitch
return 1
End
STRUCT WMMarkerHookStruct &s
if( s.marker > 3 )
return 0
endif
Variable size= s.size-s.penThick/2
if( s.opaque )
SetDrawEnv linethick=0,fillpat=-1
DrawRect s.x-size,s.y-size,s.x+size,s.y+size
SetDrawEnv linethick=s.penThick
endif
switch(s.marker)
case 0: // Up
SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
DrawOval s.x-size,s.y-size,s.x+size,s.y+size
SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
DrawArc s.x,s.y,size-s.penThick,0,180
Break
case 1: //Right
SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
DrawOval s.x-size,s.y-size,s.x+size,s.y+size
SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
DrawArc s.x,s.y,size-s.penThick,-90,90
Break
case 2: // Bottom
SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
DrawOval s.x-size,s.y-size,s.x+size,s.y+size
SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
DrawArc s.x,s.y,size-s.penThick,180,0
Break
case 3: //left
SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
DrawOval s.x-size,s.y-size,s.x+size,s.y+size
SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
DrawArc s.x,s.y,size-s.penThick,90,-90
Break
endswitch
return 1
End
I'll place the previous code place it in the code snippets section
Thanks
From the example in the "Custom Marker Hook Functions" topic:
SetWindow kwTopWin,markerHook={AudiologyMarkerProc,100,103}
That last command identifies the draw proc as AudiologyMarkerProc, and states that it should be called to draw markers with values between 100 and 103.
The start value of 100 is subtracted before being passed as s.marker, so the s.marker values are 0 to 3, not 100 to 103.
And that's why the marker(testw)=100 command is used to demonstrate AudiologyMarkerProc.
You can define your own range, say 555 to 558, but make sure you use marker(traceName)=555 for the s.marker=0:
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
August 1, 2012 at 03:14 pm - Permalink
Thanks for the clarification about the start and ending marker range Jim!
I would still like to know if a custom marker could be used as part of the
Tag
command. For example, a filled circle on top of the point selected can be drawn withIs there an equivalent command for a custom marker?
Any help would be appreciated
IH
August 2, 2012 at 10:49 am - Permalink
To see this run the marker hook example and then execute
Depending on your circumstances, you might have to add some dummy traces just to get the symbols.
For those not familiar with custom markers, execute the following:
I'll investigate the possibility of adding code to draw specific custom markers in textboxes.
August 2, 2012 at 02:14 pm - Permalink
Thanks for the reply Larry. I'll resort to this option and create a dummy trace with the x,y coordinates of the points that I want to tag.
IH
August 3, 2012 at 07:40 am - Permalink
This will be available in the next overnight build, Monday Aug 6 or later. You can get the nightly build here:
http://www.wavemetrics.net/Downloads/latest/
August 6, 2012 at 10:30 am - Permalink
http://www.wavemetrics.net/Downloads/latest/[/quote]
It works great Larry. Many thanks!
For those interested, here's is the code I use to tag the figure with the latest build
PauseUpdate; Silent 1 // building window...
Display /W=(398.25,132.5,915,502.25) testw,testw,testw,testw
ModifyGraph mode=3
ModifyGraph marker(testw)=200,marker(testw#1)=201,marker(testw#2)=202,marker(testw#3)=203
ModifyGraph offset(testw#1)={0,-0.2},offset(testw#2)={0,-0.4},offset(testw#3)={0,-0.6}
Tag/C/N=text0/F=0/B=1/X=10/Y=-10 testw#3, 1, "\\Z12\\W5203" //The updated \Wtddd escape code
SetWindow kwTopWin,markerHook={CirclesMarkerProc,200,203}
EndMacro
IH
August 7, 2012 at 02:10 pm - Permalink