Iterator<? extends CurveSegment> it = segments.iterator();
CurveSegmentImpl cs0 = (CurveSegmentImpl) it.next();
cs0.setCurve(this);
this.envelope = new EnvelopeImpl(cs0.getEnvelope());
Position p0 = cs0.getStartPosition();
// Änderung durch Sanjay, da in bisheriger Version nicht der Fall
// berücksichtigt wurde, dass nur 1 CurveSegment existiert
CurveSegmentImpl cs1 = null;
while (it.hasNext()) {
cs1 = (CurveSegmentImpl) it.next();
// set the segment / curve association
cs1.setCurve(this);
// expand the curve envelope
this.envelope.expand(cs1.getEnvelope());
if (!cs0.getEndPoint().equals(cs1.getStartPoint())) {
throw new IllegalArgumentException(
"Curvesegments are not continuous. Following curve segments are disjoint:" //$NON-NLS-1$
+ cs0 + " and " + cs1); //$NON-NLS-1$
}
cs0 = cs1;
}
Position p1 = cs0.getEndPosition();
Point pt0 = toPoint( p0 );
Point pt1 = toPoint( p1 );
if (pt0 == null) {
DirectPositionImpl copy = new DirectPositionImpl(p0.getDirectPosition());
pt0 = new PointImpl(copy);
//pt0 = this.getFeatGeometryFactory().getPrimitiveFactory().createPoint(p0);
}
if (pt1 == null) {
DirectPositionImpl copy = new DirectPositionImpl(p1.getDirectPosition());
pt1 = new PointImpl(copy);
//pt1 = this.getFeatGeometryFactory().getPrimitiveFactory().createPoint(p1);
}
// Calculate and Set Boundary
this.boundary = this.calculateBoundary(pt0, pt1);