Esempio n. 1
0
        /// <summary> Clear all selections </summary>
        public void ClearSelection()
        {
            foreach (var kvp in selectedcells)
            {
                foreach (var cell in kvp.Value)
                {
                    rows[kvp.Key].Cells[cell].SelectedNI = false;
                }

                contentpanel.RowChanged(kvp.Key);     // inform CP
                rows[kvp.Key].SelectedNI = false;
            }

            selectedcells.Clear();
            SelectionCleared?.Invoke();
        }
        /// <summary>
        /// Receives the extent made by selection box or a click select to select shapes in a shapefile using intersection.
        /// Afterwards, a Selection event is raised
        /// </summary>
        /// <param name="selectExtents"></param>
        /// <param name="selectionFromSelectBox"></param>
        private void Select(Extents selectExtents, bool selectionFromSelectBox = false)
        {
            if (_currentMapLayer != null)
            {
                _selectedShapeIndexes   = null;
                _selectionFromSelectBox = selectionFromSelectBox;
                if (_currentMapLayer.LayerType == "ShapefileClass")
                {
                    var sf = _axMap.get_Shapefile(_currentMapLayer.Handle);
                    if (sf != null)
                    {
                        _currentMapLayer.SelectedIndexes = null;
                        sf.SelectNone();
                        sf.SelectionAppearance = tkSelectionAppearance.saDrawingOptions;

                        switch (sf.ShapefileType)
                        {
                        case ShpfileType.SHP_POINT:
                            if (sf.Categories.Count > 0)
                            {
                                sf.SelectionAppearance = tkSelectionAppearance.saSelectionColor;
                            }
                            else
                            {
                                sf.SelectionAppearance = tkSelectionAppearance.saDrawingOptions;
                                sf.SelectionDrawingOptions.PointSize     = sf.DefaultDrawingOptions.PointSize;
                                sf.SelectionDrawingOptions.PointRotation = sf.DefaultDrawingOptions.PointRotation;
                                sf.SelectionDrawingOptions.PointShape    = sf.DefaultDrawingOptions.PointShape;
                            }
                            break;

                        case ShpfileType.SHP_POLYGON:
                            break;

                        case ShpfileType.SHP_POLYLINE:

                            break;
                        }

                        var objSelection = new object();
                        if (sf.SelectShapes(selectExtents, 0, SelectMode.INTERSECTION, ref objSelection))
                        {
                            _selectedShapeIndexes            = (int[])objSelection;
                            _currentMapLayer.SelectedIndexes = _selectedShapeIndexes;
                            for (int n = 0; n < _selectedShapeIndexes.Length; n++)
                            {
                                sf.ShapeSelected[_selectedShapeIndexes[n]] = true;
                            }
                            if (ShapesSelected != null)
                            {
                                var lyArg = new LayerEventArg(_currentMapLayer.Handle, _selectedShapeIndexes);
                                ShapesSelected(this, lyArg);
                            }
                        }
                        else
                        {
                            SelectionCleared?.Invoke(this, EventArgs.Empty);
                        }
                        _axMap.Redraw();
                        Selection?.Invoke(this, EventArgs.Empty);
                    }
                }
                else if (_currentMapLayer.LayerType == "ImageClass")
                {
                }
            }
        }
Esempio n. 3
0
 void OnRightButtonDown(int x, int y)
 {
     Selection = null;
     SelectionCleared?.Invoke();
 }
Esempio n. 4
0
 private void clearSelection() => SelectionCleared?.Invoke();
Esempio n. 5
0
 /// <summary>
 /// Fires the selection cleared event.
 /// </summary>
 /// <param name="args">The arguments.</param>
 protected virtual void OnSelectionCleared(FeatureChangeArgs args)
 {
     SelectionCleared?.Invoke(this, args);
 }