Exemplo n.º 1
0
void ossimROIEventListener::processEvent(ossimEvent& event)
{
   if(event.isConsumed()) return;
   
   ossimROIEvent* roiEvent = PTR_CAST(ossimROIEvent,
                                      &event);
   
   if(roiEvent)
   {
      const int type = roiEvent->getEventType();
      
      switch ( type )
      {
      case ossimROIEvent::OSSIM_RECTANGLE_ROI:
         handleRectangleROIEvent( *roiEvent );
         break;

      case ossimROIEvent::OSSIM_POLYGON_ROI:
         handlePolygonROIEvent( *roiEvent );
         break;


      case ossimROIEvent::OSSIM_POLYLINE_ROI:
         handlePolylineROIEvent( *roiEvent );
         break;

         default:
         break;
      }
   }
}
Exemplo n.º 2
0
void ossimImageChainChildListener::processEvent(ossimEvent& event)
{
   if(!theChain) return;
   ossimConnectableObjectListener::processEvent(event);
   ossimConnectableObject* obj = PTR_CAST(ossimConnectableObject,
                                          event.getCurrentObject());
   
   if((ossimConnectableObject*)theChain->getFirstSource() == obj)
   {
      if(event.isPropagatingToOutputs())
      {
         ossimConnectableObject::ConnectableObjectList& outputList = theChain->getOutputList();
         ossim_uint32 idx = 0;
         for(idx = 0; idx < outputList.size();++idx)
         {
            if(outputList[idx].valid())
            {
               outputList[idx]->fireEvent(event);
               outputList[idx]->propagateEventToOutputs(event);
            }
         }
      }
   }
}
Exemplo n.º 3
0
void ossimImageAoiListener::processEvent(ossimEvent& event)
{
   switch(event.getId())
   {
   case OSSIM_EVENT_AOI_RECTANGLE_ID:
   {
      ossimImageRectangleEvent* eventCast = static_cast<ossimImageRectangleEvent*>(&event);
      imageRectangleEvent(*eventCast);
      break;
   }
   case OSSIM_EVENT_AOI_POLYGON_ID:
   {
      ossimImagePolygonEvent* eventCast = static_cast<ossimImagePolygonEvent*>(&event);
      imagePolygonEvent(*eventCast);
      break;
   }
   default:
   {
      ossimListener::processEvent(event);
      break;
   }
   }
}
Exemplo n.º 4
0
void ossimListenerManager::fireEvent(ossimEvent& event)
{
   // only process the event if it has not been consumed.
   event.setCurrentObject( dynamic_cast<ossimObject*>(this) );
   if(event.isConsumed())
   {
      return;
   }
   theFireEventFlag = true;

   std::list<ossimListener*>::iterator currentIterator = theListenerList.begin();
   
   while(currentIterator != theListenerList.end())
   {
      // only fire if the event is not consumed
      if(!event.isConsumed())
      {
         if(*currentIterator)
         {
            if(theDelayedRemove.end()==std::find(theDelayedRemove.begin(),
                                                 theDelayedRemove.end(),
                                                 (*currentIterator)))
            {
               if((*currentIterator)->isListenerEnabled())
               {
                  (*currentIterator)->processEvent(event);
               }
            }
         }
      }
      else
      {
         // the event is now consumed so stop propagating.
         //
         theFireEventFlag = false;
         break;
      }
      ++currentIterator;
   }
   
   theFireEventFlag = false;
   
   if(theDelayedAdd.size())
   {
      for(std::list<ossimListener*>::iterator current = theDelayedAdd.begin();
          current != theDelayedAdd.end();++current)
      {
         addListener(*current);
      }
      theDelayedAdd.clear();
   }
   
   if(theDelayedRemove.size())
   {
      for(std::list<ossimListener*>::iterator current = theDelayedRemove.begin();
          current != theDelayedRemove.end();++current)
      {
         removeListener(*current);
      }
      theDelayedRemove.clear();
   }
}