ilog.views.maps.format
Class IlvMapLoader

java.lang.Object
  extended by ilog.views.maps.format.IlvMapLoader

public class IlvMapLoader
extends Object

The IlvMapLoader class can be used to load map files into an IlvManager more easily. For instance, the load(String fileName) method is able to determine the format of a map file and to instantiate the appropriate map reader to load it. Similarly, the load(IlvMapFeatureIterator iterator) method can take any IlvMapFeatureIterator and load its content into a manager.

Since:
ILOG JViews3.0
See Also:
load(java.lang.String), IlvMapFeatureIterator, IlvFeatureRenderer, IlvMapFeature, IlvManager, IlvManagerView

Constructor Summary
IlvMapLoader(IlvManager manager)
          Initializes an IlvMapLoader that will load map files into the specified manager.
 
Method Summary
 IlvCoordinateSystem getDefaultCoordinateSystem()
          Returns the default Coordinate System used by readers that are not georeferenced.
 IlvManagerLayer getInsertionLayer()
          Returns the layer to which the graphic objects will be added.
 boolean isAttachingAttributes()
          Returns true if the attributes associated with the map features are attached to the graphic objects.
 int load(IlvMapFeatureIterator featureIterator)
          Loads the map features using the specified map reader.
 int load(IlvMapFeatureIterator featureIterator, IlvFeatureRenderer renderer)
          Loads the map features using the specified map reader and translates them into graphic objects using the specified map renderer.
 int load(String fileName)
          Loads the map file specified as argument.
 IlvMapFeatureIterator makeFeatureIterator(String fileName)
          Tries to instantiate a map reader to read the data from the specified file.
 void setAttachingAttributes(boolean attachAttributes)
          Specifies whether the loader must attach a copy of the attributes of the features read by the map reader to the graphic objects.
 void setDefaultCoordinateSystem(IlvCoordinateSystem cs)
          Sets the default Coordinate System to be used by readers that are not georeferenced.
 void setInsertionLayer(IlvManagerLayer insertionLayer)
          Specifies the layer to which the graphic objects will be added.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvMapLoader

public IlvMapLoader(IlvManager manager)
Initializes an IlvMapLoader that will load map files into the specified manager. If an IlvProjectionProperty is attached to the manager, and if the objects are read from a georeferenced map file (from which it is possible to know the projection used), the graphic objects will be automatically projected using the manager's projection.

Parameters:
manager - The manager to which the graphic objects will be added.
See Also:
IlvProjectionProperty
Method Detail

load

public int load(String fileName)
         throws IOException
Loads the map file specified as argument. This method tries to determine the format of the map and instantiates the appropriate feature iterator. It translates the features returned by the feature iterator to graphic objects using the default feature renderer of the feature iterator. The graphic objects are then added to the manager. This method returns the number of features read.

Parameters:
fileName - The name of the file to be loaded.
Throws:
IlvMapFormatException - If the file format cannot be determined.
IOException - If an error occurs while reading the file.

load

public int load(IlvMapFeatureIterator featureIterator)
         throws IOException
Loads the map features using the specified map reader. The map features are translated to graphic objects using the default feature renderer of the map reader. These objects are then added to the manager. This method returns the number of features read.

Parameters:
featureIterator - The map reader.
Throws:
IOException - If an error occurs while reading the data.

load

public int load(IlvMapFeatureIterator featureIterator,
                IlvFeatureRenderer renderer)
         throws IOException
Loads the map features using the specified map reader and translates them into graphic objects using the specified map renderer. Once translated, these objects are added to a manager. This method returns the number of features read.

Parameters:
featureIterator - The map reader.
renderer - The map renderer.
Throws:
IOException - If an error occurs while reading the data.

makeFeatureIterator

public IlvMapFeatureIterator makeFeatureIterator(String fileName)
                                          throws IOException
Tries to instantiate a map reader to read the data from the specified file. This method is used by the load method. Subclassing the IlvMapLoader and overloading this method is a way to add support to user-defined map readers for the load(java.lang.String) method.

Parameters:
fileName - The name of the map file.
Returns:
null if the map format could not be determined.
Throws:
IOException - If an error occurs while opening the reader.

getInsertionLayer

public final IlvManagerLayer getInsertionLayer()
Returns the layer to which the graphic objects will be added.


setInsertionLayer

public void setInsertionLayer(IlvManagerLayer insertionLayer)
Specifies the layer to which the graphic objects will be added. The layer must belong to the manager passed as argument to the map loader.

Parameters:
insertionLayer - The layer to which the objects will be added.

setAttachingAttributes

public void setAttachingAttributes(boolean attachAttributes)
Specifies whether the loader must attach a copy of the attributes of the features read by the map reader to the graphic objects. By default, the map loader attaches attributes.

Parameters:
attachAttributes - If true, a copy of the attributes is attached to the graphic objects.
See Also:
IlvMapFeature.getAttributes()

isAttachingAttributes

public boolean isAttachingAttributes()
Returns true if the attributes associated with the map features are attached to the graphic objects.


setDefaultCoordinateSystem

public void setDefaultCoordinateSystem(IlvCoordinateSystem cs)
Sets the default Coordinate System to be used by readers that are not georeferenced.

Parameters:
cs - The default Coordinate System.
Since:
JViews 5.0

getDefaultCoordinateSystem

public IlvCoordinateSystem getDefaultCoordinateSystem()
Returns the default Coordinate System used by readers that are not georeferenced.

Since:
JViews 5.0


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.