예제 #1
0
        public void Draw(
            IEntity entity,
            Graphics gc)
        {
            Condition.Requires(entity, nameof(entity)).IsNotNull();
            if (entity.Type != this.EntityType)
            {
                return;
            }

            Condition.Requires(gc, nameof(gc)).IsNotNull();

            var helper = new PointDrawingHelper(this._drawSettings, entity.X, entity.Y);

            gc.FillRectangle(this._brush, helper.GetPointRectangle());

            gc.DrawLine(
                this._pen,
                helper.GetCornerPointLeftTop(),
                helper.GetCornerPointRightDown());

            gc.DrawLine(
                this._pen,
                helper.GetCornerPointRightTop(),
                helper.GetCornerPointLeftDown());
        }
예제 #2
0
        private void DrawDirection(
            Graphics gc,
            PointDrawingHelper drawingHelper,
            MirrorEntity mirror)
        {
            var rectangle = drawingHelper.GetPointRectangle();

            var point1 = mirror.Position == MirrorPosition.MainDiagonal
                ? drawingHelper.GetCornerPointLeftTop()
                : drawingHelper.GetCornerPointRightTop();

            var point2 = mirror.Position == MirrorPosition.MainDiagonal
                ? drawingHelper.GetCornerPointRightDown()
                : drawingHelper.GetCornerPointLeftDown();

            gc.DrawLine(this._brownPen, point1, point2);
            gc.DrawLine(this._bluePen, point1, point2);
        }