+++ /dev/null
-// Created on: 1993-03-08
-// Created by: Didier PIFFAULT
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Bnd_Array1OfBox.hxx>
-#include <Bnd_BoundSortBox2d.hxx>
-#include <Bnd_Box2d.hxx>
-#include <Standard_MultiplyDefined.hxx>
-#include <Standard_NullValue.hxx>
-#include <TColStd_Array1OfListOfInteger.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
-
-//=======================================================================
-//function : Bnd_BoundSortBox2d
-//purpose :
-//=======================================================================
-Bnd_BoundSortBox2d::Bnd_BoundSortBox2d()
- : discrX(0), discrY(0)
-{}
-
-
-//=======================================================================
-//function : Initialize
-//purpose :
-//=======================================================================
-
-void Bnd_BoundSortBox2d::Initialize(const Bnd_Box2d& CompleteBox,
- const Handle(Bnd_HArray1OfBox2d)& SetOfBox)
-{
- myBox=CompleteBox;
- myBndComponents=SetOfBox;
- discrX=SetOfBox->Length();
- discrY=discrX;
-
- Standard_Real xmin, ymin, xmax, ymax;
- Standard_Real middleX=0.;
- Standard_Real middleY=0.;
-
- const Bnd_Array1OfBox2d & taBox=myBndComponents->Array1();
-
- Standard_Integer labox;
- for (labox=taBox.Lower(); labox<=taBox.Upper(); labox++) {
- if (!taBox(labox).IsVoid()) {
- taBox.Value(labox).Get(xmin, ymin, xmax, ymax);
- middleX+=xmax-xmin;
- middleY+=ymax-ymin;
- }
- }
- middleX=middleX/taBox.Length();
- middleY=middleY/taBox.Length();
-
- Standard_Real Xmax, Ymax;
- CompleteBox.Get(Xmin, Ymin, Xmax, Ymax);
- deltaX=(Xmax-Xmin)/(Standard_Real)discrX;
- deltaY=(Ymax-Ymin)/(Standard_Real)discrY;
-
- if (middleX < Epsilon(100.)) {
- discrX=1;
- deltaX=Xmax-Xmin;
- }
- else if (middleX > deltaX) {
- discrX=(Standard_Integer)((Xmax-Xmin)/middleX);
- deltaX=middleX;
- discrX++;
- }
-
- if (middleY < Epsilon(100.)) {
- discrY=1;
- deltaY=Ymax-Ymin;
- }
- else if (middleY > deltaY) {
- discrY=(Standard_Integer)((Ymax-Ymin)/middleY + 0.1);
- deltaY=middleY;
- discrY++;
- }
-
- SortBoxes();
-}
-
-//=======================================================================
-//function : Initialize
-//purpose :
-//=======================================================================
-
-void Bnd_BoundSortBox2d::Initialize(const Handle(Bnd_HArray1OfBox2d)& SetOfBox)
-{
- myBndComponents=SetOfBox;
- discrX=SetOfBox->Length();
- discrY=discrX;
-
- Standard_Real xmin, ymin, xmax, ymax;
- Standard_Real middleX=0.;
- Standard_Real middleY=0.;
-
- const Bnd_Array1OfBox2d & taBox=myBndComponents->Array1();
-
- Standard_Integer labox;
- for (labox=taBox.Lower(); labox<=taBox.Upper(); labox++) {
- if (!taBox(labox).IsVoid()) {
- myBox.Add(taBox(labox));
- taBox.Value(labox).Get(xmin, ymin, xmax, ymax);
- middleX+=xmax-xmin;
- middleY+=ymax-ymin;
- }
- }
- middleX=middleX/taBox.Length();
- middleY=middleY/taBox.Length();
-
- Standard_Real Xmax, Ymax;
- myBox.Get(Xmin, Ymin, Xmax, Ymax);
- deltaX=(Xmax-Xmin)/(Standard_Real)discrX;
- deltaY=(Ymax-Ymin)/(Standard_Real)discrY;
-
- if (middleX < Epsilon(100.)) {
- discrX=1;
- deltaX=Xmax-Xmin;
- }
- else if (middleX > deltaX) {
- discrX=(Standard_Integer)((Xmax-Xmin)/middleX);
- deltaX=middleX;
- discrX++;
- }
-
- if (middleY < Epsilon(100.)) {
- discrY=1;
- deltaY=Ymax-Ymin;
- }
- else if (middleY > deltaY) {
- discrY=(Standard_Integer)((Ymax-Ymin)/middleY + 0.1);
- deltaY=middleY;
- discrY++;
- }
-
- SortBoxes();
-}
-
-
-//=======================================================================
-//function : SortBoxes
-//purpose :
-//=======================================================================
-
-void Bnd_BoundSortBox2d::SortBoxes()
-{
- Standard_NullValue_Raise_if (discrX+discrY <=0, "BoundSortBox2d nul!");
-
- Standard_Integer labox, lacase, firstcase, lastcase;
- Standard_Real xmin, ymin, xmax, ymax;
- const Bnd_Array1OfBox2d & taBox=myBndComponents->Array1();
-
- axisX=new TColStd_HArray1OfListOfInteger(1, discrX);
- TColStd_Array1OfListOfInteger & tabListX=axisX->ChangeArray1();
-
- axisY=new TColStd_HArray1OfListOfInteger(1, discrY);
- TColStd_Array1OfListOfInteger & tabListY=axisY->ChangeArray1();
-
- for (labox=taBox.Lower(); labox<=taBox.Upper(); labox++) {
- if (!taBox(labox).IsVoid()) {
- taBox(labox).Get(xmin, ymin, xmax, ymax);
-
- if (discrX>1) {
- firstcase=(Standard_Integer ) Max(1.0, (xmin-Xmin)/deltaX);
- lastcase=(Standard_Integer ) Min((Standard_Real)discrX, ((xmax-Xmin)/deltaX)+1);
- for (lacase=firstcase; lacase<=lastcase; lacase++) {
- tabListX(lacase).Append(labox);
- }
- }
-
- if (discrY >1) {
- firstcase=(Standard_Integer ) Max(1.0, (ymin-Ymin)/deltaY);
- lastcase=(Standard_Integer ) Min((Standard_Real)discrY, ((ymax-Ymin)/deltaY)+1);
- for (lacase=firstcase; lacase<=lastcase; lacase++) {
- tabListY(lacase).Append(labox);
- }
- }
- }
- }
-}
-
-//=======================================================================
-//function : Initialize
-//purpose :
-//=======================================================================
-
-void Bnd_BoundSortBox2d::Initialize(const Bnd_Box2d& CompleteBox,
- const Standard_Integer nbComponents)
-{
- Standard_NullValue_Raise_if (nbComponents <=0, "BoundSortBox nul!");
-
- myBox=CompleteBox;
- myBndComponents=new Bnd_HArray1OfBox2d(1, nbComponents);
-
- Bnd_Box2d emptyBox;
- myBndComponents->Init( emptyBox );
-
- discrX=nbComponents;
- discrY=nbComponents;
-
- Standard_Real Xmax, Ymax;
- CompleteBox.Get(Xmin, Ymin, Xmax, Ymax);
-
- deltaX=(Xmax-Xmin)/(Standard_Real)discrX;
- deltaY=(Ymax-Ymin)/(Standard_Real)discrY;
-
- if (deltaX < Epsilon(100.)) {
- discrX=1;
- deltaX=Xmax-Xmin;
- }
- else axisX=new TColStd_HArray1OfListOfInteger(1, discrX);
-
- if (deltaY < Epsilon(100.)) {
- discrY=1;
- deltaY=Ymax-Ymin;
- }
- else axisY=new TColStd_HArray1OfListOfInteger(1, discrY);
-}
-
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-
-void Bnd_BoundSortBox2d::Add(const Bnd_Box2d& theBox,
- const Standard_Integer boxIndex)
-{
- Standard_MultiplyDefined_Raise_if
- (!(myBndComponents->Value(boxIndex).IsVoid()),
- " This box is already defined !");
-
- if (!theBox.IsVoid()) {
- Bnd_Array1OfBox2d & taBox=myBndComponents->ChangeArray1();
- Standard_Integer theGap, firstGap , lastGap;
- Standard_Real xmin, ymin, xmax, ymax;
- theBox.Get(xmin, ymin, xmax, ymax);
-
- if (taBox.Lower()<=boxIndex && boxIndex<=taBox.Upper())
- taBox(boxIndex).Update(xmin, ymin, xmax, ymax);
-
- TColStd_Array1OfListOfInteger & tabListX=axisX->ChangeArray1();
-
- if (discrX>1) {
- firstGap=(Standard_Integer ) Max(1.0, ((xmin-Xmin)/deltaX)+1);
- lastGap=(Standard_Integer ) Min((Standard_Real)discrX, ((xmax-Xmin)/deltaX)+1);
- for (theGap=firstGap; theGap<=lastGap; theGap++) {
- tabListX(theGap).Append(boxIndex);
- }
- }
-
- TColStd_Array1OfListOfInteger & tabListY=axisY->ChangeArray1();
-
- if (discrY >1) {
- firstGap=(Standard_Integer ) Max(1.0, ((ymin-Ymin)/deltaY)+1);
- lastGap=(Standard_Integer ) Min((Standard_Real)discrY, ((ymax-Ymin)/deltaY)+1);
- for (theGap=firstGap; theGap<=lastGap; theGap++) {
- tabListY(theGap).Append(boxIndex);
- }
- }
- }
-}
-
-
-//=======================================================================
-//function : Compare
-//purpose :
-//=======================================================================
-
-
-const TColStd_ListOfInteger& Bnd_BoundSortBox2d::Compare
- (const Bnd_Box2d& theBox)
-{
- Standard_NullValue_Raise_if (discrX+discrY <=0,
- "Compare sur 1 BoundSortBox2d nul!");
-
- lastResult.Clear();
- if (theBox.IsVoid()) return lastResult;
- if (theBox.IsOut(myBox)) return lastResult;
-
- Standard_Integer lacase, firstcase, lastcase;
- Standard_Real xmin, ymin, xmax, ymax;
- theBox.Get(xmin, ymin, xmax, ymax);
-
- const Bnd_Array1OfBox2d & taBox=myBndComponents->Array1();
- Crible.Clear();
- theFound=2;
-
- Standard_Integer cardY=0;
- if (discrY>1 && (!theBox.IsOpenYmin() || !theBox.IsOpenYmax())) {
- const TColStd_Array1OfListOfInteger & tabList=axisY->Array1();
- firstcase=(Standard_Integer ) Max(1.0, (ymin-Ymin)/deltaY);
- lastcase=(Standard_Integer ) Min((Standard_Real)discrY, ((ymax-Ymin)/deltaY)+1);
- for (lacase=firstcase; lacase<=lastcase; lacase++) {
- TColStd_ListIteratorOfListOfInteger theList(tabList(lacase));
- for (; theList.More(); theList.Next()) {
- cardY++;
- Crible.Bind(theList.Value(), 2);
- }
- }
- if (cardY==0) return lastResult;
- }
- else {
- if (ymin > Ymin+deltaY || ymax < Ymin)
- return lastResult;
- theFound-=2;
- }
-
- if (discrX>1 && (!theBox.IsOpenXmin() || !theBox.IsOpenXmax())) {
- const TColStd_Array1OfListOfInteger & tabList=axisX->Array1();
- firstcase=(Standard_Integer ) Max(1.0, (xmin-Xmin)/deltaX);
- lastcase=(Standard_Integer ) Min((Standard_Real)discrX, ((xmax-Xmin)/deltaX)+1);
- for (lacase=firstcase; lacase<=lastcase; lacase++) {
- TColStd_ListIteratorOfListOfInteger theList(tabList(lacase));
- for (; theList.More(); theList.Next()) {
- if (Crible.IsBound(theList.Value())) {
- if (Crible(theList.Value())==theFound) {
- if (!taBox.Value(theList.Value()).IsOut(theBox)){
- lastResult.Append(theList.Value());
- Crible(theList.Value())=0;
- }
- }
- }
- }
- }
- return lastResult;
- }
-
- else {
- if (xmin > Xmin+deltaX || xmax < Xmin) return lastResult;
- else if (discrY==1)
- {
- lacase=1;
- for(Standard_Integer i=taBox.Lower();i<=taBox.Upper();i++)
- {
- lastResult.Append(i);
- }
- }
- else{
-
- TColStd_DataMapIteratorOfDataMapOfIntegerInteger itDM(Crible);
- for (; itDM.More(); itDM.Next()) {
- if (itDM.Value()==theFound) {
- if (taBox.Lower()<=itDM.Key() && itDM.Key()<=taBox.Upper()) {
- if (!taBox(itDM.Key()).IsOut(theBox))
- lastResult.Append(itDM.Key());
- }
- else {
- lastResult.Append(itDM.Key());
- }
- }
- }
- }
- }
- return lastResult;
-}
-
-
-//=======================================================================
-//function : Dump
-//purpose :
-//=======================================================================
-
-void Bnd_BoundSortBox2d::Dump() const
-{
- Standard_Integer lacase;
-
- std::cout << "axis X : " << discrX << " intervalles de " << deltaX << std::endl;
- if (discrX>1) {
- const TColStd_Array1OfListOfInteger & tabList=axisX->Array1();
- for (lacase=1; lacase<=discrX; lacase++) {
- std::cout << " X " << lacase << " : " ;
- TColStd_ListIteratorOfListOfInteger theList(tabList(lacase));
- for (; theList.More(); theList.Next()) {
- std::cout << theList.Value() << " ";
- }
- std::cout << "\n";
- }
- }
-
- std::cout << "axis Y : " << discrY << " intervalles de " << deltaY << std::endl;
- if (discrY>1) {
- const TColStd_Array1OfListOfInteger & tabList=axisY->Array1();
- for (lacase=1; lacase<=discrY; lacase++) {
- std::cout << " Y " << lacase << " : " ;
- TColStd_ListIteratorOfListOfInteger theList(tabList(lacase));
- for (; theList.More(); theList.Next()) {
- std::cout << theList.Value() << " ";
- }
- std::cout << "\n";
- }
- }
-}
+++ /dev/null
-// Created on: 1993-03-05
-// Created by: Didier PIFFAULT
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _Bnd_BoundSortBox2d_HeaderFile
-#define _Bnd_BoundSortBox2d_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Bnd_HArray1OfBox2d.hxx>
-#include <Standard_Integer.hxx>
-#include <TColStd_HArray1OfListOfInteger.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <TColStd_ListOfInteger.hxx>
-
-
-//! A tool to compare a 2D bounding box with a set of 2D
-//! bounding boxes. It sorts the set of bounding boxes to give
-//! the list of boxes which intersect the element being compared.
-//! The boxes being sorted generally bound a set of shapes,
-//! while the box being compared bounds a shape to be
-//! compared. The resulting list of intersecting boxes therefore
-//! gives the list of items which potentially intersect the shape to be compared.
-class Bnd_BoundSortBox2d
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Constructs an empty comparison algorithm for 2D bounding boxes.
- //! The bounding boxes are then defined using the Initialize function.
- Standard_EXPORT Bnd_BoundSortBox2d();
-
- //! Initializes this comparison algorithm with
- //! - the set of 2D bounding boxes SetOfBox
- Standard_EXPORT void Initialize (const Bnd_Box2d& CompleteBox, const Handle(Bnd_HArray1OfBox2d)& SetOfBox);
-
- //! Initializes this comparison algorithm with
- //! - the set of 2D bounding boxes SetOfBox, where
- //! CompleteBox is given as the global bounding box of SetOfBox.
- Standard_EXPORT void Initialize (const Handle(Bnd_HArray1OfBox2d)& SetOfBox);
-
- //! Initializes this comparison algorithm, giving it only
- //! - the maximum number nbComponents, and
- //! - the global bounding box CompleteBox,
- //! of the 2D bounding boxes to be managed. Use the Add
- //! function to define the array of bounding boxes to be sorted by this algorithm.
- Standard_EXPORT void Initialize (const Bnd_Box2d& CompleteBox, const Standard_Integer nbComponents);
-
- //! Adds the 2D bounding box theBox at position boxIndex in
- //! the array of boxes to be sorted by this comparison algorithm.
- //! This function is used only in conjunction with the third
- //! syntax described in the synopsis of Initialize.
- //! Exceptions
- //! - Standard_OutOfRange if boxIndex is not in the
- //! range [ 1,nbComponents ] where
- //! nbComponents is the maximum number of bounding
- //! boxes declared for this comparison algorithm at
- //! initialization.
- //! - Standard_MultiplyDefined if a box still exists at
- //! position boxIndex in the array of boxes to be sorted by
- //! this comparison algorithm.
- Standard_EXPORT void Add (const Bnd_Box2d& theBox, const Standard_Integer boxIndex);
-
-
- //! Compares the 2D bounding box theBox with the set of
- //! bounding boxes to be sorted by this comparison algorithm,
- //! and returns the list of intersecting bounding boxes as a list
- //! of indexes on the array of bounding boxes used by this algorithm.
- Standard_EXPORT const TColStd_ListOfInteger& Compare (const Bnd_Box2d& theBox);
-
- Standard_EXPORT void Dump() const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
- //! Prepares BoundSortBox2d and sorts the rectangles of
- //! <SetOfBox> .
- Standard_EXPORT void SortBoxes();
-
-
- Bnd_Box2d myBox;
- Handle(Bnd_HArray1OfBox2d) myBndComponents;
- Standard_Real Xmin;
- Standard_Real Ymin;
- Standard_Real deltaX;
- Standard_Real deltaY;
- Standard_Integer discrX;
- Standard_Integer discrY;
- Handle(TColStd_HArray1OfListOfInteger) axisX;
- Handle(TColStd_HArray1OfListOfInteger) axisY;
- Standard_Integer theFound;
- TColStd_DataMapOfIntegerInteger Crible;
- TColStd_ListOfInteger lastResult;
-
-
-};
-
-
-
-
-
-
-
-#endif // _Bnd_BoundSortBox2d_HeaderFile
+++ /dev/null
-// Created on: 1994-02-08
-// Created by: Gilles DEBARBOUILLE
-// Copyright (c) 1994-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _Quantity_PhysicalQuantity_HeaderFile
-#define _Quantity_PhysicalQuantity_HeaderFile
-
-//! List of all physical quantities(Afnor)
-enum Quantity_PhysicalQuantity
-{
-Quantity_MASS,
-Quantity_PLANEANGLE,
-Quantity_SOLIDANGLE,
-Quantity_LENGTH,
-Quantity_AREA,
-Quantity_VOLUME,
-Quantity_SPEED,
-Quantity_VELOCITY,
-Quantity_ACCELERATION,
-Quantity_ANGULARVELOCITY,
-Quantity_FREQUENCY,
-Quantity_TEMPERATURE,
-Quantity_AMOUNTOFSUBSTANCE,
-Quantity_DENSITY,
-Quantity_MASSFLOW,
-Quantity_VOLUMEFLOW,
-Quantity_CONSUMPTION,
-Quantity_MOMENTUM,
-Quantity_KINETICMOMENT,
-Quantity_MOMENTOFINERTIA,
-Quantity_FORCE,
-Quantity_MOMENTOFAFORCE,
-Quantity_TORQUE,
-Quantity_WEIGHT,
-Quantity_PRESSURE,
-Quantity_VISCOSITY,
-Quantity_KINEMATICVISCOSITY,
-Quantity_ENERGY,
-Quantity_WORK,
-Quantity_POWER,
-Quantity_SURFACETENSION,
-Quantity_COEFFICIENTOFEXPANSION,
-Quantity_THERMALCONDUCTIVITY,
-Quantity_SPECIFICHEATCAPACITY,
-Quantity_ENTROPY,
-Quantity_ENTHALPY,
-Quantity_LUMINOUSINTENSITY,
-Quantity_LUMINOUSFLUX,
-Quantity_LUMINANCE,
-Quantity_ILLUMINANCE,
-Quantity_LUMINOUSEXPOSITION,
-Quantity_LUMINOUSEFFICACITY,
-Quantity_ELECTRICCHARGE,
-Quantity_ELECTRICCURRENT,
-Quantity_ELECTRICFIELDSTRENGTH,
-Quantity_ELECTRICPOTENTIAL,
-Quantity_ELECTRICCAPACITANCE,
-Quantity_MAGNETICFLUX,
-Quantity_MAGNETICFLUXDENSITY,
-Quantity_MAGNETICFIELDSTRENGTH,
-Quantity_RELUCTANCE,
-Quantity_RESISTANCE,
-Quantity_INDUCTANCE,
-Quantity_CAPACITANCE,
-Quantity_IMPEDANCE,
-Quantity_ADMITTANCE,
-Quantity_RESISTIVITY,
-Quantity_CONDUCTIVITY,
-Quantity_MOLARMASS,
-Quantity_MOLARVOLUME,
-Quantity_CONCENTRATION,
-Quantity_MOLARCONCENTRATION,
-Quantity_MOLARITY,
-Quantity_SOUNDINTENSITY,
-Quantity_ACOUSTICINTENSITY,
-Quantity_ACTIVITY,
-Quantity_ABSORBEDDOSE,
-Quantity_DOSEEQUIVALENT
-};
-
-#endif // _Quantity_PhysicalQuantity_HeaderFile