std::string CExperimentObjectMap::getObjectCN(const size_t & index) const
{
  const CDataColumn * pColumn =
    dynamic_cast< const CDataColumn * >(getGroup(StringPrint("%d", index)));

  if (pColumn)
    return pColumn->getObjectCN();
  else
    return "";
}
C_FLOAT64 CExperimentObjectMap::getDefaultScale(const size_t & index) const
{
  const CDataColumn * pColumn =
    dynamic_cast< const CDataColumn * >(getGroup(StringPrint("%d", index)));

  if (pColumn)
    return pColumn->getDefaultScale();
  else
    return std::numeric_limits<C_FLOAT64>::quiet_NaN();
}
std::vector<std::wstring> UnicodeMatcher::findAll()
{
  std::vector<std::wstring> ret;
  reset();
  while (findNextMatch())
  {
    ret.push_back(getGroup());
  }
  return ret;
}
CExperiment::Type CExperimentObjectMap::getRole(const size_t & index) const
{
  const CDataColumn * pColumn =
    dynamic_cast< const CDataColumn * >(getGroup(StringPrint("%d", index)));

  if (pColumn)
    return pColumn->getRole();
  else
    return CExperiment::ignore;
}
/*!
 * starts to draw a new group
 * or to move/resize an existing group
 */
void XletSwitchBoard::mousePressEvent(QMouseEvent *event)
{
    // check which button was pressed
    if (event->button() == Qt::LeftButton) {
        // check if there is a group under the cursor
        Group *group = getGroup(m_layout->getPosInGrid(event->pos()));
        if (!group) {
            // start drawing a box for a new group
            m_first_corner = event->pos();
            m_second_corner = event->pos();
            m_trace_box = true;
        } else {
            QPoint topLeft = m_layout->getPosFromGrid(group->rect().topLeft());
            QPoint bottomRight = m_layout->getPosFromGrid(group->rect().bottomRight());
            m_group_resize_mode = 0;

            if (event->pos().y() - topLeft.y() < 10) {
                setCursor(QCursor(Qt::SizeVerCursor));
                m_group_resize_mode |= ETop;
            } else if (bottomRight.y() - event->pos().y() < 10) {
                setCursor(QCursor(Qt::SizeVerCursor));
                m_group_resize_mode |= EBottom;
            }


            if (event->pos().x() - topLeft.x() < 10) {
                if (m_group_resize_mode&ETop) {
                    setCursor(QCursor(Qt::SizeFDiagCursor));
                } else if (m_group_resize_mode&EBottom) {
                    setCursor(QCursor(Qt::SizeBDiagCursor));
                } else {
                    setCursor(QCursor(Qt::SizeHorCursor));
                }
                m_group_resize_mode |= ELeft;
            } else if (bottomRight.x() - event->pos().x() < 10) {
                if (m_group_resize_mode&ETop) {
                    setCursor(QCursor(Qt::SizeBDiagCursor));
                } else if (m_group_resize_mode&EBottom) {
                    setCursor(QCursor(Qt::SizeFDiagCursor));
                } else {
                    setCursor(QCursor(Qt::SizeHorCursor));
                }
                m_group_resize_mode |= ERight;
            }

            if (!m_group_resize_mode) {
                setCursor(QCursor(Qt::SizeAllCursor));
                m_group_resize_mode = EMove;
            }

            m_group_to_resize = group;
            m_first_corner = event->pos();  // storing "start" position
        }
    }
}
Example #6
0
void BaseTrackPlayerImpl::setupEqControls() {
    const QString group = getGroup();
    m_pLowFilter = new ControlObjectSlave(group, "filterLow");
    m_pMidFilter = new ControlObjectSlave(group, "filterMid");
    m_pHighFilter = new ControlObjectSlave(group, "filterHigh");
    m_pLowFilterKill = new ControlObjectSlave(group, "filterLowKill");
    m_pMidFilterKill = new ControlObjectSlave(group, "filterMidKill");
    m_pHighFilterKill = new ControlObjectSlave(group, "filterHighKill");
    m_pSpeed = new ControlObjectSlave(group, "rate");
    m_pPitch = new ControlObjectSlave(group, "pitch");
}
Example #7
0
bool CExperimentObjectMap::setScale(const size_t & index,
                                    const C_FLOAT64 & weight)
{
  CDataColumn * pColumn =
    dynamic_cast< CDataColumn * >(getGroup(StringPrint("%d", index)));

  if (pColumn)
    return pColumn->setScale(weight);
  else
    return false;
}
Example #8
0
Explosion::Explosion(QObject *parent) :
    QObject(parent),
    root(new osg::Group()),
    geode(new osg::Geode()),
    emitter(new osgParticle::ModularEmitter()),
    particleSystem(new osgParticle::ParticleSystem()),
    defaultParticle(new osgParticle::Particle()),
    updater(new osgParticle::ParticleSystemUpdater()),
    rateCounter((osgParticle::RandomRateCounter*)emitter->getCounter()),
    placer((osgParticle::PointPlacer*)emitter->getPlacer()),
    shooter((osgParticle::RadialShooter*)emitter->getShooter()),
    pat(new osg::PositionAttitudeTransform())
{
    //    defaultParticle->setShape(osgParticle::Particle::POINT);
    defaultParticle->setShape(osgParticle::Particle::QUAD_TRIANGLESTRIP);
    defaultParticle->setSizeRange(osgParticle::rangef(0.1, 1));
    defaultParticle->setColorRange(
                osgParticle::rangev4(
                    osg::Vec4f(1.0, 0.0, 0.0, 1.0),
                    osg::Vec4f(0.0, 1.0, 0.0, 1.0)
                    )
                );
    defaultParticle->setLifeTime(6.0);
    // particleSystem->setDefaultAttributes("resources/textures/waterparticle.png");
    particleSystem->setDefaultParticleTemplate(*defaultParticle);
    particleSystem->setParticleAlignment(osgParticle::ParticleSystem::BILLBOARD);

    geode->addDrawable(particleSystem);
    root->addChild(geode);
    updater->addParticleSystem(particleSystem);
    root->addChild(updater);
    rateCounter->setRateRange(500.0, 1000.0);
    shooter->setThetaRange( osgParticle::rangef(0.1, 0.4));
    shooter->setPhiRange( osgParticle::rangef(0.0, 6.2));
    shooter->setInitialSpeedRange( osgParticle::rangef(2, 40.0));
    emitter->setParticleSystem(particleSystem);
    pat->addChild(emitter);
    pat->setPosition( osg::Vec3d(0.0, -0.0, -10.0));


    // Create a modular program and attach it to our particle system
    osgParticle::ModularProgram *moveDustInAir = new osgParticle::ModularProgram;
    moveDustInAir->setParticleSystem(particleSystem);

    // Create an operator that simulates gravity, adjust it and add it to our program
    osgParticle::AccelOperator *accelUp = new osgParticle::AccelOperator;
    accelUp->setToGravity(2); // scale factor for normal acceleration due to gravity.
    moveDustInAir->addOperator(accelUp);

    // Finally, add the program to the scene
    getGroup().addChild(moveDustInAir);

    setEnabled(false);
}
Example #9
0
bool CExperimentObjectMap::setRole(const size_t & index,
                                   const CExperiment::Type & role)
{
  CDataColumn * pColumn =
    dynamic_cast< CDataColumn * >(getGroup(StringPrint("%d", index)));

  if (pColumn)
    return pColumn->setRole(role);
  else
    return false;
}
Example #10
0
bool CExperimentObjectMap::setObjectCN(const size_t & index,
                                       const std::string & CN)
{
  CDataColumn * pColumn =
    dynamic_cast< CDataColumn * >(getGroup(StringPrint("%d", index)));

  if (pColumn)
    return pColumn->setObjectCN((CCopasiObjectName) CN);
  else
    return false;
}
Example #11
0
// virtual
const std::string & CExperimentObjectMap::getName(const size_t & index) const
{
  static const std::string NoName("");

  const CDataColumn * pColumn =
    dynamic_cast< const CDataColumn * >(getGroup(StringPrint("%d", index)));

  if (pColumn)
    return pColumn->getObjectName();
  else
    return NoName;
}
Example #12
0
//-----------------------------------------------------------------------------
// 
// VSceneObjectEvent::getSceneObject();
// 
// Returns the parent group's object reference.
// 
//-----------------------------------------------------------------------------
VTorque::SceneObjectType *VSceneObjectEvent::getSceneObject( void )
{
    VSceneObjectGroup *group;
    if ( !getGroup( group ) )
    {
        // No Group!
        return NULL;
    }

    // Return Object.
    return group->getSceneObject();
}
Example #13
0
ScriptGroup* ScriptRegistry::getOrMakeGroup(const char* group)
{
	ScriptGroup* pGroup( getGroup(group) );

	if(!pGroup)
	{
		pGroup = new ScriptGroup(group);
		m_groups.push_back(pGroup);
	}

	return pGroup;
}
Example #14
0
/*
  core function: recursively traces through every stone that is
  orthogonally connected starting at stone x,y. as it traverses it counts
  and updates the attributes Size, Liberties, and Owner, and returns them
  wrapped in a Group structure

  param x,y: coordinates of a stone within a group
  param currGroup: a copy of a Group object that holds all attributes
  
  returns currGroup after traversing all stones in the group
*/
Group GoBoard::getGroup( int x, int y, Group currGroup )
{
  //coordinates of all neighbor stones
  int xnew[] = { x-1, x, x+1, x };
  int ynew[] = { y, y-1, y, y+1 };

  //set as counted to prevent double count
  grid[x][y]->setCounted();

  //iterate through every neighbor
  for( int i = 0; i < 4; i++ )
    {
      //verify we're on the board
      if( isOnBoard( xnew[i], ynew[i] ))
	{
	  //verify we have the same player
	  if( grid[xnew[i]][ynew[i]]->isPlayer(currGroup.player))
	    {
	      //check if already counted
	      if( !grid[xnew[i]][ynew[i]]->isCounted())
		{
		  currGroup = getGroup( xnew[i], ynew[i], currGroup );
		}
	    }
	  //if it is not the same player then we have to determine if ownership
	  //of the group has changed for empty territories
	  else if( currGroup.owner == EMPTY || 
		   grid[xnew[i]][ynew[i]]->isPlayer(currGroup.owner))
	    {
	      //if we have run into the same owner, or the owner hasn't been set
	      //then the piece we've run into is the owner
	      currGroup.owner = (Player)grid[xnew[i]][ynew[i]]->getPlayer();
	    }
	  else
	    {
	      //if we've run into something different than the owner
	      //then the territory is contested, once it's marked as DOMI
	      //it can't be scored for either player
	      currGroup.owner = (Player)DOMI;
	    }
	}
    }

  //increment the group size and find any liberties next to the current stone
  currGroup.size += 1;
  currGroup.liberties += countNeighbors( EMPTY, x, y );

  //debug for the attributes of each stone as it's traversed
  //std::cout<<"x: "<< x <<" y: "<< y << " lib: "<<countNeighbors( EMPTY, x, y )<<std::endl;
  
  
  return currGroup;
}
Example #15
0
//-----------------------------------------------------------------------------
// 
// VCameraTrack::onAttach();
// 
// This callback subscribes this object to the Camera Group's event signal.
// 
//-----------------------------------------------------------------------------
void VCameraTrack::onAttach( void )
{
    Parent::onAttach();

    // Valid Controller & Group?
    VCameraGroup *group;
    if ( getController() && getGroup( group ) )
    {
        // Add Event Notification.
        group->getCameraEventSignal().notify( this, &VCameraTrack::onCameraEvent );
    }
}
Example #16
0
//-----------------------------------------------------------------------------
// 
// VCameraTrack::onAttach();
// 
// This callback removes this object from the Camera Group's event signal
// notification list.
// 
//-----------------------------------------------------------------------------
void VCameraTrack::onDetach( void )
{
    // Valid Controller & Group?
    VCameraGroup *group;
    if ( getController() && getGroup( group ) )
    {
        // Clear Event Notification.
        group->getCameraEventSignal().remove( this, &VCameraTrack::onCameraEvent );
    }

    Parent::onDetach();
}
Example #17
0
int rates::getNextRateLevel(WORD wGroup)
{
	rates_group *pGroup = getGroup(wGroup);

	if (pGroup)
	{
		int nLevel = pGroup->rCurrentLevel*(pGroup->dwWindowSize-1)/pGroup->dwWindowSize + (GetTickCount() - pGroup->tCurrentLevel)/pGroup->dwWindowSize;

		return nLevel < (int)pGroup->dwMaxLevel ? nLevel : pGroup->dwMaxLevel;
	}
	return -1; // Failure
}
Example #18
0
void rates::updateLevel(WORD wGroup, int nLevel)
{
	rates_group *pGroup = getGroup(wGroup);

	if (pGroup)
	{
		pGroup->rCurrentLevel = nLevel;
		pGroup->tCurrentLevel = GetTickCount();
#ifdef _DEBUG
		ppro->NetLog_Server("Rates: New level %d for #%d", nLevel, wGroup);
#endif
	}
}
Example #19
0
void GroupClient::sendLoginInformation()
{
    const CGroupChar *character = getGroup()->getSelf();
    QVariantMap loginData = character->toVariantMap();
    if (proposedProtocolVersion == PROTOCOL_VERSION_102) {
        // Protocol 102 does handshake and login in one step
        loginData["protocolVersion"] = socket.getProtocolVersion();
        socket.setProtocolVersion(PROTOCOL_VERSION_102);
    }
    QVariantMap root;
    root["loginData"] = loginData;
    sendMessage(&socket, Messages::UPDATE_CHAR, root);
}
Example #20
0
bool
Connect::isInGroup(const Port& portInfo) const
{
  SharedPtr<const Node> node = portInfo.getNode();
  if (!node)
    return false;
  SharedPtr<const Group> group = getGroup();
  if (!group)
    return false;
  if (!node->isChildOf(group))
    return false;
  return true;
}
Example #21
0
void Manager::setSetpoint(uint8_t devid, int16_t setpoint) {
    // Lookup device
    auto dev = m_registry->getDevice(devid);
    if (dev == nullptr) return;

    // Get group and offset for device
    auto group = m_registry->getGroup(dev->getGroup());
    if (group == nullptr) return;
    auto offset = dev->getOffset();

    // Write new setpoint
    group->setSetpoint(offset, setpoint);
}
JSBSimScheduledGain::JSBSimScheduledGain(const std::string& name) :
  JSBSimFCSComponent(name)
{
  // Such a component is a simple product and a table lookup
  //
  // -------------------------------|
  // --|BreakPointLookup|-|Table|-|Product|-
  //

  Product* product = new Product("Product");
  getGroup()->addChild(product);

  mBreakPointLookup = new BreakPointLookup("Table Lookup");
  getGroup()->addChild(mBreakPointLookup);

  mTable = new Table1D("Table");
  getGroup()->addChild(mTable);
  getGroup()->connect(product->getInputPort(0),
                      mTable->getOutputPort());
  getGroup()->connect(mTable->getInputPort(0),
                      mBreakPointLookup->getOutputPort());

  // Now connect the input and the output to this groups in and outputs
  GroupInput* groupInput = new GroupInput("Input");
  getGroup()->addChild(groupInput);
  groupInput->setExternalPortName("input");
  getGroup()->connect(product->getInputPort(1),
                      groupInput->getPort("output"));
 
  groupInput = new GroupInput("Schedule Input");
  getGroup()->addChild(groupInput);
  groupInput->setExternalPortName("scheduleInput");
  getGroup()->connect(mBreakPointLookup->getInputPort(0),
                      groupInput->getPort("output"));

  // That single output port is this one
  getGroup()->connect(getInternalOutputPort(),
                      product->getOutputPort());
}
int HDF5IO::loadInt(const std::string& GroupName, const std::string& Name)
{
    try{
      H5::Group FG = getGroup( GroupName );
      H5::DataSet DataSet = FG.openDataSet( Name.c_str());
      int x;
      DataSet.read(&x,H5::PredType::NATIVE_INT);
      FG.close();
      return x;
    }catch( H5::GroupIException not_found_error ){
      RUNTIME_ERROR("No dataset found in loadInt. ");
    }
}
Example #24
0
string
Process::inspect() const {
	assert(getLifeStatus() != DEAD);
	stringstream result;
	result << "(pid=" << pid;
	GroupPtr group = getGroup();
	if (group != NULL) {
		// This Process hasn't been attached to a Group yet.
		result << ", group=" << group->name;
	}
	result << ")";
	return result.str();
}
Example #25
0
EngineDeck::EngineDeck(const ChannelHandleAndGroup& handle_group,
                       UserSettingsPointer pConfig,
                       EngineMaster* pMixingEngine,
                       EffectsManager* pEffectsManager,
                       EngineChannel::ChannelOrientation defaultOrientation)
        : EngineChannel(handle_group, defaultOrientation),
          m_pConfig(pConfig),
          m_pEngineEffectsManager(pEffectsManager ? pEffectsManager->getEngineEffectsManager() : NULL),
          m_pInputConfigured(new ControlObject(ConfigKey(getGroup(), "input_configured"))),
          m_pPassing(new ControlPushButton(ConfigKey(getGroup(), "passthrough"))),
          // Need a +1 here because the CircularBuffer only allows its size-1
          // items to be held at once (it keeps a blank spot open persistently)
          m_sampleBuffer(NULL),
          m_wasActive(false) {
    if (pEffectsManager != NULL) {
        pEffectsManager->registerChannel(handle_group);
    }

    // Make input_configured read-only.
    m_pInputConfigured->setReadOnly();

    // Set up passthrough utilities and fields
    m_pPassing->setButtonMode(ControlPushButton::POWERWINDOW);
    m_bPassthroughIsActive = false;
    m_bPassthroughWasActive = false;

    // Set up passthrough toggle button
    connect(m_pPassing, SIGNAL(valueChanged(double)),
            this, SLOT(slotPassingToggle(double)),
            Qt::DirectConnection);

    m_pSampleRate = new ControlProxy("[Master]", "samplerate");

    // Set up additional engines
    m_pPregain = new EnginePregain(getGroup());
    m_pVUMeter = new EngineVuMeter(getGroup());
    m_pBuffer = new EngineBuffer(getGroup(), pConfig, this, pMixingEngine);
}
size_t HDF5IO::loadUlong(const std::string& GroupName, const std::string& Name)
{
  try{
    H5::Group FG = getGroup( GroupName );
    H5::DataSet DataSet = FG.openDataSet( Name.c_str() );
    size_t x;
    DataSet.read(&x, H5::PredType::NATIVE_ULONG);
    return x;
    FG.close();
  }catch( H5::GroupIException not_found_error ){
    INFO("In Group - " << GroupName << ", and Name is " << Name);
    RUNTIME_ERROR("No dataset found in loadUlong. ");
  }
}
void HDF5IO::saveNumber(const std::string& GroupName, const std::string& Name,
    unsigned long x)
{
    H5::Group FG = getGroup( GroupName );
    try{
      H5::Exception::dontPrint();
      H5::DataSet dataset = FG.openDataSet( Name.c_str() );
      dataset.write(&x, H5::PredType::NATIVE_ULONG);
    } catch ( const H5::GroupIException not_found_error ){
      H5::DataSet dataset = FG.createDataSet( Name.c_str(), H5::PredType::NATIVE_ULONG, H5::DataSpace());
      dataset.write(&x, H5::PredType::NATIVE_ULONG);
    }
    FG.close();
}
Example #28
0
GroupWidget* ContentDialogManager::addGroupToDialog(ContentDialog* dialog,
    std::shared_ptr<GroupChatroom> chatroom, GenericChatForm* form)
{
    auto groupWidget = dialog->addGroup(chatroom, form);
    const auto& groupId = groupWidget->getGroup()->getPersistentId();

    ContentDialog* lastDialog = getGroupDialog(groupId);
    if (lastDialog) {
        lastDialog->removeGroup(groupId);
    }

    contactDialogs[groupId] = dialog;
    return groupWidget;
}
bool CConfigurationFile::elevateChildren()
{
  bool success = true;

  mpRecentFiles =
    elevate<CRecentFiles, CCopasiParameterGroup>(getGroup("Recent Files"));

  if (!mpRecentFiles) success = false;

  mpRecentSBMLFiles =
    elevate<CRecentFiles, CCopasiParameterGroup>(getGroup("Recent SBML Files"));

  if (!mpRecentSBMLFiles) success = false;

  mpRecentMIRIAMResources =
    elevate<CMIRIAMResources, CCopasiParameterGroup>(getGroup("MIRIAM Resources"));
  CMIRIAMResourceObject::setMIRIAMResources(mpRecentMIRIAMResources);

  if (!mpRecentMIRIAMResources) success = false;


  return success;
}
Example #30
0
ERR_Code
aCatalogue::New( bool child )
{
	qulonglong group = getGroup(), parent = getUid();
	ERR_Code err = aObject::New();
	if ( err ) return err;
	aSQLTable * t = table();
	t->setSysValue( "idg", group );
	if ( child ) t->setSysValue( "ido", parent );
	t->primeUpdate();
	t->update();
	if ( group ) groupSelect();
	setSelected(true);
	return err_noerror;
}