Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify Validate method functionality in doc comments #532

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions geom/type_geometry_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ func NewGeometryCollection(geoms []Geometry) GeometryCollection {
return GeometryCollection{geoms, ctype}
}

// Validate checks if the GeometryCollection is valid. GeometryCollections are
// unconstrained collections, however this method additionally checks that each
// child Geometry is valid.
// Validate checks if the GeometryCollection is valid. The only validation rule
// is that each geometry in the collection must be valid.
func (c GeometryCollection) Validate() error {
for i, g := range c.geoms {
if err := g.Validate(); err != nil {
Expand Down
5 changes: 2 additions & 3 deletions geom/type_multi_line_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ func NewMultiLineString(lines []LineString) MultiLineString {
return MultiLineString{lines, ctype}
}

// Validate checks if the MultiLineString is valid. MultiLineStrings are
// unconstrained collections, however this method additionally checks that each
// child LineString is valid.
// Validate checks if the MultiLineString is valid. The only validation rule is
// that each LineString in the collection must be valid.
func (m MultiLineString) Validate() error {
for i, ls := range m.lines {
if err := ls.Validate(); err != nil {
Expand Down
5 changes: 2 additions & 3 deletions geom/type_multi_point.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ func NewMultiPoint(pts []Point) MultiPoint {
return MultiPoint{forced, ctype}
}

// Validate checks if the MultiPoint is valid. MultiPoints are unconstrained
// collections, however this method additionally checks that each child Point
// is valid.
// Validate checks if the MultiPoint is valid. The only validation rule is that
// each point in the collection must be valid.
func (m MultiPoint) Validate() error {
for i, pt := range m.points {
if err := pt.Validate(); err != nil {
Expand Down
8 changes: 3 additions & 5 deletions geom/type_multi_polygon.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ func NewMultiPolygon(polys []Polygon) MultiPolygon {
// The Polygons that make up a MultiPolygon are constrained by the following
// rules:
//
// 1. The interiors of any two child polygons must not intersect.
// 2. The boundaries of any two child polygons may touch only at a finite
// 1. Each child polygon must be valid.
// 2. The interiors of any two child polygons must not intersect.
// 3. The boundaries of any two child polygons may touch only at a finite
// number of points.
//
// In addition to these constraints, this method also checks if each child
// Polygon is valid.
func (m MultiPolygon) Validate() error {
for i, poly := range m.polys {
if err := poly.Validate(); err != nil {
Expand Down
Loading