Package prefuse.data.query

Examples of prefuse.data.query.ObjectRangeModel


    protected void ordinalLayout(TupleSet ts) {
        if ( !m_modelSet) {
            Object[] array = DataLib.ordinalArray(ts, m_field);
           
            if ( m_model == null ) {
                m_model = new ObjectRangeModel(array);
            } else {
                ((ObjectRangeModel)m_model).setValueRange(array);
            }
        }
       
        ObjectRangeModel model = (ObjectRangeModel)m_model;
        int start = model.getValue();
        int end = start + model.getExtent();
        double total = (double)(end-start);
       
        Iterator iter = m_vis.items(m_group, m_filter);
        while ( iter.hasNext() ) {
            VisualItem item = (VisualItem)iter.next();
            int order = model.getIndex(item.get(m_field)) - start;
            set(item, order/total);
        }
    }
View Full Code Here


   
    /**
     * Compute an ordinal layout of axis marks.
     */
    protected void ordinalLayout(VisualTable labels) {
        ObjectRangeModel model = (ObjectRangeModel)m_model;
        double span = m_hi-m_lo;
        double pspan = m_prevhi-m_prevlo;
       
        Rectangle2D b = getLayoutBounds();
        double breadth = getBreadth(b);
        double scale = breadth/span;
        int step = getOrdinalStep(span, scale);
        if ( step <= 0 ) step = 1;
       
        // mark previously visible labels
        Iterator iter = labels.tuples();
        while ( iter.hasNext() ) {
            VisualItem item = (VisualItem)iter.next();
            reset(item);
            double v = item.getDouble(VALUE);
            double x = span==0 ? 0 : ((v-m_lo)/span)*breadth;
            set(item, x, b);
        }

        Index index = labels.index(VALUE);
       
        // handle remaining labels
        for ( int r, v=(int)m_lo; v<=m_hi; v+=step ) {
            if ( (r=index.get((double)v)) >= 0 ) {
                VisualItem item = labels.getItem(r);
                item.set(VisualItem.LABEL, model.getObject(v).toString());
                item.setVisible(true);
                item.setEndVisible(true);
            } else {
                VisualItem item = labels.addItem();
                item.set(VisualItem.LABEL, model.getObject(v).toString());
                item.setDouble(VisualItem.VALUE, v);
                double f = pspan==0 ? 0 : ((v-m_prevlo)/pspan);
                if ( f <= 0 || f >= 1.0 ) item.setStartVisible(true);
                set(item, f*breadth, b);
                set(item, (v-m_lo)*breadth/span, b);
View Full Code Here

   
    /**
     * Compute an ordinal layout of axis marks.
     */
    protected void ordinalLayout(VisualTable labels) {
        ObjectRangeModel model = (ObjectRangeModel)m_model;
        double span = m_hi-m_lo;
        double pspan = m_prevhi-m_prevlo;
       
        Rectangle2D b = getLayoutBounds();
        double breadth = getBreadth(b);
        double scale = breadth/span;
        int step = getOrdinalStep(span, scale);
        if ( step <= 0 ) step = 1;
       
        // mark previously visible labels
        Iterator iter = labels.tuples();
        while ( iter.hasNext() ) {
            VisualItem item = (VisualItem)iter.next();
            reset(item);
            double v = item.getDouble(VALUE);
            double x = span==0 ? 0.5*breadth : ((v-m_lo)/span)*breadth;
            set(item, x, b);
        }

        Index index = labels.index(VALUE);
       
        // handle remaining labels
        for ( int r, v=(int)m_lo; v<=m_hi; v+=step ) {
            if ( (r=index.get((double)v)) >= 0 ) {
                VisualItem item = labels.getItem(r);
                item.set(VisualItem.LABEL, model.getObject(v).toString());
                item.setVisible(true);
                item.setEndVisible(true);
            } else {
                VisualItem item = labels.addItem();
                item.set(VisualItem.LABEL, model.getObject(v).toString());
                item.setDouble(VisualItem.VALUE, v);
                double f = pspan==0 ? 0.5 : ((v-m_prevlo)/pspan);
                if ( f <= 0 || f >= 1.0 ) item.setStartVisible(true);
                set(item, f*breadth, b);
                set(item, (v-m_lo)*breadth/span, b);
View Full Code Here

    protected void ordinalLayout(TupleSet ts) {
        if ( !m_modelSet) {
            Object[] array = DataLib.ordinalArray(ts, m_field);
           
            if ( m_model == null ) {
                m_model = new ObjectRangeModel(array);
            } else {
                ((ObjectRangeModel)m_model).setValueRange(array);
            }
        }
       
        ObjectRangeModel model = (ObjectRangeModel)m_model;
        int start = model.getValue();
        int end = start + model.getExtent();
        double total = (double)(end-start);
       
        Iterator iter = m_vis.items(m_group, m_filter);
        while ( iter.hasNext() ) {
            VisualItem item = (VisualItem)iter.next();
            int order = model.getIndex(item.get(m_field)) - start;
            set(item, (total > 0.0) ? order/total : 0.5);
        }
    }
View Full Code Here

TOP

Related Classes of prefuse.data.query.ObjectRangeModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.