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 ArrowLoad(GCanvas gCanvas, Point startPoint, Point endPoint, double loadValue) : base(gCanvas)
        {
            GCanvas    = gCanvas;
            StartPoint = startPoint;
            EndPoint   = endPoint;
            Arrows     = new List <Arrow>();
            Height     = loadValue /*Scale*/;
            var span = Math.Sqrt(
                Math.Pow(startPoint.X - endPoint.X, 2) +
                Math.Pow(startPoint.Y - endPoint.Y, 2));

            Spacings = 10;
            var spaces = Split.Equal(span, Spacings);

            foreach (var space in spaces)
            {
                var arrow = new Arrow(GCanvas, new Point(StartPoint.X + space, StartPoint.Y), Height);
                arrow.Rotate(180);
                Arrows.Add(arrow);
            }

            HeaderLine = new GLine(GCanvas,
                                   new Point(StartPoint.X, StartPoint.Y - Height),
                                   new Point(EndPoint.X, EndPoint.Y - Height));
        }
 public Fixed(GCanvas gCanvas, Point InsertionPoint, double scale) : base(gCanvas)
 {
     Height    = 15;
     Scale     = scale;
     Rectangle = new GRectangle(GCanvas, 30, 15,
                                new Point(InsertionPoint.X /*scale*/, InsertionPoint.Y + 15));
     Line = new GLine(GCanvas, new Point(InsertionPoint.X /*scale*/, InsertionPoint.Y), new Point(InsertionPoint.X /*scale*/, InsertionPoint.Y + Height + Height / 2));
 }
 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 Roller(GCanvas gCanvas, Point insertionPoint) : base(gCanvas)
        {
            InsertionPoint = insertionPoint;
            GCanvas        = gCanvas;
            Height         = 20;
            var scaledHeight = Height * Scale;
            var sPoint       = new Point(InsertionPoint.X - scaledHeight / (2 /**/), InsertionPoint.Y + scaledHeight);
            var ePoint       = new Point(InsertionPoint.X + scaledHeight / (2 /**/), InsertionPoint.Y + scaledHeight);

            Line   = new GLine(GCanvas, sPoint, ePoint);
            Circle = new GCircle(GCanvas, new Point(insertionPoint.X, InsertionPoint.Y + scaledHeight / 2), scaledHeight * Scale);
        }
Exemplo n.º 6
0
 public GLine(GCanvas gCanvas, Point startPoint, Point endPoint) : base(gCanvas)
 {
     StartPoint = startPoint;
     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 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;
 }
Exemplo n.º 8
0
 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 GeometryEngine()
        {
            Shapes = new Dictionary <string, List <GShape> >()
            {
                { "Supports", new List <GShape>() },
                { "DistributedLoad", new List <GShape>() },
                { "ConcentratedLoad", new List <GShape>() },
                { "Beams", new List <GShape>() },
                { "Grid", new List <GShape>() },
                { "Points", new List <GShape>() },
                { "RFT", new List <GShape>() },  //Newly Added
                { "Text", new List <GShape>() }, //Newly Added
            };

            GCanvas = new GCanvas();
        }
        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, Point insertionPoint, double length) : base(gCanvas)
        {
            GCanvas        = gCanvas;
            InsertionPoint = insertionPoint;
            Length         = length;
            HeadHeight     = 5;
            var body = new GLine(GCanvas, InsertionPoint, new Point(InsertionPoint.X, InsertionPoint.Y + Length));

            var headRightLine = new GLine(GCanvas, InsertionPoint, new Point(InsertionPoint.X + HeadHeight, InsertionPoint.Y + HeadHeight));
            var headLeftLine  = new GLine(GCanvas, InsertionPoint, new Point(InsertionPoint.X - HeadHeight, InsertionPoint.Y + HeadHeight));

            Lines = new List <GLine>()
            {
                body,
                headRightLine,
                headLeftLine
            };

            foreach (var line in Lines)
            {
                line.Line.RenderTransform = new TransformGroup();
            }
        }
Exemplo n.º 13
0
 public Hinged(GCanvas gCanvas, Point insertionPoint) : base(gCanvas)
 {
     InsertionPoint = insertionPoint;
     Triangle       = new GTriangle(GCanvas, InsertionPoint, 20);
     Line           = new GLine(GCanvas, InsertionPoint, new Point(InsertionPoint.X, InsertionPoint.Y + 20));
 }
 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))
 {
 }