models

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package models provides common types modelled after entities in the ASTM standard.

Index

Constants

View Source
const (
	// TimeFormatRFC3339 is the string used for RFC3339
	TimeFormatRFC3339 = "RFC3339"
)

Variables

View Source
var (
	// ErrMissingSpatialVolume indicates that a spatial volume is required but
	// missing to complete an operation.
	ErrMissingSpatialVolume = errors.New("missing spatial volume")
	// ErrMissingFootprint indicates that a geometry footprint is required but
	// missing to complete an operation.
	ErrMissingFootprint = errors.New("missing footprint")
)

Functions

This section is empty.

Types

type GeoCircle

type GeoCircle struct {
	Center      LatLngPoint
	RadiusMeter float32
}

GeoCircle models a circular enclosed area on earth's surface.

func GeoCircleFromSCDProto

func GeoCircleFromSCDProto(c *scdpb.Circle) *GeoCircle

GeoCircleFromSCDProto converts a circle proto to a GeoCircle

func (*GeoCircle) CalculateCovering

func (gc *GeoCircle) CalculateCovering() (s2.CellUnion, error)

CalculateCovering returns the spatial covering of gc.

func (*GeoCircle) ToSCDProto

func (gc *GeoCircle) ToSCDProto() *scdpb.Circle

ToSCDProto converts the GeoCircle to a proto

type GeoPolygon

type GeoPolygon struct {
	Vertices []*LatLngPoint
}

GeoPolygon models an enclosed area on the earth. The bounding edges of this polygon shall be the shortest paths between connected vertices. This means, for instance, that the edge between two points both defined at a particular latitude is not generally contained at that latitude. The winding order shall be interpreted as the order which produces the smaller area. The path between two vertices shall be the shortest possible path between those vertices. Edges may not cross. Vertices may not be duplicated. In particular, the final polygon vertex shall not be identical to the first vertex.

func GeoPolygonFromRIDProto

func GeoPolygonFromRIDProto(footprint *ridpb.GeoPolygon) *GeoPolygon

GeoPolygonFromRIDProto convert proto to model object

func GeoPolygonFromSCDProto

func GeoPolygonFromSCDProto(p *scdpb.Polygon) *GeoPolygon

GeoPolygonFromSCDProto converts a polygon proto to a GeoPolygon

func (*GeoPolygon) CalculateCovering

func (gp *GeoPolygon) CalculateCovering() (s2.CellUnion, error)

CalculateCovering returns the spatial covering of gp.

func (*GeoPolygon) ToRIDProto

func (gp *GeoPolygon) ToRIDProto() *ridpb.GeoPolygon

ToRIDProto converts GeoPolygon model obj to proto

func (*GeoPolygon) ToSCDProto

func (gp *GeoPolygon) ToSCDProto() *scdpb.Polygon

ToSCDProto converts the GeoPolygon to a proto

type Geometry

type Geometry interface {
	// CalculateCovering returns an s2 cell covering for a geometry.
	CalculateCovering() (s2.CellUnion, error)
}

Geometry models a geometry.

type GeometryFunc

type GeometryFunc func() (s2.CellUnion, error)

GeometryFunc is an implementation of Geometry

func (GeometryFunc) CalculateCovering

func (gf GeometryFunc) CalculateCovering() (s2.CellUnion, error)

CalculateCovering returns the result of invoking gf.

type ID

type ID string

ID represents a UUID string.

func (ID) String

func (id ID) String() string

type LatLngPoint

type LatLngPoint struct {
	Lat float64
	Lng float64
}

LatLngPoint models a point on the earth's surface.

func LatLngPointFromSCDProto

func LatLngPointFromSCDProto(p *scdpb.LatLngPoint) *LatLngPoint

LatLngPointFromSCDProto converts a point proto to a latlngpoint

func PointFromRIDProto

func PointFromRIDProto(pt *ridpb.LatLngPoint) *LatLngPoint

PointFromRIDProto convert proto to model object

func (*LatLngPoint) ToRIDProto

func (pt *LatLngPoint) ToRIDProto() *ridpb.LatLngPoint

ToRIDProto converts latlngpoint model obj to proto

func (*LatLngPoint) ToSCDProto

func (pt *LatLngPoint) ToSCDProto() *scdpb.LatLngPoint

ToSCDProto converts the LatLngPoint to a proto

type Owner

type Owner string

Owner is the owner taken from the oauth token.

func (Owner) String

func (owner Owner) String() string

type Version

type Version struct {
	// contains filtered or unexported fields
}

Version represents a version, which can be supplied as a commit timestamp or a string.

func VersionFromString

func VersionFromString(s string) (*Version, error)

VersionFromString converts a version, typically provided from a user, to a Version struct.

func VersionFromTime

func VersionFromTime(t time.Time) *Version

VersionFromTime converts a timestamp, typically from the database, to a Version struct.

func (*Version) Empty

func (v *Version) Empty() bool

Empty checks if the version is nil.

func (*Version) Matches

func (v *Version) Matches(v2 *Version) bool

Matches returns true if 2 versions are equal.

func (*Version) Scan

func (v *Version) Scan(src interface{}) error

Scan implements database/sql's scan interface.

func (*Version) String

func (v *Version) String() string

String returns the string representation of a version.

func (*Version) ToTimestamp

func (v *Version) ToTimestamp() time.Time

ToTimestamp converts the version back its commit timestamp.

type Volume3D

type Volume3D struct {
	// Maximum bounding altitude (meters above the WGS84 ellipsoid) of this volume.
	AltitudeHi *float32
	// Minimum bounding altitude (meters above the WGS84 ellipsoid) of this volume.
	AltitudeLo *float32
	// Projection of this volume onto the earth's surface.
	Footprint Geometry
}

Volume3D is A three-dimensional geographic volume consisting of a vertically-extruded shape.

func Volume3DFromRIDProto

func Volume3DFromRIDProto(vol3 *ridpb.Volume3D) (*Volume3D, error)

Volume3DFromRIDProto convert proto to model object

func Volume3DFromSCDProto

func Volume3DFromSCDProto(vol3 *scdpb.Volume3D) (*Volume3D, error)

Volume3DFromSCDProto converts a vol3 proto to a Volume3D

func (*Volume3D) CalculateCovering

func (vol3 *Volume3D) CalculateCovering() (s2.CellUnion, error)

CalculateCovering returns the spatial covering of vol3.

func (*Volume3D) ToRIDProto

func (vol3 *Volume3D) ToRIDProto() (*ridpb.Volume3D, error)

ToRIDProto converts Volume3D model obj to proto

func (*Volume3D) ToSCDProto

func (vol3 *Volume3D) ToSCDProto() (*scdpb.Volume3D, error)

ToSCDProto converts the Volume3D to a proto

type Volume4D

type Volume4D struct {
	// Constant spatial extent of this volume.
	SpatialVolume *Volume3D
	// End time of this volume.
	EndTime *time.Time
	// Beginning time of this volume.
	StartTime *time.Time
}

Volume4D is a Contiguous block of geographic spacetime.

func UnionVolumes4D

func UnionVolumes4D(volumes ...*Volume4D) (*Volume4D, error)

UnionVolumes4D unions volumes and returns a volume that covers all the individual volumes in space and time.

func Volume4DFromRIDProto

func Volume4DFromRIDProto(vol4 *ridpb.Volume4D) (*Volume4D, error)

Volume4DFromRIDProto convert proto to model object

func Volume4DFromSCDProto

func Volume4DFromSCDProto(vol4 *scdpb.Volume4D) (*Volume4D, error)

Volume4DFromSCDProto converts vol4 proto to a Volume4D

func (*Volume4D) CalculateSpatialCovering

func (vol4 *Volume4D) CalculateSpatialCovering() (s2.CellUnion, error)

CalculateSpatialCovering returns the spatial covering of vol4.

func (*Volume4D) ToRIDProto

func (vol4 *Volume4D) ToRIDProto() (*ridpb.Volume4D, error)

ToRIDProto converts Volume4D model obj to proto

func (*Volume4D) ToSCDProto

func (vol4 *Volume4D) ToSCDProto() (*scdpb.Volume4D, error)

ToSCDProto converts the Volume4D to a proto

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL