Example #1
0
void SetupFile::ParseEngineLine(string& ParseString, Channels &ChannelInfo)
{
	int iValueIndex = 0;		// Index of the number of values found
	int iSearchPos	= 0;		// The next position found fora delimeter;
	int iLastPos	= 0;		// The next position found fora delimeter;
	bool EndFound = false;

	ChannelSetup ParseSetup;
	ChannelSetup* pParseSetup = (ChannelSetup*) &ParseSetup; // new ChannelSetup();

	string FindStr;

	string TypeStr;
	FindStr.resize(60);

	do
	{	
		FindStr.erase();

		iSearchPos = ParseString.find(",",iLastPos);
		if(iSearchPos == ParseString.npos)
		{
			FindStr.append(ParseString,iLastPos,ParseString.length()-iLastPos);
			EndFound = true;
		}
		else
		{
			FindStr.append(ParseString,iLastPos,iSearchPos-iLastPos);
		};

		ParseEngineString(FindStr, iValueIndex, pParseSetup);

		iValueIndex++;
		iSearchPos++;				// Increment search position to avoid repeat finding the same character
		iLastPos = iSearchPos;
	} while( !EndFound );

// Only create new data channel if we have the right number of data points
	if(iValueIndex == DATAPOS_ENGINE_LAST_INDEX)
	{
		ChannelSetup* pNewSetup = new ChannelSetup(pParseSetup);
		ChannelInfo.push_back(pNewSetup);
		LoggingFile.mLogFile << "New engine added: ";
	}
	else
	{
		LoggingFile.mLogFile << "New engine failed: ";
	};
};
Example #2
0
Channels Window::_getEventChannels( const PointerEvent& event )
{
    if( !_grabbedChannels.empty( ))
        return _grabbedChannels;

    Channels result;
    const Channels& channels = getChannels();
    for( ChannelsCIter i = channels.begin(); i != channels.end(); ++i )
    {
        Channel* channel = *i;
        if( !channel->isDestination( ))
            continue;

        const PixelViewport& pvp = getPixelViewport();
        const PixelViewport& channelPVP = channel->getNativePixelViewport();

        // convert y to GL notation (Channel PVP uses GL coordinates)
        const int32_t y = pvp.h - event.y;

        if( channelPVP.isInside( event.x, y ))
            result.push_back( channel );
    }
    return result;
}