Printable versions
This Page
All Pages
PDF (2.0MB)

Index

Component
GpsViewNET

Interface
IDrawObject

Properties
ObjectType

IDrawObject GpsTools v2.00 and later

All objects that can be drawn on a map implements this interface, it is used to be able to identify the type of a specific object returned from some methods.

E.g. Map.GetByID can return any the following objects: Ellipse, Rectangle, Line and Icon. To determine what type of object was returned, the object can be casted to a IDrawObject and IDrawObject.ObjectType can be examined to determine the type.

This is how it is done in Visual Basic:
Dim iDraw As IDrawObject
Dim objRect As Rectangle
Dim objEllipse As Ellipse
Dim objLine As Line
Dim objIcon As Icon

Set iDraw = Map1.GetByIndex(1) ' Get first object on map

Select Case iDraw.ObjectType
Case DOBJECT_ICON ' 1
  Set objIcon = iDraw ' Icon!
Case DOBJECT_LINE ' 2
  Set objLine = iDraw ' Line!
Case DOBJECT_ELLIPSE ' 3
  Set objEllipsen = iDraw ' Ellipse!
Case DOBJECT_RECTANGLE ' 4
  Set objRectangle = iDraw ' Rectangle!
End Select



100% managed code
© 2016 Franson Technology AB, All rights reserved, Contact | | Affiliate | Login