Change Building Outline Color

Last updated:

One way you can alter the look and feel of your map is by changing the color of the outline surrounding your buildings.

The method to do this is different for each platform.

To change the building outline color, along with other display properties, you must get and modify the Display Rule.

Note that the DisplayRule will be null if MapsIndoors is not loaded.

MapsIndoors.getDisplayRule(MPSolutionDisplayRule.BUILDING_OUTLINE).setPolygonStrokeColor(Color.BLUE);

The parameter strokeColor takes the color in RGB format (with an alpha-channel value), the the syntax being AARRGGBB.

To change the building outline, use the properties of MapControl.locationHighlightDisplayRule.

myMapControl.locationHighlightDisplayRule?.highlightOutlineColor = UIColor.red

The sample uses the example UIColor.red, but this can be any standard color such as UIColor.green or UIColor.lightGray. You can also define RGB values as follows: UIColor(red: 123, blue: 36, green: 273, alpha: 100).

To change the building outline color, use the strokeColor property of the BuildingOutlineOptions interface. This property accepts any color as defined by conventional CSS color values. See https://developer.mozilla.org/en-US/docs/Web/CSS/color_value for more information on CSS color values.

To do this in practice, on the MapsIndoors instance, call setBuildingOutlineOptions to change the appearance of the building outline.

mapsIndoors.setBuildingOutlineOptions({strokeColor: '#3071d9'});

Additional variables such as strokeWeight (for the thickness of the stroke) can also be used here, see the reference docs for the full list.

You can also modify the fill color of a building, not just the outline. This is done using Display Rules, and more can be read about that here.