// FullPolygon returns a special "full" polygon.
508989
func FullPolygon() *Polygon {
	ret := &Polygon{
		loops: []*Loop{
			FullLoop(),
		},
		numVertices:    len(FullLoop().Vertices()),
		bound:          FullRect(),
		subregionBound: FullRect(),
	}
	ret.initEdgesAndIndex()
	return ret
}
652753
func (p *Polygon) Validate() error {
	for i, l := range p.loops {
		// Check for loop errors that don't require building a ShapeIndex.
		if err := l.findValidationErrorNoIndex(); err != nil {
			return fmt.Errorf("loop %d: %v", i, err)
		}
		// Check that no loop is empty, and that the full loop only appears in the
		// full polygon.
		if l.IsEmpty() {
			return fmt.Errorf("loop %d: empty loops are not allowed", i)
		}
		if l.IsFull() && len(p.loops) > 1 {
			return fmt.Errorf("loop %d: full loop appears in non-full polygon", i)
		}
	}

	// TODO(roberts): Uncomment the remaining checks when they are completed.

	// Check for loop self-intersections and loop pairs that cross
	// (including duplicate edges and vertices).
	// if findSelfIntersection(p.index) {
	//	return fmt.Errorf("polygon has loop pairs that cross")
	// }

	// Check whether initOriented detected inconsistent loop orientations.
	// if p.hasInconsistentLoopOrientations {
	// 	return fmt.Errorf("inconsistent loop orientations detected")
	// }

	// Finally, verify the loop nesting hierarchy.
	return p.findLoopNestingError()
}
58282
func (c *Context) PolygonOffset(factor, units float64) {
	c.Call("polygonOffset", factor, units)
}
98127
func (calc *AreaCentroidCalculator) AddPolygon(polygon *geom.Polygon) {
	calc.setBasePoint(polygon.Coord(0))

	calc.addShell(polygon.LinearRing(0).FlatCoords())
	for i := 1; i < polygon.NumLinearRings(); i++ {
		calc.addHole(polygon.LinearRing(i).FlatCoords())
	}
}
371437
func MultiPolygon(mp orb.MultiPolygon, proj orb.Projection) orb.MultiPolygon {
	for i := range mp {
		mp[i] = Polygon(mp[i], proj)
	}

	return mp
}
926524
func Polygon(p orb.Polygon, proj orb.Projection) orb.Polygon {
	for i := range p {
		p[i] = Ring(p[i], proj)
	}

	return p
}
985619
func Polygon(b orb.Bound, p orb.Polygon) orb.Polygon {
	if len(p) == 0 {
		return nil
	}

	r := Ring(b, p[0])
	if r == nil {
		return nil
	}

	result := orb.Polygon{r}
	for i := 1; i < len(p); i++ {
		r := Ring(b, p[i])
		if r != nil {
			result = append(result, r)
		}
	}

	return result
}
659341
func (s *FlushService) Full(full bool) *FlushService {
	s.full = &full
	return s
}
262108
func NewPolygon(verts Vertices, offset vect.Vect) *Shape {
	if verts == nil {
		log.Printf("Error: no vertices passed!")
		return nil
	}

	shape := newShape()
	poly := &PolygonShape{Shape: shape}

	poly.SetVerts(verts, offset)

	shape.ShapeClass = poly
	return shape
}
734904
func Geometry(g orb.Geometry, z maptile.Zoom) maptile.Set {
	if g == nil {
		return nil
	}

	switch g := g.(type) {
	case orb.Point:
		return Point(g, z)
	case orb.MultiPoint:
		return MultiPoint(g, z)
	case orb.LineString:
		return LineString(g, z)
	case orb.MultiLineString:
		return MultiLineString(g, z)
	case orb.Ring:
		return Ring(g, z)
	case orb.Polygon:
		return Polygon(g, z)
	case orb.MultiPolygon:
		return MultiPolygon(g, z)
	case orb.Collection:
		return Collection(g, z)
	case orb.Bound:
		return Bound(g, z)
	}

	panic(fmt.Sprintf("geometry type not supported: %T", g))
}
358626
func (calc *LineCentroidCalculator) AddPolygon(polygon *geom.Polygon) *LineCentroidCalculator {
	for i := 0; i < polygon.NumLinearRings(); i++ {
		calc.AddLinearRing(polygon.LinearRing(i))
	}

	return calc
}
281942
func (mp MultiPolygon) Equal(multiPolygon MultiPolygon) bool {
	if len(mp) != len(multiPolygon) {
		return false
	}

	for i, p := range mp {
		if !p.Equal(multiPolygon[i]) {
			return false
		}
	}

	return true
}
969839
func (q *ConvexHullQuery) AddPolygon(p *Polygon) {
	q.bound = q.bound.Union(p.RectBound())
	for _, l := range p.loops {
		// Only loops at depth 0 can contribute to the convex hull.
		if l.depth == 0 {
			q.AddLoop(l)
		}
	}
}
865104
func (s *VisvalingamSimplifier) Polygon(p orb.Polygon) orb.Polygon {
	return polygon(s, p)
}
123972
func (p *Polygon) initOneLoop() {
	p.hasHoles = false
	p.numVertices = len(p.loops[0].vertices)
	p.bound = p.loops[0].RectBound()
	p.subregionBound = ExpandForSubregions(p.bound)
	// Ensure the loops depth is set correctly.
	p.loops[0].depth = 0

	p.initEdgesAndIndex()
}
540862
func (c *ReactionsListCall) Full(full bool) *ReactionsListCall {
	c.full = full
	return c
}
493999
func NewMultiPolygon(coordinates []MultiLine) *MultiPolygon {
	if coordinates == nil {
		coordinates = make([]MultiLine, 0, INIT_GEOM_CAP)
	}
	return &MultiPolygon{Type: "MultiPolygon", Coordinates: coordinates}
}