com.nutiteq.services
Class CloudMadeDirections

java.lang.Object
  extended by com.nutiteq.services.CloudMadeDirections
All Implemented Interfaces:
ResourceDataWaiter, ResourceRequestor, DirectionsService, Service

public class CloudMadeDirections
extends java.lang.Object
implements DirectionsService, ResourceRequestor, ResourceDataWaiter

Routing service using CloudMade routing, version 0.3.


Field Summary
static java.lang.String ROUTE_TYPE_BICYCLE
           
static java.lang.String ROUTE_TYPE_CAR
           
static java.lang.String ROUTE_TYPE_FOOT
           
static java.lang.String ROUTE_TYPE_MODIFIER_SHORTEST
           
 
Fields inherited from interface com.nutiteq.services.DirectionsService
ERROR_DESTINATION_ADDRESS_NOT_FOUND, ERROR_FROM_ADDRESS_NOT_FOUND, ERROR_FROM_AND_DESTINATION_ADDRESS_SAME, ERROR_ROUTE_NOT_FOUND, IMAGE_ROUTE_END, IMAGE_ROUTE_LEFT, IMAGE_ROUTE_RIGHT, IMAGE_ROUTE_START, IMAGE_ROUTE_STRAIGHT
 
Constructor Summary
CloudMadeDirections(DirectionsWaiter directionsWaiter, WgsPoint start, WgsPoint end, java.lang.String routeType, java.lang.String apiKey, java.lang.String userId)
           
CloudMadeDirections(DirectionsWaiter directionsWaiter, WgsPoint start, WgsPoint end, java.lang.String routeType, java.lang.String routeTypeModifier, java.lang.String apiKey, java.lang.String userId)
           
CloudMadeDirections(java.lang.String token, DirectionsWaiter directionsWaiter, WgsPoint start, WgsPoint end, java.lang.String routeType, java.lang.String routeTypeModifier, java.lang.String apiKey)
           
 
Method Summary
 void cancel()
          Cancel service execution
 void dataRetrieved(byte[] data)
          Data for resource retrieved
 void execute()
          Performe service action
 int getCachingLevel()
          Define at which level should given resource be cached.
 void notifyError()
          Notify implementing object about retrieval error
 java.lang.String resourcePath()
          Get path to resource.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUTE_TYPE_CAR

public static final java.lang.String ROUTE_TYPE_CAR
See Also:
Constant Field Values

ROUTE_TYPE_FOOT

public static final java.lang.String ROUTE_TYPE_FOOT
See Also:
Constant Field Values

ROUTE_TYPE_BICYCLE

public static final java.lang.String ROUTE_TYPE_BICYCLE
See Also:
Constant Field Values

ROUTE_TYPE_MODIFIER_SHORTEST

public static final java.lang.String ROUTE_TYPE_MODIFIER_SHORTEST
See Also:
Constant Field Values
Constructor Detail

CloudMadeDirections

public CloudMadeDirections(DirectionsWaiter directionsWaiter,
                           WgsPoint start,
                           WgsPoint end,
                           java.lang.String routeType,
                           java.lang.String apiKey,
                           java.lang.String userId)

CloudMadeDirections

public CloudMadeDirections(DirectionsWaiter directionsWaiter,
                           WgsPoint start,
                           WgsPoint end,
                           java.lang.String routeType,
                           java.lang.String routeTypeModifier,
                           java.lang.String apiKey,
                           java.lang.String userId)

CloudMadeDirections

public CloudMadeDirections(java.lang.String token,
                           DirectionsWaiter directionsWaiter,
                           WgsPoint start,
                           WgsPoint end,
                           java.lang.String routeType,
                           java.lang.String routeTypeModifier,
                           java.lang.String apiKey)
Parameters:
token - CloudMade token
directionsWaiter - listener for directions result (callback)
start - start point
end - end point of route
routeType - route type: ROUTE_TYPE_CAR, ROUTE_TYPE_FOOT or ROUTE_TYPE_BICYCLE
routeTypeModifier - ROUTE_TYPE_MODIFIER_SHORTEST (default is FASTEST)
apiKey - your CloudMade HTTP API key, get it from www.cloudmade.com
Method Detail

execute

public void execute()
Description copied from interface: Service
Performe service action

Specified by:
execute in interface Service

resourcePath

public java.lang.String resourcePath()
Description copied from interface: ResourceRequestor
Get path to resource. Currently library supports retrieval from network and application jar

Specified by:
resourcePath in interface ResourceRequestor
Returns:
path to resource

notifyError

public void notifyError()
Description copied from interface: ResourceRequestor
Notify implementing object about retrieval error

Specified by:
notifyError in interface ResourceRequestor

dataRetrieved

public void dataRetrieved(byte[] data)
Description copied from interface: ResourceDataWaiter
Data for resource retrieved

Specified by:
dataRetrieved in interface ResourceDataWaiter
Parameters:
data - retrieved data

cancel

public void cancel()
Description copied from interface: Service
Cancel service execution

Specified by:
cancel in interface Service

getCachingLevel

public int getCachingLevel()
Description copied from interface: ResourceRequestor
Define at which level should given resource be cached. Check Cache

Specified by:
getCachingLevel in interface ResourceRequestor
Returns:
cache level for resource