TMS iCL DEVELOPERS GUIDE - TMS Software
TMS iCL DEVELOPERS GUIDE - TMS Software
TMS iCL DEVELOPERS GUIDE - TMS Software
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>TMS</strong> SOFTWARE<br />
<strong>TMS</strong> <strong>iCL</strong><br />
<strong>DEVELOPERS</strong> <strong>GUIDE</strong><br />
This code will return the correct coordinate of the center of the map, regardless of where the map<br />
is positioned. Clicking the button drops an annotation on the MapView:<br />
If you pan the Map, and click the button, the pin will be dropped in the center of the MapView<br />
again, but on a different coordinate. The XYToCoordinate functionality is using the current region,<br />
and zooming level of the MapView to return the correct coordinate.<br />
Pin vs View<br />
By default, the annotation that is added on the map displays a pin, but this can also be changed per<br />
annotation. On the annotation collection item, a Bitmap property is available to customize the<br />
default view of an annotation. The sample below shows how to add a custom image for an<br />
annotation.<br />
var<br />
loc: T<strong>TMS</strong>FMXNativeMKMapLocation;<br />
ann: T<strong>TMS</strong>FMXNativeMKAnnotation;<br />
begin<br />
loc := <strong>TMS</strong>FMXNativeMKMapView1.XYToCoordinate(<strong>TMS</strong>FMXNativeMKMapView1.Width<br />
/ 2, <strong>TMS</strong>FMXNativeMKMapView1.Height / 2);<br />
ann := <strong>TMS</strong>FMXNativeMKMapView1.AddAnnotation(loc, 'Hello World',<br />
'Subtitle');<br />
ann.Bitmap.LoadFromFile(ExtractFilePath(ParamStr(0))+'pin.png');<br />
70