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

#include <BridgeFigure.hh>

Inheritance diagram for BridgeFigure:
Inheritance graph
Collaboration diagram for BridgeFigure:
Collaboration graph

Public Types

enum  Direction { DIR_RIGHT, DIR_LEFT, DIR_BIDIR }
 Direction of the bridge. More...
 

Public Member Functions

 BridgeFigure ()
 
virtual ~BridgeFigure ()
 
void setDirection (BridgeFigure::Direction direction)
 
Direction direction () const
 
- Public Member Functions inherited from ConnectionFigure
virtual ~ConnectionFigure ()
 
void setSource (Figure *figure)
 
void setTarget (Figure *figure)
 
Figuresource () const
 
Figuretarget () const
 
- 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 ConnectionFigure
 ConnectionFigure ()
 
- Protected Member Functions inherited from Figure
void drawChildren (wxDC *dc)
 
virtual void layoutSelf (wxDC *)
 
virtual void layoutChildren (wxDC *)
 

Private Member Functions

BridgeFigureoperator= (BridgeFigure &old)
 Assignment not allowed. More...
 
 BridgeFigure (BridgeFigure &old)
 Copying not allowed. More...
 

Private Attributes

Direction direction_
 Direction of the bridge. More...
 

Static Private Attributes

static const wxColour DEFAULT_COLOUR = wxColour(0, 0, 0)
 Default colour for figure lines. More...
 
static const wxColour DEFAULT_BG_COLOUR = wxColour(150, 200, 255)
 Default colour for figure background. More...
 

Additional Inherited Members

- Protected Attributes inherited from ConnectionFigure
Figuresource_
 Source of connection. More...
 
Figuretarget_
 Target of connection. More...
 
- 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 bridge.

Definition at line 46 of file BridgeFigure.hh.

Member Enumeration Documentation

◆ Direction

Direction of the bridge.

Enumerator
DIR_RIGHT 
DIR_LEFT 
DIR_BIDIR 

Definition at line 49 of file BridgeFigure.hh.

Constructor & Destructor Documentation

◆ BridgeFigure() [1/2]

BridgeFigure::BridgeFigure ( )

◆ ~BridgeFigure()

BridgeFigure::~BridgeFigure ( )
virtual

The Destructor.

Definition at line 53 of file BridgeFigure.cc.

53  {
54 }

◆ BridgeFigure() [2/2]

BridgeFigure::BridgeFigure ( BridgeFigure old)
private

Copying not allowed.

Member Function Documentation

◆ direction()

Direction BridgeFigure::direction ( ) const

◆ drawSelf()

void BridgeFigure::drawSelf ( wxDC *  dc)
protectedvirtual

Draws the bridge's Figure on the given device context.

Parameters
dcThe device context.

Reimplemented from Figure.

Reimplemented in BidirBridgeFigure.

Definition at line 62 of file BridgeFigure.cc.

62  {
63 
64  wxPen pen = wxPen(DEFAULT_COLOUR, 1, wxSOLID);
65  dc->SetPen(pen);
66  wxBrush brush = wxBrush(DEFAULT_BG_COLOUR, wxSOLID);
67  dc->SetBrush(brush);
68 
69  const unsigned int triangleWidth = 200;
70 
71  wxPoint trianglePoints[3];
72 
73  if (direction_ == DIR_RIGHT) {
74  trianglePoints[0] = wxPoint(
75  location_.x + size_.GetWidth() / 2 - triangleWidth / 2,
76  location_.y );
77  trianglePoints[1] = wxPoint(
78  trianglePoints[0].x + triangleWidth, location_.y);
79  trianglePoints[2] = wxPoint(
80  trianglePoints[0].x + triangleWidth / 2,
81  location_.y + size_.GetHeight());
82 
83  } else {
84  trianglePoints[0] = wxPoint(
85  location_.x + size_.GetWidth() / 2 - triangleWidth / 2,
86  location_.y + size_.GetHeight());
87  trianglePoints[1] = wxPoint(
88  trianglePoints[0].x + triangleWidth, trianglePoints[0].y);
89  trianglePoints[2] = wxPoint(
90  location_.x + size_.GetWidth() / 2, location_.y);
91  }
92 
93  dc->DrawPolygon(3, trianglePoints);
94 }

References DEFAULT_BG_COLOUR, DEFAULT_COLOUR, DIR_RIGHT, direction_, Figure::location_, and Figure::size_.

◆ operator=()

BridgeFigure& BridgeFigure::operator= ( BridgeFigure old)
private

Assignment not allowed.

◆ setDirection()

void BridgeFigure::setDirection ( BridgeFigure::Direction  direction)

Member Data Documentation

◆ DEFAULT_BG_COLOUR

const wxColour BridgeFigure::DEFAULT_BG_COLOUR = wxColour(150, 200, 255)
staticprivate

Default colour for figure background.

Definition at line 72 of file BridgeFigure.hh.

Referenced by drawSelf().

◆ DEFAULT_COLOUR

const wxColour BridgeFigure::DEFAULT_COLOUR = wxColour(0, 0, 0)
staticprivate

Default colour for figure lines.

Definition at line 70 of file BridgeFigure.hh.

Referenced by drawSelf().

◆ direction_

Direction BridgeFigure::direction_
private

Direction of the bridge.

Definition at line 67 of file BridgeFigure.hh.

Referenced by drawSelf().


The documentation for this class was generated from the following files:
BridgeFigure::DIR_BIDIR
@ DIR_BIDIR
Definition: BridgeFigure.hh:49
Figure::size_
wxSize size_
wxSize of the Figure's bounding rectangle.
Definition: Figure.hh:86
ConnectionFigure::ConnectionFigure
ConnectionFigure()
Definition: ConnectionFigure.cc:41
BridgeFigure::direction_
Direction direction_
Direction of the bridge.
Definition: BridgeFigure.hh:67
Figure::location_
wxPoint location_
Top-left location of the Figure's bounding rectangle.
Definition: Figure.hh:84
BridgeFigure::DIR_RIGHT
@ DIR_RIGHT
Definition: BridgeFigure.hh:49
BridgeFigure::DEFAULT_COLOUR
static const wxColour DEFAULT_COLOUR
Default colour for figure lines.
Definition: BridgeFigure.hh:70
MachineCanvasLayoutConstraints::BRIDGE_WIDTH
static const int BRIDGE_WIDTH
Width of a bridge.
Definition: MachineCanvasLayoutConstraints.hh:77
MachineCanvasLayoutConstraints::BRIDGE_HEIGHT
static const int BRIDGE_HEIGHT
Height of a bridge.
Definition: MachineCanvasLayoutConstraints.hh:79
BridgeFigure::DIR_LEFT
@ DIR_LEFT
Definition: BridgeFigure.hh:49
BridgeFigure::DEFAULT_BG_COLOUR
static const wxColour DEFAULT_BG_COLOUR
Default colour for figure background.
Definition: BridgeFigure.hh:72