Search in sources :

Example 51 with Range

use of org.vcell.util.Range in project vcell by virtualcell.

the class Plot2DPanel method getTransform.

/**
 * Returns an AffineTrasform that maps a cartesian rectangular area bounded by
 * the stored X axis and Y axis values to the current plotting area of this panel.
 * Creation date: (2/8/2001 11:02:15 PM)
 * @return java.awt.geom.AffineTransform
 */
private AffineTransform getTransform() {
    Range xR = getXAuto() ? getXAutoRange() : getXManualRange();
    Range yR = getYAuto() ? getYAutoRange() : getYManualRange();
    xR = xR == null ? new Range(-1, 1) : xR;
    yR = yR == null ? new Range(-1, 1) : yR;
    // these go in reverse order !
    AffineTransform transform = AffineTransform.getTranslateInstance(getTick() + getLMargin(), getTick() + getTMargin());
    transform.concatenate(AffineTransform.getScaleInstance((getWidth() - 2 * getTick() - getLMargin() - getRMargin()) / (xR.getMax() - xR.getMin()), (getHeight() - 2 * getTick() - getTMargin() - getBMargin()) / (yR.getMin() - yR.getMax())));
    transform.concatenate(AffineTransform.getTranslateInstance(-xR.getMin(), -yR.getMax()));
    return transform;
}
Also used : AffineTransform(java.awt.geom.AffineTransform) Range(org.vcell.util.Range)

Example 52 with Range

use of org.vcell.util.Range in project vcell by virtualcell.

the class Plot2DPanel method setYManualRange.

/**
 * Sets the yManualRange property (cbit.image.Range) value.
 * @param yManualRange The new value for the property.
 * @see #getYManualRange
 */
public void setYManualRange(Range yManualRange) {
    if (yManualRange != null && (yManualRange.getMin() == yManualRange.getMax())) {
        yManualRange = new Range(yManualRange.getMin() - 1, yManualRange.getMin() + 1);
    }
    if (getBCompact()) {
        setLMargin(20);
        if (yManualRange != null) {
            final int COMP_YVAL_MAX_LEN = 5;
            yCompactMinS = yManualRange.getMin() + "";
            if (yCompactMinS.length() > COMP_YVAL_MAX_LEN) {
                DecimalFormat df = new DecimalFormat();
                df.applyPattern("#.##E0");
                yCompactMinS = df.format(yManualRange.getMin());
            }
            yCompactMaxS = yManualRange.getMax() + "";
            if (yCompactMaxS.length() > COMP_YVAL_MAX_LEN) {
                DecimalFormat df = new DecimalFormat();
                df.applyPattern("#.##E0");
                yCompactMaxS = df.format(yManualRange.getMax());
            }
        } else {
            yCompactMaxS = "?";
            yCompactMinS = "?";
        }
    }
    Range oldValue = fieldYManualRange;
    fieldYManualRange = yManualRange;
    firePropertyChange("yManualRange", oldValue, yManualRange);
}
Also used : DecimalFormat(java.text.DecimalFormat) Range(org.vcell.util.Range) Point(java.awt.Point) Paint(java.awt.Paint)

Example 53 with Range

use of org.vcell.util.Range in project vcell by virtualcell.

the class Plot2DPanel method setYAutoRange.

/**
 * Sets the yAutoRange property (cbit.image.Range) value.
 * @param yAutoRange The new value for the property.
 * @see #getYAutoRange
 */
public void setYAutoRange(Range yAutoRange) {
    Range oldValue = fieldYAutoRange;
    fieldYAutoRange = yAutoRange;
    firePropertyChange("yAutoRange", oldValue, yAutoRange);
}
Also used : Range(org.vcell.util.Range)

Example 54 with Range

use of org.vcell.util.Range in project vcell by virtualcell.

the class Plot2DSettingsPanel method newRangeFromInput.

/**
 * Comment
 */
private Range newRangeFromInput(Range currentRange, String typedValue, boolean isMin) {
    double newValue = 0;
    Range newRange = null;
    try {
        newValue = Double.parseDouble(typedValue);
    } catch (NumberFormatException exc) {
        // user typed crap, put back old values
        return (Range) currentRange.clone();
    }
    if (isMin) {
        newRange = new Range(newValue, currentRange.getMax());
    } else {
        newRange = new Range(currentRange.getMin(), newValue);
    }
    if (newRange.getMin() != newRange.getMax()) {
        return newRange;
    } else {
        // can't scale properly on a zero-length interval...
        return (Range) currentRange.clone();
    }
}
Also used : Range(org.vcell.util.Range)

Aggregations

Range (org.vcell.util.Range)54 Point (java.awt.Point)12 SourceDataInfo (cbit.image.SourceDataInfo)5 Paint (java.awt.Paint)4 DecimalFormat (java.text.DecimalFormat)4 DisplayAdapterService (cbit.image.DisplayAdapterService)3 SinglePoint (cbit.vcell.geometry.SinglePoint)3 SpatialAnalysisResults (cbit.vcell.microscopy.SpatialAnalysisResults)3 DisplayPreferences (cbit.image.DisplayPreferences)2 Plot2D (cbit.plot.Plot2D)2 PlotData (cbit.plot.PlotData)2 ExportEvent (cbit.rmi.event.ExportEvent)2 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 VariableType (cbit.vcell.math.VariableType)2 VolVariable (cbit.vcell.math.VolVariable)2 MergedDataInfo (cbit.vcell.simdata.MergedDataInfo)2 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)2 CartesianMesh (cbit.vcell.solvers.CartesianMesh)2 ExternalDataIdentifier (org.vcell.util.document.ExternalDataIdentifier)2 VCDataIdentifier (org.vcell.util.document.VCDataIdentifier)2