Пример #1
0
bool UniPAX::BiochemicalPathwayStep::getAttribute(std::vector<std::pair<std::string,std::string> >& value, PersistenceManager& manager) {

	if (!UniPAX::PathwayStep::getAttribute(value, manager))
		return false;

	std::string tmp = "";
	if (stepConversion == 0)
	{
//		value.push_back(std::pair<std::string,std::string>("#stepConversion", "NIL"));
	}
	else
	{
		tmp.clear();
		if (!manager.getId(stepConversion,tmp))
		{
			return false;
		}
		value.push_back(std::pair<std::string,std::string>("#stepConversion", tmp));

	}

	if (!getStepDirection().empty())
		value.push_back(std::pair<std::string,std::string>("stepDirection", getStepDirection()));

	return true;

}
Пример #2
0
void Gantry::moveLinear(int xSteps, int ySteps) {
    int xStepDirection = getStepDirection(xSteps);
    int yStepDirection = getStepDirection(ySteps);

    xSteps = abs(xSteps);
    ySteps = abs(ySteps);

    // don't need to calculate slope if one direction is zero
    if (xSteps == 0 || ySteps == 0) {
        xStep(xSteps, xStepDirection);
        yStep(ySteps, yStepDirection);
        return;
    }

    // find the slope of the linear path
    float slope = abs((float) ySteps / xSteps);

    // keep track of how many steps
    // have been taken in each direction
    int xMoved, yMoved;
    xMoved = yMoved = 0;

    // accumulate partial y-steps as we
    // move one step at a time in the x-direction
    float yAccum = 0;

    while (xMoved < xSteps && yMoved < ySteps) {
        // add the number of partial steps we should take
        // in the y-direction for one step in the x-direction
        int xSteps = 1;
        yAccum += (xSteps * slope);

        // determine number of complete steps
        // we can take in the y-direction
        int ySteps = floor(yAccum);
        yAccum -= ySteps;

        xStep(xSteps, xStepDirection);
        xMoved += xSteps;

        yStep(ySteps, yStepDirection);
        yMoved += ySteps;
    }
}
Пример #3
0
bool UniPAX::BiochemicalPathwayStep::merge(BiochemicalPathwayStep& object)
{
	if (stepConversion != 0)
	{
		if (object.getStepConversion() != 0)
		{
			if (stepConversion->getUnipaxId() != object.getStepConversion()->getUnipaxId())
			{
				std::cerr << "Error during merging: UniPAX::BiochemicalPathwayStep::stepConversion not equal ..."
						<< stepConversion->getUnipaxId() << " != " << object.getStepConversion()->getUnipaxId() << std::endl;
				return false;
			}
		}
	}
	else
	{
		setStepConversion(object.getStepConversion());
	}


	if (!object.getStepDirection().empty())
	{
		if (!getStepDirection().empty())
		{
			if (getStepDirection() != object.getStepDirection())
			{
				std::cerr << "Error during merging: UniPAX::BiochemicalPathwayStep::stepDirection not equal ..."
						<< getStepDirection() << " != " << object.getStepDirection() << std::endl;
				return false;
			}
		}
		else
			setStepDirection(object.getStepDirection());
	}

	return UniPAX::PathwayStep::merge(object);

}