private static LinearRing insertVertexInLinearRing ( LineString lineString , Point vertexPoint , double tolerance ) { GeometryLocation geomLocation = EditUtilities . getVertexToSnap ( lineString , vertexPoint , tolerance ) ; if ( geomLocation != null ) { Coordinate [ ] coords = lineString . getCoordinates ( ) ; int index = geomLocation . getSegmentIndex ( ) ; Coordinate coord = geomLocation . getCoordinate ( ) ; if ( ! CoordinateUtils . contains2D ( coords , coord ) ) { Coordinate [ ] ret = new Coordinate [ coords . length + 1 ] ; System . arraycopy ( coords , 0 , ret , 0 , index + 1 ) ; ret [ index + 1 ] = coord ; System . arraycopy ( coords , index + 1 , ret , index + 2 , coords . length - ( index + 1 ) ) ; return FACTORY . createLinearRing ( ret ) ; } return null ; } else { return null ; } }
Adds a vertex into a LinearRing with a given tolerance .