protected ItemPositionMap makeCircularLayout( IBoundedItem currentItem, List<IBoundedItem> neighbours) { Coord2d center = currentItem.getAbsolutePosition(); CircleLayoutTable layout = new CircleLayoutTable(neighbours, center, false, 200); layout.goAlgo(); return layout.getPositions(); }
protected ItemPositionMap makeRectangleLayout( IBoundedItem currentItem, List<IBoundedItem> neighbours) { Coord2d center = currentItem.getAbsolutePosition(); RectangleLayoutTable layout = new RectangleLayoutTable(neighbours, center, 4000, 4000); layout.goAlgo(); return layout.getPositions(); }
@Override public void bring(IBoundedItem item) { setup(item); // center view to item IView view = display.getView(); ViewPointAnimation va = new ViewPointAnimation( view, Pt.cloneAsCoord2d(view.getCenter()), item.getAbsolutePosition(), 300); // Rectangle2D layoutBounds = // model.getRectangleBounds().cloneAsRectangle2D(); // System.out.println(view.getLayoutScale(layoutBounds)); // animate transition PositionMapTransition t = new PositionMapTransition(); IAnimation anim = t.transition(originalPositionMap, circularPositionMap, DURATION / 2); animator.push(anim); animator.push(va); }
@Override public void go(IBoundedItem item, IAnimationMonitor monitor) { // animate inverse transition PositionMapTransition t = new PositionMapTransition(); IAnimation anim = t.transition(circularPositionMap, originalPositionMap, DURATION); // switch to default context when animation finishes anim.addAnimationMonitor(monitor); Coord2d from = circularPositionMap.get(item); Coord2d to = originalPositionMap.get(item); // find target, and set it as mouseover for easy animation understanding setState(item.getLabel(), ItemState.MOUSE_OVER); ViewPointAnimation va = new ViewPointAnimation(display.getView(), from, to, DURATION); ViewScaleAnimation vs = new ViewScaleAnimation(display.getView(), DURATION); animator.push(anim); animator.push(va); animator.push(vs); }