spatial-go / geoos

A library provides spatial data and geometric algorithms
http://www.spatial-go.com
GNU Lesser General Public License v2.1
617 stars 130 forks source link

The shadow method Transformer.transformCollection prevents space.Geometry.Simplify() to work correctly #92

Open andreacomparini opened 1 year ago

andreacomparini commented 1 year ago

Using DP geometry simplification I noted that the shadow method tranformCollection() in Tranformer obscure the call at a missing method in DPTransformer and the call at space.Geometry.Simplify() doesn't work in case of geometry collection. I suppose the following method has to be added for DPTransformer.

func (d *DPTransformer) transformCollection(geom matrix.Collection, parent matrix.Steric) matrix.Steric {
    transGeoms := matrix.Collection{}
    for _, v := range geom {
        transformGeom, _ := d.Transform(v)
        if transformGeom == nil {
            continue
        }
        if d.pruneEmptyGeometry && transformGeom.IsEmpty() {
            continue
        }
        transGeoms = append(transGeoms, transformGeom)
    }
    return transGeoms
}