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


C# IMap.ClearSelection方法代码示例

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


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

示例1: TracePath


//.........这里部分代码省略.........
                {
                    IPoint snappedPoint = null; int EID = -1;
                    if (gn == null)
                    {

                        pNetFlags.Add(Globals.GetJunctionFlag(Xs[i], Ys[i], ref map, ref gnList, snapTol, ref gnIdx,
                                    out snappedPoint, out EID, out  pFlagDisplay, true) as INetFlag);

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

                    }
                    else
                    {
                        pNetFlags.Add(Globals.GetJunctionFlagWithGN(Xs[i], Ys[i], ref map, ref gn, ref snapTol, out snappedPoint, out EID, out  pFlagDisplay, true) as INetFlag);

                    }
                }

                if (gn == null || pNetFlags.Count < 1)
                {
                    return (A4LGSharedFunctions.Localizer.GetString("GeoNetToolsError_17b"));

                }

                if (app != null)
                {

                    pID = new UID();

                    pID.Value = "esriEditorExt.UtilityNetworkAnalysisExt";
                    pNetAnalysisExt = (INetworkAnalysisExt)app.FindExtensionByCLSID(pID);
                    Globals.SetCurrentNetwork(ref pNetAnalysisExt, ref gn);
                    traceFlowSolver = Globals.CreateTraceFlowSolverFromToolbar(ref pNetAnalysisExt, out pEdgeFlags, out pJunctionFlags, out pEdgeElementBarriers, out pJunctionElementBarriers, out pSelectionSetBarriers) as ITraceFlowSolverGEN;

                }
                else
                {
                    traceFlowSolver = new TraceFlowSolverClass() as ITraceFlowSolverGEN;
                    INetSolver netSolver = traceFlowSolver as INetSolver;

                    netSolver.SourceNetwork = gn.Network;

                }

                traceFlowSolver.TraceIndeterminateFlow = traceIndeterminate;

                if (pEdgeFlags != null)
                {
                    foreach (IEdgeFlag pEdFl in pEdgeFlags)
                    {
                        pNetFlags.Add((INetFlag)pEdFl);

                    }
                }
                if (pJunctionFlags != null)
                {

                    foreach (IJunctionFlag pJcFl in pJunctionFlags)
                    {
                        pNetFlags.Add((INetFlag)pJcFl);
                    }
                }
                //if (startNetFlag != null)
                //{

                //    pNetFlags.Add((INetFlag)startNetFlag);

                //}

                Globals.AddFlagsToTraceSolver(pNetFlags.ToArray(), ref traceFlowSolver, out junctionFlags, out edgeFlags);
                int intCount = 1;
                System.Object[] segCosts = new System.Object[1];
                segCosts[0] = new System.Object();

                traceFlowSolver.FindPath(esriFlowMethod.esriFMConnected, esriShortestPathObjFn.esriSPObjFnMinMax,
                    out juncEIDs, out edgeEIDs, intCount, ref segCosts);

                //Select junction features
                map.ClearSelection();
                IJunctionFlag[] junctionFlag = null;
                Globals.SelectJunctions(ref map, ref  gn, ref juncEIDs, ref junctionFlag, "", "", "", true);
                if (selectEdges)
                    Globals.SelectEdges(ref map, ref gn, ref edgeEIDs);
                edgeEIDs.Reset();

                //Draw edge graphics
                IEnvelope env = Globals.DrawEdges(ref map, ref gn, ref edgeEIDs);

                return edgeEIDs.Count.ToString();

            }
            catch (Exception Ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("GeoNetToolsLbl_17a") + "\n" + Ex.Message);
                return "";

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

示例2: SelectFeaturesOnMap

        /// <summary>
        /// Selects a feature on the map.
        /// </summary>
        /// <param name="feature">The feature to select.</param>
        /// <param name="map">The map.</param>
        /// <returns>Returns true if the feature was selected, otherwise returns false.</returns>
        public static bool SelectFeaturesOnMap(IList<IFeature> features, IMap map)
        {
            bool selectionSuccessful = false;

            if (features != null && map != null)
            {
                IActiveView activeView = map as IActiveView;

                if (activeView != null)
                {
                    try
                    {
                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                        map.ClearSelection();

                        foreach (IFeature feature in features)
                        {
                            string qualifiedName = DisplayMap.GetQualifiedName(feature);
                            ILayer layer = GetLayerForFeature(feature, map);
                            if (layer != null)
                                map.SelectFeature(layer, feature);
                        }

                        activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                        InvalidateMap(features, (IActiveView)map);
                        selectionSuccessful = true;
                    }
                    catch (Exception e)
                    {
                        //_logger.LogAndDisplayException(e);
                    }
                }
            }
            return selectionSuccessful;
        }
开发者ID:Ramakrishnapv,项目名称:FuturaNetwork,代码行数:41,代码来源:DisplayMap.cs

示例3: SelectFeature

        /// <summary>
        /// Selects a feature on the map.
        /// </summary>
        /// <param name="feature">The feature to select.</param>
        /// <param name="map">The map.</param>
        /// <returns>Returns true if the feature was selected, otherwise returns false.</returns>
        public static bool SelectFeature(IFeature feature, IMap map, IActiveView activeView, bool isInternalSelection)
        {
            bool selectionSuccessful = false;

            if (feature != null && map != null)
            {
                try
                {
                    // Core.DeveloperSettings.IsInternalSelection = true;
                    ILayer layer = GetLayerForFeature(feature, map);
                    map.ClearSelection();

                    if (layer != null)
                    {
                        map.SelectFeature(layer, feature);

                        if (activeView != null)
                            activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, activeView.Extent);

                        InvalidateMap(feature, activeView);
                        selectionSuccessful = true;
                    }
                }
                catch (Exception e)
                {
                    //_logger.LogAndDisplayException(e);
                }
                finally
                {
                    // Core.DeveloperSettings.IsInternalSelection = false;
                }
            }
            return selectionSuccessful;
        }
开发者ID:Ramakrishnapv,项目名称:FuturaNetwork,代码行数:40,代码来源:DisplayMap.cs

示例4: SelectFeatureOnMap

        /// <summary>
        /// Selects a feature on the map.
        /// </summary>
        /// <param name="feature">The feature to select.</param>
        /// <param name="map">The map.</param>
        /// <returns>Returns true if the feature was selected, otherwise returns false.</returns>
        public static bool SelectFeatureOnMap(IFeature feature, IMap map)
        {
            bool selectionSuccessful = false;
            if (feature != null && map != null)
            {
                try
                {
                    //string qualifiedName = DataContainer.GetQualifiedName(feature);
                    ILayer layer = GetLayerForFeature(feature, map);

                    PartialRefresh((IActiveView)map);
                    map.ClearSelection();
                    if (layer != null)
                    {
                        map.SelectFeature(layer, feature);
                        PartialRefresh((IActiveView)map);
                        InvalidateMap(feature, (IActiveView)map);
                        selectionSuccessful = true;
                    }
                }
                catch (Exception e)
                {
                    //_logger.LogAndDisplayException(e);
                }
            }
            return selectionSuccessful;
        }
开发者ID:Ramakrishnapv,项目名称:FuturaNetwork,代码行数:33,代码来源:DisplayMap.cs

示例5: ClearMapSelection

 public static void ClearMapSelection(IMap map)
 {
     map.ClearSelection();
 }
开发者ID:weigiser,项目名称:AOProjects,代码行数:4,代码来源:MapSelectionHelperClass.cs


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