Example #1
1
        public IDisplayData AsDisplayData(ViewPlane viewplane)
        {
            try
            {
                displayData       = new DisplayData(FileName);
                displayData.Color = Color;
                foreach (PointCyl v in this)
                {
                    switch (viewplane)
                    {
                    case ViewPlane.ZR:
                        displayData.Add(new PointF((float)v.Z, (float)v.R));
                        break;

                    case ViewPlane.THETAR:
                    default:
                        displayData.Add(new PointF((float)(v.ThetaDeg), (float)v.R));

                        break;
                    }
                }

                displayData.SortByX();

                return(displayData);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
1
        public DisplayData TrimTo(RectangleF window)
        {
            try
            {
                var trimmedDisplay = new DisplayData(this.FileName);

                var xList  = new List <double>();
                var ptList = new List <PointF>();

                foreach (PointF pt in this)
                {
                    if (pt.X >= window.Left && pt.X <= window.Right)
                    {
                        if (window.Bottom <= 0 && window.Top <= 0 && pt.Y < 0)
                        {
                            ptList.Add(new PointF(pt.X, pt.Y));
                            xList.Add(pt.X);
                        }
                        if (window.Bottom >= 0 && window.Top >= 0 && pt.Y > 0)
                        {
                            ptList.Add(new PointF(pt.X, pt.Y));
                            xList.Add(pt.X);
                        }
                    }
                }
                var ptArr = ptList.ToArray();

                Array.Sort(xList.ToArray(), ptArr);

                trimmedDisplay.AddRange(ptArr);
                return(trimmedDisplay);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #3
0
 public IDisplayData AsDisplayData(double segmentLength)
 {
     try
     {
         var pointList = AsPointList(segmentLength);
         var dd        = new DisplayData();
         foreach (var pt in pointList)
         {
             dd.Add(new System.Drawing.PointF((float)pt.X, (float)pt.Y));
         }
         return(dd);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #4
0
 public IDisplayData AsPolarViewDisplayData()
 {
     try
     {
         displayData       = new DisplayData(FileName);
         displayData.Color = Color;
         foreach (IPointCyl v in this)
         {
             displayData.Add(new PointF((float)(Math.Cos(v.ThetaRad) * v.R), (float)(Math.Sin(v.ThetaRad) * v.R)));
         }
         return(displayData);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #5
0
        public IDisplayData TrimToWindow(RectangleF window)
        {
            try
            {
                var trimmedDisplay = new DisplayData(this.FileName);

                var xList  = new List <double>();
                var ptList = new List <PointF>();

                foreach (PointF pt in data)
                {
                    if (window.Contains(pt))
                    {
                        ptList.Add(new PointF(pt.X, pt.Y));
                        xList.Add(pt.X);
                    }
                    //if (pt.X >= window.Left && pt.X <= window.Right)
                    //{
                    //    if (window.Bottom <= 0 && window.Top <= 0 && pt.Y < 0)
                    //    {
                    //        ptList.Add(new PointF(pt.X, pt.Y));
                    //        xList.Add(pt.X);
                    //    }
                    //    if (window.Bottom >= 0 && window.Top >= 0 && pt.Y > 0)
                    //    {
                    //        ptList.Add(new PointF(pt.X, pt.Y));
                    //        xList.Add(pt.X);
                    //    }
                    //}
                }
                var ptArr = ptList.ToArray();

                Array.Sort(xList.ToArray(), ptArr);

                trimmedDisplay.AddRange(ptArr.ToList());
                trimmedDisplay.Color = Color;
                return(trimmedDisplay);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #6
0
        public DisplayData AsDisplayData(ViewPlane viewplane)
        {
            var pts = new DisplayData(FileName);

            pts.Color = Color;
            foreach (PointCyl v in this)
            {
                switch (viewplane)
                {
                case ViewPlane.ZR:
                    pts.Add(new PointF((float)v.Z, (float)v.R));
                    break;

                case ViewPlane.THETAR:
                default:
                    pts.Add(new PointF((float)v.ThetaDeg, (float)v.R));
                    break;
                }
            }
            return(pts);
        }
Example #7
0
        public DisplayData AsDisplayData(ViewPlane viewPlane)
        {
            try
            {
                var pts = new DisplayData(FileName);
                pts.Color = Color;
                foreach (Vector3 v in this)
                {
                    switch (viewPlane)
                    {
                    case ViewPlane.THETAR:
                        var ptc = new PointCyl(v);
                        pts.Add(new PointF((float)ptc.ThetaDeg, (float)ptc.R));
                        break;

                    case ViewPlane.XZ:
                        pts.Add(new PointF((float)v.X, (float)v.Z));
                        break;

                    case ViewPlane.YZ:
                        pts.Add(new PointF((float)v.Y, (float)v.Z));
                        break;

                    case ViewPlane.XY:
                    default:
                        pts.Add(new PointF((float)v.X, (float)v.Y));
                        break;
                    }
                }
                return(pts);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #8
0
        public DisplayData CenterToXMidpoint()
        {
            int    midCount = (int)Math.Round(data.Count / 2.0);
            var    minMax   = GetMinMaxY();
            var    midYData = (minMax.Item1 + minMax.Item2) / 2.0;
            double x1       = 0;

            for (int i = 1; i < midCount; i++)
            {
                if ((data[i - 1].Y <midYData && data[i].Y> midYData) ||
                    (data[i - 1].Y > midYData && data[i].Y < midYData))
                {
                    x1 = (data[i - 1].X + data[i].X) / 2.0;
                    break;
                }
            }
            double x2 = 0;

            for (int i = midCount; i < data.Count; i++)
            {
                if ((data[i - 1].Y <midYData && data[i].Y> midYData) ||
                    (data[i - 1].Y > midYData && data[i].Y < midYData))
                {
                    x2 = (data[i - 1].X + data[i].X) / 2.0;
                    break;
                }
            }
            double midX      = (x1 + x2) / 2.0;
            var    transData = new DisplayData(FileName);

            foreach (var pt in data)
            {
                transData.Add(new System.Drawing.PointF((float)(pt.X - midX), pt.Y));
            }
            return(transData);
        }
Example #9
0
        public DisplayData AsDisplayData(ViewPlane viewplane, TolType tolType)
        {
            var displayData = new DisplayData(FileName);

            switch (tolType)
            {
            case TolType.MAX:
                displayData.Color = Color.Red;
                break;

            case TolType.MIN:
                displayData.Color = Color.Blue;
                break;

            case TolType.NOM:
                displayData.Color = Color.Green;
                break;
            }
            displayData.Color = Color;
            foreach (var v in this)
            {
                switch (viewplane)
                {
                case ViewPlane.ZR:
                    switch (tolType)
                    {
                    case TolType.MAX:
                        displayData.Add(new PointF((float)v.Z, (float)v.RMax));
                        break;

                    case TolType.MIN:
                        displayData.Add(new PointF((float)v.Z, (float)v.RMin));
                        break;

                    case TolType.NOM:
                        displayData.Add(new PointF((float)v.Z, (float)v.RNom));
                        break;
                    }

                    break;

                case ViewPlane.THETAR:
                default:
                    switch (tolType)
                    {
                    case TolType.MAX:
                        displayData.Add(new PointF((float)(v.ThetaDeg), (float)v.RMax));
                        break;

                    case TolType.MIN:
                        displayData.Add(new PointF((float)(v.ThetaDeg), (float)v.RMin));
                        break;

                    case TolType.NOM:
                        displayData.Add(new PointF((float)(v.ThetaDeg), (float)v.RNom));
                        break;
                    }

                    break;
                }
            }

            return(displayData);
        }