Esempio n. 1
0
        public void OnPaint(IGraphicsDraw canvasDraw)
        {
            if (_currObjectSnapPoint != null)
            {
                CanvasDraw gd  = canvasDraw as CanvasDraw;
                Pen        pen = GDIResMgr.Instance.GetPen(Color.White, 2);
                gd.pen = pen;
                LitMath.Vector2 posInCanvas = _presenter.ModelToCanvas(_currObjectSnapPoint.position);

                switch (_currObjectSnapPoint.type)
                {
                case ObjectSnapMode.End:
                {
                    gd.DrawRectangle(new LitMath.Vector2(posInCanvas.x - _threshold, posInCanvas.y - _threshold),
                                     _threshold * 2, _threshold * 2);
                }
                break;

                case ObjectSnapMode.Mid:
                {
                    LitMath.Vector2 offset = new LitMath.Vector2(0, -_threshold * 1.2);
                    LitMath.Vector2 point1 = posInCanvas + offset;
                    offset = LitMath.Vector2.Rotate(offset, 120);
                    LitMath.Vector2 point2 = posInCanvas + offset;
                    offset = LitMath.Vector2.Rotate(offset, 120);
                    LitMath.Vector2 point3 = posInCanvas + offset;

                    gd.DrawLine(point1, point2);
                    gd.DrawLine(point2, point3);
                    gd.DrawLine(point3, point1);
                }
                break;

                case ObjectSnapMode.Center:
                {
                    gd.DrawCircle(posInCanvas, _threshold);
                }
                break;

                default:
                {
                    gd.DrawRectangle(new LitMath.Vector2(posInCanvas.x - _threshold, posInCanvas.y - _threshold),
                                     _threshold * 2, _threshold * 2);
                }
                break;
                }
            }
        }
Esempio n. 2
0
 public CreateGraphicsHistory(IGraphicsDraw drawer, GraphicsBase graphics)
 {
     this.Description = "创建图形";
     Graphics         = graphics;
     Drawer           = drawer;
     if (graphics is GraphicsLineModel)
     {
         this.Revocation = () =>
         {
             var glm = (Graphics as GraphicsLineModel);
             glm.Revocate(Drawer);
         };
         this.Redo = () =>
         {
             var glm = (Graphics as GraphicsLineModel);
             glm.Redo(Drawer, null);
         };
     }
     else
     {
         this.Revocation = () => (Graphics as GraphicsBase).Revocate(drawer);
         this.Redo       = () => (Graphics as GraphicsBase).Redo(drawer, graphics);
     }
 }
Esempio n. 3
0
 public SliderPenPart(IGraphicsDraw drawer, string propath, string text, Rect bouds)
     : base(drawer, propath, text, bouds)
 {
     this.InitializeComponent();
 }
Esempio n. 4
0
 public TextPen(IGraphicsDraw drawer, PensManagerBase pensManager)
     : base(drawer, pensManager, "文字笔")
 {
     PenParts.Add(new InputBoxPenPart(Drawer, "Text", "内容"));
     PenParts.Add(new SliderPenPart(Drawer, "TextFormat.FontSize", "文字大小", new Rect(0, 0, 100, 100)));
 }
 public EraserGraphics(IGraphicsDraw drawer, PensManagerBase pensManager)
     : base(drawer, pensManager, "图形擦")
 {
 }
Esempio n. 6
0
 /// <summary>
 /// 绘制函数
 /// </summary>
 public override void Draw(IGraphicsDraw gd)
 {
     gd.DrawLine(_startPoint, _endPoint);
 }
Esempio n. 7
0
 public EraserGraphicsBuildPart(IGraphicsDraw drawer)
     : base(drawer)
 {
     CanvasPointerMoved = PointerMoved;
 }
 public GraphicsRoundedRectangleModel(PenModel penModel, IGraphicsDraw draw)
     : base(GraphicsTypes.RoundRectangle, penModel, draw)
 {
 }
 public GraphicsTextModel(PenModel penModel, IGraphicsDraw draw)
     : base(GraphicsTypes.Text, penModel, draw)
 {
 }
Esempio n. 10
0
 public GraphicsImage(GraphicsTypes graphics, PenModel penModel, IGraphicsDraw draw)
     : base(GraphicsTypes.Image, penModel, draw)
 {
 }
 public GraphicsCircleModel(PenModel penModel, IGraphicsDraw draw)
     : base(GraphicsTypes.Circle, penModel, draw)
 {
 }
 public GaussianBlurModel(PenModel penModel, IGraphicsDraw draw)
     : base(GraphicsTypes.GaussianBlur, penModel, draw)
 {
 }
Esempio n. 13
0
 public GraphicsEllipseModel(PenModel penModel, IGraphicsDraw draw)
     : base(GraphicsTypes.Ellipse, penModel, draw)
 {
 }
 public GraphicsLineModel(PenModel penModel, IGraphicsDraw draw)
     : base(GraphicsTypes.CurveLine, penModel, draw)
 {
     IsFill = true;
 }
Esempio n. 15
0
 public EclipsePen(IGraphicsDraw drawer, PensManagerBase pensManager)
     : base(drawer, pensManager, "圆形笔")
 {
     PenParts.Add(new SliderPenPart(drawer, "LocPenModel.StrokeWidth", "笔宽", new Rect(0, 0, 100, 100)));
     PenParts.Add(new ToggerPenPart(drawer, "IsFill", "填充"));
 }
Esempio n. 16
0
 public SelectPen(IGraphicsDraw drawer, PensManagerBase pensManager)
     : base(drawer, pensManager, "选择笔")
 {
     PenParts.Add(new ToggerPenPart(Drawer, "IsLock", "锁定图层"));
 }
Esempio n. 17
0
 /// <summary>
 /// 绘制函数
 /// </summary>
 public override void Draw(IGraphicsDraw gd)
 {
     gd.DrawCircle(_center, _radius);
 }
 public LayerPartBuildBase(IGraphicsDraw drawer)
 {
     Drawer     = drawer;
     CanvasDraw = Draw;
 }
Esempio n. 19
0
 /// <summary>
 /// 生成实例
 /// </summary>
 /// <param name="drawer">图层实例</param>
 /// <param name="bindingpath">属性双向绑定路径</param>
 public PenPartControlBase(IGraphicsDraw drawer, string bindingpath, string text, Rect bounds)
     : this(drawer, bindingpath, text)
 {
     Bounds = bounds;
 }
Esempio n. 20
0
 /// <summary>
 /// 绘制函数
 /// </summary>
 public override void Draw(IGraphicsDraw gd)
 {
     gd.DrawPoint(_endPoint);
 }
Esempio n. 21
0
 public ToggerPenPart(IGraphicsDraw drawer, string propath, string text)
     : base(drawer, propath, text, new Rect())
 {
     this.InitializeComponent();
 }
 /// <summary>
 /// 暂时不用
 /// </summary>
 /// <param name="graphics"></param>
 /// <param name="penModel"></param>
 /// <param name="draw"></param>
 public GraphicsScanModel(GraphicsTypes graphics, PenModel penModel, IGraphicsDraw draw)
     : base(GraphicsTypes.Scan, penModel, draw)
 {
 }
Esempio n. 23
0
 public LayerPartManager(IGraphicsDraw draw)
 {
     Drawer = draw;
     GraphicsBuildCollection = new Dictionary <GraphicsTypes, ILayerPartBuild>();
     InitGraphicsBuilds();
 }
Esempio n. 24
0
 public abstract void Revocate(IGraphicsDraw drawer);
Esempio n. 25
0
 /// <summary>
 /// 绘制函数
 /// </summary>
 public override void Draw(IGraphicsDraw gd)
 {
     LitMath.Vector2 size = gd.DrawText(_position, _text, _height, _font, (LitCAD.TextAlignment)_alignment);
     this.UpdateBounding(size.x, size.y);
 }
Esempio n. 26
0
 public abstract void Redo(IGraphicsDraw drawer, object data);
Esempio n. 27
0
 /// <summary>
 /// 绘制函数
 /// </summary>
 public virtual void Draw(IGraphicsDraw gd)
 {
 }
Esempio n. 28
0
 /// <summary>
 /// 绘制函数
 /// </summary>
 public override void Draw(IGraphicsDraw gd)
 {
     gd.DrawXLine(_basePoint, _direction);
 }
Esempio n. 29
0
 public InputBoxPenPart(IGraphicsDraw drawer, string propath, string text)
     : base(drawer, propath, text)
 {
     this.InitializeComponent();
 }
Esempio n. 30
0
 /// <summary>
 /// 绘制函数
 /// </summary>
 public override void Draw(IGraphicsDraw gd)
 {
     gd.DrawArc(_center, _radius, startAngle, endAngle);
 }