file

package
v0.0.0-...-ae1d368 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadShapeCollection

func LoadShapeCollection(path, name string) (*model.ShapeCollection, error)

LoadShapeCollection loads a prior saved file and deserializes it to a shape collection

func LoadShapes

func LoadShapes(path, name string) ([]geometry.Shape, error)

LoadShapes loads a prior saved file and deserializes it to a list of shapes

func ReadGeoJSONFeatureCollection

func ReadGeoJSONFeatureCollection(path, file string, inputType InputType) (geojson.FeatureCollection, error)

ReadGeoJSONFeatureCollection reads a GeoJSON feature collection and returns as a geojson-struct

func SaveShapeCollection

func SaveShapeCollection(path, name string, shapeCollection model.ShapeCollection) error

SaveShapeCollection saves the given shape collection to a gob-encoded file for later use

func SaveShapeCollectionFile

func SaveShapeCollectionFile(path, name string, shapeCollectionFile ShapeCollectionFile) error

SaveShapeCollectionFile saves the given shape collection to a gob-encoded file for later use

func SaveShapes

func SaveShapes(path, name string, shapes []geometry.Shape) error

SaveShapes saves the given shapes to a gob-encoded file for later use

func WatchIndexFolder

func WatchIndexFolder(path string) (chan WatchEvent, error)

WatchIndexFolder will watch given folder and return a channel which will publish a WatchEvent upon file changes for .gob files changed and if they contain a ShapeCollection

Types

type InputType

type InputType int

InputType Type of geoJSON input

const (
	// GeoJSON normal GeoJSON input
	GeoJSON InputType = 0
)

type ShapeCollectionFile

type ShapeCollectionFile struct {
	ShapeCollection model.ShapeCollection
	ShapeStore      geometry.ShapeStore
}

ShapeCollectionFile is a file representation of a complete ShapeCollection including its shapes

func LoadShapeCollectionFile

func LoadShapeCollectionFile(path, name string) (*ShapeCollectionFile, error)

LoadShapeCollectionFile loads a prior saved file and deserializes it to a shape collection along with a corresponding shape store

type WatchEvent

type WatchEvent struct {
	// Event is which kind of watch event type
	Event WatchEventType
	// Path is the path of the file
	Path string
	// ShapeCollection is the ShapeCollection for the event
	ShapeCollectionFile *ShapeCollectionFile
}

WatchEvent is the event you receive when a file has changed

type WatchEventType

type WatchEventType string

WatchEventType is the type of event received when a file has changed

const (
	// Updated means a file has been created or updated
	Updated WatchEventType = "updated"
	// Removed means a file has been removed
	Removed WatchEventType = "removed"
)

Jump to

Keyboard shortcuts

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