Search in sources :

Example 1 with ArrayInt

use of org.yamcs.studio.data.vtype.ArrayInt in project yamcs-studio by yamcs.

the class Sine2DWaveform method nextValue.

@Override
VDoubleArray nextValue() {
    if (initialReference == null) {
        initialReference = lastTime;
    }
    double t = initialReference.until(lastTime, ChronoUnit.SECONDS);
    var omega = 2 * Math.PI / periodInSeconds;
    var k = 2 * Math.PI / wavelengthInSamples;
    var min = -1.0;
    var max = 1.0;
    var range = 0.0;
    return (VDoubleArray) ValueFactory.newVNumberArray(generateNewValue(omega, t, k), new ArrayInt(ySamples, xSamples), ValueUtil.defaultArrayDisplay(new ArrayInt(ySamples, xSamples)), alarmNone(), newTime(lastTime), newDisplay(min, min + range * 0.1, min + range * 0.2, "", DOUBLE_FORMAT, min + range * 0.8, min + range * 0.9, max, min, max));
}
Also used : VDoubleArray(org.yamcs.studio.data.vtype.VDoubleArray) ArrayInt(org.yamcs.studio.data.vtype.ArrayInt)

Example 2 with ArrayInt

use of org.yamcs.studio.data.vtype.ArrayInt in project yamcs-studio by yamcs.

the class IntensityGraphEditPart method doCreateFigure.

@Override
protected IFigure doCreateFigure() {
    var model = getWidgetModel();
    graph = new IntensityGraphFigure(getExecutionMode() == ExecutionMode.RUN_MODE);
    graph.setMin(model.getMinimum());
    graph.setMax(model.getMaximum());
    graph.setDataWidth(model.getDataWidth());
    graph.setDataHeight(model.getDataHeight());
    graph.setColorMap(model.getColorMap());
    graph.setShowRamp(model.isShowRamp());
    graph.setCropLeft(model.getCropLeft());
    graph.setCropRight(model.getCropRight());
    graph.setCropTop(model.getCropTOP());
    graph.setCropBottom(model.getCropBottom());
    graph.setInRGBMode(model.isRGBMode());
    graph.setColorDepth(model.getColorDepth());
    graph.setSingleLineProfiling(model.isSingleLineProfiling());
    graph.setROIColor(model.getROIColor().getSWTColor());
    // init X-Axis
    for (var axisProperty : AxisProperty.values()) {
        var propID = IntensityGraphModel.makeAxisPropID(IntensityGraphModel.X_AXIS_ID, axisProperty.propIDPre);
        setAxisProperty(graph.getXAxis(), axisProperty, model.getPropertyValue(propID));
    }
    // init Y-Axis
    for (var axisProperty : AxisProperty.values()) {
        var propID = IntensityGraphModel.makeAxisPropID(IntensityGraphModel.Y_AXIS_ID, axisProperty.propIDPre);
        setAxisProperty(graph.getYAxis(), axisProperty, model.getPropertyValue(propID));
    }
    if (getExecutionMode() == ExecutionMode.RUN_MODE) {
        // add profile data listener
        if (model.getHorizonProfileYPV().trim().length() > 0 || model.getVerticalProfileYPV().trim().length() > 0) {
            graph.addProfileDataListener((xProfileData, yProfileData, xAxisRange, yAxisRange) -> {
                // horizontal
                setPVValue(PROP_HORIZON_PROFILE_Y_PV_NAME, xProfileData);
                var horizonXData = new double[xProfileData.length];
                var d = (xAxisRange.getUpper() - xAxisRange.getLower()) / (xProfileData.length - 1);
                for (var i1 = 0; i1 < xProfileData.length; i1++) {
                    horizonXData[i1] = xAxisRange.getLower() + d * i1;
                }
                setPVValue(PROP_HORIZON_PROFILE_X_PV_NAME, horizonXData);
                // vertical
                setPVValue(PROP_VERTICAL_PROFILE_Y_PV_NAME, yProfileData);
                var verticalXData = new double[yProfileData.length];
                d = (yAxisRange.getUpper() - yAxisRange.getLower()) / (yProfileData.length - 1);
                for (var i2 = 0; i2 < yProfileData.length; i2++) {
                    verticalXData[i2] = yAxisRange.getUpper() - d * i2;
                }
                setPVValue(PROP_VERTICAL_PROFILE_X_PV_NAME, verticalXData);
            });
        }
        if (model.getPixelInfoPV().trim().length() > 0) {
            // Listen to pixel info, forward to PV
            graph.addPixelInfoListener((pixel_info, selected) -> {
                // TODO "Selected" column should be boolean, but there is no 'ArrayBoolean', and List<Boolean>
                // also fails
                List<Object> values = Arrays.<Object>asList(new ArrayDouble(pixel_info.xcoord), new ArrayDouble(pixel_info.ycoord), new ArrayDouble(pixel_info.value), new ArrayInt(selected ? 1 : 0));
                Object value = ValueFactory.newVTable(PXL_TABLE_TYPES, PXL_TABLE_COLUMNS, values);
                setPVValue(PROP_PIXEL_INFO_PV_NAME, value);
            });
        }
    }
    updatePropSheet();
    return graph;
}
Also used : IntensityGraphFigure(org.csstudio.swt.widgets.figures.IntensityGraphFigure) ArrayDouble(org.yamcs.studio.data.vtype.ArrayDouble) ArrayInt(org.yamcs.studio.data.vtype.ArrayInt)

Example 3 with ArrayInt

use of org.yamcs.studio.data.vtype.ArrayInt in project yamcs-studio by yamcs.

the class Square2DWaveform method nextValue.

@Override
VDoubleArray nextValue() {
    if (initialReference == null) {
        initialReference = lastTime;
    }
    double t = initialReference.until(lastTime, ChronoUnit.SECONDS);
    var omega = 2 * Math.PI / periodInSeconds;
    var k = 2 * Math.PI / wavelengthInSamples;
    var min = -1.0;
    var max = 1.0;
    var range = 0.0;
    return (VDoubleArray) ValueFactory.newVNumberArray(generateNewValue(omega, t, k), new ArrayInt(ySamples, xSamples), ValueUtil.defaultArrayDisplay(new ArrayInt(ySamples, xSamples)), alarmNone(), newTime(lastTime), newDisplay(min, min + range * 0.1, min + range * 0.2, "", DOUBLE_FORMAT, min + range * 0.8, min + range * 0.9, max, min, max));
}
Also used : VDoubleArray(org.yamcs.studio.data.vtype.VDoubleArray) ArrayInt(org.yamcs.studio.data.vtype.ArrayInt)

Aggregations

ArrayInt (org.yamcs.studio.data.vtype.ArrayInt)3 VDoubleArray (org.yamcs.studio.data.vtype.VDoubleArray)2 IntensityGraphFigure (org.csstudio.swt.widgets.figures.IntensityGraphFigure)1 ArrayDouble (org.yamcs.studio.data.vtype.ArrayDouble)1