예제 #1
0
        public static ISpatialReference TransactionSpatialReference(TransactionManager tm, ISDUTExtension ext)
        {
            IMxDocument pMxDoc = RestTransactionManager.Instance.BaseTransactionManager.app.Document as IMxDocument;
            IMap pMap = pMxDoc.FocusMap;

            IEnumLayer enm = pMap.Layers;
            enm.Reset();

            IFeatureLayer fl = enm.Next() as IFeatureLayer;
            while (fl != null)
            {
                try
                {
                    IFeatureWorkspace thePgdbWorkspace = (IFeatureWorkspace)tm.Current().PGDBConnection;
                    IFeatureClass theTransFC = thePgdbWorkspace.OpenFeatureClass(fl.Name);

                    ISpatialReference sr = ((IGeoDataset)theTransFC).SpatialReference;

                    if (sr != null) return sr;
                }
                catch (Exception e)
                {
                    //ignore
                }

                fl = enm.Next() as IFeatureLayer;
            }

            return null;
        }
예제 #2
0
        public static Dictionary<string, ISpatialReference> OSDBSpatialReferences(TransactionManager tm, ISDUTExtension ext)
        {
            // Get the list of working/osdb pairs associated with the transaction
            //ISDUTLib.tm.TransactionConfig theConfig = new TransactionConfig();
            //theConfig.Init(tm.ConnectionManager.Isdut, ext);

            //ArrayList theLayerConfig;
            //IFeatureWorkspace theOsdbWorkspace;

            //string thePrefix = "";
            //if (tm.Current().OperationalDatasetName.Equals("TANT"))
            //{
            //    theLayerConfig = theConfig.TantalisLayers;
            //    theOsdbWorkspace = (IFeatureWorkspace)tm.ConnectionManager.Tant;
            //    thePrefix = ext.get_SystemValue(ISDUTLib.tm.dao.DAOUtils.TANT_SCHEMA_KEY);
            //}
            //else
            //{
            //    theLayerConfig = theConfig.AdminBoundaryLayers;
            //    theOsdbWorkspace = (IFeatureWorkspace)tm.ConnectionManager.Fadm;
            //    thePrefix = ext.get_SystemValue(ISDUTLib.tm.dao.DAOUtils.FADM_SCHEMA_KEY);
            //}

            //if (thePrefix.Length > 0)
            //    thePrefix += ".";

            Dictionary<string, ISpatialReference> theReturn = new Dictionary<string,ISpatialReference>();
            //for (int i = 0; i < theLayerConfig.Count; i++)
            //{
            //    TransactionConfig.LayerConfig lc = (TransactionConfig.LayerConfig)theLayerConfig[i];
            //    string theFCName = thePrefix + lc.OsdbLayerName;

            //    IFeatureClass theOSDBFC = theOsdbWorkspace.OpenFeatureClass(theFCName);

            //    theReturn.Add(lc.WorkingLayerName, ((IGeoDataset)theOSDBFC).SpatialReference);
            //}

            return theReturn;
        }