package space.nstart.pcp.complan.apl

import org.locationtech.jts.geom.Geometry
import org.locationtech.jts.operation.union.UnaryUnionOp

class IntervalCoverageChecker {

    fun findUncoveredGeometry(contour: Geometry, intervals: List<Geometry>): Geometry {
        if (intervals.isEmpty()) {
            return contour.copy()
        }

        val intervalsUnion = UnaryUnionOp(intervals).union()
        return contour.difference(intervalsUnion)
    }
}
