Search in sources :

Example 1 with SampledCurve

use of cbit.vcell.geometry.SampledCurve in project vcell by virtualcell.

the class PDEDataViewer method roiAction.

private void roiAction() {
    BeanUtils.setCursorThroughout(this, Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    try {
        final String[] ROI_COLUMN_NAMES = new String[] { "ROI source", "ROI source name", "ROI Description" };
        final Vector<Object> auxInfoV = new Vector<Object>();
        final DataIdentifier dataIdentifier = getPdeDataContext().getDataIdentifier();
        VariableType variableType = dataIdentifier.getVariableType();
        final boolean isVolume = variableType.equals(VariableType.VOLUME) || variableType.equals(VariableType.VOLUME_REGION);
        DefaultTableModel tableModel = new DefaultTableModel() {

            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        for (int i = 0; i < ROI_COLUMN_NAMES.length; i++) {
            tableModel.addColumn(ROI_COLUMN_NAMES[i]);
        }
        // Add Snapshot ROI
        if ((isVolume ? volumeSnapshotROI : membraneSnapshotROI) != null) {
            tableModel.addRow(new Object[] { (isVolume ? "Volume" : "Membrane") + " Variables and Functions", "Snapshot", (isVolume ? volumeSnapshotROIDescription : membraneSnapshotROIDescription) + ", (values = 1.0)" });
            auxInfoV.add((isVolume ? volumeSnapshotROI : membraneSnapshotROI));
        }
        // Add user ROIs
        SpatialSelection[] userROIArr = getPDEDataContextPanel1().fetchSpatialSelections(true, false);
        for (int i = 0; userROIArr != null && i < userROIArr.length; i += 1) {
            String descr = null;
            boolean bPoint = false;
            if (isVolume) {
                if (userROIArr[i] instanceof SpatialSelectionVolume) {
                    Curve curve = ((SpatialSelectionVolume) userROIArr[i]).getCurveSelectionInfo().getCurve();
                    descr = curve.getDescription();
                    if (curve instanceof SinglePoint) {
                        bPoint = true;
                    }
                }
            } else {
                if (userROIArr[i] instanceof SpatialSelectionMembrane) {
                    SampledCurve selectionSource = ((SpatialSelectionMembrane) userROIArr[i]).getSelectionSource();
                    descr = selectionSource.getDescription();
                    if (selectionSource instanceof SinglePoint) {
                        bPoint = true;
                    }
                }
            }
            // Add Area User ROI
            BitSet fillBitSet = null;
            if (userROIArr[i] instanceof SpatialSelectionVolume) {
                fillBitSet = getFillROI((SpatialSelectionVolume) userROIArr[i]);
                if (fillBitSet != null) {
                    tableModel.addRow(new Object[] { "User Defined", descr, "Area Enclosed Volume ROI" });
                    auxInfoV.add(fillBitSet);
                }
            }
            // Add Point and Line User ROI
            if (fillBitSet == null) {
                tableModel.addRow(new Object[] { "User Defined", descr, (bPoint ? "Point" : "Line") + (isVolume ? " Volume" : " Membrane") + " ROI " });
                auxInfoV.add(userROIArr[i]);
            }
        }
        // Add sorted Geometry ROI
        final CartesianMesh cartesianMesh = getPdeDataContext().getCartesianMesh();
        HashMap<Integer, ?> regionMapSubvolumesHashMap = (isVolume ? cartesianMesh.getVolumeRegionMapSubvolume() : cartesianMesh.getMembraneRegionMapSubvolumesInOut());
        Set<?> regionMapSubvolumesEntrySet = regionMapSubvolumesHashMap.entrySet();
        Iterator<?> regionMapSubvolumesEntryIter = regionMapSubvolumesEntrySet.iterator();
        TreeSet<Object[]> sortedGeomROITreeSet = new TreeSet<Object[]>(new Comparator<Object[]>() {

            public int compare(Object[] o1, Object[] o2) {
                int result = ((String) ((Object[]) o1[0])[1]).compareToIgnoreCase((String) ((Object[]) o2[0])[1]);
                if (result == 0) {
                    result = (((Entry<Integer, ?>) o1[1]).getKey()).compareTo(((Entry<Integer, ?>) o2[1]).getKey());
                }
                return result;
            }
        });
        while (regionMapSubvolumesEntryIter.hasNext()) {
            Entry<Integer, ?> regionMapSubvolumesEntry = (Entry<Integer, ?>) regionMapSubvolumesEntryIter.next();
            sortedGeomROITreeSet.add(new Object[] { new Object[] { "Geometry", (isVolume ? getSimulationModelInfo().getVolumeNamePhysiology(((Integer) regionMapSubvolumesEntry.getValue())) : getSimulationModelInfo().getMembraneName(((int[]) regionMapSubvolumesEntry.getValue())[0], ((int[]) regionMapSubvolumesEntry.getValue())[1], false)), (isVolume ? "(svID=" + regionMapSubvolumesEntry.getValue() + " " : "(") + "vrID=" + regionMapSubvolumesEntry.getKey() + ") Predefined " + (isVolume ? "volume" : "membrane") + " region" }, regionMapSubvolumesEntry });
        }
        Iterator<Object[]> sortedGeomROIIter = sortedGeomROITreeSet.iterator();
        while (sortedGeomROIIter.hasNext()) {
            Object[] sortedGeomROIObjArr = (Object[]) sortedGeomROIIter.next();
            tableModel.addRow((Object[]) sortedGeomROIObjArr[0]);
            auxInfoV.add(sortedGeomROIObjArr[1]);
        }
        final ScrollTable roiTable = new ScrollTable();
        roiTable.setModel(tableModel);
        roiTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        roiTable.setPreferredScrollableViewportSize(new Dimension(500, 200));
        final JPanel mainJPanel = new JPanel();
        BoxLayout mainBL = new BoxLayout(mainJPanel, BoxLayout.Y_AXIS);
        mainJPanel.setLayout(mainBL);
        MiniTimePanel timeJPanel = new MiniTimePanel();
        ActionListener okAction = new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (((Double) timeJPanel.jcb_time_begin.getSelectedItem()).compareTo((Double) timeJPanel.jcb_time_end.getSelectedItem()) > 0) {
                    PopupGenerator.showErrorDialog(PDEDataViewer.this, "Selected 'Begin Time' must be less than or equal to 'End Time'");
                    return;
                }
                int[] selectedRows = roiTable.getSelectedRows();
                if (selectedRows != null) {
                    try {
                        BitSet dataBitSet = new BitSet(getPdeDataContext().getDataValues().length);
                        for (int i = 0; i < selectedRows.length; i++) {
                            Object auxInfo = auxInfoV.elementAt(selectedRows[i]);
                            if (auxInfo instanceof BitSet) {
                                dataBitSet.or((BitSet) auxInfo);
                            } else if (auxInfo instanceof SpatialSelectionMembrane) {
                                int[] roiIndexes = ((SpatialSelectionMembrane) auxInfo).getIndexSamples().getSampledIndexes();
                                for (int j = 0; j < roiIndexes.length; j += 1) {
                                    dataBitSet.set(roiIndexes[j], true);
                                }
                            } else if (auxInfo instanceof SpatialSelectionVolume) {
                                int[] roiIndexes = ((SpatialSelectionVolume) auxInfo).getIndexSamples(0, 1).getSampledIndexes();
                                for (int j = 0; j < roiIndexes.length; j += 1) {
                                    dataBitSet.set(roiIndexes[j], true);
                                }
                            } else if (auxInfo instanceof Entry) {
                                Entry<Integer, Integer> entry = (Entry<Integer, Integer>) auxInfo;
                                if (isVolume) {
                                    int volumeRegionID = entry.getKey();
                                    dataBitSet.or(cartesianMesh.getVolumeROIFromVolumeRegionID(volumeRegionID));
                                } else {
                                    int membraneRegionID = entry.getKey();
                                    dataBitSet.or(cartesianMesh.getMembraneROIFromMembraneRegionID(membraneRegionID));
                                }
                            } else if (auxInfo instanceof BitSet) {
                                dataBitSet.or((BitSet) auxInfo);
                            } else {
                                throw new Exception("ROI table, Unknown data type: " + auxInfo.getClass().getName());
                            }
                        }
                        TimeSeriesJobSpec timeSeriesJobSpec = new TimeSeriesJobSpec(new String[] { dataIdentifier.getName() }, new BitSet[] { dataBitSet }, ((Double) timeJPanel.jcb_time_begin.getSelectedItem()).doubleValue(), 1, ((Double) timeJPanel.jcb_time_end.getSelectedItem()).doubleValue(), true, false, VCDataJobID.createVCDataJobID(getDataViewerManager().getUser(), true));
                        Hashtable<String, Object> hash = new Hashtable<String, Object>();
                        hash.put(StringKey_timeSeriesJobSpec, timeSeriesJobSpec);
                        AsynchClientTask task1 = new TimeSeriesDataRetrievalTask("Retrieve data for '" + dataIdentifier + "'", PDEDataViewer.this, getPdeDataContext());
                        AsynchClientTask task2 = new AsynchClientTask("Showing stat for '" + dataIdentifier + "'", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

                            @Override
                            public void run(Hashtable<String, Object> hashTable) throws Exception {
                                TSJobResultsSpaceStats tsJobResultsSpaceStats = (TSJobResultsSpaceStats) hashTable.get(StringKey_timeSeriesJobResults);
                                plotSpaceStats(tsJobResultsSpaceStats);
                            }
                        };
                        ClientTaskDispatcher.dispatch(PDEDataViewer.this, hash, new AsynchClientTask[] { task1, task2 }, true, true, null);
                    } catch (Exception e1) {
                        e1.printStackTrace();
                        PopupGenerator.showErrorDialog(PDEDataViewer.this, "ROI Error.\n" + e1.getMessage(), e1);
                    }
                }
                BeanUtils.disposeParentWindow(mainJPanel);
            }
        };
        ActionListener cancelAction = new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                BeanUtils.disposeParentWindow(mainJPanel);
            }
        };
        OkCancelSubPanel okCancelJPanel = new OkCancelSubPanel(okAction, cancelAction);
        roiTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            public void valueChanged(ListSelectionEvent e) {
                if (roiTable.getSelectedRows() != null && roiTable.getSelectedRows().length > 0) {
                    okCancelJPanel.okButton.setEnabled(true);
                } else {
                    okCancelJPanel.okButton.setEnabled(false);
                }
            }
        });
        mainJPanel.add(timeJPanel);
        mainJPanel.add(roiTable.getEnclosingScrollPane());
        mainJPanel.add(okCancelJPanel);
        // showComponentInFrame(mainJPanel,
        // "Calculate "+(isVolume?"volume":"membrane")+" statistics for '"+getPdeDataContext().getVariableName()+"'."+
        // "  Choose times and 1 or more ROI(s).");
        Frame dialogOwner = JOptionPane.getFrameForComponent(this);
        JOptionPane inputDialog = new JOptionPane(mainJPanel, JOptionPane.PLAIN_MESSAGE, 0, null, new Object[0]);
        final JDialog d = inputDialog.createDialog(dialogOwner, "Calculate " + (isVolume ? "volume" : "membrane") + " statistics for '" + getPdeDataContext().getVariableName() + "'." + "  Choose times and 1 or more ROI(s).");
        d.setResizable(true);
        try {
            DialogUtils.showModalJDialogOnTop(d, PDEDataViewer.this);
        } finally {
            d.dispose();
        }
    } finally {
        BeanUtils.setCursorThroughout(this, Cursor.getDefaultCursor());
    }
}
Also used : JPanel(javax.swing.JPanel) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) LocalVCSimulationDataIdentifier(cbit.vcell.client.ClientSimManager.LocalVCSimulationDataIdentifier) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier) VCDataIdentifier(org.vcell.util.document.VCDataIdentifier) DataIdentifier(cbit.vcell.simdata.DataIdentifier) ScrollTable(org.vcell.util.gui.ScrollTable) TimeSeriesJobSpec(org.vcell.util.document.TimeSeriesJobSpec) ActionEvent(java.awt.event.ActionEvent) TreeSet(java.util.TreeSet) Vector(java.util.Vector) SampledCurve(cbit.vcell.geometry.SampledCurve) Curve(cbit.vcell.geometry.Curve) BitSet(java.util.BitSet) TSJobResultsSpaceStats(org.vcell.util.document.TSJobResultsSpaceStats) JOptionPane(javax.swing.JOptionPane) ListSelectionListener(javax.swing.event.ListSelectionListener) CartesianMesh(cbit.vcell.solvers.CartesianMesh) ActionListener(java.awt.event.ActionListener) SpatialSelectionVolume(cbit.vcell.simdata.SpatialSelectionVolume) JDialog(javax.swing.JDialog) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Frame(java.awt.Frame) SpatialSelectionMembrane(cbit.vcell.simdata.SpatialSelectionMembrane) DefaultTableModel(javax.swing.table.DefaultTableModel) BoxLayout(javax.swing.BoxLayout) ListSelectionEvent(javax.swing.event.ListSelectionEvent) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) Entry(java.util.Map.Entry) UserDataEntry(cbit.vcell.export.gloworm.atoms.UserDataEntry) SinglePoint(cbit.vcell.geometry.SinglePoint) SpatialSelection(cbit.vcell.simdata.SpatialSelection) SampledCurve(cbit.vcell.geometry.SampledCurve) VariableType(cbit.vcell.math.VariableType) Hashtable(java.util.Hashtable) Dimension(java.awt.Dimension) Point(java.awt.Point) SinglePoint(cbit.vcell.geometry.SinglePoint) DataAccessException(org.vcell.util.DataAccessException) PropertyVetoException(java.beans.PropertyVetoException) ImageException(cbit.image.ImageException) UserCancelException(org.vcell.util.UserCancelException)

Example 2 with SampledCurve

use of cbit.vcell.geometry.SampledCurve in project vcell by virtualcell.

the class XmlReader method getControlPointCurve.

/**
 * This method returns a ControlPointcurve object from a XML element.
 * Creation date: (5/22/2001 5:20:39 PM)
 * @return cbit.vcell.geometry.ControlPointCurve
 * @param param org.jdom.Element
 */
private ControlPointCurve getControlPointCurve(Element param) {
    ControlPointCurve curve = null;
    // get Attributes
    String type = param.getAttributeValue(XMLTags.TypeAttrTag);
    boolean closed = Boolean.valueOf(param.getAttributeValue(XMLTags.ClosedAttrTag)).booleanValue();
    List<Element> coordList = param.getChildren();
    // Upon de type, decide which Curve type to create
    if (type.equalsIgnoreCase(XMLTags.PolyLineTypeTag)) {
        if (coordList.size() == 2) {
            // I have a Line
            Coordinate begin = getCoordinate(coordList.get(0));
            Coordinate end = getCoordinate(coordList.get(1));
            // ****create new Line ****
            curve = new Line(begin, end);
        } else {
            // If it it is not a Line, then it is a SampledCurve
            Coordinate[] coords = new Coordinate[coordList.size()];
            for (int i = 0; i < coordList.size(); i++) {
                coords[i] = getCoordinate(coordList.get(i));
            }
            // ****create new SampledCurve ****
            curve = new SampledCurve(coords);
        }
    } else if (type.equalsIgnoreCase(XMLTags.SplineTypeTag)) {
        Coordinate[] coords = new Coordinate[coordList.size()];
        for (int i = 0; i < coordList.size(); i++) {
            coords[i] = getCoordinate(coordList.get(i));
        }
        // ****create new Spline ****
        curve = new Spline(coords);
    }
    // set Atributes
    curve.setClosed(closed);
    return curve;
}
Also used : Line(cbit.vcell.geometry.Line) SampledCurve(cbit.vcell.geometry.SampledCurve) Coordinate(org.vcell.util.Coordinate) Element(org.jdom.Element) ControlPointCurve(cbit.vcell.geometry.ControlPointCurve) Spline(cbit.vcell.geometry.Spline)

Example 3 with SampledCurve

use of cbit.vcell.geometry.SampledCurve in project vcell by virtualcell.

the class Xmlproducer method getXML.

/**
 * This method retruns a XML ELement from a ControlPointCurve object.
 * Creation date: (5/22/2001 4:11:37 PM)
 * @return Element
 * @param param cbit.vcell.geometry.ControlPointCurve
 */
private Element getXML(ControlPointCurve param) {
    Element curve = new Element(XMLTags.CurveTag);
    // Add attributes
    String type = null;
    if (param instanceof Spline) {
        type = XMLTags.SplineTypeTag;
    } else if (param instanceof Line || param instanceof SampledCurve) {
        type = XMLTags.PolyLineTypeTag;
    }
    curve.setAttribute(XMLTags.TypeAttrTag, type);
    curve.setAttribute(XMLTags.ClosedAttrTag, String.valueOf(param.isClosed()));
    // Add coordinates
    Vector<Coordinate> vector = param.getControlPointsVector();
    Iterator<Coordinate> iterator = vector.iterator();
    while (iterator.hasNext()) {
        curve.addContent(getXML(iterator.next()));
    }
    return curve;
}
Also used : Line(cbit.vcell.geometry.Line) SampledCurve(cbit.vcell.geometry.SampledCurve) Coordinate(org.vcell.util.Coordinate) Element(org.jdom.Element) Spline(cbit.vcell.geometry.Spline)

Example 4 with SampledCurve

use of cbit.vcell.geometry.SampledCurve in project vcell by virtualcell.

the class PdeTimePlotMultipleVariablesPanel method initialize.

private void initialize() {
    VariableType varType = multiTimePlotHelper.getPdeDatacontext().getDataIdentifier().getVariableType();
    String varName = multiTimePlotHelper.getPdeDatacontext().getVariableName();
    String[] plotNames = new String[pointVector.size()];
    final SymbolTableEntry[] symbolTableEntries = new SymbolTableEntry[plotNames.length];
    DefaultListModel<String> pointListModel = new DefaultListModel<String>();
    for (int i = 0; i < pointVector.size(); i++) {
        Coordinate tp = null;
        if (varType.equals(VariableType.VOLUME) || varType.equals(VariableType.VOLUME_REGION) || varType.equals(VariableType.POSTPROCESSING)) {
            SpatialSelectionVolume ssv = (SpatialSelectionVolume) pointVector.get(i);
            tp = ssv.getCurveSelectionInfo().getCurve().getBeginningCoordinate();
        } else if (varType.equals(VariableType.MEMBRANE) || varType.equals(VariableType.MEMBRANE_REGION)) {
            SpatialSelectionMembrane ssm = (SpatialSelectionMembrane) pointVector.get(i);
            double midU = ssm.getCurveSelectionInfo().getCurveUfromSelectionU(.5);
            tp = ((SampledCurve) ssm.getCurveSelectionInfo().getCurve()).coordinateFromNormalizedU(midU);
        }
        plotNames[i] = varName + " at P[" + i + "]";
        String point = "P[" + i + "]  (" + niceCoordinateString(tp) + ")";
        pointListModel.addElement(point);
        if (multiTimePlotHelper.getsimulation() != null) {
            symbolTableEntries[0] = multiTimePlotHelper.getsimulation().getMathDescription().getEntry(varName);
        } else {
            System.out.println("PdeTimePlotMultipleVariablesPanel.initialize() adding artificial symbol table entries for field data");
            SimpleSymbolTable simpleSymbolTable = new SimpleSymbolTable(new String[] { varName });
            symbolTableEntries[0] = simpleSymbolTable.getEntry(varName);
        }
    }
    pointJList.setModel(pointListModel);
    pointJList.setForeground(variableJList.getForeground());
    pointJList.setVisibleRowCount(3);
    pointJList.setBackground(getBackground());
    pointJList.setSelectionBackground(getBackground());
    pointJList.setSelectionForeground(Color.black);
    plotPane = new PlotPane();
    double[][] plotDatas = tsJobResultsNoStats.getTimesAndValuesForVariable(varName);
    Plot2D plot2D = new SingleXPlot2D(symbolTableEntries, multiTimePlotHelper.getDataSymbolMetadataResolver(), ReservedVariable.TIME.getName(), plotNames, plotDatas, new String[] { "Time Plot", ReservedVariable.TIME.getName(), "" });
    plotPane.setPlot2D(plot2D);
    DataIdentifier[] dis = (multiTimePlotHelper.getCopyOfDisplayedDataIdentifiers() != null ? multiTimePlotHelper.getCopyOfDisplayedDataIdentifiers() : DataIdentifier.collectSortedSimilarDataTypes(multiTimePlotHelper.getVariableType(), multiTimePlotHelper.getPdeDatacontext().getDataIdentifiers()));
    Arrays.sort(dis, new Comparator<DataIdentifier>() {

        public int compare(DataIdentifier o1, DataIdentifier o2) {
            int bEqualIgnoreCase = o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName());
            if (bEqualIgnoreCase == 0) {
                return o1.getDisplayName().compareTo(o2.getDisplayName());
            }
            return bEqualIgnoreCase;
        }
    });
    variableJList.setListData(dis);
    initVariableListSelected(variableJList, multiTimePlotHelper.getPdeDatacontext().getDataIdentifier());
    variableJList.setCellRenderer(multiTimePlotHelper.getListCellRenderer());
    setLayout(new GridBagLayout());
    JLabel label = new JLabel("Selected Points");
    label.setFont(label.getFont().deriveFont(Font.BOLD));
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new java.awt.Insets(15, 10, 4, 4);
    add(label, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.fill = java.awt.GridBagConstraints.BOTH;
    gbc.gridheight = 4;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new java.awt.Insets(0, 4, 0, 0);
    add(plotPane, gbc);
    JScrollPane sp = new JScrollPane(pointJList);
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.weighty = 0.5;
    gbc.fill = java.awt.GridBagConstraints.BOTH;
    gbc.insets = new java.awt.Insets(4, 10, 4, 4);
    add(sp, gbc);
    label = new JLabel("Y Axis");
    label.setFont(label.getFont().deriveFont(Font.BOLD));
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new java.awt.Insets(4, 10, 4, 4);
    add(label, gbc);
    sp = new JScrollPane(variableJList);
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.weightx = 0.2;
    gbc.weighty = 1;
    gbc.insets = new java.awt.Insets(4, 10, 50, 4);
    gbc.fill = java.awt.GridBagConstraints.BOTH;
    add(sp, gbc);
    variableJList.addListSelectionListener(eventHandler);
    multiTimePlotHelper.addPropertyChangeListener(eventHandler);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) DataIdentifier(cbit.vcell.simdata.DataIdentifier) GridBagLayout(java.awt.GridBagLayout) SpatialSelectionMembrane(cbit.vcell.simdata.SpatialSelectionMembrane) DefaultListModel(javax.swing.DefaultListModel) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) JScrollPane(javax.swing.JScrollPane) SampledCurve(cbit.vcell.geometry.SampledCurve) VariableType(cbit.vcell.math.VariableType) JLabel(javax.swing.JLabel) SingleXPlot2D(cbit.plot.SingleXPlot2D) SimpleSymbolTable(cbit.vcell.parser.SimpleSymbolTable) Coordinate(org.vcell.util.Coordinate) SpatialSelectionVolume(cbit.vcell.simdata.SpatialSelectionVolume) PlotPane(cbit.plot.gui.PlotPane) SingleXPlot2D(cbit.plot.SingleXPlot2D) Plot2D(cbit.plot.Plot2D)

Example 5 with SampledCurve

use of cbit.vcell.geometry.SampledCurve in project vcell by virtualcell.

the class PDEDataContextPanel method updateContours.

/**
 * Insert the method's description here.
 * Creation date: (11/9/2000 4:14:39 PM)
 */
private void updateContours() {
    // 
    if (getPdeDataContext() == null || getPdeDataContext().getDataIdentifier() == null) {
        return;
    }
    // Remove previous curves
    CurveRenderer curveRenderer = getImagePlaneManagerPanel().getCurveRenderer();
    if (contoursAndValues != null) {
        java.util.Enumeration<SampledCurve> keysEnum = contoursAndValues.keys();
        while (keysEnum.hasMoreElements()) {
            Curve curve = keysEnum.nextElement();
            curveRenderer.removeCurve(curve);
        }
    }
    // 
    contoursAndValues = null;
    boolean hasValues = false;
    if (meshDisplayAdapter != null) {
        VariableType variableType = getPdeDataContext().getDataIdentifier().getVariableType();
        if (variableType.equals(VariableType.VOLUME)) {
            // Get curves with no values for overlay on volume Data
            contoursAndValues = meshDisplayAdapter.getCurvesFromContours(null);
        } else if (variableType.equals(VariableType.CONTOUR)) {
            // get curves with values
            contoursAndValues = meshDisplayAdapter.getCurvesFromContours(getPdeDataContext().getDataValues());
            hasValues = true;
        }
    }
    // Add new curves to curveRenderer
    if (contoursAndValues != null) {
        java.util.Enumeration<SampledCurve> keysEnum = contoursAndValues.keys();
        while (keysEnum.hasMoreElements()) {
            Curve curve = (Curve) keysEnum.nextElement();
            // 
            curveRenderer.addCurve(curve);
            // 
            curveRenderer.renderPropertyEditable(curve, false);
            curveRenderer.renderPropertySelectable(curve, hasValues);
            if (hasValues) {
                curveRenderer.renderPropertySubSelectionType(curve, CurveRenderer.SUBSELECTION_SEGMENT);
            } else {
                curveRenderer.renderPropertyLineWidthMultiplier(curve, 3);
            }
        }
    }
}
Also used : SampledCurve(cbit.vcell.geometry.SampledCurve) VariableType(cbit.vcell.math.VariableType) ControlPointCurve(cbit.vcell.geometry.ControlPointCurve) Curve(cbit.vcell.geometry.Curve) SampledCurve(cbit.vcell.geometry.SampledCurve) CurveSelectionCurve(cbit.vcell.geometry.CurveSelectionCurve) CurveRenderer(cbit.vcell.geometry.CurveRenderer)

Aggregations

SampledCurve (cbit.vcell.geometry.SampledCurve)18 Coordinate (org.vcell.util.Coordinate)11 SinglePoint (cbit.vcell.geometry.SinglePoint)8 ControlPointCurve (cbit.vcell.geometry.ControlPointCurve)6 Curve (cbit.vcell.geometry.Curve)6 VariableType (cbit.vcell.math.VariableType)5 Vector (java.util.Vector)5 CurveSelectionCurve (cbit.vcell.geometry.CurveSelectionCurve)4 CurveSelectionInfo (cbit.vcell.geometry.CurveSelectionInfo)3 Hashtable (java.util.Hashtable)3 CurveRenderer (cbit.vcell.geometry.CurveRenderer)2 Line (cbit.vcell.geometry.Line)2 Spline (cbit.vcell.geometry.Spline)2 SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)2 DataIdentifier (cbit.vcell.simdata.DataIdentifier)2 SpatialSelectionMembrane (cbit.vcell.simdata.SpatialSelectionMembrane)2 SpatialSelectionVolume (cbit.vcell.simdata.SpatialSelectionVolume)2 CartesianMesh (cbit.vcell.solvers.CartesianMesh)2 CartesianMeshChombo (cbit.vcell.solvers.CartesianMeshChombo)2 Element (org.jdom.Element)2