Exemple #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;
     }
 }
Exemple #2
0
        /// <summary>
        /// Allows for new behavior during deactivation.
        /// </summary>
        protected override void OnDeactivate()
        {
            if (_standBy)
            {
                return;
            }

            // Don't completely deactivate, but rather go into standby mode
            // where we draw only the content that we have actually locked in.
            _standBy = true;
            _coordinateDialog?.Hide();

            if (_coordinates != null && _coordinates.Count > 1)
            {
                LineString ls = new LineString(_coordinates.ToArray());
                FeatureSet fs = new FeatureSet(FeatureType.Line);
                fs.Features.Add(new Feature(ls));
                MapLineLayer gll = new MapLineLayer(fs)
                {
                    Symbolizer =
                    {
                        ScaleMode = ScaleMode.Symbolic,
                        Smoothing = true
                    },
                    MapFrame = Map.MapFrame
                };
                _tempLayer = gll;
                Map.MapFrame.DrawingLayers.Add(gll);
                Map.MapFrame.Invalidate();
                Map.Invalidate();
            }

            Deactivate();
        }
        /// <summary>
        /// 비활성화하는 동안 새로운 동작을 허용합니다.
        /// </summary>
        protected override void OnDeactivate()
        {
            if (_standBy)
            {
                return;
            }

            // 완전히 비활성화하지 않고 대기 모드로 전환하십시오.
            // 여기서 실제로 잠근 내용 만 그립니다.
            _standBy = true;
            _coordinateDialog?.Hide();

            if (_coordinates != null && _coordinates.Count > 1)
            {
                LineString ls = new LineString(_coordinates.ToArray());
                FeatureSet fs = new FeatureSet(FeatureType.Line);
                fs.Features.Add(new Feature(ls));
                MapLineLayer gll = new MapLineLayer(fs)
                {
                    Symbolizer =
                    {
                        ScaleMode = ScaleMode.Symbolic,
                        Smoothing = true
                    },
                    MapFrame = Map.MapFrame
                };
                _tempLayer = gll;
                Map.MapFrame.DrawingLayers.Add(gll);
                Map.MapFrame.Invalidate();
                Map.Invalidate();
            }

            Deactivate();
        }
Exemple #4
0
        private void AssignLayerSymbologies(IMapFrame mapFrame)
        {
            foreach (ILayer layer in mapFrame.GetAllLayers())
            {
                IMapLineLayer lineLayer = layer as IMapLineLayer;
                if (lineLayer != null)
                {
                    ILineScheme original = lineLayer.Symbology;
                    if (original != null)
                    {
                        ILineScheme newScheme = original.Clone() as ILineScheme;
                        original.CopyProperties(newScheme);
                        original.ResumeEvents();
                    }
                }

                //to correctly draw categories:
                IMapFeatureLayer featureLayer = layer as IMapFeatureLayer;
                if (featureLayer != null)
                {
                    if (featureLayer.Symbology.NumCategories > 1)
                    {
                        featureLayer.DataSet.FillAttributes();
                        featureLayer.ApplyScheme(featureLayer.Symbology);
                    }
                }
            }
        }
Exemple #5
0
        protected IMapLineLayer GetLineLayer()
        {
            IMapLineLayer lineLayer = null;

            foreach (ILayer item in _map.MapFrame.DrawingLayers)
            {
                if (item.LegendText == "Line")
                {
                    lineLayer = item as IMapLineLayer;
                    break;
                }
            }
            if (lineLayer == null)
            {
                lineLayer            = new MapLineLayer();
                lineLayer.LegendText = "Line";
                lineLayer.Symbolizer = GIS.FrameWork.ROIConfigure.lineSymbolizer;
                if (_map.MapFrame.DrawingLayers.Count > 0 && _map.MapFrame.DrawingLayers[_map.MapFrame.DrawingLayers.Count - 1].LegendText == "Point")
                {
                    _map.MapFrame.DrawingLayers.Insert(_map.MapFrame.DrawingLayers.Count - 1, lineLayer);
                }
                else
                {
                    _map.MapFrame.DrawingLayers.Add(lineLayer);
                }
            }
            return(lineLayer);
        }
Exemple #6
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();
        }
Exemple #7
0
        /// <summary>
        /// Occurs when this function is removed.
        /// </summary>
        protected override void OnUnload()
        {
            if (Enabled)
            {
                _coordinates = null;
                _coordinateDialog.Hide();
            }
            if (_tempLayer != null)
            {
                Map.MapFrame.DrawingLayers.Remove(_tempLayer);
                Map.MapFrame.Invalidate();

                _tempLayer = null;
            }
            Map.Invalidate();
        }
Exemple #8
0
 private void lineBuffer()
 {
     foreach (ILayer item in _map.MapFrame.DrawingLayers)
     {
         if (item.LegendText == "Line")
         {
             IMapLineLayer lineLayer = item as IMapLineLayer;
             ILayer        layer     = bufferLayer();
             for (int i = 0; i < lineLayer.DataSet.Features.Count; i++)
             {
                 (layer as IMapPolygonLayer).DataSet.AddFeature(lineLayer.DataSet.Features[i].Geometry.Buffer(_distance));
             }
             _map.Refresh();
             break;
         }
     }
 }
Exemple #9
0
        protected override void OnMouseDoubleClick(GeoMouseArgs e)
        {
            _isEnabled = false;
            _coordinatePoints.Clear();
            for (int i = 0; i <= (_points.Count - 1); i++)
            {
                _coordinatePoints.Add(_map.PixelToProj(new System.Drawing.Point(_points[i].X, _points[i].Y)));
            }
            _lineString = new LineString(_coordinatePoints.ToArray());

            IMapLineLayer lineLayer = GetLineLayer();

            lineLayer.DataSet.AddFeature(_lineString as IGeometry);

            _points.Clear();
            _map.Refresh();
            _isEnabled = true;
        }
        /// <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();
        }
 /// <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;
     }
 }
        /// <summary>
        /// Occurs when this function is removed.
        /// </summary>
        protected override void OnUnload()
        {
            if (Enabled)
            {
                _coordinates = null;
                _coordinateDialog.Hide();
            }
            if (_tempLayer != null)
            {
                Map.MapFrame.DrawingLayers.Remove(_tempLayer);
                Map.MapFrame.Invalidate();

                _tempLayer = null;
            }
            Map.Invalidate();
        }
        /// <summary>
        /// Allows for new behavior during deactivation.
        /// </summary>
        protected override void OnDeactivate()
        {
            if (_standBy) { return; }

            // Don't completely deactivate, but rather go into standby mode
            // where we draw only the content that we have actually locked in.
            _standBy = true;
            if (_coordinateDialog != null) { _coordinateDialog.Hide(); }
            if (_coordinates != null && _coordinates.Count > 1)
            {
                LineString ls = new LineString(_coordinates);
                FeatureSet fs = new FeatureSet(FeatureType.Line);
                fs.Features.Add(new Feature(ls));
                MapLineLayer gll = new MapLineLayer(fs)
                                       {
                                           Symbolizer =
                                               {
                                                   ScaleMode = ScaleMode.Symbolic,
                                                   Smoothing = true
                                               },
                                           MapFrame = Map.MapFrame
                                       };
                _tempLayer = gll;
                Map.MapFrame.DrawingLayers.Add(gll);
                Map.MapFrame.Invalidate();
                Map.Invalidate();
            }

            base.Deactivate();
        }
        /// <summary>
        /// Allows for new behavior during deactivation.
        /// </summary>
        protected override void OnDeactivate()
        {
            if (_standBy) return;
            // Don't completely deactivate, but rather go into standby mode
            // where we draw only the content that we have actually locked in.
            _standBy = true;
            // base.OnDeactivate();
            if(_coordinateDialog != null)_coordinateDialog.Hide();
            if (_coordinates != null && _coordinates.Count > 1)
            {
                LineString ls = new LineString(_coordinates);
                FeatureSet fs = new FeatureSet(FeatureTypes.Line);
                fs.Features.Add(new Feature(ls));
                MapLineLayer gll = new MapLineLayer(fs);
                //gll.Symbolizer.FillColor = Color.Blue;
                gll.Symbolizer.ScaleMode = ScaleModes.Symbolic;
                gll.Symbolizer.Smoothing = true;
                gll.MapFrame = Map.MapFrame;
               
                _tempLayer = gll;
                Map.MapFrame.DrawingLayers.Add(gll);
               // Map.MapFrame.Initialize(_tempLayer);
                Map.MapFrame.Invalidate();
                Map.Invalidate();
            }

        }
        /// <summary>
        /// Forces this function to begin collecting points for building a new shape.
        /// </summary>
        protected override void OnActivate()
        {

            if (_measureDialog == null || _measureDialog.IsDisposed) _measureDialog = new MeasureDialog();
            _measureDialog.Show();
            _measureDialog.MeasureModeChanged += new EventHandler(_measureDialog_MeasureModeChanged);
            _measureDialog.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();
        }