Пример #1
0
        //Query the map for all the tracking layers in it
        private IEnumLayer GetAllTrackingLayers()
        {
            IEnumLayer eLayers = null;

            try
            {
                IBasicMap basicMap        = null;
                IUID      uidTemoralLayer = new UIDClass();
                uidTemoralLayer.Value = TEMPORALLAYERCLSID;

                if (m_hookHelper != null)
                {
                    basicMap = m_hookHelper.FocusMap as IBasicMap;
                }
                else if (m_globeHookHelper != null)
                {
                    basicMap = m_globeHookHelper.Globe as IBasicMap;
                }

                //This call throws an E_FAIL exception if the map has no layers, caught below
                if (basicMap != null)
                {
                    eLayers = basicMap.get_Layers((UID)uidTemoralLayer, true);
                }
            }
            catch
            {
            }

            return(eLayers);
        }
Пример #2
0
        public static IFeatureLayer FindFeatureLayerByFCName(IBasicMap pMap, string fcName, bool checkEdit)
        {
            string str = fcName.ToLower();
            UID    uid = new UID
            {
                Value = "{6CA416B1-E160-11D2-9F4E-00C04F6BC78E}"
            };
            IEnumLayer layer = pMap.get_Layers(uid, true);

            layer.Reset();
            for (ILayer layer2 = layer.Next(); layer2 != null; layer2 = layer.Next())
            {
                if (layer2 is IFeatureLayer)
                {
                    string[] strArray = ((layer2 as IFeatureLayer).FeatureClass as IDataset).Name.Split(new char[] { '.' });
                    if (strArray[strArray.Length - 1].ToLower() == str)
                    {
                        if (!checkEdit)
                        {
                            return(layer2 as IFeatureLayer);
                        }
                        IWorkspaceEdit workspace =
                            ((layer2 as IFeatureLayer).FeatureClass as IDataset).Workspace as IWorkspaceEdit;
                        if (workspace.IsBeingEdited())
                        {
                            return(layer2 as IFeatureLayer);
                        }
                    }
                }
            }
            return(null);
        }
Пример #3
0
        public static bool LayerIsExist(IBasicMap ibasicMap_0, ILayer ilayer_0)
        {
            IEnumLayer layer = ibasicMap_0.get_Layers(null, true);

            layer.Reset();
            for (ILayer layer2 = layer.Next(); layer2 != null; layer2 = layer.Next())
            {
                if (layer2 == ilayer_0)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #4
0
        public static IEnumLayer GetMapLayers(ISceneGraph isceneGraph_0)
        {
            IBasicMap  basicMap = isceneGraph_0.Scene as IBasicMap;
            IEnumLayer result;

            if (basicMap.LayerCount == 0)
            {
                result = null;
            }
            else
            {
                result = basicMap.get_Layers(null, true);
            }
            return(result);
        }
Пример #5
0
        public static ILayer GetFeatureLayer(ref IBasicMap ibasicMap_0, ref string string_0)
        {
            ILayer result;

            if (ibasicMap_0.LayerCount > 0)
            {
                IEnumLayer enumLayer = ibasicMap_0.get_Layers(null, true);
                enumLayer.Reset();
                for (ILayer layer = enumLayer.Next(); layer != null; layer = enumLayer.Next())
                {
                    if (layer.Name == string_0 && layer is IFeatureLayer && layer.Valid)
                    {
                        result = layer;
                        return(result);
                    }
                }
            }
            result = null;
            return(result);
        }
Пример #6
0
        public static ILayer GetLayerByName(ISceneGraph isceneGraph_0, string string_0)
        {
            IBasicMap basicMap = isceneGraph_0.Scene as IBasicMap;
            ILayer    result;

            if (basicMap.LayerCount > 0)
            {
                IEnumLayer enumLayer = basicMap.get_Layers(null, true);
                enumLayer.Reset();
                for (ILayer layer = enumLayer.Next(); layer != null; layer = enumLayer.Next())
                {
                    if (layer.Name.ToUpper() == string_0.ToUpper())
                    {
                        ILayer layer2 = layer;
                        result = layer2;
                        return(result);
                    }
                }
            }
            result = null;
            return(result);
        }