예제 #1
0
파일: DoCover.cs 프로젝트: MGajd/DP
 private void DownToUpLeftToRight(CoverLine _oldCoverLine, MachineObject _machineObject)
 {
     if (_oldCoverLine.IsDivide)
     {
         newLine = new CoverLine(_oldCoverLine, (int)MachineObject.WorkingWidth, 0);
     }
     else
         throw new NotImplementedException();
 }
예제 #2
0
        private Response AssumedCoverLineFinishResponse(CoverLine actualCoverLine)
        {
            Response response = new Response();

            response.CoverLineFinish = new CoverLineFinishObject();
            response.CoverLineFinish.SetMachineActualCoverDirection(actualCoverLine);
            response.CoverLineFinish.CoverLineFinishTime = EndsAt;

            return response;
        }
예제 #3
0
파일: World.cs 프로젝트: MGajd/DP
        public static void AddCoverLine(CoverLine newCoverLine, decimal width)
        {
            CoverLinesList.Add(newCoverLine);

            if (newCoverLine.IsDivide)
                return;
            AreaToCover area = GetAreaByID(newCoverLine.AreaToCoverID);

            if (area.Width <= newCoverLine.Width)
            {
                World.RemoveAreaToCover(area.AreaToCoverID);
            }
            else
            {
                area.AddCoverLine(newCoverLine);
            }
        }
예제 #4
0
파일: AreaObjects.cs 프로젝트: MGajd/DP
        /// <summary>
        /// Creates new line by copying system info of old CoverLine. Use when adding the same value to both coordinates.
        /// </summary>
        /// <param name="_oldCoverLine">CovwrLine to create new one.</param>
        /// <param name="xCoordinateAdd">Add value to x coordinate.</param>
        /// <param name="yCoordinateAdd">Add value to y coordinate.</param>
        public CoverLine(CoverLine _oldCoverLine, int xCoordinateAdd, int yCoordinateAdd,bool isDivide = false, string areaToCoverID = null)
        {
            StartingCoordinates = new Coordinates(_oldCoverLine.EndingCoordinates.X + xCoordinateAdd, _oldCoverLine.EndingCoordinates.Y + yCoordinateAdd);
            EndingCoordinates = new Coordinates(_oldCoverLine.StartingCoordinates.X + xCoordinateAdd, _oldCoverLine.StartingCoordinates.Y + yCoordinateAdd);

            IsDivide = isDivide;
            AreaToCoverID = areaToCoverID ?? _oldCoverLine.AreaToCoverID;
            MachineID = _oldCoverLine.MachineID;
            Status = Enumerations.CoverLineStatus.reserved;
        }
예제 #5
0
파일: AreaObjects.cs 프로젝트: MGajd/DP
 public CoveredSubArea(CoverLine coverLineObject)
 {
 }
예제 #6
0
파일: ResponseObjects.cs 프로젝트: MGajd/DP
 public void SetMachineActualCoverDirection(CoverLine actualCoverLine)
 {
     MachineActualCoverLineDirection = actualCoverLine.CoverLineDirection;
 }
예제 #7
0
파일: AreaToCover.cs 프로젝트: MGajd/DP
        private CoverLine GetFirstLineFromRight(decimal workingWidth, bool reverseDirection = false)
        {
            //TODO: can be incorrect
            int coef = 1;
            if (reverseDirection)
                coef = -1;
            CoverLine coverLine = new CoverLine();
            coverLine.StartingCoordinates = new Coordinates(MaxX + (coef * workingWidth) / 2, GetMinY(MaxX, (coef * workingWidth)));// RightDown.Y);
            coverLine.EndingCoordinates = new Coordinates(MaxX + (coef * workingWidth) / 2, GetMaxY(MaxX, (coef * workingWidth)));// RightUp.Y);

            coverLine.Status = Enumerations.CoverLineStatus.reserved;
            coverLine.IsDivide = false;
            coverLine.CoverLineID = World.CoverLineIDCounter++.ToString();

            if (reverseDirection)
                coverLine.ReverseCoordinates();
            return coverLine;
        }
예제 #8
0
파일: AreaToCover.cs 프로젝트: MGajd/DP
        private CoverLine GetFirstLineFromLeft(decimal workingWidth, bool reverseDirection = false)
        {
            int coef = 1;
            if (reverseDirection)
                coef = -1;
            CoverLine coverLine = new CoverLine();

            //TODO:blocker - DONE? change Y-coordinates to the proper Y due to shape
            coverLine.StartingCoordinates = new Coordinates(MinX + (coef * workingWidth) / 2, GetMinY(MinX, (coef * workingWidth)));
            coverLine.EndingCoordinates = new Coordinates(MinX + (coef * workingWidth) / 2, GetMaxY(MinX, (coef * workingWidth)));// LeftUp.Y);

            coverLine.Status = Enumerations.CoverLineStatus.reserved;
            coverLine.IsDivide = false;
            coverLine.CoverLineID = World.CoverLineIDCounter++.ToString();

            if (reverseDirection)
                coverLine.ReverseCoordinates();
            return coverLine;
        }
예제 #9
0
파일: AreaToCover.cs 프로젝트: MGajd/DP
        private void DeleteCoordinatesBetween(Coordinates coorFrom, Coordinates coorTo, CoverLine newCoverLine, int coef = 1)
        {
            List<Coordinates> newCoordinates = AddNewIndexes(coorFrom, coorTo, newCoverLine, coef);
            RemoveRedundantCoordinates();

            int coorFomIndex = Helpers.Methods.GetCoordinatecIndex(CoordinateList, newCoordinates.Last());
            int coorToIndex = Helpers.Methods.GetCoordinatecIndex(CoordinateList, newCoordinates.First());

            DeleteCoordinatesBetweenIndexes(coorFomIndex, coorToIndex);
        }
예제 #10
0
파일: AreaToCover.cs 프로젝트: MGajd/DP
        private List<Coordinates> AddNewIndexes(Coordinates coorFrom, Coordinates coorTo, CoverLine newCoverLine, int coef)
        {
            List<Coordinates> returnCoordinates = new List<Coordinates>();

            int coorToIndex = Helpers.Methods.GetCoordinatecIndex(CoordinateList, coorTo);
            returnCoordinates.Add(Helpers.Methods.LinearInterpolation(CoordinateList[GetSafeCoordinateListIndex(coorToIndex)], CoordinateList[GetSafeCoordinateListIndex(coorToIndex - 1)], newCoverLine.X + (newCoverLine.Width / 2) * coef));
            CoordinateList.Insert(coorToIndex, returnCoordinates.Last());

            int coorFromIndex = Helpers.Methods.GetCoordinatecIndex(CoordinateList, coorFrom);
            returnCoordinates.Add(Helpers.Methods.LinearInterpolation(CoordinateList[GetSafeCoordinateListIndex(coorFromIndex)], CoordinateList[GetSafeCoordinateListIndex(coorFromIndex + 1)], newCoverLine.X + (newCoverLine.Width / 2) * coef));
            CoordinateList.Insert(coorFromIndex + 1, returnCoordinates.Last());

            return returnCoordinates;
        }
예제 #11
0
파일: AreaToCover.cs 프로젝트: MGajd/DP
        internal void SetAsDividedRight(CoverLine coverLine, decimal workingWidth)
        {
            DeleteAllSmallerOrEqualXCoordinates(coverLine.X + workingWidth / 2);

            //CoordinateList[0] = new Coordinates(coverLine.StartingCoordinates.X + workingWidth / 2, CoordinateList[0].Y);
            //CoordinateList[3] = new Coordinates(coverLine.EndingCoordinates.X + workingWidth / 2, CoordinateList[3].Y);
        }
예제 #12
0
파일: AreaToCover.cs 프로젝트: MGajd/DP
        internal void SetAsDividedLeft(CoverLine coverLine, decimal workingWidth)
        {
            DeleteAllBiggerOrEqualXCoordinates(coverLine.X - workingWidth / 2);

            //CoordinateList[1] = new Coordinates(coverLine.StartingCoordinates.X - workingWidth / 2, CoordinateList[1].Y);
            //CoordinateList[2] = new Coordinates(coverLine.EndingCoordinates.X - workingWidth / 2, CoordinateList[2].Y);
        }
예제 #13
0
파일: AreaToCover.cs 프로젝트: MGajd/DP
        /// <summary>
        /// Edit Coordinates in CoordinatesList due to coverLine
        /// </summary>
        /// <param name="newCoverLine"></param>
        internal void AddCoverLine(CoverLine newCoverLine)
        {
            int counter = 0;
            Coordinates leftDown = null,
                        leftUp = null,
                        rightDown = null,
                        rightUp = null;

            decimal leftX = newCoverLine.X - newCoverLine.Width / 2;
            decimal rightX = newCoverLine.X + newCoverLine.Width / 2;

            while (leftDown == null)
            {
                if (CoordinateList[GetSafeCoordinateListIndex(counter)].X <= leftX && CoordinateList[GetSafeCoordinateListIndex(counter + 1)].X > leftX)
                    leftDown = CoordinateList[GetSafeCoordinateListIndex(counter)];

                counter++;
            }

            while (rightDown == null)
            {
                if (CoordinateList[GetSafeCoordinateListIndex(counter)].X >= rightX && CoordinateList[GetSafeCoordinateListIndex(counter - 1)].X < rightX)
                    rightDown = CoordinateList[GetSafeCoordinateListIndex(counter)];
                else
                    counter++;
            }

            while (rightUp == null)
            {
                if (CoordinateList[GetSafeCoordinateListIndex(counter)].X >= rightX && CoordinateList[GetSafeCoordinateListIndex(counter + 1)].X < rightX)
                    rightUp = CoordinateList[GetSafeCoordinateListIndex(counter)];

                counter++;
            }

            while (leftUp == null)
            {
                if (CoordinateList[GetSafeCoordinateListIndex(counter)].X <= leftX && CoordinateList[GetSafeCoordinateListIndex(counter - 1)].X > leftX)
                    leftUp = CoordinateList[GetSafeCoordinateListIndex(counter)];

                counter++;
            }

            //zhora dole
            if (newCoverLine.CoverLineDirection == Enumerations.CoverLineDirection.upToDown)
            {
                if (World.CoverDirection == Enumerations.CoverDirection.leftToRight)
                    DeleteCoordinatesBetween(leftDown, leftUp, newCoverLine, -1);
                else if (World.CoverDirection == Enumerations.CoverDirection.rightToLeft)
                    DeleteCoordinatesBetween(rightUp, rightDown, newCoverLine);
            }

            //zdola hore
            else if (newCoverLine.CoverLineDirection == Enumerations.CoverLineDirection.downToUp)
            {
                if (World.CoverDirection == Enumerations.CoverDirection.leftToRight)
                    DeleteCoordinatesBetween(rightUp, rightDown, newCoverLine);
                else if (World.CoverDirection == Enumerations.CoverDirection.rightToLeft)
                    DeleteCoordinatesBetween(leftDown, leftUp, newCoverLine, -1);
            }
        }
예제 #14
0
파일: AreaToCover.cs 프로젝트: MGajd/DP
        public CoverLine GetLineFromRight(decimal width, decimal workingWidth, bool reverseDirection = false)
        {
            int coef = 1;
            if (reverseDirection)
                coef = -1;
            CoverLine coverLine = new CoverLine();
            coverLine.StartingCoordinates = new Coordinates(RightDown.X - width - (coef * workingWidth) / 2, RightDown.Y);
            coverLine.EndingCoordinates = new Coordinates(RightUp.X - width - (coef * workingWidth) / 2, RightUp.Y);

            coverLine.Status = Enumerations.CoverLineStatus.reserved;
            coverLine.IsDivide = false;
            coverLine.CoverLineID = World.CoverLineIDCounter++.ToString();

            if (reverseDirection)
                coverLine.ReverseCoordinates();
            return coverLine;
        }
예제 #15
0
파일: AreaToCover.cs 프로젝트: MGajd/DP
        public CoverLine GetLineFromLeft(decimal width, decimal workingWidth, bool reverseDirection = false)
        {
            //int coef = 1;
            //if (reverseDirection)
            //    coef = -1;

            //TODO:blocker - upravit kvoli moznosti pokrytia nepravidelnej plochy
            CoverLine coverLine = new CoverLine();
            coverLine.EndingCoordinates = new Coordinates(MinX + width - workingWidth / 2, LeftDown.Y);
            coverLine.StartingCoordinates = new Coordinates(MinX + width - workingWidth / 2, LeftUp.Y);

            coverLine.Status = Enumerations.CoverLineStatus.reserved;
            coverLine.IsDivide = false;
            coverLine.CoverLineID = World.CoverLineIDCounter++.ToString();

            if (reverseDirection)
                coverLine.ReverseCoordinates();
            return coverLine;
        }
예제 #16
0
파일: DoCover.cs 프로젝트: MGajd/DP
 private void DownToUpBoth(CoverLine _oldCoverLine, MachineObject _machineObject)
 {
     throw new NotImplementedException();
 }