OpenASIP 2.2
Loading...
Searching...
No Matches
SocketBusConnFigure.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 SocketBusConnFigure.cc
26 *
27 * Definition of SocketBusConnFigure 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 <vector>
35
36#include "Application.hh"
39
40const wxColour SocketBusConnFigure::DEFAULT_COLOUR = wxColour(0, 0, 0);
41
42/**
43 * The Constructor.
44 */
47
48/**
49 * The Destructor.
50 */
53
54/**
55 * Draws the connection's Figure on the given device context.
56 *
57 * @param dc The device context.
58 */
59void
61 assert(source_ != NULL && target_ != NULL);
62 wxPen pen = wxPen(DEFAULT_COLOUR, 1, wxSOLID);
63 wxBrush brush = wxBrush(DEFAULT_COLOUR, wxSOLID);
64 dc->SetPen(pen);
65 dc->SetBrush(brush);
67}
68
69
70/**
71 * Draws the connection's Figure on the give device context.
72 */
73void
75
76 int xOffset = source_->bounds().GetWidth()/2;
77 int yOffset = target_->bounds().GetHeight()/2;
78
79 // assumes that socket is always "source"
80 dc->DrawCircle(source_->location().x + xOffset,
81 target_->location().y + yOffset,
82 size_.GetWidth()/2);
83}
84
85
86/**
87 * Sets the figure's bounds.
88 */
89void
92 wxPoint(
93 source_->location().x,
94 target_->location().y +
95 (target_->bounds().GetHeight()/2) -
97 int size = std::max(std::min(source_->bounds().GetWidth(),
100 setWidth(size);
101 setHeight(size);
102
103}
#define assert(condition)
Figure * source_
Source of connection.
Figure * target_
Target of connection.
void setHeight(int height)
Definition Figure.cc:95
virtual wxRect bounds() const
void setWidth(int width)
Definition Figure.cc:81
wxSize size_
wxSize of the Figure's bounding rectangle.
Definition Figure.hh:86
wxPoint location() const
void setLocation(wxPoint point)
static const int BUS_SPACE
Space between buses and bus chains.
static const int SOCKET_WIDTH
Width of a socket.
virtual void drawSelf(wxDC *dc)
static const wxColour DEFAULT_COLOUR
Default colour for the figure.
virtual void drawConnection(wxDC *dc)
virtual void layoutSelf(wxDC *dc)