ilog.views.maps.geometry
Class IlvMapPolygon

java.lang.Object
  extended by ilog.views.maps.IlvMapGeometry
      extended by ilog.views.maps.geometry.IlvMapArea
          extended by ilog.views.maps.geometry.IlvMapPolygon

public class IlvMapPolygon
extends IlvMapArea

This class defines a Polygon. A polygon is an area that can contain holes. It is defined by an exterior ring and by interior rings that describe the internal holes of the polygon. The interior rings should not intersect. However, this class does not perform automatic consistency checking. The instances of this class can be rendered by an IlvDefaultFeatureRenderer or by an IlvDefaultAreaRenderer.

Since:
JViews 3.5

Constructor Summary
IlvMapPolygon(IlvMapRingInterface exteriorRing)
          Constructs a polygon with its exterior ring.
 
Method Summary
 void addInteriorRing(IlvMapRingInterface ring)
          Adds an interior ring to the polygon.
 boolean contains(IlvCoordinate c)
          Returns true if c is contained in the object.
 Rectangle2D getBounds(Rectangle2D result)
          Returns the bounds of this IlvMapGeometry
 IlvMapRingInterface getExteriorRing()
          Returns the exterior ring of the polygon.
 IlvMapRingInterface getInteriorRing(int index)
          Returns interior ring at the specified index.
 int getInteriorRingCount()
          Returns the number of interior rings.
 IlvMapCurve getOutline()
          Returns the outline of this polygon.
 IlvMapRingInterface removeInteriorRing(IlvMapRingInterface ring)
          Removes the specified interior ring from the list and returns it.
 void removeInteriorRings()
          Removes all the interior rings of the polygon.
 IlvMapRingInterface setExteriorRing(IlvMapRingInterface exteriorRing)
          Sets the exterior ring of the polygon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvMapPolygon

public IlvMapPolygon(IlvMapRingInterface exteriorRing)
Constructs a polygon with its exterior ring.

Parameters:
exteriorRing - The exterior ring. exteriorRing should not be null. Since the ring is not copied, the ring should not be modified after this operation.
Method Detail

getExteriorRing

public IlvMapRingInterface getExteriorRing()
Returns the exterior ring of the polygon.


setExteriorRing

public IlvMapRingInterface setExteriorRing(IlvMapRingInterface exteriorRing)
Sets the exterior ring of the polygon. The previous exterior ring is returned by the function.

Parameters:
exteriorRing - The exterior ring. Since the ring is not copied, the ring should not be modified after being set. The value should not be null.
Returns:
The previous exterior ring.

getInteriorRingCount

public int getInteriorRingCount()
Returns the number of interior rings.

Returns:
The number of interior rings.

removeInteriorRings

public void removeInteriorRings()
Removes all the interior rings of the polygon.


removeInteriorRing

public IlvMapRingInterface removeInteriorRing(IlvMapRingInterface ring)
Removes the specified interior ring from the list and returns it. If the ring is not an interior ring of the polygon, the function returns null.

Parameters:
ring - The ring to remove.
Returns:
The removed interior ring or null if ring is not an interior ring of the polygon.

addInteriorRing

public void addInteriorRing(IlvMapRingInterface ring)
Adds an interior ring to the polygon. Since the ring is not copied, the ring should not be modified after being added.

Parameters:
ring - The interior ring to be added.

getInteriorRing

public IlvMapRingInterface getInteriorRing(int index)
Returns interior ring at the specified index.

Parameters:
index - The index of the ring. index should be between 0 and getInteriorRingCount() - 1.
Returns:
The IlvMapRingInterface object at index index.

getOutline

public IlvMapCurve getOutline()
Returns the outline of this polygon.
As this method returns a reference to an internal object, this object is subject to change when this IlvMapPolygon changes.

Specified by:
getOutline in class IlvMapArea
Returns:
An IlvCurve object that should not be modified.

contains

public boolean contains(IlvCoordinate c)
Returns true if c is contained in the object.

Specified by:
contains in class IlvMapArea
Parameters:
c - The point to be checked.
Returns:
true if c is contained in the object.

getBounds

public Rectangle2D getBounds(Rectangle2D result)
Returns the bounds of this IlvMapGeometry

Specified by:
getBounds in class IlvMapGeometry


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