Click or drag to resize

MovementCategorizer Class

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
MovementCategorizer provides a description, in the form of a MovementDescription or an image showing a schematic of the movement, given a Movement.
Inheritance Hierarchy
SystemObject
  Telogis.GeoBase.NavigationMovementCategorizer

Namespace:  Telogis.GeoBase.Navigation
Assembly:  geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax
public class MovementCategorizer

The MovementCategorizer type exposes the following members.

Constructors
  NameDescription
Public methodMovementCategorizer
Creates a MovementCategorizer that uses the default images. Images should be available in your TurnIcons folder.
Public methodMovementCategorizer(String)
Creates a MovementCategorizer that uses images from a specified folder. The images should be in PNG or BMP format.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetFilename
Returns the filename of the schematic image for the given Movement. If no path was specified when creating the MovementCategorizer it returns an empty string.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetImage
Returns an image for the given Movement.
Public methodGetMovementDescription
Returns a MovementDescription for the given Movement.
Public methodGetProgressImage
Returns the progress image for the given progress proportion.
Public methodGetProgressImageName
Returns the progress image name for the given progress proportion.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
C#
MovementCategorizer mc = new MovementCategorizer();
// ^^ creates a new MovementCategorizer with default settings

/// MovementCategorizer mc = new MovementCategorizer(path);
// ^^ creates a new MovementCategorizer that uses images from the 
// specified path. Images should be in PNG or BMP format

// If a path is specified, the required images with their correct filenames must be present.

// You can obtain schematic information from a Movement, mv, using
MovementDescription md = mc.GetMovementDescription(mv);
String filename = mc.GetFilename(mv);
Image img = mc.GetImage(mv);
The following working example illustrates the use of MovementCategorizer's GetImage(Movement), GetFilename(Movement) and GetMovementDescription(Movement) methods.
C#
// Create a MovementCategorizer with defaults and look for images in the
// Program Files\Telogis\GeoBase\GeoBaseResources\TurnIcons folder.
MovementCategorizer mc = new MovementCategorizer();

// Create a MovementCategorizer that points to the specified image folder.
// This folder must contain all images with their correct file names.
// MovementCategorizer mc = new MovementCategorizer(@"C:\path_to_folder\TurnIcons");

Route tr = new Route();
tr.Start = new RouteStop(33.903187, -118.225697);
tr.AddStopAtEnd(new RouteStop(33.903457, -118.225756));
tr.End = new RouteStop(33.903178, -118.225835);

Directions myDirections = tr.GetDirections();

foreach (Direction d in myDirections)
   {
       // Used to build the instructions for display.
       StringBuilder instruction = new StringBuilder();

       // Use only Movements. Ignore Notes.
       if (d is Movement)

           {
               // Retrieve an image in PNG or BMP format 
               // that represents the movement. For UI use.
               Image img = mc.GetImage(d as Movement);

               // Retrieve the image file name as text 
               // eg. 'destination.png' or 'uturn_rhd.png'.
               String filename = mc.GetFilename(d as Movement);

               // Retrieve a text description of the movement
               // eg. 'UTurn' or 'SharpLeft'.
               MovementDescription ddesc = mc.GetMovementDescription(d as Movement);

               // Retrieve the natural language direction as text.
               String instr = d.Instructions;

               instruction.AppendFormat("Instructions: " + instr + "\n");
               instruction.AppendFormat("UI image: " + filename + "\n");
               instruction.AppendFormat("Plain text: " + ddesc + "\n");
           }

           // Output the generated instruction
           Console.WriteLine(instruction);
   }
See Also