1 // Copyright (C) 2006-2008 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library 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 GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef _LINKMATRIX_HXX_
20 #define _LINKMATRIX_HXX_
39 class AbstractSceneItem;
41 class SceneComposedNodeItem;
48 LNode(int x, int y) : _x(x), _y(y) {};
49 LNode(std::pair<int,int> m) : _x(m.first), _y(m.second) {};
51 inline int getX() const {return _x; };
52 inline int getY() const {return _y; };
53 inline std::pair<int,int> getPos() const { return std::pair<int,int>(_x, _y); };
54 inline bool isEqual(const LNode& o) const { return ((_x == o._x) && (_y == o._y)); };
55 double distance(const LNode& o) const;
61 typedef std::list<LNode> LNodePath;
65 std::pair<int,int> from;
66 std::pair<int,int> to;
67 YACS::HMI::SceneLinkItem* item;
76 typedef std::list<linkPoint> LinkPath;
81 LinkMatrix(SceneComposedNodeItem* bloc);
82 virtual ~LinkMatrix();
84 void explore(AbstractSceneItem *child, bool setObstacle=false);
85 void defineCost(AbstractSceneItem *child);
86 void getBoundingBox(SceneItem *obstacle, int margin, bool setObstacle=false);
87 std::pair<int,int> cellFrom(YACS::ENGINE::OutPort* outp);
88 std::pair<int,int> cellFrom(YACS::ENGINE::OutGate* outp);
89 std::pair<int,int> cellTo(YACS::ENGINE::InPort* inp);
90 std::pair<int,int> cellTo(YACS::ENGINE::InGate* inp);
91 std::list<linkdef> getListOfCtrlLinkDef();
92 std::list<linkdef> getListOfDataLinkDef();
93 LinkPath getPath(LNodePath lnp);
95 int cost(int i, int j) const;
96 inline int imax() const { return _im; };
97 inline int jmax() const { return _jm; };
100 SceneComposedNodeItem* _bloc;
103 std::set<double> _sxm;
104 std::set<double> _sym;
105 std::vector<double> _xm;
106 std::vector<double> _ym;
107 std::map<double,int> _x2i;
108 std::map<double,int> _y2j;
109 std::vector<int> _cost;
110 QtGuiContext* _context;