StringsListSelectionWidget::StringsListSelectionWidget(QWidget *parent,
    const ListType listType, const unsigned int maxSelectedStringsListSize) :
  QWidget(parent), listType(listType), stringsListSelectionWidget(NULL) {
  setListType(listType);
  stringsListSelectionWidget->setMaxSelectedStringsListSize(
    maxSelectedStringsListSize);
}
示例#2
0
void PMListPattern::restoreMemento( PMMemento* s )
{
   PMMementoDataIterator it( s );
   PMMementoData* data;

   for( ; it.current( ); ++it )
   {
      data = it.current( );
      if( data->objectType( ) == s_pMetaObject )
      {
         switch( data->valueID( ) )
         {
            case PMListTypeID:
               setListType( ( PMListType ) data->intData( ) );
               break;
            case PMBrickSizeID:
               setBrickSize( data->vectorData( ) );
               break;
            case PMMortarID:
               setMortar( data->doubleData( ) );
               break;
            default:
               kdError( PMArea ) << "Wrong ID in PMListPattern::restoreMemento\n";
               break;
         }
      }
   }
   Base::restoreMemento( s );
}
示例#3
0
void CSensItem::setSingleObjectCN(const CCommonName & cn)
{
  mSingleObjectCN = cn;
  //  if (cn != "")
  setListType(CObjectLists::SINGLE_OBJECT);
}
SubRouteRequestPacket::SubRouteRequestPacket(const DriverPref* driverPref,
                                             const SubRouteVector* origs,
                                             const OrigDestInfoList* dests,
                                             const OrigDestInfoList* allDests,
                                             bool routeToOneDest,
                                             uint32 cutOff,
                                             int levelDelta,
                                             const DisturbanceVector*
                                             disturbances,
                                             bool calcCostSums,
                                             bool dontSendSubRoutes,
                                             const DisturbanceVector*
                                             infoModuleDists )
{   
   mc2dbg4 << "SubRouteRequestPacket::SubRouteRequestPacket" << endl;
   setPriority(DEFAULT_PACKET_PRIO);
   // Calculate size of request
   // Origins and destinations
  
   // Do something about the listtype
   if ( driverPref->getVehicleRestriction() != ItemTypes::pedestrian ) {
      setListType(SubRouteListTypes::LOWER_LEVEL);
   } else {
      // Pedestrian
      setListType(SubRouteListTypes::LOWER_LEVEL_WALK); // Lower level walk
   }

   uint32 reqSize = SUBROUTE_REQUEST_HEADER_SIZE;

   // The number of subroutes
   int nbrSubRoutes = origs->getSize() +
      // Add the destinations for HIGHER_LEVEL too
    ((getListType() == SubRouteListTypes::HIGHER_LEVEL) ? dests->size() : 0);

   
   // Origin. Will probably be removed
   if ( origs != NULL &&
        getListType() == SubRouteListTypes::HIGHER_LEVEL )
      reqSize += origs->size() * ORIG_DEST_SIZE;
   // Destinations 
   if ( dests != NULL )
      reqSize += dests->size() * ORIG_DEST_SIZE;
   // Subroutes.
   for(uint32 i=0; i < origs->size() ; i++ ) {
      reqSize += SUB_ROUTE_SIZE +
         SUB_ROUTE_CONNECTION_SIZE * 1;
   }

   // Compensate for disturbances
   // Length
   reqSize += 4;
   if ( disturbances != NULL ) {
      reqSize += DISTURBANCE_SIZE*disturbances->size();
   }
   reqSize += 4;
   if ( infoModuleDists != NULL ) {
      reqSize += 8 * infoModuleDists->size();
   }

   if ( reqSize > getBufSize() ) {
      mc2dbg2 << "SubRouteRequestPacket - buffer too small reallocing"
              << endl;
      byte* temp = MAKE_UINT32_ALIGNED_BYTE_BUFFER( reqSize * 2);
      memcpy(temp, this->buffer, SUBROUTE_REQUEST_HEADER_SIZE);      
      delete [] this->buffer;
      this->buffer = temp;
      this->bufSize = reqSize * 2;
   }

   // First request? Won't exactly work all the time...
   bool original = origs->front()->getPrevSubRouteID() == MAX_UINT32;

   if ( levelDelta == 1 ) {
      // Higher level routing - do some tricks
      setMapID( FIRST_OVERVIEWMAP_ID  );
      setListType(SubRouteListTypes::HIGHER_LEVEL);
   }

   //setOriginIP(leaderIP);
   //setOriginPort(leaderPort);
   setSubType(Packet::PACKETTYPE_SUBROUTEREQUEST);
   // Get mapid from one of the origins
   setMapID(origs->front()->getNextMapID() );
   // Setting the extra vehicle to avoid toll roads.
   uint32 extraVehicle = 0;
   if ( driverPref->avoidTollRoads() ) {
      extraVehicle |= ItemTypes::avoidTollRoad;
   }
   if ( driverPref->avoidHighways() ) {
      extraVehicle |= ItemTypes::avoidHighway;
   }
   setVehicleRestrictions( driverPref->getVehicleRestriction() |
                           extraVehicle );
                                                  
   setRoutingCosts(driverPref->getRoutingCosts());
   setUseTurnCost(driverPref->useUturn());
   setTime(driverPref->getTime());
   setMinWaitTime(driverPref->getMinWaitTime());

   // Some flags.
   setRouteToAll(! routeToOneDest );
   setDontSendSubRoutes( dontSendSubRoutes );
   setCalcCostSums( calcCostSums );
      
   setRouteID(0);  // Don't know what it should be. Seems to be the same
                   // as the request id, but for the RouteReader.
   setCutOff(cutOff);
   
   setIsOriginalRequest(original);
   
   // Add the origins that belongs to this mapID and only the first time.
   setNbrOrigins(0);
   int pos = SUBROUTE_REQUEST_HEADER_SIZE;

   if ( original ) {
      for(uint32 i=0; i < origs->getSize(); i++) {
         const SubRoute* curSubRoute = origs->getSubRouteAt(i);
         // Destinations are origins in next route.
         const OrigDestInfo* orig = curSubRoute->getDestInfo();
         addOrigin(*orig, pos);
//           addOrigin(curSubRoute->getNextMapID(),
//                     curSubRoute->getDestNodeID(),
//                     curSubRoute->getDestOffset(),
//                     MAX_UINT32,
//                     MAX_UINT32,
//                     pos);
      }
   }
   
   // Add all destinations ( not allDests, they aren't used yet)
   setNbrDestinations(0);
   OrigDestInfoList::const_iterator it;
   it = dests->begin();
   while ( it != dests->end() ) {
      addDestination(*it, pos);
      it++;
   }

   setNbrSubRoutes( nbrSubRoutes );
   for (uint32 i = 0; i < origs->getSize(); i++) {
      SubRoute* subRoute = (*origs)[i];
      if (subRoute != NULL) {
         addSubRoute(subRoute, pos);
      }
   }

   if ( getListType() == SubRouteListTypes::HIGHER_LEVEL ) {
      OrigDestInfoList::const_iterator it(dests->begin());
      for(uint32 i=0; i < dests->size() ; ++i ) {
         SubRoute subRoute(*it, *it);
         ++it;
         // Add backward subroute for each destination.
         // The routemodule uses them as destinations later.
         addSubRoute(&subRoute, pos, false);
      }
   }
   
   addDisturbances(pos, disturbances);
   // Add info module disturbances using the more compact format.
   addInfoModDisturbances( pos, infoModuleDists );
   setLength(pos);
   
   if ( true || pos > (int)reqSize || (reqSize - pos) > 65536 ) {
      mc2dbg2 << "SubRouteRequestPacket - calcSize = " << reqSize 
           << "real size = " << pos << endl;
   }
} // Constructor