moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kig / misc / calcpaths.h
blobc0971e875b51cc38dcb62b1a175e63dcb3da67df
1 // Copyright (C) 2002 Dominique Devriese <devriese@kde.org>
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
16 // 02111-1307, USA.
18 #ifndef KIG_MISC_CALCPATHS_H
19 #define KIG_MISC_CALCPATHS_H
21 #include "../objects/common.h"
23 /**
24 * This function sorts os such that they're in the right order for
25 * calc()-ing. This means that child objects must appear after their
26 * parents ( for you graph people, this is just a topological sort.. )
28 std::vector<ObjectCalcer*> calcPath( const std::vector<ObjectCalcer*>& os );
30 /**
31 * This is a different function for more or less the same purpose. It
32 * takes a few Objects, which are considered to have been calced
33 * already. Then, it puts the necessary part of their children in the
34 * right order, so that calc()-ing correctly updates all of their data
35 * ( they're calc'ed in the right order, i mean... ). The objects in
36 * from are normally not included in the output, unless they appear
37 * somewhere in the middle of the calc-path towards to...
39 std::vector<ObjectCalcer*> calcPath( const std::vector<ObjectCalcer*>& from, const ObjectCalcer* to );
41 /**
42 * This function returns all objects on the side of the path through
43 * the dependency tree from from down to to. This means that we look
44 * for any objects that don't depend on any of the objects in from
45 * themselves, but of which one of the direct children does. We need
46 * this function for Locus stuff...
48 std::vector<ObjectCalcer*> sideOfTreePath( const std::vector<ObjectCalcer*>& from, const ObjectCalcer* to );
50 /**
51 * This function returns all objects above the @p given in the
52 * dependency graph. The @p given objects are also included
53 * themselves..
55 std::vector<ObjectCalcer*> getAllParents( const std::vector<ObjectCalcer*>& objs );
56 /**
57 * @overload
59 std::vector<ObjectCalcer*> getAllParents( ObjectCalcer* obj );
61 /**
62 * This function returns all objects below the objects in objs in the
63 * dependency graphy. The objects in objs are also included
64 * themselves..
66 std::set<ObjectCalcer*> getAllChildren( const std::vector<ObjectCalcer*> objs );
68 /**
69 * @overload
71 std::set<ObjectCalcer*> getAllChildren( ObjectCalcer* obj );
73 /**
74 * Returns true if o is a descendant of any of the objects in os..
76 bool isChild( const ObjectCalcer* o, const std::vector<ObjectCalcer*>& os );
78 /**
79 * Return true if the given point is ( by construction ) on the given
80 * curve. This means that it is either a constrained point on the
81 * curve, or the curve is constructed through the point, or the point
82 * is an intersection point of the curve with another curve.
83 * Note that it is assumed that the given point is in fact a point and the
84 * given curve is in fact a curve.
86 bool isPointOnCurve( const ObjectCalcer* point, const ObjectCalcer* curve );
88 #endif