cartodb-4.42/lib/carto/styles/line.rb

31 lines
764 B
Ruby
Raw Normal View History

2024-04-06 13:25:13 +08:00
require_relative './style.rb'
require_relative '../definition.rb'
module Carto::Styles
class Line < Style
def initialize(definition: default_definition)
super(definition)
end
def self.accepted_geometry_types
['line', 'multiline', 'linestring', 'multilinestring', 'st_multipoint', 'st_linestring', 'st_multilinestring']
end
def default_definition
Carto::Definition.instance.load_from_file(CARTOGRAPHY_DEFINITION_LOCATION)[:simple][:line]
end
private
def parse_stroke(stroke)
width = stroke[:size][:fixed]
color = stroke[:color][:fixed]
opacity = stroke[:color][:opacity]
["line-color: #{color};",
"line-width: #{width};",
"line-opacity: #{opacity};"]
end
end
end