Base text direction: in the JViews Maps SDK

At the map level

No Java classes specific to maps exist for controlling base text direction at the map level. The manager in JViews Framework can be used to control base text direction at this level. You can use this class to set base text direction for the entire map, including the layers. For example:
Setting base text direction by IlvManager
IlvManager myMgr = new IlvManager();
/*   top level manager responsible for controlling ALL graphical elements of map */
myMgr.setBaseTextDirection(IlvBidiUtil.RIGHT_TO_LEFT);
If all text objects, labels, and annotation have base text direction DIRECTION_INHERITED, this class enables the base text direction to be dynamically changed uniformly for all these objects on all layers of the map. All such text-related objects inherit the same base text direction, which is assigned to the top level programmatically, with similar code to the example Setting base text direction by IlvManager.

At the layer level

Base text direction in JViews Maps is defined as an attribute of map layer style and can be changed individually for each layer. For example:
IlvMapStyle layerStyle = layer.getStyle();

if (style instanceof IlvMapTextStyle)       // text object style
  (IlvMapTextStyle) layerStyle.setBaseTextDirection(IlvBidiUtil.RIGHT_TO_LEFT);

else if(style instanceof IlvMapLabelStyle)  // labels, including annotations
  (IlvMapLabelStyle) layerStyle.setBaseTextDirection(IlvBidiUtil.RIGHT_TO_LEFT);

else if(style instanceof IlvGridStyle)      // grid
   (IlvGridStyle) layerStyle.setBaseTextDirection(IlvBidiUtil.RIGHT_TO_LEFT);

Base text direction: suitable JViews Maps components

Specifying base text direction for a specific component has the highest priority. Only when base text direction is defined on a specific component as DIRECTION_INHERITED is the value from a higher level used.
Level where base text direction is specified Additional levels where specification applies Comments
Map All layers. Top level
Layer All text elements that belong to the layer; for example, text data objects, data object labels, annotation labels, grid labels.  

Enabling dynamic change at run time

You can set base text direction dynamically to have the same value for all text elements of a map or to assign one specific base text direction value to a specific text element of a map.

Dynamically setting a consistent base text direction for all text elements

Setting any of the following values for base text direction in any text-related elements of map layers, including text data objects, data object labels, annotation labels, and labels of grid objects, is an explicit or static assignment:
  • Left To Right
  • Right To Left
  • Contextual
The only external factor that can affect these settings on a given element is a call to the Java API.
Setting base text direction to one of the following values means that base text direction can be affected by external influences at run time:
Inherited
For example, change of the base specification in the map where the text element is embedded affects the value of the base text direction of text elements in the map.
Component Orientation
For example, change of GUI direction for the container in which the map is embedded affects the base text direction of text elements in the map.
By such a change at run time you can dynamically affect the base text direction in a consistent way for all text elements contained in the map.
For such a dynamic run time change, the following conditions must be satisfied:
  • No explicit value is assigned to base text direction property of any of the map layers.
  • The API is used to change the value of base text direction at the highest level; for example:
    IlvManager myMgr = new IlvManager();
    /*   top level manager responsible for controlling ALL graphical elements of map */
    myMgr.setBaseTextDirection(IlvBidiUtil.RIGHT_TO_LEFT);

Dynamically assigning one specific base text direction value to a specific text element

The lowest level on which base text direction can be specified is the layer. The following example shows how to assign a specific base text direction value for the layer:
IlvMapStyle layerStyle = layer.getStyle();

if (style instanceof IlvMapTextStyle)       // text object style
  (IlvMapTextStyle) layerStyle.setBaseTextDirection(IlvBidiUtil.RIGHT_TO_LEFT);

else if(style instanceof IlvMapLabelStyle)  // labels, including annotations
  (IlvMapLabelStyle) layerStyle.setBaseTextDirection(IlvBidiUtil.RIGHT_TO_LEFT);

else if(style instanceof IlvGridStyle)      // grid
   (IlvGridStyle) layerStyle.setBaseTextDirection(IlvBidiUtil.RIGHT_TO_LEFT);