Ejemplo n.º 1
0
func (this CoordsFactory64) CopyFromGeometry(geom geom.Geometry) geom.ReadWriteCoords {
	coords := NewCoords64()
	geomCoords := geom.Coords()
	for i := uint32(0); i < geomCoords.NumCoords(); i++ {
		coords.InsertRaw(i, geomCoords.Get(i).ToArray()[:this.dim])
	}
	return coords
}
Ejemplo n.º 2
0
func locate(p geom.Point, geom geom.Geometry) uint8 {
	if len(geom.Coords()) == 0 {
		return location_EXTERIOR
	}

	switch typedGeom := geom.(type) {
	case geom.Line:
		return locateOnLine(p, typedGeom)
	case geom.Polygon:
		return locateOnPolygon(p, typedGeom)
	}

	result := locationResult{}
	computeLocation(result, p, geom)
	if boundaryRule.isInBoundary(result.numBoundaries) {
		return location_BOUNDARY
	}
	if result.numBoundaries > 0 || result.isIn {
		return location_INTERIOR
	}

	return location_EXTERIOR
}