GetNextId() public method

public GetNextId ( ) : int
return int
示例#1
0
        private IList <FingerPoint> MapFingerPoints(IList <FingerPoint> oldFingerPoints, IList <FingerPoint> newFingerPoints)
        {
            var idGenerator = new IdGenerator();
            var distanceMap = new DistanceMap <FingerPoint, FingerPoint>(oldFingerPoints);

            distanceMap.Map(newFingerPoints);
            foreach (var tuple in distanceMap.MappedItems)
            {
                idGenerator.SetUsed(tuple.Item1.Id);
                tuple.Item2.Id         = tuple.Item1.Id;
                tuple.Item2.FrameCount = tuple.Item1.FrameCount + 1;
            }
            foreach (var newFinger in distanceMap.UnmappedItems)
            {
                newFinger.Id = idGenerator.GetNextId();
            }
            foreach (var discontinuedFinger in distanceMap.DiscontinuedItems)
            {
                discontinuedFinger.NegativeFrameCount++;
            }

            return(distanceMap.MappedItems.Select(i => i.Item2)
                   .Union(distanceMap.UnmappedItems)
                   .Union(distanceMap.DiscontinuedItems)
                   .Where(i => i.NegativeFrameCount <= this.settings.FramesForDiscontinuedFingerPoint).ToList());
        }
示例#2
0
        private IList <FingerPoint> MapFingerPoints(IList <FingerPoint> oldFingerPoints, IList <FingerPoint> newFingerPoints)
        {
            var idGenerator = new IdGenerator();
            var distanceMap = new DistanceMap <FingerPoint, FingerPoint>(oldFingerPoints);

            distanceMap.Map(newFingerPoints);
            foreach (var tuple in distanceMap.MappedItems)
            {
                idGenerator.SetUsed(tuple.Item1.Id);
                tuple.Item2.Id = tuple.Item1.Id;
            }
            foreach (var newFinger in distanceMap.UnmappedItems)
            {
                newFinger.Id = idGenerator.GetNextId();
            }
            return(distanceMap.MappedItems.Select(i => i.Item2).Union(distanceMap.UnmappedItems).ToList());
        }
 private IList<FingerPoint> MapFingerPoints(IList<FingerPoint> oldFingerPoints, IList<FingerPoint> newFingerPoints)
 {
     var idGenerator = new IdGenerator();
     var distanceMap = new DistanceMap<FingerPoint, FingerPoint>(oldFingerPoints);
     distanceMap.Map(newFingerPoints);
     foreach (var tuple in distanceMap.MappedItems)
     {
         idGenerator.SetUsed(tuple.Item1.Id);
         tuple.Item2.Id = tuple.Item1.Id;
     }
     foreach (var newFinger in distanceMap.UnmappedItems)
     {
         newFinger.Id = idGenerator.GetNextId();
     }
     return distanceMap.MappedItems.Select(i => i.Item2).Union(distanceMap.UnmappedItems).ToList();
 }
示例#4
0
 private HandData Create(Shape shape)
 {
     return(this.Create(idGenerator.GetNextId(), shape, new List <FingerPoint>()));
 }
示例#5
0
        private IList<FingerPoint> MapFingerPoints(IList<FingerPoint> oldFingerPoints, IList<FingerPoint> newFingerPoints)
        {
            var idGenerator = new IdGenerator();
            var distanceMap = new DistanceMap<FingerPoint, FingerPoint>(oldFingerPoints);
            distanceMap.Map(newFingerPoints);
            foreach (var tuple in distanceMap.MappedItems)
            {
                idGenerator.SetUsed(tuple.Item1.Id);
                tuple.Item2.Id = tuple.Item1.Id;
                tuple.Item2.FrameCount = tuple.Item1.FrameCount + 1;
            }
            foreach (var newFinger in distanceMap.UnmappedItems)
            {
                newFinger.Id = idGenerator.GetNextId();
            }
            foreach (var discontinuedFinger in distanceMap.DiscontinuedItems)
            {
                discontinuedFinger.NegativeFrameCount++;
            }

            return distanceMap.MappedItems.Select(i => i.Item2)
                .Union(distanceMap.UnmappedItems)
                .Union(distanceMap.DiscontinuedItems)
                .Where(i => i.NegativeFrameCount <= this.settings.FramesForDiscontinuedFingerPoint).ToList();
        }