Ejemplo n.º 1
0
 public Feature HitTestByPrj(ShapePoint prjPoint)
 {
     ILayer[] lyrs = _map.LayerContainer.Layers;
     if (lyrs == null || lyrs.Length == 0)
     {
         return(null);
     }
     foreach (IFeatureLayer y in lyrs)
     {
         if (!(y is IFeatureLayer))
         {
             continue;
         }
         if (!_map.LayerContainer.IsSelectable(y.Name))
         {
             continue;
         }
         BaseFeatureRenderer r = y.Renderer as BaseFeatureRenderer;
         if (r._currentFeatureRects.Count > 0)
         {
             foreach (Feature fet in r._currentFeatureRects.Keys)
             {
                 if (fet.Geometry == null)
                 {
                     continue;
                 }
                 if (fet.Geometry.Contains(prjPoint))
                 {
                     return(fet);
                 }
             }
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
 public void HitTest(PointF pixelPt, out Feature feature, out RectangleF rect)
 {
     feature = null;
     rect    = RectangleF.Empty;
     if (_map == null)
     {
         return;
     }
     ILayer[] lyrs = _map.LayerContainer.Layers;
     if (lyrs == null || lyrs.Length == 0)
     {
         return;
     }
     foreach (IFeatureLayer y in lyrs)
     {
         if (!(y is IFeatureLayer))
         {
             continue;
         }
         if (!_map.LayerContainer.IsSelectable(y.Name))
         {
             continue;
         }
         BaseFeatureRenderer r = y.Renderer as BaseFeatureRenderer;
         if (r._currentFeatureRects.Count > 0)
         {
             foreach (Feature fet in r._currentFeatureRects.Keys)
             {
                 rect = r._currentFeatureRects[fet];
                 if (rect.Contains(pixelPt))
                 {
                     feature = fet;
                     return;
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
        public Feature[] HitTest(RectangleF rect)
        {
            if (_map == null)
            {
                return(null);
            }
            ILayer[] lyrs = _map.LayerContainer.Layers;
            if (lyrs == null || lyrs.Length == 0)
            {
                return(null);
            }
            List <Feature> fets = new List <Feature>();

            foreach (IFeatureLayer y in lyrs)
            {
                if (!(y is IFeatureLayer))
                {
                    continue;
                }
                if (!_map.LayerContainer.IsSelectable(y.Name))
                {
                    continue;
                }
                BaseFeatureRenderer r = y.Renderer as BaseFeatureRenderer;
                if (r._currentFeatureRects.Count > 0)
                {
                    foreach (Feature fet in r._currentFeatureRects.Keys)
                    {
                        rect = r._currentFeatureRects[fet];
                        if (rect.Contains(rect))
                        {
                            fets.Add(fet);
                        }
                    }
                }
            }
            return(fets.Count > 0 ? fets.ToArray() : null);
        }
Ejemplo n.º 4
0
        public Feature[] HitTestByPrj(Envelope prjRect)
        {
            ILayer[] lyrs = _map.LayerContainer.Layers;
            if (lyrs == null || lyrs.Length == 0)
            {
                return(null);
            }
            List <Feature> fets = new List <Feature>();

            foreach (IFeatureLayer y in lyrs)
            {
                if (!(y is IFeatureLayer))
                {
                    continue;
                }
                if (!_map.LayerContainer.IsSelectable(y.Name))
                {
                    continue;
                }
                BaseFeatureRenderer r = y.Renderer as BaseFeatureRenderer;
                if (r._currentFeatureRects.Count > 0)
                {
                    foreach (Feature fet in r._currentFeatureRects.Keys)
                    {
                        if (fet.Geometry == null)
                        {
                            continue;
                        }
                        if (prjRect.Contains(fet.Geometry.Envelope))
                        {
                            fets.Add(fet);
                        }
                    }
                }
            }
            return(fets.Count > 0 ? fets.ToArray() : null);
        }