1 // Created on: 1994-04-18
2 // Created by: Didier PIFFAULT
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <SelectBasics_SortAlgo.ixx>
18 #include <TColStd_ListIteratorOfListOfInteger.hxx>
19 #include <TColStd_MapOfInteger.hxx>
20 #include <gp_Pnt2d.hxx>
22 //=======================================================================
23 //function : SelectBasics_SortAlgo
25 //=======================================================================
26 SelectBasics_SortAlgo::SelectBasics_SortAlgo()
30 //=======================================================================
31 //function : SelectBasics_SortAlgo
33 //=======================================================================
34 SelectBasics_SortAlgo::SelectBasics_SortAlgo
35 (const Bnd_Box2d& ClippingRectangle,
36 const Standard_Real sizeOfSensitiveArea,
37 const Handle(Bnd_HArray1OfBox2d)& theRectangles)
38 : clipRect(ClippingRectangle), sizeArea(sizeOfSensitiveArea)
40 sortedRect.Initialize(clipRect, theRectangles);
43 //=======================================================================
44 //function : Initialize
46 //=======================================================================
47 void SelectBasics_SortAlgo::Initialize(const Bnd_Box2d& ClippingRectangle,
48 const Standard_Real sizeOfSensitiveArea,
49 const Handle(Bnd_HArray1OfBox2d)& theRectangles)
51 clipRect=ClippingRectangle;
52 sizeArea=sizeOfSensitiveArea;
53 sortedRect.Initialize(clipRect, theRectangles);
56 //=======================================================================
59 //=======================================================================
60 void SelectBasics_SortAlgo::InitSelect(const Standard_Real x,
61 const Standard_Real y)
64 rep.Set(gp_Pnt2d(x, y));
65 rep.Enlarge(sizeArea);
67 TColStd_ListIteratorOfListOfInteger It(sortedRect.Compare(rep));
68 for(;It.More();It.Next()){
69 myMap.Add(It.Value());
71 curResult.Initialize(myMap);
74 //=======================================================================
77 //=======================================================================
78 void SelectBasics_SortAlgo::InitSelect(const Bnd_Box2d& rect)
81 TColStd_ListIteratorOfListOfInteger It(sortedRect.Compare(rect));
82 for(;It.More();It.Next()){
83 myMap.Add(It.Value());
85 curResult.Initialize(myMap);
89 //=======================================================================
92 //=======================================================================
93 Standard_Boolean SelectBasics_SortAlgo::More() const
95 return curResult.More();
98 //=======================================================================
101 //=======================================================================
102 void SelectBasics_SortAlgo::Next()
108 //=======================================================================
111 //=======================================================================
112 Standard_Integer SelectBasics_SortAlgo::Value() const
114 return curResult.Key();