com.esri.arcgis.networkanalyst
Class INACompactStreetDirectionProxy

java.lang.Object
  extended by com.esri.arcgis.interop.Dispatch
      extended by com.esri.arcgis.networkanalyst.INACompactStreetDirectionProxy
All Implemented Interfaces:
INACompactStreetDirection, Externalizable, Serializable
Direct Known Subclasses:
INACompactStreetDirection2Proxy

public class INACompactStreetDirectionProxy
extends com.esri.arcgis.interop.Dispatch
implements INACompactStreetDirection, Serializable

Provides access to a compact street direction item.

Remarks

The INACompactStreetDirection interface provides access to each direction element. The NACompactStreetDirection object this interface accesses is significantly smaller than the NAStreetDirection object accessed via the INAStreetDirection interface. In particular, there is less information stored about the direction, and the geometry representing the traversed streets is highly compressed. Due to their smaller size, these directions are better suited for passing across low bandwidth connections in server applications.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

See Also:
Serialized Form

Field Summary
 boolean noncastable
           
 
Fields inherited from class com.esri.arcgis.interop.Dispatch
DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF, objRef
 
Constructor Summary
  INACompactStreetDirectionProxy()
           
  INACompactStreetDirectionProxy(Object obj)
           
protected INACompactStreetDirectionProxy(Object obj, String iid)
           
 
Method Summary
 void addListener(String iidStr, Object theListener, Object theSource)
           
 String getCompressedGeometry()
          The compressed geometry for the driving direction.
 Date getETA()
          The estimated time of arrival.
 double getLength()
          The cumulative driving length (in directions length units).
 int getManeuverType()
          The maneuver type.
 String getText()
          The driving direction text.
 double getTime()
          The time spent.
 void removeListener(String iidStr, Object theListener)
           
 
Methods inherited from class com.esri.arcgis.interop.Dispatch
bindUsingMoniker, constructVtblPosTable, convertToNative, cookieForListener, createDispatch, createObjrefMonikerDisplayName, equals, getActiveObject, getActiveObject, getDefaultProperty, getDispatchIdOfName, getLastErrorCode, getMtsObjectContext, getObjRef, getPropertyByName, getPropertyByName, getVtblPos, hashCode, initDispatch, invoke, invokeMethodByName, invokeMethodByName, invokeMethodByName, invokePropertyGetByName, invokePropertyPutByName, invokePropertyPutByRefByName, isNativeMode, isObjRef, optimizedVtblInvoke, queryInterface, readExternal, release, setNativeMode, setPropertyByName, toString, vtblInvoke, writeExternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

noncastable

public boolean noncastable
Constructor Detail

INACompactStreetDirectionProxy

public INACompactStreetDirectionProxy()

INACompactStreetDirectionProxy

public INACompactStreetDirectionProxy(Object obj)
                               throws IOException
Throws:
IOException

INACompactStreetDirectionProxy

protected INACompactStreetDirectionProxy(Object obj,
                                         String iid)
                                  throws IOException
Throws:
IOException
Method Detail

addListener

public void addListener(String iidStr,
                        Object theListener,
                        Object theSource)
                 throws IOException
Overrides:
addListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

removeListener

public void removeListener(String iidStr,
                           Object theListener)
                    throws IOException
Overrides:
removeListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

getLength

public double getLength()
                 throws IOException,
                        AutomationException
The cumulative driving length (in directions length units).

Remarks

Length returns the length of the particular direction element.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getLength in interface INACompactStreetDirection
Returns:
The length
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getTime

public double getTime()
               throws IOException,
                      AutomationException
The time spent.

Remarks

Time returns the travel time of the particular direction element.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getTime in interface INACompactStreetDirection
Returns:
The time
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getText

public String getText()
               throws IOException,
                      AutomationException
The driving direction text.

Remarks

Text returns the text of the particular direction element.

The following lines are examples of what Text might return:

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getText in interface INACompactStreetDirection
Returns:
The strText
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCompressedGeometry

public String getCompressedGeometry()
                             throws IOException,
                                    AutomationException
The compressed geometry for the driving direction.

Remarks

CompressedGeometry returns a compressed line geometry representing the direction. By compressing the geometry, the overall size of the direction item is significantly reduced.

The direction's line geometry is compressed by the directions agent. It compresses it by converting the line geometry into a string that holds the relative offsets of the points in the line as integers stored in 32-based notation.

Here is a description of the compression algorithm that is used:

Input to compression: 

  dirPoints - Direction's line geometry as a collection of points

  coefficient - Integer to multiply each x and y double by when converting to integer

Output: 

  compressedGeometry - String representing geometry

1. Convert coefficient to string and add to the start of the compressedGeometry string

2. set pointPrev = (0,0)

3. For each point in dirPoints

   a. int xDifference = Round(coefficient  * (point.x - pointPrev.x))

   b. Int yDifference = Round(coefficient  * (point.y - pointPrev.y))

   c. Convert xDifference to string using 32-based scale and add to compressedGeometry string

   d. Convert yDifference to string using 32-based scale and add to compressedGeometry string

   e. pointPrev = point;

4. return compressedGeometry string

To extract the points for the line geometry from the CompressedGeometry string, the reverse of the above must be done. It is necessary to get the first integer from the string and convert it to an integer to be used as the coefficient. Then, pop off each remaining substring and convert it back into a double.

Here is a description of the uncompression algorithm:

Input to decompression: 

  compressedGeometry - String representing geometry

Output:

  dirPoints - Direction's line geometry as a collection of points 

1. get first token from compressedGeometry string and convert to integer to use as the coefficient

2. xDiffPrev = 0, yDiffPrev = 0

3. For each point in dirPoints

   a. xDiff = get token from compressedGeometry string and convert from 32-based scale to integer

   b. yDiff = get token from compressedGeometry string and convert from 32-based scale to integer

   c. point.x = (xDiff + xDiffPrev) / coefficient

   e. point.y = (yDiff + yDiffPrev) / coeffiecint

   f. add point to dirPoints

   g. xDiffPrev = xDiff, yDiffPrev = yDiff

4. return dirPoints

Thus, with the following input data:
dirPoints:
-118.356654545455, 34.1146
-118.356436363636, 34.1143272727273
-118.356418181818, 34.1142363636364
-118.356490909091, 34.1137636363636
coefficient:
55000 - represents 2 meter resolution

It would be compressed into the following string:
"+1lmo-66l1f+1p8af+c-f+1-5-4-q"

When uncompressed, the resulting points would be the following (slightly different due to lossy compression):
-118.356636363636, 34.1146
-118.356418181818, 34.1143272727273
-118.3564, 34.1142363636364
-118.356472727273, 34.1137636363636

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getCompressedGeometry in interface INACompactStreetDirection
Returns:
The strGeometry
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getETA

public Date getETA()
            throws IOException,
                   AutomationException
The estimated time of arrival.

Remarks

ETA returns the estimated time of arrival at the direction element.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getETA in interface INACompactStreetDirection
Returns:
The value
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getManeuverType

public int getManeuverType()
                    throws IOException,
                           AutomationException
The maneuver type.

Remarks

ManeuverType returns the type of maneuver that the direction represents.

The esriDirectionsManeuverType enumeration has the following values:

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getManeuverType in interface INACompactStreetDirection
Returns:
A com.esri.arcgis.networkanalyst.esriDirectionsManeuverType constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.