コード例 #1
0
ファイル: SEEDAO.cs プロジェクト: EAWCS1/SUITT
        public static IFeatureWorkspace GetSEEWorkspace(ISDUTExtension ext)
        {
            /*
            string path = ext.get_SystemValue(DAOUtils.ISDUT_SEE_TEMP);

            Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.AccessWorkspaceFactory");
            IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
            return (IFeatureWorkspace)workspaceFactory.OpenFromFile(path, 0);
            */

            return (IFeatureWorkspace)ext.TransactionManager.Current().PGDBConnection;
        }
コード例 #2
0
ファイル: TestManagerForm.cs プロジェクト: EAWCS1/SUITT
        public TestManagerForm(ISDUTExtension ext, ref QATestCollection tests, string[] businessNames)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Store the collection
            this._ext = ext;
            this._tests = tests;
            this._bizNames = businessNames;
        }
コード例 #3
0
ファイル: EditLogger.cs プロジェクト: EAWCS1/SUITT
        internal EditLogger(ISDUTExtension ext, Transaction current, TransactionConfig config, QAManager qaManager)
        {
            chg_evnt = new IEditEvents_OnChangeFeatureEventHandler(LogFeatureUpdate);
            crt_evnt = new IEditEvents_OnCreateFeatureEventHandler(LogFeatureInsert);
            del_evnt = new IEditEvents_OnDeleteFeatureEventHandler(LogFeatureDelete);

            transaction = current;
            this.config = config;
            this.qaManager = qaManager;

            editor = ext.Editor;

            ((IEditEvents_Event)editor).OnChangeFeature += chg_evnt;
            ((IEditEvents_Event)editor).OnCreateFeature += crt_evnt;
            ((IEditEvents_Event)editor).OnDeleteFeature += del_evnt;
        }
コード例 #4
0
ファイル: MapTopologyDefaults.cs プロジェクト: EAWCS1/SUITT
        public MapTopologyDefaults(IApplication pApp)
        {
            try
            {

                m_pApp = pApp;

                UID pUID = new UIDClass();
                pUID.Value = "esriEditor.Editor";
                m_pEditor = (IEditor)m_pApp.FindExtensionByCLSID(pUID);

                pUID.Value = "esriEditorExt.TopologyExtension";
                m_pTopologyExt = m_pApp.FindExtensionByCLSID(pUID) as ITopologyExtension;
                m_pMapTopology = m_pTopologyExt.MapTopology;

                m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_pApp.FindExtensionByName("SUITT Extension");

                //m_XYTolerance = SetTopoClasses();

                m_pTopologyExt.CurrentTopology = m_pMapTopology;

                // make sure the specified tolerance is not less than allowable tolerance
                if (m_XYTolerance < GetMinXYTolerance)
                {
                    util.Logger.Write("The specified xy cluster tolerance (" + m_XYTolerance.ToString() + ") for the <SUITT Map Topology> defaults was " +
                        "below the minimum xy tolerance allowed.  The value of " + GetMinXYTolerance.ToString() + " will be used instead.");
                    m_XYTolerance = GetMinXYTolerance;
                }
                m_pMapTopology.ClusterTolerance = m_XYTolerance;

                //m_pMapTopology.Name = "<ISDUT Map Topology>"; // apply the topology name
            }
            catch(Exception ex)
            {
                Debug.WriteLine(ex.Message + "\n" + ex.StackTrace);
                util.Logger.Write(" Descrip  : Setting up the SUITT map topology defaults." +
                    "\n Message  : " + ex.Message +
                    "\n StackTrc : " + ex.StackTrace, util.Logger.LogLevel.Debug);
            }
        }
コード例 #5
0
        public override void OnCreate(object hook)
        {
            try
            {
                if (hook != null)
                {
                    if (hook is IMxApplication)
                    {
                        // create / access core AO variables.
                        m_app = (IApplication) hook;
                        //m_pMxDoc = (IMxDocument)m_app.Document;

            //						UID pUID;
            //						pUID = new UIDClass();
            //						pUID.Value = "esriEditor.Editor";
            //						m_pEditor = (IEditor)m_app.FindExtensionByCLSID(pUID);

                        try
                        {
                            m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_app.FindExtensionByName("SUITT Extension");
                            this.BCGSMAPLAYER = m_pISDUTExt.get_SystemValue("tools.bcgs.datasetname");
                        }
                        catch
                        {
                            throw new Exception("SUITT Extension not found.");
                        }
                    }
                }
            }
            catch(Exception ex)
            {
                util.Logger.Write("Failed to Create '" + this.Name + "': " + ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
コード例 #6
0
ファイル: CmdRetire.cs プロジェクト: EAWCS1/SUITT
        /// <summary>
        /// Occurs when this command is created
        /// </summary>
        /// <param name="hook">Instance of the application</param>
        public override void OnCreate(object hook)
        {
            if (hook == null)
                return;

            try
            {
                m_app = (IApplication)hook;

                m_hookHelper = new HookHelperClass();
                m_hookHelper.Hook = hook;
                if (m_hookHelper.ActiveView == null)
                    m_hookHelper = null;

                m_ext = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_app.FindExtensionByName(ISDUTExtension.NAME);
            }
            catch
            {
                m_hookHelper = null;
            }

            if (m_hookHelper == null)
                base.m_enabled = false;
            else
                base.m_enabled = true;

            // TODO:  Add other initialization code
        }
コード例 #7
0
ファイル: CmdNew.cs プロジェクト: EAWCS1/SUITT
        public static SEE generateFromSelected(ISDUTExtension ext, IFeatureClass target)
        {
            Logger.Write("Create See based on selection");
            IMap map = ext.FocusMap;
            IEnumFeature selection = (IEnumFeature)map.FeatureSelection;
            ((IEnumFeatureSetup)selection).AllFields = true;
            ((IEnumFeatureSetup)selection).Recycling = false;

            int i=0;
            ArrayList t = new ArrayList();
            IGeometry shape = null;
            for(IFeature feat = selection.Next();feat!=null;feat = selection.Next())
            {
                if(i > UNION_SET_OPT && shape != null)
                {
                    t.Add(((IClone)shape).Clone());
                    shape = null;
                    i = 0;
                }
                if(feat.Shape!= null && esriGeometryType.esriGeometryPolygon.Equals(feat.Shape.GeometryType))
                {

                    IGeometry g = feat.ShapeCopy;

                    if (g != null && (g.SpatialReference == null || g.SpatialReference is IUnknownCoordinateSystem))
                    {
                        g.SpatialReference = ext.FocusMap.SpatialReference;
                    }

                    if (!g.SpatialReference.Equals(((IGeoDataset)target).SpatialReference))
                    {
                        g.Project(((IGeoDataset)target).SpatialReference);
                    }

                    if(shape == null)
                    {

                        if (g != null)
                        {
                            IEnvelope env = new EnvelopeClass();
                            g.QueryEnvelope(env);
                            double buf = (Math.Max(env.Width,env.Height)) * (ext.TransactionManager.getShapeAlterPercentage()/100.0);
                            ((IPolycurve)g).Weed(buf);
                        }

                        shape = g;
                    }
                    else
                    {
                        shape = merge(shape, g,ext);
                    }
                    i++;
                }
            }
            if(shape!=null)
                t.Add(((IClone)shape).Clone());

            while(t.Count > 1)
            {
                t = merge(t,ext);
            }

            SEE see = new SEE();
            if(t.Count>0)
            {
                see.Expand((IPolygon)t[0],ext);
            }

            Logger.Write("See from selection is "+see);
            return see;
        }
コード例 #8
0
ファイル: CmdNew.cs プロジェクト: EAWCS1/SUITT
 public static ArrayList merge(ArrayList t,ISDUTExtension ext)
 {
     ArrayList r = new ArrayList();
     int ct = t.Count;
     int j=0;
     IGeometry shape = null;
     IGeometry ts = null;
     for(int i=0;i<t.Count;i++)
     {
         ts = (IGeometry)t[i];
         if(j > UNION_SET_OPT && shape != null)
         {
             r.Add(((IClone)shape).Clone());
             shape = null;
             j=0;
         }
         if(ts!= null)
         {
             if(shape == null)
             {
                 shape = (IGeometry)((IClone)ts).Clone();
                 if (shape.SpatialReference == null || shape.SpatialReference is IUnknownCoordinateSystem)
                 {
                     shape.SpatialReference = ext.FocusMap.SpatialReference;
                 }
             }
             else
             {
                 try
                 {
                     shape = merge(shape, ts,ext);
                 }
                 catch(Exception e)
                 {
                     // we will assume the offending geom is ts ...
                     // ignore this
                     Logger.Write(e);
                 }
             }
             j++;
         }
     }
     if(shape!=null)
         r.Add(((IClone)shape).Clone());
     return r;
 }
コード例 #9
0
ファイル: PrimarySubdivCmd.cs プロジェクト: EAWCS1/SUITT
        private ISet GetSelectedPrimaryParcels(IFeatureLayer surveyParcelLayer, IWorkspace tantalisWorkspace)
        {
            // Mar 12, 2008
            m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)_App.FindExtensionByName("SUITT Extension");
            this.TANTschema = m_pISDUTExt.get_SystemValue("db.tant.schema") + ".";

            ISet theReturn = null;

            if (surveyParcelLayer == null)
                return null;

            IQueryFilter theQF = new QueryFilterClass();
            util.Logger.Write("Fetching all selected parcels");

            //theQF.WhereClause = PARCEL_TYPE_FIELD_NAME + " = " + PRIMARY_PARCEL_CODE;
            //util.Logger.Write("Fetching parcels where: " + PARCEL_TYPE_FIELD_NAME + " = " + PRIMARY_PARCEL_CODE);

            if (tantalisWorkspace != null)
            {
                // Create in-memory join
                IRelationshipClass2 theRC = null;
                try
                {
                    // Open the related table
                    ITable theOsdbTable = ((IFeatureWorkspace)tantalisWorkspace).OpenTable(TANTschema + SURVEY_PARCEL_TAB_NAME);

                    IMemoryRelationshipClassFactory theFactory = new MemoryRelationshipClassFactoryClass();
                    theRC = (IRelationshipClass2)theFactory.Open(
                        SURVEY_PARCEL_FC_NAME + "_to_" + SURVEY_PARCEL_TAB_NAME,
                        (IObjectClass)surveyParcelLayer.FeatureClass,
                        SURVEY_PARCEL_FK_NAME,
                        (IObjectClass)theOsdbTable,
                        SURVEY_PARCEL_FK_NAME,
                        "forward",
                        "backward",
                        esriRelCardinality.esriRelCardinalityOneToOne);
                }
                catch (Exception ex)
                {
                    util.Logger.Write("Error creating memory relationship class between " + SURVEY_PARCEL_FC_NAME + " and " + SURVEY_PARCEL_TAB_NAME + ":" + Environment.NewLine
                        + ex.Message + Environment.NewLine + ex.StackTrace);
                    return null;
                }

                // Loop through the selected features
                ISet theSelectedSPs = new SetClass();
                ICursor theCursor = null;
                ((IFeatureSelection)surveyParcelLayer).SelectionSet.Search(null, false, out theCursor);
                IRow theSPRow = theCursor.NextRow();
                while (theSPRow != null)
                {
                    theSelectedSPs.Add(theSPRow);
                    theSPRow = theCursor.NextRow();
                }
                Marshal.ReleaseComObject(theCursor);

                IRelClassEnumRowPairs thePairs = theRC.GetObjectsMatchingObjectSetEx(theSelectedSPs, theQF, true);
                theReturn = new SetClass();

                IRow theOsdbRow;
                thePairs.Next(out theSPRow, out theOsdbRow);
                while (theSPRow != null)
                {
                    theReturn.Add(theSPRow);
                    thePairs.Next(out theSPRow, out theOsdbRow);
                }
            }
            else
            {
                // Loop through the selected features
                theReturn = new SetClass();
                ICursor theCursor = null;
                ((IFeatureSelection)surveyParcelLayer).SelectionSet.Search(theQF, false, out theCursor);
                IRow theSPRow = theCursor.NextRow();
                while (theSPRow != null)
                {
                    theReturn.Add(theSPRow);
                    theSPRow = theCursor.NextRow();
                }
                Marshal.ReleaseComObject(theCursor);
            }

            return theReturn;
        }
コード例 #10
0
        public CreateWellSitePointForm(IApplication pApp, IFeatureLayer pFeatureLayerBCGS)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            m_pApp = pApp;
            //m_pMxDoc = (IMxDocument)m_pApp.Document;

            try
            {
                m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_pApp.FindExtensionByName("SUITT Extension");

                this.TANTschema =  m_pISDUTExt.get_SystemValue("db.tant.schema") + ".";

            //				this.BCGSMAPLAYER = m_pISDUTExt.get_SystemValue("tools.bcgs.datasetname");
                m_pFeatureLayerBCGS = pFeatureLayerBCGS;

                string bcgsfields = m_pISDUTExt.get_SystemValue("tools.bcgs.fieldname");
                m_BCGSFields = bcgsfields.Split(",".ToCharArray());

                m_pFeatureLayerWellsTM = tools.utils.LoadFeatureLayerByDatasetName(TANTschema + WELLS_SHAPE,null,m_pISDUTExt.TransactionManager.Current().PGDBConnection);
                m_pFeatureLayerWellsOSDB = tools.utils.LoadFeatureLayerByDatasetName(TANTschema + WELLS_SHAPE,null,m_pISDUTExt.TransactionManager.ConnectionManager.Tant);
                m_pTableWellsOSDB = tools.utils.LoadTableByDatasetName(TANTschema + WELLS_TABLE,m_pISDUTExt.TransactionManager.ConnectionManager.Tant);

            }
            catch
            {
            }
        }
コード例 #11
0
        public override void OnCreate(object hook)
        {
            try
            {
                if (hook != null)
                {
                    //m_pHookHelper.Hook = hook;

                    if (hook is IMxApplication)
                    {
                        // create / access core AO variables.
                        m_app = (IApplication)hook;
                        //m_pMxDoc = (IMxDocument)m_app.Document;

                        UID pUID;
                        pUID = new UIDClass();

                        pUID.Value = "esriEditor.Editor";
                        m_pEditor = (IEditor)m_app.FindExtensionByCLSID(pUID);

                        //the code in extension enabled block was here...
                        // Create delegate instances of editor events
                        m_OnStartEditing = new IEditEvents_OnStartEditingEventHandler(OnStartEditing_Handler);
                        m_OnStopEditing = new IEditEvents_OnStopEditingEventHandler(OnStopEditing_Handler);
                        m_OnCurrentLayerChanged = new IEditEvents_OnCurrentLayerChangedEventHandler(OnCurrentLayerChanged_Hander);

                        //add delgates to the appropriate events to enable listening
                        ((IEditEvents_Event)m_pEditor).OnStartEditing += m_OnStartEditing;
                        ((IEditEvents_Event)m_pEditor).OnStopEditing += m_OnStopEditing;
                        ((IEditEvents_Event)m_pEditor).OnCurrentLayerChanged += m_OnCurrentLayerChanged;

                        m_frmSourceLayer.cboSourceLayer.SelectedIndexChanged += new System.EventHandler(cboSourceLayer_SelectedIndexChanged);

                        try
                        {
                            m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_app.FindExtensionByName("SUITT Extension");
                        }
                        catch
                        {
                            throw new Exception("Could not access SUITT Extension.");
                        }
                    }
                }
            }
            catch(Exception ex)
            {
                Debug.WriteLine(ex.Message + "\n" + ex.StackTrace);
                util.Logger.Write(" Descrip  : Creating Source Layer dropdown combo box command tool class. " +
                    "\n Message  : " + ex.Message +
                    "\n StackTrc : " + ex.StackTrace,util.Logger.LogLevel.Debug);
            }
        }
コード例 #12
0
ファイル: CmdNew.cs プロジェクト: EAWCS1/SUITT
        public static IGeometry merge(IGeometry g1, IGeometry g2, ISDUTExtension ext)
        {
            ITopologicalOperator2 op_2 = (ITopologicalOperator2)g2;
            if(g1 == null)
            {
                if( g2 == null )
                    return null;

                op_2.IsKnownSimple_2 = false;
                try
                {
                    op_2.Simplify();
                }
                catch (Exception e)
                {
                    Logger.Warn(e);
                }
                return g2;
            }

            ITopologicalOperator2 op_1 = (ITopologicalOperator2)g1;
            if(g2 == null)
            {
                op_1.IsKnownSimple_2 = false;
                try
                {
                    op_1.Simplify();
                }
                catch (Exception e)
                {
                    Logger.Warn(e);
                }
                return g1;
            }

            // http://forums.esri.com/Thread.asp?c=93&f=1170&t=88297#242834

            op_1.IsKnownSimple_2 = false;
            try
            {
                op_1.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }

            op_2.IsKnownSimple_2 = false;
            try
            {
                op_2.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }

            if (g1.SpatialReference == null || g1.SpatialReference is IUnknownCoordinateSystem)
            {
                g1.SpatialReference = ext.FocusMap.SpatialReference;
            }

            if (g2.SpatialReference == null || g2.SpatialReference is IUnknownCoordinateSystem)
            {
                g2.SpatialReference = ext.FocusMap.SpatialReference;
            }

            g2.Project(g1.SpatialReference);

            ISpatialReference sr = g1.SpatialReference;

            g1.SnapToSpatialReference();
            g2.SnapToSpatialReference();

            IGeometry r = (IGeometry)(op_1.Union(g2));
            r.SpatialReference = sr;

            if (r.SpatialReference == null || r.SpatialReference is IUnknownCoordinateSystem)
            {
                r.SpatialReference = ext.FocusMap.SpatialReference;
            }

            ITopologicalOperator2 op_r = (ITopologicalOperator2)r;
            op_r.IsKnownSimple_2 = false;
            try
            {
                op_r.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }

            return r;
        }
コード例 #13
0
ファイル: BusinessFeatures.cs プロジェクト: EAWCS1/SUITT
        public BusinessFeatures(ITable pTable, ref ISDUTExtension pISDUTExtension)
        {
            Debug.WriteLine("Loading business feature information...");

            m_BFarray = new ArrayList();

            m_pISDUTExt = pISDUTExtension;

            ICursor pCursor = pTable.Search(null,false);

            IRow pRow;
            pRow = pCursor.NextRow();
            while(pRow != null)
            {
                BusinessFeature bf = new BusinessFeature();
                try
                {
                    bf.OperationDS = pRow.get_Value(pRow.Fields.FindField("OPERATIONAL_DATASET_NAME")).ToString();
                    bf.FCode = pRow.get_Value(pRow.Fields.FindField("FEATURE_CODE")).ToString();
                    bf.SDELayer = pRow.get_Value(pRow.Fields.FindField("MAINTENANCE_LAYER_NAME")).ToString();
                    bf.Description = pRow.get_Value(pRow.Fields.FindField("DESCRIPTION")).ToString();

                    tm.TransactionConfig.LayerConfig lc = m_pISDUTExt.TransactionManager.transactionConfig().get_LayerConfig(bf.SDELayer);

                    bf.requiresSID = Convert.ToBoolean(lc.RequiresSID); //'true' or 'false'
                    bf.Geometry = lc.Geometry; // should be one of 'none,'point','line','polygon'

                    if(bf.requiresSID == true)
                    {
                        string OSDBtable = bf.SDELayer;
                        if(OSDBtable.ToUpper().EndsWith("_SHAPES") == true)
                        {
                            bf.SDETable = OSDBtable.Remove(OSDBtable.Length - 7,7) + "S";
                        }
                    }

                    try
                    {

                        int fieldInd = pRow.Fields.FindField("MLSUB_SUBTYPE");
                        if (pRow.get_Value(fieldInd) != DBNull.Value)
                        {
                            bf.SubType = Convert.ToInt32(pRow.get_Value(fieldInd));
                            bf.SubTypeDescription = GetSubTypeDescription(bf.SubType);
                        }
                        else
                        {
                            bf.SubType = -1;
                            bf.SubTypeDescription = "";
                        }
                    }
                    catch
                    {
                        bf.SubType = -1;
                        bf.SubTypeDescription = "";
                    }
                }
                catch
                {
                    Debug.WriteLine("\tNot using BF: " + bf.FCode + "-" + bf.Description + " in " + bf.OperationDS + "." + bf.SDELayer);
                    bf = null;
                }

                if (bf != null)
                {
                    //Debug.WriteLine("\tAdding bf: " + bf.FCode + "\t" + bf.Geometry + "\t" + bf.requiresSID + "\t" + bf.OperationDS + "\t" + bf.SDELayer);
                    m_BFarray.Add(bf);
                }

                pRow = pCursor.NextRow();
            }

            // for debugging only.....
            //			Debug.WriteLine("Business Features...");
            //			for(int i = 0; i < m_BFarray.Count; i++)
            //			{
            //				BusinessFeature tmp = (BusinessFeature)m_BFarray[i];
            //				Debug.WriteLine("\t BFs = " + tmp.FCode + "\t" + tmp.Geometry + "\t" + tmp.requiresSID + "\t" + tmp.OperationDS + "\t" + tmp.SDELayer);
            //			}

            itr = 0;
        }
コード例 #14
0
ファイル: LayerCountDAO.cs プロジェクト: EAWCS1/SUITT
 public LayerCountDAO(ISDUTExtension ext)
 {
     this.ext = ext;
 }
コード例 #15
0
ファイル: CmdNew.cs プロジェクト: EAWCS1/SUITT
        public static void updateAcetate(SEE see, IFeatureClass featureClass, ISDUTExtension ext)
        {
            if(see == null)
            {
                return;
            }

            Logger.Write("Update acetate");
            IFeature feat = null;
            if(featureClass.FeatureCount(null) < 1)
            {
                feat = featureClass.CreateFeature();
                feat.Shape = see.Shape;
                feat.Store();
            }
            else
            {
                feat = featureClass.Update(null,false).NextFeature();
                feat.Shape = see.Shape;
                feat.Store();
            }
            Logger.Write("Update acetate -- Refresh");

            ((IActiveView)ext.FocusMap).Refresh();
        }
コード例 #16
0
ファイル: CmdNew.cs プロジェクト: EAWCS1/SUITT
        public static IFeatureClass setupSEELayer(ISDUTExtension ext)
        {
            try
            {
                string see_layer_name = ext.get_SystemValue(SEE_LAYER_NAME_KEY);
                Logger.Write("Create SEE Layer: "+see_layer_name);

                // temp pgdb
                IWorkspace ws = (new ScratchWorkspaceFactory()).CreateNewScratchWorkspace();
                IFeatureWorkspace fws = (IFeatureWorkspace)ws;

                IFields fields = new FieldsClass();
                IFieldsEdit fieldsEdit = (IFieldsEdit)fields;

                // Make the shape field
                // it will need a geometry definition, with a spatial reference
                FieldClass pField = new FieldClass();

                ((IFieldEdit)pField).Name_2 = SHAPE_FIELD_NAME;
                ((IFieldEdit)pField).Type_2 = esriFieldType.esriFieldTypeGeometry;

                GeometryDefClass pGeomDef = new GeometryDefClass();
                ((IGeometryDefEdit)pGeomDef).GeometryType_2 = esriGeometryType.esriGeometryPolygon;
                ((IGeometryDefEdit)pGeomDef).SpatialReference_2 = ext.FocusMap.SpatialReference;
                ((IFieldEdit)pField).GeometryDef_2 = pGeomDef;
                ((IFieldsEdit)fields).AddField(pField);

                pField = new FieldClass();

                ((IFieldEdit)pField).Name_2 = "OID";
                ((IFieldEdit)pField).Type_2 = esriFieldType.esriFieldTypeOID;
                ((IFieldsEdit)fields).AddField(pField);

                IFeatureClass pFeatureClass = fws.CreateFeatureClass(see_layer_name,fields, null, null,
                    esriFeatureType.esriFTSimple, SHAPE_FIELD_NAME, "");

                // Add feature class as layer to the map
                IFeatureLayer pFeatureLayer = new FeatureLayer();
                pFeatureLayer.Visible = true;
                pFeatureLayer.Name = see_layer_name;
                pFeatureLayer.FeatureClass = pFeatureClass;
                pFeatureLayer.Selectable = false;
                pFeatureLayer.SpatialReference = ((IGeoDataset)pFeatureClass).SpatialReference;

                Logger.Write("Adding layer");
                ext.FocusMap.AddLayer(pFeatureLayer);

                return pFeatureClass;
            }
            catch(Exception e)
            {
                MessageBox.Show("An error occured adding/creating the temporary Spatial Edit Extent Layer "+e.Message,
                    "EXCEPTION", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                throw new HandledException(e);
            }
        }
コード例 #17
0
ファイル: CmdNew.cs プロジェクト: EAWCS1/SUITT
 public static void removeSEELayer(IFeatureClass featureClass, ISDUTExtension ext)
 {
     try
     {
         string see_layer_name = ext.get_SystemValue(SEE_LAYER_NAME_KEY);
         if (featureClass != null)
         {
             IMap map = ext.FocusMap;
             IEnumLayer el = map.get_Layers(null,false);
             for(ILayer lyr = el.Next();lyr!=null;lyr = el.Next())
             {
                 if((lyr is IFeatureLayer && ((IFeatureLayer)lyr).FeatureClass!=null
                     && ((IFeatureLayer)lyr).FeatureClass.Equals(featureClass)) ||
                     (lyr != null && lyr.Name != null && lyr.Name.Equals(see_layer_name)))
                 {
                     ((IFeatureLayer)lyr).FeatureClass = null;
                     map.DeleteLayer(lyr);
                 }
             }
         }
     }
     catch(Exception e)
     {
         MessageBox.Show("An error occured removing the temporary Spatial Edit Extent Layer "+e.Message,
             "EXCEPTION", MessageBoxButtons.OK,
             MessageBoxIcon.Error);
         throw new HandledException(e);
     }
 }
コード例 #18
0
ファイル: SEE.cs プロジェクト: EAWCS1/SUITT
        /**
         * Creates a new SEE object representing the buffered union of the selection, unioned
         * with this object and the newShape.
         *
         * If any parameters are null, this method should fail gracefully.
         */
        public void Expand(IPolygon expansion, ISDUTExtension ext)
        {
            if(expansion == null)
                return;

            ITopologicalOperator2 op_expansion = (ITopologicalOperator2)expansion;
            op_expansion.IsKnownSimple_2 = false;
            try
            {
                op_expansion.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }

            if(shape == null)
            {
                shape = (IPolygon)((IClone)expansion).Clone();
                if (shape.SpatialReference == null || shape.SpatialReference is IUnknownCoordinateSystem)
                {
                    shape.SpatialReference = ext.FocusMap.SpatialReference;
                }
                return;
            }
            // buggy
            // http://forums.esri.com/Thread.asp?c=93&f=1170&t=88297#242834

            ITopologicalOperator2 op_shape = (ITopologicalOperator2)shape;
            op_shape.IsKnownSimple_2 = false;
            try
            {
                op_shape.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }

            if (shape.SpatialReference == null || shape.SpatialReference is IUnknownCoordinateSystem)
            {
                shape.SpatialReference = ext.FocusMap.SpatialReference;
            }

            if (expansion.SpatialReference == null || shape.SpatialReference is IUnknownCoordinateSystem)
            {
                expansion.SpatialReference = ext.FocusMap.SpatialReference;
            }

            expansion.Project(shape.SpatialReference);

            ISpatialReference sr = shape.SpatialReference;

            shape.SnapToSpatialReference();
            expansion.SnapToSpatialReference();

            shape = (IPolygon)(op_shape.Union((IPolygon)expansion));
            shape.SpatialReference = sr;

            if (shape.SpatialReference == null || shape.SpatialReference is IUnknownCoordinateSystem)
            {
                shape.SpatialReference = ext.FocusMap.SpatialReference;
            }

            op_shape = (ITopologicalOperator2)shape;
            try
            {
                op_shape.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }
            return;
        }
コード例 #19
0
ファイル: CreatePDFMapOutputCmd.cs プロジェクト: EAWCS1/SUITT
        public override void OnCreate(object hook)
        {
            try
            {
                if (hook != null)
                {
                    if (hook is IMxApplication)
                    {
                        // create / access core AO variables.
                        m_app = (IApplication) hook;

                        UID pUID;
                        pUID = new UIDClass();

                        pUID.Value = "esriEditor.Editor";
                        m_pEditor = (IEditor)m_app.FindExtensionByCLSID(pUID);

                        try
                        {
                            m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_app.FindExtensionByName("SUITT Extension");
                            this.TemplateFolder = m_pISDUTExt.get_SystemValue("tools.mapping.templatefolder");

                            try
                            {
                                string scales = m_pISDUTExt.get_SystemValue("tools.mapping.scales");
                                m_scales = scales.Split(",".ToCharArray());
                            }
                            catch{}
                        }
                        catch
                        {
                            throw new Exception("SUITT Extension not found.");
                        }
                    }
                }
            }
            catch(Exception ex)
            {

                util.Logger.Write(" Descrip  : Creating command and accessing SUITT extension." +
                    "\n Message  : " + ex.Message +
                    "\n StackTrc : " + ex.StackTrace,util.Logger.LogLevel.Debug);

            }
        }
コード例 #20
0
ファイル: ConnectionManager.cs プロジェクト: EAWCS1/SUITT
 internal ConnectionManager(IApplication app, ISDUTExtension ext, TransactionConfig transactionConfig)
 {
     this.app = app;
     this.ext = ext;
 }
コード例 #21
0
ファイル: Stationing.cs プロジェクト: EAWCS1/SUITT
        public override void OnCreate(object hook)
        {
            if (hook != null)
            {
                if (hook is IMxApplication)
                {
                    m_app = (IApplication) hook;

                    try
                    {
                        m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_app.FindExtensionByName("SUITT Extension");
                    }
                    catch
                    { }

                    UID pUID;
                    pUID = new UIDClass();
                    pUID.Value = "esriEditor.Editor";
                    m_pEditor = (IEditor)m_app.FindExtensionByCLSID(pUID);

                    pUID.Value = "esriEditor.TraverseWindow";
                    m_pTraverseWindow = (ITraverseWindow)m_pEditor.FindExtension(pUID);

                }
            }
        }
コード例 #22
0
ファイル: CompilationLogCmd.cs プロジェクト: EAWCS1/SUITT
        public override void OnCreate(object hook)
        {
            try
            {
                if (hook != null)
                {
                    if (hook is IMxApplication)
                    {
                        // create / access core AO variables.
                        m_app = (IApplication) hook;

                        try
                        {
                            m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_app.FindExtensionByName("SUITT Extension");
                            this.ISDUTschema =  m_pISDUTExt.get_SystemValue("db.isdut.schema") + ".";
                        }
                        catch
                        {
                            throw new Exception("SUITT Extension not found.");
                        }

                    }
                }
            }
            catch(Exception ex)
            {

                util.Logger.Write(" Descrip  : Creating command and accessing SUITT extension." +
                                "\n Message  : " + ex.Message +
                                "\n StackTrc : " + ex.StackTrace,util.Logger.LogLevel.Debug);

            }
        }
コード例 #23
0
ファイル: GPSManageForm.cs プロジェクト: EAWCS1/SUITT
        public GPSManageForm(IApplication pApp)
        {
            try
            {
                InitializeComponent();

                m_pApp = pApp;
                //m_pMxDoc = (IMxDocument)m_pApp.Document;
                sortAscending = true;
                lastcolumn = string.Empty;

                try
                {
                    m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); // (ISDUTExtension)m_pApp.FindExtensionByName("SUITT Extension");

                    // get the BCGS dataset name and
                    this.BCGSMAPLAYER = m_pISDUTExt.get_SystemValue("tools.bcgs.datasetname");
                    string bcgsfields = m_pISDUTExt.get_SystemValue("tools.bcgs.fieldname");
                    m_BCGSFields = bcgsfields.Split(",".ToCharArray());

                }
                catch
                {
                    throw new Exception("Could not access SUITT Extension or system default values.");
                }
            }
            catch(Exception ex)
            {
                util.Logger.Write(" Descrip  : Form constructor - access SUITT extension and ISDUT_defaults file." +
                                "\n Message  : " + ex.Message +
                                "\n StackTrc : " + ex.StackTrace,util.Logger.LogLevel.Debug);
            }
        }
コード例 #24
0
ファイル: IsdutBaseTool.cs プロジェクト: EAWCS1/SUITT
 public override void OnCreate( System.Object hook )
 {
     app = (IApplication)hook;
     ext = (ISDUTExtension)app.FindExtensionByName(ISDUTExtension.NAME);
 }
コード例 #25
0
ファイル: TransactionConfig.cs プロジェクト: EAWCS1/SUITT
        public void Init(IWorkspace con, ISDUTExtension ext)
        {
            try
            {
                adminLayers = new Hashtable();
                tantalisLayers = new Hashtable();

                if(con==null)
                    return;

                string prefix = ext.get_SystemValue(DAOUtils.ISDUT_SCHEMA_KEY);
                if(prefix !=null && !prefix.Equals("") && !prefix.EndsWith("."))
                {
                    prefix = prefix+".";
                }

                // load FADM
                init(con,prefix,BusinessArea.ForAdmBound,adminLayers);

                // load TANT
                init(con,prefix,BusinessArea.Tantalis,tantalisLayers);

            }
            catch(HandledException e)
            {
                throw e;
            }
            catch(Exception e)
            {
                Logger.Write(e);
                throw new HandledException(e);
            }
        }
コード例 #26
0
ファイル: SEEConflictDAO.cs プロジェクト: EAWCS1/SUITT
 public SEEConflictDAO(ISDUTExtension ext)
 {
     this.ext = ext;
 }
コード例 #27
0
ファイル: ManageGPSPointsCmd.cs プロジェクト: EAWCS1/SUITT
        public override void OnCreate(object hook)
        {
            try
            {
                if (hook != null)
                {
                    if (hook is IMxApplication)
                    {
                        // create / access core AO variables.
                        m_app = (IApplication) hook;

                        try
                        {
                            m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_app.FindExtensionByName("SUITT Extension");
                        }
                        catch
                        {
                            throw new Exception("Could not access SUITT Extension.");
                        }
                    }
                }
            }
            catch(Exception ex)
            {
                util.Logger.Write(" Descrip  : Creating the GPS Point Management command. " +
                                "\n Message  : " + ex.Message +
                                "\n StackTrc : " + ex.StackTrace,util.Logger.LogLevel.Debug);

            }
        }