MapLayerInfo类代码

    根据SKY的要求,特给出MapLayerInfo类的代码,很简单:

public class MapLayerInfo
    {
        private IFeatureLayer _FeatureLayer = null;
        private IMap _Map = null;
        //图层的属性
        private string _FeatLyrName = null;
        private bool _Cached = false;
        private string _DataSourceType = null;
        private string _DisplayField = null;
        private double _MaximumScale = 0;
        private double _MinimunScale = 0;
        private bool _ScaleSymbols = false;
        private bool _Selectable = false;
        private bool _Visible = false;
        private bool _ShowTips = false;

        public MapLayerInfo(IFeatureLayer pFeatLyr, IMap pMap)
        {
            this._FeatureLayer = pFeatLyr;
            this._Map = pMap;

            this._FeatLyrName = pFeatLyr.Name;
            this._DataSourceType = pFeatLyr.DataSourceType;
            this._DisplayField = pFeatLyr.DisplayField;
            this._MaximumScale = pFeatLyr.MaximumScale;
            this._MinimunScale = pFeatLyr.MinimumScale;
            this._Cached = pFeatLyr.Cached;
            this._ScaleSymbols = pFeatLyr.ScaleSymbols;
            this._Selectable = pFeatLyr.Selectable;
            this._Visible = pFeatLyr.Visible;
            this._ShowTips = pFeatLyr.ShowTips;
        }

        //使用[CategoryAttribute("图层基本信息"),DefaultValueAttribute(true)]可以使得该属性在
        //PropertyGrid中显示时出现在“图层基本信息”栏中
        [CategoryAttribute("图层基本信息"), DefaultValueAttribute(true)]
        public string Name
        {
            get { return this._FeatLyrName; }
            set
            {
                this._FeatLyrName = value;
                this._FeatureLayer.Name = this._FeatLyrName;
            }
        }
        [CategoryAttribute("图层基本信息"), DefaultValueAttribute(true)]
        public string DataSourceType
        {
            get { return this._DataSourceType; }
            set
            {
                this._DataSourceType = value;
                this._FeatureLayer.DataSourceType = this._DataSourceType;
            }
        }
        [CategoryAttribute("显示信息"), DefaultValueAttribute(true)]
        public string DisplayField
        {
            get
            {
                return this._DisplayField;
            }
            set
            {
                this._DisplayField = value;
                this._FeatureLayer.DisplayField = this._DisplayField;
            }
        }
        [CategoryAttribute("显示信息"), DefaultValueAttribute(true)]
        public double MaximumScale
        {
            get { return this._MaximumScale; }
            set
            {
                this._MaximumScale = value;
                this._FeatureLayer.MaximumScale = this._MaximumScale;
            }
        }
        [CategoryAttribute("显示信息"), DefaultValueAttribute(true)]
        public double MinimumScale
        {
            get { return this._MinimunScale; }
            set
            {
                this._MinimunScale = value;
                this._FeatureLayer.MinimumScale = this._MinimunScale;
            }
        }
        [CategoryAttribute("杂项"), DefaultValueAttribute(true)]
        public bool Cached
        {
            get { return this._Cached; }
            set
            {
                this._Cached = value;
                this._FeatureLayer.Cached = this._Cached;
            }
        }
        [CategoryAttribute("杂项"), DefaultValueAttribute(true)]
        public bool Selectable
        {
            get { return this._Selectable; }
            set
            {
                this._Selectable = value;
                this._FeatureLayer.Selectable = this._Selectable;
            }
        }
        [CategoryAttribute("杂项"), DefaultValueAttribute(true)]
        public bool ScaleSymbols
        {
            get { return this._ScaleSymbols; }
            set
            {
                this._ScaleSymbols = value;
                this._FeatureLayer.ScaleSymbols = this._ScaleSymbols;
            }
        }
        [CategoryAttribute("杂项"), DefaultValueAttribute(true)]
        public bool Visible
        {
            get { return this._Visible; }
            set
            {
                this._Visible = value;
                this._FeatureLayer.Visible = this._Visible;
                IActiveView pAV = (IActiveView)this._Map;
                pAV.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            }
        }
        [CategoryAttribute("杂项"), DefaultValueAttribute(true)]
        public bool ShowTips
        {
            get { return this._ShowTips; }
            set
            {
                this._ShowTips = value;
                this._FeatureLayer.ShowTips = this._ShowTips;
            }
        }
    }

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值