zoukankan      html  css  js  c++  java
  • Delphi版 创建SimpleRenderer专题地图[增强版]

    //对给定的图层的某一字段,用指定的颜色和样式创建专题

    function SimpleRenderer(pLayer: ILayer; sField: string; pColor: IColor; eStyle: TOleEnum): Boolean;
    var
      pSimpleRenderer: ISimpleRenderer;
      pSimpleFillSymbol: ISimpleFillSymbol;
      pSimpleMarkSymbol: ISimpleMarkerSymbol;
      pSimpleLineSymbol: ISimpleLineSymbol;
      pRenderer: ITransparencyRenderer;
      pGeoLayer: IGeoFeatureLayer;
    begin
      try
        pGeoLayer := pLayer as IGeoFeatureLayer;
        pSimpleRenderer := CoSimpleRenderer.Create as ISimpleRenderer;
        case (pLayer as IGeoFeatureLayer).FeatureClass.ShapeType of
          esriGeometryPoint, esriGeometryMultipoint:
            begin
              pSimpleMarkSymbol := CoSimpleMarkerSymbol.Create as ISimpleMarkerSymbol;
              pSimpleMarkSymbol.Color := pColor;
              pSimpleMarkSymbol.Style := esriSMSCircle;
              pSimpleMarkSymbol.Size := 7;
              pSimpleMarkSymbol.Outline := True;

              pSimpleRenderer.Symbol := pSimpleMarkSymbol as ISymbol;

            end;

          esriGeometryLine, esriGeometryPolyline:

            begin
              pSimpleLineSymbol := CoSimpleLineSymbol.Create as ISimpleLineSymbol;
              pSimpleLineSymbol.Color := pColor;
              pSimpleLineSymbol.Style := esriSLSSolid;
              pSimpleLineSymbol.Width := 2;
              pSimpleRenderer.Symbol := pSimpleLineSymbol as ISymbol;
            end;
          esriGeometryPolygon:
            begin
              pSimpleFillSymbol := CoSimpleFillSymbol.Create as ISimpleFillSymbol;
              pSimpleFillSymbol.Color := pColor as IColor;
              pSimpleFillSymbol.Style := eStyle;
              pSimpleRenderer.Symbol := pSimpleFillSymbol as ISymbol;
            end;
        end;
        pSimpleRenderer.Description := '透明度专题';
        pSimpleRenderer.Label_ := sField;
        pRenderer := pSimpleRenderer as ITransparencyRenderer;
        pRenderer.TransparencyField := sField;
        pGeoLayer.Renderer := pRenderer as IFeatureRenderer;
      except
        Result := False;
        Exit;
      end;
      Result := True;
    end;

     //注意调用了本函数后,别忘了刷新MapControl控件的视图啊。

  • 相关阅读:
    0911内容。
    0909学习内容。
    0908学习内容
    第二天的学习内容
    第一天的学习内容
    学习目的
    jquery parents() next() prev() 找父级别标签 找同级别标签
    JQuery each遍历A标签获取href 和 里面指定的值
    jquery怎么实现点击一个按钮控制一个div的显示和隐藏
    谷歌浏览器(Chrome)禁止浏览器缓存 设置
  • 原文地址:https://www.cnblogs.com/chinacodegear/p/1404305.html
Copyright © 2011-2022 走看看