use of org.sirix.gui.view.sunburst.model.SunburstCompareModel in project sirix by sirixdb.
the class SunburstControl method notifyChanges.
/**
* Notify other views of changes.
*
* @param pItems
* the new item list
*/
private void notifyChanges(final List<SunburstItem> pItems) {
assert pItems != null;
final SunburstView view = (SunburstView) ((Embedded) mSunburstGUI.mParent).getView();
final ViewNotifier notifier = view.getNotifier();
if (mModel instanceof SunburstModel) {
notifier.update(view, Optional.<VisualItemAxis>absent());
} else if (mModel instanceof SunburstCompareModel) {
notifier.update(view, Optional.of(new VisualItemAxis(pItems)));
}
}
use of org.sirix.gui.view.sunburst.model.SunburstCompareModel in project sirix by sirixdb.
the class ViewUtilities method legend.
/**
* Legend of a SunburstView.
*
* @param pGUI
* GUI which provides a SunburstView and therefore extends
* {@link AbstractSunburstGUI}
* @param applet
* Processing {@link applet} reference
*/
public static void legend(final AbstractSunburstGUI pGUI, final Model<SunburstContainer, SunburstItem> pModel) {
final PApplet applet = pGUI.getApplet();
// applet.translate(0, 0);
applet.textAlign(PConstants.LEFT, PConstants.TOP);
applet.strokeWeight(0);
if (pGUI.isShowArcs()) {
applet.fill(pGUI.getHueStart(), pGUI.getSaturationStart(), pGUI.getBrightnessStart());
applet.rect(20f, applet.height - 70f, 50, 17);
color(pGUI);
applet.text("-", 78, applet.height - 70f);
applet.fill(pGUI.getHueEnd(), pGUI.getSaturationEnd(), pGUI.getBrightnessEnd());
applet.rect(90f, applet.height - 70f, 50, 17);
color(pGUI);
if (pModel instanceof SunburstModel) {
applet.text("text node length", 150f, applet.height - 70f);
}
if (pModel instanceof SunburstCompareModel || pModel instanceof SmallmultipleModel) {
applet.text("text node similarity", 150f, applet.height - 70f);
}
applet.fill(0, 0, pGUI.getInnerNodeBrightnessStart());
applet.rect(20f, applet.height - 50f, 50, 17);
color(pGUI);
applet.text("-", 78, applet.height - 50f);
applet.fill(0, 0, pGUI.getInnerNodeBrightnessEnd());
applet.rect(90f, applet.height - 50f, 50, 17);
color(pGUI);
if (pModel instanceof SunburstModel) {
applet.text("descendant-or-self count of element nodes", 150f, applet.height - 50f);
}
if (pModel instanceof SunburstCompareModel || pModel instanceof SmallmultipleModel) {
applet.text("element node similarity", 150f, applet.height - 50f);
}
}
if (pGUI.isSavePDF()) {
applet.translate(applet.width / 2f, applet.height / 2f);
pGUI.setSavePDF(false);
applet.endRecord();
PApplet.println("saving to pdf – done");
}
}
use of org.sirix.gui.view.sunburst.model.SunburstCompareModel in project sirix by sirixdb.
the class SunburstControl method controlEvent.
@Override
public void controlEvent(final ControlEvent pControlEvent) {
super.controlEvent(pControlEvent);
if (pControlEvent.isGroup()) {
if (pControlEvent.getGroup().getName().equals("Compare revision")) {
mSunburstGUI.mParent.noLoop();
mSunburstGUI.mSelectedRev = (int) pControlEvent.getGroup().getValue();
final int selectedRev = mSunburstGUI.mSelectedRev;
mModel = new SunburstCompareModel(mSunburstGUI.mParent, mSunburstGUI.mDb);
mModel.addPropertyChangeListener(mSunburstGUI);
final SunburstContainer container = new SunburstContainer(mSunburstGUI, mModel);
if (mSunburstGUI.mUsePruning) {
container.setPruning(Pruning.DIFF);
} else {
container.setPruning(Pruning.NO);
}
container.setMoveDetection(mSunburstGUI.mUseMoveDetection);
mModel.traverseTree(container.setRevision(selectedRev).setModWeight(mSunburstGUI.getModificationWeight()));
mSunburstGUI.mUseDiffView = ViewType.DIFF;
mSunburstGUI.mUseDiffView.setValue(true);
final SunburstView view = (SunburstView) ((Embedded) mSunburstGUI.mParent).getView();
final ViewNotifier notifier = view.getNotifier();
mDb.setCompareRevisionNumber(selectedRev);
notifier.init(view);
}
} else if (pControlEvent.isController()) {
if (pControlEvent.getController() instanceof Toggle) {
final Toggle toggle = (Toggle) pControlEvent.getController();
final boolean state = toggle.getState();
switch(toggle.getId()) {
case 3:
mSunburstGUI.setUseArc(state);
break;
case 4:
mSunburstGUI.setFisheye(state);
break;
case 5:
if (state) {
mRefresh = true;
}
mSunburstGUI.setUsePruning(state);
break;
case 6:
mSunburstGUI.setUseAttribute(state);
break;
case 7:
mSunburstGUI.setUseMoveDetection(state);
break;
}
}
}
}
Aggregations