Search in sources :

Example 1 with SunburstModel

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)));
    }
}
Also used : VisualItemAxis(org.sirix.gui.view.VisualItemAxis) SunburstCompareModel(org.sirix.gui.view.sunburst.model.SunburstCompareModel) ViewNotifier(org.sirix.gui.view.ViewNotifier) SunburstModel(org.sirix.gui.view.sunburst.model.SunburstModel)

Example 2 with SunburstModel

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");
    }
}
Also used : SunburstCompareModel(org.sirix.gui.view.sunburst.model.SunburstCompareModel) PApplet(processing.core.PApplet) SmallmultipleModel(org.sirix.gui.view.smallmultiple.SmallmultipleModel) SunburstModel(org.sirix.gui.view.sunburst.model.SunburstModel)

Example 3 with SunburstModel

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);
}
Also used : SunburstModel(org.sirix.gui.view.sunburst.model.SunburstModel)

Aggregations

SunburstModel (org.sirix.gui.view.sunburst.model.SunburstModel)3 SunburstCompareModel (org.sirix.gui.view.sunburst.model.SunburstCompareModel)2 ViewNotifier (org.sirix.gui.view.ViewNotifier)1 VisualItemAxis (org.sirix.gui.view.VisualItemAxis)1 SmallmultipleModel (org.sirix.gui.view.smallmultiple.SmallmultipleModel)1 PApplet (processing.core.PApplet)1