/*
         * public void UpdateSnaps()
         * {
         *  for (int i = 0; i < ActiveSnapList.Count-1; i++)
         *  {
         *      SnapInformation inf1 = ActiveSnapList[i];
         *      SnapInformation inf2 = ActiveSnapList[i+1];
         *
         *      //Point to point only
         *      for(int j=0; j<inf1.SnapList.Count;j++)
         *      {
         *          SnapPoint p1 = inf1.SnapList[j];
         *              for(int k=0; k<inf2.SnapList.Count;k++)
         *              {
         *                  SnapPoint p2 = inf2.SnapList[k];
         *
         *                  if (isInSnapRange(p1, p2))
         *                  {
         *
         *                  }
         *              }
         *      }
         *
         *
         *  }
         * }*/

        public void SnapTo(SnapInformation source, SnapInformation target)
        {
            //Point to point only
            for (int j = 0; j < target.SnapList.Count; j++)
            {
                SnapPoint pTarget = target.SnapList[j];
                for (int k = 0; k < source.SnapList.Count; k++)
                {
                    SnapPoint pSource = source.SnapList[k];

                    if (isSameType(pTarget, pSource) && isInSnapRange(pTarget, pSource))
                    {
                        source.Snap(pSource, pTarget);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public List <Transformation> SnapTo(SnapInformation obj, List <ISnappableWorldTarget> targets)
        {
            List <Transformation> transformations = new List <Transformation>();

            for (int i = 0; i < targets.Count; i++)
            {
                for (int k = 0; k < obj.SnapList.Count; k++)
                {
                    var target = targets[i];
                    for (int l = 0; l < target.SnapInformation.SnapList.Count; l++)
                    {
                        var objSnapObjectType    = obj.SnapList[k];
                        var targetSnapObjectType = target.SnapInformation.SnapList[l];


                        if (objSnapObjectType.TileFaceType.GetRoot() == targetSnapObjectType.TileFaceType.GetRoot())
                        {
                            for (int index = 0; index < snappers.Count; index++)
                            {
                                ISnapObjectSnapper t = snappers[index];

                                var snapper = t;


                                if (snapper.SnapObjectTypeA == objSnapObjectType.GetType() &&
                                    snapper.SnapObjectTypeB == targetSnapObjectType.GetType())
                                {
                                    snapper.SnapAToB(objSnapObjectType, targetSnapObjectType, target.Transformation, transformations);
                                }
                                else if (snapper.SnapObjectTypeB == objSnapObjectType.GetType() &&
                                         snapper.SnapObjectTypeA == targetSnapObjectType.GetType())
                                {
                                    snapper.SnapBToA(targetSnapObjectType, objSnapObjectType, target.Transformation, transformations);
                                }
                            }
                        }
                    }
                }
            }


            return(transformations);
        }
 public void addSnapInformation(SnapInformation information)
 {
     ActiveSnapList.Add(information);
 }