Developer

VisioMove - Using VgPoints

Arrow navigation

Go back

VisioMove - Using VgPoints

A quick run down on how VgPoints can be used to improve the user experience in your application

Introduction

Need to customize the way a name and icon appear above their place? Need to hide or show certain icons within the map as a result of some filter request? Well, you're reading the right blog!  Since VisioDevKit v2.0.9334 this has been possible.

VgPoint

A VgPoint is the base class for text and icons rendered by the VisioMove engine.  If you get access to a VgPoint, then you can change it's appearance, including:

  • scale,
  • orientation,
  • location,
  • size policy
  • hidden or not

For the full list of what you can do, check out the documentation for Vg3DModule::VgPoint.

Accessing a VgPoint

To modify the VgPoint, you'll first need to get your hands on it.  All the VgPoints that exists within the VisioMove can be accessed using the VgEngine::VgIEngine::execute method.  In order to chose the VgPoints that you want, you must pass a VgEngine::VgQuery object.  In the below code snippet we demonstrate a query that searches for VgSpatials who's ID matches a specific value (a VgSpaitial is a base class of VgPoint).

Check out the documentation to see other possible types of queries that can be created.

Adding an icon and a name to a place

Using setPlaceIcon and setPlaceName at the same time may not provide you with the behaviour you desire.  If that's the case, then VgPoint may help.  The VgPoint provides a powerful way to manipulate the behaviour of icons and labels.

Assuming that you have already added a name to a place using the setPlaceName method.  You can then use the VgPoint to also associate an icon with the place.

Using the code snippet below, we already have our list of VgSpatials.  We demonstrate how to retrieve our VgPoint of interest:



 
 

After running the above code, the result will appear as below:

place.name
Before
place.name.and.icon
After

Note: You can reset the place's behaviour by calling setPlaceName or setPlaceIcon (this recreates the VgPoint associated with that place).

Hiding an icon

Similarly, its possible to hide an icon within the map.  Let's say we have a toilet icon and we want to make it disappear.

The below code snippet shows how this is possible:

This gives us the following result

icon
Before
icon.gone
After

Changing scale

It's also possible to change the scale of the VgPoints within the map.  In the below code snippet we query all the Vg3DModule::VgPoint and increase their scale by two:

before.scale
Before
after.scale
After

Changing the sizing policy

By default, the text sizing policy is designed such that the text fits within the rectangle associated with each place that are defined within VisioMapEditor.

It's possible also to change the size policy so that all the text and icons have the same size.

This gives the below results.

size.policy.fit.to.rectangle
Before
size.policy.fixed.size
After

When using this method, be careful not to increase the scale too much, otherwise the labels may overlap and become unreadable.

Note that the size policy (eSizePolicyFitToRectangle) will only have an affect on the VgPoints that are first created via the setPlaceName or setPlaceIcon methods.  It does not include the static icons within the map, for example the parking or entry/exit icons.