当前位置: 首页>>代码示例>>C#>>正文


C# CancelTrackerClass.Continue方法代码示例

本文整理汇总了C#中CancelTrackerClass.Continue方法的典型用法代码示例。如果您正苦于以下问题:C# CancelTrackerClass.Continue方法的具体用法?C# CancelTrackerClass.Continue怎么用?C# CancelTrackerClass.Continue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CancelTrackerClass的用法示例。


在下文中一共展示了CancelTrackerClass.Continue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddBarrier

        public static void AddBarrier(IPoint pPnt, IApplication app, double snapTol)
        {
            IProgressDialogFactory pProDFact = null;
            IStepProgressor pStepPro = null;
            IProgressDialog2 pProDlg = null;
            ITrackCancel pTrkCan = null;

            List<IGeometricNetwork> gnList = null;
            IGeometricNetwork gn = null;
            IPoint snappedPoint = null;
            IFlagDisplay pFlagDisplay = null;
            INetFlag startNetFlag = null;
            INetworkAnalysisExt pNetAnalysisExt = null;
            UID pID = null;
            IMap pMap = null;
            int EID = -1;
            double distanceAlong;

            try
            {

                pMap = (app.Document as IMxDocument).FocusMap;
                bool boolCont = true;
                // Create a CancelTracker
                pTrkCan = new CancelTrackerClass();
                // Create the ProgressDialog. This automatically displays the dialog
                pProDFact = new ProgressDialogFactoryClass();
                pProDlg = (IProgressDialog2)pProDFact.Create(pTrkCan, 0);

                // Set the properties of the ProgressDialog
                pProDlg.CancelEnabled = true;

                pProDlg.Animation = esriProgressAnimationTypes.esriProgressGlobe;

                // Set the properties of the Step Progressor
                pStepPro = (IStepProgressor)pProDlg;

                pStepPro.MinRange = 0;
                pStepPro.MaxRange = 6;
                pStepPro.StepValue = 1;
                pStepPro.Position = 0;
                pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_4");

                gnList = Globals.GetGeometricNetworksCurrentlyVisible(ref pMap);
                int gnIdx = -1;

                if (gnList == null || gnList.Count == 0)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_2"), A4LGSharedFunctions.Localizer.GetString("GeoNetToolsErrorLbl_2"));
                    return;
                }

                // Create junction or edge flag at start of trace - also returns geometric network, snapped point, and EID of junction
                pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_6");
                pStepPro.Step();
                boolCont = pTrkCan.Continue();

                if (!boolCont)
                {

                    pStepPro.Hide();
                    pProDlg.HideDialog();
                    pStepPro = null;
                    pProDlg = null;
                    pProDFact = null;
                    return;
                }

                startNetFlag = Globals.GetJunctionFlag(ref pPnt, ref  pMap, ref gnList, snapTol, ref gnIdx, out snappedPoint, out EID, out  pFlagDisplay, false) as INetFlag;
                if (startNetFlag == null)
                {
                    startNetFlag = Globals.GetEdgeFlag(ref pPnt, ref pMap, ref gnList, snapTol, ref gnIdx, out snappedPoint, out EID, out distanceAlong, out  pFlagDisplay, false) as INetFlag;
                }

                //Set network to trace
                if (gnIdx > -1)
                    gn = gnList[gnIdx] as IGeometricNetwork;

                // Stop if user point was not on a visible network feature, old trace results and selection are cleared
                if (gn == null || startNetFlag == null)
                {
                    return;
                }

                if (app != null)
                {
                    pID = new UID();

                    pID.Value = "esriEditorExt.UtilityNetworkAnalysisExt";
                    pNetAnalysisExt = (INetworkAnalysisExt)app.FindExtensionByCLSID(pID);
                    Globals.SetCurrentNetwork(ref pNetAnalysisExt, ref gn);
                    Globals.AddBarrierToGN(pNetAnalysisExt, gn, pFlagDisplay);
                    //  pFlagDisplay
                    pNetAnalysisExt = null;
                    pID = null;

                }

            }
            catch (Exception ex)
//.........这里部分代码省略.........
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:101,代码来源:GeoNetTools.cs

示例2: TraceIsolationSummary


//.........这里部分代码省略.........
                        if (resVals.Length == 3)
                        {
                            intValveCount = Convert.ToInt32(resVals[0]);
                            intMeterCount = Convert.ToInt32(resVals[1]);
                            intCritMeterCount = Convert.ToInt32(resVals[2]);
                            comments = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsDone_18a");
                        }
                        else
                        {
                            comments = result;
                        }
                        // pStepPro.Message = "Saving Result: " + pStepPro.Position + A4LGSharedFunctions.Localizer.GetString("Of") + FeatureCount + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_18a");

                        pSumFeatBuf.Shape = pMainsFeat.ShapeCopy;
                        if (resultsDateFieldPosition > -1)
                        {
                            pSumFeatBuf.set_Value(resultsDateFieldPosition, DateTime.Now);
                        }
                        pSumFeatBuf.set_Value(resultsFacilityIDFieldPosition, pMainsFeat.get_Value(facilityIDFieldPosition));

                        pSumFeatBuf.set_Value(resultsValveCountFieldPosition, intValveCount);
                        pSumFeatBuf.set_Value(resultsMeterCountFieldPosition, intMeterCount);
                        pSumFeatBuf.set_Value(resultsCritMeterCountFieldPosition, intCritMeterCount);
                        if (resultsCommentsFieldPosition > 0)
                        {
                            pSumFeatBuf.set_Value(resultsCommentsFieldPosition, comments);
                        }
                        pStepPro.Step();
                        pInsCur.InsertFeature(pSumFeatBuf);

                        //curIdx = curIdx + 1;

                        // pInsCur.InsertFeature (pFeatBuf);
                        boolCont = pTrkCan.Continue();

                        if (!boolCont)
                        {
                            pInsCur.Flush();
                            pWSEdit.AbortEditOperation();

                            return;
                        }

                    }
                    catch (Exception Ex)
                    {
                        System.Diagnostics.Debug.WriteLine(Ex.Message + A4LGSharedFunctions.Localizer.GetString("Step") + pStepPro.Position);

                        System.Diagnostics.Trace.WriteLine(Ex.Message + A4LGSharedFunctions.Localizer.GetString("Step") + pStepPro.Position);
                        //    MessageBox.Show(Ex.Message);
                    }
                    intCurID = pSelectIDs.Next();

                    Marshal.ReleaseComObject(pMainsFeat);

                }
                try
                {
                    pInsCur.Flush();
                }
                catch
                { }

                pWSEdit.StopEditOperation();

            }
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:67,代码来源:GeoNetTools.cs

示例3: CalculateFlowAccum


//.........这里部分代码省略.........
                    {
                        MessageBox.Show(sumAcc.LayerName + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_20d") + sumAcc.SumFlowField + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_20e"));
                        return;
                    }

                    // Step through each selected feature in the selection set
                    pFSel.SelectionSet.Search(null, false, out pCursor);

                    pFCursor = pCursor as IFeatureCursor;

                    // Set the properties of the ProgressDialog
                    pProDlg.Description = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsMess_20a") + sumAcc.LayerName;
                    pProDlg.Title = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsMess_20a") + sumAcc.LayerName;

                    pStepPro.MinRange = 0;
                    pStepPro.MaxRange = pFSel.SelectionSet.Count;
                    pStepPro.StepValue = 1;
                    pStepPro.Position = 0;
                    pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsMess_20a") + sumAcc.LayerName + " 0" + A4LGSharedFunctions.Localizer.GetString("OutOf") + pFSel.SelectionSet.Count;

                    try
                    {
                        pEditor.StartOperation();
                    }
                    catch
                    {
                        pEditor.AbortOperation();
                        pEditor.StartOperation();
                    }

                    int cnt = 1;
                    while ((pFeature = pFCursor.NextFeature()) != null)
                    {

                        pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsMess_20a") + sumAcc.LayerName + cnt + A4LGSharedFunctions.Localizer.GetString("OutOf") + pFSel.SelectionSet.Count;
                        pStepPro.Step();
                        boolCont = pTrkCan.Continue();

                        if (!boolCont)
                        {

                            pStepPro.Hide();
                            pProDlg.HideDialog();
                            pStepPro = null;
                            pProDlg = null;
                            pProDFact = null;
                            return;
                        }

                        retAcc = Globals.ReturnAccumulation(ref app, ref pFeature, sumAcc.WeightName, sumAcc.FlowDirection);
                        if (Globals.IsNumeric(retAcc))
                        {
                            pFeature.set_Value(lSumFieldLoc, retAcc);
                            pFeature.Store();
                        }
                        else
                        {

                        }

                        cnt++;
                    }

                    pEditor.StopOperation(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsDone_20a") + sumAcc.LayerName);

                }

                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsDone_20b"));

            }
            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsLbl_20a") + "\n" + ex.Message);
            }
            finally
            {

                //pStepPro.Hide();
                if (pProDlg != null)
                    pProDlg.HideDialog();
                pProDFact = null;
                pStepPro = null;
                pProDlg = null;
                pTrkCan = null;

                pMap = null;
                pFLayer = null;

                pFSel = null;
                if (pFCursor != null)
                    Marshal.ReleaseComObject(pFCursor);
                pFCursor = null;
                if (pCursor != null)
                    Marshal.ReleaseComObject(pCursor);
                pCursor = null;
                pFeature = null;
                pEditor = null;

            }
        }
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:101,代码来源:GeoNetTools.cs

示例4: TraceFlow

        public static void TraceFlow(ref IPoint point, IApplication app, esriFlowMethod flow, double snapTol, bool traceIndeterminate, bool selectEdges)
        {
            IMap map = null;
            IProgressDialogFactory pProDFact;
            IStepProgressor pStepPro;
            IProgressDialog2 pProDlg = null;
            ITrackCancel pTrkCan;

            List<IGeometricNetwork> gnList;
            IGeometricNetwork gn = null;
            IPoint snappedPoint = null;
            IFlagDisplay pFlagDisplay;
            INetFlag startNetFlag;
            ITraceFlowSolverGEN traceFlowSolver;
            List<IEdgeFlag> pEdgeFlags = null;
            List<IJunctionFlag> pJunctionFlags = null;
            //List<IEdgeFlag> pEdgeFlagsBar = null;
            //List<IJunctionFlag> pJunctionFlagsBar = null;
            INetElementBarriers pEdgeElementBarriers;
            INetElementBarriers pJunctionElementBarriers;
            ISelectionSetBarriers pSelectionSetBarriers;
            INetworkAnalysisExt pNetAnalysisExt = null;
            List<INetFlag> pNetFlags = new List<INetFlag>();
            IJunctionFlag[] junctionFlag;
            IEdgeFlag[] edgeFlag;
            IEnumNetEID juncEIDs;
            IEnumNetEID edgeEIDs;
            IEnvelope env;
            int EID = -1;
            double distanceAlong;

            UID pID = null;
            INetSolver netSolver = null;

            try
            {

                map = ((IMxDocument)app.Document).FocusMap;

                bool boolCont = true;
                // Create a CancelTracker
                pTrkCan = new CancelTrackerClass();
                // Create the ProgressDialog. This automatically displays the dialog
                pProDFact = new ProgressDialogFactoryClass();
                pProDlg = (IProgressDialog2)pProDFact.Create(pTrkCan, 0);

                // Set the properties of the ProgressDialog
                pProDlg.CancelEnabled = true;
                if (flow == esriFlowMethod.esriFMConnected)
                {
                    pProDlg.Description = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsDesc_14a");
                    pProDlg.Title = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsTitle_14a");
                }
                else if (flow == esriFlowMethod.esriFMDownstream)
                {
                    pProDlg.Description = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsDesc_14b");
                    pProDlg.Title = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsTitle_14b");
                }
                else if (flow == esriFlowMethod.esriFMUpstream)
                {
                    pProDlg.Description = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsDesc_14c");
                    pProDlg.Title = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsTitle_14c");
                }

                pProDlg.Animation = esriProgressAnimationTypes.esriProgressGlobe;

                // Set the properties of the Step Progressor
                pStepPro = (IStepProgressor)pProDlg;

                pStepPro.MinRange = 0;
                pStepPro.MaxRange = 8;
                pStepPro.StepValue = 1;
                pStepPro.Position = 0;
                pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_4");

                gnList = Globals.GetGeometricNetworksCurrentlyVisible(ref map);
                int gnIdx = -1;

                if (gnList == null || gnList.Count == 0)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_2"), A4LGSharedFunctions.Localizer.GetString("GeoNetToolsErrorLbl_2"));
                    return;
                }

                pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsMess_14a");
                pStepPro.Step();
                boolCont = pTrkCan.Continue();

                if (!boolCont)
                {

                    pStepPro.Hide();
                    pProDlg.HideDialog();
                    pStepPro = null;
                    pProDlg = null;
                    pProDFact = null;
                    return;
                }
                //Remove old trace graphics (flags and results)
                Globals.RemoveTraceGraphics(map, true);
//.........这里部分代码省略.........
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:101,代码来源:GeoNetTools.cs

示例5: TraceIsolation


//.........这里部分代码省略.........
            INetFlag netFlag2 = null;
            try
            {
                map = ((app.Document as IMxDocument).FocusMap);

                bool boolCont = true;
                if (processEvent)
                {
                    // Create a CancelTracker
                    pTrkCan = new CancelTrackerClass();
                    // Create the ProgressDialog. This automatically displays the dialog
                    pProDFact = new ProgressDialogFactoryClass();
                    pProDlg = (IProgressDialog2)pProDFact.Create(pTrkCan, 0);

                    // Set the properties of the ProgressDialog
                    pProDlg.CancelEnabled = true;

                    pProDlg.Description = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsDesc_16a");
                    pProDlg.Title = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsTitle_16a");

                    pProDlg.Animation = esriProgressAnimationTypes.esriProgressGlobe;

                    // Set the properties of the Step Progressor
                    pStepPro = (IStepProgressor)pProDlg;

                    pStepPro.MinRange = 0;
                    pStepPro.MaxRange = 18;
                    pStepPro.StepValue = 1;
                    pStepPro.Position = 0;
                    pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_4");

                    pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsMess_14a");
                    pStepPro.Step();
                    boolCont = pTrkCan.Continue();

                    if (!boolCont)
                    {

                        pStepPro.Hide();
                        pProDlg.HideDialog();
                        pStepPro = null;
                        pProDlg = null;
                        pProDFact = null;
                        return A4LGSharedFunctions.Localizer.GetString("CanceledReturnStatement");
                    }
                }
                if (processEvent)
                {
                    pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_4");
                    pStepPro.Step();
                    boolCont = pTrkCan.Continue();
                }

                if (!boolCont)
                {

                    pStepPro.Hide();
                    pProDlg.HideDialog();
                    pStepPro = null;
                    pProDlg = null;
                    pProDFact = null;
                    return A4LGSharedFunctions.Localizer.GetString("CanceledReturnStatement");
                }
                pointAlong++;

                gnList = Globals.GetGeometricNetworksCurrentlyVisible(ref map);
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:67,代码来源:GeoNetTools.cs

示例6: RemoveFlagBarrier

        public static void RemoveFlagBarrier(IPoint pPnt, IApplication app, double snapTol)
        {
            IProgressDialogFactory pProDFact = null;
            IStepProgressor pStepPro = null;
            IProgressDialog2 pProDlg = null;
            ITrackCancel pTrkCan = null;
            List<IGeometricNetwork> gnList = null;

            IMap pMap = null;
            INetworkAnalysisExt pNetAnalysisExt = null;

            UID pID = null;
            try
            {

                pMap = (app.Document as IMxDocument).FocusMap;
                bool boolCont = true;
                // Create a CancelTracker
                pTrkCan = new CancelTrackerClass();
                // Create the ProgressDialog. This automatically displays the dialog
                pProDFact = new ProgressDialogFactoryClass();
                pProDlg = (IProgressDialog2)pProDFact.Create(pTrkCan, 0);

                // Set the properties of the ProgressDialog
                pProDlg.CancelEnabled = true;

                pProDlg.Animation = esriProgressAnimationTypes.esriProgressGlobe;

                // Set the properties of the Step Progressor
                pStepPro = (IStepProgressor)pProDlg;

                pStepPro.MinRange = 0;
                pStepPro.MaxRange = 6;
                pStepPro.StepValue = 1;
                pStepPro.Position = 0;
                pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_4");

                gnList = Globals.GetGeometricNetworksCurrentlyVisible(ref pMap);

                if (gnList == null || gnList.Count == 0)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_2"), A4LGSharedFunctions.Localizer.GetString("GeoNetToolsErrorLbl_2"));
                    return;
                }

                // Create junction or edge flag at start of trace - also returns geometric network, snapped point, and EID of junction

                pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_5") + "/" + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_6");
                pStepPro.Step();
                boolCont = pTrkCan.Continue();

                if (!boolCont)
                {

                    pStepPro.Hide();
                    pProDlg.HideDialog();
                    pStepPro = null;
                    pProDlg = null;
                    pProDFact = null;
                    return;
                }

                if (app != null)
                {
                    pID = new UID();

                    pID.Value = "esriEditorExt.UtilityNetworkAnalysisExt";
                    pNetAnalysisExt = (INetworkAnalysisExt)app.FindExtensionByCLSID(pID);
                    Globals.RemoveFlagBarrierAtLocation(pPnt.X, pPnt.Y, ref pNetAnalysisExt, snapTol);
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsLbl_3") + ": " + ex.ToString());

            }
            finally
            {
                if (pProDlg != null)
                {

                    pProDlg.HideDialog();
                }
                pStepPro = null;
                pProDlg = null;
                pProDFact = null;
                pTrkCan = null;
                gnList = null;
                pNetAnalysisExt = null;
                pMap = null;
                pID = null;
            }
        }
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:94,代码来源:GeoNetTools.cs

示例7: TraceFindClosest


//.........这里部分代码省略.........

            try
            {
                map = ((app.Document as IMxDocument).FocusMap);

                bool boolCont = true;
                if (processEvent)
                {
                    // Create a CancelTracker
                    pTrkCan = new CancelTrackerClass();
                    // Create the ProgressDialog. This automatically displays the dialog
                    pProDFact = new ProgressDialogFactoryClass();
                    pProDlg = (IProgressDialog2)pProDFact.Create(pTrkCan, 0);

                    // Set the properties of the ProgressDialog
                    pProDlg.CancelEnabled = true;

                    pProDlg.Description = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsDesc_15a");
                    pProDlg.Title = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsTitle_15a");

                    pProDlg.Animation = esriProgressAnimationTypes.esriProgressGlobe;

                    // Set the properties of the Step Progressor
                    pStepPro = (IStepProgressor)pProDlg;

                    pStepPro.MinRange = 0;
                    pStepPro.MaxRange = 18;
                    pStepPro.StepValue = 1;
                    pStepPro.Position = 0;
                    pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_4");

                    pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsMess_14a");
                    pStepPro.Step();
                    boolCont = pTrkCan.Continue();

                    if (!boolCont)
                    {

                        pStepPro.Hide();
                        pProDlg.HideDialog();
                        pStepPro = null;
                        pProDlg = null;
                        pProDFact = null;
                        return A4LGSharedFunctions.Localizer.GetString("CanceledReturnStatement");
                    }
                }
                if (processEvent)
                {
                    pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_4");
                    pStepPro.Step();
                    boolCont = pTrkCan.Continue();
                }

                if (!boolCont)
                {

                    pStepPro.Hide();
                    pProDlg.HideDialog();
                    pStepPro = null;
                    pProDlg = null;
                    pProDFact = null;
                    return A4LGSharedFunctions.Localizer.GetString("CanceledReturnStatement");
                }

                gnList = Globals.GetGeometricNetworksCurrentlyVisible(ref map);
                gnIdx = -1;
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:67,代码来源:GeoNetTools.cs

示例8: ExportInsertFeatures

        private void ExportInsertFeatures(IDisplayTable hluDisplayTable, IQueryFilter exportQueryFilter, 
            int exportRowCount, int[] exportFieldMap, bool isShp, object outWS, IFeatureClass outFeatureClass)
        {
            // Create a Cancel Tracker.
            ITrackCancel trackCancel = new CancelTrackerClass();

            // Create the Progress Dialog. This automatically displays the dialog.
            IProgressDialogFactory progressDlgFactory = new ProgressDialogFactoryClass();
            IProgressDialog2 progressDlg = progressDlgFactory.Create(trackCancel, _application.hWnd) as IProgressDialog2;

            // Set the properties of the Progress Dialog.
            progressDlg.CancelEnabled = true;
            progressDlg.Title = "Export Progress";
            progressDlg.Description = string.Format("Exporting HLU Features and Attributes\n({0} features)", exportRowCount.ToString());
            progressDlg.Animation = esriProgressAnimationTypes.esriNoAnimation;

            // Set the properties of the Step Progressor.
            IStepProgressor stepProgressor = progressDlg as IStepProgressor;
            stepProgressor.MinRange = 0;
            stepProgressor.MaxRange = exportRowCount;
            stepProgressor.StepValue = 1;
            stepProgressor.Message = "";

            // Set the continue progress to true.
            bool contProgress = true;

            IWorkspaceEdit workspaceEdit = null;
            IWorkspace wsOut = outWS as IWorkspace;
            bool restoreEditSession = InEditingSession;
            if (restoreEditSession) CloseEditSession(true);

            // If the workspace is remote then the data is being accessed
            // via ArcSDE.
            if (wsOut.WorkspaceFactory.WorkspaceType == esriWorkspaceType.esriRemoteDatabaseWorkspace)
            {
                Editor.StartEditing(wsOut);
                Editor.StartOperation();
            }
            // Otherwise, it must be a FileSystem (for shapefiles)
            // or LocalDatabase (for geodatabases) workspace.
            else
            {
                workspaceEdit = (IWorkspaceEdit)outWS;
                workspaceEdit.StartEditing(true);
                workspaceEdit.StartEditOperation();
            }
            
            IFeatureCursor exportFeatureCursor =
                (IFeatureCursor)hluDisplayTable.SearchDisplayTable(exportQueryFilter, true);
            IFeature exportFeature;

            IFeatureCursor insertCursor = outFeatureClass.Insert(true);
            IFeatureBuffer featureBuffer = outFeatureClass.CreateFeatureBuffer();

            bool calcGeometry = _hluFeatureClass.ShapeType == esriGeometryType.esriGeometryPoint || isShp;
            double geom1;
            double geom2;
            // The last two fields are always the geometry fields.
            int ixGeom1 = featureBuffer.Fields.FieldCount - 2;
            int ixGeom2 = featureBuffer.Fields.FieldCount - 1;

            try
            {
                object item;
                while ((exportFeature = exportFeatureCursor.NextFeature()) != null)
                {
                    featureBuffer.Shape = exportFeature.ShapeCopy;

                    for (int i = 2; i < exportFieldMap.Length; i++)
                    {
                        item = exportFeature.get_Value(exportFieldMap[i]);
                        if (item != DBNull.Value)
                            featureBuffer.set_Value(i, item);
                        //---------------------------------------------------------------------
                        // FIX: 036 Clear all missing fields when exporting features from ArcGIS.
                        else
                            featureBuffer.set_Value(i, null);
                        //---------------------------------------------------------------------
                    }

                    if (calcGeometry)
                    {
                        GetGeometryProperties(exportFeature, out geom1, out geom2);
                        if (geom1 != -1)
                            featureBuffer.set_Value(ixGeom1, geom1);
                        if (geom2 != -1)
                            featureBuffer.set_Value(ixGeom2, geom2);
                    }

                    try { insertCursor.InsertFeature(featureBuffer); }
                    catch { }

                    // Check if the cancel button was pressed. If so, stop the process.
                    contProgress = trackCancel.Continue();
                    if (!contProgress)
                        throw new Exception("Export cancelled by user.");
                }
                FlushCursor(false, ref insertCursor);

                if (workspaceEdit == null)
//.........这里部分代码省略.........
开发者ID:HabitatFramework,项目名称:HLUTool,代码行数:101,代码来源:HluArcMapExtension.cs

示例9: batchLoadBarriers


//.........这里部分代码省略.........
                        if (pFl.FeatureClass == null)
                        {
                            MessageBox.Show(strRetVal + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_18d"));
                            return;
                        }
                        pFLD = (IFeatureLayerDefinition2)pFl;

                        // Create a CancelTracker
                        pTrkCan = new CancelTrackerClass();
                        // Create the ProgressDialog. This automatically displays the dialog
                        pProDFact = new ProgressDialogFactoryClass();
                        pProDlg = (IProgressDialog2)pProDFact.Create(pTrkCan, 0);

                        // Set the properties of the ProgressDialog
                        pProDlg.CancelEnabled = true;

                        pProDlg.Animation = esriProgressAnimationTypes.esriProgressGlobe;

                        // Set the properties of the Step Progressor
                        pStepPro = (IStepProgressor)pProDlg;

                        pStepPro.MinRange = 0;
                        pQF = new QueryFilterClass();
                        if (pFLD.DefinitionExpression.Trim() == "")
                        {

                            featCount = pFl.FeatureClass.FeatureCount(null);
                        }
                        else
                        {
                            pQF.WhereClause = pFLD.DefinitionExpression;
                            featCount = pFl.FeatureClass.FeatureCount(pQF);
                        }
                        if (featCount == 0) { return; }

                        pStepPro.MaxRange = featCount;
                        pStepPro.StepValue = 1;
                        pStepPro.Position = 0;
                        pStepPro.Message = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsProc_6");

                        featureCursor = pFl.Search(null, false);
                        feature = featureCursor.NextFeature();
                        while (feature != null)
                        {
                            if (!boolCont)
                            {

                                pStepPro.Hide();
                                pProDlg.HideDialog();
                                pStepPro = null;
                                pProDlg = null;
                                pProDFact = null;
                                return;
                            }

                            if (A4WaterUtilities.GeoNetTools.AddBarrier(feature.Shape as IPoint, app, seTol, false) == false)
                            {
                                return;
                            }
                            feature = featureCursor.NextFeature();
                            pStepPro.Step();
                            boolCont = pTrkCan.Continue();

                        }
                        if (featureCursor != null)
                        {
                            Marshal.ReleaseComObject(featureCursor);
                        }

                    }

                }

            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.Write(ex.Message);
            }
            finally
            {
                if (pProDlg != null)
                {

                    pProDlg.HideDialog();
                }
                pStepPro = null;
                pProDlg = null;
                pProDFact = null;
                pTrkCan = null;

                pLays = null;
                pFl = null;
                featureCursor = null;

                feature = null;
                pFLD = null;
                pQF = null;
                pLay = null;
            }
        }
开发者ID:rkBiswal,项目名称:local-government-desktop-addins,代码行数:101,代码来源:GeoNetTools.cs

示例10: Execute

        /**
         * Executes each of the DataQualityTests in order and collects their results
         */
        public int Execute()
        {
            // Establish the place to store the errors
            try
            {
                tm.TransactionManager theTM = this.Extension.TransactionManager;
                string theFCName = this.Extension.get_SystemValue("tm.template.dataerrors.table");

                if (theTM.Current() == null)
                {
                    // This isn't tied to any transaction, so prompt the user to save a pgdb
                    SaveFileDialog theSaveDialog = new SaveFileDialog();

                    theSaveDialog.Filter = "Personal Geodatabase files (*.mdb)|*.mdb";
                    theSaveDialog.FilterIndex = 1;
                    theSaveDialog.RestoreDirectory = true;
                    theSaveDialog.Title = "Save Test Results";

                    if(theSaveDialog.ShowDialog() == DialogResult.OK)
                    {
                        string theTemplate = this.Extension.get_SystemValue("tm.template.tant.pgdb");
                        this._errors = new QAErrorStorage(theTemplate, theSaveDialog.FileName, theFCName);
                    }
                    else
                        return -2;
                }
                else
                {
                    if (this._errors == null || this._errors.StorageWorkspace != theTM.Current().PGDBConnection)
                    {
                        this._errors = new QAErrorStorage(theTM.Current().PGDBConnection, theFCName);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error raised when establishing place to save errors:" + Environment.NewLine
                    + ex.Message,
                    "Error Storage Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                util.Logger.Write("Error raised when establishing place to save errors:" + Environment.NewLine
                    + ex.Message + Environment.NewLine + ex.StackTrace);
                return -1;
            }

            bool bShowErrorManager = false;
            ArrayList theNewErrors = new ArrayList();

            // Initialize log file
            string logDirectory = this.Extension.get_SystemValue(util.Logger.LOG_DIRECTORY_KEY)
                + Path.DirectorySeparatorChar;
            String logFileName = logDirectory + "isdut_qa_" + DateTime.Now.ToString("s").Replace(":", "-") + ".log";

            // Will put up a progress dialog, with a proper CancelTracker
            IProgressDialog2 thePDialog = null;

            try
            {
                ITrackCancel theCancelTracker = new CancelTrackerClass();
                IProgressDialogFactory theFactory = new ProgressDialogFactoryClass();
                thePDialog = (IProgressDialog2)theFactory.Create(theCancelTracker, this._app.hWnd);
                thePDialog.CancelEnabled = true;
                thePDialog.Description = "";
                thePDialog.Title = "Running QA Tests";
                thePDialog.Animation = esriProgressAnimationTypes.esriProgressGlobe;

                IStepProgressor theStepProgressor = (IStepProgressor)thePDialog;
                theStepProgressor.MinRange = 0;
                theStepProgressor.MaxRange = this.TestCount + 2;
                theStepProgressor.StepValue = 1;

                bool bContinue = true;
                bool bProblemWithTest = false;

                for (int i = 0; i < this.TestCount; i++)
                {
                    QATest theQATest = this._tests.get_Test(i);

                    theStepProgressor.Message = theQATest.Name;

                    if (theQATest != null && theQATest.IsActive)
                    {
                        IDataQualityTest theTest = theQATest.Test;
                        if (theTest != null)
                        {
                            int errCount = theTest.Execute(logFileName);

                            bContinue = theCancelTracker.Continue();
                            if (bContinue == false)
                                break;

                            if (errCount < 0)
                            {
                                bProblemWithTest = true;
                            }

                            if (theTest.ErrorCount > 0)
//.........这里部分代码省略.........
开发者ID:EAWCS1,项目名称:SUITT,代码行数:101,代码来源:QAManager.cs

示例11: ExportActiveView

        //输出当前地图至指定的文件
        public static void ExportActiveView(IActiveView pView, Size outRect, string outPath)
        {
            try
            {
                //参数检查
                if (pView == null)
                {
                    throw new Exception("输入参数错误,无法生成图片文件!");
                }

                //根据给定的文件扩展名,来决定生成不同类型的对象
                ESRI.ArcGIS.Output.IExport export = null;
                if (outPath.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportJPEGClass();
                }
                else if (outPath.EndsWith(".tiff", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportTIFFClass();
                }
                else if (outPath.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportBMPClass();
                }
                else if (outPath.EndsWith(".emf", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportEMFClass();
                }
                else if (outPath.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportPNGClass();
                }
                else if (outPath.EndsWith(".gif", StringComparison.OrdinalIgnoreCase))
                {
                    export = new ESRI.ArcGIS.Output.ExportGIFClass();
                }

                SetOutputQuality(pView, 1);

                export.ExportFileName = outPath;
                IEnvelope pEnvelope = pView.Extent;
                //导出参数
                export.Resolution = 300;

                tagRECT exportRect = new tagRECT();
                exportRect.left = exportRect.top = 0;
                exportRect.right = outRect.Width;
                exportRect.bottom = (int)(exportRect.right * pEnvelope.Height / pEnvelope.Width);
                ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
                //输出范围
                envelope.PutCoords(exportRect.left, exportRect.top, exportRect.right, exportRect.bottom);
                export.PixelBounds = envelope;
                //可用于取消操作
                ITrackCancel pCancel = new CancelTrackerClass();
                export.TrackCancel = pCancel;
                pCancel.Reset();
                //点击ESC键时,中止转出
                pCancel.CancelOnKeyPress = true;
                pCancel.CancelOnClick = false;
                pCancel.ProcessMessages = true;
                //获取handle
                System.Int32 hDC = export.StartExporting();
                //开始转出
                pView.Output(hDC, (System.Int32)export.Resolution, ref exportRect, pEnvelope, pCancel);
                bool bContinue = pCancel.Continue();
                //捕获是否继续
                if (bContinue)
                {
                    export.FinishExporting();
                    export.Cleanup();
                }
                else
                {
                    export.Cleanup();
                }

                bContinue = pCancel.Continue();
            }
            catch (Exception e)
            {
                //错误信息提示
            }
        }
开发者ID:niwho,项目名称:ArcGISFundation,代码行数:84,代码来源:PrintHelper.cs

示例12: UpdatePointXYFromGeometry

        private bool UpdatePointXYFromGeometry(ITable PointTable, IQueryFilter QueryFilter, bool Unversioned, double UpdateIfMoreThanTolerance, out int ChangedPointCount)
        {
            IProgressDialogFactory pProgressorDialogFact = new ProgressDialogFactoryClass();
              ITrackCancel pTrackCancel = new CancelTrackerClass();
              IStepProgressor pStepProgressor = pProgressorDialogFact.Create(pTrackCancel, ArcMap.Application.hWnd);
              IProgressDialog2 pProgressorDialog = (IProgressDialog2)pStepProgressor;
              try
              {
            pStepProgressor.MinRange = 0;
            pStepProgressor.MaxRange = PointTable.RowCount(null);
            pStepProgressor.StepValue = 1;
            pProgressorDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressSpiral;
            bool bCont = true;

            IRow pPointFeat = null;
            ICursor pPtCurs = null;
            ChangedPointCount = 0;
            if (Unversioned)
            {
              ITableWrite pTableWr = (ITableWrite)PointTable;//used for unversioned table
              pPtCurs = pTableWr.UpdateRows(QueryFilter, false);
            }
            else
              pPtCurs = PointTable.Update(QueryFilter, false);

            pPointFeat = pPtCurs.NextRow();

            int iPointIdx_X = pPtCurs.Fields.FindField("X");
            int iPointIdx_Y = pPtCurs.Fields.FindField("Y");

            pProgressorDialog.ShowDialog();
            pStepProgressor.Message = "Updating point data...";

            while (pPointFeat != null)
            {//loop through all of the fabric points, and if any of the point id values are in the deleted set,
              //then remove the control name from the point's NAME field

              bCont = pTrackCancel.Continue();
              if (!bCont)
            break;

              IFeature pFeat = (IFeature)pPointFeat;
              IPoint pPtSource = (IPoint)pFeat.ShapeCopy;

              if (pPtSource == null)
              {
            Marshal.ReleaseComObject(pPointFeat); //garbage collection
            pPointFeat = pPtCurs.NextRow();
            continue;
              }

              if (pPtSource.IsEmpty)
              {
            Marshal.ReleaseComObject(pPointFeat); //garbage collection
            pPointFeat = pPtCurs.NextRow();
            continue;
              }
              IPoint pPtTarget = new ESRI.ArcGIS.Geometry.PointClass();
              pPtTarget.X = Convert.ToDouble(pPointFeat.get_Value(iPointIdx_X));
              pPtTarget.Y = Convert.ToDouble(pPointFeat.get_Value(iPointIdx_Y));

              ILine pLine = new ESRI.ArcGIS.Geometry.LineClass();
              pLine.PutCoords(pPtSource, pPtTarget);

              if (pLine.Length > UpdateIfMoreThanTolerance)
              {
            pPointFeat.set_Value(iPointIdx_X, pPtSource.X);
            pPointFeat.set_Value(iPointIdx_Y, pPtSource.Y);

            //if (Unversioned)
              pPtCurs.UpdateRow(pPointFeat);
            //else
            //  pPointFeat.Store();
            ChangedPointCount++;
            string sCnt = ChangedPointCount.ToString() + " of " + pStepProgressor.MaxRange.ToString();
            pStepProgressor.Message = "Updating point data..." + sCnt;
              }

              Marshal.ReleaseComObject(pPointFeat); //garbage collection
              pPointFeat = pPtCurs.NextRow();

              if (pStepProgressor.Position < pStepProgressor.MaxRange)
            pStepProgressor.Step();

            }
            Marshal.ReleaseComObject(pPtCurs); //garbage collection
            return bCont;

              }
              catch (COMException ex)
              {
            MessageBox.Show("Problem updating point XY from shape: " + Convert.ToString(ex.ErrorCode));
            ChangedPointCount = 0;
            return false;
              }
              finally
              {
            pStepProgressor = null;
            if (!(pProgressorDialog == null))
              pProgressorDialog.HideDialog();
//.........这里部分代码省略.........
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:101,代码来源:CoordinateInverse.cs


注:本文中的CancelTrackerClass.Continue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。