config

package
v0.0.0-...-9050db6 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const NOT_LOADED_ERR = "no loaded styles were found"
View Source
const NO_STYLE_ERR = "no corresponding style found"

Variables

This section is empty.

Functions

func ParseColor

func ParseColor(colorStr string) (*color.RGBA, error)

func ParseHexColor

func ParseHexColor(hexColor string) (*color.RGBA, error)

ParseHexColor returns a color type which was parsed from a raw hex color string. Adapted from here: https://stackoverflow.com/questions/54197913/parse-hex-string-to-image-color

func ParseRGBAColor

func ParseRGBAColor(rgbaColor string) (*color.RGBA, error)

ParseRGBAColor parses an rgba color string.

Types

type Config

type Config struct {
	UseMap  bool
	Verbose bool
	// contains filtered or unexported fields
}

func (*Config) GetFillColor

func (c *Config) GetFillColor() (*color.RGBA, error)

func (*Config) GetLandFillColor

func (c *Config) GetLandFillColor() (*color.RGBA, error)

func (*Config) GetLandStrokeColor

func (c *Config) GetLandStrokeColor() (*color.RGBA, error)

func (*Config) GetLandStrokeWidth

func (c *Config) GetLandStrokeWidth() (float64, error)

func (*Config) GetStyles

func (c *Config) GetStyles() *StyleConfig

func (*Config) Parse

func (c *Config) Parse(source []byte) error

func (*Config) ParseFile

func (c *Config) ParseFile(filename string) error

func (*Config) Query

func (c *Config) Query(attribute, value string) (*FeatureStyle, error)

func (*Config) QueryId

func (c *Config) QueryId(wayId int64) (*FeatureStyle, error)

func (*Config) ShowAll

func (c *Config) ShowAll() bool

type FeatureQuery

type FeatureQuery struct {
	Attribute string
	Value     string
}

type FeatureStyle

type FeatureStyle struct {
	Queries       []FeatureQuery
	WayIdQueries  []int64        `yaml:"way_id_queries"`
	WayIdExcludes []int64        `yaml:"way_id_excludes"`
	Exclude       []FeatureQuery `yaml:"exclude"`
	StrokeWidth   float64        `yaml:"stroke_width"`
	StrokeColor   string         `yaml:"stroke_color"`
	FillColor     string         `yaml:"fill_color"`
	ZIndex        int            `yaml:"z_index"`
	Dashed        bool
}

func (*FeatureStyle) ShouldExclude

func (fs *FeatureStyle) ShouldExclude(tagMap map[string]string, wayID osm.WayID) bool

ShouldExclude takes in a map of tags (from an OSM Way) and returns whether the style should be excluded or not.

type FeatureStyleMap

type FeatureStyleMap map[string]map[string]*FeatureStyle

type LandStyle

type LandStyle struct {
	FillColor   string  `yaml:"fill_color"`
	StrokeWidth float64 `yaml:"stroke_width"`
	StrokeColor string  `yaml:"stroke_color"`
}

type StyleConfig

type StyleConfig struct {
	FillColor string `yaml:"fill_color"`
	Land      LandStyle
	ShowAll   bool `yaml:"show_all"`
	Styles    []FeatureStyle
}

Jump to

Keyboard shortcuts

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