/// <summary>
        /// Executes the ClipPolygonWithLine Operation tool programaticaly.
        /// Ping deleted static for external testing 01/2010
        /// </summary>
        /// <param name="input1">The input Polygon FeatureSet.</param>
        /// <param name="input2">The input Polyline FeatureSet.</param>
        /// <param name="output">The output Polygon FeatureSet.</param>
        /// <param name="cancelProgressHandler">The progress handler.</param>
        /// <returns></returns>
        public bool Execute(IFeatureSet input1, IFeatureSet input2, IFeatureSet output, ICancelProgressHandler cancelProgressHandler)
        {
            //Validates the input and output data
            if (input1 == null || input2 == null || output == null)
            {
                return false;
            }
            if (cancelProgressHandler.Cancel)
                return false;
            IFeature polygon = input1.Features[0];
            IFeature line = input2.Features[0];
            IFeatureSet resultFS = new FeatureSet(FeatureTypes.Polygon);
            int previous = 0;
            if (DoClipPolygonWithLine(ref polygon, ref line, ref output) == false)
            {
                throw new SystemException(TextStrings.Exceptioninclipin);
            }
            int intFeature = output.Features.Count;
            for (int i = 0; i < intFeature; i++)
            {
                Polygon poly = new Polygon(output.Features[i].Coordinates);
                resultFS.AddFeature(poly);

                int current = Convert.ToInt32(Math.Round(i * 100D / intFeature));
                //only update when increment in percentage
                if (current > previous)
                    cancelProgressHandler.Progress("", current, current + TextStrings.progresscompleted);
                previous = current;
            }
            cancelProgressHandler.Progress("", 100, 100 + TextStrings.progresscompleted);
            resultFS.SaveAs(output.Filename, true);
            return true;
        }
 /// <summary>
 /// Handles the situation for exporting the layer as a new source.
 /// </summary>
 protected override void OnExportData()
 {
     ExportFeature frmExport = new ExportFeature();
     frmExport.Filename = DataSet.Filename;
     if (frmExport.ShowDialog() != DialogResult.OK) return;
     if (frmExport.FeaturesIndex == 0)
     {
         DataSet.SaveAs(frmExport.Filename, true);
     }
     else if (frmExport.FeaturesIndex == 1)
     {
         FeatureSet fs = _selection.ToFeatureSet();
         fs.SaveAs(frmExport.Filename, true);
     }
     else if (frmExport.FeaturesIndex == 2)
     {
         List<IFeature> features = DataSet.Select(MapFrame.Extents);
         FeatureSet fs = new FeatureSet(features);
         if (fs.Features.Count == 0)
         {
             fs.CopyTableSchema(DataSet);
         }
         fs.SaveAs(frmExport.Filename, true);               
     }
     AddToMapDialog dlgAddLayer = new AddToMapDialog();
     if (dlgAddLayer.ShowDialog() != DialogResult.OK) return;
     if (dlgAddLayer.AddLayer == false) return;
     IFeatureLayer newLayer = OpenFile(frmExport.Filename) as IFeatureLayer;
     IGroup parent = GetParentItem() as IGroup;
     if (parent != null)
     {
         int index = parent.IndexOf(this);
         if (newLayer != null)
         {
             parent.Insert(index + 1, newLayer);
         }
     }
 }