OpenASIP 2.2
Loading...
Searching...
No Matches
BridgeFigure.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file BridgeFigure.cc
26 *
27 * Definition of BridgeFigure class.
28 *
29 * @author Ari Metsähalme 2003 (ari.metsahalme-no.spam-tut.fi)
30 * @note rating: yellow
31 * @note reviewed Jul 27 2004 by ml, pj, am
32 */
33
34#include "BridgeFigure.hh"
36
37const wxColour BridgeFigure::DEFAULT_COLOUR = wxColour(0, 0, 0);
38const wxColour BridgeFigure::DEFAULT_BG_COLOUR = wxColour(150, 200, 255);
39
40/**
41 * The Constructor.
42 */
49
50/**
51 * The Destructor.
52 */
55
56/**
57 * Draws the bridge's Figure on the given device context.
58 *
59 * @param dc The device context.
60 */
61void
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}
static const wxColour DEFAULT_BG_COLOUR
Default colour for figure background.
static const wxColour DEFAULT_COLOUR
Default colour for figure lines.
virtual ~BridgeFigure()
Direction direction_
Direction of the bridge.
virtual void drawSelf(wxDC *dc)
wxSize size_
wxSize of the Figure's bounding rectangle.
Definition Figure.hh:86
wxPoint location_
Top-left location of the Figure's bounding rectangle.
Definition Figure.hh:84
static const int BRIDGE_WIDTH
Width of a bridge.
static const int BRIDGE_HEIGHT
Height of a bridge.