Warning, file /office/calligra/libs/flake/KoConnectionPoint.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * 
0003  * Copyright (C) 2011 Jan Hambrecht <jaham@gmx.net>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 
0021 #include "KoConnectionPoint.h"
0022 
0023 KoConnectionPoint::KoConnectionPoint()
0024 : position(0, 0), escapeDirection(AllDirections), alignment(AlignNone)
0025 {
0026 }
0027 
0028 KoConnectionPoint::KoConnectionPoint(const QPointF& pos)
0029 : position(pos), escapeDirection(AllDirections), alignment(AlignNone)
0030 {
0031 }
0032 
0033 KoConnectionPoint::KoConnectionPoint(const QPointF& pos, EscapeDirection direction)
0034 : position(pos), escapeDirection(direction), alignment(AlignNone)
0035 {
0036 }
0037 
0038 KoConnectionPoint::KoConnectionPoint(const QPointF &pos, EscapeDirection direction, Alignment alignment)
0039 : position(pos), escapeDirection(direction), alignment(alignment)
0040 {
0041 }
0042 
0043 KoConnectionPoint KoConnectionPoint::defaultConnectionPoint(PointId connectionPointId)
0044 {
0045     switch(connectionPointId)
0046     {
0047         case TopConnectionPoint:
0048             return KoConnectionPoint(QPointF(0.5, 0.0));
0049         case RightConnectionPoint:
0050             return KoConnectionPoint(QPointF(1.0, 0.5));
0051         case BottomConnectionPoint:
0052             return KoConnectionPoint(QPointF(0.5, 1.0));
0053         case LeftConnectionPoint:
0054             return KoConnectionPoint(QPointF(0.0, 0.5));
0055         default:
0056             return KoConnectionPoint();
0057     }
0058 }