Пример #1
0
        /// <summary>
        /// Get elements in frame.
        /// </summary>
        /// <param name="objectLayer">Layer to find elements.</param>
        /// <param name="frame">Frame.</param>
        /// <returns>Elements in frame.</returns>
        private List <object> _GetElementsInSelectionFrame(ObjectLayer objectLayer,
                                                           ESRI.ArcGIS.Client.Geometry.Envelope frame)
        {
            Debug.Assert(SelectedItems != null);
            Debug.Assert(_selectionFrame != null);
            Debug.Assert(_clustering != null);

            List <object> elementsInFrame = new List <object>();

            foreach (DataGraphicObject graphic in objectLayer.MapLayer.Graphics)
            {
                // Null extent in case of empty polyline.
                if (graphic.Geometry != null && graphic.Geometry.Extent != null &&
                    graphic.Data.GetType() == objectLayer.LayerType)
                {
                    // If graphic in frame, data type is equals to objectLayer data type and data contains in objectayercollection.
                    if (MapHelpers.IsIntersects(frame, graphic.Geometry) && graphic.Data.GetType() == objectLayer.LayerType &&
                        MapHelpers.CollectionContainsData(objectLayer.Collection, graphic.Data))
                    {
                        elementsInFrame.Add(graphic.Data);
                    }
                }
            }

            _clustering.AddElementsFromClusterAndNotInFrame(objectLayer, frame, elementsInFrame);

            return(elementsInFrame);
        }
Пример #2
0
        /// <summary>
        /// Add elements from cluster and not in frame
        /// </summary>
        /// <param name="objectLayer">Object layer to find cluster</param>
        /// <param name="frame">Selection fram envelope</param>
        /// <param name="elementsInFrame">Already selected elements list</param>
        public void AddElementsFromClusterAndNotInFrame(ObjectLayer objectLayer, Envelope frame, IList <object> elementsInFrame)
        {
            foreach (ClusterGraphicObject clusterGraphic in ClusterGraphicObject.Graphics)
            {
                if (MapHelpers.IsIntersects(frame, clusterGraphic.Geometry))
                {
                    IList <object> clusterDataList = GetClusteredData(clusterGraphic);

                    foreach (object data in clusterDataList)
                    {
                        // if graphic not in frame yet, data type is equals to objectLayer data type and data contains in objectayercollection
                        if (data.GetType() == objectLayer.LayerType && !elementsInFrame.Contains(data) &&
                            MapHelpers.CollectionContainsData(objectLayer.Collection, data))
                        {
                            elementsInFrame.Add(data);
                        }
                    }
                }
            }
        }