Exemplo n.º 1
0
/** \brief Recalculates the bounding box of the page.
*/
void GRPage::updateBoundingBox()
{
	// - Start from a null rectangle
	mBoundingBox.Set( 0, 0, 0, 0 );
	GRNotationElement * el;

	// - Add systems boxes
	SystemPointerList::iterator ptr;
	TYPE_DURATION duration;
	for( ptr = mSystems.begin(); ptr != mSystems.end(); ++ ptr ) {
		el = *ptr;
		NVRect eltBox ( el->getBoundingBox());
		eltBox += el->getPosition();
		mBoundingBox.Merge( eltBox );
		duration += el->getDuration();
		//addToBoundingBox( el );
	}
	setDuration (duration);

	// - Add page and system-tags boxes
	GuidoPos mypos = First();
	if (mypos) {
		GRNotationElement * el = GetNext( mypos );
		NVRect eltBox ( el->getBoundingBox());
		eltBox += el->getPosition();
		mBoundingBox.Merge( eltBox );
		// todo: addToBoundingBox( el );
	}
	mMapping = mBoundingBox;

	// - Add the page margins
/*
	mBoundingBox.left -= getMarginLeft();
	mBoundingBox.top -= getMarginTop();
	mBoundingBox.right += getMarginRight();
	mBoundingBox.bottom += getMarginBottom();
*/
	// This adds some space to the right and at the bottom.
	// The NoteServer can display a nicer picture using this ....
	// maybe this needs to be changed later!?
	//mBoundingBox.right += 5* LSPACE;
	//mBoundingBox.bottom += 5* LSPACE;

}
Exemplo n.º 2
0
// ATTENTION, aend timePosition!
void NEPointerList::setSpacing(const TYPE_TIMEPOSITION & timePosition, 
							   NVPoint& position)
{
	// this is obolete!
	assert(false);
#ifdef BALBAL
	if (empty()) return;
	assert(!empty());
	GRNotationElement * criticalElement = 0;
	NEPointerList * list= this; // getElementsWithTimePosition(timePosition);
	
	// think about it.
	TYPE_TIMEPOSITION nextTimePosition (getNextTimePosition(timePosition));
	TYPE_SPACING spacing = 0;
	if(!list->empty())
	{
		NEPointerList* shortyList=list->getElementsWithShortestDuration();
		criticalElement=shortyList->getElementWithMaxSpacing();
		float criticalElementSize=criticalElement->getBoundingBox().right;
		assert(criticalElementSize>=0); // get size of real element
		if(criticalElement->getRelativeEndTimePosition()>nextTimePosition) // is there an Overlap?
		{
			criticalElement = new GRSingleNote(nextTimePosition-timePosition);
			// Dummy element for spacing calculation
			// I Believe abstractRepresentation will not be created?
			delete criticalElement;
		}
		else
		{
		}

		GuidoPos pos = GetHeadPosition();
		GRNotationElement * e;
		float min = 0;
		while (pos)
		{
			e = GetNext(pos);
			if (e->getRelativeTimePosition()==timePosition
			  && e->getBoundingBox().left<min)
				 min = e->getBoundingBox().left;
		}
		pos = GetHeadPosition();
		while(pos)
		{
			e = GetNext(pos);
			if (tmp)
			{
				tmp->setHPosition(position.x-min);
			}
			else
			{
			}
		}
		position.x += spacing+criticalElementSize;
		position.x -= min;

		delete shortyList;
	}
	else
	{
		criticalElement = new GRSingleNote(nextTimePosition-timePosition); // special Dummy-Object??
		delete criticalElement;

		GRNotationElement * e;
		GuidoPos pos=GetHeadPosition();
		while(pos)
		{
			e=GetNext(pos);
		}
		position.x += spacing;
	}
#endif
}