| Programming with JViews Maps > Introducing the Main Classes > Readers and Writers > The MID/MIF Reader |
The MID/MIF Reader |
INDEX
PREVIOUS
NEXT
|
The class relationship for the mid/mif reader is shown in Figure 1.6.
This section describes the ilog.views.maps.format.mid/mif package, which allows you to read files provided in the MapInfo Interchange File (MIF) format.
A MapInfo Interchange Format consists of a MIF file containing the geometries and rendering attributes, and a MID file containing the attributes attached to each geometry.
The MIF file is an ASCII text file that describes the geometry data associated with rendering attributes such as pen and brush styles, font, and color that should be used to transform geometries into graphic objects. The reader classes provided with the JViews Maps package allow you to use either the information contained in the MIF file or your own rendering attributes.
The MID file contains attributes, which are nongraphical additional information associated with the geometries contained in the MIF file.
The MID/MIF Reader contains the following classes:
The IlvMIDMIFDataSource class is a specialized data source that reads MIDMIF files. It wraps all MIDMIF file rendering processes.
IlvMIDMIFDataSource source = new IlvMIDMIFDataSource(filename); source.setManager(manager); source.start(); |
The IlvMIFDMIFDataSource produces a IlvMapLayer for objects having the same geometries and similar graphic attributes. If, however, a MIDMIF file contains lines whose color attributes are different, for example, red and blue, two layers are created, one for the blue lines and one for the red lines.
The JViews Maps package provides all the necessary classes to read data provided in the MapInfo Interchange File format. In addition to these classes, the JViews Maps package also provides the IlvGraphic classes needed to render specific MIF objects.
The classes used to read MapInfo Interchange files are the following:
This class reads both MIF file and MID file by providing a MIF file name and a MID file name. If the MID file name is set to null, no attribute is loaded. If the MID file name corresponds to a valid MID file, the attributes are read from the file and attached to the IlvMapFeature returned by the reader.
IlvMIDMIFReader reader = new IlvMIDMIFReader("example.mif", "example.mid"); IlvMapFeature feature = reader.getNextFeature(); while(feature != null) feature = reader.getNextFeature(); |
This is the class that reads a single MIF file, providing a MIF file name or a reader to the constructor. You can then iterate to obtain the IlvMapFeatures of the file, but you can also obtain information about the MIF file you are reading, such as:
IlvAttributeInfoProperty, which defines the name and the classes of the attributes that can be found in the associated MID file.
Note that the coordinate system returned by the reader can be null even if the MapInfo specifications consider the geometries to be in the Geographic coordinate system if none is specified in the MIF file.
This class reads a MID file. You must have previously opened the corresponding MIF file, in order to build the second argument of the MID reader (IlvAttributeInfoProperty) that is provided in the MIF file.
Since the MIF file can contain rendering information, the JViews Maps package provides classes to directly use this rendering information. This includes a ready-to-use IlvFeatureRenderer suitable to render geometries found in the MIF file and a factory to create IlvMapLineRenderingStyle.
In addition to these rendering classes, the JViews Maps package also provides a set of specific IlvGraphic objects to display the MID/MIF geometries. These IlvGraphic objects are needed by the MID/MIF specifications but can also be used outside a MID/MIF context.
This class is a subclass of the IlvDefaultFeatureRenderer that dispatches on the appropriate renderer with the rendering styles found in the MIF file. This is the IlvFeatureRenderer returned by the getDefaultFeatureRenderer() method of the IlvMIFReader class. The rendering styles found in the MIF file are attached to the IlvMapFeature as properties by the reader and interpreted in the renderer.
This class is a factory to create an IlvMapLineRenderingStyle by specifying a MID/MIF pattern identifier.
This class is a factory to translate a MID/MIF coordinate system into a Maps coordinate system.
The IlvGraphic objects needed to render MID/MIF geometries include the following classes:
IlvDecoratedPath: A general path supporting decorations. A decoration is a drawing that follows the path of the graphic. These decorations can be clipped against the clip region of the java.awt.Graphics to provide high performance drawing.
IlvMapLabel: A label able to display multiline text. This label supports interline spacing.
IlvFontMarker: A graphic object able to display a character of a given font as the marker point. This object is usually used with a symbol font that provides cartographic symbology.
Along with objects and attribute information, MIF files also contain information on the coordinate system used to store the graphic objects of a defined file.
The possible coordinate systems in MID/MIF are the following:
null, and the IlvMIFReader.getUnit() method returns the unit defined in the file.
null, and the IlvMIFReader.getUnit() method returns the unit defined in the file.
The JViews Maps package fully supports projected coordinates defined in a MID/MIF file. The supported projections are listed in Table 1.1:
JViews Maps supports all ellipsoids and nearly all datums from MapInfo (see the MID/MIF file format specification for the full list of ellipsoids and datums).
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |