use of org.sirix.gui.view.sunburst.model.SunburstModel 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.SunburstModel 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.SunburstModel in project sirix by sirixdb.
the class SunburstControl method refreshUpdate.
/**
* Refresh storage after an update.
*
* @param pDB
* {@link ReadDB} instance
*/
public void refreshUpdate(final ReadDB pDB) {
mDb = checkNotNull(pDB);
mSunburstGUI.mDone = false;
mSunburstGUI.mUseDiffView = ViewType.NODIFF;
mModel = new SunburstModel(mSunburstGUI.mParent, mSunburstGUI.mDb);
final SunburstContainer container = new SunburstContainer(mSunburstGUI, mModel).setNewStartKey(mDb.getNodeKey());
if (mSunburstGUI.mUsePruning) {
container.setPruning(Pruning.DEPTH);
} else {
container.setPruning(Pruning.NO);
}
container.setOldRevision(mDb.getRevisionNumber());
if (mSunburstGUI.mSelectedRev > 0) {
container.setRevision(mSunburstGUI.mSelectedRev);
}
if (mHitTestIndex > 0) {
final SunburstItem item = mModel.getItem(mHitTestIndex);
container.setDepth(item.getDepth()).setModWeight(mSunburstGUI.getModificationWeight()).setNewStartKey(item.getKey());
} else {
container.setModWeight(mSunburstGUI.getModificationWeight());
}
mModel.updateDb(mDb, container);
mSunburstGUI.updateDb(mDb);
}
Aggregations