The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Class: TContourPlot
Declaration: function FindNearestAnnoElem (mx, my: double; ItemID: TrcItem; ClassNumber: byte; VisLayersOnly: boolean; var Dist: double): longint;

The function FindNearestAnnoElem searches for the annotation item which is closest to the point [mx,my], belongs to the item type ItemID, and has a class number of ClassNumber. In order to search through all items in the annotation container, ItemID should be set to tkEverything and ClassNumber must be 255. Setting the parameter VisLayersOnly to TRUE restricts the search to visible layers only.

Please note that only annotation elements can searched which can be drawn on the canvas (i.e. MoveTo elements cannot be searched).

The function returns the index of the closest annotation item, a value of -1 indicating that no element has been found. In addition, the variable parameter Dist contains the distance of the found item.

Hint: The distances between the reference point [mx,my] and the annotation items of the chart are calculated using screen coordinates (instead of world coordinates).

Last Update: 2017-Sep-11