private void SelectExtents(MapWinGIS.Extents ext) { object[] Shapes = new object[m_Map.NumLayers]; if (m_CurrentLayer == -1 || m_CurrentLayer >= m_Map.NumLayers) { for (int lyr = 0; lyr < m_Map.NumLayers; lyr++) { object ob = m_Map.get_GetObject(lyr); if (ob.GetType() != typeof(MapWinGIS.Shapefile)) { return; } MapWinGIS.Shapefile sf = ob as MapWinGIS.Shapefile; sf.SelectShapes(ext, 0, MapWinGIS.SelectMode.INTERSECTION, ref Shapes[m_CurrentLayer]); } } else { object ob = m_Map.get_GetObject(m_CurrentLayer); if (ob.GetType() != typeof(MapWinGIS.Shapefile)) { return; } MapWinGIS.Shapefile sf = ob as MapWinGIS.Shapefile; sf.SelectShapes(ext, 0, MapWinGIS.SelectMode.INTERSECTION, ref Shapes[m_CurrentLayer]); } m_Map.SuspendLayout(); // If shift is down then we append to the selection if (m_ShiftPressed == false) { // Clear the selection first ClearSelectedShapes(); } //Append selected shapes for (int lyr = 0; lyr < m_Map.NumLayers; lyr++) { int[] myShapes = Shapes[lyr] as int[]; for (int shp = 0; shp <= myShapes.GetUpperBound(0); shp++) { if (m_SelectedShapes[lyr].Contains(myShapes[shp])) { continue; } m_SelectedShapes[lyr].Add(myShapes[shp]); } } for (int lyr = 0; lyr < m_SelectedShapes.GetUpperBound(0); lyr++) { Highlight_Layer(lyr); } m_Map.ResumeLayout(); }