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

  • 相关阅读:
    CalParcess.php.
    MyCalView.php
    接口
    抽象类
    方法重载(重写)/方法覆盖、魔术函数实现
    继承覆盖问题
    推荐算法之基于内容的推荐
    推荐算法之协同过滤
    reactor模式:主从式reactor
    reactor模式:多线程的reactor模式
  • 原文地址:https://www.cnblogs.com/chinacodegear/p/1404305.html
Copyright © 2011-2022 走看看