ilog.views.maps.datasource
Class IlvPolylineMergerDataSource

java.lang.Object
  extended by ilog.views.maps.datasource.IlvMapDataSource
      extended by ilog.views.maps.datasource.IlvGraphicLayerDataSource
          extended by ilog.views.maps.datasource.IlvPolylineMergerDataSource
All Implemented Interfaces:
IlvPersistentObject, IlvFeatureRenderer, IlvMapFeatureIterator, IlvMapReusableFeatureIterator

public class IlvPolylineMergerDataSource
extends IlvGraphicLayerDataSource

This class features a utility that merges several polylines into a single polyline.
This can be useful when the API must label the polylines.
For example, roads comprised of many smaller polylines may be labeled several times along their path, but they may also not be labeled if the Label Manager cannot fit labels on these segments.
Using this utility class can produce cleaner and more efficient labeling of polylines.

Since:
JViews 7.5

Nested Class Summary
static interface IlvPolylineMergerDataSource.IlvGraphicIdentifier
          This interface compares collections of features that are to be merged as a single polyline.
 
Field Summary
 
Fields inherited from class ilog.views.maps.datasource.IlvMapDataSource
renderer, usingGeodeticComputation
 
Constructor Summary
IlvPolylineMergerDataSource(IlvInputStream stream)
          Creates a data source by reading its parameters on the stream.
IlvPolylineMergerDataSource(IlvMapDataSource dataSource)
          Creates a IlvPolylineMergerDataSource on a IlvMapDataSource passed as parameter
IlvPolylineMergerDataSource(IlvMapDataSource dataSource, IlvPolylineMergerDataSource.IlvGraphicIdentifier identifier)
          Creates a IlvPolylineMergerDataSource on a IlvMapDataSource passed as parameter, with specified IlvGraphicIdentifier
 
Method Summary
 IlvPolylineMergerDataSource.IlvGraphicIdentifier getComponentIdentifier()
          Returns the IlvGraphicIdentifier used by this polyline merger to identify polylines that should be merged together.
 boolean isGeoreferenced()
          Returns false.
 void setComponentIdentifier(IlvPolylineMergerDataSource.IlvGraphicIdentifier identifier)
          Sets the IlvGraphicIdentifier used by this polyline merger to identify polylines that should be merged together
 void setMergeDistance(double distance)
          Set the criterion distance used when merging polylines.
 void start()
          Merges together the specified collection of polylines.
 void write(IlvOutputStream stream)
          Writes an IlvPolylineMergerDataSource into an IlvOutputStream
 
Methods inherited from class ilog.views.maps.datasource.IlvGraphicLayerDataSource
add, add, clear, dispose, get, getDefaultFeatureRenderer, getFeatureIterator, getLowerRightCorner, getMonitoringData, getNextFeature, getUpperLeftCorner, isPersistent, makeGraphic, remove, restart, setCoordinateSystem, setManager, setMonitoringData, size
 
Methods inherited from class ilog.views.maps.datasource.IlvMapDataSource
addDataSourceListener, callListeners, createInsertionLayer, getBackupDataSources, getCoordinateSystem, getDescription, getFeatureRenderer, getInsertionLayer, getManager, getMapLayer, getName, getNode, getValidExtentions, hasInsertionLayer, initBackupDataSource, initInsertionLayer, isAttachingAttributes, isSaveBackupDataSources, isSourceDataAvailable, isUsingGeodeticComputation, mapIntersects, removeDataSourceListener, reset, setAttachingAttributes, setDescription, setFeatureRenderer, setForceUsingBackupDataSource, setInsertionLayer, setName, setSaveBackupDataSources, setValidExtentions, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ilog.views.maps.IlvMapFeatureIterator
getCoordinateSystem
 

Constructor Detail

IlvPolylineMergerDataSource

public IlvPolylineMergerDataSource(IlvMapDataSource dataSource)
Creates a IlvPolylineMergerDataSource on a IlvMapDataSource passed as parameter

Parameters:
dataSource - the IlvMapDataSource producing polylines to merge

IlvPolylineMergerDataSource

public IlvPolylineMergerDataSource(IlvInputStream stream)
                            throws IlvReadFileException
Creates a data source by reading its parameters on the stream.

Parameters:
stream - stream to read from.
Throws:
IlvReadFileException

IlvPolylineMergerDataSource

public IlvPolylineMergerDataSource(IlvMapDataSource dataSource,
                                   IlvPolylineMergerDataSource.IlvGraphicIdentifier identifier)
Creates a IlvPolylineMergerDataSource on a IlvMapDataSource passed as parameter, with specified IlvGraphicIdentifier

Parameters:
dataSource - the IlvMapDataSource containing polylines to merge
identifier - the IlvGraphicIdentifier used to identify polylines to merge together (same id)
Method Detail

write

public void write(IlvOutputStream stream)
           throws IOException
Writes an IlvPolylineMergerDataSource into an IlvOutputStream

Specified by:
write in interface IlvPersistentObject
Specified by:
write in interface IlvFeatureRenderer
Overrides:
write in class IlvGraphicLayerDataSource
Parameters:
stream - The stream to write to.
Throws:
IOException
See Also:
IlvFeatureRenderer.write(ilog.views.io.IlvOutputStream)

setComponentIdentifier

public void setComponentIdentifier(IlvPolylineMergerDataSource.IlvGraphicIdentifier identifier)
Sets the IlvGraphicIdentifier used by this polyline merger to identify polylines that should be merged together

Parameters:
identifier - IlvGraphicIdentifier to retrieve the identifier to use.

getComponentIdentifier

public IlvPolylineMergerDataSource.IlvGraphicIdentifier getComponentIdentifier()
Returns the IlvGraphicIdentifier used by this polyline merger to identify polylines that should be merged together.

Returns:
the IlvGraphicIdentifier used by this polyline merger.

setMergeDistance

public void setMergeDistance(double distance)
Set the criterion distance used when merging polylines. When to polylines have two points that are closer than this distance, they are merged. Inadequate merge distances (i.e. too big compared to polylines coordinates range) may result in polylines being merged in an unpredictable way.

Parameters:
distance - the square of the max distance between two polygons to merge.

start

public void start()
           throws Exception
Merges together the specified collection of polylines. This is done according to the mergeDistance criterion, and is intended to "weld" almost identical points (start or end) of several polylines. Therefore, high merge distances may result in polylines being merged in an unpredictable way.

Overrides:
start in class IlvGraphicLayerDataSource
Throws:
Exception - when the initial source
See Also:
IlvMapDataSource.start()

isGeoreferenced

public boolean isGeoreferenced()
Returns false.

Specified by:
isGeoreferenced in interface IlvMapFeatureIterator
Overrides:
isGeoreferenced in class IlvGraphicLayerDataSource
Returns:
Returns false.
See Also:
IlvMapFeatureIterator.isGeoreferenced()


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