de.unihalle.informatik.MiToBo.core.datatypes
Class MTBContour2DSet

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDData
      extended by de.unihalle.informatik.MiToBo.core.datatypes.MTBContour2DSet
All Implemented Interfaces:
java.lang.Cloneable

public class MTBContour2DSet
extends de.unihalle.informatik.Alida.operator.ALDData
implements java.lang.Cloneable

A set of 2D contours living in a common domain which is a rectangular subset of R x R. Each contours is of type Contour2D

Author:
Stefan Posch

Field Summary
(package private)  java.util.Vector<MTBContour2D> contourSet
          The set of contours represented as a Vector.
private  double xMax
          Maximal x coordinate of the domain of this contour set.
private  double xMin
          Minimal x coordinate of the domain of this contour set.
private  double yMax
          Maximal y coordinate of the domain of this contour set.
private  double yMin
          Minimal y coordinate of the domain of this contour set.
 
Constructor Summary
MTBContour2DSet()
          Standard constructor.
MTBContour2DSet(double xMin, double yMin, double xMax, double yMax)
          Construct an empty set of contours with given extent of domain.
 
Method Summary
 boolean add(MTBContour2D contour)
          Append a contour (at the end) to the set of contours.
 MTBContour2DSet clone()
           
 MTBContour2D elementAt(int i)
          Get a contour by index.
 de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType getContour2DAsXml(MTBContour2D contour, de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType xmlC)
          Copy the information of contour into the corresponding xml element xmlContour.
 MTBContour2D getContour2DFromXml(de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType xmlContour)
          Get a new MTBContour2D from the information of the xmlContour.
 void read(java.lang.String filename)
          Read a contour set from an xml file filename and set the MTB polygon set accordingly.
 void removeElementAt(int i)
          Delete the i-th contour from the set
 void setElementAt(MTBContour2D contour, int i)
          Set the i-th contour from the set.
 int size()
          Get the number of contours of this contour set
 void write(java.lang.String filename)
          Write this contour set into XML file filename.xml Additionally, its processing history is written.
 
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDData
cloneProperties, getLocation, getProperty, getPropertyKeys, print, setLocation, setProperty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contourSet

java.util.Vector<MTBContour2D> contourSet
The set of contours represented as a Vector.


xMax

private double xMax
Maximal x coordinate of the domain of this contour set.


xMin

private double xMin
Minimal x coordinate of the domain of this contour set.


yMax

private double yMax
Maximal y coordinate of the domain of this contour set.


yMin

private double yMin
Minimal y coordinate of the domain of this contour set.

Constructor Detail

MTBContour2DSet

public MTBContour2DSet()
Standard constructor.


MTBContour2DSet

public MTBContour2DSet(double xMin,
                       double yMin,
                       double xMax,
                       double yMax)
Construct an empty set of contours with given extent of domain.

Parameters:
xMin - minimal x-coordinate of the domain
yMin - minimal y-coordinate of the domain
xMax - maximal x-coordinate of the domain
yMax - maximal y-coordinate of the domain
Method Detail

add

public boolean add(MTBContour2D contour)
Append a contour (at the end) to the set of contours.

Parameters:
contour - contour to add

clone

public MTBContour2DSet clone()
Overrides:
clone in class java.lang.Object

elementAt

public MTBContour2D elementAt(int i)
Get a contour by index.

Returns:
The i-th contour.

getContour2DAsXml

public de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType getContour2DAsXml(MTBContour2D contour,
                                                                               de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType xmlC)
Copy the information of contour into the corresponding xml element xmlContour. If xmlContour is null, a new obejct is created, otherwise the passed object filled.


getContour2DFromXml

public MTBContour2D getContour2DFromXml(de.unihalle.informatik.MiToBo_xml.MTBXMLContour2DType xmlContour)
Get a new MTBContour2D from the information of the xmlContour.

Parameters:
xmlContour - xml contour object
Returns:
MTBContour2D object.

read

public void read(java.lang.String filename)
          throws java.lang.ClassNotFoundException,
                 MTBException
Read a contour set from an xml file filename and set the MTB polygon set accordingly. The processing history is read also if available.

WARNING: currently assume filename WITHOUT extension.

Parameters:
filename - Filename to read from, WITHOUT extension (for the moment).
Throws:
java.lang.ClassNotFoundException
MTBException

removeElementAt

public void removeElementAt(int i)
Delete the i-th contour from the set

Parameters:
i - index of contour to remove

setElementAt

public void setElementAt(MTBContour2D contour,
                         int i)
Set the i-th contour from the set.

Parameters:
contour - new contour element
i - index of the new contour

size

public int size()
Get the number of contours of this contour set

Returns:
Number of contours.

write

public void write(java.lang.String filename)
           throws de.unihalle.informatik.Alida.exceptions.ALDException
Write this contour set into XML file filename.xml Additionally, its processing history is written.

WARNING: currently assume filename WITHOUT extension.

Parameters:
filename - Filename to write to, WITHOUT extension (for the moment)
Throws:
de.unihalle.informatik.Alida.exceptions.ALDException