SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | List of all members
wonderjuce::SourceDisplay Class Reference

An abstract class for a GUI component that displays a two-dimensional view of WONDER sources and the speaker arrays. More...

#include <SourceDisplay.h>

Inheritance diagram for wonderjuce::SourceDisplay:
Inheritance graph
[legend]
Collaboration diagram for wonderjuce::SourceDisplay:
Collaboration graph
[legend]

Public Member Functions

 SourceDisplay (const String &componentName=String::empty, int dotSize=10, int roomLineThickness=2, const Colour roomColour=Colours::yellow, const Colour bgColour=Colours::black)
 Constructor. More...
 
virtual ~SourceDisplay ()
 Destructor. More...
 
void paint (Graphics &g)
 Overriding juce::Component::paint, this will fill the display with its background colour and draw the speaker arrays. More...
 
void setPositionDotSize (int diameter)
 Sets the size of the dot indicating the source's position. More...
 
int getPositionDotSize () const
 Returns the size of the dot indicating the source's position (diameter in pixels). More...
 
bool setRoom (std::shared_ptr< const wonder::Room > room)
 Sets the wonder::Room object that is used for painting the positions of the speaker arrays. More...
 
void setShowNames (bool showNames)
 Sets whether the names of the sources shall be shown next to them. More...
 
bool showsNames () const
 Returns the current showNames setting. More...
 
- Public Member Functions inherited from wonderjuce::ComponentWithFocusPoint
 ComponentWithFocusPoint (const String &componentName=String::empty)
 Constructor. More...
 
virtual ~ComponentWithFocusPoint ()
 Destructor. More...
 
virtual Point< float > getFocusPoint ()=0
 Returns the "focus point", the point where this component shall be auto-centered (for example, when it is zoomed into). More...
 
virtual float getFocusPointX ()=0
 Returns the x-coordinate of the "focus point". More...
 
virtual float getFocusPointY ()=0
 Returns the y-coordinate of the "focus point". More...
 

Protected Member Functions

void paintSource (Graphics &g, const wonder::Source &source, uint8_t alpha=0xFF)
 Paints a wonder::Source. More...
 

Detailed Description

An abstract class for a GUI component that displays a two-dimensional view of WONDER sources and the speaker arrays.

The methods of ComponentWithFocusPoint, desired reactions to mouse-actions must be implemented in a derived class. Also, this class does not actually paint any sources, it only offers a paintSource method that must be called from derived classes.

Constructor & Destructor Documentation

wonderjuce::SourceDisplay::SourceDisplay ( const String &  componentName = String::empty,
int  dotSize = 10,
int  roomLineThickness = 2,
const Colour  roomColour = Colours::yellow,
const Colour  bgColour = Colours::black 
)

Constructor.

Parameters
componentNameThe name of this component.
dotSizeThe size of the dot indicating the source's position (in pixels).
roomLineThicknessThe thickness of the line that indicates the speaker arrays (in pixels).
roomColourThe colour of the speaker arrays.
bgColourThe background colour.
wonderjuce::SourceDisplay::~SourceDisplay ( )
virtual

Destructor.

Member Function Documentation

int wonderjuce::SourceDisplay::getPositionDotSize ( ) const

Returns the size of the dot indicating the source's position (diameter in pixels).

Returns
The size of the dot indicating the source's position (diameter in pixels).
void wonderjuce::SourceDisplay::paint ( Graphics &  g)

Overriding juce::Component::paint, this will fill the display with its background colour and draw the speaker arrays.

In derived classes, this should be the called from their paint method before drawing any sources.

Parameters
gThe graphics context to be used for drawing.
See Also
juce::Component
void wonderjuce::SourceDisplay::paintSource ( Graphics &  g,
const wonder::Source source,
uint8_t  alpha = 0xFF 
)
protected

Paints a wonder::Source.

Can be called from the paint methods of derived classes to paint sources (at their position, with their colour etc.).

Parameters
gThe graphics context to be used for drawing.
sourceThe source to be painted.
alphaThe alpha-channel value for painting the source. This can be used for drawing semi-transparent sources.
void wonderjuce::SourceDisplay::setPositionDotSize ( int  diameter)

Sets the size of the dot indicating the source's position.

Various other sizes are determined by this (i.e. the size of the arrow indciating a plane wave source and the text size of the source names).

Parameters
diameterThe dot's diameter in pixels.
bool wonderjuce::SourceDisplay::setRoom ( std::shared_ptr< const wonder::Room room)

Sets the wonder::Room object that is used for painting the positions of the speaker arrays.

Parameters
roomA (reference-counted) shared pointer to the wonder::Room object used for painting the speaker arrays.
void wonderjuce::SourceDisplay::setShowNames ( bool  showNames)

Sets whether the names of the sources shall be shown next to them.

Parameters
showNamestrue if the names of the sources shall be shown next to them.
bool wonderjuce::SourceDisplay::showsNames ( ) const

Returns the current showNames setting.

If this is true, the names of the sources are shown.

Returns
The current showNames setting. If this is true, the names of the sources are shown.