예제 #1
0
        public static DrawableElement Polyline(List <double> coords, string name = null, string comment = null, string color = "Undefined")
        {
            var settings             = new VisualSettings(name, color: color);
            List <ReperPoint> points = new List <ReperPoint>();

            for (int i = 0; 2 * i + 1 < coords.Count; i++)
            {
                points.Add(new ReperPoint(coords[2 * i], coords[2 * i + 1]));
            }
            return(new DrawableElement()
            {
                Type = DrawableType.Polyline,
                Comment = new List <string>()
                {
                    comment
                },
                reper = points,
                Settings = settings
            });
        }
예제 #2
0
        public static DrawableElement Vector(double px, double py, double vx, double vy, string name = null, string comment = null, string color = "Undefined")
        {
            var settings = new VisualSettings(name, color: color);
            var l        = Math.Sqrt(vx * vx + vy * vy);

            return(new DrawableElement
            {
                Type = DrawableType.Vector,
                Comment = new List <string>()
                {
                    comment
                },
                reper = new List <ReperPoint> {
                    new ReperPoint(px, py),
                    new ReperPoint(px + l, py),
                    // here's new points to form vector head
                    new ReperPoint(px + 5 * l / 6, py + l / 12),
                    new ReperPoint(px + 11 * l / 12, py),
                    new ReperPoint(px + 5 * l / 6, py - l / 12),
                    new ReperPoint(px + vx, py + vy)    // this point[5] is to remember angle and should be replaced later
                },
                Settings = settings
            });
        }
예제 #3
0
 public Port(VisualSettings settings)
 {
     charts        = new List <Chart>();
     this.settings = settings;
 }