Beispiel #1
0
        public void AddMessage(HMessage objs)
        {
            HTuple finish = objs.GetMessageParam("key_exists", "finish_processing");

            if ((int)finish == 0)
            {
                HTuple hasmatch = objs.GetMessageParam("key_exists", "contour");
                if ((int)hasmatch == 1)
                {
                    AddToStack(objs.GetMessageObj("contour"));
                }
                AddToStack(objs.GetMessageObj("image"));
            }
            DisplayResults();

            // clean up previously sent HALCON objects
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Beispiel #2
0
 private void DoWork()
 {
     while (IsRunning)
     {
         HMessage imsg = null;
         if (wait)
         {
             imsg = msg_queue.DequeueMessage("timeout", "infinite");
         }
         else
         {
             try
             {
                 // unless we post a message in the queue, we get a timeout
                 // error
                 imsg = msg_queue.DequeueMessage("timeout", 0);
             }
             catch (HalconException)
             {
             }
         }
         if (imsg != null)
         {
             HTuple finish = imsg.GetMessageParam("key_exists", "finish_processing");
             if ((int)finish == 1)
             {
                 lock (locker)
                     running = false;
                 return;
             }
         }
         HMessage msg = ActorTask(imsg);
         if (Next != null)
         {
             Next.AddMessage(msg);
         }
     }
 }