// MultiPoint creates a tile cover for the set of points,
972755
func MultiPoint(mp orb.MultiPoint, z maptile.Zoom) maptile.Set {
	set := make(maptile.Set)
	for _, p := range mp {
		set[maptile.At(p, z)] = true
	}

	return set
}
570092
func Geometry(b orb.Bound, g orb.Geometry) orb.Geometry {
	if g == nil {
		return nil
	}

	if !b.Intersects(g.Bound()) {
		return nil
	}

	switch g := g.(type) {
	case orb.Point:
		return g // Intersect check above
	case orb.MultiPoint:
		mp := MultiPoint(b, g)
		if len(mp) == 1 {
			return mp[0]
		}

		if mp == nil {
			return nil
		}

		return mp
	case orb.LineString:
		mls := LineString(b, g)
		if len(mls) == 1 {
			return mls[0]
		}

		if len(mls) == 0 {
			return nil
		}
		return mls
	case orb.MultiLineString:
		mls := MultiLineString(b, g)
		if len(mls) == 1 {
			return mls[0]
		}

		if mls == nil {
			return nil
		}

		return mls
	case orb.Ring:
		r := Ring(b, g)
		if r == nil {
			return nil
		}

		return r
	case orb.Polygon:
		p := Polygon(b, g)
		if p == nil {
			return nil
		}

		return p
	case orb.MultiPolygon:
		mp := MultiPolygon(b, g)
		if len(mp) == 1 {
			return mp[0]
		}

		if mp == nil {
			return nil
		}

		return mp
	case orb.Collection:
		c := Collection(b, g)
		if len(c) == 1 {
			return c[0]
		}

		if c == nil {
			return nil
		}

		return c
	case orb.Bound:
		b = Bound(b, g)
		if b.IsEmpty() {
			return nil
		}

		return b
	}

	panic(fmt.Sprintf("geometry type not supported: %T", g))
}
98836
func (r Rect) ContainsPoint(p Point) bool {
	return r.X.Contains(p.X) && r.Y.Contains(p.Y)
}
272264
func singlePointLoop(p Point) *Loop {
	const offset = 1e-15
	d0 := p.Ortho()
	d1 := p.Cross(d0)
	vertices := []Point{
		p,
		Point{p.Add(d0.Mul(offset)).Normalize()},
		Point{p.Add(d1.Mul(offset)).Normalize()},
	}
	return LoopFromPoints(vertices)
}
1223676
func (s *RadialSimplifier) MultiPolygon(mp orb.MultiPolygon) orb.MultiPolygon {
	return multiPolygon(s, mp)
}
357459
func MultiPolygon(mp orb.MultiPolygon, z maptile.Zoom) maptile.Set {
	set := make(maptile.Set)
	for _, p := range mp {
		polygon(set, p, z)
	}

	return set
}
176417
func (mp MultiPoint) MarshalJSON() ([]byte, error) {
	return json.Marshal(Geometry{Coordinates: orb.MultiPoint(mp)})
}
772891
func (cu *CellUnion) ContainsPoint(p Point) bool {
	return cu.ContainsCell(CellFromPoint(p))
}
963971
func (g *MultiPoint) MustSetCoords(coords []Coord) *MultiPoint {
	Must(g.SetCoords(coords))
	return g
}
99157
func (lsf *LeastSquaresFunction) AppendPoints(points Points) {
	for _, p := range points {
		lsf.AppendPoint(p.X(), p.Y())
	}
}
551130
func (r Rect) ClampPoint(p Point) Point {
	return Point{r.X.ClampPoint(p.X), r.Y.ClampPoint(p.Y)}
}
580649
func WithMultiEndpointApp(f func(dir string)) {
	dir, err := ioutil.TempDir("", "simple-app")
	Expect(err).ToNot(HaveOccurred())
	defer os.RemoveAll(dir)

	tempfile := filepath.Join(dir, "index.html")
	err = ioutil.WriteFile(tempfile, []byte(fmt.Sprintf("hello world %d", rand.Int())), 0666)
	Expect(err).ToNot(HaveOccurred())

	tempfile = filepath.Join(dir, "other_endpoint.html")
	err = ioutil.WriteFile(tempfile, []byte("other endpoint"), 0666)
	Expect(err).ToNot(HaveOccurred())

	tempfile = filepath.Join(dir, "third_endpoint.html")
	err = ioutil.WriteFile(tempfile, []byte("third endpoint"), 0666)
	Expect(err).ToNot(HaveOccurred())

	err = ioutil.WriteFile(filepath.Join(dir, "Staticfile"), nil, 0666)
	Expect(err).ToNot(HaveOccurred())

	f(dir)
}
1002659
func flattenMultiMaps(m map[string]interface{}) error {
	for k, v := range m {
		switch v := v.(type) {
		case []map[string]interface{}:
			switch {
			case len(v) > 1:
				return fmt.Errorf("multiple map declarations not supported for variables")
			case len(v) == 1:
				m[k] = v[0]
			}
		}
	}
	return nil
}
896188
func (r *Store) MountPoints() []string {
	mps := make([]string, 0, len(r.mounts))
	for k := range r.mounts {
		mps = append(mps, k)
	}
	sort.Sort(sort.Reverse(store.ByPathLen(mps)))
	return mps
}
465182
func (q *ConvexHullQuery) AddPoint(p Point) {
	q.bound = q.bound.AddPoint(LatLngFromPoint(p))
	q.points = append(q.points, p)
}
652180
func (m *Matrix) TranslatePoint(p Point) *Matrix {
	return m.Translate(p.X, p.Y)
}
548618
func Point(p orb.Point, proj orb.Projection) orb.Point {
	return proj(p)
}