Class TLcySafeGuardFormatWrapper


public class TLcySafeGuardFormatWrapper extends ALcyFormatWrapper

Decorator for an ALcyFormat that safe guards all operations on models and layers to make sure no invalid models or layers are ever accepted or handled. It relies on the implementation of isModelOfFormat(com.luciad.model.ILcdModel) and isGXYLayerOfFormat(com.luciad.view.gxy.ILcdGXYLayer) of the given ALcyFormat to do so.

As a result, implementers of an ALcyFormat can simplify this type of code:


 protected ILcyModelContentTypeProvider createModelContentTypeProvider() {
   return new ILcyModelContentTypeProvider() {
     public int getModelContentType( ILcdModel aModel ) {
       if ( aModel.getModelDescriptor() instanceof TLcdSHPModelDescriptor ) {
         return MIXED;
       }
       else {
         return UNKNOWN;
       }
     }
   };
 }
 
to this:

  protected ILcyModelContentTypeProvider createModelContentTypeProvider() {
   return new ILcyModelContentTypeProvider() {
     public int getModelContentType( ILcdModel aModel ) {
       return MIXED;
     }
   };
 }
 
which is easier and less error prone. Similar simplifications apply to all other concepts such as ILcdGXYLayerFactory, ILcdGXYLayerEncoder etc.