• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CancelTrackerClass类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CancelTrackerClass的典型用法代码示例。如果您正苦于以下问题:C# CancelTrackerClass类的具体用法?C# CancelTrackerClass怎么用?C# CancelTrackerClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: Execute

        public void Execute(ESRI.ArcGIS.esriSystem.IArray paramvalues, ESRI.ArcGIS.esriSystem.ITrackCancel TrackCancel, ESRI.ArcGIS.Geoprocessing.IGPEnvironmentManager envMgr, ESRI.ArcGIS.Geodatabase.IGPMessages message)
        {
            try
            {
                IGPUtilities3 gpUtilities3 = new GPUtilitiesClass();

                if (TrackCancel == null)
                {
                    TrackCancel = new CancelTrackerClass();
                }

                IGPParameter inputFeatureClassParameter = paramvalues.get_Element(in_osmFeaturesNumber) as IGPParameter;
                IGPValue inputFeatureGPValue = gpUtilities3.UnpackGPValue(inputFeatureClassParameter) as IGPValue;

                IFeatureClass osmFeatureClass = null;
                IQueryFilter queryFilter = null;

                gpUtilities3.DecodeFeatureLayer((IGPValue)inputFeatureGPValue, out osmFeatureClass, out queryFilter);

                ((ITable)osmFeatureClass).ApplyOSMClassExtension();
            }
            catch (Exception ex)
            {
                message.AddError(120050, ex.Message);
            }
        }
开发者ID:leijiancd,项目名称:arcgis-osm-editor,代码行数:26,代码来源:OSMGPAddExtension.cs


示例2: ExportBookmarksToFiles

        /// <summary>Exports all bookmarks to PDF files.</summary>
        /// <param name="directory">The directory that the exported files will be written to.</param>
        /// <param name="dpi">The resolution of the output files.</param>
        /// <param name="exportFormat">The format of the exported files.</param>
        public void ExportBookmarksToFiles(string directory, long dpi, ExportFormat exportFormat)
        {
            if (!Directory.Exists(directory))
            {
                throw new DirectoryNotFoundException("Directory not found: " + directory);
            }
            IMouseCursor mc = new MouseCursorClass();
            const int hourglass = 2;
            mc.SetCursor(hourglass);

            IMxDocument mxDoc = _app.Document as IMxDocument;
            IMapBookmarks bookmarks = (IMapBookmarks)mxDoc.FocusMap;

            IEnumSpatialBookmark enumBM = bookmarks.Bookmarks;
            enumBM.Reset();
            ISpatialBookmark sbm = enumBM.Next();

            ProgressDialogFactoryClass dialogFactory = new ProgressDialogFactoryClass();
            var cancelTracker = new CancelTrackerClass();
            IStepProgressor stepProgressor = dialogFactory.Create(cancelTracker, _app.hWnd);
            IProgressDialog2 progDialog = stepProgressor as IProgressDialog2;
            progDialog.CancelEnabled = true;

            progDialog.ShowDialog();
            stepProgressor.Hide();
            stepProgressor.Message = "Exporting...";

            // Create a formatting string with the proper extension.  (E.g., "{0}.pdf" for PDF files".)
            string fnFmt = string.Format("{{0}}.{0}", Enum.GetName(typeof(ExportFormat), exportFormat));
            try
            {
                while (sbm != null)
                {
                    sbm.ZoomTo(mxDoc.FocusMap);
                    string filename = System.IO.Path.Combine(directory, string.Format(fnFmt, sbm.Name));
                    ExportPageLayoutToFile(mxDoc.PageLayout, filename, dpi, exportFormat);
                    sbm = enumBM.Next();
                }
            }
            finally
            {
                if (progDialog != null)
                {
                    progDialog.HideDialog();
                    ComReleaser.ReleaseCOMObject(progDialog);
                }
            }
        }
开发者ID:WSDOT-GIS,项目名称:ArcMapBookmarkExporter,代码行数:52,代码来源:Exporter.cs


示例3: 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


示例4: CreateJumps

        public static void CreateJumps(IApplication app, JumpTypes jumpType, double jumpDistance)
        {
            IProgressDialog2 progressDialog = default(IProgressDialog2);

            IProgressDialogFactory progressDialogFactory = null;
            ITrackCancel trackCancel = null;
            IStepProgressor stepProgressor = null;
            ICursor lineCursor = null;
            IEditor editor = null;
            IFeature lineFeature = null;

            IMxDocument mxdoc = null;
            IMap map = null;

            UID geoFeatureLayerID = null;
            IEnumLayer enumLayer = null;

            IEditLayers eLayers = null;

            List<IFeatureLayer> lineLayers = null;
            ILayer layer = null;
            IFeatureLayer fLayer = null;
            IFeatureSelection fSel = null;
            try
            {

                //Get editor
                editor = Globals.getEditor(app);
                if (editor.EditState != esriEditState.esriStateEditing)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("MustBEditg"), A4LGSharedFunctions.Localizer.GetString("GeometryToolsLbl_6"));
                    return;
                }

                //ProgressBar
                progressDialogFactory = new ProgressDialogFactoryClass();

                // Create a CancelTracker

                trackCancel = new CancelTrackerClass();

                // Set the properties of the Step Progressor
                Int32 int32_hWnd = editor.Parent.hWnd;
                stepProgressor = progressDialogFactory.Create(trackCancel, int32_hWnd);
                stepProgressor.MinRange = 0;
                // stepProgressor.MaxRange = itotal
                stepProgressor.StepValue = 1;
                stepProgressor.Message = "";
                stepProgressor.Hide();

                // Create the ProgressDialog. This automatically displays the dialog
                progressDialog = (ESRI.ArcGIS.Framework.IProgressDialog2)stepProgressor; // Explict Cast

                // Set the properties of the ProgressDialog
                progressDialog.CancelEnabled = false;
                progressDialog.Description = A4LGSharedFunctions.Localizer.GetString("GeometryToolsProc_12") +"...";
                progressDialog.Title = A4LGSharedFunctions.Localizer.GetString("GeometryToolsProc_12");
                progressDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressGlobe;

                mxdoc = (IMxDocument)app.Document;
                map = editor.Map;

                //Get enumeration of feature layers
                geoFeatureLayerID = new UIDClass();
                geoFeatureLayerID.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";
                enumLayer = map.get_Layers(((ESRI.ArcGIS.esriSystem.UID)geoFeatureLayerID), true);

                //Get enumeration of editable layers
                eLayers = (IEditLayers)editor;

                // Create list of visible line layers with selected feature(s)
                lineLayers = new List<IFeatureLayer>();
                enumLayer.Reset();
                layer = enumLayer.Next();
                while (layer != null)
                {
                    fLayer = (IFeatureLayer)layer;
                    stepProgressor.Message = A4LGSharedFunctions.Localizer.GetString("GeometryToolsMess_2") + fLayer.Name;
                    if (fLayer.Valid && (fLayer.FeatureClass.ShapeType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline)
                       && (fLayer.Visible))
                    {
                        if (eLayers.IsEditable(fLayer))
                        {

                            fSel = fLayer as IFeatureSelection;
                            if (fSel.SelectionSet.Count > 0)
                            {
                                stepProgressor.Message = A4LGSharedFunctions.Localizer.GetString("GeometryToolsMess_3") + fLayer.Name;
                                lineLayers.Add(fLayer);
                            }
                        }
                    }
                    layer = enumLayer.Next();
                }
                if (lineLayers.Count == 0)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeometryToolsError_7"));
                    return;

                }
//.........这里部分代码省略.........
开发者ID:jrinks,项目名称:local-government-desktop-addins,代码行数:101,代码来源:GeometryTools.cs


示例5: Execute

        public void Execute(ESRI.ArcGIS.esriSystem.IArray paramvalues, ESRI.ArcGIS.esriSystem.ITrackCancel TrackCancel, ESRI.ArcGIS.Geoprocessing.IGPEnvironmentManager envMgr, ESRI.ArcGIS.Geodatabase.IGPMessages message)
        {
            try
            {
                IGPUtilities3 gpUtilities3 = new GPUtilitiesClass();

                if (TrackCancel == null)
                {
                    TrackCancel = new CancelTrackerClass();
                }

                IGPValue inputLayersGPValue = gpUtilities3.UnpackGPValue(paramvalues.get_Element(in_LayersNumber));
                IGPMultiValue inputLayersMultiValue = gpUtilities3.UnpackGPValue(inputLayersGPValue) as IGPMultiValue;

                IGPParameter outputGroupLayerParameter = paramvalues.get_Element(out_groupLayerNumber) as IGPParameter;
                IGPValue outputGPGroupLayer = gpUtilities3.UnpackGPValue(outputGroupLayerParameter);
                IGPCompositeLayer outputCompositeLayer = outputGPGroupLayer as IGPCompositeLayer;

                if (outputCompositeLayer == null)
                {
                    message.AddError(120048, string.Format(resourceManager.GetString("GPTools_NullPointerParameterType"), outputGroupLayerParameter.Name));
                    return;
                }

                IGroupLayer groupLayer = null;

                // find the last position of the "\" string
                // in case we find such a thing, i.e. position is >= -1 then let's assume that we are dealing with a layer file on disk
                // otherwise let's create a new group layer instance
                string outputGPLayerNameAsString = outputGPGroupLayer.GetAsText();
                int separatorPosition = outputGPLayerNameAsString.LastIndexOf(System.IO.Path.DirectorySeparatorChar);
                string layerName = String.Empty;

                if (separatorPosition > -1)
                {
                    layerName = outputGPGroupLayer.GetAsText().Substring(separatorPosition + 1);
                }
                else
                {
                    layerName = outputGPGroupLayer.GetAsText();
                }

                ILayer foundLayer = null;
                IGPLayer existingGPLayer = gpUtilities3.FindMapLayer2(layerName, out foundLayer);

                if (foundLayer != null)
                {
                    gpUtilities3.RemoveFromMapEx((IGPValue)existingGPLayer);
                    gpUtilities3.RemoveInternalLayerEx(foundLayer);
                }

                groupLayer = new GroupLayer();
                ((ILayer)groupLayer).Name = layerName;

                for (int layerIndex = 0; layerIndex < inputLayersMultiValue.Count; layerIndex++)
                {
                    IGPValue gpLayerToAdd = inputLayersMultiValue.get_Value(layerIndex) as IGPValue;

                    ILayer sourceLayer = gpUtilities3.DecodeLayer(gpLayerToAdd);

                    groupLayer.Add(sourceLayer);
                }

                outputGPGroupLayer = gpUtilities3.MakeGPValueFromObject(groupLayer);

                if (separatorPosition > -1)
                {
                    try
                    {
                        // in the case that we are dealing with a layer file on disk
                        // let's persist the group layer information into the file
                        ILayerFile pointLayerFile = new LayerFileClass();

                        if (System.IO.Path.GetExtension(outputGPLayerNameAsString).ToUpper().Equals(".LYR"))
                        {
                            if (pointLayerFile.get_IsPresent(outputGPLayerNameAsString))
                            {
                                try
                                {
                                    gpUtilities3.Delete(outputGPGroupLayer);
                                }
                                catch (Exception ex)
                                {
                                    message.AddError(120001, ex.Message);
                                    return;
                                }
                            }

                            pointLayerFile.New(outputGPLayerNameAsString);

                            pointLayerFile.ReplaceContents(groupLayer);

                            pointLayerFile.Save();

                        }

                         outputGPGroupLayer = gpUtilities3.MakeGPValueFromObject(pointLayerFile.Layer);
                    }
                    catch (Exception ex)
                    {
//.........这里部分代码省略.........
开发者ID:weepingdog,项目名称:arcgis-osm-editor,代码行数:101,代码来源:GPCombineLayers.cs


示例6: Execute

        public void Execute(ESRI.ArcGIS.esriSystem.IArray paramvalues, ESRI.ArcGIS.esriSystem.ITrackCancel TrackCancel, ESRI.ArcGIS.Geoprocessing.IGPEnvironmentManager envMgr, ESRI.ArcGIS.Geodatabase.IGPMessages message)
        {
            IGPUtilities3 gpUtilities3 = new GPUtilitiesClass();
            OSMToolHelper osmToolHelper = new OSMToolHelper();

            if (TrackCancel == null)
            {
                TrackCancel = new CancelTrackerClass();
            }

            IGPEnvironment configKeyword = OSMToolHelper.getEnvironment(envMgr, "configKeyword");
            IGPString gpString = configKeyword.Value as IGPString;

            string storageKeyword = String.Empty;

            if (gpString != null)
            {
                storageKeyword = gpString.Value;
            }

            IGPParameter osmFileParameter = paramvalues.get_Element(0) as IGPParameter;
            IGPValue osmFileLocationString = gpUtilities3.UnpackGPValue(osmFileParameter) as IGPValue;

            IGPParameter loadSuperRelationParameter = paramvalues.get_Element(1) as IGPParameter;
            IGPBoolean loadSuperRelationGPValue = gpUtilities3.UnpackGPValue(loadSuperRelationParameter) as IGPBoolean;

            IGPParameter osmSourceLineFeatureClassParameter = paramvalues.get_Element(2) as IGPParameter;
            IGPValue osmSourceLineFeatureClassGPValue = gpUtilities3.UnpackGPValue(osmSourceLineFeatureClassParameter) as IGPValue;

            IGPParameter osmSourcePolygonFeatureClassParameter = paramvalues.get_Element(3) as IGPParameter;
            IGPValue osmSourcePolygonFeatureClassGPValue = gpUtilities3.UnpackGPValue(osmSourcePolygonFeatureClassParameter) as IGPValue;

            IGPParameter osmTargetLineFeatureClassParameter = paramvalues.get_Element(6) as IGPParameter;
            IGPValue osmTargetLineFeatureClassGPValue = gpUtilities3.UnpackGPValue(osmTargetLineFeatureClassParameter) as IGPValue;

            IName workspaceName = gpUtilities3.CreateParentFromCatalogPath(osmTargetLineFeatureClassGPValue.GetAsText());
            IWorkspace2 lineFeatureWorkspace = workspaceName.Open() as IWorkspace2;

            string[] lineFCNameElements = osmTargetLineFeatureClassGPValue.GetAsText().Split(System.IO.Path.DirectorySeparatorChar);

            IFeatureClass osmLineFeatureClass = null;

            IGPParameter tagLineCollectionParameter = paramvalues.get_Element(4) as IGPParameter;
            IGPMultiValue tagLineCollectionGPValue = gpUtilities3.UnpackGPValue(tagLineCollectionParameter) as IGPMultiValue;

            List<String> lineTagstoExtract = null;

            if (tagLineCollectionGPValue.Count > 0)
            {
                lineTagstoExtract = new List<string>();

                for (int valueIndex = 0; valueIndex < tagLineCollectionGPValue.Count; valueIndex++)
                {
                    string nameOfTag = tagLineCollectionGPValue.get_Value(valueIndex).GetAsText();

                    lineTagstoExtract.Add(nameOfTag);
                }
            }
            else
            {
                lineTagstoExtract = OSMToolHelper.OSMSmallFeatureClassFields();
            }

            // lines
            try
            {
                osmLineFeatureClass = osmToolHelper.CreateSmallLineFeatureClass(lineFeatureWorkspace,
                    lineFCNameElements[lineFCNameElements.Length - 1], storageKeyword, "", "", lineTagstoExtract);
            }
            catch (Exception ex)
            {
                message.AddError(120035, String.Format(resourceManager.GetString("GPTools_OSMGPDownload_nullpointfeatureclass"), ex.Message));
                return;
            }

            if (osmLineFeatureClass == null)
            {
                return;
            }

            IGPParameter osmTargetPolygonFeatureClassParameter = paramvalues.get_Element(7) as IGPParameter;
            IGPValue osmTargetPolygonFeatureClassGPValue = gpUtilities3.UnpackGPValue(osmTargetPolygonFeatureClassParameter) as IGPValue;

            workspaceName = gpUtilities3.CreateParentFromCatalogPath(osmTargetPolygonFeatureClassGPValue.GetAsText());
            IWorkspace2 polygonFeatureWorkspace = workspaceName.Open() as IWorkspace2;

            string[] polygonFCNameElements = osmTargetPolygonFeatureClassGPValue.GetAsText().Split(System.IO.Path.DirectorySeparatorChar);

            IFeatureClass osmPolygonFeatureClass = null;

            IGPParameter tagPolygonCollectionParameter = paramvalues.get_Element(5) as IGPParameter;
            IGPMultiValue tagPolygonCollectionGPValue = gpUtilities3.UnpackGPValue(tagPolygonCollectionParameter) as IGPMultiValue;

            List<String> polygonTagstoExtract = null;

            if (tagPolygonCollectionGPValue.Count > 0)
            {
                polygonTagstoExtract = new List<string>();

                for (int valueIndex = 0; valueIndex < tagPolygonCollectionGPValue.Count; valueIndex++)
//.........这里部分代码省略.........
开发者ID:weepingdog,项目名称:arcgis-osm-editor,代码行数:101,代码来源:OSMGPRelationLoader.cs


示例7: CheckConnections

        public static void CheckConnections(IApplication app, bool CheckVisibleOnly)
        {
            IProgressDialog2 progressDialog = default(IProgressDialog2);
            IGeometricNetwork geometricNetwork = null;
            ISelectionEvents selEvents = null;
            IMxDocument mxDoc = null;
            IActiveView activeView = null;
            IMap map = null;
            List<IGeometricNetwork> gnList = null;
            IMouseCursor appCursor = null;
            IEnumFeatureClass enumClass = null;
            IFeatureClass featureClass = null;
            IFeatureLayer featureLayer = null;
            IProgressDialogFactory progressDialogFactory = null;
            ITrackCancel trackCancel = null;
            IStepProgressor stepProgressor = null;
            IFeatureSelection fSel = null;
            IEnumFeature enumFeatures = null;
            IEditor editor = null;

            try
            {
                editor = Globals.getEditor(ref app);
                if (editor == null)
                    return;

                if (editor.EditState == esriEditState.esriStateNotEditing)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("MustBEditg"), A4LGSharedFunctions.Localizer.GetString("GeoNetToolsLbl_2"));
                    return;
                }
                mxDoc = (IMxDocument)app.Document;
                activeView = (IActiveView)mxDoc.FocusMap;
                map = activeView.FocusMap;
                int countDeleted = 0;

                if (activeView == null) return;
                if (map.LayerCount == 0) return;
                long total = Globals.GetTotalVisibleNetworkFeatures(map);
                if (total > 1000)
                {
                    if (MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsAsk_11a") + total + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsAsk_11b"), A4LGSharedFunctions.Localizer.GetString("Proceed"), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }

                }
                string resultMessage = "";
                string resultMessage2 = "";

                //Get visible networks
                gnList = Globals.GetGeometricNetworksCheckedVisible(ref map);

                if (gnList.Count == 0)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_11a"), A4LGSharedFunctions.Localizer.GetString("GeoNetToolsLbl_2"));
                    return;
                }

                //Change mouse cursor to wait - automatically changes back (ArcGIS Desktop only)
                appCursor = new MouseCursorClass();
                appCursor.SetCursor(2);

                //This step is required to avoid accidently deleting features
                if (map.SelectionCount > 0)
                {
                    activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                    map.ClearSelection();
                }

                int itotal = Convert.ToInt32(total);

                //ProgressBar
                progressDialogFactory = new ProgressDialogFactoryClass();

                // Create a CancelTracker

                trackCancel = new CancelTrackerClass();

                // Set the properties of the Step Progressor
                Int32 int32_hWnd = editor.Parent.hWnd;
                stepProgressor = progressDialogFactory.Create(trackCancel, int32_hWnd);
                stepProgressor.MinRange = 0;
                // stepProgressor.MaxRange = itotal
                stepProgressor.StepValue = 1;
                stepProgressor.Message = "";
                stepProgressor.Hide();

                // Create the ProgressDialog. This automatically displays the dialog
                progressDialog = (ESRI.ArcGIS.Framework.IProgressDialog2)stepProgressor; // Explict Cast

                // Set the properties of the ProgressDialog
                progressDialog.CancelEnabled = false;
                progressDialog.Description = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsDesc_11");
                progressDialog.Title = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsTitle_11");
                progressDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressGlobe;

                for (int i = 0; i < gnList.Count; i++)
                {
                    geometricNetwork = gnList[i] as IGeometricNetwork;
//.........这里部分代码省略.........
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:101,代码来源:GeoNetTools.cs


示例8: ProfileCreateGraph


//.........这里部分代码省略.........
                pScatterSeriesProps.LabelField = "LABEL";

                if (ProfileGraph[CurrentDetail].PointAlong_ShowLabels.ToUpper() == "TRUE" && ProfileGraph[CurrentDetail].PointAlong_Labels.Length > 0)
                {

                    pScatterSeriesProps.Marks = true;
                }

                pScatterSeriesProps.InLegend = true; // show legend   ' false = don't show legend
                pScatterSeriesProps.Name = ProfileGraph[CurrentDetail].PointAlong_LayerName;//"Points Along";
                //pSeriesProps.LabelField = "OBJECTID"
                pScatterSeriesProps.ValueFormat = " ";

                pScatterSeriesProps.SetField(0, strXDataFldName);// timefldName
                pScatterSeriesProps.SetField(1, strYDataFldName);

                pColor = Globals.GetColor(255, 0, 0);// green

                pScatterSeriesProps.CustomColor = pColor.RGB;  // pSymbol.Color.RGB

                // don't have any symbols on the line, just solid
                //IPointSeriesProperties pScatterSeriesProps2;
                pScatterSeriesProps2 = (IPointSeriesProperties)pScatterSeriesProps;// 'QI

                pScatterSeriesProps2.SymbolProperties.Style = esriDataGraphTSymbolType.esriDataGraphTSymbolStar;
                pScatterSeriesProps2.SymbolProperties.Visible = true;

                pScatterSeriesProps2.SymbolProperties.Color = pColor.RGB;
                pScatterSeriesProps2.SymbolProperties.BorderProperties.Color = pColor.RGB;
                pScatterSeriesProps2.SymbolProperties.BorderProperties.Style = esriDataGraphTPenType.esriDataGraphTPenSolid;

                pDataGraphBase.UseSelectedSet = false;

                pCancelTracker = new CancelTrackerClass();
                pDataGraphT.Update(pCancelTracker);

                // create data graph window

                pDataGraphWin = new DataGraphWindowClass();
                pDataGraphWin.DataGraphBase = pDataGraphBase;
                pDataGraphWin.Application = app;
                // size and position the window
                pDataGraphWin.PutPosition(0, 0, 900, 250);

                // add the graph to the project

                pDataGraphs = (IDataGraphCollection)pMxDoc; //QI
                pDataGraphs.AddDataGraph(pDataGraphBase);
                //IDataGraphT ptmp = (IDataGraphT)pDataGraphs.DataGraph[1];

                //string fld = ptmp.SeriesProperties[5].GetField(0);
                //fld = ptmp.SeriesProperties[5].GetField(1);
                //fld = ptmp.SeriesProperties[5].GetField(2);
                //fld = ptmp.SeriesProperties[5].LabelField;
                //fld = ptmp.SeriesProperties[5].Marks.ToString();
                //   fld = ptmp.SeriesProperties[5].HorizontalAxis;

                pDataGraphT.AxisProperties[0].AutomaticMaximum = true;
                pDataGraphT.AxisProperties[0].AutomaticMinimum = true;
                // pDataGraphT.AxisProperties[0].Minimum = minChartVal - 5;
                //pDataGraphT.AxisProperties[0].Maximum = maxChartVal + 5;
                pDataGraphT.AxisProperties[0].InitDefaults();

                // show the graph
                pDataGraphWin.Show(true);
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:66,代码来源:GeoNetTools.cs


示例9: TraceIsolationSummary

        public static void TraceIsolationSummary(IApplication app, string sourceFLName, string valveFLName, string operableFieldNameValve, string operableFieldNameSource,
                                double snapTol, bool processEvent, string[] opValues, string addSQL, bool traceIndeterminate, bool ZeroSourceCont,
                                    string mainsFLName, string meterFLName, string metersCritFieldName, string metersCritValue,
                                string traceSum_LayerName, string traceSum_FacilityIDField, string traceSum_DateFieldName, string traceSum_ValveCountFieldName,
                                    string traceSum_MeterCountFieldName, string traceSum_CritMeterCountFieldName, string traceSum_CommentsFieldName)
        {
            IFeatureLayer mainsFL = null;

            IFeatureLayer resultsLayer = null;
            IFeatureClass mainFC = null;
            INetworkClass mainsNetwork = null;
            IFeatureClass resultsFC = null;
            IFeatureSelection mainsFS = null;
            IFeature pMainsFeat = null;
            IProgressDialogFactory pProDFact = null;
            IStepProgressor pStepPro = null;
            IProgressDialog2 pProDlg = null;
            ITrackCancel pTrkCan = null;
            IWorkspaceEdit pWSEdit = null;
            IFeatureCursor pFC = null;
            IFeatureCursor pInsCur = null;
            // IFeatureClassLoad featureClassLoad = null;
            // ISchemaLock schemaLock = null;
            IFeatureBuffer pSumFeatBuf = null;
            IEnumIDs pSelectIDs = null;

            ICurve pCurve = null;
            IPoint pPnt = null;
            IDataset pDS = null;

            int facilityIDFieldPosition;

            int resultsFacilityIDFieldPosition;
            //int resultsSourceIDFieldPosition;
            int resultsDateFieldPosition;
            int resultsValveCountFieldPosition;
            int resultsMeterCountFieldPosition;
            int resultsCritMeterCountFieldPosition;
            int resultsCommentsFieldPosition;

            try
            {

                bool FCorLayerMains = true;
                mainsFL = (IFeatureLayer)Globals.FindLayer(((IMxDocument)app.Document).FocusMap, mainsFLName, ref FCorLayerMains);
                if (mainsFL == null)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsMess_15d") + mainsFLName + " feature class was not found.\r\n Check the TraceIsolationSummary_Main_FeatureLayer tag in the config");
                    return;
                }
                mainFC = mainsFL.FeatureClass;

                //Determine field position for facility id
                facilityIDFieldPosition = mainFC.Fields.FindField("FACILITYID");
                if (facilityIDFieldPosition == -1)
                    facilityIDFieldPosition = mainFC.Fields.FindField("FACID");
                if (facilityIDFieldPosition == -1)
                    facilityIDFieldPosition = mainFC.Fields.FindField("ASSETID");
                if (facilityIDFieldPosition == -1)
                    facilityIDFieldPosition = mainFC.Fields.FindField(mainFC.OIDFieldName);
                if (facilityIDFieldPosition == -1)
                    return;

                mainsNetwork = mainFC as INetworkClass;
                if ((mainsNetwork == null) || (mainsNetwork.GeometricNetwork == null))
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsMess_15d") + mainsFLName + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_18a"));
                    return;
                }

                mainsFS = (IFeatureSelection)mainsFL;
                int FeatureCount = 0;
                if (mainsFS.SelectionSet.Count == 0)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("No") + mainsFL.Name + A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_18b"),
                        A4LGSharedFunctions.Localizer.GetString("GeoNetToolsLbl_18a"), MessageBoxButtons.OK);

                    return;

                }
                FeatureCount = mainsFS.SelectionSet.Count;

                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.Description = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsDesc_18a");
                pProDlg.Title = A4LGSharedFunctions.Localizer.GetString("GeoNetToolsTitle_18a");
                pProDlg.Animation = esriProgressAnimationTypes.esriProgressGlobe;

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

                pStepPro.MinRange = 1;
                pStepPro.MaxRange = FeatureCount - 1;
//.........这里部分代码省略.........
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:101,代码来源:GeoNetTools.cs


示例10: Execute

        public void Execute(ESRI.ArcGIS.esriSystem.IArray paramvalues, ESRI.ArcGIS.esriSystem.ITrackCancel TrackCancel, ESRI.ArcGIS.Geoprocessing.IGPEnvironmentManager envMgr, ESRI.ArcGIS.Geodatabase.IGPMessages message)
        {
            try
            {
                IGPUtilities3 execute_Utilities = new GPUtilitiesClass();

                if (TrackCancel == null)
                {
                    TrackCancel = new CancelTrackerClass();
                }

                IGPParameter inputOSMParameter = paramvalues.get_Element(in_osmFeatureClass) as IGPParameter;
                IGPValue inputOSMGPValue = execute_Utilities.UnpackGPValue(inputOSMParameter);

                IGPParameter tagCollectionParameter = paramvalues.get_Element(in_attributeSelector) as IGPParameter;
                IGPMultiValue tagCollectionGPValue = execute_Utilities.UnpackGPValue(tagCollectionParameter) as IGPMultiValue;

                if (tagCollectionGPValue == null)
                {
                    message.AddError(120048, string.Format(resourceManager.GetString("GPTools_NullPointerParameterType"), tagCollectionParameter.Name));
                    return;
                }

                bool useUpdateCursor = false;

                IFeatureClass osmFeatureClass = null;
                ITable osmInputTable = null;
                IQueryFilter osmQueryFilter = null;

                try
                {
                    execute_Utilities.DecodeFeatureLayer(inputOSMGPValue, out osmFeatureClass, out osmQueryFilter);
                    if (osmFeatureClass != null)
                    {
                        if (osmFeatureClass.Extension is IOSMClassExtension)
                        {
                            useUpdateCursor = false;
                        }
                        else
                        {
                            useUpdateCursor = true;
                        }
                    }

                    osmInputTable = osmFeatureClass as ITable;
                }
                catch { }

                try
                {
                    if (osmInputTable == null)
                    {
                        execute_Utilities.DecodeTableView(inputOSMGPValue, out osmInputTable, out osmQueryFilter);
                    }
                }
                catch { }

                if (osmInputTable == null)
                {
                    string errorMessage = String.Format(resourceManager.GetString("GPTools_OSMGPAttributeSelecto_unableopentable"), inputOSMGPValue.GetAsText());
                    message.AddError(120053, errorMessage);
                    return;
                }

                // find the field that holds tag binary/xml field
                int osmTagCollectionFieldIndex = osmInputTable.FindField("osmTags");

                // if the Field doesn't exist - wasn't found (index = -1) get out
                if (osmTagCollectionFieldIndex == -1)
                {
                    message.AddError(120005, resourceManager.GetString("GPTools_OSMGPAttributeSelector_notagfieldfound"));
                    return;
                }

                // check if the tag collection includes the keyword "ALL", if does then we'll need to extract all tags
                bool extractAll = false;
                for (int valueIndex = 0; valueIndex < tagCollectionGPValue.Count; valueIndex++)
                {
                    if (tagCollectionGPValue.get_Value(valueIndex).GetAsText().Equals("ALL"))
                    {
                        extractAll = true;
                        break;
                    }
                }
                //if (extractAll)
                //{
                //    if (osmTagKeyCodedValues == null)
                //        extractAllTags(ref osmTagKeyCodedValues, osmInputTable, osmQueryFilter, osmTagCollectionFieldIndex, false);

                //    if (osmTagKeyCodedValues == null)
                //    {
                //        message.AddAbort(resourceManager.GetString("GPTools_OSMGPAttributeSelector_Unable2RetrieveTags"));
                //        return;
                //    }

                //    // empty the existing gp multivalue object
                //    tagCollectionGPValue = new GPMultiValueClass();

                //    // fill the coded domain in gp multivalue object
                //    for (int valueIndex = 0; valueIndex < osmTagKeyCodedValues.CodeCount; valueIndex++)
//.........这里部分代码省略.........
开发者ID:hallahan,项目名称:arcgis-osm-editor,代码行数:101,代码来源:OSMGPAttributeSelector.cs


示例11: OnClick


//.........这里部分代码省略.........
            if (!FabricUTILS.SetupEditEnvironment(pWS, pCadFabric, pEd, out bIsFileBasedGDB,
              out bIsUnVersioned, out bUseNonVersionedDelete))
              return;

            //loop through each control layer and
            //Get the selection of control
             int iCnt=0;
             int iTotalSelectionCount = 0;
             for (; iCnt < CFControlLayers.Count; iCnt++)
             {
               pFL = (IFeatureLayer)CFControlLayers.get_Element(iCnt);
               IFeatureSelection pFeatSel = (IFeatureSelection)pFL;
               ISelectionSet2 pSelSet = (ISelectionSet2)pFeatSel.SelectionSet;
               iTotalSelectionCount += pSelSet.Count;
             }

             if (iTotalSelectionCount == 0)
             {
               MessageBox.Show("Please select some fabric control points and try again.", "No Selection",
             MessageBoxButtons.OK, MessageBoxIcon.Information);
               if (bUseNonVersionedDelete)
               {
             pCadEd.CadastralFabricLayer = null;
             CFControlLayers = null;
               }
               return;
             }

             bShowProgressor = (iTotalSelectionCount > 10);

             if (bShowProgressor)
             {
               pProgressorDialogFact = new ProgressDialogFactoryClass();
               pTrackCancel = new CancelTrackerClass();
               pStepProgressor = pProgressorDialogFact.Create(pTrackCancel, ArcMap.Application.hWnd);
               pProgressorDialog = (IProgressDialog2)pStepProgressor;
               pStepProgressor.MinRange = 1;
               pStepProgressor.MaxRange = iTotalSelectionCount * 2; //(runs through selection twice)
               pStepProgressor.StepValue = 1;
               pProgressorDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressSpiral;
             }

            //loop through each control layer and
            //delete from its selection
            m_pQF = new QueryFilterClass();
            iCnt=0;
            for (; iCnt < CFControlLayers.Count; iCnt++)
            {
              pFL = (IFeatureLayer)CFControlLayers.get_Element(iCnt);
              IFeatureSelection pFeatSel = (IFeatureSelection)pFL;
              ISelectionSet2 pSelSet = (ISelectionSet2)pFeatSel.SelectionSet;

              ISQLSyntax pSQLSyntax = (ISQLSyntax)pWS;
              string sPref = pSQLSyntax.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierPrefix);
              string sSuff = pSQLSyntax.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierSuffix);

              if (bShowProgressor)
              {
            pProgressorDialog.ShowDialog();
            pStepProgressor.Message = "Collecting Control point data...";
              }

              //Add the OIDs of all the selected control points into a new feature IDSet
              string[] sOIDListPoints = { "(" };
              int tokenLimit = 995;
              //int tokenLimit = 5; //temp for testing
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:67,代码来源:clsDeleteSelectedControl.cs


示例12: batchLoadBarriers

        public static void batchLoadBarriers(IApplication app)
        {
            bool fndAsLayer = false;
            List<string> strFiles = new List<string>();

            IEnumLayer pLays = null;
            IProgressDialogFactory pProDFact = null;
            IStepProgressor pStepPro = null;
            IProgressDialog2 pProDlg = null;
            ITrackCancel pTrkCan = null;
            IFeatureLayer pFl = null;
            IFeatureCursor featureCursor = null;

            IFeature feature = null;
            IFeatureLayerDefinition2 pFLD = null;
            IQueryFilter pQF = null;
            ILayer pLay = null;
            bool boolCont = true;
            int featCount = 0;
            try
            {
                double seTol = ConfigUtil.GetConfigValue("Trace_Click_Point_Tolerence", 5.0);
                pLays = Globals.GetLayers(app, "VECTOR");
                if (pLays != null)
                {
                    pLay = pLays.Next();

                    while (pLay != null)
                    {
                        if (pLay is IFeatureLayer)
                        {
                            if (((IFeatureLayer)pLay).FeatureClass != null)
                            {
                                if (((IFeatureLayer)pLay).FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                                {
                                    strFiles.Add(pLay.Name);

                                }
                            }

                        }
                        pLay = pLays.Next();
                    }
                    //MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsLbl_1") + "\n" + ex.Message, ex.Source);
                    string strRetVal = Globals.showOptionsForm(strFiles, A4LGSharedFunctions.Localizer.GetString("GeoNetToolsBatchBarrier"), ComboBoxStyle.DropDownList);
                    if (strRetVal != null && strRetVal != "||Cancelled||")
                    {
                        pFl = (IFeatureLayer)Globals.FindLayer(app, strRetVal, ref fndAsLayer);
                        if (pFl == null)
                        {

                            MessageBox.Show(strRetVal + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14bb"));
                            return;
                        }
                        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);
                       

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CancellationToken类代码示例发布时间:2022-05-24
下一篇:
C# CancelEventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap