Class TLcdKML22StyleProvider

java.lang.Object
com.luciad.format.kml22.util.TLcdKML22StyleProvider

public class TLcdKML22StyleProvider extends Object

Provides styles for KML features on demand.

styles can be retrieved synchronously or asynchronously. The provider keeps a cache of styles to optimize performance.

A template for the usage of retrieving styles is as follows:

 
    //variables used in this template
    TLcdKML22StyleProvider styleProvider;
    TLcdKML22AbstractFeature abstractFeature;
    ELcdKML22StyleState styleState;
    ILcdKML22ResourceListener callbackFunction;

    //the template

    //obtain the status of the style to decide what to do
    ELcdKML22ResourceStatus imageStatus = styleProvider.getImageStatus( abstractFeature,styleState );
    TLcdKML22Style style = null;
    switch ( imageStatus ) {
      case CACHED:
        //the resource is cached, so you can retrieve it synchronously without blocking the calling
        //thread
        style = styleProvider.retrieveStyle( abstractFeature, styleState );
        break;
      case LOADING:
        //the resource is being loaded. Use a temporary value instead.
        style = getLoadingStyle();
        break;
      case FAULTY:
        //the resource is unavailable because it is faulty. A fallback mechanism should be used here
        //because the resource itself can't be retried.
        style = getFaultyStyle();
        break;
      case NOT_CACHED:
        //the resource is not cached. Start an asynchronous retrieve and used a temporary value instead.
        styleProvider.retrieveStyle( abstractFeature,styleState,callbackFunction );
        style = getLoadingStyle();
        break;
    }
   
   
Since:
10.0