1 // File: SelectBasics_SortAlgo.cxx
2 // Created: Mon Apr 18 14:30:38 1994
3 // Author: Didier PIFFAULT
6 #include <SelectBasics_SortAlgo.ixx>
7 #include <TColStd_ListIteratorOfListOfInteger.hxx>
8 #include <TColStd_MapOfInteger.hxx>
9 #include <gp_Pnt2d.hxx>
11 //=======================================================================
12 //function : SelectBasics_SortAlgo
14 //=======================================================================
15 SelectBasics_SortAlgo::SelectBasics_SortAlgo()
19 //=======================================================================
20 //function : SelectBasics_SortAlgo
22 //=======================================================================
23 SelectBasics_SortAlgo::SelectBasics_SortAlgo
24 (const Bnd_Box2d& ClippingRectangle,
25 const Standard_Real sizeOfSensitiveArea,
26 const Handle_Bnd_HArray1OfBox2d& theRectangles)
27 : clipRect(ClippingRectangle), sizeArea(sizeOfSensitiveArea)
29 sortedRect.Initialize(clipRect, theRectangles);
32 //=======================================================================
33 //function : Initialize
35 //=======================================================================
36 void SelectBasics_SortAlgo::Initialize(const Bnd_Box2d& ClippingRectangle,
37 const Standard_Real sizeOfSensitiveArea,
38 const Handle_Bnd_HArray1OfBox2d& theRectangles)
40 clipRect=ClippingRectangle;
41 sizeArea=sizeOfSensitiveArea;
42 sortedRect.Initialize(clipRect, theRectangles);
45 //=======================================================================
48 //=======================================================================
49 void SelectBasics_SortAlgo::InitSelect(const Standard_Real x,
50 const Standard_Real y)
53 rep.Set(gp_Pnt2d(x, y));
54 rep.Enlarge(sizeArea);
56 TColStd_ListIteratorOfListOfInteger It(sortedRect.Compare(rep));
57 for(;It.More();It.Next()){
58 myMap.Add(It.Value());
60 curResult.Initialize(myMap);
63 //=======================================================================
66 //=======================================================================
67 void SelectBasics_SortAlgo::InitSelect(const Bnd_Box2d& rect)
70 TColStd_ListIteratorOfListOfInteger It(sortedRect.Compare(rect));
71 for(;It.More();It.Next()){
72 myMap.Add(It.Value());
74 curResult.Initialize(myMap);
78 //=======================================================================
81 //=======================================================================
82 Standard_Boolean SelectBasics_SortAlgo::More() const
84 return curResult.More();
87 //=======================================================================
90 //=======================================================================
91 void SelectBasics_SortAlgo::Next()
97 //=======================================================================
100 //=======================================================================
101 Standard_Integer SelectBasics_SortAlgo::Value() const
103 return curResult.Key();