mapDrawer

package module
v0.0.0-...-2a43d44 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2019 License: LGPL-3.0 Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Project Title

Draw map with features in multiple formats. Writen in go

Installing

Install as usually

go get -u github.com/elektro/mapdrawer

License

This project is licensed under the LGPL-3.0 License - see the LICENSE.md file for details

Documentation

Overview

Package mapDrawer is a generated protocol buffer package.

It is generated from these files:

mvt.proto

It has these top-level messages:

Tile

Index

Constants

View Source
const Default_Tile_Feature_Id uint64 = 0
View Source
const Default_Tile_Layer_Extent uint32 = 4096
View Source
const Default_Tile_Layer_Version uint32 = 1

Variables

View Source
var CacheManager cache
View Source
var Tile_GeomType_name = map[int32]string{
	0: "UNKNOWN",
	1: "POINT",
	2: "LINESTRING",
	3: "POLYGON",
}
View Source
var Tile_GeomType_value = map[string]int32{
	"UNKNOWN":    0,
	"POINT":      1,
	"LINESTRING": 2,
	"POLYGON":    3,
}

Functions

func DownloadUrl

func DownloadUrl(du downloadUrl)

func DrawPath

func DrawPath(gc draw2d.GraphicContext, d string, scale float64)

func NewCacheHd

func NewCacheHd(dir string) (*cacheHd, error)

func StringToColor

func StringToColor(scol string) (color.Color, error)

Types

type Converter

type Converter struct {
	Width      int
	Height     int
	TilePixelX int
	TilePixelY int
	MinLoc     [2]float64
	MaxLoc     [2]float64
	Zoom       uint8

	Gc draw2d.GraphicContext
	// contains filtered or unexported fields
}

func (*Converter) GetXY

func (c *Converter) GetXY(ll [2]float64) (x, y float64)

type Drawer

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

func NewDrawer

func NewDrawer(gc draw2d.GraphicContext, w, h, margin int) *Drawer

func (*Drawer) Add

func (d *Drawer) Add(do DrawerObject)

func (*Drawer) Draw

func (d *Drawer) Draw()

func (*Drawer) GetBounds

func (d *Drawer) GetBounds() (float64, float64, float64, float64, uint8)

func (*Drawer) GetSize

func (d *Drawer) GetSize() (int, int)

func (*Drawer) Prepend

func (d *Drawer) Prepend(do DrawerObject)

func (*Drawer) SetDrawAreaFromDraw

func (d *Drawer) SetDrawAreaFromDraw()

type DrawerObject

type DrawerObject interface {
	Draw(*Converter)
	GetLocs() [][2]float64
}

type DrawerTile

type DrawerTile interface {
	Draw(*Converter)
}

type ImageTile

type ImageTile struct {
	Url    string
	Name   string
	Mirror []string
}

func ImageTileStreetMap

func ImageTileStreetMap() *ImageTile

func (*ImageTile) Draw

func (i *ImageTile) Draw(c *Converter)

type Marker

type Marker struct {
	Size        Size         `json:"size"`
	Stroke      float64      `json:stroke`
	Radius      float64      `json:radius`
	FillColor   string       `json:"fillcolor"`
	StrokeColor string       `json:"strokecolor"`
	Label       string       `json:"label"`
	Shape       ShapeType    `json:"ShapeType"`
	Icon        string       `json:"icon"`
	Locs        [][2]float64 `json:"locs"`
}

func (*Marker) Draw

func (m *Marker) Draw(c *Converter)

func (*Marker) GetLocs

func (m *Marker) GetLocs() [][2]float64

type Path

type Path struct {
	Color    string       `json:"color"`
	Locs     [][2]float64 `json:"locs"`
	Weight   float64      `json:"weight"`
	GeoDesic bool         `json:"geodesic"`
	Arrow    bool         `json:"arrow"`
	// contains filtered or unexported fields
}

func (*Path) Draw

func (p *Path) Draw(c *Converter)

func (*Path) GetLocs

func (p *Path) GetLocs() [][2]float64

type ShapeType

type ShapeType uint8
const (
	MarkShape ShapeType = ShapeType(iota)
	CircleShape
)

type Size

type Size uint8

func (*Size) UnmarshalJSON

func (s *Size) UnmarshalJSON(b []byte) error

type Tile

type Tile struct {
	Layers           []*Tile_Layer             `protobuf:"bytes,3,rep,name=layers" json:"layers,omitempty"`
	XXX_extensions   map[int32]proto.Extension `json:"-"`
	XXX_unrecognized []byte                    `json:"-"`
}

func (*Tile) ExtensionMap

func (m *Tile) ExtensionMap() map[int32]proto.Extension

func (*Tile) ExtensionRangeArray

func (*Tile) ExtensionRangeArray() []proto.ExtensionRange

func (*Tile) GetLayers

func (m *Tile) GetLayers() []*Tile_Layer

func (*Tile) ProtoMessage

func (*Tile) ProtoMessage()

func (*Tile) Reset

func (m *Tile) Reset()

func (*Tile) String

func (m *Tile) String() string

type Tile_Feature

type Tile_Feature struct {
	Id *uint64 `protobuf:"varint,1,opt,name=id,def=0" json:"id,omitempty"`
	// Tags of this feature are encoded as repeated pairs of
	// integers.
	// A detailed description of tags is located in sections
	// 4.2 and 4.4 of the specification
	Tags []uint32 `protobuf:"varint,2,rep,packed,name=tags" json:"tags,omitempty"`
	// The type of geometry stored in this feature.
	Type *Tile_GeomType `protobuf:"varint,3,opt,name=type,enum=vector_tile.Tile_GeomType,def=0" json:"type,omitempty"`
	// Contains a stream of commands and parameters (vertices).
	// A detailed description on geometry encoding is located in
	// section 4.3 of the specification.
	Geometry         []uint32 `protobuf:"varint,4,rep,packed,name=geometry" json:"geometry,omitempty"`
	XXX_unrecognized []byte   `json:"-"`
}

Features are described in section 4.2 of the specification

func (*Tile_Feature) GetGeometry

func (m *Tile_Feature) GetGeometry() []uint32

func (*Tile_Feature) GetId

func (m *Tile_Feature) GetId() uint64

func (*Tile_Feature) GetTags

func (m *Tile_Feature) GetTags() []uint32

func (*Tile_Feature) GetType

func (m *Tile_Feature) GetType() Tile_GeomType

func (*Tile_Feature) ProtoMessage

func (*Tile_Feature) ProtoMessage()

func (*Tile_Feature) Reset

func (m *Tile_Feature) Reset()

func (*Tile_Feature) String

func (m *Tile_Feature) String() string

type Tile_GeomType

type Tile_GeomType int32

GeomType is described in section 4.3.4 of the specification

const (
	Tile_UNKNOWN    Tile_GeomType = 0
	Tile_POINT      Tile_GeomType = 1
	Tile_LINESTRING Tile_GeomType = 2
	Tile_POLYGON    Tile_GeomType = 3
)
const Default_Tile_Feature_Type Tile_GeomType = Tile_UNKNOWN

func (Tile_GeomType) Enum

func (x Tile_GeomType) Enum() *Tile_GeomType

func (Tile_GeomType) String

func (x Tile_GeomType) String() string

func (*Tile_GeomType) UnmarshalJSON

func (x *Tile_GeomType) UnmarshalJSON(data []byte) error

type Tile_Layer

type Tile_Layer struct {
	// Any compliant implementation must first read the version
	// number encoded in this message and choose the correct
	// implementation for this version number before proceeding to
	// decode other parts of this message.
	Version *uint32 `protobuf:"varint,15,req,name=version,def=1" json:"version,omitempty"`
	Name    *string `protobuf:"bytes,1,req,name=name" json:"name,omitempty"`
	// The actual features in this tile.
	Features []*Tile_Feature `protobuf:"bytes,2,rep,name=features" json:"features,omitempty"`
	// Dictionary encoding for keys
	Keys []string `protobuf:"bytes,3,rep,name=keys" json:"keys,omitempty"`
	// Dictionary encoding for values
	Values []*Tile_Value `protobuf:"bytes,4,rep,name=values" json:"values,omitempty"`
	// Although this is an "optional" field it is required by the specification.
	// See https://github.com/mapbox/vector-tile-spec/issues/47
	Extent           *uint32                   `protobuf:"varint,5,opt,name=extent,def=4096" json:"extent,omitempty"`
	XXX_extensions   map[int32]proto.Extension `json:"-"`
	XXX_unrecognized []byte                    `json:"-"`
}

Layers are described in section 4.1 of the specification

func (*Tile_Layer) ExtensionMap

func (m *Tile_Layer) ExtensionMap() map[int32]proto.Extension

func (*Tile_Layer) ExtensionRangeArray

func (*Tile_Layer) ExtensionRangeArray() []proto.ExtensionRange

func (*Tile_Layer) GetExtent

func (m *Tile_Layer) GetExtent() uint32

func (*Tile_Layer) GetFeatures

func (m *Tile_Layer) GetFeatures() []*Tile_Feature

func (*Tile_Layer) GetKeys

func (m *Tile_Layer) GetKeys() []string

func (*Tile_Layer) GetName

func (m *Tile_Layer) GetName() string

func (*Tile_Layer) GetValues

func (m *Tile_Layer) GetValues() []*Tile_Value

func (*Tile_Layer) GetVersion

func (m *Tile_Layer) GetVersion() uint32

func (*Tile_Layer) ProtoMessage

func (*Tile_Layer) ProtoMessage()

func (*Tile_Layer) Reset

func (m *Tile_Layer) Reset()

func (*Tile_Layer) String

func (m *Tile_Layer) String() string

type Tile_Value

type Tile_Value struct {
	// Exactly one of these values must be present in a valid message
	StringValue      *string                   `protobuf:"bytes,1,opt,name=string_value" json:"string_value,omitempty"`
	FloatValue       *float32                  `protobuf:"fixed32,2,opt,name=float_value" json:"float_value,omitempty"`
	DoubleValue      *float64                  `protobuf:"fixed64,3,opt,name=double_value" json:"double_value,omitempty"`
	IntValue         *int64                    `protobuf:"varint,4,opt,name=int_value" json:"int_value,omitempty"`
	UintValue        *uint64                   `protobuf:"varint,5,opt,name=uint_value" json:"uint_value,omitempty"`
	SintValue        *int64                    `protobuf:"zigzag64,6,opt,name=sint_value" json:"sint_value,omitempty"`
	BoolValue        *bool                     `protobuf:"varint,7,opt,name=bool_value" json:"bool_value,omitempty"`
	XXX_extensions   map[int32]proto.Extension `json:"-"`
	XXX_unrecognized []byte                    `json:"-"`
}

Variant type encoding The use of values is described in section 4.1 of the specification

func (*Tile_Value) ExtensionMap

func (m *Tile_Value) ExtensionMap() map[int32]proto.Extension

func (*Tile_Value) ExtensionRangeArray

func (*Tile_Value) ExtensionRangeArray() []proto.ExtensionRange

func (*Tile_Value) GetBoolValue

func (m *Tile_Value) GetBoolValue() bool

func (*Tile_Value) GetDoubleValue

func (m *Tile_Value) GetDoubleValue() float64

func (*Tile_Value) GetFloatValue

func (m *Tile_Value) GetFloatValue() float32

func (*Tile_Value) GetIntValue

func (m *Tile_Value) GetIntValue() int64

func (*Tile_Value) GetSintValue

func (m *Tile_Value) GetSintValue() int64

func (*Tile_Value) GetStringValue

func (m *Tile_Value) GetStringValue() string

func (*Tile_Value) GetUintValue

func (m *Tile_Value) GetUintValue() uint64

func (*Tile_Value) ProtoMessage

func (*Tile_Value) ProtoMessage()

func (*Tile_Value) Reset

func (m *Tile_Value) Reset()

func (*Tile_Value) String

func (m *Tile_Value) String() string

Jump to

Keyboard shortcuts

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