Permalink
Browse files

mapserver: support for text-min-path-length (numeric and auto)

  • Loading branch information...
olt committed Aug 22, 2017
1 parent ac53585 commit 62fa58db771712a9241ba42ceea97322103d1da4
Showing with 23 additions and 2 deletions.
  1. +13 −1 builder/mapserver/mapfile.go
  2. +10 −1 mss/spec.go
@@ -487,6 +487,16 @@ func (m *Map) addTextSymbolizer(b *Block, r mss.Rule, isLine bool) (styled bool)
style.AddNonNil("Font", fontNames)
}
var minFeatureSizeSet bool
if _, ok := r.Properties.GetString("text-min-path-length"); ok {
minFeatureSizeSet = true
style.Add("MinFeatureSize", "AUTO")
}
if minLength, ok := r.Properties.GetFloat("text-min-path-length"); ok {
minFeatureSizeSet = true
style.Add("MinFeatureSize", minLength)
}
style.Add("Type", "truetype")
if isLine {
angle, ok := r.Properties.GetString("text-placement")
@@ -497,7 +507,9 @@ func (m *Map) addTextSymbolizer(b *Block, r mss.Rule, isLine bool) (styled bool)
style.Add("Angle", "FOLLOW")
}
style.Add("MinFeatureSize", "AUTO")
if !minFeatureSizeSet {
style.Add("MinFeatureSize", "AUTO")
}
}
if wrapWidth, ok := r.Properties.GetFloat("text-wrap-width"); ok {
maxLength := wrapWidth / textSize
View
@@ -83,6 +83,15 @@ func isKeyword(keywords ...string) isValid {
}
}
func isKeywordOr(other isValid, keywords ...string) isValid {
return func(val interface{}) bool {
if other(val) {
return true
}
return isKeyword(keywords...)(val)
}
}
func isStops(val interface{}) bool {
vals, ok := val.([]Value)
if !ok {
@@ -376,7 +385,7 @@ func init() {
"text-justify-alignment": isJustifyAlignment,
"text-margin": isNumber,
"text-repeat-distance": isNumber,
"text-min-path-length": isNumber,
"text-min-path-length": isKeywordOr(isNumber, "auto"),
"text-rotate-displacement": isBool,
"text-upgright": isKeyword("auto", "auto-down", "left", "right", "left-only", "right-only"),
"text-simplify": isNumber,

0 comments on commit 62fa58d

Please sign in to comment.