|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.operator.ALDData
de.unihalle.informatik.MiToBo.core.datatypes.MTBPolygon2DSet
@ALDParametrizedClass public class MTBPolygon2DSet
Data type to represent a set of MTBPolygon2D
.
A set of 2D polygons lives in a common domain which is a rectangular subset
of R x R. Each polygon is of type Polygon2D or a subclass. For reading and
writing the derived class MTBSnake
is handled in addition to
MTBPolygon2D
.
Field Summary | |
---|---|
private boolean |
debug
Debug flag for internal use only. |
(package private) java.util.Vector<MTBPolygon2D> |
polygonSet
The set of polygons represented as a Vector. |
private double |
xMax
Maximal x coordinate of the domain of this polygon set. |
private double |
xMin
Minimal x coordinate of the domain of this polygon set. |
private double |
yMax
Maximal y coordinate of the domain of this polygon set. |
private double |
yMin
Minimal y coordinate of the domain of this polygon set. |
Constructor Summary | |
---|---|
MTBPolygon2DSet()
Standard constructor |
|
MTBPolygon2DSet(double _xMin,
double _yMin,
double _xMax,
double _yMax)
Construct an empty set of polygons with given extent of domain. |
|
MTBPolygon2DSet(java.util.Vector<MTBPolygon2D> _polys,
double _xMin,
double _yMin,
double _xMax,
double _yMax)
Construct polygon set from given vector. |
Method Summary | |
---|---|
boolean |
add(MTBPolygon2D polygon)
Append a polygon (at the end) to the set of polygons. |
MTBPolygon2DSet |
clone()
|
MTBPolygon2D |
elementAt(int i)
Get a polygon by index. |
private java.util.Vector<java.awt.geom.Point2D.Double> |
extractPointVectorPolygon(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
Extract the list of polygon points for a polygon. |
private java.util.Vector<MTBSnakePoint2D> |
extractPointVectorSnake(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
Extract the list of polygon points for a snake. |
de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType |
getPolygon2DAsXml(MTBPolygon2D polygon,
de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
Copy the information of polygon into the corresponding xml
element xmlPolygon . |
MTBPolygon2D |
getPolygon2DFromXml(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
* Get a new Polygon2D from the information of the
xmlPolygon . |
de.unihalle.informatik.MiToBo_xml.MTBXMLSnakeType |
getSnakeAsXml(MTBSnake snake,
de.unihalle.informatik.MiToBo_xml.MTBXMLSnakeType xmlSnake)
Copy the information of snake into the corresponding xml
element xmlSnake . |
double |
getXmax()
Returns maximal x coordinate of the domain. |
double |
getXmin()
Returns minimal x coordinate of the domain. |
double |
getYmax()
Returns maximal x coordinate of the domain. |
double |
getYmin()
Returns minimal y coordinate of the domain. |
void |
read(java.lang.String filename)
Read a polygon set from an xml file filename and set the MTB
polygon set accordingly. |
void |
setElementAt(int i,
MTBPolygon2D poly)
Set a polygon at i-th position of the set. |
int |
size()
Get the number of polygons of this polygon set. |
java.lang.String |
toString()
|
void |
write(java.lang.String filename)
Write this polygon set as xml into file filename.xml
Additionally the processing history is written. |
void |
write(java.lang.String filename,
boolean writeHistory)
Write this polygon set as xml into file filename If flag is
set to true, the processing history is written, too. |
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, wait, wait, wait |
Field Detail |
---|
private boolean debug
@ALDClassParameter(label="Set of polygons") java.util.Vector<MTBPolygon2D> polygonSet
@ALDClassParameter(label="Maximal x in domain") private double xMax
@ALDClassParameter(label="Minimal x in domain") private double xMin
@ALDClassParameter(label="Maximal y in domain") private double yMax
@ALDClassParameter(label="Minimal y in domain") private double yMin
Constructor Detail |
---|
public MTBPolygon2DSet()
public MTBPolygon2DSet(double _xMin, double _yMin, double _xMax, double _yMax)
_xMin
- minimum value of x-coordinates for the set_yMin
- minimum value of y-coordinates for the set_xMax
- maximum value of x-coordinates for the set_yMax
- maximum value of y-coordinates for the setpublic MTBPolygon2DSet(java.util.Vector<MTBPolygon2D> _polys, double _xMin, double _yMin, double _xMax, double _yMax)
_polys
- set of polygons_xMin
- minimum value of x-coordinates for the set_yMin
- minimum value of y-coordinates for the set_xMax
- maximum value of x-coordinates for the set_yMax
- maximum value of y-coordinates for the setMethod Detail |
---|
public boolean add(MTBPolygon2D polygon)
polygon
- Polygon to add.public MTBPolygon2DSet clone()
clone
in class java.lang.Object
public MTBPolygon2D elementAt(int i)
private java.util.Vector<java.awt.geom.Point2D.Double> extractPointVectorPolygon(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
xmlPolygon
- the xml polygon to copy the data from
private java.util.Vector<MTBSnakePoint2D> extractPointVectorSnake(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
xmlPolygon
- the xml polygon to copy the data from
public de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType getPolygon2DAsXml(MTBPolygon2D polygon, de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon)
polygon
into the corresponding xml
element xmlPolygon
. If xmlPolygon
is null, a new
obejct is created, otherwise the passed object filled.
public MTBPolygon2D getPolygon2DFromXml(de.unihalle.informatik.MiToBo_xml.MTBXMLPolygon2DType xmlPolygon) throws java.lang.ClassNotFoundException
Polygon2D
from the information of the
xmlPolygon
. Returns Polygon2D and Snake type polygons as
appropriate.
xmlPolygon
- polygon object stored in the xmlPolygon
java.lang.ClassNotFoundException
public de.unihalle.informatik.MiToBo_xml.MTBXMLSnakeType getSnakeAsXml(MTBSnake snake, de.unihalle.informatik.MiToBo_xml.MTBXMLSnakeType xmlSnake)
snake
into the corresponding xml
element xmlSnake
. If xmlSnake
is null, a new
obejct is created, otherwise the passed object filled.
public double getXmax()
public double getXmin()
public double getYmax()
public double getYmin()
public void read(java.lang.String filename) throws java.lang.ClassNotFoundException, MTBException
filename
and set the MTB
polygon set accordingly. The processing history is read also if available.
WARNING: currently assume filename WITHOUT extension.
filename
- Filename to read from, WITHOUT extension (for the moment).
java.lang.ClassNotFoundException
MTBException
public void setElementAt(int i, MTBPolygon2D poly)
i
- positionpoly
- polygon object to set at position ipublic int size()
public java.lang.String toString()
toString
in class java.lang.Object
public void write(java.lang.String filename) throws de.unihalle.informatik.Alida.exceptions.ALDException
filename.xml
Additionally the processing history is written.
WARNING: currently assume filename WITHOUT extension.
filename
- Filename to write to, WITHOUT extension (for the moment)
de.unihalle.informatik.Alida.exceptions.ALDException
public void write(java.lang.String filename, boolean writeHistory) throws de.unihalle.informatik.Alida.exceptions.ALDException
filename
If flag is
set to true, the processing history is written, too.
filename
- Filename to write to.writeHistory
- If true, the history is written as well.
de.unihalle.informatik.Alida.exceptions.ALDException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |