public GPolygon(GCanvas gCanvas, PointCollection points, [Optional] Point Position, [Optional] Point origin) : base(gCanvas) { ///Set shape properties Shape = Polygon = new Polygon(); Points = points; this.Position = Position; if (origin == default(Point)) { // origin = Points.FirstOrDefault(); } else { Origin = origin; } //Set polygon Properties if (Position != default(Point)) { var left = Position.X - Origin.X; var top = Position.Y - Origin.Y; Polygon.Margin = new Thickness(left, top, 0, 0); } Polygon.HorizontalAlignment = HorizontalAlignment.Left; Polygon.VerticalAlignment = VerticalAlignment.Center; }
public GeometryEngine() { Shapes = new Dictionary <string, List <GShape> >() { { "Points", new List <GShape>() }, { "Lines", new List <GShape>() }, }; GCanvas = new GCanvas(); }
public GShape(GCanvas gCanvas) { GCanvas = gCanvas; Thickness = new Thickness(101, -11, 362, 250); Visibility = Visibility.Visible; Stroke = Brushes.Black; StrokeThickness = 1; Fill = Brushes.Red; // Id = GeometryEngine.Id; GeometryEngine.Id++; }
public GText(GCanvas gCanvas, Point insertionPoint, double size, string text) : base(gCanvas) { TextBlock = new TextBlock(); Text = text; Size = size; //default size =5 // defaults; Size = 5; ForegroundColor = Brushes.Black; InsertionPoint = insertionPoint; BackgroundColor = Brushes.Transparent; TextBlock.RenderTransform = new TransformGroup(); TextBlock.FontWeight = FontWeights.Normal; }
public GLine(GCanvas gCanvas, Point2D startPoint, Point2D endPoint) : base(gCanvas) { this.startPoint = startPoint; this.endPoint = endPoint; Shape = Line = new Line(); Line.X1 = StartPoint.X /*Scale*/; Line.Y1 = StartPoint.Y; // Line.X2 = EndPoint.X /*Scale*/; Line.Y2 = EndPoint.Y; //Add this Shape to Canvas Line.RenderTransform = new TransformGroup(); }
public GTriangle(GCanvas gCanvas, Point top, double sideLength) : base(gCanvas) { Top = top; SideLength = sideLength * Scale; Right = new Point(top.X + SideLength, top.Y + SideLength); Left = new Point(top.X - SideLength, top.Y + SideLength); if (Points == null) { Points = new PointCollection(); } //add point to the polygon Points Collection Points.Add(Top); Points.Add(Right); Points.Add(Left); }
public GCircle(GCanvas gCanvas, Point position, double radius) : base(gCanvas) { //set shape Shape = Circle = new Ellipse(); //set shape specific property Position = position; Radius = radius * Scale; // Circle.Height = Radius; Circle.Width = Radius; var left = Position.X - (Radius / 2); var top = Position.Y - (Radius / 2); Circle.Margin = new Thickness(left, top, 0, 0); Fill = Brushes.Transparent; Circle.RenderTransform = new TransformGroup(); }
public GRectangle(GCanvas gCanvas, double width, double height, Point position) : base(gCanvas) { Width = width; Height = height; Position = position; // Shape = Rectangle = new Rectangle(); Rectangle.Width = Width; Rectangle.Height = Height; Rectangle.RadiusX = RadiusX; Rectangle.RadiusY = RadiusY; var left = Position.X - (Width / 2); var top = Position.Y - (Height / 2); Rectangle.Margin = new Thickness(left, top, 0, 0); Fill = Brushes.Transparent; //Add this Shape to Canvas }
public Arrow(GCanvas gCanvas, Point2D insertionPoint, double length) : base(gCanvas) { GCanvas = gCanvas; InsertionPoint = insertionPoint; Length = length; HeadHeight = 5; var body = new GLine(GCanvas, InsertionPoint, new Point2D(InsertionPoint.X, InsertionPoint.Y + Length)); var headRightLine = new GLine(GCanvas, InsertionPoint, new Point2D(InsertionPoint.X + HeadHeight, InsertionPoint.Y + HeadHeight)); var headLeftLine = new GLine(GCanvas, InsertionPoint, new Point2D(InsertionPoint.X - HeadHeight, InsertionPoint.Y + HeadHeight)); Lines = new List <GLine>() { body, headRightLine, headLeftLine }; foreach (var line in Lines) { line.Line.RenderTransform = new TransformGroup(); } }
public GText(GCanvas gCanvas, Point insertionPoint, string text) : this(gCanvas, insertionPoint, 5, text) { }
public GPolygon(GCanvas gCanvas) : this(gCanvas, new PointCollection(), default(Point), default(Point)) { }