mil.nga.wkb.geom.CompoundCurve Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wkb Show documentation
Show all versions of wkb Show documentation
Library for writing and reading Well-Known Binary Geometries to and from bytes
package mil.nga.wkb.geom;
import java.util.ArrayList;
import java.util.List;
/**
* Compound Curve, Curve sub type
*
* @author osbornb
*/
public class CompoundCurve extends Curve {
/**
* List of line strings
*/
private List lineStrings = new ArrayList();
/**
* Constructor
*/
public CompoundCurve() {
this(false, false);
}
/**
* Constructor
*
* @param hasZ
* has z
* @param hasM
* has m
*/
public CompoundCurve(boolean hasZ, boolean hasM) {
super(GeometryType.COMPOUNDCURVE, hasZ, hasM);
}
/**
* Constructor
*
* @param compoundCurve
* compound Curve to copy
*/
public CompoundCurve(CompoundCurve compoundCurve) {
this(compoundCurve.hasZ(), compoundCurve.hasM());
for (LineString lineString : compoundCurve.getLineStrings()) {
addLineString((LineString) lineString.copy());
}
}
/**
* Get the line strings
*
* @return line strings
*/
public List getLineStrings() {
return lineStrings;
}
/**
* Set the line strings
*
* @param lineStrings
* line strings
*/
public void setLineStrings(List lineStrings) {
this.lineStrings = lineStrings;
}
/**
* Add a line string
*
* @param lineString
* line string
*/
public void addLineString(LineString lineString) {
lineStrings.add(lineString);
}
/**
* Get the number of line strings
*
* @return number of line strings
*/
public int numLineStrings() {
return lineStrings.size();
}
/**
* {@inheritDoc}
*/
@Override
public Geometry copy() {
return new CompoundCurve(this);
}
}