Esempio n. 1
0
        public List <Point> List_PoChildToPoint(List <syPoChild> syPoChilds, syPoDrawing refCurrPoDrawing)
        {
            List <Point> rePoints = new List <Point>();


            foreach (syPoChild spc in syPoChilds)
            {
                //Math.Round
                syPoRelation spr = new syPoRelation();
                spr.SyGuid = System.Guid.NewGuid().ToString();

                Point p_temp = PoChildToPoint(spc, refCurrPoDrawing);
                spr.SyPoint = p_temp;
                spr.SyChild = spc;
                MainRelation.Add(spr);
                rePoints.Add(p_temp);
            }

            if (rePoints.Count > 0)
            {
                return(rePoints);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        public List<Point> List_PoChildToPoint(List<syPoChild> syPoChilds, syPoDrawing refCurrPoDrawing)
        {
            List<Point> rePoints = new List<Point>();


            foreach (syPoChild spc in syPoChilds)
            {
                //Math.Round
                syPoRelation spr = new syPoRelation();
                spr.SyGuid = System.Guid.NewGuid().ToString();

                Point p_temp = PoChildToPoint(spc, refCurrPoDrawing);
                spr.SyPoint = p_temp;
                spr.SyChild = spc;
                MainRelation.Add(spr);
                rePoints.Add(p_temp); 
            }

            if (rePoints.Count > 0)
                return rePoints;
            else
                return null;

        }
Esempio n. 3
0
        public Point PoChildToPoint(syPoChild syChild, syPoDrawing refCurrPoDrawing)
        {
            //Point p=new Point();
            double xWide = refCurrPoDrawing.SyXWide;
            double yWide = refCurrPoDrawing.SyYWide;
            double DanWeiX = (double)refCurrPoDrawing.SyXValue[1] - (double)refCurrPoDrawing.SyXValue[0];
            double DanWeiY = (double)refCurrPoDrawing.SyYValue[1] - (double)refCurrPoDrawing.SyYValue[0];
            double NxWide = xWide / DanWeiX;
            double NyWide = yWide / DanWeiY;

            double syX = Math.Round(syChild.SyX, 4);
            double syY = Math.Round(syChild.SyY, 4);

            int ZhengX = (int)Math.Round(syX, 0);
            int ZhengY = (int)Math.Round(syY, 0);

            int Tx = 0;
            int Ty = 0;

            for (int i = 0; i < refCurrPoDrawing.SyXValue.Count - 1; i++)
            {

                if ((double)refCurrPoDrawing.SyXValue[i] <= ZhengX && ZhengX <= (double)refCurrPoDrawing.SyXValue[i + 1])
                {
                    Tx = i +1;
                    break;
                }
            }
            for (int i = 0; i < refCurrPoDrawing.SyYValue.Count - 1; i++)
            {
                if ((double)refCurrPoDrawing.SyYValue[i] <= ZhengY && ZhengY <= (double)refCurrPoDrawing.SyYValue[i + 1])
                {
                    Ty = i +1 ;
                    break;
                }
            }

            
            double LingX = 0;
            try
            {
                LingX = syX - (double)refCurrPoDrawing.SyXValue[Tx - 1];
            }
            catch { }
            double HouJX = Math.Round( NxWide * LingX,4);

            
            double LingY = 0;
            try
            {
                LingY = syY - (double)refCurrPoDrawing.SyYValue[Ty - 1];
            }
            catch { }
            double HouJY = Math.Round(NyWide * LingY,4);

            //y是反数
            double TeY = refCurrPoDrawing.SyYValue.Count - Ty;


            double QuX = Tx * xWide;
            double QuY = TeY * yWide;

            double ZuoX = QuX + HouJX;
            double ZuoY = QuY - HouJY;

            ZuoY += refCurrPoDrawing.SyYMarin;
            ZuoX += refCurrPoDrawing.SyXMarin;

            ZuoX -= xWide;
            ZuoY += yWide;

            return new Point(ZuoX, ZuoY);
        }
Esempio n. 4
0
        public Point PoChildToPoint(syPoChild syChild, syPoDrawing refCurrPoDrawing)
        {
            //Point p=new Point();
            double xWide   = refCurrPoDrawing.SyXWide;
            double yWide   = refCurrPoDrawing.SyYWide;
            double DanWeiX = (double)refCurrPoDrawing.SyXValue[1] - (double)refCurrPoDrawing.SyXValue[0];
            double DanWeiY = (double)refCurrPoDrawing.SyYValue[1] - (double)refCurrPoDrawing.SyYValue[0];
            double NxWide  = xWide / DanWeiX;
            double NyWide  = yWide / DanWeiY;

            double syX = Math.Round(syChild.SyX, 4);
            double syY = Math.Round(syChild.SyY, 4);

            int ZhengX = (int)Math.Round(syX, 0);
            int ZhengY = (int)Math.Round(syY, 0);

            int Tx = 0;
            int Ty = 0;

            for (int i = 0; i < refCurrPoDrawing.SyXValue.Count - 1; i++)
            {
                if ((double)refCurrPoDrawing.SyXValue[i] <= ZhengX && ZhengX <= (double)refCurrPoDrawing.SyXValue[i + 1])
                {
                    Tx = i + 1;
                    break;
                }
            }
            for (int i = 0; i < refCurrPoDrawing.SyYValue.Count - 1; i++)
            {
                if ((double)refCurrPoDrawing.SyYValue[i] <= ZhengY && ZhengY <= (double)refCurrPoDrawing.SyYValue[i + 1])
                {
                    Ty = i + 1;
                    break;
                }
            }


            double LingX = 0;

            try
            {
                LingX = syX - (double)refCurrPoDrawing.SyXValue[Tx - 1];
            }
            catch { }
            double HouJX = Math.Round(NxWide * LingX, 4);


            double LingY = 0;

            try
            {
                LingY = syY - (double)refCurrPoDrawing.SyYValue[Ty - 1];
            }
            catch { }
            double HouJY = Math.Round(NyWide * LingY, 4);

            //y是反数
            double TeY = refCurrPoDrawing.SyYValue.Count - Ty;


            double QuX = Tx * xWide;
            double QuY = TeY * yWide;

            double ZuoX = QuX + HouJX;
            double ZuoY = QuY - HouJY;

            ZuoY += refCurrPoDrawing.SyYMarin;
            ZuoX += refCurrPoDrawing.SyXMarin;

            ZuoX -= xWide;
            ZuoY += yWide;

            return(new Point(ZuoX, ZuoY));
        }