예제 #1
0
 /// <summary>
 /// Disposes this handler, removing any buttons that it is responsible for adding.
 /// </summary>
 /// <param name="disposeManagedResources">Disposes of the resources.</param>
 protected virtual void Dispose(bool disposeManagedResources)
 {
     if (!_disposed)
     {
         // One option would be to leave the non-working tools,
         // but if this gets disposed we should clean up after
         // ourselves and remove any added controls.
         if (disposeManagedResources)
         {
             if (!_coordinateDialog.IsDisposed)
             {
                 _coordinateDialog.Dispose();
             }
             if (_context != null)
             {
                 _context.Dispose();
             }
             // if (_finishPart != null) { _finishPart.Dispose(); }
             _featureSet       = null;
             _coordinates      = null;
             _coordinateDialog = null;
             _tempLayer        = null;
             _context          = null;
             // _finishPart = null;
             _parts = null;
         }
         _disposed = true;
     }
 }
예제 #2
0
        /// <summary>
        /// Forces this function to begin collecting points for building a new shape.
        /// </summary>
        protected override void OnActivate()
        {
            if (_coordinateDialog == null)
            {
                _coordinateDialog = new CoordinateDialog();
            }

            if (_featureSet.CoordinateType == CoordinateType.Z)
            {
                _coordinateDialog.ShowZValues = true;
                _coordinateDialog.ShowMValues = true;
            }
            else if (_featureSet.CoordinateType == CoordinateType.M)
            {
                _coordinateDialog.ShowZValues = false;
                _coordinateDialog.ShowMValues = true;
            }
            else
            {
                _coordinateDialog.ShowZValues = false;
                _coordinateDialog.ShowMValues = false;
            }
            if (_featureSet.FeatureType == FeatureType.Point || _featureSet.FeatureType == FeatureType.MultiPoint)
            {
//                if (_context.MenuItems.Contains(_finishPart))
//                {
//                    _context.MenuItems.Remove(_finishPart);
//                }
            }
            else
            {
//                if (!_context.MenuItems.Contains(_finishPart))
//                {
//                    _context.MenuItems.Add(1, _finishPart);
//                }
            }
            _coordinateDialog.Show();
            _coordinateDialog.FormClosing += CoordinateDialogFormClosing;
            if (_standBy == false)
            {
                _coordinates = new List <Coordinate>();
            }
            if (_tempLayer != null)
            {
                Map.MapFrame.DrawingLayers.Remove(_tempLayer);
                Map.MapFrame.Invalidate();
                Map.Invalidate();
                _tempLayer = null;
            }
            _standBy = false;
            base.OnActivate();
        }
예제 #3
0
        /// <summary>
        /// Forces this function to begin collecting points for building a new shape.
        /// </summary>
        protected override void OnActivate()
        {
            if (_coordinateDialog == null) { _coordinateDialog = new CoordinateDialog(); }

            if (_featureSet.CoordinateType == CoordinateType.Z)
            {
                _coordinateDialog.ShowZValues = true;
                _coordinateDialog.ShowMValues = true;
            }
            else if (_featureSet.CoordinateType == CoordinateType.M)
            {
                _coordinateDialog.ShowZValues = false;
                _coordinateDialog.ShowMValues = true;
            }
            else
            {
                _coordinateDialog.ShowZValues = false;
                _coordinateDialog.ShowMValues = false;
            }
            if (_featureSet.FeatureType == FeatureType.Point || _featureSet.FeatureType == FeatureType.MultiPoint)
            {
                if (_context.MenuItems.Contains(_finishPart))
                {
                    _context.MenuItems.Remove(_finishPart);
                }
            }
            else
            {
                if (!_context.MenuItems.Contains(_finishPart))
                {
                    _context.MenuItems.Add(1, _finishPart);
                }
            }
            _coordinateDialog.Show();
            _coordinateDialog.FormClosing += CoordinateDialogFormClosing;
            if (_standBy == false) { _coordinates = new List<Coordinate>(); }
            if (_tempLayer != null)
            {
                Map.MapFrame.DrawingLayers.Remove(_tempLayer);
                Map.MapFrame.Invalidate();
                Map.Invalidate();
                _tempLayer = null;
            }
            _standBy = false;
            base.OnActivate();
        }
예제 #4
0
 /// <summary>
 /// Disposes this handler, removing any buttons that it is responsible for adding.
 /// </summary>
 /// <param name="disposeManagedResources">Disposes of the resources.</param>
 protected virtual void Dispose(bool disposeManagedResources)
 {
     if (!_disposed)
     {
         // One option would be to leave the non-working tools,
         // but if this gets disposed we should clean up after
         // ourselves and remove any added controls.
         if (disposeManagedResources)
         {
             if (!_coordinateDialog.IsDisposed) { _coordinateDialog.Dispose(); }
             if (_context != null) { _context.Dispose(); }
             if (_finishPart != null) { _finishPart.Dispose(); }
             _featureSet = null;
             _coordinates = null;
             _coordinateDialog = null;
             _tempLayer = null;
             _context = null;
             _finishPart = null;
             _parts = null;
         }
         _disposed = true;
     }
 }