models

package
v0.0.0-...-4afc424 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MapDataPath = "./static/maps/map.json"

Functions

func SaveMapData

func SaveMapData(buildings []*Building) error

Types

type Building

type Building struct {
	Floors      []*Floor `json:"floors,omitempty"`
	Name        string   `json:"name,omitempty"`
	SIS         string   `json:"sis,omitempty"`
	Position    *LatLng  `json:"position,omitempty"`
	Address     string
	Image       string
	Description string
}

func LoadMapData

func LoadMapData() ([]*Building, error)

func (Building) Meta

func (b Building) Meta() *Building

type BySIS

type BySIS []*Building

func (BySIS) Len

func (a BySIS) Len() int

func (BySIS) Less

func (a BySIS) Less(i, j int) bool

func (BySIS) Swap

func (a BySIS) Swap(i, j int)

type Coords

type Coords struct {
	North float64 `json:"north,omitempty"`
	South float64 `json:"south,omitempty"`
	East  float64 `json:"east,omitempty"`
	West  float64 `json:"west,omitempty"`
}

func (Coords) DLat

func (c Coords) DLat() float64

func (Coords) DLng

func (c Coords) DLng() float64

func (Coords) Overlap

func (c Coords) Overlap(c2 *Coords) bool

func (Coords) OverlapLatLng

func (c Coords) OverlapLatLng(p *LatLng) bool

type Floor

type Floor struct {
	Name     string  `json:"floor,omitempty"`
	Coords   *Coords `json:"coords,omitempty"`
	Image    string  `json:"image,omitempty"`
	Rooms    []*Room `json:"rooms,omitempty"`
	Rotation float64 `json:"rotation,omitempty"`

	RotatedImage draw.Image     `json:"-"`
	ImageWG      sync.WaitGroup `json:"-"`
	ImageOnce    sync.Once      `json:"-"`
}

func (*Floor) LoadImage

func (f *Floor) LoadImage() (draw.Image, error)

type Index

type Index struct {
	Id          string
	Name        string
	Type        string
	Image       string
	Description string

	Item interface{} `json:"-"`
}

type LatLng

type LatLng struct {
	Lat float64 `json:"H,omitempty"`
	Lng float64 `json:"L,omitempty"`
}

type Room

type Room struct {
	Id          string  `json:"id,omitempty"`
	SIS         string  `json:"sis,omitempty"`
	Name        string  `json:"name,omitempty"`
	Position    *LatLng `json:"position,omitempty"`
	RelPosition *LatLng `json:"rel_position,omitempty"`
	Type        string  `json:"type,omitempty"`
	Floor       string  `json:"floor,omitempty"`
}

type ZoomableCoord

type ZoomableCoord struct {
	*Coords

	Zoom  int    `json:"zoom,omitempty"`
	Floor string `json:"floor,omitempty"`
}

Jump to

Keyboard shortcuts

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