use of com.xenoage.utils.annotations.Untested in project Zong by Xenoage.
the class Layout method getScoreFrame.
/**
* Computes the adjustment handle at the given position and returns it. If
* there is none, null is returned.
* @param layoutPosition the position where to look for a handle
* @param scaling the current scaling factor
*/
/* TODO
public FrameHandle computeFrameHandleAt(LayoutPosition layoutPosition, float scaling)
{
if (layoutPosition == null)
return null;
// find handle on the given page
FrameHandle handle = null;
Page givenPage = pages.get(layoutPosition.getPageIndex());
handle = givenPage.computeFrameHandleAt(layoutPosition.getPosition(), scaling);
return handle;
} */
/**
* Gets the axis-aligned bounding rectangle of the given system, specified
* by its {@link ScoreLayout}, the index of the frame and the index of the
* system (relative to the frame) in page coordinates together with the
* index of the page. If not found, null is returned.
*/
/* TODO
public Tuple2<Integer, Rectangle2f> getSystemBoundingRect(ScoreLayout scoreLayout,
int frameIndex, int systemIndex) {
//find the frame
ScoreFrameChain chain = scoreLayouts.getKeyByValue(scoreLayout);
ScoreFrame scoreFrame = chain.frames.get(frameIndex);
//get system boundaries in mm
ScoreFrameLayout scoreFrameLayout = scoreLayout.frames.get(frameIndex);
Rectangle2f rectMm = scoreFrameLayout.getSystemBoundaries(systemIndex);
if (rectMm == null)
return null;
//compute corner points (because frame may be rotated) and transform them
float x = rectMm.position.x - scoreFrame.getSize().width / 2;
float y = rectMm.position.y - scoreFrame.getSize().height / 2;
float w = rectMm.size.width;
float h = rectMm.size.height;
Point2f nw = scoreFrame.computePagePosition(new Point2f(x, y), this);
Point2f ne = scoreFrame.computePagePosition(new Point2f(x + w, y), this);
Point2f se = scoreFrame.computePagePosition(new Point2f(x + w, y + h), this);
Point2f sw = scoreFrame.computePagePosition(new Point2f(x, y + h), this);
// compute axis-aligned bounding box and return it
Rectangle2f ret = new Rectangle2f(nw.x, nw.y, 0, 0);
ret = ret.extend(ne);
ret = ret.extend(se);
ret = ret.extend(sw);
int pageIndex = pages.indexOf(getPage(scoreFrame));
return new Tuple2<Integer, Rectangle2f>(pageIndex, ret);
} */
/**
* Gets the {@link ScoreFrame} which contains the given measure within
* the given score. If it can not be found, null is returned.
*/
@Untested
public ScoreFrame getScoreFrame(Score score, int measure) {
ScoreFrameChain chain = getScoreFrameChain(score);
if (chain == null || chain.getScoreLayout() == null)
return null;
int frameIndex = chain.getScoreLayout().getFrameIndexOf(measure);
if (frameIndex >= 0 && frameIndex < chain.getFrames().size())
return chain.getFrames().get(frameIndex);
return null;
}
use of com.xenoage.utils.annotations.Untested in project Zong by Xenoage.
the class Frame method getPagePosition.
/**
* Transforms the given coordinates in frame space to
* a position in page space.
*
* Untested for higher levels
*/
@Untested
public final Point2f getPagePosition(Point2f p) {
Point2f ret = p;
Frame frame = this;
if (parent != null) {
if (frame.rotation != 0f)
ret = MathUtils.INSTANCE.rotate(ret, frame.rotation);
ret = ret.add(frame.position);
}
return parent.getPagePosition(p);
}
Aggregations