Search in sources :

Example 41 with Range

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

the class HistogramPanel method calcSelectedPixelRanges.

private void calcSelectedPixelRanges(MouseEvent e) {
    if (mouseStartPoint != null) {
        Range dragRange = getDragRange(e.getPoint());
        if (calcRangeBinCount(dragRange) == 0) {
            // selected bin range on histogram with no pixels
            pixelListSelectionModel.clearSelection();
            return;
        }
        if ((e.getModifiersEx() & (InputEvent.SHIFT_DOWN_MASK)) != 0) {
            if (!pixelListSelectionModel.isSelectionEmpty() && pixelListSelectionModel.getAnchorSelectionIndex() == pixelListSelectionModel.getLeadSelectionIndex()) {
                pixelListSelectionModel.addSelectionInterval(pixelListSelectionModel.getAnchorSelectionIndex(), (int) dragRange.getMin());
            }
        }
        boolean isShiftDown = (e.getModifiersEx() & (InputEvent.SHIFT_DOWN_MASK)) != 0;
        boolean isCntrlDown = (e.getModifiersEx() & (InputEvent.CTRL_DOWN_MASK)) != 0;
        if (isCntrlDown || isShiftDown) {
            if (!isShiftDown && dragStartUnselect) {
                pixelListSelectionModel.removeSelectionInterval((int) dragRange.getMin(), (int) dragRange.getMax());
            } else {
                pixelListSelectionModel.addSelectionInterval((int) dragRange.getMin(), (int) dragRange.getMax());
            }
        } else {
            pixelListSelectionModel.setSelectionInterval((int) dragRange.getMin(), (int) dragRange.getMax());
        }
    }
}
Also used : Range(org.vcell.util.Range)

Example 42 with Range

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

the class HistogramPanel method getHorzScaleSlider.

private JSlider getHorzScaleSlider() {
    if (horzScaleSlider != null) {
        return horzScaleSlider;
    }
    horzScaleSlider = new JSlider();
    horzScaleSlider.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            if (originalTreeMap == null) {
                return;
            }
            int min = getHorzOffsetSlider().getValue();
            int interval = originalTreeMap.lastKey() / horzScaleSlider.getValue();
            int max = min + interval;
            if (max > originalTreeMap.lastKey()) {
                min -= (max) - originalTreeMap.lastKey();
            }
            min = Math.max(originalTreeMap.firstKey(), min);
            max = Math.min(max, originalTreeMap.lastKey());
            viewPixelRange = new Range(min, max);
            horzOffsetSlider.setValue(min);
            horzOffsetSlider.setMaximum(originalTreeMap.lastKey() - interval);
            updateLowHigh();
            getHorzOffsetSlider().setEnabled(getHorzScaleSlider().getValue() > 1);
            // moveScrollBar.getModel().setRangeProperties(moveScrollBar.getValue(), interval, min, originalTreeMap.lastKey(),false);
            // System.out.println("val="+horzScaleSlider.getValue()+" min="+min+" interv="+interval+" max="+(originalTreeMap.lastKey()-interval));
            // System.out.println(" "+moveScrollBar.getModel());
            repaint();
        }
    });
    horzScaleSlider.setMinimum(1);
    horzScaleSlider.setValue(1);
    return horzScaleSlider;
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) JSlider(javax.swing.JSlider) ChangeListener(javax.swing.event.ChangeListener) Range(org.vcell.util.Range)

Example 43 with Range

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

the class DisplayAdapterServicePanel method calculateCustomScaleRange.

/**
 * Comment
 */
private void calculateCustomScaleRange() {
    try {
        double min = Double.parseDouble(getMinTextField().getText());
        double max = Double.parseDouble(getMaxTextField().getText());
        getDisplayAdapterService().setCustomScaleRange(new Range(min, max));
        firePropertyChange(HLE_PROPERTY_ID, true, false);
    } catch (NumberFormatException e) {
        ensureMinMaxDisplay();
    // if(getactiveScaleRange1() != null){
    // getMinTextField().setText(getactiveScaleRange1().getMin()+"");
    // getMaxTextField().setText(getactiveScaleRange1().getMax()+"");
    // }
    }
}
Also used : Range(org.vcell.util.Range)

Example 44 with Range

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

the class DoubleDisplayAdapter method setDataValues.

/**
 * Sets the dataValues property (double[]) value.
 * @param dataValues The new value for the property.
 * @see #getDataValues
 */
public final void setDataValues(double[] dataValues) {
    double dataMin = 0;
    double dataMax = 0;
    if (dataValues != null) {
        dataMin = dataValues[0];
        dataMax = dataMin;
        for (int i = 0; i < dataValues.length; i++) {
            dataMin = Math.min(dataMin, dataValues[i]);
            dataMax = Math.max(dataMax, dataValues[i]);
        }
    }
    setDataRange(new Range(dataMin, dataMax));
    double[] oldValue = fieldDataValues;
    fieldDataValues = dataValues;
    firePropertyChange("dataValues", oldValue, dataValues);
}
Also used : Range(org.vcell.util.Range)

Example 45 with Range

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

the class ImageContainerPanel method checkScaleSettingsHistory.

/**
 * Comment
 */
public void checkScaleSettingsHistory() throws DataAccessException {
    String newDataSet = getImageContainer().getDataID();
    if (scaleSettingsHistory.capacity() != 0)
        scaleSettingsHistory.setElementAt(getScalePanel1().getScaleRange(), index);
    if (dataSetHistory.contains(newDataSet)) {
        getScalePanel1().setScaleRange((Range) scaleSettingsHistory.elementAt(dataSetHistory.indexOf(newDataSet)));
    } else {
        dataSetHistory.addElement(newDataSet);
        Range defaultManualRange = new Range(0.0, Math.pow(10, (int) ((Math.log(getScalePanel1().getDataRange().getMax())) / Math.log(10)) + 1));
        getScalePanel1().setScaleRange(defaultManualRange);
        scaleSettingsHistory.addElement(defaultManualRange);
    }
    index = dataSetHistory.indexOf(newDataSet);
    return;
}
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