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; } } }
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); } }
public SliderPenPart(IGraphicsDraw drawer, string propath, string text, Rect bouds) : base(drawer, propath, text, bouds) { this.InitializeComponent(); }
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, "图形擦") { }
/// <summary> /// 绘制函数 /// </summary> public override void Draw(IGraphicsDraw gd) { gd.DrawLine(_startPoint, _endPoint); }
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) { }
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) { }
public GraphicsEllipseModel(PenModel penModel, IGraphicsDraw draw) : base(GraphicsTypes.Ellipse, penModel, draw) { }
public GraphicsLineModel(PenModel penModel, IGraphicsDraw draw) : base(GraphicsTypes.CurveLine, penModel, draw) { IsFill = true; }
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", "填充")); }
public SelectPen(IGraphicsDraw drawer, PensManagerBase pensManager) : base(drawer, pensManager, "选择笔") { PenParts.Add(new ToggerPenPart(Drawer, "IsLock", "锁定图层")); }
/// <summary> /// 绘制函数 /// </summary> public override void Draw(IGraphicsDraw gd) { gd.DrawCircle(_center, _radius); }
public LayerPartBuildBase(IGraphicsDraw drawer) { Drawer = drawer; CanvasDraw = Draw; }
/// <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; }
/// <summary> /// 绘制函数 /// </summary> public override void Draw(IGraphicsDraw gd) { gd.DrawPoint(_endPoint); }
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) { }
public LayerPartManager(IGraphicsDraw draw) { Drawer = draw; GraphicsBuildCollection = new Dictionary <GraphicsTypes, ILayerPartBuild>(); InitGraphicsBuilds(); }
public abstract void Revocate(IGraphicsDraw drawer);
/// <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); }
public abstract void Redo(IGraphicsDraw drawer, object data);
/// <summary> /// 绘制函数 /// </summary> public virtual void Draw(IGraphicsDraw gd) { }
/// <summary> /// 绘制函数 /// </summary> public override void Draw(IGraphicsDraw gd) { gd.DrawXLine(_basePoint, _direction); }
public InputBoxPenPart(IGraphicsDraw drawer, string propath, string text) : base(drawer, propath, text) { this.InitializeComponent(); }
/// <summary> /// 绘制函数 /// </summary> public override void Draw(IGraphicsDraw gd) { gd.DrawArc(_center, _radius, startAngle, endAngle); }