[105ed6]: src / interfaces / iconrouter.cpp  Maximize  Restore  History

Download this file

86 lines (67 with data), 2.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
Abstraction for the routing of a connection
Copyright (C) 2003-2004 by David Saxton <david@bluehaze.org>
Copyright (C) 2010 Julian B채ume <julian@svg4all.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "iconrouter.h"
#include <QPointF>
#include <QPainterPath>
#include <KDebug>
#include "idocumentscene.h"
using namespace KTechLab;
IConRouter::IConRouter()
{}
IConRouter::~IConRouter()
{}
void IConRouter::mapRoute(qreal sx, qreal sy, qreal ex, qreal ey)
{
mapRoute(QPointF(sx,sy),QPointF(ex,ey));
}
QPainterPath IConRouter::paintedRoute() const
{
QPainterPath p;
if (m_route.size() < 2)
return p;
QList<QPointF>::const_iterator end = m_route.constEnd();
QList<QPointF>::const_iterator it=m_route.constBegin();
p.moveTo(*it);
for ( ++it; it != end; ++it ){
p.lineTo(*it);
}
return p;
}
QList< QPointF > IConRouter::route() const
{
return m_route;
}
void IConRouter::setRoute(const QList< QPointF >& route)
{
if (m_route.size()>0) {
//this can happen, but in debug-mode, we should inform about it
kDebug() << "Overwriting non-empty route.";
}
m_route = route;
}
void IConRouter::setDocumentScene(IDocumentScene* scene)
{
m_documentScene = scene;
if (scene->routingInfo().isNull()){
generateRoutingInfo( scene );
}
}
QPixmap KTechLab::IConRouter::visualizedData(const QRectF &region) const
{
Q_UNUSED(region);
return QPixmap();
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks