public void addToAGroup(MyThumb old, MyThumb newThumb)
 {
     Console.Write("\naddToAGroup => grouplinecount: " + old.grouplinecount + "," + newThumb.grouplinecount + " | groupnumbers: " + old.groupNumber + "," + newThumb.groupNumber);
     newThumb.groupNumber = old.groupNumber;
     thumbGroupsList[old.groupNumber].getListOfThumbs().Add(newThumb);
     windowRef.createLink(old, newThumb, thumbGroupsList[old.groupNumber].getColor(), 3);
 }
 public GroupMode(Window1 w)
 {
     windowRef         = w;
     thumbGroupsList   = new List <ThumbGroups>();
     dummy             = new MyThumb();
     dummy.groupNumber = dummy.grouplinecount = -100;
 }
 public Link(MyThumb s, MyThumb e, int color, int thickness)
 {
     line      = new LineGeometry();
     startNode = s;
     endNode   = e;
     createPath(color, thickness);
     path.Data = line;
     s.StartLines.Add(line);
     e.EndLines.Add(line);
 }
        public void removeGroup(MyThumb one)
        {
            nextIndexToBeFilled = one.groupNumber;
            ThumbGroups group = thumbGroupsList[one.groupNumber];

            foreach (MyThumb thumb in group.getListOfThumbs())
            {
                thumb.grouplinecount = 0;;
                thumb.groupNumber    = -1;
            }
            thumbGroupsList[one.groupNumber] = null;
        }
 public void removeLink(MyThumb one, MyThumb two)
 {
     Console.Write("\nremoveLink => grouplinecount: " + one.grouplinecount + "," + two.grouplinecount + " | groupnumbers: " + one.groupNumber + "," + two.groupNumber);
     if (one.grouplinecount == 0 || two.grouplinecount == 0)
     {
         windowRef.deleteLink(one, two);
         return;
     }
     if (one.groupNumber == two.groupNumber)
     {
         Console.Write(" ....same group number");
         if (one.grouplinecount == 1 && two.grouplinecount == 1)
         {
             windowRef.deleteLink(one, two);
             removeGroup(one, two);
             one.grouplinecount = 0; two.grouplinecount = 0;
             one.groupNumber    = -1; two.groupNumber = -1;
         }
         else
         {
             if (one.grouplinecount > 1 && two.grouplinecount > 1)
             {
                 windowRef.deleteLink(one, two);
                 one.grouplinecount--; two.grouplinecount--;
                 //one.groupNumber = two.groupNumber = -1;
             }
             else
             {
                 if (one.grouplinecount == 1)
                 {
                     windowRef.deleteLink(one, two);
                     removeThumbFromGroup(one);
                     one.grouplinecount = 0; one.groupNumber = -1;
                     two.grouplinecount--;
                 }
                 else
                 if (two.grouplinecount == 1)
                 {
                     windowRef.deleteLink(one, two);
                     removeThumbFromGroup(two);
                     two.grouplinecount = 0; two.groupNumber = -1;
                     one.grouplinecount--;
                 }
             }
         }
     }
     else
     {
         windowRef.deleteLink(one, two);
     }
     //****
 }
        public void unSelectWholeGroup()
        {
            Console.Write("\nUNselectWholeGroup");
            //currentGroupSelectionThumb = one;
            ThumbGroups group = thumbGroupsList[currentGroupSelectionThumb.groupNumber];

            foreach (MyThumb thumb in group.getListOfThumbs())
            {
                windowRef.myCanvas.Children.Remove(thumb.rect);
            }
            currentGroupSelectionThumb = dummy;
            currentSelectedGroup       = null;
        }
        public void createGroup(MyThumb one, MyThumb two)
        {
            //if (nextIndexToBeFilled != -1)
            //{
            //    currentIndex = nextIndexToBeFilled;
            //    nextIndexToBeFilled = -1;
            //}
            //else
            //{}
            currentIndex = thumbGroupsList.Count;
            ThumbGroups group = new ThumbGroups(currentIndex + 1, 3, currentIndex);

            one.groupNumber = two.groupNumber = group.getGroupNumber();
            group.getListOfThumbs().Add(one);
            group.getListOfThumbs().Add(two);
            thumbGroupsList.Add(group);
            windowRef.createLink(one, two, currentIndex + 1, 3);
        }
        public void handleThumbDeletion(MyThumb thumb)
        {
            List <MyThumb> neighbours = windowRef.getGroupNeighboursOnThumbDeletion(thumb);

            if (neighbours != null)
            {
                if (neighbours.Count != 0)
                {
                    foreach (MyThumb t in neighbours)
                    {
                        removeLink(thumb, t);
                    }
                }
            }
            if (thumb.groupNumber != -1)
            {
                removeThumbFromGroup(thumb);
            }
        }
        public void removeThumbFromGroup(MyThumb one)
        {
            ThumbGroups group = thumbGroupsList[one.groupNumber];
            bool        found = false;

            for (int i = 0; i < group.getListOfThumbs().Count&& !found; i++)
            {
                if (one == group.getListOfThumbs()[i])
                {
                    group.getListOfThumbs()[i].grouplinecount = 0;;
                    group.getListOfThumbs()[i].groupNumber    = -1;
                    found = true;
                }
            }
            if (found)
            {
                group.getListOfThumbs().Remove(one);
            }
        }
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                }

                this.kinectRegion = null;
                this.inputModel   = null;
                this.myThumb      = null;

                this.inputModel.ManipulationStarted   -= InputModel_ManipulationStarted;
                this.inputModel.ManipulationUpdated   -= InputModel_ManipulationUpdated;
                this.inputModel.ManipulationCompleted -= InputModel_ManipulationCompleted;

                disposedValue = true;
            }
        }
 public bool selectWholeGroup(MyThumb one)
 {
     Console.Write("\nselectWholeGroup");
     if (one.groupNumber == -1)
     {
         return(false);
     }
     if (currentGroupSelectionThumb != one)
     {
         currentGroupSelectionThumb = one;
         ThumbGroups group = thumbGroupsList[one.groupNumber];
         currentSelectedGroup = group;
         foreach (MyThumb thumb in group.getListOfThumbs())
         {
             thumb.rect = windowRef.addRectangle(thumb, 3);
             windowRef.myCanvas.Children.Add(thumb.rect);
         }
     }
     return(true);
 }
 public void drawLine(MyThumb one, MyThumb two)
 {
     Console.Write("\ndrawLine => grouplinecount: " + one.grouplinecount + "," + two.grouplinecount + " | groupnumbers: " + one.groupNumber + "," + two.groupNumber);
     if (one.groupNumber == -1 && two.groupNumber == -1)
     {
         Console.Write(" ....one.groupNumber == -1 && two.groupNumber == -1");
         createGroup(one, two); one.grouplinecount++; two.grouplinecount++;
         return;
     }
     if (one.groupNumber != -1 && two.groupNumber != -1)
     {
         Console.Write(" ....one.groupNumber != -1 && two.groupNumber != -1");
         if (one.groupNumber == two.groupNumber)
         {
             Console.Write(" ....one.groupNumber == two.groupNumber");
             windowRef.createLink(one, two, thumbGroupsList[one.groupNumber].getColor(), 3);
             one.grouplinecount++; two.grouplinecount++;
         }
         else
         {
             windowRef.createLink(one, two);
         }
     }
     else
     {
         Console.Write(" ....one.groupNumber != -1 or two.groupNumber != -1");
         if (one.groupNumber != -1)
         {
             addToAGroup(one, two); one.grouplinecount++; two.grouplinecount++;
         }
         else
         {
             addToAGroup(two, one); one.grouplinecount++; two.grouplinecount++;
         }
     }
 }
示例#13
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 6 "..\..\Window1.xaml"
                ((KinectWhiteBoard.Window1)(target)).Loaded += new System.Windows.RoutedEventHandler(this.WindowLoaded);

            #line default
            #line hidden
                return;

            case 2:
                this.myCanvas = ((System.Windows.Controls.Canvas)(target));
                return;

            case 3:
                this.myThumb1 = ((KinectWhiteBoard.MyThumb)(target));
                return;

            case 4:
                this.myThumb2 = ((KinectWhiteBoard.MyThumb)(target));
                return;

            case 5:
                this.myThumb3 = ((KinectWhiteBoard.MyThumb)(target));
                return;

            case 6:
                this.myThumb4 = ((KinectWhiteBoard.MyThumb)(target));
                return;

            case 7:
                this.showIt = ((System.Windows.Controls.Button)(target));

            #line 55 "..\..\Window1.xaml"
                this.showIt.Click += new System.Windows.RoutedEventHandler(this.showMenuClick);

            #line default
            #line hidden
                return;

            case 8:
                this.showRight = ((System.Windows.Controls.Button)(target));

            #line 56 "..\..\Window1.xaml"
                this.showRight.Click += new System.Windows.RoutedEventHandler(this.showRightClick);

            #line default
            #line hidden
                return;

            case 9:
                this.closeRight = ((System.Windows.Controls.Button)(target));

            #line 57 "..\..\Window1.xaml"
                this.closeRight.Click += new System.Windows.RoutedEventHandler(this.closeRightClick);

            #line default
            #line hidden
                return;

            case 10:
                this.RecycleBin = ((System.Windows.Controls.Image)(target));
                return;

            case 11:
                this.ActionText = ((System.Windows.Controls.TextBox)(target));
                return;

            case 12:
                this.GroupModeText = ((System.Windows.Controls.TextBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
 public void removeGroup(MyThumb one, MyThumb two)
 {
     Console.Write("\nREMOVE GROUP");
     nextIndexToBeFilled = one.groupNumber;
     thumbGroupsList[one.groupNumber] = null;
 }
 public void addThumbToGroup(MyThumb thumb)
 {
     listOfThumbs.Add(thumb);
 }