} //todo łącz przy kasowaniu!

        public List <WeldRegenerationOrder> RegisterWeld(WeldPosition weldPosition, WeldSideType sideType,
                                                         WeldingInputTerrain inputTerrain)
        {
            var outList      = new List <WeldRegenerationOrder>();
            var newWeldsList = new List <Weld>();

            foreach (var weld in _welds)
            {
                if (RangeIsInWeld(weld, weldPosition.Range))
                {
                    WeldSplicingResult spliced = SpliceWeld(weld, weldPosition.Range);
                    var newWeld = spliced.NewWeld;
                    newWeld.AddSide(new WeldSideSource()
                    {
                        SideType = sideType,
                        Terrain  = inputTerrain
                    });

                    outList.Add(new WeldRegenerationOrder()
                    {
                        Weld = newWeld
                    });

                    newWeldsList.AddRange(spliced.RestOfWelds);
                    newWeldsList.Add(spliced.NewWeld);
                }
                else
                {
                    newWeldsList.Add(weld);
                }
            }

            _welds = newWeldsList.OrderBy(c => c.GlobalSizeRange.X).ToList();
            return(outList.Where(c => c.Weld.ThereAreBothSides).ToList());
        }
Beispiel #2
0
        public static TerrainWeldUvs CreateFrom(WeldSideType sideType, Vector4 weldUv)
        {
            Vector4 leftUv   = new Vector4(-1, -1, -1, -1);
            Vector4 rightUv  = new Vector4(-1, -1, -1, -1);
            Vector4 topUv    = new Vector4(-1, -1, -1, -1);
            Vector4 bottomUv = new Vector4(-1, -1, -1, -1);

            if (sideType == WeldSideType.Left)
            {
                leftUv = weldUv;
            }
            else if (sideType == WeldSideType.Right)
            {
                rightUv = weldUv;
            }
            else if (sideType == WeldSideType.Top)
            {
                topUv = weldUv;
            }
            else if (sideType == WeldSideType.Bottom)
            {
                bottomUv = weldUv;
            }
            else
            {
                Preconditions.Fail("Unsupported sideType: " + sideType);
            }
            return(new TerrainWeldUvs()
            {
                BottomUv = bottomUv,
                RightUv = rightUv,
                TopUv = topUv,
                LeftUv = leftUv
            });
        }
 public static bool IsDonorSide(this WeldSideType type)
 {
     if (type == WeldSideType.Left || type == WeldSideType.Bottom)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public static WeldOrientation GetOrientation(this WeldSideType type)
 {
     if (type == WeldSideType.Bottom || type == WeldSideType.Top)
     {
         return(WeldOrientation.Horizontal);
     }
     else
     {
         return(WeldOrientation.Vertical);
     }
 }