|
ngscopeclient v0.3
|
A WaveformArea is a plot that displays one or more OscilloscopeChannel's worth of data. More...
#include <WaveformArea.h>


Public Member Functions | |
| WaveformArea (StreamDescriptor stream, std::shared_ptr< WaveformGroup > group, MainWindow *parent) | |
| bool | Render (int iArea, int numAreas, ImVec2 clientArea) |
| Renders a waveform area. | |
| void | RenderWaveformTextures (vk::raii::CommandBuffer &cmdbuf, std::vector< std::shared_ptr< InputDescriptor > > &channels, bool clearPersistence) |
| Runs the rendering shader on all of our waveforms. | |
| void | ReferenceWaveformTextures () |
| Marks all of our waveform textures as being used this frame. | |
| void | ToneMapAllWaveforms (vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers) |
| Tone map our waveforms. | |
| size_t | GetStreamCount () |
| StreamDescriptor | GetStream (size_t i) |
| std::shared_ptr< DisplayedChannel > | GetDisplayedChannel (size_t i) |
| bool | IsStreamBeingDisplayed (StreamDescriptor target) |
| Checks if this area is currently displaying a provided stream. | |
| void | AddStream (StreamDescriptor desc, bool persistence=false, const std::string &ramp="eye-gradient-viridis") |
| void | AddStream (StreamDescriptor desc, size_t position, bool persistence=false, const std::string &ramp="eye-gradient-viridis") |
| bool | IsCompatible (StreamDescriptor desc) |
| Checks if this area is compatible with a provided stream. | |
| bool | IsShowing (StreamDescriptor desc) |
| Checks if provided stream descriptor is already present in this waveform area. | |
| virtual void | RemoveStream (size_t i) override |
| Removes the stream at a specified index. | |
| void | ClearPersistence () |
| void | ClearPersistenceOfChannel (OscilloscopeChannel *chan) |
| Clear persistence iff we are displaying the specified channel. | |
| bool | IsChannelBeingDragged () |
| Returns true if a channel is currently being dragged. | |
| StreamDescriptor | GetChannelBeingDragged () |
| Returns the channel being dragged, if one exists. | |
| void | AutofitVertical () |
| std::shared_ptr< WaveformGroup > | GetGroup () |
| Gets the WaveformGroup for this area. | |
| TimePoint | GetWaveformTimestamp () |
| Gets the timestamp of our current waveform (if we have one) | |
| void | SerializeConfiguration (YAML::Node &node) |
| virtual YAML::Node | SerializeConfiguration (IDTable &table) override |
| SerializeConfiguration method called by filter graph, not yet used for anything. | |
| void | LoadConfiguration (YAML::Node &node) |
| bool | IsMouseOverYCursor (int iCursor, bool ignoreCursorsPlacedThisFrame) |
| bool | IsMouseOverAnyYCursor (bool ignoreCursorsPlacedThisFrame) |
| StreamDescriptor | GetFirstAnalogStream () |
| Returns the first analog stream displayed in this area. | |
| StreamDescriptor | GetFirstEyeStream () |
| Returns the first eye pattern displayed in this area. | |
| StreamDescriptor | GetFirstConstellationStream () |
| Returns the first constellation diagram displayed in this area. | |
| StreamDescriptor | GetFirstDensityFunctionStream () |
| Returns the first density plot displayed in this area. | |
| StreamDescriptor | GetFirstAnalogOrDensityStream () |
| Returns the first analog, spectrogram or eye pattern stream displayed in this area. | |
| Unit | GetYAxisUnit () |
| bool | IsMouseOverButtonAtEndOfRender () |
| Returns true if the mouse is over a button, rather than the plot area. | |
| template<class T > | |
| void | RenderUniformDigitalBusWaveform (shared_ptr< DisplayedChannel > channel, T *data, ImVec2 start, ImVec2 size) |
Public Member Functions inherited from SinkNode | |
| virtual void | Refresh (vk::raii::CommandBuffer &cmdBuf, std::shared_ptr< QueueHandle > queue) override |
Public Member Functions inherited from FlowGraphNode | |
| void | DetachInputs () |
| Disconnects all inputs from the node without releasing them. | |
| size_t | GetInputCount () |
| Get the number of input ports. | |
| std::string | GetInputName (size_t i) |
| void | SetInput (size_t i, StreamDescriptor stream, bool force=false) |
| Connects a stream to the input of this node. | |
| void | SetInput (const std::string &name, StreamDescriptor stream, bool force=false) |
| virtual bool | ValidateChannel (size_t i, StreamDescriptor stream) |
| Check if a stream is allowed to be connected to the given input. | |
| bool | HasInput (StreamDescriptor desc) |
| Checks if the given stream is connected to at least one of our inputs. | |
| StreamDescriptor | GetInput (size_t i) |
| Gets the descriptor for one of our inputs. | |
| std::shared_ptr< InputConstraint > | GetInputConstraints (size_t i) |
| Get the constraints on one of our inputs. | |
| FilterParameter & | GetParameter (std::string s) |
| bool | HasParameter (std::string s) |
| Checks if we have a parameter with a given name. | |
| ParameterMapType::iterator | GetParamBegin () |
| Returns an iterator to the beginning of our parameter map. | |
| ParameterMapType::iterator | GetParamEnd () |
| Returns an iterator to the end of our parameter map. | |
| size_t | GetParamCount () |
| Returns the number of parameter we have. | |
| virtual void | LoadParameters (const YAML::Node &node, IDTable &table) |
| Load configuration from a save file. | |
| virtual void | LoadInputs (const YAML::Node &node, IDTable &table) |
| bool | IsDownstreamOf (std::set< FlowGraphNode * > nodes) |
| Determines if this node is downstream of any of the specified other nodes. | |
| virtual uint32_t | GetExecutionCapabilitiesMask () |
| Returns a bitmask of ExecutionCapabilities fields. | |
| bool | HasMessages () const |
| Checks if this graph has any messages. | |
| const std::vector< FlowGraphNodeMessage > & | GetMessages () const |
| Walking through any messages. | |
| const FlowGraphNodeMessage * | GetMostSevereMessage () const |
| void | AddSink (size_t stream, FlowGraphNode *node) |
| void | RemoveSink (size_t stream, FlowGraphNode *node) |
| const std::set< FlowGraphNode * > & | GetSinks (size_t stream) |
| sigc::signal< void()> | signal_parametersChanged () |
| sigc::signal< void()> | signal_inputsChanged () |
Protected Types | |
| enum | DragState { DRAG_STATE_NONE , DRAG_STATE_CHANNEL , DRAG_STATE_CHANNEL_LAST , DRAG_STATE_Y_AXIS , DRAG_STATE_TRIGGER_LEVEL , DRAG_STATE_TRIGGER_SECONDARY_LEVEL , DRAG_STATE_BER_LEVEL , DRAG_STATE_BER_BOTH , DRAG_STATE_PEAK_MARKER , DRAG_STATE_Y_CURSOR0 , DRAG_STATE_Y_CURSOR1 } |
| Drag and drop of UI elements. | |
| enum | YAxisCursorMode { Y_CURSOR_NONE , Y_CURSOR_SINGLE , Y_CURSOR_DUAL } |
| Horizontal cursor configuration. | |
Protected Member Functions | |
| void | OnStreamAdded (StreamDescriptor desc) |
| When a stream is added, autoscale it. | |
| virtual void | CreateInput (const std::string &name) override |
| Gets the digital bus waveform attached to the specified input. | |
| virtual std::shared_ptr< DisplayedChannel > | CreateInput (StreamDescriptor stream, Session &session) |
| void | ChannelButton (std::shared_ptr< DisplayedChannel > chan, size_t index) |
| Handles a button for a channel. | |
| void | RenderBackgroundGradient (ImVec2 start, ImVec2 size) |
| Renders the background of the main plot area. | |
| void | RenderGrid (ImVec2 start, ImVec2 size, std::map< float, float > &gridmap, float &vbot, float &vtop) |
| Renders grid lines. | |
| void | RenderYAxis (ImVec2 size, std::map< float, float > &gridmap, float vbot, float vtop) |
| Renders the Y axis scale. | |
| void | RenderTriggerLevelArrows (ImVec2 start, ImVec2 size) |
| Arrows pointing to trigger levels. | |
| void | RenderBERLevelArrows (ImVec2 start, ImVec2 size) |
| Arrows pointing to BERT sampling level. | |
| void | RenderCursors (ImVec2 start, ImVec2 size) |
| Cursors and related stuff. | |
| void | RenderYAxisCursors (ImVec2 pos, ImVec2 size, float yAxisWidth) |
| Render horizontal cursors over the plot. | |
| void | RenderBERSamplingPoint (ImVec2 start, ImVec2 size) |
| Sampling point for BER. | |
| void | CheckForScaleMismatch (ImVec2 start, ImVec2 size) |
| Look for mismatched vertical scales and display warning message. | |
| void | RenderEyePatternTooltip (ImVec2 start, ImVec2 size) |
| Draw the tooltip on an eye pattern. | |
| void | RenderWaveforms (ImVec2 start, ImVec2 size) |
| Renders our waveforms. | |
| void | RenderAnalogWaveform (std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size) |
| Renders a single analog waveform. | |
| void | RenderEyeWaveform (std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size) |
| Renders a single eye pattern. | |
| void | RenderConstellationWaveform (std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size) |
| Renders a single constellation diagram. | |
| void | RenderWaterfallWaveform (std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size) |
| Renders a single waterfall. | |
| void | RenderSpectrogramWaveform (std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size) |
| Renders a single spectrogram (same as waterfall for now) | |
| void | RenderSpectrumPeaks (ImDrawList *list, std::shared_ptr< DisplayedChannel > channel) |
| Draw peaks from a FFT or similar waveform. | |
| void | RenderDigitalWaveform (std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size) |
| Renders a single digital waveform. | |
| void | RenderProtocolWaveform (std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size) |
| Renders a single protocol waveform (assume it's sparse) | |
| void | RenderDigitalBusWaveform (std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size) |
| Renders a single digital vector waveform. | |
| template<class T > | |
| void | RenderUniformDigitalBusWaveform (std::shared_ptr< DisplayedChannel > channel, T *data, ImVec2 start, ImVec2 size) |
| void | RenderComplexSignal (ImDrawList *list, int visleft, int visright, float xstart, float xend, float xoff, float ybot, float ymid, float ytop, std::string str, ImU32 color) |
| void | MakePathSignalBody (ImDrawList *list, float xstart, float xend, float ybot, float ymid, float ytop) |
| void | ToneMapAnalogOrDigitalWaveform (std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers) |
| Tone maps an analog or digital waveform by converting the internal fp32 buffer to RGBA. | |
| void | ToneMapEyeWaveform (std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers) |
| Tone maps an eye waveform by converting the internal fp32 buffer to RGBA. | |
| void | ToneMapConstellationWaveform (std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers) |
| Tone maps a constellation waveform by converting the internal fp32 buffer to RGBA. | |
| void | ToneMapWaterfallWaveform (std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers) |
| Tone maps a waterfall waveform by converting the internal fp32 buffer to RGBA and cropping/scaling. | |
| void | ToneMapSpectrogramWaveform (std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers) |
| Tone maps a spectrogram waveform by converting the internal fp32 buffer to RGBA and cropping/scaling. | |
| void | RasterizeAnalogOrDigitalWaveform (std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, bool clearPersistence) |
| void | PlotContextMenu () |
| Run the context menu for the main plot area. | |
| void | DrawDropRangeMismatchMessage (ImDrawList *list, ImVec2 center, StreamDescriptor ourStream, StreamDescriptor theirStream) |
| Display a warning message about mismatched vertical scale. | |
| void | DrawDropScalarMessage (ImDrawList *list, ImVec2 center) |
| void | DragDropOverlays (ImVec2 start, ImVec2 size, int iArea, int numAreas) |
| Drag-and-drop overlay areas. | |
| bool | CenterRightDropArea (ImVec2 start, ImVec2 size, ImGuiDir direction) |
| Drop area for the middle of the plot. | |
| bool | EdgeDropArea (const std::string &name, ImVec2 start, ImVec2 size, ImGuiDir splitDir) |
| Drop area for edge of the plot. | |
| void | CenterDropArea (ImVec2 start, ImVec2 size) |
| Main drop area used to drop a stream in this waveform area at a given position. | |
| void | FilterMenu (std::shared_ptr< DisplayedChannel > chan) |
| void | FilterSubmenu (std::shared_ptr< DisplayedChannel > chan, const std::string &name, Filter::Category cat) |
| Run the submenu for a single filter category. | |
| float | PixelsToYAxisUnits (float pix) |
| float | YAxisUnitsToPixels (float volt) |
| float | YAxisUnitsToYPosition (float volt) |
| float | YPositionToYAxisUnits (float y) |
| float | PickStepSize (float volts_per_half_span, int min_steps=2, int max_steps=5) |
| void | OnMouseWheelPlotArea (float delta, float delta_h) |
| Handles a mouse wheel scroll step on the plot area. | |
| void | OnMouseWheelYAxis (float delta) |
| Handles a mouse wheel scroll step on the Y axis. | |
| void | OnMouseUp () |
| void | OnDragUpdate () |
| ImVec2 | ClosestPointOnLineSegment (ImVec2 lineA, ImVec2 lineB, ImVec2 pt) |
| Computes the closest point on a line segment (given the endpoints) to a given point. | |
| void | DoCursor (int iCursor, DragState state) |
| Run interaction processing for dragging a Y axis cursor. | |
Protected Member Functions inherited from SinkNode | |
| void | RefreshInputNames () |
| Regenerate the list of inputs so that each port has a unique, monotonic name. | |
| void | ClearEmptyInputs () |
| Removes any empty spaces from m_inputs. | |
| size_t | GetStreamPosition (StreamDescriptor desc) |
| Get the position of the provided Stream in this SinkNode. | |
| void | MoveStream (StreamDescriptor desc, size_t newPosition) |
| Move a stream to another position in this plot. | |
Protected Member Functions inherited from FlowGraphNode | |
| virtual void | OnInputChanged (size_t i) |
| Called when a new input is connected to the node. | |
| WaveformBase * | GetInputWaveform (size_t i) |
| Gets the waveform attached to the specified input. | |
| SparseAnalogWaveform * | GetSparseAnalogInputWaveform (size_t i) |
| Gets the analog waveform attached to the specified input. | |
| UniformAnalogWaveform * | GetUniformAnalogInputWaveform (size_t i) |
| Gets the analog waveform attached to the specified input. | |
| SparseDigitalWaveform * | GetSparseDigitalInputWaveform (size_t i) |
| Gets the digital waveform attached to the specified input. | |
| UniformDigitalWaveform * | GetUniformDigitalInputWaveform (size_t i) |
| Gets the digital waveform attached to the specified input. | |
| template<class T , class... Args> | |
| void | CreateInput (const std::string &name, Args &&... args) |
| std::string | GetInputDisplayName (size_t i) |
| Gets the display name for one of our inputs. | |
| void | ClearMessages () |
| Remove any messages left over from the last graph refresh. | |
| void | AddMessage (const FlowGraphNodeMessage &msg) |
| Attach a new message to the node. | |
| void | AddMessage (Severity severity, const std::string &title, const std::string &message) |
| Attach a new message to the node. | |
| void | AddErrorMessage (const std::string &err) |
| Add a new error message. | |
| void | AddErrorMessage (const std::string &title, const std::string &err) |
| Add a new error message with a title. | |
Protected Attributes | |
| float | m_width |
| Cached plot width (excluding Y axis) | |
| float | m_height |
| Cached plot height. | |
| float | m_yAxisOffset |
| Cached Y axis offset. | |
| float | m_ymid |
| Cached midpoint of the plot. | |
| float | m_pixelsPerYAxisUnit |
| Cached Y axis scale. | |
| Unit | m_yAxisUnit |
| Cached Y axis unit. | |
| enum WaveformArea::DragState | m_dragState |
| StreamDescriptor | m_dragStream |
| The stream currently being dragged (invalid if m_dragState != DRAG_STATE_CHANNEL) | |
| std::shared_ptr< WaveformGroup > | m_group |
| Waveform group containing us. | |
| MainWindow * | m_parent |
| Top level window object containing us. | |
| double | m_tLastMouseMove |
| Time of last mouse movement. | |
| bool | m_mouseOverTriggerArrow |
| True if mouse is over a trigger level arrow. | |
| bool | m_mouseOverBERTarget |
| True if mouse is over the BER sampling location. | |
| float | m_triggerLevelDuringDrag |
| Current trigger level, if dragging. | |
| int64_t | m_xAxisPosDuringDrag |
| Current X axis position during drag. | |
| Trigger * | m_triggerDuringDrag |
| The trigger we're configuring. | |
| BERTInputChannel * | m_bertChannelDuringDrag |
| The BERT channel we're configuring. | |
| std::vector< std::shared_ptr< InputDescriptor > > | m_channelsToRemove |
| Channels we're in the process of removing. | |
| int64_t | m_lastRightClickOffset |
| X axis position of the mouse at the most recent right click. | |
| std::atomic< bool > | m_clearPersistence |
| True if clearing persistence next render. | |
| float | m_channelButtonHeight |
| Height of a channel button. | |
| PeakLabel * | m_dragPeakLabel |
| Peak label being dragged, if any. | |
| ImVec2 | m_dragPeakAnchorOffset |
| Offset, in pixels, from mouse to anchor point of peak being dragged. | |
| bool | m_mouseOverButton |
| True if the mouse cursor is over a channel button. | |
| YAxisCursorMode | m_yAxisCursorMode |
| Currently selected state of the Y axis cursor(s) | |
| float | m_yAxisCursorPositions [2] |
| Position of the Y axis cursor(s) | |
| bool | m_cursorPlacedThisFrame |
| True if the Y axis cursors were just placed in the current frame. | |
Protected Attributes inherited from FlowGraphNode | |
| std::vector< std::shared_ptr< InputDescriptor > > | m_inputs |
| Input ports. | |
| std::vector< std::set< FlowGraphNode * > > | m_sinks |
| The nodes (if any) that each of our streams drives. | |
| ParameterMapType | m_parameters |
| sigc::signal< void()> | m_parametersChangedSignal |
| Signal emitted when the set of parameters changes. | |
| sigc::signal< void()> | m_inputsChangedSignal |
| Signal emitted when the set of inputs changes. | |
| std::vector< FlowGraphNodeMessage > | m_messages |
Additional Inherited Members | |
Public Types inherited from FlowGraphNode | |
| enum class | ExecutionCapabilities { None = 0 , CommandBufferAppend = 1 , CommandBufferTailCall = 2 , VulkanOnly = 4 , DynamicShader = 8 } |
| typedef std::map< std::string, FilterParameter > | ParameterMapType |
| Short name for a map of strings to parameters. | |
A WaveformArea is a plot that displays one or more OscilloscopeChannel's worth of data.
WaveformArea's auto resize, and will collectively fill the entire client area of their parent window.
Drop area for the middle of the plot.
Dropping a waveform in here adds it to a new plot in the same group
| void WaveformArea::ClearPersistenceOfChannel | ( | OscilloscopeChannel * | chan | ) |
Clear persistence iff we are displaying the specified channel.
TODO: can we clear only that channel and nothing else? TODO: clear if we have any dependency chain leading to the specified channel
Computes the closest point on a line segment (given the endpoints) to a given point.
Reference: https://en.wikibooks.org/wiki/Linear_Algebra/Orthogonal_Projection_Onto_a_Line
Gets the digital bus waveform attached to the specified input.
Reimplemented from FlowGraphNode.
|
protected |
Drop area for edge of the plot.
Dropping a waveform in here splits and forms a new group
| StreamDescriptor WaveformArea::GetFirstAnalogOrDensityStream | ( | ) |
Returns the first analog, spectrogram or eye pattern stream displayed in this area.
(this really means "has a useful Y axis")
If no suitable waveforms returns a null stream.
| StreamDescriptor WaveformArea::GetFirstAnalogStream | ( | ) |
Returns the first analog stream displayed in this area.
If no analog waveforms are visible, returns a null stream.
| StreamDescriptor WaveformArea::GetFirstConstellationStream | ( | ) |
Returns the first constellation diagram displayed in this area.
If no constellation diagrams are visible, returns a null stream.
| StreamDescriptor WaveformArea::GetFirstDensityFunctionStream | ( | ) |
Returns the first density plot displayed in this area.
If none are visible, returns a null stream.
| StreamDescriptor WaveformArea::GetFirstEyeStream | ( | ) |
Returns the first eye pattern displayed in this area.
If no eye patterns are visible, returns a null stream.
|
inline |
Returns true if the mouse is over a button, rather than the plot area.
Only valid after rendering is complete before start of the next render cycle
Handles a mouse wheel scroll step on the plot area.
| delta | Vertical scroll steps |
| delta_h | Horizontal scroll steps |
Removes the stream at a specified index.
Reimplemented from SinkNode.
Renders a waveform area.
Returns false if the area should be closed (no more waveforms visible in it)
Renders the background of the main plot area.
For now, simple gray gradient.
|
protected |
Renders a single protocol waveform (assume it's sparse)
TODO: should we ever support uniform protocol data? maybe coming off some kind of analyzer?
| void WaveformArea::RenderWaveformTextures | ( | vk::raii::CommandBuffer & | cmdbuf, |
| std::vector< std::shared_ptr< InputDescriptor > > & | channels, | ||
| bool | clearPersistence | ||
| ) |
Runs the rendering shader on all of our waveforms.
Called from WaveformThread
| cmdbuf | Command buffer to record rendering commands into |
| chans | Set of channels we rendered into Used to keep references active until rendering completes if we close them this frame |
| clearPersistence | True if persistence maps should be erased before rendering |
|
overridevirtual |
SerializeConfiguration method called by filter graph, not yet used for anything.
Long term we'll switch waveform area serialization to this method and retire the one that takes a reference
Reimplemented from FlowGraphNode.