Minsky
lasso.cc
Go to the documentation of this file.
1 /*
2  @copyright Steve Keen 2021
3  @author Russell Standish
4  This file is part of Minsky.
5 
6  Minsky is free software: you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Minsky is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Minsky. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "item.h"
21 #include "lasso.h"
22 #include "port.h"
23 #include "wire.h"
24 #include "lasso.rcd"
25 #include "minsky_epilogue.h"
26 
27 #include <utility>
28 
29 minsky::LassoBox::LassoBox(float x0, float y0, float x1, float y1):
30  x0(x0), y0(y0), x1(x1), y1(y1)
31 {
32  if (x0>x1) std::swap(this->x0,this->x1);
33  if (y0>y1) std::swap(this->y0,this->y1);
34 }
35 
36 
38 {
39  // Make sure both ends of wires are selected in all cases. For ticket 1147
40  return (intersects(wire.from()->item()) && intersects(wire.to()->item()));
41 }
42 
44 
represents rectangular region of a lasso operation
Definition: lasso.h:28
bool contains(const Wire &wire) const
return true if both endpoints of the wire lie within the lasso
Definition: lasso.cc:37
float x0
Definition: lasso.h:30
CLASSDESC_ACCESS_EXPLICIT_INSTANTIATION(minsky::LassoBox)
float y1
Definition: lasso.h:30
float x1
Definition: lasso.h:30
float y0
Definition: lasso.h:30