id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
29,600 | twpayne/go-geom | encoding/igc/decode.go | parseH | func (p *parser) parseH(line string) error {
m := hRegexp.FindStringSubmatch(line)
if m == nil {
return fmt.Errorf("invalid H record")
}
header := Header{
Source: m[1],
Key: m[2],
KeyExtra: strings.TrimSuffix(m[3], ":"),
Value: m[4],
}
p.headers = append(p.headers, header)
if header.Key == "D... | go | func (p *parser) parseH(line string) error {
m := hRegexp.FindStringSubmatch(line)
if m == nil {
return fmt.Errorf("invalid H record")
}
header := Header{
Source: m[1],
Key: m[2],
KeyExtra: strings.TrimSuffix(m[3], ":"),
Value: m[4],
}
p.headers = append(p.headers, header)
if header.Key == "D... | [
"func",
"(",
"p",
"*",
"parser",
")",
"parseH",
"(",
"line",
"string",
")",
"error",
"{",
"m",
":=",
"hRegexp",
".",
"FindStringSubmatch",
"(",
"line",
")",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
... | // parseB parses an H record from line and updates the state of p. | [
"parseB",
"parses",
"an",
"H",
"record",
"from",
"line",
"and",
"updates",
"the",
"state",
"of",
"p",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/igc/decode.go#L203-L240 |
29,601 | twpayne/go-geom | encoding/igc/decode.go | parseI | func (p *parser) parseI(line string) error {
var err error
var n int
if len(line) < 3 {
return fmt.Errorf("I record too short: %d, want >=3", len(line))
}
if n, err = parseDec(line, 1, 3); err != nil {
return err
}
if len(line) < 7*n+3 {
return fmt.Errorf("invalid I record length: %d, want %d", len(line), ... | go | func (p *parser) parseI(line string) error {
var err error
var n int
if len(line) < 3 {
return fmt.Errorf("I record too short: %d, want >=3", len(line))
}
if n, err = parseDec(line, 1, 3); err != nil {
return err
}
if len(line) < 7*n+3 {
return fmt.Errorf("invalid I record length: %d, want %d", len(line), ... | [
"func",
"(",
"p",
"*",
"parser",
")",
"parseI",
"(",
"line",
"string",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"var",
"n",
"int",
"\n",
"if",
"len",
"(",
"line",
")",
"<",
"3",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
... | // parseB parses an I record from line and updates the state of p. | [
"parseB",
"parses",
"an",
"I",
"record",
"from",
"line",
"and",
"updates",
"the",
"state",
"of",
"p",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/igc/decode.go#L243-L277 |
29,602 | twpayne/go-geom | encoding/igc/decode.go | parseLine | func (p *parser) parseLine(line string) error {
switch line[0] {
case 'B':
return p.parseB(line)
case 'H':
return p.parseH(line)
case 'I':
return p.parseI(line)
default:
return nil
}
} | go | func (p *parser) parseLine(line string) error {
switch line[0] {
case 'B':
return p.parseB(line)
case 'H':
return p.parseH(line)
case 'I':
return p.parseI(line)
default:
return nil
}
} | [
"func",
"(",
"p",
"*",
"parser",
")",
"parseLine",
"(",
"line",
"string",
")",
"error",
"{",
"switch",
"line",
"[",
"0",
"]",
"{",
"case",
"'B'",
":",
"return",
"p",
".",
"parseB",
"(",
"line",
")",
"\n",
"case",
"'H'",
":",
"return",
"p",
".",
... | // parseLine parses a single record from line and updates the state of p. | [
"parseLine",
"parses",
"a",
"single",
"record",
"from",
"line",
"and",
"updates",
"the",
"state",
"of",
"p",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/igc/decode.go#L280-L291 |
29,603 | twpayne/go-geom | encoding/igc/decode.go | doParse | func doParse(r io.Reader) (*parser, Errors) {
var errors Errors
p := newParser()
s := bufio.NewScanner(r)
foundA := false
leadingNoise := false
for lineno := 1; s.Scan(); lineno++ {
line := strings.TrimSuffix(s.Text(), "\r")
switch {
case len(line) == 0:
case foundA:
if err := p.parseLine(line); err !=... | go | func doParse(r io.Reader) (*parser, Errors) {
var errors Errors
p := newParser()
s := bufio.NewScanner(r)
foundA := false
leadingNoise := false
for lineno := 1; s.Scan(); lineno++ {
line := strings.TrimSuffix(s.Text(), "\r")
switch {
case len(line) == 0:
case foundA:
if err := p.parseLine(line); err !=... | [
"func",
"doParse",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"*",
"parser",
",",
"Errors",
")",
"{",
"var",
"errors",
"Errors",
"\n",
"p",
":=",
"newParser",
"(",
")",
"\n",
"s",
":=",
"bufio",
".",
"NewScanner",
"(",
"r",
")",
"\n",
"foundA",
":=... | // doParse reads r, parsers all the records it finds, updating the state of p. | [
"doParse",
"reads",
"r",
"parsers",
"all",
"the",
"records",
"it",
"finds",
"updating",
"the",
"state",
"of",
"p",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/igc/decode.go#L294-L335 |
29,604 | twpayne/go-geom | encoding/igc/decode.go | Read | func Read(r io.Reader) (*T, error) {
p, errors := doParse(r)
var err error = errors
if len(errors) == 0 {
err = nil
}
return &T{
Headers: p.headers,
LineString: geom.NewLineStringFlat(geom.Layout(5), p.coords),
}, err
} | go | func Read(r io.Reader) (*T, error) {
p, errors := doParse(r)
var err error = errors
if len(errors) == 0 {
err = nil
}
return &T{
Headers: p.headers,
LineString: geom.NewLineStringFlat(geom.Layout(5), p.coords),
}, err
} | [
"func",
"Read",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"*",
"T",
",",
"error",
")",
"{",
"p",
",",
"errors",
":=",
"doParse",
"(",
"r",
")",
"\n",
"var",
"err",
"error",
"=",
"errors",
"\n",
"if",
"len",
"(",
"errors",
")",
"==",
"0",
"{",
... | // Read reads a igc.T from r, which should contain IGC records.
//
// IGC files in the wild are often corrupt, the IGC specification has been
// incomplete, and has evolved over time. The parser is consequently very
// tolerant of what it accepts and ignores several common errors. Consequently,
// the returned T might ... | [
"Read",
"reads",
"a",
"igc",
".",
"T",
"from",
"r",
"which",
"should",
"contain",
"IGC",
"records",
".",
"IGC",
"files",
"in",
"the",
"wild",
"are",
"often",
"corrupt",
"the",
"IGC",
"specification",
"has",
"been",
"incomplete",
"and",
"has",
"evolved",
... | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/igc/decode.go#L344-L354 |
29,605 | twpayne/go-geom | examples/postgis/main.go | readGeoJSON | func readGeoJSON(db *sql.DB, r io.Reader) error {
var waypoint Waypoint
if err := json.NewDecoder(r).Decode(&waypoint); err != nil {
return err
}
var geometry geom.T
if err := geojson.Unmarshal(waypoint.Geometry, &geometry); err != nil {
return err
}
point, ok := geometry.(*geom.Point)
if !ok {
return err... | go | func readGeoJSON(db *sql.DB, r io.Reader) error {
var waypoint Waypoint
if err := json.NewDecoder(r).Decode(&waypoint); err != nil {
return err
}
var geometry geom.T
if err := geojson.Unmarshal(waypoint.Geometry, &geometry); err != nil {
return err
}
point, ok := geometry.(*geom.Point)
if !ok {
return err... | [
"func",
"readGeoJSON",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"r",
"io",
".",
"Reader",
")",
"error",
"{",
"var",
"waypoint",
"Waypoint",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
")",
".",
"Decode",
"(",
"&",
"waypoint",
")",
... | // readGeoJSON demonstrates reading data in GeoJSON format and inserting it
// into a database in EWKB format. | [
"readGeoJSON",
"demonstrates",
"reading",
"data",
"in",
"GeoJSON",
"format",
"and",
"inserting",
"it",
"into",
"a",
"database",
"in",
"EWKB",
"format",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/examples/postgis/main.go#L83-L100 |
29,606 | twpayne/go-geom | examples/postgis/main.go | writeGeoJSON | func writeGeoJSON(db *sql.DB, w io.Writer) error {
rows, err := db.Query(`
SELECT id, name, ST_AsEWKB(geom) FROM waypoints ORDER BY id ASC;
`)
if err != nil {
return err
}
defer rows.Close()
for rows.Next() {
var id int
var name string
var ewkbPoint ewkb.Point
if err := rows.Scan(&id, &name, &ewkbPoin... | go | func writeGeoJSON(db *sql.DB, w io.Writer) error {
rows, err := db.Query(`
SELECT id, name, ST_AsEWKB(geom) FROM waypoints ORDER BY id ASC;
`)
if err != nil {
return err
}
defer rows.Close()
for rows.Next() {
var id int
var name string
var ewkbPoint ewkb.Point
if err := rows.Scan(&id, &name, &ewkbPoin... | [
"func",
"writeGeoJSON",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"rows",
",",
"err",
":=",
"db",
".",
"Query",
"(",
"`\n\t\tSELECT id, name, ST_AsEWKB(geom) FROM waypoints ORDER BY id ASC;\n\t`",
")",
"\n",
"if",
"err... | // writeGeoJSON demonstrates reading data from a database in EWKB format and
// writing it as GeoJSON. | [
"writeGeoJSON",
"demonstrates",
"reading",
"data",
"from",
"a",
"database",
"in",
"EWKB",
"format",
"and",
"writing",
"it",
"as",
"GeoJSON",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/examples/postgis/main.go#L104-L132 |
29,607 | twpayne/go-geom | xy/centroid.go | Centroid | func Centroid(geometry geom.T) (centroid geom.Coord, err error) {
switch t := geometry.(type) {
case *geom.Point:
centroid = PointsCentroid(t)
case *geom.MultiPoint:
centroid = MultiPointCentroid(t)
case *geom.LineString:
centroid = LinesCentroid(t)
case *geom.LinearRing:
centroid = LinearRingsCentroid(t)
... | go | func Centroid(geometry geom.T) (centroid geom.Coord, err error) {
switch t := geometry.(type) {
case *geom.Point:
centroid = PointsCentroid(t)
case *geom.MultiPoint:
centroid = MultiPointCentroid(t)
case *geom.LineString:
centroid = LinesCentroid(t)
case *geom.LinearRing:
centroid = LinearRingsCentroid(t)
... | [
"func",
"Centroid",
"(",
"geometry",
"geom",
".",
"T",
")",
"(",
"centroid",
"geom",
".",
"Coord",
",",
"err",
"error",
")",
"{",
"switch",
"t",
":=",
"geometry",
".",
"(",
"type",
")",
"{",
"case",
"*",
"geom",
".",
"Point",
":",
"centroid",
"=",
... | // Centroid calculates the centroid of the geometry. The centroid may be outside of the geometry depending
// on the topology of the geometry | [
"Centroid",
"calculates",
"the",
"centroid",
"of",
"the",
"geometry",
".",
"The",
"centroid",
"may",
"be",
"outside",
"of",
"the",
"geometry",
"depending",
"on",
"the",
"topology",
"of",
"the",
"geometry"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/centroid.go#L11-L32 |
29,608 | twpayne/go-geom | bounds.go | NewBounds | func NewBounds(layout Layout) *Bounds {
stride := layout.Stride()
min, max := make(Coord, stride), make(Coord, stride)
for i := 0; i < stride; i++ {
min[i], max[i] = math.Inf(1), math.Inf(-1)
}
return &Bounds{
layout: layout,
min: min,
max: max,
}
} | go | func NewBounds(layout Layout) *Bounds {
stride := layout.Stride()
min, max := make(Coord, stride), make(Coord, stride)
for i := 0; i < stride; i++ {
min[i], max[i] = math.Inf(1), math.Inf(-1)
}
return &Bounds{
layout: layout,
min: min,
max: max,
}
} | [
"func",
"NewBounds",
"(",
"layout",
"Layout",
")",
"*",
"Bounds",
"{",
"stride",
":=",
"layout",
".",
"Stride",
"(",
")",
"\n",
"min",
",",
"max",
":=",
"make",
"(",
"Coord",
",",
"stride",
")",
",",
"make",
"(",
"Coord",
",",
"stride",
")",
"\n",
... | // NewBounds creates a new Bounds. | [
"NewBounds",
"creates",
"a",
"new",
"Bounds",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/bounds.go#L13-L24 |
29,609 | twpayne/go-geom | bounds.go | Extend | func (b *Bounds) Extend(g T) *Bounds {
b.extendLayout(g.Layout())
if b.layout == XYZM && g.Layout() == XYM {
return b.extendXYZMFlatCoordsWithXYM(g.FlatCoords(), 0, len(g.FlatCoords()))
}
return b.extendFlatCoords(g.FlatCoords(), 0, len(g.FlatCoords()), g.Stride())
} | go | func (b *Bounds) Extend(g T) *Bounds {
b.extendLayout(g.Layout())
if b.layout == XYZM && g.Layout() == XYM {
return b.extendXYZMFlatCoordsWithXYM(g.FlatCoords(), 0, len(g.FlatCoords()))
}
return b.extendFlatCoords(g.FlatCoords(), 0, len(g.FlatCoords()), g.Stride())
} | [
"func",
"(",
"b",
"*",
"Bounds",
")",
"Extend",
"(",
"g",
"T",
")",
"*",
"Bounds",
"{",
"b",
".",
"extendLayout",
"(",
"g",
".",
"Layout",
"(",
")",
")",
"\n",
"if",
"b",
".",
"layout",
"==",
"XYZM",
"&&",
"g",
".",
"Layout",
"(",
")",
"==",
... | // Extend extends b to include geometry g. | [
"Extend",
"extends",
"b",
"to",
"include",
"geometry",
"g",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/bounds.go#L32-L38 |
29,610 | twpayne/go-geom | bounds.go | IsEmpty | func (b *Bounds) IsEmpty() bool {
if b.layout == NoLayout {
return true
}
for i, stride := 0, b.layout.Stride(); i < stride; i++ {
if b.max[i] < b.min[i] {
return true
}
}
return false
} | go | func (b *Bounds) IsEmpty() bool {
if b.layout == NoLayout {
return true
}
for i, stride := 0, b.layout.Stride(); i < stride; i++ {
if b.max[i] < b.min[i] {
return true
}
}
return false
} | [
"func",
"(",
"b",
"*",
"Bounds",
")",
"IsEmpty",
"(",
")",
"bool",
"{",
"if",
"b",
".",
"layout",
"==",
"NoLayout",
"{",
"return",
"true",
"\n",
"}",
"\n",
"for",
"i",
",",
"stride",
":=",
"0",
",",
"b",
".",
"layout",
".",
"Stride",
"(",
")",
... | // IsEmpty returns true if b is empty. | [
"IsEmpty",
"returns",
"true",
"if",
"b",
"is",
"empty",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/bounds.go#L41-L51 |
29,611 | twpayne/go-geom | bounds.go | Overlaps | func (b *Bounds) Overlaps(layout Layout, b2 *Bounds) bool {
for i, stride := 0, layout.Stride(); i < stride; i++ {
if b.min[i] > b2.max[i] || b.max[i] < b2.min[i] {
return false
}
}
return true
} | go | func (b *Bounds) Overlaps(layout Layout, b2 *Bounds) bool {
for i, stride := 0, layout.Stride(); i < stride; i++ {
if b.min[i] > b2.max[i] || b.max[i] < b2.min[i] {
return false
}
}
return true
} | [
"func",
"(",
"b",
"*",
"Bounds",
")",
"Overlaps",
"(",
"layout",
"Layout",
",",
"b2",
"*",
"Bounds",
")",
"bool",
"{",
"for",
"i",
",",
"stride",
":=",
"0",
",",
"layout",
".",
"Stride",
"(",
")",
";",
"i",
"<",
"stride",
";",
"i",
"++",
"{",
... | // Overlaps returns true if b overlaps b2 in layout. | [
"Overlaps",
"returns",
"true",
"if",
"b",
"overlaps",
"b2",
"in",
"layout",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/bounds.go#L69-L76 |
29,612 | twpayne/go-geom | bounds.go | Polygon | func (b *Bounds) Polygon() *Polygon {
if b.IsEmpty() {
return NewPolygonFlat(XY, nil, nil)
}
x1, y1 := b.min[0], b.min[1]
x2, y2 := b.max[0], b.max[1]
flatCoords := []float64{
x1, y1,
x1, y2,
x2, y2,
x2, y1,
x1, y1,
}
return NewPolygonFlat(XY, flatCoords, []int{len(flatCoords)})
} | go | func (b *Bounds) Polygon() *Polygon {
if b.IsEmpty() {
return NewPolygonFlat(XY, nil, nil)
}
x1, y1 := b.min[0], b.min[1]
x2, y2 := b.max[0], b.max[1]
flatCoords := []float64{
x1, y1,
x1, y2,
x2, y2,
x2, y1,
x1, y1,
}
return NewPolygonFlat(XY, flatCoords, []int{len(flatCoords)})
} | [
"func",
"(",
"b",
"*",
"Bounds",
")",
"Polygon",
"(",
")",
"*",
"Polygon",
"{",
"if",
"b",
".",
"IsEmpty",
"(",
")",
"{",
"return",
"NewPolygonFlat",
"(",
"XY",
",",
"nil",
",",
"nil",
")",
"\n",
"}",
"\n",
"x1",
",",
"y1",
":=",
"b",
".",
"m... | // Polygon returns b as a two-dimensional Polygon. | [
"Polygon",
"returns",
"b",
"as",
"a",
"two",
"-",
"dimensional",
"Polygon",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/bounds.go#L79-L93 |
29,613 | twpayne/go-geom | bounds.go | SetCoords | func (b *Bounds) SetCoords(min, max Coord) *Bounds {
b.min = Coord(make([]float64, b.layout.Stride()))
b.max = Coord(make([]float64, b.layout.Stride()))
for i := 0; i < b.layout.Stride(); i++ {
b.min[i] = math.Min(min[i], max[i])
b.max[i] = math.Max(min[i], max[i])
}
return b
} | go | func (b *Bounds) SetCoords(min, max Coord) *Bounds {
b.min = Coord(make([]float64, b.layout.Stride()))
b.max = Coord(make([]float64, b.layout.Stride()))
for i := 0; i < b.layout.Stride(); i++ {
b.min[i] = math.Min(min[i], max[i])
b.max[i] = math.Max(min[i], max[i])
}
return b
} | [
"func",
"(",
"b",
"*",
"Bounds",
")",
"SetCoords",
"(",
"min",
",",
"max",
"Coord",
")",
"*",
"Bounds",
"{",
"b",
".",
"min",
"=",
"Coord",
"(",
"make",
"(",
"[",
"]",
"float64",
",",
"b",
".",
"layout",
".",
"Stride",
"(",
")",
")",
")",
"\n... | // SetCoords sets the minimum and maximum values of the Bounds. | [
"SetCoords",
"sets",
"the",
"minimum",
"and",
"maximum",
"values",
"of",
"the",
"Bounds",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/bounds.go#L113-L121 |
29,614 | twpayne/go-geom | derived.gen.go | deriveCloneBounds | func deriveCloneBounds(src *Bounds) *Bounds {
if src == nil {
return nil
}
dst := new(Bounds)
deriveDeepCopy(dst, src)
return dst
} | go | func deriveCloneBounds(src *Bounds) *Bounds {
if src == nil {
return nil
}
dst := new(Bounds)
deriveDeepCopy(dst, src)
return dst
} | [
"func",
"deriveCloneBounds",
"(",
"src",
"*",
"Bounds",
")",
"*",
"Bounds",
"{",
"if",
"src",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"dst",
":=",
"new",
"(",
"Bounds",
")",
"\n",
"deriveDeepCopy",
"(",
"dst",
",",
"src",
")",
"\n",
"re... | // deriveCloneBounds returns a clone of the src parameter. | [
"deriveCloneBounds",
"returns",
"a",
"clone",
"of",
"the",
"src",
"parameter",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L6-L13 |
29,615 | twpayne/go-geom | derived.gen.go | deriveCloneCoord | func deriveCloneCoord(src Coord) Coord {
if src == nil {
return nil
}
dst := make(Coord, len(src))
deriveDeepCopy_(dst, src)
return dst
} | go | func deriveCloneCoord(src Coord) Coord {
if src == nil {
return nil
}
dst := make(Coord, len(src))
deriveDeepCopy_(dst, src)
return dst
} | [
"func",
"deriveCloneCoord",
"(",
"src",
"Coord",
")",
"Coord",
"{",
"if",
"src",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"dst",
":=",
"make",
"(",
"Coord",
",",
"len",
"(",
"src",
")",
")",
"\n",
"deriveDeepCopy_",
"(",
"dst",
",",
"src... | // deriveCloneCoord returns a clone of the src parameter. | [
"deriveCloneCoord",
"returns",
"a",
"clone",
"of",
"the",
"src",
"parameter",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L16-L23 |
29,616 | twpayne/go-geom | derived.gen.go | deriveCloneLinearRing | func deriveCloneLinearRing(src *LinearRing) *LinearRing {
if src == nil {
return nil
}
dst := new(LinearRing)
deriveDeepCopy_1(dst, src)
return dst
} | go | func deriveCloneLinearRing(src *LinearRing) *LinearRing {
if src == nil {
return nil
}
dst := new(LinearRing)
deriveDeepCopy_1(dst, src)
return dst
} | [
"func",
"deriveCloneLinearRing",
"(",
"src",
"*",
"LinearRing",
")",
"*",
"LinearRing",
"{",
"if",
"src",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"dst",
":=",
"new",
"(",
"LinearRing",
")",
"\n",
"deriveDeepCopy_1",
"(",
"dst",
",",
"src",
... | // deriveCloneLinearRing returns a clone of the src parameter. | [
"deriveCloneLinearRing",
"returns",
"a",
"clone",
"of",
"the",
"src",
"parameter",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L26-L33 |
29,617 | twpayne/go-geom | derived.gen.go | deriveCloneLineString | func deriveCloneLineString(src *LineString) *LineString {
if src == nil {
return nil
}
dst := new(LineString)
deriveDeepCopy_2(dst, src)
return dst
} | go | func deriveCloneLineString(src *LineString) *LineString {
if src == nil {
return nil
}
dst := new(LineString)
deriveDeepCopy_2(dst, src)
return dst
} | [
"func",
"deriveCloneLineString",
"(",
"src",
"*",
"LineString",
")",
"*",
"LineString",
"{",
"if",
"src",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"dst",
":=",
"new",
"(",
"LineString",
")",
"\n",
"deriveDeepCopy_2",
"(",
"dst",
",",
"src",
... | // deriveCloneLineString returns a clone of the src parameter. | [
"deriveCloneLineString",
"returns",
"a",
"clone",
"of",
"the",
"src",
"parameter",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L36-L43 |
29,618 | twpayne/go-geom | derived.gen.go | deriveCloneMultiLineString | func deriveCloneMultiLineString(src *MultiLineString) *MultiLineString {
if src == nil {
return nil
}
dst := new(MultiLineString)
deriveDeepCopy_3(dst, src)
return dst
} | go | func deriveCloneMultiLineString(src *MultiLineString) *MultiLineString {
if src == nil {
return nil
}
dst := new(MultiLineString)
deriveDeepCopy_3(dst, src)
return dst
} | [
"func",
"deriveCloneMultiLineString",
"(",
"src",
"*",
"MultiLineString",
")",
"*",
"MultiLineString",
"{",
"if",
"src",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"dst",
":=",
"new",
"(",
"MultiLineString",
")",
"\n",
"deriveDeepCopy_3",
"(",
"dst"... | // deriveCloneMultiLineString returns a clone of the src parameter. | [
"deriveCloneMultiLineString",
"returns",
"a",
"clone",
"of",
"the",
"src",
"parameter",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L46-L53 |
29,619 | twpayne/go-geom | derived.gen.go | deriveCloneMultiPoint | func deriveCloneMultiPoint(src *MultiPoint) *MultiPoint {
if src == nil {
return nil
}
dst := new(MultiPoint)
deriveDeepCopy_4(dst, src)
return dst
} | go | func deriveCloneMultiPoint(src *MultiPoint) *MultiPoint {
if src == nil {
return nil
}
dst := new(MultiPoint)
deriveDeepCopy_4(dst, src)
return dst
} | [
"func",
"deriveCloneMultiPoint",
"(",
"src",
"*",
"MultiPoint",
")",
"*",
"MultiPoint",
"{",
"if",
"src",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"dst",
":=",
"new",
"(",
"MultiPoint",
")",
"\n",
"deriveDeepCopy_4",
"(",
"dst",
",",
"src",
... | // deriveCloneMultiPoint returns a clone of the src parameter. | [
"deriveCloneMultiPoint",
"returns",
"a",
"clone",
"of",
"the",
"src",
"parameter",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L56-L63 |
29,620 | twpayne/go-geom | derived.gen.go | deriveCloneMultiPolygon | func deriveCloneMultiPolygon(src *MultiPolygon) *MultiPolygon {
if src == nil {
return nil
}
dst := new(MultiPolygon)
deriveDeepCopy_5(dst, src)
return dst
} | go | func deriveCloneMultiPolygon(src *MultiPolygon) *MultiPolygon {
if src == nil {
return nil
}
dst := new(MultiPolygon)
deriveDeepCopy_5(dst, src)
return dst
} | [
"func",
"deriveCloneMultiPolygon",
"(",
"src",
"*",
"MultiPolygon",
")",
"*",
"MultiPolygon",
"{",
"if",
"src",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"dst",
":=",
"new",
"(",
"MultiPolygon",
")",
"\n",
"deriveDeepCopy_5",
"(",
"dst",
",",
"... | // deriveCloneMultiPolygon returns a clone of the src parameter. | [
"deriveCloneMultiPolygon",
"returns",
"a",
"clone",
"of",
"the",
"src",
"parameter",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L66-L73 |
29,621 | twpayne/go-geom | derived.gen.go | deriveClonePoint | func deriveClonePoint(src *Point) *Point {
if src == nil {
return nil
}
dst := new(Point)
deriveDeepCopy_6(dst, src)
return dst
} | go | func deriveClonePoint(src *Point) *Point {
if src == nil {
return nil
}
dst := new(Point)
deriveDeepCopy_6(dst, src)
return dst
} | [
"func",
"deriveClonePoint",
"(",
"src",
"*",
"Point",
")",
"*",
"Point",
"{",
"if",
"src",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"dst",
":=",
"new",
"(",
"Point",
")",
"\n",
"deriveDeepCopy_6",
"(",
"dst",
",",
"src",
")",
"\n",
"retu... | // deriveClonePoint returns a clone of the src parameter. | [
"deriveClonePoint",
"returns",
"a",
"clone",
"of",
"the",
"src",
"parameter",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L76-L83 |
29,622 | twpayne/go-geom | derived.gen.go | deriveClonePolygon | func deriveClonePolygon(src *Polygon) *Polygon {
if src == nil {
return nil
}
dst := new(Polygon)
deriveDeepCopy_7(dst, src)
return dst
} | go | func deriveClonePolygon(src *Polygon) *Polygon {
if src == nil {
return nil
}
dst := new(Polygon)
deriveDeepCopy_7(dst, src)
return dst
} | [
"func",
"deriveClonePolygon",
"(",
"src",
"*",
"Polygon",
")",
"*",
"Polygon",
"{",
"if",
"src",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"dst",
":=",
"new",
"(",
"Polygon",
")",
"\n",
"deriveDeepCopy_7",
"(",
"dst",
",",
"src",
")",
"\n",... | // deriveClonePolygon returns a clone of the src parameter. | [
"deriveClonePolygon",
"returns",
"a",
"clone",
"of",
"the",
"src",
"parameter",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L86-L93 |
29,623 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_1 | func deriveDeepCopy_1(dst, src *LinearRing) {
func() {
field := new(geom1)
deriveDeepCopy_8(field, &src.geom1)
dst.geom1 = *field
}()
} | go | func deriveDeepCopy_1(dst, src *LinearRing) {
func() {
field := new(geom1)
deriveDeepCopy_8(field, &src.geom1)
dst.geom1 = *field
}()
} | [
"func",
"deriveDeepCopy_1",
"(",
"dst",
",",
"src",
"*",
"LinearRing",
")",
"{",
"func",
"(",
")",
"{",
"field",
":=",
"new",
"(",
"geom1",
")",
"\n",
"deriveDeepCopy_8",
"(",
"field",
",",
"&",
"src",
".",
"geom1",
")",
"\n",
"dst",
".",
"geom1",
... | // deriveDeepCopy_1 recursively copies the contents of src into dst. | [
"deriveDeepCopy_1",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L142-L148 |
29,624 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_2 | func deriveDeepCopy_2(dst, src *LineString) {
func() {
field := new(geom1)
deriveDeepCopy_8(field, &src.geom1)
dst.geom1 = *field
}()
} | go | func deriveDeepCopy_2(dst, src *LineString) {
func() {
field := new(geom1)
deriveDeepCopy_8(field, &src.geom1)
dst.geom1 = *field
}()
} | [
"func",
"deriveDeepCopy_2",
"(",
"dst",
",",
"src",
"*",
"LineString",
")",
"{",
"func",
"(",
")",
"{",
"field",
":=",
"new",
"(",
"geom1",
")",
"\n",
"deriveDeepCopy_8",
"(",
"field",
",",
"&",
"src",
".",
"geom1",
")",
"\n",
"dst",
".",
"geom1",
... | // deriveDeepCopy_2 recursively copies the contents of src into dst. | [
"deriveDeepCopy_2",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L151-L157 |
29,625 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_3 | func deriveDeepCopy_3(dst, src *MultiLineString) {
func() {
field := new(geom2)
deriveDeepCopy_9(field, &src.geom2)
dst.geom2 = *field
}()
} | go | func deriveDeepCopy_3(dst, src *MultiLineString) {
func() {
field := new(geom2)
deriveDeepCopy_9(field, &src.geom2)
dst.geom2 = *field
}()
} | [
"func",
"deriveDeepCopy_3",
"(",
"dst",
",",
"src",
"*",
"MultiLineString",
")",
"{",
"func",
"(",
")",
"{",
"field",
":=",
"new",
"(",
"geom2",
")",
"\n",
"deriveDeepCopy_9",
"(",
"field",
",",
"&",
"src",
".",
"geom2",
")",
"\n",
"dst",
".",
"geom2... | // deriveDeepCopy_3 recursively copies the contents of src into dst. | [
"deriveDeepCopy_3",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L160-L166 |
29,626 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_4 | func deriveDeepCopy_4(dst, src *MultiPoint) {
func() {
field := new(geom1)
deriveDeepCopy_8(field, &src.geom1)
dst.geom1 = *field
}()
} | go | func deriveDeepCopy_4(dst, src *MultiPoint) {
func() {
field := new(geom1)
deriveDeepCopy_8(field, &src.geom1)
dst.geom1 = *field
}()
} | [
"func",
"deriveDeepCopy_4",
"(",
"dst",
",",
"src",
"*",
"MultiPoint",
")",
"{",
"func",
"(",
")",
"{",
"field",
":=",
"new",
"(",
"geom1",
")",
"\n",
"deriveDeepCopy_8",
"(",
"field",
",",
"&",
"src",
".",
"geom1",
")",
"\n",
"dst",
".",
"geom1",
... | // deriveDeepCopy_4 recursively copies the contents of src into dst. | [
"deriveDeepCopy_4",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L169-L175 |
29,627 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_5 | func deriveDeepCopy_5(dst, src *MultiPolygon) {
func() {
field := new(geom3)
deriveDeepCopy_10(field, &src.geom3)
dst.geom3 = *field
}()
} | go | func deriveDeepCopy_5(dst, src *MultiPolygon) {
func() {
field := new(geom3)
deriveDeepCopy_10(field, &src.geom3)
dst.geom3 = *field
}()
} | [
"func",
"deriveDeepCopy_5",
"(",
"dst",
",",
"src",
"*",
"MultiPolygon",
")",
"{",
"func",
"(",
")",
"{",
"field",
":=",
"new",
"(",
"geom3",
")",
"\n",
"deriveDeepCopy_10",
"(",
"field",
",",
"&",
"src",
".",
"geom3",
")",
"\n",
"dst",
".",
"geom3",... | // deriveDeepCopy_5 recursively copies the contents of src into dst. | [
"deriveDeepCopy_5",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L178-L184 |
29,628 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_6 | func deriveDeepCopy_6(dst, src *Point) {
func() {
field := new(geom0)
deriveDeepCopy_11(field, &src.geom0)
dst.geom0 = *field
}()
} | go | func deriveDeepCopy_6(dst, src *Point) {
func() {
field := new(geom0)
deriveDeepCopy_11(field, &src.geom0)
dst.geom0 = *field
}()
} | [
"func",
"deriveDeepCopy_6",
"(",
"dst",
",",
"src",
"*",
"Point",
")",
"{",
"func",
"(",
")",
"{",
"field",
":=",
"new",
"(",
"geom0",
")",
"\n",
"deriveDeepCopy_11",
"(",
"field",
",",
"&",
"src",
".",
"geom0",
")",
"\n",
"dst",
".",
"geom0",
"=",... | // deriveDeepCopy_6 recursively copies the contents of src into dst. | [
"deriveDeepCopy_6",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L187-L193 |
29,629 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_7 | func deriveDeepCopy_7(dst, src *Polygon) {
func() {
field := new(geom2)
deriveDeepCopy_9(field, &src.geom2)
dst.geom2 = *field
}()
} | go | func deriveDeepCopy_7(dst, src *Polygon) {
func() {
field := new(geom2)
deriveDeepCopy_9(field, &src.geom2)
dst.geom2 = *field
}()
} | [
"func",
"deriveDeepCopy_7",
"(",
"dst",
",",
"src",
"*",
"Polygon",
")",
"{",
"func",
"(",
")",
"{",
"field",
":=",
"new",
"(",
"geom2",
")",
"\n",
"deriveDeepCopy_9",
"(",
"field",
",",
"&",
"src",
".",
"geom2",
")",
"\n",
"dst",
".",
"geom2",
"="... | // deriveDeepCopy_7 recursively copies the contents of src into dst. | [
"deriveDeepCopy_7",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L196-L202 |
29,630 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_8 | func deriveDeepCopy_8(dst, src *geom1) {
func() {
field := new(geom0)
deriveDeepCopy_11(field, &src.geom0)
dst.geom0 = *field
}()
} | go | func deriveDeepCopy_8(dst, src *geom1) {
func() {
field := new(geom0)
deriveDeepCopy_11(field, &src.geom0)
dst.geom0 = *field
}()
} | [
"func",
"deriveDeepCopy_8",
"(",
"dst",
",",
"src",
"*",
"geom1",
")",
"{",
"func",
"(",
")",
"{",
"field",
":=",
"new",
"(",
"geom0",
")",
"\n",
"deriveDeepCopy_11",
"(",
"field",
",",
"&",
"src",
".",
"geom0",
")",
"\n",
"dst",
".",
"geom0",
"=",... | // deriveDeepCopy_8 recursively copies the contents of src into dst. | [
"deriveDeepCopy_8",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L205-L211 |
29,631 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_9 | func deriveDeepCopy_9(dst, src *geom2) {
func() {
field := new(geom1)
deriveDeepCopy_8(field, &src.geom1)
dst.geom1 = *field
}()
if src.ends == nil {
dst.ends = nil
} else {
if dst.ends != nil {
if len(src.ends) > len(dst.ends) {
if cap(dst.ends) >= len(src.ends) {
dst.ends = (dst.ends)[:len(s... | go | func deriveDeepCopy_9(dst, src *geom2) {
func() {
field := new(geom1)
deriveDeepCopy_8(field, &src.geom1)
dst.geom1 = *field
}()
if src.ends == nil {
dst.ends = nil
} else {
if dst.ends != nil {
if len(src.ends) > len(dst.ends) {
if cap(dst.ends) >= len(src.ends) {
dst.ends = (dst.ends)[:len(s... | [
"func",
"deriveDeepCopy_9",
"(",
"dst",
",",
"src",
"*",
"geom2",
")",
"{",
"func",
"(",
")",
"{",
"field",
":=",
"new",
"(",
"geom1",
")",
"\n",
"deriveDeepCopy_8",
"(",
"field",
",",
"&",
"src",
".",
"geom1",
")",
"\n",
"dst",
".",
"geom1",
"=",
... | // deriveDeepCopy_9 recursively copies the contents of src into dst. | [
"deriveDeepCopy_9",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L214-L238 |
29,632 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_10 | func deriveDeepCopy_10(dst, src *geom3) {
func() {
field := new(geom1)
deriveDeepCopy_8(field, &src.geom1)
dst.geom1 = *field
}()
if src.endss == nil {
dst.endss = nil
} else {
if dst.endss != nil {
if len(src.endss) > len(dst.endss) {
if cap(dst.endss) >= len(src.endss) {
dst.endss = (dst.end... | go | func deriveDeepCopy_10(dst, src *geom3) {
func() {
field := new(geom1)
deriveDeepCopy_8(field, &src.geom1)
dst.geom1 = *field
}()
if src.endss == nil {
dst.endss = nil
} else {
if dst.endss != nil {
if len(src.endss) > len(dst.endss) {
if cap(dst.endss) >= len(src.endss) {
dst.endss = (dst.end... | [
"func",
"deriveDeepCopy_10",
"(",
"dst",
",",
"src",
"*",
"geom3",
")",
"{",
"func",
"(",
")",
"{",
"field",
":=",
"new",
"(",
"geom1",
")",
"\n",
"deriveDeepCopy_8",
"(",
"field",
",",
"&",
"src",
".",
"geom1",
")",
"\n",
"dst",
".",
"geom1",
"=",... | // deriveDeepCopy_10 recursively copies the contents of src into dst. | [
"deriveDeepCopy_10",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L241-L265 |
29,633 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_11 | func deriveDeepCopy_11(dst, src *geom0) {
dst.layout = src.layout
dst.stride = src.stride
if src.flatCoords == nil {
dst.flatCoords = nil
} else {
if dst.flatCoords != nil {
if len(src.flatCoords) > len(dst.flatCoords) {
if cap(dst.flatCoords) >= len(src.flatCoords) {
dst.flatCoords = (dst.flatCoord... | go | func deriveDeepCopy_11(dst, src *geom0) {
dst.layout = src.layout
dst.stride = src.stride
if src.flatCoords == nil {
dst.flatCoords = nil
} else {
if dst.flatCoords != nil {
if len(src.flatCoords) > len(dst.flatCoords) {
if cap(dst.flatCoords) >= len(src.flatCoords) {
dst.flatCoords = (dst.flatCoord... | [
"func",
"deriveDeepCopy_11",
"(",
"dst",
",",
"src",
"*",
"geom0",
")",
"{",
"dst",
".",
"layout",
"=",
"src",
".",
"layout",
"\n",
"dst",
".",
"stride",
"=",
"src",
".",
"stride",
"\n",
"if",
"src",
".",
"flatCoords",
"==",
"nil",
"{",
"dst",
".",... | // deriveDeepCopy_11 recursively copies the contents of src into dst. | [
"deriveDeepCopy_11",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L268-L290 |
29,634 | twpayne/go-geom | derived.gen.go | deriveDeepCopy_12 | func deriveDeepCopy_12(dst, src [][]int) {
for src_i, src_value := range src {
if src_value == nil {
dst[src_i] = nil
} else {
if dst[src_i] != nil {
if len(src_value) > len(dst[src_i]) {
if cap(dst[src_i]) >= len(src_value) {
dst[src_i] = (dst[src_i])[:len(src_value)]
} else {
dst[... | go | func deriveDeepCopy_12(dst, src [][]int) {
for src_i, src_value := range src {
if src_value == nil {
dst[src_i] = nil
} else {
if dst[src_i] != nil {
if len(src_value) > len(dst[src_i]) {
if cap(dst[src_i]) >= len(src_value) {
dst[src_i] = (dst[src_i])[:len(src_value)]
} else {
dst[... | [
"func",
"deriveDeepCopy_12",
"(",
"dst",
",",
"src",
"[",
"]",
"[",
"]",
"int",
")",
"{",
"for",
"src_i",
",",
"src_value",
":=",
"range",
"src",
"{",
"if",
"src_value",
"==",
"nil",
"{",
"dst",
"[",
"src_i",
"]",
"=",
"nil",
"\n",
"}",
"else",
"... | // deriveDeepCopy_12 recursively copies the contents of src into dst. | [
"deriveDeepCopy_12",
"recursively",
"copies",
"the",
"contents",
"of",
"src",
"into",
"dst",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/derived.gen.go#L293-L314 |
29,635 | twpayne/go-geom | linearring.go | NewLinearRingFlat | func NewLinearRingFlat(layout Layout, flatCoords []float64) *LinearRing {
g := new(LinearRing)
g.layout = layout
g.stride = layout.Stride()
g.flatCoords = flatCoords
return g
} | go | func NewLinearRingFlat(layout Layout, flatCoords []float64) *LinearRing {
g := new(LinearRing)
g.layout = layout
g.stride = layout.Stride()
g.flatCoords = flatCoords
return g
} | [
"func",
"NewLinearRingFlat",
"(",
"layout",
"Layout",
",",
"flatCoords",
"[",
"]",
"float64",
")",
"*",
"LinearRing",
"{",
"g",
":=",
"new",
"(",
"LinearRing",
")",
"\n",
"g",
".",
"layout",
"=",
"layout",
"\n",
"g",
".",
"stride",
"=",
"layout",
".",
... | // NewLinearRingFlat returns a new LinearRing with the given flat coordinates. | [
"NewLinearRingFlat",
"returns",
"a",
"new",
"LinearRing",
"with",
"the",
"given",
"flat",
"coordinates",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/linearring.go#L14-L20 |
29,636 | twpayne/go-geom | linearring.go | Area | func (g *LinearRing) Area() float64 {
return doubleArea1(g.flatCoords, 0, len(g.flatCoords), g.stride) / 2
} | go | func (g *LinearRing) Area() float64 {
return doubleArea1(g.flatCoords, 0, len(g.flatCoords), g.stride) / 2
} | [
"func",
"(",
"g",
"*",
"LinearRing",
")",
"Area",
"(",
")",
"float64",
"{",
"return",
"doubleArea1",
"(",
"g",
".",
"flatCoords",
",",
"0",
",",
"len",
"(",
"g",
".",
"flatCoords",
")",
",",
"g",
".",
"stride",
")",
"/",
"2",
"\n",
"}"
] | // Area returns the the area. | [
"Area",
"returns",
"the",
"the",
"area",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/linearring.go#L23-L25 |
29,637 | twpayne/go-geom | linearring.go | Length | func (g *LinearRing) Length() float64 {
return length1(g.flatCoords, 0, len(g.flatCoords), g.stride)
} | go | func (g *LinearRing) Length() float64 {
return length1(g.flatCoords, 0, len(g.flatCoords), g.stride)
} | [
"func",
"(",
"g",
"*",
"LinearRing",
")",
"Length",
"(",
")",
"float64",
"{",
"return",
"length1",
"(",
"g",
".",
"flatCoords",
",",
"0",
",",
"len",
"(",
"g",
".",
"flatCoords",
")",
",",
"g",
".",
"stride",
")",
"\n",
"}"
] | // Length returns the length of the perimeter. | [
"Length",
"returns",
"the",
"length",
"of",
"the",
"perimeter",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/linearring.go#L38-L40 |
29,638 | twpayne/go-geom | linearring.go | MustSetCoords | func (g *LinearRing) MustSetCoords(coords []Coord) *LinearRing {
Must(g.SetCoords(coords))
return g
} | go | func (g *LinearRing) MustSetCoords(coords []Coord) *LinearRing {
Must(g.SetCoords(coords))
return g
} | [
"func",
"(",
"g",
"*",
"LinearRing",
")",
"MustSetCoords",
"(",
"coords",
"[",
"]",
"Coord",
")",
"*",
"LinearRing",
"{",
"Must",
"(",
"g",
".",
"SetCoords",
"(",
"coords",
")",
")",
"\n",
"return",
"g",
"\n",
"}"
] | // MustSetCoords sets the coordinates and panics if there is any error. | [
"MustSetCoords",
"sets",
"the",
"coordinates",
"and",
"panics",
"if",
"there",
"is",
"any",
"error",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/linearring.go#L43-L46 |
29,639 | twpayne/go-geom | linearring.go | SetCoords | func (g *LinearRing) SetCoords(coords []Coord) (*LinearRing, error) {
if err := g.setCoords(coords); err != nil {
return nil, err
}
return g, nil
} | go | func (g *LinearRing) SetCoords(coords []Coord) (*LinearRing, error) {
if err := g.setCoords(coords); err != nil {
return nil, err
}
return g, nil
} | [
"func",
"(",
"g",
"*",
"LinearRing",
")",
"SetCoords",
"(",
"coords",
"[",
"]",
"Coord",
")",
"(",
"*",
"LinearRing",
",",
"error",
")",
"{",
"if",
"err",
":=",
"g",
".",
"setCoords",
"(",
"coords",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"n... | // SetCoords sets the coordinates. | [
"SetCoords",
"sets",
"the",
"coordinates",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/linearring.go#L49-L54 |
29,640 | twpayne/go-geom | xy/internal/coord_stack.go | Push | func (stack *CoordStack) Push(data []float64, idx int) []float64 {
c := data[idx : idx+stack.stride]
stack.Data = append(stack.Data, c...)
return c
} | go | func (stack *CoordStack) Push(data []float64, idx int) []float64 {
c := data[idx : idx+stack.stride]
stack.Data = append(stack.Data, c...)
return c
} | [
"func",
"(",
"stack",
"*",
"CoordStack",
")",
"Push",
"(",
"data",
"[",
"]",
"float64",
",",
"idx",
"int",
")",
"[",
"]",
"float64",
"{",
"c",
":=",
"data",
"[",
"idx",
":",
"idx",
"+",
"stack",
".",
"stride",
"]",
"\n",
"stack",
".",
"Data",
"... | // Push puts the coordinate at the location idx onto the stack. | [
"Push",
"puts",
"the",
"coordinate",
"at",
"the",
"location",
"idx",
"onto",
"the",
"stack",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/internal/coord_stack.go#L21-L25 |
29,641 | twpayne/go-geom | xy/internal/coord_stack.go | Pop | func (stack *CoordStack) Pop() ([]float64, int) {
numOrds := len(stack.Data)
start := numOrds - stack.stride
coord := stack.Data[start:numOrds]
stack.Data = stack.Data[:start]
return coord, stack.Size()
} | go | func (stack *CoordStack) Pop() ([]float64, int) {
numOrds := len(stack.Data)
start := numOrds - stack.stride
coord := stack.Data[start:numOrds]
stack.Data = stack.Data[:start]
return coord, stack.Size()
} | [
"func",
"(",
"stack",
"*",
"CoordStack",
")",
"Pop",
"(",
")",
"(",
"[",
"]",
"float64",
",",
"int",
")",
"{",
"numOrds",
":=",
"len",
"(",
"stack",
".",
"Data",
")",
"\n",
"start",
":=",
"numOrds",
"-",
"stack",
".",
"stride",
"\n",
"coord",
":=... | // Pop the last pushed coordinate off the stack and return the coordinate | [
"Pop",
"the",
"last",
"pushed",
"coordinate",
"off",
"the",
"stack",
"and",
"return",
"the",
"coordinate"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/internal/coord_stack.go#L28-L34 |
29,642 | twpayne/go-geom | xy/internal/coord_stack.go | Peek | func (stack *CoordStack) Peek() []float64 {
numOrds := len(stack.Data)
start := numOrds - stack.stride
coord := stack.Data[start:numOrds]
return coord
} | go | func (stack *CoordStack) Peek() []float64 {
numOrds := len(stack.Data)
start := numOrds - stack.stride
coord := stack.Data[start:numOrds]
return coord
} | [
"func",
"(",
"stack",
"*",
"CoordStack",
")",
"Peek",
"(",
")",
"[",
"]",
"float64",
"{",
"numOrds",
":=",
"len",
"(",
"stack",
".",
"Data",
")",
"\n",
"start",
":=",
"numOrds",
"-",
"stack",
".",
"stride",
"\n",
"coord",
":=",
"stack",
".",
"Data"... | // Peek returns the most recently pushed coord without modifying the stack | [
"Peek",
"returns",
"the",
"most",
"recently",
"pushed",
"coord",
"without",
"modifying",
"the",
"stack"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/internal/coord_stack.go#L37-L42 |
29,643 | twpayne/go-geom | xy/location/location.go | Symbol | func (t Type) Symbol() rune {
switch t {
case Exterior:
return 'e'
case Boundary:
return 'b'
case Interior:
return 'i'
case None:
return '-'
}
panic(fmt.Sprintf("Unknown location value: %v", int(t)))
} | go | func (t Type) Symbol() rune {
switch t {
case Exterior:
return 'e'
case Boundary:
return 'b'
case Interior:
return 'i'
case None:
return '-'
}
panic(fmt.Sprintf("Unknown location value: %v", int(t)))
} | [
"func",
"(",
"t",
"Type",
")",
"Symbol",
"(",
")",
"rune",
"{",
"switch",
"t",
"{",
"case",
"Exterior",
":",
"return",
"'e'",
"\n",
"case",
"Boundary",
":",
"return",
"'b'",
"\n",
"case",
"Interior",
":",
"return",
"'i'",
"\n",
"case",
"None",
":",
... | // Symbol converts the location value to a location symbol, for example, Exterior => 'e'
// locationValue
// Returns either 'e', 'b', 'i' or '-' | [
"Symbol",
"converts",
"the",
"location",
"value",
"to",
"a",
"location",
"symbol",
"for",
"example",
"Exterior",
"=",
">",
"e",
"locationValue",
"Returns",
"either",
"e",
"b",
"i",
"or",
"-"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/location/location.go#L44-L56 |
29,644 | twpayne/go-geom | point.go | NewPoint | func NewPoint(l Layout) *Point {
return NewPointFlat(l, make([]float64, l.Stride()))
} | go | func NewPoint(l Layout) *Point {
return NewPointFlat(l, make([]float64, l.Stride()))
} | [
"func",
"NewPoint",
"(",
"l",
"Layout",
")",
"*",
"Point",
"{",
"return",
"NewPointFlat",
"(",
"l",
",",
"make",
"(",
"[",
"]",
"float64",
",",
"l",
".",
"Stride",
"(",
")",
")",
")",
"\n",
"}"
] | // NewPoint allocates a new Point with layout l and all values zero. | [
"NewPoint",
"allocates",
"a",
"new",
"Point",
"with",
"layout",
"l",
"and",
"all",
"values",
"zero",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/point.go#L9-L11 |
29,645 | twpayne/go-geom | point.go | NewPointFlat | func NewPointFlat(l Layout, flatCoords []float64) *Point {
g := new(Point)
g.layout = l
g.stride = l.Stride()
g.flatCoords = flatCoords
return g
} | go | func NewPointFlat(l Layout, flatCoords []float64) *Point {
g := new(Point)
g.layout = l
g.stride = l.Stride()
g.flatCoords = flatCoords
return g
} | [
"func",
"NewPointFlat",
"(",
"l",
"Layout",
",",
"flatCoords",
"[",
"]",
"float64",
")",
"*",
"Point",
"{",
"g",
":=",
"new",
"(",
"Point",
")",
"\n",
"g",
".",
"layout",
"=",
"l",
"\n",
"g",
".",
"stride",
"=",
"l",
".",
"Stride",
"(",
")",
"\... | // NewPointFlat allocates a new Point with layout l and flat coordinates flatCoords. | [
"NewPointFlat",
"allocates",
"a",
"new",
"Point",
"with",
"layout",
"l",
"and",
"flat",
"coordinates",
"flatCoords",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/point.go#L14-L20 |
29,646 | twpayne/go-geom | point.go | MustSetCoords | func (g *Point) MustSetCoords(coords Coord) *Point {
Must(g.SetCoords(coords))
return g
} | go | func (g *Point) MustSetCoords(coords Coord) *Point {
Must(g.SetCoords(coords))
return g
} | [
"func",
"(",
"g",
"*",
"Point",
")",
"MustSetCoords",
"(",
"coords",
"Coord",
")",
"*",
"Point",
"{",
"Must",
"(",
"g",
".",
"SetCoords",
"(",
"coords",
")",
")",
"\n",
"return",
"g",
"\n",
"}"
] | // MustSetCoords is like SetCoords but panics on any error. | [
"MustSetCoords",
"is",
"like",
"SetCoords",
"but",
"panics",
"on",
"any",
"error",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/point.go#L43-L46 |
29,647 | twpayne/go-geom | point.go | Z | func (g *Point) Z() float64 {
zIndex := g.layout.ZIndex()
if zIndex == -1 {
return 0
}
return g.flatCoords[zIndex]
} | go | func (g *Point) Z() float64 {
zIndex := g.layout.ZIndex()
if zIndex == -1 {
return 0
}
return g.flatCoords[zIndex]
} | [
"func",
"(",
"g",
"*",
"Point",
")",
"Z",
"(",
")",
"float64",
"{",
"zIndex",
":=",
"g",
".",
"layout",
".",
"ZIndex",
"(",
")",
"\n",
"if",
"zIndex",
"==",
"-",
"1",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"g",
".",
"flatCoords",
"[",
... | // Z returns g's Z-coordinate, or zero if g has no Z-coordinate. | [
"Z",
"returns",
"g",
"s",
"Z",
"-",
"coordinate",
"or",
"zero",
"if",
"g",
"has",
"no",
"Z",
"-",
"coordinate",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/point.go#L78-L84 |
29,648 | twpayne/go-geom | point.go | M | func (g *Point) M() float64 {
mIndex := g.layout.MIndex()
if mIndex == -1 {
return 0
}
return g.flatCoords[mIndex]
} | go | func (g *Point) M() float64 {
mIndex := g.layout.MIndex()
if mIndex == -1 {
return 0
}
return g.flatCoords[mIndex]
} | [
"func",
"(",
"g",
"*",
"Point",
")",
"M",
"(",
")",
"float64",
"{",
"mIndex",
":=",
"g",
".",
"layout",
".",
"MIndex",
"(",
")",
"\n",
"if",
"mIndex",
"==",
"-",
"1",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"g",
".",
"flatCoords",
"[",
... | // M returns g's M-coordinate, or zero if g has no M-coordinate. | [
"M",
"returns",
"g",
"s",
"M",
"-",
"coordinate",
"or",
"zero",
"if",
"g",
"has",
"no",
"M",
"-",
"coordinate",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/point.go#L87-L93 |
29,649 | twpayne/go-geom | encoding/ewkb/sql.go | Value | func (ls *LineString) Value() (driver.Value, error) {
if ls.LineString == nil {
return nil, nil
}
return value(ls.LineString)
} | go | func (ls *LineString) Value() (driver.Value, error) {
if ls.LineString == nil {
return nil, nil
}
return value(ls.LineString)
} | [
"func",
"(",
"ls",
"*",
"LineString",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"if",
"ls",
".",
"LineString",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"value",
"(",
"ls",
".",
... | // Value returns the EWKB encoding of ls. | [
"Value",
"returns",
"the",
"EWKB",
"encoding",
"of",
"ls",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/ewkb/sql.go#L126-L131 |
29,650 | twpayne/go-geom | encoding/ewkb/sql.go | Value | func (mls *MultiLineString) Value() (driver.Value, error) {
if mls.MultiLineString == nil {
return nil, nil
}
return value(mls.MultiLineString)
} | go | func (mls *MultiLineString) Value() (driver.Value, error) {
if mls.MultiLineString == nil {
return nil, nil
}
return value(mls.MultiLineString)
} | [
"func",
"(",
"mls",
"*",
"MultiLineString",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"if",
"mls",
".",
"MultiLineString",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"value",
"(",
"m... | // Value returns the EWKB encoding of mls. | [
"Value",
"returns",
"the",
"EWKB",
"encoding",
"of",
"mls",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/ewkb/sql.go#L231-L236 |
29,651 | twpayne/go-geom | encoding/ewkb/sql.go | Value | func (gc *GeometryCollection) Value() (driver.Value, error) {
if gc.GeometryCollection == nil {
return nil, nil
}
return value(gc.GeometryCollection)
} | go | func (gc *GeometryCollection) Value() (driver.Value, error) {
if gc.GeometryCollection == nil {
return nil, nil
}
return value(gc.GeometryCollection)
} | [
"func",
"(",
"gc",
"*",
"GeometryCollection",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"if",
"gc",
".",
"GeometryCollection",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"value",
"(",
... | // Value returns the EWKB encoding of gc. | [
"Value",
"returns",
"the",
"EWKB",
"encoding",
"of",
"gc",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/ewkb/sql.go#L301-L306 |
29,652 | twpayne/go-geom | encoding/wkbcommon/wkbcommon.go | ReadFlatCoords0 | func ReadFlatCoords0(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, error) {
coord := make([]float64, stride)
if err := ReadFloatArray(r, byteOrder, coord); err != nil {
return nil, err
}
return coord, nil
} | go | func ReadFlatCoords0(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, error) {
coord := make([]float64, stride)
if err := ReadFloatArray(r, byteOrder, coord); err != nil {
return nil, err
}
return coord, nil
} | [
"func",
"ReadFlatCoords0",
"(",
"r",
"io",
".",
"Reader",
",",
"byteOrder",
"binary",
".",
"ByteOrder",
",",
"stride",
"int",
")",
"(",
"[",
"]",
"float64",
",",
"error",
")",
"{",
"coord",
":=",
"make",
"(",
"[",
"]",
"float64",
",",
"stride",
")",
... | // ReadFlatCoords0 reads flat coordinates 0. | [
"ReadFlatCoords0",
"reads",
"flat",
"coordinates",
"0",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/wkbcommon/wkbcommon.go#L107-L113 |
29,653 | twpayne/go-geom | encoding/wkbcommon/wkbcommon.go | ReadFlatCoords1 | func ReadFlatCoords1(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, error) {
n, err := ReadUInt32(r, byteOrder)
if err != nil {
return nil, err
}
if limit := MaxGeometryElements[1]; limit >= 0 && int(n) > limit {
return nil, ErrGeometryTooLarge{Level: 1, N: int(n), Limit: limit}
}
flatCoords... | go | func ReadFlatCoords1(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, error) {
n, err := ReadUInt32(r, byteOrder)
if err != nil {
return nil, err
}
if limit := MaxGeometryElements[1]; limit >= 0 && int(n) > limit {
return nil, ErrGeometryTooLarge{Level: 1, N: int(n), Limit: limit}
}
flatCoords... | [
"func",
"ReadFlatCoords1",
"(",
"r",
"io",
".",
"Reader",
",",
"byteOrder",
"binary",
".",
"ByteOrder",
",",
"stride",
"int",
")",
"(",
"[",
"]",
"float64",
",",
"error",
")",
"{",
"n",
",",
"err",
":=",
"ReadUInt32",
"(",
"r",
",",
"byteOrder",
")",... | // ReadFlatCoords1 reads flat coordinates 1. | [
"ReadFlatCoords1",
"reads",
"flat",
"coordinates",
"1",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/wkbcommon/wkbcommon.go#L116-L129 |
29,654 | twpayne/go-geom | encoding/wkbcommon/wkbcommon.go | ReadFlatCoords2 | func ReadFlatCoords2(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, []int, error) {
n, err := ReadUInt32(r, byteOrder)
if err != nil {
return nil, nil, err
}
if limit := MaxGeometryElements[2]; limit >= 0 && int(n) > limit {
return nil, nil, ErrGeometryTooLarge{Level: 2, N: int(n), Limit: limi... | go | func ReadFlatCoords2(r io.Reader, byteOrder binary.ByteOrder, stride int) ([]float64, []int, error) {
n, err := ReadUInt32(r, byteOrder)
if err != nil {
return nil, nil, err
}
if limit := MaxGeometryElements[2]; limit >= 0 && int(n) > limit {
return nil, nil, ErrGeometryTooLarge{Level: 2, N: int(n), Limit: limi... | [
"func",
"ReadFlatCoords2",
"(",
"r",
"io",
".",
"Reader",
",",
"byteOrder",
"binary",
".",
"ByteOrder",
",",
"stride",
"int",
")",
"(",
"[",
"]",
"float64",
",",
"[",
"]",
"int",
",",
"error",
")",
"{",
"n",
",",
"err",
":=",
"ReadUInt32",
"(",
"r"... | // ReadFlatCoords2 reads flat coordinates 2. | [
"ReadFlatCoords2",
"reads",
"flat",
"coordinates",
"2",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/wkbcommon/wkbcommon.go#L132-L151 |
29,655 | twpayne/go-geom | encoding/wkbcommon/wkbcommon.go | WriteFlatCoords0 | func WriteFlatCoords0(w io.Writer, byteOrder binary.ByteOrder, coord []float64) error {
return WriteFloatArray(w, byteOrder, coord)
} | go | func WriteFlatCoords0(w io.Writer, byteOrder binary.ByteOrder, coord []float64) error {
return WriteFloatArray(w, byteOrder, coord)
} | [
"func",
"WriteFlatCoords0",
"(",
"w",
"io",
".",
"Writer",
",",
"byteOrder",
"binary",
".",
"ByteOrder",
",",
"coord",
"[",
"]",
"float64",
")",
"error",
"{",
"return",
"WriteFloatArray",
"(",
"w",
",",
"byteOrder",
",",
"coord",
")",
"\n",
"}"
] | // WriteFlatCoords0 writes flat coordinates 0. | [
"WriteFlatCoords0",
"writes",
"flat",
"coordinates",
"0",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/wkbcommon/wkbcommon.go#L154-L156 |
29,656 | twpayne/go-geom | encoding/wkbcommon/wkbcommon.go | WriteFlatCoords1 | func WriteFlatCoords1(w io.Writer, byteOrder binary.ByteOrder, coords []float64, stride int) error {
if err := WriteUInt32(w, byteOrder, uint32(len(coords)/stride)); err != nil {
return err
}
return WriteFloatArray(w, byteOrder, coords)
} | go | func WriteFlatCoords1(w io.Writer, byteOrder binary.ByteOrder, coords []float64, stride int) error {
if err := WriteUInt32(w, byteOrder, uint32(len(coords)/stride)); err != nil {
return err
}
return WriteFloatArray(w, byteOrder, coords)
} | [
"func",
"WriteFlatCoords1",
"(",
"w",
"io",
".",
"Writer",
",",
"byteOrder",
"binary",
".",
"ByteOrder",
",",
"coords",
"[",
"]",
"float64",
",",
"stride",
"int",
")",
"error",
"{",
"if",
"err",
":=",
"WriteUInt32",
"(",
"w",
",",
"byteOrder",
",",
"ui... | // WriteFlatCoords1 writes flat coordinates 1. | [
"WriteFlatCoords1",
"writes",
"flat",
"coordinates",
"1",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/wkbcommon/wkbcommon.go#L159-L164 |
29,657 | twpayne/go-geom | encoding/wkbcommon/wkbcommon.go | WriteFlatCoords2 | func WriteFlatCoords2(w io.Writer, byteOrder binary.ByteOrder, flatCoords []float64, ends []int, stride int) error {
if err := WriteUInt32(w, byteOrder, uint32(len(ends))); err != nil {
return err
}
offset := 0
for _, end := range ends {
if err := WriteFlatCoords1(w, byteOrder, flatCoords[offset:end], stride); ... | go | func WriteFlatCoords2(w io.Writer, byteOrder binary.ByteOrder, flatCoords []float64, ends []int, stride int) error {
if err := WriteUInt32(w, byteOrder, uint32(len(ends))); err != nil {
return err
}
offset := 0
for _, end := range ends {
if err := WriteFlatCoords1(w, byteOrder, flatCoords[offset:end], stride); ... | [
"func",
"WriteFlatCoords2",
"(",
"w",
"io",
".",
"Writer",
",",
"byteOrder",
"binary",
".",
"ByteOrder",
",",
"flatCoords",
"[",
"]",
"float64",
",",
"ends",
"[",
"]",
"int",
",",
"stride",
"int",
")",
"error",
"{",
"if",
"err",
":=",
"WriteUInt32",
"(... | // WriteFlatCoords2 writes flat coordinates 2. | [
"WriteFlatCoords2",
"writes",
"flat",
"coordinates",
"2",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/wkbcommon/wkbcommon.go#L167-L179 |
29,658 | twpayne/go-geom | sorting/sorting.go | IsLess2D | func IsLess2D(v1, v2 []float64) bool {
if v1[0] < v2[0] {
return true
}
if v1[0] > v2[0] {
return false
}
if v1[1] < v2[1] {
return true
}
return false
} | go | func IsLess2D(v1, v2 []float64) bool {
if v1[0] < v2[0] {
return true
}
if v1[0] > v2[0] {
return false
}
if v1[1] < v2[1] {
return true
}
return false
} | [
"func",
"IsLess2D",
"(",
"v1",
",",
"v2",
"[",
"]",
"float64",
")",
"bool",
"{",
"if",
"v1",
"[",
"0",
"]",
"<",
"v2",
"[",
"0",
"]",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"v1",
"[",
"0",
"]",
">",
"v2",
"[",
"0",
"]",
"{",
"retur... | // IsLess2D is a comparator that compares based on the size of the x and y coords.
//
// First the x coordinates are compared.
// if x coords are equal then the y coords are compared | [
"IsLess2D",
"is",
"a",
"comparator",
"that",
"compares",
"based",
"on",
"the",
"size",
"of",
"the",
"x",
"and",
"y",
"coords",
".",
"First",
"the",
"x",
"coordinates",
"are",
"compared",
".",
"if",
"x",
"coords",
"are",
"equal",
"then",
"the",
"y",
"co... | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/sorting/sorting.go#L24-L36 |
29,659 | twpayne/go-geom | sorting/sorting.go | NewFlatCoordSorting2D | func NewFlatCoordSorting2D(layout geom.Layout, coordData []float64) FlatCoord {
return NewFlatCoordSorting(layout, coordData, IsLess2D)
} | go | func NewFlatCoordSorting2D(layout geom.Layout, coordData []float64) FlatCoord {
return NewFlatCoordSorting(layout, coordData, IsLess2D)
} | [
"func",
"NewFlatCoordSorting2D",
"(",
"layout",
"geom",
".",
"Layout",
",",
"coordData",
"[",
"]",
"float64",
")",
"FlatCoord",
"{",
"return",
"NewFlatCoordSorting",
"(",
"layout",
",",
"coordData",
",",
"IsLess2D",
")",
"\n",
"}"
] | // NewFlatCoordSorting2D creates a Compare2D based sort.Interface implementation | [
"NewFlatCoordSorting2D",
"creates",
"a",
"Compare2D",
"based",
"sort",
".",
"Interface",
"implementation"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/sorting/sorting.go#L39-L41 |
29,660 | twpayne/go-geom | sorting/sorting.go | NewFlatCoordSorting | func NewFlatCoordSorting(layout geom.Layout, coordData []float64, comparator IsLess) FlatCoord {
return FlatCoord{
isLess: comparator,
coords: coordData,
layout: layout,
stride: layout.Stride(),
}
} | go | func NewFlatCoordSorting(layout geom.Layout, coordData []float64, comparator IsLess) FlatCoord {
return FlatCoord{
isLess: comparator,
coords: coordData,
layout: layout,
stride: layout.Stride(),
}
} | [
"func",
"NewFlatCoordSorting",
"(",
"layout",
"geom",
".",
"Layout",
",",
"coordData",
"[",
"]",
"float64",
",",
"comparator",
"IsLess",
")",
"FlatCoord",
"{",
"return",
"FlatCoord",
"{",
"isLess",
":",
"comparator",
",",
"coords",
":",
"coordData",
",",
"la... | // NewFlatCoordSorting creates a sort.Interface implementation based on the Comparator function | [
"NewFlatCoordSorting",
"creates",
"a",
"sort",
".",
"Interface",
"implementation",
"based",
"on",
"the",
"Comparator",
"function"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/sorting/sorting.go#L44-L51 |
29,661 | twpayne/go-geom | linestring.go | NewLineStringFlat | func NewLineStringFlat(layout Layout, flatCoords []float64) *LineString {
g := new(LineString)
g.layout = layout
g.stride = layout.Stride()
g.flatCoords = flatCoords
return g
} | go | func NewLineStringFlat(layout Layout, flatCoords []float64) *LineString {
g := new(LineString)
g.layout = layout
g.stride = layout.Stride()
g.flatCoords = flatCoords
return g
} | [
"func",
"NewLineStringFlat",
"(",
"layout",
"Layout",
",",
"flatCoords",
"[",
"]",
"float64",
")",
"*",
"LineString",
"{",
"g",
":=",
"new",
"(",
"LineString",
")",
"\n",
"g",
".",
"layout",
"=",
"layout",
"\n",
"g",
".",
"stride",
"=",
"layout",
".",
... | // NewLineStringFlat returns a new LineString with layout l and control points
// flatCoords. | [
"NewLineStringFlat",
"returns",
"a",
"new",
"LineString",
"with",
"layout",
"l",
"and",
"control",
"points",
"flatCoords",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/linestring.go#L16-L22 |
29,662 | twpayne/go-geom | linestring.go | Interpolate | func (g *LineString) Interpolate(val float64, dim int) (int, float64) {
n := len(g.flatCoords)
if n == 0 {
panic("geom: empty linestring")
}
if val <= g.flatCoords[dim] {
return 0, 0
}
if g.flatCoords[n-g.stride+dim] <= val {
return (n - 1) / g.stride, 0
}
low := 0
high := n / g.stride
for low < high {
... | go | func (g *LineString) Interpolate(val float64, dim int) (int, float64) {
n := len(g.flatCoords)
if n == 0 {
panic("geom: empty linestring")
}
if val <= g.flatCoords[dim] {
return 0, 0
}
if g.flatCoords[n-g.stride+dim] <= val {
return (n - 1) / g.stride, 0
}
low := 0
high := n / g.stride
for low < high {
... | [
"func",
"(",
"g",
"*",
"LineString",
")",
"Interpolate",
"(",
"val",
"float64",
",",
"dim",
"int",
")",
"(",
"int",
",",
"float64",
")",
"{",
"n",
":=",
"len",
"(",
"g",
".",
"flatCoords",
")",
"\n",
"if",
"n",
"==",
"0",
"{",
"panic",
"(",
"\"... | // Interpolate returns the index and delta of val in dimension dim. | [
"Interpolate",
"returns",
"the",
"index",
"and",
"delta",
"of",
"val",
"in",
"dimension",
"dim",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/linestring.go#L40-L68 |
29,663 | twpayne/go-geom | linestring.go | Length | func (g *LineString) Length() float64 {
return length1(g.flatCoords, 0, len(g.flatCoords), g.stride)
} | go | func (g *LineString) Length() float64 {
return length1(g.flatCoords, 0, len(g.flatCoords), g.stride)
} | [
"func",
"(",
"g",
"*",
"LineString",
")",
"Length",
"(",
")",
"float64",
"{",
"return",
"length1",
"(",
"g",
".",
"flatCoords",
",",
"0",
",",
"len",
"(",
"g",
".",
"flatCoords",
")",
",",
"g",
".",
"stride",
")",
"\n",
"}"
] | // Length returns the length of g. | [
"Length",
"returns",
"the",
"length",
"of",
"g",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/linestring.go#L71-L73 |
29,664 | twpayne/go-geom | linestring.go | MustSetCoords | func (g *LineString) MustSetCoords(coords []Coord) *LineString {
Must(g.SetCoords(coords))
return g
} | go | func (g *LineString) MustSetCoords(coords []Coord) *LineString {
Must(g.SetCoords(coords))
return g
} | [
"func",
"(",
"g",
"*",
"LineString",
")",
"MustSetCoords",
"(",
"coords",
"[",
"]",
"Coord",
")",
"*",
"LineString",
"{",
"Must",
"(",
"g",
".",
"SetCoords",
"(",
"coords",
")",
")",
"\n",
"return",
"g",
"\n",
"}"
] | // MustSetCoords is like SetCoords but it panics on any error. | [
"MustSetCoords",
"is",
"like",
"SetCoords",
"but",
"it",
"panics",
"on",
"any",
"error",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/linestring.go#L76-L79 |
29,665 | twpayne/go-geom | linestring.go | SubLineString | func (g *LineString) SubLineString(start, stop int) *LineString {
return NewLineStringFlat(g.layout, g.flatCoords[start*g.stride:stop*g.stride])
} | go | func (g *LineString) SubLineString(start, stop int) *LineString {
return NewLineStringFlat(g.layout, g.flatCoords[start*g.stride:stop*g.stride])
} | [
"func",
"(",
"g",
"*",
"LineString",
")",
"SubLineString",
"(",
"start",
",",
"stop",
"int",
")",
"*",
"LineString",
"{",
"return",
"NewLineStringFlat",
"(",
"g",
".",
"layout",
",",
"g",
".",
"flatCoords",
"[",
"start",
"*",
"g",
".",
"stride",
":",
... | // SubLineString returns a LineString from starts at index start and stops at
// index stop of g. The returned LineString aliases g. | [
"SubLineString",
"returns",
"a",
"LineString",
"from",
"starts",
"at",
"index",
"start",
"and",
"stops",
"at",
"index",
"stop",
"of",
"g",
".",
"The",
"returned",
"LineString",
"aliases",
"g",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/linestring.go#L97-L99 |
29,666 | twpayne/go-geom | transform/tree_set.go | NewTreeSet | func NewTreeSet(layout geom.Layout, compare Compare) *TreeSet {
return &TreeSet{
layout: layout,
stride: layout.Stride(),
compare: compare,
}
} | go | func NewTreeSet(layout geom.Layout, compare Compare) *TreeSet {
return &TreeSet{
layout: layout,
stride: layout.Stride(),
compare: compare,
}
} | [
"func",
"NewTreeSet",
"(",
"layout",
"geom",
".",
"Layout",
",",
"compare",
"Compare",
")",
"*",
"TreeSet",
"{",
"return",
"&",
"TreeSet",
"{",
"layout",
":",
"layout",
",",
"stride",
":",
"layout",
".",
"Stride",
"(",
")",
",",
"compare",
":",
"compar... | // NewTreeSet creates a new TreeSet instance | [
"NewTreeSet",
"creates",
"a",
"new",
"TreeSet",
"instance"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/transform/tree_set.go#L32-L38 |
29,667 | twpayne/go-geom | transform/tree_set.go | Insert | func (set *TreeSet) Insert(coord geom.Coord) bool {
if set.stride == 0 {
set.stride = set.layout.Stride()
}
if len(coord) < set.stride {
panic(fmt.Sprintf("Coordinate inserted into tree does not have a sufficient number of points for the provided layout. Length of Coord was %v but should have been %v", len(coor... | go | func (set *TreeSet) Insert(coord geom.Coord) bool {
if set.stride == 0 {
set.stride = set.layout.Stride()
}
if len(coord) < set.stride {
panic(fmt.Sprintf("Coordinate inserted into tree does not have a sufficient number of points for the provided layout. Length of Coord was %v but should have been %v", len(coor... | [
"func",
"(",
"set",
"*",
"TreeSet",
")",
"Insert",
"(",
"coord",
"geom",
".",
"Coord",
")",
"bool",
"{",
"if",
"set",
".",
"stride",
"==",
"0",
"{",
"set",
".",
"stride",
"=",
"set",
".",
"layout",
".",
"Stride",
"(",
")",
"\n",
"}",
"\n",
"if"... | // Insert adds a new coordinate to the tree set
// the coordinate must be the same size as the Stride of the layout provided
// when constructing the TreeSet
// Returns true if the coordinate was added, false if it was already in the tree | [
"Insert",
"adds",
"a",
"new",
"coordinate",
"to",
"the",
"tree",
"set",
"the",
"coordinate",
"must",
"be",
"the",
"same",
"size",
"as",
"the",
"Stride",
"of",
"the",
"layout",
"provided",
"when",
"constructing",
"the",
"TreeSet",
"Returns",
"true",
"if",
"... | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/transform/tree_set.go#L44-L58 |
29,668 | twpayne/go-geom | transform/tree_set.go | ToFlatArray | func (set *TreeSet) ToFlatArray() []float64 {
stride := set.layout.Stride()
array := make([]float64, set.size*stride)
i := 0
set.walk(set.tree, func(v []float64) {
for j := 0; j < stride; j++ {
array[i+j] = v[j]
}
i += stride
})
return array
} | go | func (set *TreeSet) ToFlatArray() []float64 {
stride := set.layout.Stride()
array := make([]float64, set.size*stride)
i := 0
set.walk(set.tree, func(v []float64) {
for j := 0; j < stride; j++ {
array[i+j] = v[j]
}
i += stride
})
return array
} | [
"func",
"(",
"set",
"*",
"TreeSet",
")",
"ToFlatArray",
"(",
")",
"[",
"]",
"float64",
"{",
"stride",
":=",
"set",
".",
"layout",
".",
"Stride",
"(",
")",
"\n",
"array",
":=",
"make",
"(",
"[",
"]",
"float64",
",",
"set",
".",
"size",
"*",
"strid... | // ToFlatArray returns an array of floats containing all the coordinates in the TreeSet | [
"ToFlatArray",
"returns",
"an",
"array",
"of",
"floats",
"containing",
"all",
"the",
"coordinates",
"in",
"the",
"TreeSet"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/transform/tree_set.go#L61-L74 |
29,669 | twpayne/go-geom | xy/internal/lineintersector/line_intersector.go | PointIntersectsLine | func PointIntersectsLine(strategy Strategy, point, lineStart, lineEnd geom.Coord) (hasIntersection bool) {
intersectorData := &lineIntersectorData{
strategy: strategy,
inputLines: [2][2]geom.Coord{{lineStart, lineEnd}, {}},
intersectionPoints: [2]geom.Coord{{0, 0}, {0, 0}},
}
intersectorData... | go | func PointIntersectsLine(strategy Strategy, point, lineStart, lineEnd geom.Coord) (hasIntersection bool) {
intersectorData := &lineIntersectorData{
strategy: strategy,
inputLines: [2][2]geom.Coord{{lineStart, lineEnd}, {}},
intersectionPoints: [2]geom.Coord{{0, 0}, {0, 0}},
}
intersectorData... | [
"func",
"PointIntersectsLine",
"(",
"strategy",
"Strategy",
",",
"point",
",",
"lineStart",
",",
"lineEnd",
"geom",
".",
"Coord",
")",
"(",
"hasIntersection",
"bool",
")",
"{",
"intersectorData",
":=",
"&",
"lineIntersectorData",
"{",
"strategy",
":",
"strategy"... | // PointIntersectsLine tests if point intersects the line | [
"PointIntersectsLine",
"tests",
"if",
"point",
"intersects",
"the",
"line"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/internal/lineintersector/line_intersector.go#L17-L30 |
29,670 | twpayne/go-geom | xy/internal/lineintersector/line_intersector.go | rParameter | func rParameter(p1, p2, p geom.Coord) float64 {
var r float64
// compute maximum delta, for numerical stability
// also handle case of p1-p2 being vertical or horizontal
dx := math.Abs(p2[0] - p1[0])
dy := math.Abs(p2[1] - p1[1])
if dx > dy {
r = (p[0] - p1[0]) / (p2[0] - p1[0])
} else {
r = (p[1] - p1[1]) /... | go | func rParameter(p1, p2, p geom.Coord) float64 {
var r float64
// compute maximum delta, for numerical stability
// also handle case of p1-p2 being vertical or horizontal
dx := math.Abs(p2[0] - p1[0])
dy := math.Abs(p2[1] - p1[1])
if dx > dy {
r = (p[0] - p1[0]) / (p2[0] - p1[0])
} else {
r = (p[1] - p1[1]) /... | [
"func",
"rParameter",
"(",
"p1",
",",
"p2",
",",
"p",
"geom",
".",
"Coord",
")",
"float64",
"{",
"var",
"r",
"float64",
"\n",
"// compute maximum delta, for numerical stability",
"// also handle case of p1-p2 being vertical or horizontal",
"dx",
":=",
"math",
".",
"Ab... | /**
* RParameter computes the parameter for the point p
* in the parameterized equation
* of the line from p1 to p2.
* This is equal to the 'distance' of p along p1-p2
*/ | [
"RParameter",
"computes",
"the",
"parameter",
"for",
"the",
"point",
"p",
"in",
"the",
"parameterized",
"equation",
"of",
"the",
"line",
"from",
"p1",
"to",
"p2",
".",
"This",
"is",
"equal",
"to",
"the",
"distance",
"of",
"p",
"along",
"p1",
"-",
"p2"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/internal/lineintersector/line_intersector.go#L83-L95 |
29,671 | twpayne/go-geom | xy/point_centroid.go | AddPoint | func (calc *PointCentroidCalculator) AddPoint(point *geom.Point) {
calc.AddCoord(geom.Coord(point.FlatCoords()))
} | go | func (calc *PointCentroidCalculator) AddPoint(point *geom.Point) {
calc.AddCoord(geom.Coord(point.FlatCoords()))
} | [
"func",
"(",
"calc",
"*",
"PointCentroidCalculator",
")",
"AddPoint",
"(",
"point",
"*",
"geom",
".",
"Point",
")",
"{",
"calc",
".",
"AddCoord",
"(",
"geom",
".",
"Coord",
"(",
"point",
".",
"FlatCoords",
"(",
")",
")",
")",
"\n",
"}"
] | // AddPoint adds a point to the calculation | [
"AddPoint",
"adds",
"a",
"point",
"to",
"the",
"calculation"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/point_centroid.go#L69-L71 |
29,672 | twpayne/go-geom | xy/point_centroid.go | AddCoord | func (calc *PointCentroidCalculator) AddCoord(point geom.Coord) {
calc.ptCount++
calc.centSum[0] += point[0]
calc.centSum[1] += point[1]
} | go | func (calc *PointCentroidCalculator) AddCoord(point geom.Coord) {
calc.ptCount++
calc.centSum[0] += point[0]
calc.centSum[1] += point[1]
} | [
"func",
"(",
"calc",
"*",
"PointCentroidCalculator",
")",
"AddCoord",
"(",
"point",
"geom",
".",
"Coord",
")",
"{",
"calc",
".",
"ptCount",
"++",
"\n",
"calc",
".",
"centSum",
"[",
"0",
"]",
"+=",
"point",
"[",
"0",
"]",
"\n",
"calc",
".",
"centSum",... | // AddCoord adds a point to the calculation | [
"AddCoord",
"adds",
"a",
"point",
"to",
"the",
"calculation"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/point_centroid.go#L74-L78 |
29,673 | twpayne/go-geom | xy/point_centroid.go | GetCentroid | func (calc *PointCentroidCalculator) GetCentroid() geom.Coord {
cent := geom.Coord{0, 0}
cent[0] = calc.centSum[0] / float64(calc.ptCount)
cent[1] = calc.centSum[1] / float64(calc.ptCount)
return cent
} | go | func (calc *PointCentroidCalculator) GetCentroid() geom.Coord {
cent := geom.Coord{0, 0}
cent[0] = calc.centSum[0] / float64(calc.ptCount)
cent[1] = calc.centSum[1] / float64(calc.ptCount)
return cent
} | [
"func",
"(",
"calc",
"*",
"PointCentroidCalculator",
")",
"GetCentroid",
"(",
")",
"geom",
".",
"Coord",
"{",
"cent",
":=",
"geom",
".",
"Coord",
"{",
"0",
",",
"0",
"}",
"\n",
"cent",
"[",
"0",
"]",
"=",
"calc",
".",
"centSum",
"[",
"0",
"]",
"/... | // GetCentroid obtains centroid currently calculated. Returns a 0 coord if no coords have been added | [
"GetCentroid",
"obtains",
"centroid",
"currently",
"calculated",
".",
"Returns",
"a",
"0",
"coord",
"if",
"no",
"coords",
"have",
"been",
"added"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/point_centroid.go#L81-L86 |
29,674 | twpayne/go-geom | xy/internal/cga.go | Distance2D | func Distance2D(c1, c2 geom.Coord) float64 {
dx := c1[0] - c2[0]
dy := c1[1] - c2[1]
return math.Sqrt(dx*dx + dy*dy)
} | go | func Distance2D(c1, c2 geom.Coord) float64 {
dx := c1[0] - c2[0]
dy := c1[1] - c2[1]
return math.Sqrt(dx*dx + dy*dy)
} | [
"func",
"Distance2D",
"(",
"c1",
",",
"c2",
"geom",
".",
"Coord",
")",
"float64",
"{",
"dx",
":=",
"c1",
"[",
"0",
"]",
"-",
"c2",
"[",
"0",
"]",
"\n",
"dy",
":=",
"c1",
"[",
"1",
"]",
"-",
"c2",
"[",
"1",
"]",
"\n\n",
"return",
"math",
"."... | // Distance2D calculates the 2d distance between the two coordinates | [
"Distance2D",
"calculates",
"the",
"2d",
"distance",
"between",
"the",
"two",
"coordinates"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/internal/cga.go#L59-L64 |
29,675 | twpayne/go-geom | multipolygon.go | NewMultiPolygonFlat | func NewMultiPolygonFlat(layout Layout, flatCoords []float64, endss [][]int) *MultiPolygon {
g := new(MultiPolygon)
g.layout = layout
g.stride = layout.Stride()
g.flatCoords = flatCoords
g.endss = endss
return g
} | go | func NewMultiPolygonFlat(layout Layout, flatCoords []float64, endss [][]int) *MultiPolygon {
g := new(MultiPolygon)
g.layout = layout
g.stride = layout.Stride()
g.flatCoords = flatCoords
g.endss = endss
return g
} | [
"func",
"NewMultiPolygonFlat",
"(",
"layout",
"Layout",
",",
"flatCoords",
"[",
"]",
"float64",
",",
"endss",
"[",
"]",
"[",
"]",
"int",
")",
"*",
"MultiPolygon",
"{",
"g",
":=",
"new",
"(",
"MultiPolygon",
")",
"\n",
"g",
".",
"layout",
"=",
"layout",... | // NewMultiPolygonFlat returns a new MultiPolygon with the given flat coordinates. | [
"NewMultiPolygonFlat",
"returns",
"a",
"new",
"MultiPolygon",
"with",
"the",
"given",
"flat",
"coordinates",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/multipolygon.go#L14-L21 |
29,676 | twpayne/go-geom | multipolygon.go | Area | func (g *MultiPolygon) Area() float64 {
return doubleArea3(g.flatCoords, 0, g.endss, g.stride) / 2
} | go | func (g *MultiPolygon) Area() float64 {
return doubleArea3(g.flatCoords, 0, g.endss, g.stride) / 2
} | [
"func",
"(",
"g",
"*",
"MultiPolygon",
")",
"Area",
"(",
")",
"float64",
"{",
"return",
"doubleArea3",
"(",
"g",
".",
"flatCoords",
",",
"0",
",",
"g",
".",
"endss",
",",
"g",
".",
"stride",
")",
"/",
"2",
"\n",
"}"
] | // Area returns the sum of the area of the individual Polygons. | [
"Area",
"returns",
"the",
"sum",
"of",
"the",
"area",
"of",
"the",
"individual",
"Polygons",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/multipolygon.go#L24-L26 |
29,677 | twpayne/go-geom | multipolygon.go | Length | func (g *MultiPolygon) Length() float64 {
return length3(g.flatCoords, 0, g.endss, g.stride)
} | go | func (g *MultiPolygon) Length() float64 {
return length3(g.flatCoords, 0, g.endss, g.stride)
} | [
"func",
"(",
"g",
"*",
"MultiPolygon",
")",
"Length",
"(",
")",
"float64",
"{",
"return",
"length3",
"(",
"g",
".",
"flatCoords",
",",
"0",
",",
"g",
".",
"endss",
",",
"g",
".",
"stride",
")",
"\n",
"}"
] | // Length returns the sum of the perimeters of the Polygons. | [
"Length",
"returns",
"the",
"sum",
"of",
"the",
"perimeters",
"of",
"the",
"Polygons",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/multipolygon.go#L39-L41 |
29,678 | twpayne/go-geom | multipolygon.go | Polygon | func (g *MultiPolygon) Polygon(i int) *Polygon {
offset := 0
if i > 0 {
ends := g.endss[i-1]
offset = ends[len(ends)-1]
}
ends := make([]int, len(g.endss[i]))
if offset == 0 {
copy(ends, g.endss[i])
} else {
for j, end := range g.endss[i] {
ends[j] = end - offset
}
}
return NewPolygonFlat(g.layout,... | go | func (g *MultiPolygon) Polygon(i int) *Polygon {
offset := 0
if i > 0 {
ends := g.endss[i-1]
offset = ends[len(ends)-1]
}
ends := make([]int, len(g.endss[i]))
if offset == 0 {
copy(ends, g.endss[i])
} else {
for j, end := range g.endss[i] {
ends[j] = end - offset
}
}
return NewPolygonFlat(g.layout,... | [
"func",
"(",
"g",
"*",
"MultiPolygon",
")",
"Polygon",
"(",
"i",
"int",
")",
"*",
"Polygon",
"{",
"offset",
":=",
"0",
"\n",
"if",
"i",
">",
"0",
"{",
"ends",
":=",
"g",
".",
"endss",
"[",
"i",
"-",
"1",
"]",
"\n",
"offset",
"=",
"ends",
"[",... | // Polygon returns the ith Polygon. | [
"Polygon",
"returns",
"the",
"ith",
"Polygon",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/multipolygon.go#L55-L70 |
29,679 | twpayne/go-geom | multipolygon.go | Push | func (g *MultiPolygon) Push(p *Polygon) error {
if p.layout != g.layout {
return ErrLayoutMismatch{Got: p.layout, Want: g.layout}
}
offset := len(g.flatCoords)
ends := make([]int, len(p.ends))
if offset == 0 {
copy(ends, p.ends)
} else {
for i, end := range p.ends {
ends[i] = end + offset
}
}
g.flatC... | go | func (g *MultiPolygon) Push(p *Polygon) error {
if p.layout != g.layout {
return ErrLayoutMismatch{Got: p.layout, Want: g.layout}
}
offset := len(g.flatCoords)
ends := make([]int, len(p.ends))
if offset == 0 {
copy(ends, p.ends)
} else {
for i, end := range p.ends {
ends[i] = end + offset
}
}
g.flatC... | [
"func",
"(",
"g",
"*",
"MultiPolygon",
")",
"Push",
"(",
"p",
"*",
"Polygon",
")",
"error",
"{",
"if",
"p",
".",
"layout",
"!=",
"g",
".",
"layout",
"{",
"return",
"ErrLayoutMismatch",
"{",
"Got",
":",
"p",
".",
"layout",
",",
"Want",
":",
"g",
"... | // Push appends a Polygon. | [
"Push",
"appends",
"a",
"Polygon",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/multipolygon.go#L73-L89 |
29,680 | twpayne/go-geom | xy/internal/lineintersector/robust_line_intersector.go | normalizeToEnvCentre | func normalizeToEnvCentre(line1Start, line1End, line2Start, line2End, normPt geom.Coord) {
// Note: All these "max" checks are inlined for performance.
// It would be visually cleaner to do that but requires more function calls
line1MinX := line1End[0]
if line1Start[0] < line1End[0] {
line1MinX = line1Start[0]
... | go | func normalizeToEnvCentre(line1Start, line1End, line2Start, line2End, normPt geom.Coord) {
// Note: All these "max" checks are inlined for performance.
// It would be visually cleaner to do that but requires more function calls
line1MinX := line1End[0]
if line1Start[0] < line1End[0] {
line1MinX = line1Start[0]
... | [
"func",
"normalizeToEnvCentre",
"(",
"line1Start",
",",
"line1End",
",",
"line2Start",
",",
"line2End",
",",
"normPt",
"geom",
".",
"Coord",
")",
"{",
"// Note: All these \"max\" checks are inlined for performance.",
"// It would be visually cleaner to do that but requires more f... | /**
* Normalize the supplied coordinates to
* so that the midpoint of their intersection envelope
* lies at the origin.
*/ | [
"Normalize",
"the",
"supplied",
"coordinates",
"to",
"so",
"that",
"the",
"midpoint",
"of",
"their",
"intersection",
"envelope",
"lies",
"at",
"the",
"origin",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/internal/lineintersector/robust_line_intersector.go#L263-L332 |
29,681 | twpayne/go-geom | geometrycollection.go | Layout | func (g *GeometryCollection) Layout() Layout {
maxLayout := NoLayout
for _, g := range g.geoms {
switch l := g.Layout(); l {
case XYZ:
if maxLayout == XYM {
maxLayout = XYZM
} else if l > maxLayout {
maxLayout = l
}
case XYM:
if maxLayout == XYZ {
maxLayout = XYZM
} else if l > maxLay... | go | func (g *GeometryCollection) Layout() Layout {
maxLayout := NoLayout
for _, g := range g.geoms {
switch l := g.Layout(); l {
case XYZ:
if maxLayout == XYM {
maxLayout = XYZM
} else if l > maxLayout {
maxLayout = l
}
case XYM:
if maxLayout == XYZ {
maxLayout = XYZM
} else if l > maxLay... | [
"func",
"(",
"g",
"*",
"GeometryCollection",
")",
"Layout",
"(",
")",
"Layout",
"{",
"maxLayout",
":=",
"NoLayout",
"\n",
"for",
"_",
",",
"g",
":=",
"range",
"g",
".",
"geoms",
"{",
"switch",
"l",
":=",
"g",
".",
"Layout",
"(",
")",
";",
"l",
"{... | // Layout returns the smallest layout that covers all of the layouts in g's
// geometries. | [
"Layout",
"returns",
"the",
"smallest",
"layout",
"that",
"covers",
"all",
"of",
"the",
"layouts",
"in",
"g",
"s",
"geometries",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/geometrycollection.go#L27-L50 |
29,682 | twpayne/go-geom | geometrycollection.go | Bounds | func (g *GeometryCollection) Bounds() *Bounds {
// FIXME this needs work for mixing layouts, e.g. XYZ and XYM
b := NewBounds(g.Layout())
for _, g := range g.geoms {
b = b.Extend(g)
}
return b
} | go | func (g *GeometryCollection) Bounds() *Bounds {
// FIXME this needs work for mixing layouts, e.g. XYZ and XYM
b := NewBounds(g.Layout())
for _, g := range g.geoms {
b = b.Extend(g)
}
return b
} | [
"func",
"(",
"g",
"*",
"GeometryCollection",
")",
"Bounds",
"(",
")",
"*",
"Bounds",
"{",
"// FIXME this needs work for mixing layouts, e.g. XYZ and XYM",
"b",
":=",
"NewBounds",
"(",
"g",
".",
"Layout",
"(",
")",
")",
"\n",
"for",
"_",
",",
"g",
":=",
"rang... | // Bounds returns the bounds of all the geometries in g. | [
"Bounds",
"returns",
"the",
"bounds",
"of",
"all",
"the",
"geometries",
"in",
"g",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/geometrycollection.go#L63-L70 |
29,683 | twpayne/go-geom | geometrycollection.go | MustPush | func (g *GeometryCollection) MustPush(gs ...T) *GeometryCollection {
if err := g.Push(gs...); err != nil {
panic(err)
}
return g
} | go | func (g *GeometryCollection) MustPush(gs ...T) *GeometryCollection {
if err := g.Push(gs...); err != nil {
panic(err)
}
return g
} | [
"func",
"(",
"g",
"*",
"GeometryCollection",
")",
"MustPush",
"(",
"gs",
"...",
"T",
")",
"*",
"GeometryCollection",
"{",
"if",
"err",
":=",
"g",
".",
"Push",
"(",
"gs",
"...",
")",
";",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}... | // MustPush pushes gs to g. It panics on any error. | [
"MustPush",
"pushes",
"gs",
"to",
"g",
".",
"It",
"panics",
"on",
"any",
"error",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/geometrycollection.go#L98-L103 |
29,684 | twpayne/go-geom | geometrycollection.go | Push | func (g *GeometryCollection) Push(gs ...T) error {
g.geoms = append(g.geoms, gs...)
return nil
} | go | func (g *GeometryCollection) Push(gs ...T) error {
g.geoms = append(g.geoms, gs...)
return nil
} | [
"func",
"(",
"g",
"*",
"GeometryCollection",
")",
"Push",
"(",
"gs",
"...",
"T",
")",
"error",
"{",
"g",
".",
"geoms",
"=",
"append",
"(",
"g",
".",
"geoms",
",",
"gs",
"...",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // Push appends geometries. | [
"Push",
"appends",
"geometries",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/geometrycollection.go#L106-L109 |
29,685 | twpayne/go-geom | geometrycollection.go | SetSRID | func (g *GeometryCollection) SetSRID(srid int) *GeometryCollection {
g.srid = srid
return g
} | go | func (g *GeometryCollection) SetSRID(srid int) *GeometryCollection {
g.srid = srid
return g
} | [
"func",
"(",
"g",
"*",
"GeometryCollection",
")",
"SetSRID",
"(",
"srid",
"int",
")",
"*",
"GeometryCollection",
"{",
"g",
".",
"srid",
"=",
"srid",
"\n",
"return",
"g",
"\n",
"}"
] | // SetSRID sets g's SRID and the SRID of all its elements. | [
"SetSRID",
"sets",
"g",
"s",
"SRID",
"and",
"the",
"SRID",
"of",
"all",
"its",
"elements",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/geometrycollection.go#L112-L115 |
29,686 | twpayne/go-geom | encoding/igc/encode.go | Encode | func (enc *Encoder) Encode(ls *geom.LineString) error {
if enc.a != "" {
if _, err := fmt.Fprintf(enc.w, "A%s\n", enc.a); err != nil {
return err
}
}
var t0 time.Time
for i, n := 0, ls.NumCoords(); i < n; i++ {
coord := ls.Coord(i)
t := time.Unix(int64(coord[3]), 0).UTC()
if t.Day() != t0.Day() || t.Mo... | go | func (enc *Encoder) Encode(ls *geom.LineString) error {
if enc.a != "" {
if _, err := fmt.Fprintf(enc.w, "A%s\n", enc.a); err != nil {
return err
}
}
var t0 time.Time
for i, n := 0, ls.NumCoords(); i < n; i++ {
coord := ls.Coord(i)
t := time.Unix(int64(coord[3]), 0).UTC()
if t.Day() != t0.Day() || t.Mo... | [
"func",
"(",
"enc",
"*",
"Encoder",
")",
"Encode",
"(",
"ls",
"*",
"geom",
".",
"LineString",
")",
"error",
"{",
"if",
"enc",
".",
"a",
"!=",
"\"",
"\"",
"{",
"if",
"_",
",",
"err",
":=",
"fmt",
".",
"Fprintf",
"(",
"enc",
".",
"w",
",",
"\""... | // Encode encodes a LineString. | [
"Encode",
"encodes",
"a",
"LineString",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/igc/encode.go#L42-L86 |
29,687 | twpayne/go-geom | multilinestring.go | NewMultiLineStringFlat | func NewMultiLineStringFlat(layout Layout, flatCoords []float64, ends []int) *MultiLineString {
g := new(MultiLineString)
g.layout = layout
g.stride = layout.Stride()
g.flatCoords = flatCoords
g.ends = ends
return g
} | go | func NewMultiLineStringFlat(layout Layout, flatCoords []float64, ends []int) *MultiLineString {
g := new(MultiLineString)
g.layout = layout
g.stride = layout.Stride()
g.flatCoords = flatCoords
g.ends = ends
return g
} | [
"func",
"NewMultiLineStringFlat",
"(",
"layout",
"Layout",
",",
"flatCoords",
"[",
"]",
"float64",
",",
"ends",
"[",
"]",
"int",
")",
"*",
"MultiLineString",
"{",
"g",
":=",
"new",
"(",
"MultiLineString",
")",
"\n",
"g",
".",
"layout",
"=",
"layout",
"\n... | // NewMultiLineStringFlat returns a new MultiLineString with the given flat coordinates. | [
"NewMultiLineStringFlat",
"returns",
"a",
"new",
"MultiLineString",
"with",
"the",
"given",
"flat",
"coordinates",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/multilinestring.go#L14-L21 |
29,688 | twpayne/go-geom | multilinestring.go | Length | func (g *MultiLineString) Length() float64 {
return length2(g.flatCoords, 0, g.ends, g.stride)
} | go | func (g *MultiLineString) Length() float64 {
return length2(g.flatCoords, 0, g.ends, g.stride)
} | [
"func",
"(",
"g",
"*",
"MultiLineString",
")",
"Length",
"(",
")",
"float64",
"{",
"return",
"length2",
"(",
"g",
".",
"flatCoords",
",",
"0",
",",
"g",
".",
"ends",
",",
"g",
".",
"stride",
")",
"\n",
"}"
] | // Length returns the sum of the length of the LineStrings. | [
"Length",
"returns",
"the",
"sum",
"of",
"the",
"length",
"of",
"the",
"LineStrings",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/multilinestring.go#L39-L41 |
29,689 | twpayne/go-geom | multilinestring.go | LineString | func (g *MultiLineString) LineString(i int) *LineString {
offset := 0
if i > 0 {
offset = g.ends[i-1]
}
return NewLineStringFlat(g.layout, g.flatCoords[offset:g.ends[i]])
} | go | func (g *MultiLineString) LineString(i int) *LineString {
offset := 0
if i > 0 {
offset = g.ends[i-1]
}
return NewLineStringFlat(g.layout, g.flatCoords[offset:g.ends[i]])
} | [
"func",
"(",
"g",
"*",
"MultiLineString",
")",
"LineString",
"(",
"i",
"int",
")",
"*",
"LineString",
"{",
"offset",
":=",
"0",
"\n",
"if",
"i",
">",
"0",
"{",
"offset",
"=",
"g",
".",
"ends",
"[",
"i",
"-",
"1",
"]",
"\n",
"}",
"\n",
"return",... | // LineString returns the ith LineString. | [
"LineString",
"returns",
"the",
"ith",
"LineString",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/multilinestring.go#L44-L50 |
29,690 | twpayne/go-geom | multilinestring.go | Push | func (g *MultiLineString) Push(ls *LineString) error {
if ls.layout != g.layout {
return ErrLayoutMismatch{Got: ls.layout, Want: g.layout}
}
g.flatCoords = append(g.flatCoords, ls.flatCoords...)
g.ends = append(g.ends, len(g.flatCoords))
return nil
} | go | func (g *MultiLineString) Push(ls *LineString) error {
if ls.layout != g.layout {
return ErrLayoutMismatch{Got: ls.layout, Want: g.layout}
}
g.flatCoords = append(g.flatCoords, ls.flatCoords...)
g.ends = append(g.ends, len(g.flatCoords))
return nil
} | [
"func",
"(",
"g",
"*",
"MultiLineString",
")",
"Push",
"(",
"ls",
"*",
"LineString",
")",
"error",
"{",
"if",
"ls",
".",
"layout",
"!=",
"g",
".",
"layout",
"{",
"return",
"ErrLayoutMismatch",
"{",
"Got",
":",
"ls",
".",
"layout",
",",
"Want",
":",
... | // Push appends a LineString. | [
"Push",
"appends",
"a",
"LineString",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/multilinestring.go#L64-L71 |
29,691 | twpayne/go-geom | encoding/geojson/geojson.go | Encode | func Encode(g geom.T) (*Geometry, error) {
switch g := g.(type) {
case *geom.Point:
var coords json.RawMessage
coords, err := json.Marshal(g.Coords())
if err != nil {
return nil, err
}
return &Geometry{
Type: "Point",
Coordinates: &coords,
}, nil
case *geom.LineString:
var coords json.R... | go | func Encode(g geom.T) (*Geometry, error) {
switch g := g.(type) {
case *geom.Point:
var coords json.RawMessage
coords, err := json.Marshal(g.Coords())
if err != nil {
return nil, err
}
return &Geometry{
Type: "Point",
Coordinates: &coords,
}, nil
case *geom.LineString:
var coords json.R... | [
"func",
"Encode",
"(",
"g",
"geom",
".",
"T",
")",
"(",
"*",
"Geometry",
",",
"error",
")",
"{",
"switch",
"g",
":=",
"g",
".",
"(",
"type",
")",
"{",
"case",
"*",
"geom",
".",
"Point",
":",
"var",
"coords",
"json",
".",
"RawMessage",
"\n",
"co... | // Encode encodes g as a GeoJSON geometry. | [
"Encode",
"encodes",
"g",
"as",
"a",
"GeoJSON",
"geometry",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/geojson/geojson.go#L197-L275 |
29,692 | twpayne/go-geom | encoding/geojson/geojson.go | UnmarshalJSON | func (f *Feature) UnmarshalJSON(data []byte) error {
var gf geojsonFeature
if err := json.Unmarshal(data, &gf); err != nil {
return err
}
if gf.Type != "Feature" {
return ErrUnsupportedType(gf.Type)
}
f.ID = gf.ID
var err error
f.Geometry, err = gf.Geometry.Decode()
if err != nil {
return err
}
f.Prope... | go | func (f *Feature) UnmarshalJSON(data []byte) error {
var gf geojsonFeature
if err := json.Unmarshal(data, &gf); err != nil {
return err
}
if gf.Type != "Feature" {
return ErrUnsupportedType(gf.Type)
}
f.ID = gf.ID
var err error
f.Geometry, err = gf.Geometry.Decode()
if err != nil {
return err
}
f.Prope... | [
"func",
"(",
"f",
"*",
"Feature",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"gf",
"geojsonFeature",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"gf",
")",
";",
"err",
"!=",
"nil",
... | // UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON. | [
"UnmarshalJSON",
"implements",
"json",
".",
"Unmarshaler",
".",
"UnmarshalJSON",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/geojson/geojson.go#L312-L328 |
29,693 | twpayne/go-geom | encoding/geojson/geojson.go | UnmarshalJSON | func (fc *FeatureCollection) UnmarshalJSON(data []byte) error {
var gfc geojsonFeatureCollection
if err := json.Unmarshal(data, &gfc); err != nil {
return err
}
if gfc.Type != "FeatureCollection" {
return ErrUnsupportedType(gfc.Type)
}
fc.Features = gfc.Features
return nil
} | go | func (fc *FeatureCollection) UnmarshalJSON(data []byte) error {
var gfc geojsonFeatureCollection
if err := json.Unmarshal(data, &gfc); err != nil {
return err
}
if gfc.Type != "FeatureCollection" {
return ErrUnsupportedType(gfc.Type)
}
fc.Features = gfc.Features
return nil
} | [
"func",
"(",
"fc",
"*",
"FeatureCollection",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"gfc",
"geojsonFeatureCollection",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"gfc",
")",
";",
"e... | // UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON | [
"UnmarshalJSON",
"implements",
"json",
".",
"Unmarshaler",
".",
"UnmarshalJSON"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/encoding/geojson/geojson.go#L343-L353 |
29,694 | twpayne/go-geom | xy/internal/centralendpoint/intersector.go | GetIntersection | func GetIntersection(line1End1, line1End2, line2End1, line2End2 geom.Coord) geom.Coord {
intersector := centralEndpointIntersector{
line1End1: line1End1,
line1End2: line1End2,
line2End1: line2End1,
line2End2: line2End2,
}
intersector.compute()
return intersector.intersectionPoint
} | go | func GetIntersection(line1End1, line1End2, line2End1, line2End2 geom.Coord) geom.Coord {
intersector := centralEndpointIntersector{
line1End1: line1End1,
line1End2: line1End2,
line2End1: line2End1,
line2End2: line2End2,
}
intersector.compute()
return intersector.intersectionPoint
} | [
"func",
"GetIntersection",
"(",
"line1End1",
",",
"line1End2",
",",
"line2End1",
",",
"line2End2",
"geom",
".",
"Coord",
")",
"geom",
".",
"Coord",
"{",
"intersector",
":=",
"centralEndpointIntersector",
"{",
"line1End1",
":",
"line1End1",
",",
"line1End2",
":",... | // GetIntersection computes an approximate intersection of two line segments by taking the most central of the endpoints of the segments.
//
// This is effective in cases where the segments are nearly parallel and should intersect at an endpoint.
// It is also a reasonable strategy for cases where the endpoint of one s... | [
"GetIntersection",
"computes",
"an",
"approximate",
"intersection",
"of",
"two",
"line",
"segments",
"by",
"taking",
"the",
"most",
"central",
"of",
"the",
"endpoints",
"of",
"the",
"segments",
".",
"This",
"is",
"effective",
"in",
"cases",
"where",
"the",
"se... | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/internal/centralendpoint/intersector.go#L18-L27 |
29,695 | twpayne/go-geom | xy/internal/raycrossing/ray-crossing-counter.go | LocatePointInRing | func LocatePointInRing(layout geom.Layout, p geom.Coord, ring []float64) location.Type {
counter := rayCrossingCounter{p: p}
stride := layout.Stride()
for i := stride; i < len(ring); i += stride {
p1 := geom.Coord(ring[i : i+2])
p2 := geom.Coord(ring[i-stride : i-stride+2])
counter.countSegment(p1, p2)
if... | go | func LocatePointInRing(layout geom.Layout, p geom.Coord, ring []float64) location.Type {
counter := rayCrossingCounter{p: p}
stride := layout.Stride()
for i := stride; i < len(ring); i += stride {
p1 := geom.Coord(ring[i : i+2])
p2 := geom.Coord(ring[i-stride : i-stride+2])
counter.countSegment(p1, p2)
if... | [
"func",
"LocatePointInRing",
"(",
"layout",
"geom",
".",
"Layout",
",",
"p",
"geom",
".",
"Coord",
",",
"ring",
"[",
"]",
"float64",
")",
"location",
".",
"Type",
"{",
"counter",
":=",
"rayCrossingCounter",
"{",
"p",
":",
"p",
"}",
"\n\n",
"stride",
":... | // LocatePointInRing determine where the point is with regards to the ring | [
"LocatePointInRing",
"determine",
"where",
"the",
"point",
"is",
"with",
"regards",
"to",
"the",
"ring"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/internal/raycrossing/ray-crossing-counter.go#L10-L25 |
29,696 | twpayne/go-geom | xy/internal/raycrossing/ray-crossing-counter.go | countSegment | func (counter *rayCrossingCounter) countSegment(p1, p2 geom.Coord) {
/**
* For each segment, check if it crosses
* a horizontal ray running from the test point in the positive x direction.
*/
// check if the segment is strictly to the left of the test point
if p1[0] < counter.p[0] && p2[0] < counter.p[0] {
... | go | func (counter *rayCrossingCounter) countSegment(p1, p2 geom.Coord) {
/**
* For each segment, check if it crosses
* a horizontal ray running from the test point in the positive x direction.
*/
// check if the segment is strictly to the left of the test point
if p1[0] < counter.p[0] && p2[0] < counter.p[0] {
... | [
"func",
"(",
"counter",
"*",
"rayCrossingCounter",
")",
"countSegment",
"(",
"p1",
",",
"p2",
"geom",
".",
"Coord",
")",
"{",
"/**\n\t * For each segment, check if it crosses\n\t * a horizontal ray running from the test point in the positive x direction.\n\t */",
"// check if the s... | /**
* Counts a segment
*
* @param p1 an endpoint of the segment
* @param p2 another endpoint of the segment
*/ | [
"Counts",
"a",
"segment"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/internal/raycrossing/ray-crossing-counter.go#L62-L137 |
29,697 | twpayne/go-geom | xy/line_centroid.go | NewLineCentroidCalculator | func NewLineCentroidCalculator(layout geom.Layout) *LineCentroidCalculator {
return &LineCentroidCalculator{
layout: layout,
stride: layout.Stride(),
centSum: geom.Coord(make([]float64, layout.Stride())),
}
} | go | func NewLineCentroidCalculator(layout geom.Layout) *LineCentroidCalculator {
return &LineCentroidCalculator{
layout: layout,
stride: layout.Stride(),
centSum: geom.Coord(make([]float64, layout.Stride())),
}
} | [
"func",
"NewLineCentroidCalculator",
"(",
"layout",
"geom",
".",
"Layout",
")",
"*",
"LineCentroidCalculator",
"{",
"return",
"&",
"LineCentroidCalculator",
"{",
"layout",
":",
"layout",
",",
"stride",
":",
"layout",
".",
"Stride",
"(",
")",
",",
"centSum",
":... | // NewLineCentroidCalculator creates a new instance of the calculator.
// Once a calculator is created polygons, linestrings or linear rings can be added and the
// GetCentroid method can be used at any point to get the current centroid
// the centroid will naturally change each time a geometry is added | [
"NewLineCentroidCalculator",
"creates",
"a",
"new",
"instance",
"of",
"the",
"calculator",
".",
"Once",
"a",
"calculator",
"is",
"created",
"polygons",
"linestrings",
"or",
"linear",
"rings",
"can",
"be",
"added",
"and",
"the",
"GetCentroid",
"method",
"can",
"b... | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/line_centroid.go#L64-L70 |
29,698 | twpayne/go-geom | xy/line_centroid.go | AddPolygon | func (calc *LineCentroidCalculator) AddPolygon(polygon *geom.Polygon) *LineCentroidCalculator {
for i := 0; i < polygon.NumLinearRings(); i++ {
calc.AddLinearRing(polygon.LinearRing(i))
}
return calc
} | go | func (calc *LineCentroidCalculator) AddPolygon(polygon *geom.Polygon) *LineCentroidCalculator {
for i := 0; i < polygon.NumLinearRings(); i++ {
calc.AddLinearRing(polygon.LinearRing(i))
}
return calc
} | [
"func",
"(",
"calc",
"*",
"LineCentroidCalculator",
")",
"AddPolygon",
"(",
"polygon",
"*",
"geom",
".",
"Polygon",
")",
"*",
"LineCentroidCalculator",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"polygon",
".",
"NumLinearRings",
"(",
")",
";",
"i",
"++",... | // AddPolygon adds a Polygon to the calculation. | [
"AddPolygon",
"adds",
"a",
"Polygon",
"to",
"the",
"calculation",
"."
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/line_centroid.go#L81-L87 |
29,699 | twpayne/go-geom | xy/line_centroid.go | AddLine | func (calc *LineCentroidCalculator) AddLine(line *geom.LineString) *LineCentroidCalculator {
coords := line.FlatCoords()
calc.addLine(coords, 0, len(coords))
return calc
} | go | func (calc *LineCentroidCalculator) AddLine(line *geom.LineString) *LineCentroidCalculator {
coords := line.FlatCoords()
calc.addLine(coords, 0, len(coords))
return calc
} | [
"func",
"(",
"calc",
"*",
"LineCentroidCalculator",
")",
"AddLine",
"(",
"line",
"*",
"geom",
".",
"LineString",
")",
"*",
"LineCentroidCalculator",
"{",
"coords",
":=",
"line",
".",
"FlatCoords",
"(",
")",
"\n",
"calc",
".",
"addLine",
"(",
"coords",
",",... | // AddLine adds a LineString to the current calculation | [
"AddLine",
"adds",
"a",
"LineString",
"to",
"the",
"current",
"calculation"
] | e21b3afba225b21d05fbcbeb8ece2c79c96554c5 | https://github.com/twpayne/go-geom/blob/e21b3afba225b21d05fbcbeb8ece2c79c96554c5/xy/line_centroid.go#L90-L94 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.