private void ratioChanges()
        {
            double space_Height_PixelsHeight = BCUtility.RealLengthToPixelsWidthByScale(space_Height_m);
            double space_Height_PixelsWidth  = BCUtility.RealLengthToPixelsWidthByScale(space_Width_m);

            pnl_Map.Size = new Size((int)space_Height_PixelsWidth, (int)space_Height_PixelsHeight);
        }
Example #2
0
        private void initialMapSpace()
        {
            if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_ASE))
            {
                space_Height_m             = 14000;
                space_Width_m              = 40000;
                zoon_Factor                = 100;
                defaultMaxScale            = 10;
                trackBar_scale.SmallChange = 2;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_ASE_LOOP))
            {
                space_Height_m             = 14000;
                space_Width_m              = 53000;
                zoon_Factor                = 100;
                defaultMaxScale            = 10;
                trackBar_scale.SmallChange = 2;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_ASE_LINE3))
            {
                space_Height_m             = 14000;
                space_Width_m              = 50000;
                zoon_Factor                = 100;
                defaultMaxScale            = 10;
                trackBar_scale.SmallChange = 2;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_ASE_TEST))
            {
                space_Height_m             = 14000;
                space_Width_m              = 40000;
                zoon_Factor                = 100;
                defaultMaxScale            = 10;
                trackBar_scale.SmallChange = 2;
            }
            else
            {
                space_Height_m  = 14000;
                space_Width_m   = 40000;
                zoon_Factor     = 100;
                defaultMaxScale = 10;
            }
            trackBar_scale.Maximum = defaultMaxScale;
            trackBar_scale.Value   = defaultMaxScale;
            lbl_maxScale.Text      = defaultMaxScale.ToString();
            //BCUtility.setScale(trackBar_scale.Value);
            BCUtility.setScale(10, zoon_Factor);
            double space_Height_PixelsHeight = BCUtility.RealLengthToPixelsWidthByScale(space_Height_m);
            double space_Height_PixelsWidth  = BCUtility.RealLengthToPixelsWidthByScale(space_Width_m);

            pnl_Map.Height       = (int)space_Height_PixelsHeight;
            pnl_Map.Width        = (int)space_Height_PixelsWidth;
            this.pnl_Map.Resize += new System.EventHandler(this.pnl_Map_Resize);
            pnl_Map.Tag          = pnl_Map.Height + "|" + pnl_Map.Width;
        }
        private void refreshVehicleLoaction_Dic()
        {
            foreach (string adr_id in dicVehicles.Keys)
            {
                for (int i = 0; i < dicVehicles[adr_id].Count(); i++)
                {
                    int      railInterval     = 0;
                    uctlRail matchRail        = findTheMatchingRail(dicVehicles[adr_id].Count() - i, out railInterval);
                    int      railInterval_Pix = (int)BCUtility.RealLengthToPixelsWidthByScale((double)railInterval);

                    int Location_X = 0;
                    int Location_Y = 0;
                    switch (RailDircetion)
                    {
                    case E_RAIL_DIR.F:
                        Location_X = (int)matchRail.p_Points[0].RealPointf.X;
                        Location_Y = (int)matchRail.p_Points[0].RealPointf.Y;
                        if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Horizontal)
                        {
                            dicVehicles[adr_id][i].PrcSetLocation(Location_X + railInterval_Pix, Location_Y);
                        }
                        else if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Vertical)
                        {
                            dicVehicles[adr_id][i].PrcSetLocation(Location_X, Location_Y + railInterval_Pix);
                        }
                        else
                        {
                            dicVehicles[adr_id][i].PrcSetLocation((int)matchRail.p_RealCenterPoint.X, (int)matchRail.p_RealCenterPoint.Y);
                        }
                        break;

                    case E_RAIL_DIR.R:
                        Location_X = (int)matchRail.p_Points[1].RealPointf.X;
                        Location_Y = (int)matchRail.p_Points[1].RealPointf.Y;
                        if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Horizontal)
                        {
                            dicVehicles[adr_id][i].PrcSetLocation(Location_X - railInterval_Pix, Location_Y);
                        }
                        else if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Vertical)
                        {
                            dicVehicles[adr_id][i].PrcSetLocation(Location_X, Location_Y - railInterval_Pix);
                        }
                        else
                        {
                            dicVehicles[adr_id][i].PrcSetLocation((int)matchRail.p_RealCenterPoint.X, (int)matchRail.p_RealCenterPoint.Y);
                        }
                        break;
                    }
                    dicVehicles[adr_id][i].Tag = dicVehicles[adr_id][i].Top + "|" + dicVehicles[adr_id][i].Left + "|"
                                                 + dicVehicles[adr_id][i].Height + "|" + dicVehicles[adr_id][i].Width;
                }
            }
        }
        private void refreshVehicleLoaction(uctlNewVehicle vh, double sec_dis, sc.ProtocolFormat.OHTMessage.DriveDirction driveDirction)
        {
            //if (driveDirction == sc.ProtocolFormat.OHTMessage.DriveDirction.DriveDirReverse)
            //{
            //    if (RealDistance >= sec_dis)//確保不會一減 ,就變負的
            //        sec_dis = RealDistance - sec_dis;
            //    else
            //        sec_dis = 0;
            //}
            double distance_scale = 1;
            double distanceTemp   = 0;

            if (RealDistance > 10)
            {
                distance_scale = sec_dis / RealDistance;
            }
            else
            {
            }
            distanceTemp = Distance * distance_scale;

            int railInterval = 0;


            uctlRail matchRail        = findTheMatchingRail((int)distanceTemp, out railInterval);
            int      railInterval_Pix = (int)BCUtility.RealLengthToPixelsWidthByScale((double)railInterval);

            //int Location_X = 0;
            //int Location_Y = 0;

            KeyValuePair <uctlRail, E_RAIL_DIR> keyValuePairTemp = uctlRails.Where(keyValue => keyValue.Key == matchRail).SingleOrDefault();

            if (keyValuePairTemp.Equals(default(KeyValuePair <uctlRail, E_RAIL_DIR>)))
            {
                return;
            }
            E_RAIL_DIR railDIR = keyValuePairTemp.Value;

            //switch (RailDircetion)
            switch (railDIR)
            {
            case E_RAIL_DIR.F:
                WalkingForward(vh, distance_scale, matchRail, railInterval_Pix);
                break;

            case E_RAIL_DIR.R:
                ReverseWalking(vh, distance_scale, matchRail, railInterval_Pix);
                break;
            }
        }
Example #5
0
        private void initialMapSpace()
        {
            if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_ASE_K21))
            {
                space_Height_m  = 55000; //ASE_K21 地圖地圖大小
                space_Width_m   = 52000;
                zoon_Factor     = 130;
                defaultMaxScale = 13;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_ASE_K21_DEMO))
            {
                space_Height_m  = 7000; //AGVC 地圖地圖大小
                space_Width_m   = 10000;
                zoon_Factor     = 50;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_TAICHUNG))
            {
                space_Height_m  = 10000; //AGVC 地圖地圖大小
                space_Width_m   = 26000;
                zoon_Factor     = 70;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_AGC))
            {
                space_Height_m  = 35000; //AGVC 地圖地圖大小
                space_Width_m   = 135000;
                zoon_Factor     = 130;
                defaultMaxScale = 10;
            }
            else
            {
                space_Height_m  = 14000;
                space_Width_m   = 40000;
                zoon_Factor     = 100;
                defaultMaxScale = 10;
            }
            trackBar_scale.Maximum = defaultMaxScale;
            trackBar_scale.Value   = defaultMaxScale;
            lbl_maxScale.Text      = defaultMaxScale.ToString();
            //BCUtility.setScale(trackBar_scale.Value);
            BCUtility.setScale(10, zoon_Factor);
            double space_Height_PixelsHeight = BCUtility.RealLengthToPixelsWidthByScale(space_Height_m);
            double space_Height_PixelsWidth  = BCUtility.RealLengthToPixelsWidthByScale(space_Width_m);

            pnl_Map.Height       = (int)space_Height_PixelsHeight;
            pnl_Map.Width        = (int)space_Height_PixelsWidth;
            this.pnl_Map.Resize += new System.EventHandler(this.pnl_Map_Resize);
            pnl_Map.Tag          = pnl_Map.Height + "|" + pnl_Map.Width;
        }
        private void refreshVehicleLoaction(uctlVehicle vh, double sec_dis)
        {
            double distance_scale = 1;
            double distanceTemp   = 0;

            if (RealDistance > 10)
            {
                distance_scale = sec_dis / RealDistance;
            }
            else
            {
            }
            distanceTemp = Distance * distance_scale;
            int railInterval = 0;


            uctlRail matchRail        = findTheMatchingRail((int)distanceTemp, out railInterval);
            int      railInterval_Pix = (int)BCUtility.RealLengthToPixelsWidthByScale((double)railInterval);

            int Location_X = 0;
            int Location_Y = 0;

            KeyValuePair <uctlRail, E_RAIL_DIR> keyValuePairTemp = uctlRails.Where(keyValue => keyValue.Key == matchRail).SingleOrDefault();

            if (keyValuePairTemp.Equals(default(KeyValuePair <uctlRail, E_RAIL_DIR>)))
            {
                return;
            }
            E_RAIL_DIR railDIR = keyValuePairTemp.Value;

            //switch (RailDircetion)
            switch (railDIR)
            {
            case E_RAIL_DIR.F:
                Location_X = (int)matchRail.p_Points[0].RealPointf.X;
                Location_Y = (int)matchRail.p_Points[0].RealPointf.Y;
                if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Horizontal)
                {
                    vh.PrcSetLocation(Location_X + railInterval_Pix, Location_Y);
                }
                else if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Vertical)
                {
                    vh.PrcSetLocation(Location_X, Location_Y + railInterval_Pix);
                }
                else
                {
                    vh.PrcSetLocation((int)matchRail.p_RealCenterPoint.X, (int)matchRail.p_RealCenterPoint.Y);
                }
                break;

            case E_RAIL_DIR.R:
                Location_X = (int)matchRail.p_Points[1].RealPointf.X;
                Location_Y = (int)matchRail.p_Points[1].RealPointf.Y;
                if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Horizontal)
                {
                    vh.PrcSetLocation(Location_X - railInterval_Pix, Location_Y);
                }
                else if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Vertical)
                {
                    vh.PrcSetLocation(Location_X, Location_Y - railInterval_Pix);
                }
                else
                {
                    vh.PrcSetLocation((int)matchRail.p_RealCenterPoint.X, (int)matchRail.p_RealCenterPoint.Y);
                }
                break;
            }
        }
        private void initialMapSpace()
        {
            if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_AUO_CAAGV100) ||
                BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_AUO_CAAGV100_Beta))
            {
                space_Height_m  = 35000; //AGVC 地圖地圖大小
                space_Width_m   = 135000;
                zoon_Factor     = 210;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_TAICHUNG))
            {
                space_Height_m  = 15000; //AGVC 地圖地圖大小
                space_Width_m   = 24000;
                zoon_Factor     = 70;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_AUO_CAAGVC00))
            {
                space_Height_m  = 28000; //CAAGVC00 地圖地圖大小
                space_Width_m   = 12000;
                zoon_Factor     = 130;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_AUO_CAAGV200))
            {
                space_Height_m  = 22000; //CAAGVC00 地圖地圖大小
                space_Width_m   = 60000;
                zoon_Factor     = 130;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_AUO_FAXAGV03))
            {
                space_Height_m  = 27000; //4F 地圖地圖大小
                space_Width_m   = 15000;
                zoon_Factor     = 130;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_NORTH_INNOLUX))
            {
                space_Height_m  = 109000; //Innolux North 地圖地圖大小
                space_Width_m   = 28000;
                zoon_Factor     = 210;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_SOUTH_INNOLUX))
            {
                space_Height_m  = 21000; //Innolux South 地圖地圖大小
                space_Width_m   = 50000;
                zoon_Factor     = 130;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_NORTH_INNOLUX_TEST_SITE))
            {
                space_Height_m = 10000; //Innolux North Test Site 地圖地圖大小
                space_Width_m  = 26000;
                //space_Height_m = 10000; //Innolux North Test Site 地圖地圖大小
                //space_Width_m = 20000;
                zoon_Factor     = 70;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_UMTC_TEST_SITE))
            {
                space_Height_m  = 22000; //CAAGVC00 地圖地圖大小
                space_Width_m   = 60000;
                zoon_Factor     = 130;
                defaultMaxScale = 10;
            }
            else if (BCFUtility.isMatche(mainForm.BCApp.SCApplication.BC_ID, SCAppConstants.WorkVersion.VERSION_NAME_AUO_CAAGV4F))
            {
                space_Height_m  = 55000; //CAAGV4F 地圖地圖大小
                space_Width_m   = 41000;
                zoon_Factor     = 130;
                defaultMaxScale = 10;
            }
            else
            {
                space_Height_m  = 14000;
                space_Width_m   = 40000;
                zoon_Factor     = 100;
                defaultMaxScale = 10;
            }
            trackBar_scale.Maximum = defaultMaxScale;
            trackBar_scale.Value   = defaultMaxScale;
            lbl_maxScale.Text      = defaultMaxScale.ToString();
            //BCUtility.setScale(trackBar_scale.Value);
            BCUtility.setScale(10, zoon_Factor);
            double space_Height_PixelsHeight = BCUtility.RealLengthToPixelsWidthByScale(space_Height_m);
            double space_Height_PixelsWidth  = BCUtility.RealLengthToPixelsWidthByScale(space_Width_m);

            pnl_Map.Height       = (int)space_Height_PixelsHeight;
            pnl_Map.Width        = (int)space_Height_PixelsWidth;
            this.pnl_Map.Resize += new System.EventHandler(this.pnl_Map_Resize);
            pnl_Map.Tag          = pnl_Map.Height + "|" + pnl_Map.Width;
        }