According to the requirements of SKY, the MapLayerInfo class code is provided, which is very simple:
Public class MapLayerInfo
{
Private IFeatureLayer _ FeatureLayer = null;
Private IMap _ Map = null;
// Layer attributes
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;
}
// Use [CategoryAttribute ("layer basic information"), DefaultValueAttribute (true)]
// Displayed in the "layer basic information" column when PropertyGrid is displayed
[CategoryAttribute ("layer basic information"), DefaultValueAttribute (true)]
Public string Name
{
Get {return this. _ FeatLyrName ;}
Set
{
This. _ FeatLyrName = value;
This. _ FeatureLayer. Name = this. _ FeatLyrName;
}
}
[CategoryAttribute ("layer basic information"), DefaultValueAttribute (true)]
Public string DataSourceType
{
Get {return this. _ DataSourceType ;}
Set
{
This. _ DataSourceType = value;
This. _ FeatureLayer. DataSourceType = this. _ DataSourceType;
}
}
[CategoryAttribute ("display information"), DefaultValueAttribute (true)]
Public string DisplayField
{
Get
{
Return this. _ DisplayField;
}
Set
{
This. _ DisplayField = value;
This. _ FeatureLayer. DisplayField = this. _ DisplayField;
}
}
[CategoryAttribute ("display information"), DefaultValueAttribute (true)]
Public double MaximumScale
{
Get {return this. _ MaximumScale ;}
Set
{
This. _ MaximumScale = value;
This. _ FeatureLayer. MaximumScale = this. _ MaximumScale;
}
}
[CategoryAttribute ("display information"), DefaultValueAttribute (true)]
Public double MinimumScale
{
Get {return this. _ MinimunScale ;}
Set
{
This. _ MinimunScale = value;
This. _ FeatureLayer. MinimumScale = this. _ MinimunScale;
}
}
[CategoryAttribute ("Miscellaneous"), DefaultValueAttribute (true)]
Public bool Cached
{
Get {return this. _ Cached ;}
Set
{
This. _ Cached = value;
This. _ FeatureLayer. Cached = this. _ Cached;
}
}
[CategoryAttribute ("Miscellaneous"), DefaultValueAttribute (true)]
Public bool Selectable
{
Get {return this. _ Selectable ;}
Set
{
This. _ Selectable = value;
This. _ FeatureLayer. Selectable = this. _ Selectable;
}
}
[CategoryAttribute ("Miscellaneous"), DefaultValueAttribute (true)]
Public bool ScaleSymbols
{
Get {return this. _ ScaleSymbols ;}
Set
{
This. _ ScaleSymbols = value;
This. _ FeatureLayer. ScaleSymbols = this. _ ScaleSymbols;
}
}
[CategoryAttribute ("Miscellaneous"), 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 ("Miscellaneous"), DefaultValueAttribute (true)]
Public bool ShowTips
{
Get {return this. _ ShowTips ;}
Set
{
This. _ ShowTips = value;
This. _ FeatureLayer. ShowTips = this. _ ShowTips;
}
}
}