Skip to Content
SAP Visual Business

ABAP Development: Specific properties of location based objects

Tags:

Since the additional properties vary per object type they are not part of structure IF_VBI_SERVICE_PROVIDER=>SPOT_ENTRY. However, this structure has a field SPECIFIC_PROPERTIES of type REF TO DATA. This allows you to refer to a data object holding the additional properties for a certain instance. The available properties are defined for each object type as structure types in interface IF_VBI_CONST.

3D-Boxes

In order to get a box at a specified location you need to set the object TYPE to IF_VBI_CONST=>GC_SCENE_OBJECT_TYPE-BOX. Beside the location a box has some additional properties. Those are defined by structure IF_VBI_CONST=>GTYPE_BOX_EXTENSION. The box has the following additional properties:

  • SCALE: a vector which holds the scaling factor for X-, Y-, and Z-dimension of the object
  • ROTATION: a vector which holds the rotation in degrees around the X-, Y-, and Z-axis of the object (optional)
  • TEXTURE: name of the texture image (optional)
  • FIX_DIR: Flag to determine if the object should rotate with the scene or not. If ABAP_TRUE it does not rotate.
  • FIX_SIZE: Flag to determine if the object should change its size with the zoom or not. If ABAP_TRUE it does not change size.

Information

Texture images have to be uploaded to the visual business frontend during the application initialization. You can provide them in import parameter IT_ADDITIONAL_RESOURCES to method GET_INITIAL_ZIP_ARCHIVE of the application.


The following code snipped shows how to provide the properties for a box:

...

* add special properties

   field-symbols: <PROPERTIES> type IF_VBI_CONST=>GTYPE_BOX_EXTENSION.

   create data LS_SPOT-SPECIFIC_PROPERTIES type IF_VBI_CONST=>GTYPE_BOX_EXTENSION.

   assign LS_SPOT-SPECIFIC_PROPERTIES->* to <PROPERTIES>.

   <PROPERTIES>-SCALE-X = VBI_S_GUI_TEST_UI-SCALE_X.

   <PROPERTIES>-SCALE-Y = VBI_S_GUI_TEST_UI-SCALE_Y.

   <PROPERTIES>-SCALE-Z = VBI_S_GUI_TEST_UI-SCALE_Z.

   <PROPERTIES>-ROTATION-X = VBI_S_GUI_TEST_UI-ROTATION_X.

   <PROPERTIES>-ROTATION-Y = VBI_S_GUI_TEST_UI-ROTATION_Y.

   <PROPERTIES>-ROTATION-Z = VBI_S_GUI_TEST_UI-ROTATION_Z.

...

Circles an Geo Circles

In order to get a circle at a specified location you need to set the object TYPE to IF_VBI_CONST=>GC_SCENE_OBJECT_TYPE-CIRCLE for fixed size circles or IF_VBI_CONST=>GC_SCENE_OBJECT_TYPE-GEO_CIRCLE for circles with geo reference. Beside the location a circle has additional properties. Those are defined by structure IF_VBI_CONST=>GTYPE_CIRCLE_EXTENSION.
The circle has the following additional properties:

  • RADIUS: radius of the circle. For circles the radius is given in pixels, for geo-circles in meter.

The following code snipped shows how to provide the properties for a circle:

* add special properties

   field-symbols: <PROPERTIES> type IF_VBI_CONST=>GTYPE_CIRCLE_EXTENSION.

   create data LS_SPOT-SPECIFIC_PROPERTIES type IF_VBI_CONST=>GTYPE_CIRCLE_EXTENSION.

   assign LS_SPOT-SPECIFIC_PROPERTIES->* to <PROPERTIES>.

   <PROPERTIES>-RADIUS = IS_DATA-RADIUS.

Pie Charts

In order to get a pie chart at a specified location you need to set the object TYPE to IF_VBI_CONST=>GC_SCENE_OBJECT_TYPE-PIE_CHART. Beside the location a pie chart has further properties. Those are defined by structure IF_VBI_CONST=>GTYPE_PIE_CHART_EXTENSION. The pie has the following additional properties:

  • SCALE: a vector which holds the scaling factor for X-, Y-, and Z-dimension of the object
  • THRESHOLD: threshold for showing a individual slice for a series entry. All entries below the threshold are summed up and added to the leftover slice (optional)
  • LEFTOVER: slice index for leftovers (entries below threshold) (optional)
  • START_COLOR: color index 0 - 31 of the pie color palette (optional)
  • SERIES: data table for the pie chart. Each entry consists or up to three values:
    • NAME: name of the data entry
    • VALUE: value of the data entry
    • TOOLTIP: special tooltip fir the data entry overruling the general tooltip template for slices.

As an exception to all the other object the pie chart has not a single tooltip, but a tooltip per slice. Thus in supports a set of placeholder for the tooltip, which will be replaced with the data of the actual slice.

The following code snipped shows how to provide the properties for a pie chart:

* add special properties

   field-symbols: <PROPERTIES> type IF_VBI_CONST=>GTYPE_PIE_CHART_EXTENSION.

   create data LS_SPOT-SPECIFIC_PROPERTIES type IF_VBI_CONST=>GTYPE_PIE_CHART_EXTENSION.

   assign LS_SPOT-SPECIFIC_PROPERTIES->* to <PROPERTIES>.

   <PROPERTIES>-SCALE-X = VBI_S_GUI_TEST_UI-SCALE_X.

   <PROPERTIES>-SCALE-Y = VBI_S_GUI_TEST_UI-SCALE_Y.

   <PROPERTIES>-SCALE-Z = VBI_S_GUI_TEST_UI-SCALE_Z.

   <PROPERTIES>-THRESHOLD = VBI_S_GUI_TEST_UI-THRESHOLD.

   <PROPERTIES>-LEFTOVER = VBI_S_GUI_TEST_UI-LEFTOVER.

   <PROPERTIES>-START_COLOR = VBI_S_GUI_TEST_UI-START_COLOR.

* add series

   data: LS_SERIES_ENTRY type IF_VBI_CONST=>GTYPE_SERIES_ENTRY.

   do VBI_S_GUI_TEST_UI-SEGMENTS times.

   LS_SERIES_ENTRY-NAME = SY-INDEX.

   concatenate 'SEGMENT_' LS_SERIES_ENTRY-NAME into LS_SERIES_ENTRY-NAME.

   condense LS_SERIES_ENTRY-NAME no-gaps.

   LS_SERIES_ENTRY-VALUE = '5'.

   LS_SERIES_ENTRY-VALUE = LS_SERIES_ENTRY-VALUE * SY-INDEX.

   append LS_SERIES_ENTRY to <PROPERTIES>-SERIES.

   enddo.

Collada objects

The use of Collada models have to be declared upon application initialization by providing table IT_COLLADA_VOS to the INITIALIZE method of the application. In this table you assign a VO ID to collada model DAE-files. Those file need to be provided as additional resources just like texture files. The provision of all declared model resources can be check by an assertion belonging to checkpoint group VBI_DATA_CONSISTENCY.

The following code snipped shows how to initialize an application for using collada objects:

* declare collada objects to be used

   LS_COLLADA_VO-ID = 'Axle'. "#EC NOTEXT

   LS_COLLADA_VO-RESOURCE_NAME = 'Axle.dae'. "#EC NOTEXT

   APPEND LS_COLLADA_VO TO LT_COLLADA_VOS.

   LS_COLLADA_VO-ID = 'Cabin'. "#EC NOTEXT

   LS_COLLADA_VO-RESOURCE_NAME = 'Cabin.dae'. "#EC NOTEXT

   APPEND LS_COLLADA_VO TO LT_COLLADA_VOS.

   LV_APPL->INITIALIZE( IV_APPLICATION_ID = '3D_DEMO'

   IS_START_POSITION = LS_START_POSITION

   IT_COLLADA_VOS = LT_COLLADA_VOS ).

In order to get a collada object at a specified location you need to set the object TYPE to IF_VBI_CONST=>GC_SCENE_OBJECT_TYPE-COLLADA. Beside the

location a collada object has some more properties. Those are defined by structure IF_VBI_CONST=>GTYPE_COLLADA_EXTENSION. The collada object has the following additional properties:

  • SCALE: a vector which holds the scaling factor for X-, Y-, and Z-dimension of the object
  • ROTATION: a vector which holds the rotation in degrees around the X-, Y-, and Z-axis of the object (optional)
  • TEXTURE: name of the texture image (optional)
  • FIX_DIR: Flag to determine if the object should rotate with the scene or not. If ABAP_TRUE it does not rotate.
  • FIX_SIZE: Flag to determine if the object should change its size with the zoom or not. If ABAP_TRUE it does not change size.
  • VO_ID: ID of the collada model to be used for the object instance


Information

Texture images have to be uploaded to the visual business frontend during the application initialization. You can provide them in import parameter IT_ADDITIONAL_RESOURCES to method GET_INITIAL_ZIP_ARCHIVE of the application.

The following code snipped shows how to provide the properties for a collada object:

* add special properties

   field-symbols: <PROPERTIES> type IF_VBI_CONST=>GTYPE_COLLADA_EXTENSION.

   create data LS_SPOT-SPECIFIC_PROPERTIES type IF_VBI_CONST=>GTYPE_COLLADA_EXTENSION.

   assign LS_SPOT-SPECIFIC_PROPERTIES->* to <PROPERTIES>.

   <PROPERTIES>-SCALE-X = IS_DATA-SCALE_X.

   <PROPERTIES>-SCALE-Y = IS_DATA-SCALE_Y.

   <PROPERTIES>-SCALE-Z = IS_DATA-SCALE_Z.

   <PROPERTIES>-ROTATION-X = IS_DATA-ROTATION_X.

   <PROPERTIES>-ROTATION-Y = IS_DATA-ROTATION_Y.

   <PROPERTIES>-ROTATION-Z = IS_DATA-ROTATION_Z.

   <PROPERTIES>-TEXTURE = 'MetalTexture.jpg'.

   <PROPERTIES>-VO_ID = 'Axle'. "#EC NOTEXT

No comments