Search in sources :

Example 6 with DoubleInterval

use of maspack.util.DoubleInterval in project artisynth_core by artisynth.

the class DoubleIntervalField method valueToText.

@Override
protected String[] valueToText(Object obj) {
    String[] strs = new String[2];
    if (obj instanceof DoubleInterval) {
        DoubleInterval rng = (DoubleInterval) obj;
        strs[0] = myFmt.format(rng.getLowerBound());
        strs[1] = myFmt.format(rng.getUpperBound());
        return strs;
    } else {
        strs[0] = strs[1] = "";
    }
    return strs;
}
Also used : DoubleInterval(maspack.util.DoubleInterval)

Example 7 with DoubleInterval

use of maspack.util.DoubleInterval in project artisynth_core by artisynth.

the class FemMeshBase method setStressPlotRange.

public void setStressPlotRange(DoubleInterval range) {
    myStressPlotRange = new DoubleInterval(range);
    myStressPlotRangeMode = PropertyUtils.propagateValue(this, "stressPlotRange", range, myStressPlotRangeMode);
}
Also used : DoubleInterval(maspack.util.DoubleInterval)

Example 8 with DoubleInterval

use of maspack.util.DoubleInterval in project artisynth_core by artisynth.

the class NumericProbeDisplayLarge method initialize.

private void initialize() {
    setSize(new Dimension(700, 400));
    String inputOutputString = (myProbe.isInput()) ? "Input probe" : "Output probe";
    setTitle(myTrackNumber + " " + inputOutputString + ": " + myProbe.getName());
    // create probe panels based on the fact if it is input or output probes
    myPanel = (NumericProbePanel) myProbe.getDisplay(getWidth(), getHeight(), LARGE_PROBE_DISPLAY);
    if (myPanel.isAutoRanging()) {
        myPanel.adjustRangeIfNecessary();
    }
    JToolBar sideToolBar = new JToolBar(JToolBar.VERTICAL);
    zoomInBtn = ButtonCreator.createIconicButton(zoomInIcon, "Zoom In", "Zoom In", true, false, this);
    zoomOutBtn = ButtonCreator.createIconicButton(zoomOutIcon, "Zoom Out", "Zoom Out", true, false, this);
    moveDisplayBtn = ButtonCreator.createIconicButton(moveDisplayIcon, "Move Display", "Move Display", true, false, this);
    pointerBtn = ButtonCreator.createIconicButton(pointerIcon, "Edit Plot", "Edit Plot", true, false, this);
    upArrowBtn = ButtonCreator.createIconicButton(upArrowIcon, "Increase Range", "Increase Range", true, false, this);
    downArrowBtn = ButtonCreator.createIconicButton(downArrowIcon, "Decrease Range", "Decrease Range", true, false, this);
    fitRangeBtn = ButtonCreator.createIconicButton(fitRangeIcon, "Fit Range", "Fit Range", true, false, this);
    autoRangeCheck = new BooleanSelector("Auto range", true);
    autoRangeCheck.addValueChangeListener(this);
    setYRange(myPanel.getAutoRange());
    setXRange(myPanel.getDefaultDomain());
    yRangeField = new DoubleIntervalField("Y range", new DoubleInterval(yMin, yMax), "%.6g");
    yRangeField.addValueChangeListener(this);
    xRangeField = new DoubleIntervalField("X range", new DoubleInterval(xMin, xMax), "%.6g");
    xRangeField.addValueChangeListener(this);
    sideToolBar.add(pointerBtn);
    sideToolBar.addSeparator();
    sideToolBar.add(zoomInBtn);
    sideToolBar.add(zoomOutBtn);
    sideToolBar.add(moveDisplayBtn);
    sideToolBar.addSeparator();
    sideToolBar.add(upArrowBtn);
    sideToolBar.add(downArrowBtn);
    sideToolBar.add(fitRangeBtn);
    sideToolBar.addSeparator();
    JToolBar rangeToolBar = new JToolBar();
    rangeToolBar.add(autoRangeCheck);
    rangeToolBar.addSeparator();
    rangeToolBar.add(yRangeField);
    rangeToolBar.addSeparator();
    rangeToolBar.add(xRangeField);
    rangeToolBar.addSeparator();
    normalBorder = zoomInBtn.getBorder();
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(myPanel, BorderLayout.CENTER);
    getContentPane().add(sideToolBar, BorderLayout.WEST);
    getContentPane().add(rangeToolBar, BorderLayout.NORTH);
    pack();
}
Also used : BooleanSelector(maspack.widgets.BooleanSelector) BorderLayout(java.awt.BorderLayout) DoubleIntervalField(maspack.widgets.DoubleIntervalField) DoubleInterval(maspack.util.DoubleInterval) Dimension(java.awt.Dimension) JToolBar(javax.swing.JToolBar)

Example 9 with DoubleInterval

use of maspack.util.DoubleInterval in project artisynth_core by artisynth.

the class NumericProbeDisplayLarge method valueChange.

public void valueChange(ValueChangeEvent e) {
    Object source = e.getSource();
    if (source == yRangeField) {
        double lower = yRangeField.getLowerBound();
        double upper = yRangeField.getUpperBound();
        if (lower != yMin && lower < upper) {
            yMin = lower;
            myPanel.setDisplayRangeManually(lower, upper);
        } else if (upper != yMax && upper > lower) {
            yMax = upper;
            myPanel.setDisplayRangeManually(lower, upper);
        }
        yRangeField.setValue(new DoubleInterval(yMin, yMax));
        autoRangeCheck.setValue(false);
        myPanel.setAutoRanging(false);
    } else if (source == xRangeField) {
        double lower = xRangeField.getLowerBound();
        double upper = xRangeField.getUpperBound();
        if (lower != xMin && lower < upper) {
            xMin = lower;
            myPanel.setDisplayDomain(lower, upper);
        } else if (upper != xMax && upper > lower) {
            xMax = upper;
            myPanel.setDisplayDomain(lower, upper);
        }
        xRangeField.setValue(new DoubleInterval(xMin, xMax));
        autoRangeCheck.setValue(false);
        myPanel.setAutoRanging(false);
    } else if (source == autoRangeCheck) {
        if (autoRangeCheck.getBooleanValue()) {
            yRangeField.removeValueChangeListener(this);
            xRangeField.removeValueChangeListener(this);
            myPanel.setAutoRanging(true);
            setYRange(myPanel.getAutoRange());
            setXRange(myPanel.getDefaultDomain());
            yRangeField.setValue(new DoubleInterval(yMin, yMax));
            xRangeField.setValue(new DoubleInterval(xMin, xMax));
            myPanel.setDisplayRangeManually(yMin, yMax);
            myPanel.setDisplayDomain(xMin, xMax);
            yRangeField.addValueChangeListener(this);
            xRangeField.addValueChangeListener(this);
        }
    }
    myPanel.repaint();
}
Also used : DoubleInterval(maspack.util.DoubleInterval)

Example 10 with DoubleInterval

use of maspack.util.DoubleInterval in project artisynth_core by artisynth.

the class PropertyWidgetDialog method initialize.

private void initialize() {
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    Container pane = getContentPane();
    pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
    LabeledComponentPanel propPanel = new LabeledComponentPanel();
    propPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
    // myChooser = new PropertyChooser ("component/property", 30, myMain);
    // myChooser.setAlignmentX (Component.CENTER_ALIGNMENT);
    // myChooser.addValueChangeListener (this);
    // pane.add (Box.createRigidArea (new Dimension (0, 4)));
    // propPanel.addWidget (myChooser);
    myPropField = new PropertyField("component/property", 30, myMain);
    myPropField.setAlignmentX(Component.CENTER_ALIGNMENT);
    myPropField.addValueChangeListener(this);
    propPanel.addWidget(myPropField);
    propPanel.addWidget(new JSeparator());
    mySliderSelector = new BooleanSelector("slider");
    mySliderSelector.addValueChangeListener(this);
    propPanel.addWidget(mySliderSelector);
    myRangeField = new DoubleIntervalField("range", new DoubleInterval(0, 1), "%.6g");
    // new VectorMultiField (
    // "range", new String[] { "min:", "max:" }, new Vector2d (0, 1),
    // "%.6f");
    // myRangeField.setAlignmentX (Component.CENTER_ALIGNMENT);
    propPanel.addWidget(myRangeField);
    myLabelTextField = new StringField("labelText", 20);
    myLabelTextField.setEnabledAll(false);
    myLabelTextField.addValueCheckListener(new ValueCheckListener() {

        public Object validateValue(ValueChangeEvent e, StringHolder errMsg) {
            String newName = (String) e.getValue();
            String err = ModelComponentBase.checkName(newName, null);
            if (err != null) {
                err = "Invalid name '" + newName + "': " + err;
                newName = null;
            }
            if (errMsg != null) {
                errMsg.value = err;
            }
            return newName;
        }
    });
    propPanel.addWidget(myLabelTextField);
    myLabelFontColorSelector = new ColorSelector("labelFontColor");
    myLabelFontColorSelector.enableNullColors();
    myLabelFontColorSelector.setValue(null);
    propPanel.addWidget(myLabelFontColorSelector);
    myBackgroundColorSelector = new ColorSelector("backgroundColor");
    myBackgroundColorSelector.enableNullColors();
    myBackgroundColorSelector.setValue(null);
    propPanel.addWidget(myBackgroundColorSelector);
    // sliderPanel.add (myRangeField);
    // pane.add (Box.createRigidArea (new Dimension (0, 4)));
    // pane.add (sliderPanel);
    pane.add(propPanel);
    pane.add(new JSeparator());
    // set slider value here because valueChanged needs some
    // other widgets instantiated.
    mySliderSelector.setValue(false);
    mySliderSelector.setEnabledAll(false);
    OptionPanel options = new OptionPanel("OK Cancel", this);
    myOKButton = options.getButton("OK");
    myOKButton.setEnabled(false);
    options.setAlignmentX(Component.CENTER_ALIGNMENT);
    pane.add(options);
    pack();
}
Also used : BoxLayout(javax.swing.BoxLayout) JSeparator(javax.swing.JSeparator) Container(java.awt.Container) PropertyField(artisynth.core.gui.widgets.PropertyField) ValueCheckListener(maspack.widgets.ValueCheckListener) ValueChangeEvent(maspack.widgets.ValueChangeEvent) StringHolder(maspack.util.StringHolder) BooleanSelector(maspack.widgets.BooleanSelector) DoubleIntervalField(maspack.widgets.DoubleIntervalField) StringField(maspack.widgets.StringField) DoubleInterval(maspack.util.DoubleInterval) LabeledComponentPanel(maspack.widgets.LabeledComponentPanel) ColorSelector(maspack.widgets.ColorSelector) OptionPanel(maspack.widgets.OptionPanel)

Aggregations

DoubleInterval (maspack.util.DoubleInterval)22 NumericInterval (maspack.util.NumericInterval)3 Property (maspack.properties.Property)2 IntegerInterval (maspack.util.IntegerInterval)2 BooleanSelector (maspack.widgets.BooleanSelector)2 DoubleIntervalField (maspack.widgets.DoubleIntervalField)2 AddComponentsCommand (artisynth.core.gui.editorManager.AddComponentsCommand)1 PropertyField (artisynth.core.gui.widgets.PropertyField)1 Point (artisynth.core.mechmodels.Point)1 NumericOutputProbe (artisynth.core.probes.NumericOutputProbe)1 NumericProbeVariable (artisynth.core.probes.NumericProbeVariable)1 ColorBar (artisynth.core.renderables.ColorBar)1 BorderLayout (java.awt.BorderLayout)1 Container (java.awt.Container)1 Dimension (java.awt.Dimension)1 Font (java.awt.Font)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 BoxLayout (javax.swing.BoxLayout)1