Class TLcdMAPModelDecoder

java.lang.Object
com.luciad.format.mif.TLcdMAPModelDecoder
All Implemented Interfaces:
ILcdInputStreamFactoryCapable, ILcdModelDecoder

@LcdService(service=ILcdModelDecoder.class, priority=20000) public class TLcdMAPModelDecoder extends Object implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
This ILcdModelDecoder decodes MAP (native binary MapInfo) files.

Input files

File Required Entry point Description
*.map x x MapInfo binary file containing the vector data
*.tab

x
File containing the names and data types of the attributes
*.dat

File containing the shape attributes

Supported file transfer protocols

  • This model decoder supports all transfer protocols that are supported by the inputStreamFactory of this decoder.

Model structure

  • This model decoder creates a model per MAP file.
  • All models returned by this model decoder implement ILcd2DBoundsIndexedModel.

Model descriptor

  • All models returned by this model decoder have a TLcdMIFModelDescriptor.
  • The type name of the model descriptor is MIF.
  • The model descriptor implements ILcdDataModelDescriptor. This means that the model elements produced by this model decoder have a matching TLcdDataType, each with their own TLcdDataProperty.
  • The model descriptor also implements ILcdFeaturedDescriptor for backwards compatibility. This is the old version of ILcdDataModelDescriptor

Model elements

The following MAP elements are currently supported:

MAP element type MAP element nameDecoded object
1, 2POINT TLcdMIFPoint
4, 5LINE TLcdMIFPLine containing ILcdPolyline
7, 8PLINE TLcdMIFPLine containing ILcdPolyline
10, 11ARC TLcdMIFPLine containing ILcdArc
13, 14REGION TLcdMIFRegion containing ILcdPolygon
16, 17TEXT TLcdMIFText containing ILcdText
19, 20RECT TLcdMIFRegion containing ILcdBounds
22, 23ROUNDRECT TLcdMIFRegion containing ILcdBounds
25, 26ELLIPSE TLcdMIFRegion containing ILcdEllipse
37, 38(MULTI) PLINE TLcdMIFPLine containing ILcdPolyline
40, 41(TRUETYPE) POINT TLcdMIFPoint
43, 44(CUSTOM) POINT TLcdMIFPoint
46, 47(LARGE) REGION TLcdMIFRegion containing ILcdPolygon
49, 50(LARGE, MULTI) PLINETLcdMIFPLine containing ILcdPolyline
52, 53(LARGE) MULTIPOINT TLcdMIFMultipoint containing ILcdPolypoint
55, 56COLLECTION TLcdMIFCollection containing TLcdMIFRegion,

All model elements implement the ILcdMIFShape interface. This interface extends both the ILcdFeatured interface (for backwards compatibility reasons) as the ILcdDataObject interface. While both interfaces can be used to obtain the properties of a model element, ILcdDataObject is the preferred interface for interacting with model elements in a generic way.

All elements in a model will have the TLcdMIFDataTypes.graphicalObjectType TLcdDataType as their data type.

Sample code


 ILcdModelDecoder decoder = new TLcdMAPModelDecoder();
 ILcdModel model = decoder.decode( "vector.map" );
 

Thread safety

  • The decoding of models is not thread-safe.
  • The decoded models are thread-safe for read access.

Supported versions and specifications

  • The official MapInfo MAP format specifications are not available. The current implementation is based on information freely available on Internet. See for example the MapInfo Dataset Format page.

Known limitations

  • Due to closed specifications, some shape types may or may not be correctly supported.

See Also:
  • Constructor Details

    • TLcdMAPModelDecoder

      public TLcdMAPModelDecoder()
      Constructs a new MAP model decoder.
    • TLcdMAPModelDecoder

      public TLcdMAPModelDecoder(String aDataModelName)
      Constructs a new MAP model decoder with a fixed TLcdDataModel. All files that are decoded with this decoder will use exactly the same data model. This data model will have the given name. It is the responsibility of the caller of this method to ensure that all files that are decoded have exactly the same structure. The result of decoding files with different structures with a fixed data model is unspecified.

  • Method Details

    • getDefaultExtension

      public String getDefaultExtension()
      Returns the default extension for MAP files: map .
      Returns:
      "map".
    • setCharacterSet

      public void setCharacterSet(String aCharacterSet)
      Sets the character set to use.
      Parameters:
      aCharacterSet - the character set to use to decode MAP files. The supported character sets depend on the JVM implementation and can be found at String(byte[], String).
    • getCharacterSet

      public String getCharacterSet()
    • setUseFloatPoint

      public void setUseFloatPoint(boolean aUseFloatPoint)
      Sets whether the decoder should return shapes containing TLcdXYFloatPoints instead of the normal TLcdXYPoints.
      Parameters:
      aUseFloatPoint - boolean indicating whether the decoder should return shapes containing TLcdXYFloatPoints instead of the normal TLcdXYPoints.
    • isUseFloatPoint

      public boolean isUseFloatPoint()
      Returns whether the decoder returns shapes containing TLcdXYFloatPoints instead of the normal TLcdXYPoints.
      Returns:
      whether the decoder returns shapes containing TLcdXYFloatPoints instead of the normal TLcdXYPoints.
    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Sets the input stream factory to handle data input.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Parameters:
      aInputStreamFactory - the factory to handle the data input.
      See Also:
    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Returns the input stream factory used to handle data input.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Returns:
      the input stream factory used to handle data input.
      See Also:
    • setFeatureIndexForDisplayName

      public void setFeatureIndexForDisplayName(int aFeatureIndexForDisplayName)

      Sets the index of the feature to be used as default display name (e.g. the feature value to be used by the Object.toString() method). This index refers to the feature ordering in the MID file to decode. The default value is 0.

      Note that this method also works for the ILcdDataObject interface, where the index will match the index of the property for a data object.

      Parameters:
      aFeatureIndexForDisplayName - the index of the feature to use for the default display name.
      See Also:
    • getFeatureIndexForDisplayName

      public int getFeatureIndexForDisplayName()

      Returns the index of the feature to be used for displaying the name of objects in models created by this decoder.

      Note that this method also works for the ILcdDataObject interface, where the index will match the index of the property for a data object.

      Returns:
      the index of the feature to be used for displaying the name of objects in models created by this decoder.
      See Also:
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ILcdModelDecoder
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Specified by:
      getDisplayName in interface ILcdModelDecoder
      Returns:
      the displayable name of this ILcdModelDecoder.
    • canDecodeSource

      public boolean canDecodeSource(String aSourceName)
      Returns whether this decoder can handle data from this input.
      Specified by:
      canDecodeSource in interface ILcdModelDecoder
      Parameters:
      aSourceName - the name of the input to check.
      Returns:
      true if the file extension is <defaultExtension> or <defaultExtension>.gz, <code>false</code> otherwise (<defaultExtension> is the String returned by getDefaultExtension).
      See Also:
    • decode

      public ILcdModel decode(String aSourceName) throws IOException
      Description copied from interface: ILcdModelDecoder
      Creates a new model from the given data source.
      Specified by:
      decode in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be decoded; typically a file name or a URL.
      Returns:
      A model containing the decoded data. While null is allowed, implementors are advised to throw an error instead.
      Throws:
      IOException - for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.
      
         public ILcdModel decode( String aSourceName ) throws IOException {
            try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) {
               // Perform decoding ...
            } catch (RuntimeException e) {
               throw new IOException(e);
            }
         }
       
      See Also: