1 // Created on: 1994-04-18
2 // Created by: Didier PIFFAULT
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #include <SelectBasics_SortAlgo.ixx>
23 #include <TColStd_ListIteratorOfListOfInteger.hxx>
24 #include <TColStd_MapOfInteger.hxx>
25 #include <gp_Pnt2d.hxx>
27 //=======================================================================
28 //function : SelectBasics_SortAlgo
30 //=======================================================================
31 SelectBasics_SortAlgo::SelectBasics_SortAlgo()
35 //=======================================================================
36 //function : SelectBasics_SortAlgo
38 //=======================================================================
39 SelectBasics_SortAlgo::SelectBasics_SortAlgo
40 (const Bnd_Box2d& ClippingRectangle,
41 const Standard_Real sizeOfSensitiveArea,
42 const Handle_Bnd_HArray1OfBox2d& theRectangles)
43 : clipRect(ClippingRectangle), sizeArea(sizeOfSensitiveArea)
45 sortedRect.Initialize(clipRect, theRectangles);
48 //=======================================================================
49 //function : Initialize
51 //=======================================================================
52 void SelectBasics_SortAlgo::Initialize(const Bnd_Box2d& ClippingRectangle,
53 const Standard_Real sizeOfSensitiveArea,
54 const Handle_Bnd_HArray1OfBox2d& theRectangles)
56 clipRect=ClippingRectangle;
57 sizeArea=sizeOfSensitiveArea;
58 sortedRect.Initialize(clipRect, theRectangles);
61 //=======================================================================
64 //=======================================================================
65 void SelectBasics_SortAlgo::InitSelect(const Standard_Real x,
66 const Standard_Real y)
69 rep.Set(gp_Pnt2d(x, y));
70 rep.Enlarge(sizeArea);
72 TColStd_ListIteratorOfListOfInteger It(sortedRect.Compare(rep));
73 for(;It.More();It.Next()){
74 myMap.Add(It.Value());
76 curResult.Initialize(myMap);
79 //=======================================================================
82 //=======================================================================
83 void SelectBasics_SortAlgo::InitSelect(const Bnd_Box2d& rect)
86 TColStd_ListIteratorOfListOfInteger It(sortedRect.Compare(rect));
87 for(;It.More();It.Next()){
88 myMap.Add(It.Value());
90 curResult.Initialize(myMap);
94 //=======================================================================
97 //=======================================================================
98 Standard_Boolean SelectBasics_SortAlgo::More() const
100 return curResult.More();
103 //=======================================================================
106 //=======================================================================
107 void SelectBasics_SortAlgo::Next()
113 //=======================================================================
116 //=======================================================================
117 Standard_Integer SelectBasics_SortAlgo::Value() const
119 return curResult.Key();