OpenASIP  2.0
Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
MoveFigure Class Reference

#include <MoveFigure.hh>

Inheritance diagram for MoveFigure:
Inheritance graph
Collaboration diagram for MoveFigure:
Collaboration graph

Public Member Functions

 MoveFigure (Figure *bus, Figure *source, Figure *target)
 
virtual ~MoveFigure ()
 
- Public Member Functions inherited from Figure
 Figure ()
 
virtual ~Figure ()
 
wxPoint location () const
 
void setLocation (wxPoint point)
 
void setX (int x)
 
void setY (int y)
 
void setPreferredX (int x)
 
bool xSet () const
 
void clearXSetFlag ()
 
virtual wxRect bounds () const
 
virtual wxRect virtualBounds () const
 
void setBounds (wxSize bounds)
 
void setWidth (int width)
 
void setHeight (int height)
 
virtual void addChild (Figure *child)
 
int childCount () const
 
Figurechild (int index) const
 
virtual void layout (wxDC *dc)
 
virtual void draw (wxDC *dc)
 
void highlight (const wxColour &colour)
 
void clearHighlight ()
 
void setOptions (MachineCanvasOptions *options)
 
MachineCanvasOptionsoptions ()
 

Protected Member Functions

virtual void drawSelf (wxDC *dc)
 
- Protected Member Functions inherited from Figure
void drawChildren (wxDC *dc)
 
virtual void layoutSelf (wxDC *)
 
virtual void layoutChildren (wxDC *)
 

Private Attributes

Figurebus_
 Figure of the bus where the move is done. More...
 
Figuresource_
 Figure of the source port. More...
 
Figuretarget_
 Figure of the TargetPort. More...
 

Static Private Attributes

static const wxColour DEFAULT_COLOUR = wxColour(255, 255, 0)
 Default colour of the figure. More...
 

Additional Inherited Members

- Protected Attributes inherited from Figure
wxPoint location_
 Top-left location of the Figure's bounding rectangle. More...
 
wxSize size_
 wxSize of the Figure's bounding rectangle. More...
 
wxSize minSize_
 Figure's minimum size. More...
 
std::vector< Figure * > children_
 Figure's children. More...
 
bool xSet_
 Tells if x-coordinate has been fixed. More...
 
bool laidOut_
 Tells whether the Figure and its children have been laid out or not. More...
 
bool drawn_
 Tells whether the Figure and its children have been drawn or not. More...
 
wxColour highlight_
 Highlight colour. More...
 
bool highlighted_
 Tells if the figure is highlighted. More...
 
MachineCanvasOptionsoptions_
 Options which are used for customizing figures. More...
 

Detailed Description

Figure of a move.

Definition at line 41 of file MoveFigure.hh.

Constructor & Destructor Documentation

◆ MoveFigure()

MoveFigure::MoveFigure ( Figure bus,
Figure source,
Figure target 
)

The Constructor.

Parameters
busFigure of the bus which transports the move.
sourceFigure of the source port of the move.
targetFigure of the target port of the move.

Definition at line 45 of file MoveFigure.cc.

45  :
46  Figure(), bus_(bus), source_(source), target_(target) {
47 
48  laidOut_ = true;
49 }

References Figure::laidOut_.

◆ ~MoveFigure()

MoveFigure::~MoveFigure ( )
virtual

The Destructor.

Definition at line 55 of file MoveFigure.cc.

55  {
56 }

Member Function Documentation

◆ drawSelf()

void MoveFigure::drawSelf ( wxDC *  dc)
protectedvirtual

Draws the move figure on a device context.

Parameters
dcDevice context where to draw the figure.

Reimplemented from Figure.

Definition at line 65 of file MoveFigure.cc.

65  {
66 
67  assert(bus_ != NULL);
68 
69  wxPen pen = wxPen(DEFAULT_COLOUR, 4, wxSOLID);
70  wxBrush brush = wxBrush(DEFAULT_COLOUR, wxSOLID);
71  dc->SetPen(pen);
72  dc->SetBrush(brush);
73 
75  int busY = bus_->location().y + bus_->bounds().GetHeight()/2;
76 
77  int sourceX = 0;
78  int targetX = 0;
79 
80  // Draw source port -> bus line.
81  if (source_ != NULL) {
82  sourceX = source_->location().x + source_->bounds().GetWidth()/2;
83  int sourceY = source_->location().y + offset * 2;
84  dc->DrawLine(sourceX, sourceY, sourceX, busY);
85  int size = std::max(
86  std::min(source_->bounds().GetWidth(),
89  dc->DrawCircle(sourceX, busY, size/2);
90  }
91 
92  // Draw bus -> target port line.
93  if (target_ != NULL) {
94  targetX = target_->location().x + target_->bounds().GetWidth()/2;
95  int targetY = target_->location().y + offset * 2;
96  dc->DrawLine(targetX, targetY, targetX, busY);
97  int size = std::max(
98  std::min(target_->bounds().GetWidth(),
101  dc->DrawCircle(targetX, busY, size/2);
102  }
103 
104  // Draw line on the bus.
105  if (target_ != NULL && source_ != NULL) {
106  dc->DrawLine(sourceX, busY, targetX, busY);
107  } else {
108  // Source or target missing. Draw move over the whole bus.
109  sourceX = bus_->location().x;
110  targetX = bus_->location().x + bus_->bounds().GetWidth();
111  dc->DrawLine(sourceX, busY, targetX, busY);
112  }
113 }

References assert, Figure::bounds(), bus_, MachineCanvasLayoutConstraints::BUS_SPACE, DEFAULT_COLOUR, Figure::location(), MachineCanvasLayoutConstraints::PORT_WIDTH, MachineCanvasLayoutConstraints::SOCKET_WIDTH, source_, and target_.

Here is the call graph for this function:

Member Data Documentation

◆ bus_

Figure* MoveFigure::bus_
private

Figure of the bus where the move is done.

Definition at line 53 of file MoveFigure.hh.

Referenced by drawSelf().

◆ DEFAULT_COLOUR

const wxColour MoveFigure::DEFAULT_COLOUR = wxColour(255, 255, 0)
staticprivate

Default colour of the figure.

Definition at line 51 of file MoveFigure.hh.

Referenced by drawSelf().

◆ source_

Figure* MoveFigure::source_
private

Figure of the source port.

Definition at line 55 of file MoveFigure.hh.

Referenced by drawSelf().

◆ target_

Figure* MoveFigure::target_
private

Figure of the TargetPort.

Definition at line 57 of file MoveFigure.hh.

Referenced by drawSelf().


The documentation for this class was generated from the following files:
Figure::bounds
virtual wxRect bounds() const
Figure::laidOut_
bool laidOut_
Tells whether the Figure and its children have been laid out or not.
Definition: Figure.hh:95
MoveFigure::source_
Figure * source_
Figure of the source port.
Definition: MoveFigure.hh:55
MachineCanvasLayoutConstraints::SOCKET_WIDTH
static const int SOCKET_WIDTH
Width of a socket.
Definition: MachineCanvasLayoutConstraints.hh:59
Figure::location
wxPoint location() const
MoveFigure::bus_
Figure * bus_
Figure of the bus where the move is done.
Definition: MoveFigure.hh:53
assert
#define assert(condition)
Definition: Application.hh:86
MoveFigure::target_
Figure * target_
Figure of the TargetPort.
Definition: MoveFigure.hh:57
MoveFigure::DEFAULT_COLOUR
static const wxColour DEFAULT_COLOUR
Default colour of the figure.
Definition: MoveFigure.hh:51
MachineCanvasLayoutConstraints::PORT_WIDTH
static const int PORT_WIDTH
Default Width of a port.
Definition: MachineCanvasLayoutConstraints.hh:51
MachineCanvasLayoutConstraints::BUS_SPACE
static const int BUS_SPACE
Space between buses and bus chains.
Definition: MachineCanvasLayoutConstraints.hh:75
Figure::Figure
Figure()
Definition: Figure.cc:44