Skip to content

Commit

Permalink
Merge pull request #491 from peterstace/simplify_geometry_type_method
Browse files Browse the repository at this point in the history
Simplify the `Type` method of the `Geometry` type
  • Loading branch information
peterstace committed Feb 15, 2023
2 parents 0f60dd0 + a6aa366 commit 799302d
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions geom/type_geometry.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,9 @@ func (t GeometryType) String() string {
}
}

// Type returns a string representation of the geometry's type.
// Type returns the type of the Geometry.
func (g Geometry) Type() GeometryType {
switch g.gtype {
case TypeGeometryCollection:
return g.MustAsGeometryCollection().Type()
case TypePoint:
return g.MustAsPoint().Type()
case TypeLineString:
return g.MustAsLineString().Type()
case TypePolygon:
return g.MustAsPolygon().Type()
case TypeMultiPoint:
return g.MustAsMultiPoint().Type()
case TypeMultiLineString:
return g.MustAsMultiLineString().Type()
case TypeMultiPolygon:
return g.MustAsMultiPolygon().Type()
default:
panic("unknown geometry: " + g.gtype.String())
}
return g.gtype
}

// IsGeometryCollection return true iff the Geometry is a GeometryCollection geometry.
Expand Down

0 comments on commit 799302d

Please sign in to comment.