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控件的视图啊。

  • 相关阅读:
    面向对象知识点2
    面向对象知识点1
    面向对象知识点
    常用模块
    模块与包
    迭代器相关知识
    jquery.jqprint-0.3.js打印功能 以及页眉页脚设置显示与否
    js和layerjs配合实现的拖拽表格列
    iframe中跳转页面的区别
    select3搜索下拉树
  • 原文地址:https://www.cnblogs.com/chinacodegear/p/1404305.html
Copyright © 2011-2022 走看看