zoukankan      html  css  js  c++  java
  • SLD 样式 之 labels with graphics

            最近在配地图的样式,遇到一个问题,就是像 的道路lables不知如何定义,在网上几番搜索发现lables中得

    <TextSymbolizer>标签中也可以添加 <Graphic>标签。
    具体sld样式如下:
     1  <TextSymbolizer>
    2 <Label>
    3 <ogc:PropertyName>name</ogc:PropertyName>
    4 </Label>
    5 <Font>
    6 <CssParameter name="font-family">宋体</CssParameter>
    7 <CssParameter name="font-size">12</CssParameter>
    8 <CssParameter name="font-weight">bold</CssParameter>
    9 </Font>
    10 <LabelPlacement>
    11 <PointPlacement>
    12 <AnchorPoint>
    13 <AnchorPointX>0.5</AnchorPointX>
    14 <AnchorPointY>0.5</AnchorPointY>
    15 </AnchorPoint>
    16 </PointPlacement>
    17 </LabelPlacement>
    18 <Fill>
    19 <CssParameter name="fill">#FFFFFF</CssParameter>
    20 </Fill>
    21 <Graphic>
    22 <Mark>
    23 <WellKnownName>square</WellKnownName>
    24 <Fill>
    25 <CssParameter name="fill">#59BF34</CssParameter>
    26 </Fill>
    27 <Stroke>
    28 <CssParameter name="stroke">#2D6917</CssParameter>
    29 </Stroke>
    30 </Mark>
    31 <Size>24</Size>
    32 </Graphic>
    33 <VendorOption name="graphic-resize">stretch</VendorOption>
    34 <VendorOption name="graphic-margin">3</VendorOption>
    35 <VendorOption name="group">true</VendorOption>
    36 <VendorOption name="repeat">200</VendorOption>
    37 <VendorOption name="maxDisplacement">50</VendorOption>
    38 </TextSymbolizer>

    
    
     其中graphic-resize模式有如下三种: none,proportional, stretch

    效果:                      

    要实现或更漂亮的背景可以使用<ExternalGraphic>

    <ExternalGraphic>
    <OnlineResource xlink:type="simple"
    xlink:href
    ="http://......jpg" />
    <Format>image/jpeg</Format>
    </ExternalGraphic>

    相应的在<LineSymbolizer> 和<PolygonSymbolizer>

    也可以添加<Graphic>标签

    <LineSymbolizer>
    <Stroke>
    <GraphicStroke>
    <Graphic>
    <Mark>
    <WellKnownName>shape://vertline</WellKnownName>
    <Stroke/>
    </Mark><Size>7</Size>
    </Graphic>
    </GraphicStroke>
    </Stroke>
    </LineSymbolizer>
    <PolygonSymbolizer>
    <Fill>
    <GraphicFill><Graphic>
    <Mark>
    <WellKnownName>shape://slash</WellKnownName>
    <Stroke />
    </Mark><Size>10</Size>
    </Graphic></GraphicFill>
    </Fill>
    <Stroke/>
    </PolygonSymbolizer>
    
    






  • 相关阅读:
    touch:创建文件及修改文件时间戳
    stat:查看文件时间参数
    获取二维数组里面实际存有数据的行数
    Math.Atan2 方法
    c#移位运算符("<<"及">>")
    c# 一维数组和二维数组的几种定义方式<转>
    C#异常处理总结
    C#图片灰度处理(位深度24→位深度8)、C#图片二值化处理(位深度8→位深度1)
    WinForm窗体及其控件的自适应
    C#的WinForm窗体美化
  • 原文地址:https://www.cnblogs.com/shitao/p/2397615.html
Copyright © 2011-2022 走看看