Skip to Content

ABAP Development: HowTo add point objects to the map

The Visual Business component supports multiple point located objects:


  • Spot: Flat imaged based object consisting of a pin image and an icon
  • Box: 3D box object, which can be parameterized for scale, rotation, and color
  • Circle: Circle object
  • Pie Chart: 3D-Pie Chart
  • Collada: Arbitrary 3D object loaded from a Collada DAE file

The basis creation for all those location based objects is the same and shown in this HowTo. In order to show an object on a location on the map we need to add it to the scene. The use of the API is independent from the actual UI technology the VB control is used with. However, there might be also specific API wrappers in certain integration scenarios, e.g. in the FPM integration.First you need to fill a structure of type IF_VBI_SERVICE_PROVIDER=>SPOT_ENTRY. You need to fill field ID and optionally GUID. In case the later is left empty, the Scene Manager will assign a GUID internally. Important NoticeIconThe GUID will be the primary key of the object and is also given in the event data in order to specify the event source. Thus we recommend to assign the GUID on application level. You may create a suitable GUID on your own with method CL_VBI_SCENE_MANAGER=>GET_NEW_OBJECT_GUID().Since our object is location based, we need to specify this location. This is done by filling sub-structure POSITION. The field XPOS holds the longitude and YPOS the latitude value of the location. The ZPOS remains initial as it makes no sense in most cases.The actual object type is determined by the value of field TYPE. The possible values are given as constants in interface IF_VBI_CONST attribute structure GC_SCENE_OBJECT_TYPE. The base for location based objects is a spot. Thus we choose this type (IF_VBI_CONST=>GC_SCENE_OBJECT_TYPE-IMAGE) for our example to keep it simple. All other types need additional object specific properties. There use is described in this document ABAP Development: Specific properties of location based objects in detail.If the spot object should have a tooltip you can fill sub-table DESCRIPTION. This table allows you to have multi-line tooltips. This table can also store data to be shown in a detail window. The purpose of an entry is determined by field CATEGORY. The available values are defined in IF_VBI_CONST=>GC_DESCR_CATEGORY.Structure IF_VBI_SERVICE_PROVIDER=>SPOT_ENTRY provides also a set of flags:


  • HIGHLIGHTED: allows you to highlight the object by using a different pin image (by default with a yellow pin border).
  • FLY_TO: indicates that you want an animated zoom to the object location.
  • SELECTED: Indicates the object as selected (by default with a grey pin border)
  • FIXED: Protects the object against easy deletion


Finally you can assign one or more roles to the object by adding them to sub-table ROLES. The role will influence the icon of the spot. The pre-defined roles are defined in constants interface IF_VBI_GEOMAP_CONST structure attribute GC_OBJECT_ROLE.

In order to send the new object to the GeoMap the structure is added to a table of type IF_VBI_SERVICE_PROVIDER=>SPOT_TAB. This table is than given to the GeoMap service provider by calling method UPDATE_SCENE_OBJECTS as parameter IT_SPOTS.

After this you may add further object to the scene. Once your are done you need to trigger the update of the frontend control by raising event IF_VBI_CONST=>GC_EVENT-DISPLAY_SCENE on the scene manager (method HANDLE_EVENT).

The following code snipped from local class LCL_APPLICATION (inheriting from CL_VBI_GEOMAP_APPLICATION) of program VBI_GUI_TEST method ADD_SPOT is an easy example on how to create a spot object:

   data: LS_SPOT type IF_VBI_SERVICE_PROVIDER=>SPOT_ENTRY,

   LT_SPOTS type IF_VBI_SERVICE_PROVIDER=>SPOTS_TAB.

   LS_SPOT-ID = IS_DATA-OBJECT_ID.

   LS_SPOT-TYPE = IF_VBI_CONST=>GC_SCENE_OBJECT_TYPE-IMAGE.

* copy position

   LS_SPOT-POSITION-XPOS = IS_DATA-SPOT_POS_LON.

   LS_SPOT-POSITION-YPOS = IS_DATA-SPOT_POS_LAT.

* copy role

   insert IS_DATA-ROLE into table LS_SPOT-ROLES.

* copy tooltip and detail

   data: LS_DESCR_ENTRY type VBI_S_OBJECT_DESCR_ENTRY.

   LS_DESCR_ENTRY-CATEGORY = IF_VBI_CONST=>GC_DESCR_CATEGORY-BOTH.

   LS_DESCR_ENTRY-PART = IF_VBI_CONST=>GC_DESCR_PART-CAPTION.

   LS_DESCR_ENTRY-FIELD_NAME = 'Object'(004).

   LS_DESCR_ENTRY-VALUE = IS_DATA-OBJECT_ID.

   append LS_DESCR_ENTRY to LS_SPOT-DESCRIPTION.

   LS_DESCR_ENTRY-CATEGORY = IF_VBI_CONST=>GC_DESCR_CATEGORY-TOOLTIP.

   LS_DESCR_ENTRY-PART = IF_VBI_CONST=>GC_DESCR_PART-BODY.

   LS_DESCR_ENTRY-FIELD_NAME = 'Tooltip'(005).

   LS_DESCR_ENTRY-VALUE = IS_DATA-TOOLTIP.

   append LS_DESCR_ENTRY to LS_SPOT-DESCRIPTION.

   LS_DESCR_ENTRY-CATEGORY = IF_VBI_CONST=>GC_DESCR_CATEGORY-DETAIL.

   LS_DESCR_ENTRY-PART = IF_VBI_CONST=>GC_DESCR_PART-BODY.

   LS_DESCR_ENTRY-FIELD_NAME = 'Detail'(006).

   LS_DESCR_ENTRY-VALUE = IS_DATA-DETAIL.

   append LS_DESCR_ENTRY to LS_SPOT-DESCRIPTION.

   LS_SPOT-FLY_TO = ABAP_TRUE.

   LS_SPOT-HIGHLIGHTED = IS_DATA-HIGHLIGHTED.

   append LS_SPOT to LT_SPOTS.

   ME->SERVICE_PROVIDER->UPDATE_SCENE_OBJECTS( IT_SPOTS = LT_SPOTS ).

   if IV_SUPPRESS_UPDATE ne ABAP_TRUE.

   ME->SERVICE_PROVIDER->HANDLE_SCENE_EVENT( IV_EVENT_ID = IF_VBI_CONST=>GC_EVENT-DISPLAY_SCENE ).

   endif.

The result looks like this:

Tags:
Former Member

No comments