예제 #1
0
        private void OnClustersCancelled(ClusterUpdateEventArgs e)
        {
            EventHandler<ClusterUpdateEventArgs> handler;

            lock (ClusterUpdateLock)
            {
                handler = ClustersCancelledEvent;
            }
            
            if (handler != null)
            {
                handler(this, e);
            }

        }
예제 #2
0
        private void OnClusterToIdentify(ClusterUpdateEventArgs e)
        {
            EventHandler<ClusterUpdateEventArgs> handler;

            lock (ClusterUpdateLock)
            {
                handler = ClustersToIdentifyEvent;
            }
            
            if (handler != null)
            {
                handler(this, e);
            }

        }
예제 #3
0
        private void OnClustersMoved(object sender, ClusterUpdateEventArgs e)
        {
            foreach(Cluster cluster in e.GetClusters())
            {
                //Update internally the token
                InternalToken internalToken;
                if(tokens.TryGetValue(cluster.Hash,out internalToken))
                {
                    internalToken.Update(cluster);
                    tokens.Remove(cluster.Hash);
                    tokens.Add(internalToken.HashId, internalToken);

                    //Update Global Token
                    InputManager.GetToken(internalToken.Id).UpdateToken(internalToken);

                    //Here check deltas in order to fire or not Events
                    if(UpdateGreaterThanThreshold(internalToken))
                        LaunchScreenTokenUpdated(new ApplicationTokenEventArgs(new Token(internalToken)));

                }
            }
        }
예제 #4
0
        private void OnClustersCancelled(object sender, ClusterUpdateEventArgs e)
        {
            foreach(Cluster cluster in e.GetClusters())
            {
                //Cancle cluster according to point
                //Here is very delicate because it must be considered also the possibility of not removing the token untill not all points have been removed
                InternalToken token;
                if (tokens.TryGetValue(cluster.CancelledClusterHash, out token))
                {
                    tokenIds.Remove(token.Id);
                    InputManager.RemoveToken(token.Id);

                    tokens.Remove(cluster.CancelledClusterHash);

                    //Launch CallBack to CM
                    LaunchTokenCancelled(new InternalTokenCancelledEventArgs(cluster.Hash));

                    //Lauch Application Token Cancelled
                    LaunchTokenRemovedFromScreen(new ApplicationTokenEventArgs(new Token(token)));
                }

            }
        }
예제 #5
0
        private void OnClustersToIdentify(object sender, ClusterUpdateEventArgs e)
        {
            foreach(Cluster cluster in e.GetClusters())
            {
                //TODO this function requires updates
                InternalToken token = TokenIdentification.Instance.IdentifyCluster(cluster);
                
                if(token != null)
                {
                    //Statistics
                    tokenStatistics.TokenIdentification(true);

                    //Calculate TokenClass
                    token.ComputeTokenClass(ClassComputeRefSystem, ClassComputeDimension);

                    tokenStatistics.TokenClassRecognition(token.Class);
                    
                    //Cluster Identification succesfull
                    //Set Token ID
                    token.SetTokenId(GetFirstAvailableTokenId());
                    tokenIds.Add(token.Id);

                    //Add Token to internal List
                    tokens.Add(token.HashId, token);

                    //Add Token To Global List
                    InputManager.AddToken(new Token(token));                 

                    //Notify CM cluster has been identified
                    LaunchTokenIdentified(new InternalTokenIdentifiedEventArgs(token.HashId,true));

                    //Fire event token identified
                    LaunchTokenPlacedOnScreen(new ApplicationTokenEventArgs(new Token(token)));

                }
                else
                {
                    tokenStatistics.TokenIdentification(false);
                    //Cluser Identification failed, need to report back to CM
                    LaunchTokenIdentified(new InternalTokenIdentifiedEventArgs(cluster.Hash, false));

                }
            }
        }