/// <summary>
        /// Handles the Mouse-Up situation.
        /// </summary>
        /// <param name="e">The GeoMouseArcs class describes the mouse condition along with geographic coordinates.</param>
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            if (_standBy)
            {
                return;
            }
            if (_featureSet == null || _featureSet.IsDisposed)
            {
                return;
            }

            if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right)
            {
                // Add the current point to the featureset
                if (_featureSet.FeatureType == FeatureType.Point)
                {
                    // Begin snapping changes
                    Coordinate snappedCoord = _coordinateDialog.Coordinate;
                    ComputeSnappedLocation(e, ref snappedCoord);
                    // End snapping changes

                    Topology.Point pt = new Topology.Point(snappedCoord); // Snapping changes
                    Feature        f  = new Feature(pt);
                    _featureSet.Features.Add(f);
                    _featureSet.ShapeIndices = null; // Reset shape indices
                    _featureSet.UpdateExtent();
                    _layer.AssignFastDrawnStates();
                    _featureSet.InvalidateVertices();
                    return;
                }

                if (e.Button == MouseButtons.Right)
                {
                    _context.Show((Control)Map, e.Location);
                }
                else
                {
                    if (_coordinates == null)
                    {
                        _coordinates = new List <Coordinate>();
                    }

                    // Begin snapping changes
                    Coordinate snappedCoord = e.GeographicLocation;
                    ComputeSnappedLocation(e, ref snappedCoord);
                    // End snapping changes

                    _coordinates.Add(snappedCoord); // Snapping changes
                    if (_coordinates.Count > 1)
                    {
                        Point     p1      = Map.ProjToPixel(_coordinates[_coordinates.Count - 1]);
                        Point     p2      = Map.ProjToPixel(_coordinates[_coordinates.Count - 2]);
                        Rectangle invalid = SymbologyGlobal.GetRectangle(p1, p2);
                        invalid.Inflate(20, 20);
                        Map.Invalidate(invalid);
                    }
                }
            }
            base.OnMouseUp(e);
        }
예제 #2
0
        /// <inheritdoc />
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            if (e.Button == MouseButtons.Left && _dragging)
            {
                _dragging  = false;
                Map.IsBusy = false;
                _featureSet.InvalidateVertices();

                if (_featureSet.FeatureType == FeatureType.Point || _featureSet.FeatureType == FeatureType.MultiPoint)
                {
                    if (_activeFeature == null)
                    {
                        return;
                    }
                    if (_layer.GetCategory(_activeFeature) != _selectedCategory)
                    {
                        _layer.SetCategory(_activeFeature, _selectedCategory);
                        _layer.SetVisible(_activeFeature, true);
                    }
                }
                else
                {
                    if (_selectedFeature == null)
                    {
                        return;
                    }
                    if (_layer.GetCategory(_selectedFeature) != _selectedCategory)
                    {
                        _layer.SetCategory(_selectedFeature, _selectedCategory);
                    }
                }
            }
            Map.MapFrame.Initialize();
        }
예제 #3
0
        /// <summary>
        /// Finish the shape.
        /// </summary>
        /// <param name="sender">The object sender.</param>
        /// <param name="e">An empty EventArgs class.</param>
        public void FinishShape(object sender, EventArgs e)
        {
            if (_featureSet != null && !_featureSet.IsDisposed)
            {
                Feature f = null;
                if (_featureSet.FeatureType == FeatureType.MultiPoint)
                {
                    f = new Feature(new MultiPoint(_coordinates.CastToPointArray()));
                }

                if (_featureSet.FeatureType == FeatureType.Line || _featureSet.FeatureType == FeatureType.Polygon)
                {
                    // if (_coordinates == null || _coordinates.Count < 2) return;
                    FinishPart(sender, e);

                    if (_parts == null || _parts.Count <= 0)
                    {
                        return;
                    }
                    Shape shp = new Shape(_featureSet.FeatureType);
                    foreach (List <Coordinate> part in _parts)
                    {
                        // In order to avoid exceptions
                        if (part != null && part.Count >= 2)
                        {
                            shp.AddPart(part, _featureSet.CoordinateType);
                        }
                    }

                    f = new Feature(shp);
                }

                if (f != null)
                {
                    _featureSet.Features.Add(f);
                }

                _featureSet.ShapeIndices = null; // Reset shape indices
                _featureSet.UpdateExtent();
                _layer.AssignFastDrawnStates();
                _featureSet.InvalidateVertices();
            }

            _coordinates = new List <Coordinate>();
            _parts       = new List <List <Coordinate> >();
        }
예제 #4
0
        /// <inheritdoc />
        protected override void OnMouseUp(GeoMouseArgs e)
        {
            // À̵¿Áõ ¸¶¿ì½º¸¦ ³õ¾ÒÀ» ³õ¾ÒÀ»¶§(À§Ä¡À̵¿°áÁ¤½Ã)
            if (e.Button == MouseButtons.Left && _dragging)
            {
                // [20200414] fdragons - add user confirm
                //if (DialogResult.OK != MessageBox.Show("ÀÌ À§Ä¡·Î À̵¿ ÇϽðڽÀ´Ï±î?", "ÁÂÇ¥À̵¿", MessageBoxButtons.OKCancel))
                //{
                //    // [TODO] À̵¿ Ãë¼Ò󸮸¦ Ãß°¡ÇÏ¿©¾ß ÇÑ´Ù.
                //}
                _dragging  = false;
                Map.IsBusy = false;

                _featureSet.InvalidateVertices();

                // Á¡
                if (_featureSet.FeatureType == FeatureType.Point || _featureSet.FeatureType == FeatureType.MultiPoint)
                {
                    if (_activeFeature == null)
                    {
                        return;
                    }

                    OnVertexMoved(new VertexMovedEventArgs(_activeFeature));

                    if (_layer.GetCategory(_activeFeature) != _selectedCategory)
                    {
                        _layer.SetCategory(_activeFeature, _selectedCategory);
                        _layer.SetVisible(_activeFeature, true);
                    }
                }
                else // ¼±, ¸é
                {
                    if (_selectedFeature == null)
                    {
                        return;
                    }

                    OnVertexMoved(new VertexMovedEventArgs(_selectedFeature));

                    if (_layer.GetCategory(_selectedFeature) != _selectedCategory)
                    {
                        _layer.SetCategory(_selectedFeature, _selectedCategory);
                    }
                }
            }

            Map.MapFrame.Initialize();
            base.OnMouseUp(e);
        }