/// <summary>
 /// Sets min visible scale to current scale
 /// </summary>
 private void btnSetMinScale_Click(object sender, EventArgs e)
 {
     MapWinGIS.Map map = m_legend.Map;
     if (map != null)
     {
         cboMinScale.Text = map.CurrentScale.ToString();
         btnApply.Enabled = true;
     }
 }
 /// <summary>
 /// Saves layer name from user input
 /// </summary>
 private void txtComments_Validated(object sender, EventArgs e)
 {
     MapWinGIS.Map map = _legend.Map;
     if (map != null)
     {
         map.set_LayerDescription(_layerHandle, txtComments.Text);
         MarkStateChanged();
     }
 }
 /// <summary>
 /// Saves layer name from user input
 /// </summary>
 private void txtComments_KeyPress(object sender, KeyPressEventArgs e)
 {
     MapWinGIS.Map map = _legend.Map;
     if (map != null)
     {
         if (e.KeyChar == (char)Keys.Enter)
         {
             map.set_LayerDescription(_layerHandle, txtComments.Text);
             MarkStateChanged();
         }
     }
 }
        /// <summary>
        /// Initializes the state of dynamic visibility controls
        /// </summary>
        private void InitVisibilityTab()
        {
            scaleLayer.Locked = true;

            Layer layer = _layer;

            scaleLayer.MaximumScale         = layer.MaxVisibleScale;
            scaleLayer.MinimimScale         = layer.MinVisibleScale;
            scaleLayer.UseDynamicVisibility = layer.UseDynamicVisibility;

            MapWinGIS.Map map = _legend.Map;
            scaleLayer.CurrentScale = map.CurrentScale;

            ShpfileType type  = Globals.ShapefileType2D(_shapefile.ShapefileType);
            uint        color = (type == ShpfileType.SHP_POLYLINE)? _shapefile.DefaultDrawingOptions.LineColor : _shapefile.DefaultDrawingOptions.FillColor;

            scaleLayer.FillColor = Colors.UintToColor(color);

            scaleLayer.Locked = false;
        }
        private string GetLayerDescription()
        {
            string s = "";

            MapWinGIS.Map map = _legend.Map;
            if (map != null)
            {
                txtComments.Text = map.get_LayerDescription(_layerHandle);
            }

            MapWinGIS.Extents ext = _shapefile.Extents;
            //string units = Globals.get_MapUnits();
            string units = "";
            string type  = _shapefile.ShapefileType.ToString().Substring(4).ToLower() + " shapefile";

            var layer = map.get_OgrLayer(_layerHandle);

            if (layer != null)
            {
                s += "Datasource type: OGR layer" + Environment.NewLine;
                s += "Driver name: " + layer.DriverName + Environment.NewLine;
                s += "Connection string: " + layer.GetConnectionString() + Environment.NewLine;
                s += "Layer type: " + layer.SourceType.ToString() + Environment.NewLine;
                s += "Name or query: " + layer.GetSourceQuery() + Environment.NewLine;
                s += "Support editing: " + layer.SupportsEditing[tkOgrSaveType.ostSaveAll] + Environment.NewLine;
                s += "Dynamic loading: " + layer.DynamicLoading + "\n";
            }
            else
            {
                s += "Datasource type: ESRI Shapefile" + Environment.NewLine;
            }

            s += "Type: " + type + Environment.NewLine +
                 "Number of shapes: " + _shapefile.NumShapes + Environment.NewLine +
                 "Selected: " + _shapefile.NumSelected + Environment.NewLine +
                 "Source: " + _shapefile.Filename + Environment.NewLine +
                 "Bounds X: " + String.Format("{0:F2}", ext.xMin) + " to " + String.Format("{0:F2}", ext.xMax) + units + Environment.NewLine +
                 "Bounds Y: " + String.Format("{0:F2}", ext.yMin) + " to " + String.Format("{0:F2}", ext.yMax) + units + Environment.NewLine +
                 "Projection: " + _shapefile.Projection;
            return(s);
        }