コード例 #1
0
        /// <summary>
        /// Draws the label.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected override void OnDraw(MapDrawArgs e)
        {
            if (_isDragging)
            {
                Rectangle r = Opp.RectangleFromPoints(_startPoint, _currentPoint);
                r.Width  -= 1;
                r.Height -= 1;
                e.Graphics.DrawRectangle(Pens.White, r);
                e.Graphics.DrawRectangle(_selectionPen, r);
            }

            if (_doSelect)
            {
                foreach (IMapLayer lyr in Map.MapFrame.Layers)
                {
                    IMapFeatureLayer fl = lyr as IMapFeatureLayer;
                    fl?.LabelLayer?.Invalidate();
                }

                _doSelect = false;
                _selectTimer.Start();
            }

            base.OnDraw(e);
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 protected override void OnDraw(MapDrawArgs e)
 {
     if (_isDragging)
     {
         Rectangle r = Opp.RectangleFromPoints(_startPoint, _currentPoint);
         r.Width  -= 1;
         r.Height -= 1;
         e.Graphics.DrawRectangle(Pens.White, r);
         e.Graphics.DrawRectangle(_selectionPen, r);
     }
     if (_doSelect)
     {
         foreach (IMapLayer lyr in Map.MapFrame.Layers)
         {
             IMapFeatureLayer fl = lyr as IMapFeatureLayer;
             if (fl == null)
             {
                 continue;
             }
             IMapLabelLayer gll = fl.LabelLayer;
             //gll.Select(_selectionEnvelope, e); // using this form of selection can test the actual pixel rectangles
             if (gll != null)
             {
                 gll.Invalidate();
             }
         }
         _doSelect = false;
         _selectTimer.Start();
     }
     base.OnDraw(e);
 }
コード例 #3
0
        public void OnDraw_Dragging_DrawRectangle()
        {
            // Setup
            var       random = new Random(21);
            int       startX = random.Next(1, 100);
            int       startY = random.Next(1, 100);
            Rectangle rectangleFromPoints = Opp.RectangleFromPoints(new Point(startX, startY), new Point(startX, startY));

            rectangleFromPoints.Width  -= 1;
            rectangleFromPoints.Height -= 1;

            var map        = mockingRepository.Stub <IMap>();
            var mapFrame   = mockingRepository.Stub <IMapFrame>();
            var inGraphics = mockingRepository.Stub <Graphics>();

            inGraphics.Expect(e => e.DrawRectangle(Pens.White, rectangleFromPoints));
            inGraphics.Expect(e => e.DrawRectangle(Arg <Pen> .Matches(p => p.Color.Equals(Color.Black) && p.DashStyle.Equals(DashStyle.Dash)), Arg.Is(rectangleFromPoints)));

            mockingRepository.ReplayAll();

            var mapFunction = new MapFunctionSelectionZoom(map);

            var clipRectangle = new Rectangle(0, 0, 0, 0);

            mapFunction.DoMouseDown(new GeoMouseArgs(new MouseEventArgs(MouseButtons.Left, 1, startX, startY, 0), map));

            // Call
            mapFunction.Draw(new MapDrawArgs(inGraphics, clipRectangle, mapFrame));

            // Assert
            mockingRepository.VerifyAll();
        }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 protected override void OnDraw(MapDrawArgs e)
 {
     if (_isDragging)
     {
         Rectangle r = Opp.RectangleFromPoints(_startPoint, _currentPoint);
         r.Width  -= 1;
         r.Height -= 1;
         e.Graphics.DrawRectangle(Pens.White, r);
         e.Graphics.DrawRectangle(_selectionPen, r);
     }
     base.OnDraw(e);
 }
コード例 #5
0
        //public bool PolygonCanIn
        //{
        //    get;
        //    set;
        //}

        #endregion

        #region Properties

        //public IGeometry Geometry
        //{
        //    get
        //    {
        //        LinearRing linearRing = new LinearRing(_coordinatePoints.ToArray());
        //        Polygon polygon = new Polygon(linearRing);
        //        return polygon as IGeometry;
        //    }
        //}

        #endregion

        #region Method

        protected override void OnDraw(MapDrawArgs e)
        {
            if (_isEnabled)
            {
                Rectangle r = Opp.RectangleFromPoints(_startPoint, _currentPoint);
                r.Width  -= 1;
                r.Height -= 1;

                HatchBrush brush = new HatchBrush(HatchStyle.Percent25, Color.Tomato, Color.SeaGreen);
                Pen        pen   = new Pen(brush, 2);
                pen.DashStyle = DashStyle.Dot;
                e.Graphics.DrawRectangle(pen, r);
                e.Graphics.FillRectangle(brush, r);
            }
            base.OnDraw(e);
        }