Beispiel #1
0
        public static void ExtractSpecifyHRegFeatures(IWorkspaceName iworkspaceName_0, IMap imap_0,
                                                      IGeometry igeometry_0, IMap imap_1)
        {
            (new SelectionEnvironment()).CombinationMethod = esriSelectionResultEnum.esriSelectionResultNew;
            IWorkspace workspace = (iworkspaceName_0 as IName).Open() as IWorkspace;

            for (int i = imap_0.LayerCount - 1; i >= 0; i--)
            {
                ILayer layer = imap_0.Layer[i];
                if ((!layer.Visible ? false : layer is IFeatureLayer))
                {
                    try
                    {
                        IEnvelope            areaOfInterest      = layer.AreaOfInterest;
                        ITopologicalOperator topologicalOperator = (ITopologicalOperator)((IClone)igeometry_0).Clone();
                        topologicalOperator.Simplify();
                        if (topologicalOperator.IsSimple)
                        {
                            topologicalOperator.Clip(areaOfInterest);
                        }
                    }
                    catch (Exception exception)
                    {
                    }
                    if (!igeometry_0.IsEmpty)
                    {
                        ClipHelper.ExtractSelectFeatureFormFeatureCursor(layer,
                                                                         ClipHelper.searchFeatureFormLayer(layer, igeometry_0), (IFeatureWorkspace)workspace,
                                                                         igeometry_0, imap_1);
                    }
                }
            }
            Marshal.ReleaseComObject(workspace);
            workspace = null;
        }
Beispiel #2
0
 private static void ExtractSpecifyHRegFeatures(IFeatureWorkspace ifeatureWorkspace_0,
                                                ICompositeLayer icompositeLayer_0, IGeometry igeometry_0)
 {
     for (int i = 0; i < icompositeLayer_0.Count; i++)
     {
         ILayer layer = icompositeLayer_0.Layer[i];
         if (layer.Visible)
         {
             if (layer is IGroupLayer)
             {
                 ClipHelper.ExtractSpecifyHRegFeatures(ifeatureWorkspace_0, layer as ICompositeLayer, igeometry_0);
             }
             else if (layer is IFeatureLayer)
             {
                 try
                 {
                     IEnvelope            areaOfInterest      = layer.AreaOfInterest;
                     ITopologicalOperator topologicalOperator =
                         (ITopologicalOperator)((IClone)igeometry_0).Clone();
                     topologicalOperator.Simplify();
                     if (topologicalOperator.IsSimple)
                     {
                         topologicalOperator.Clip(areaOfInterest);
                     }
                 }
                 catch (Exception exception)
                 {
                 }
                 if (!igeometry_0.IsEmpty)
                 {
                     ClipHelper.ExtractSelectFeatureFormFeatureCursor(layer.Name,
                                                                      ClipHelper.searchFeatureFormLayer(layer, igeometry_0), ifeatureWorkspace_0, igeometry_0);
                 }
             }
         }
     }
 }