From: jfa Date: Fri, 6 Apr 2007 12:46:59 +0000 (+0000) Subject: NPAL15298: KindOfShape(). A tool by PKV. X-Git-Tag: V3_2_6pre4~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=52a39bebf31f3f73230d6d6ac4ff127c8ca421dc;p=modules%2Fgeom.git NPAL15298: KindOfShape(). A tool by PKV. --- diff --git a/src/GEOMAlgo/GEOMAlgo.cdl b/src/GEOMAlgo/GEOMAlgo.cdl index f290d14d0..b1e7aaa2f 100755 --- a/src/GEOMAlgo/GEOMAlgo.cdl +++ b/src/GEOMAlgo/GEOMAlgo.cdl @@ -61,6 +61,55 @@ is ST_INOUT end State; -- + enumeration KindOfShape is + KS_UNKNOWN, + KS_SPHERE, + KS_CYLINDER, + KS_BOX, + KS_TORUS, + KS_CONE, + KS_ELLIPSE, + KS_PLANE, + KS_CIRCLE, + KS_LINE, + KS_DEGENERATED + end KindOfShape; + -- + enumeration KindOfName is + KN_UNKNOWN, + KN_SPHERE, + KN_CYLINDER, + KN_TORUS, + KN_CONE, + KN_ELLIPSE, + KN_CIRCLE, + KN_PLANE, + KN_LINE, + KN_BOX, + KN_SEGMENT, + KN_ARCCIRCLE, + KN_POLYGON, + KN_POLYHEDRON, + KN_DISKCIRCLE, + KN_DISKELLIPSE, + KN_RECTANGLE, + KN_TRIANGLE, + KN_QUADRANGLE, + KN_ARCELLIPSE + end KindOfName; + -- + enumeration KindOfBounds is + KB_UNKNOWN, + KB_TRIMMED, + KB_INFINITE + end KindOfBounds; + -- + enumeration KindOfClosed is + KC_UNKNOWN, + KC_CLOSED, + KC_NOTCLOSED + end KindOfClosed; + -- deferred class HAlgo; deferred class Clsf; class ClsfSurf; @@ -73,6 +122,9 @@ is deferred class Algo; deferred class ShapeAlgo; -- + class ShapeInfo; + class ShapeInfoFiller; + -- -- gluer class Gluer; class GlueAnalyser; @@ -151,21 +203,25 @@ is instantiates List from TCollection (CoupleOfShapes from GEOMAlgo); - class IndexedDataMapOfShapeState + class IndexedDataMapOfShapeState instantiates IndexedDataMap from TCollection (Shape from TopoDS, State from TopAbs, ShapeMapHasher from TopTools); - class ListOfPnt + class ListOfPnt instantiates List from TCollection (Pnt from gp); - class DataMapOfPassKeyInteger + class DataMapOfPassKeyInteger instantiates DataMap from TCollection (PassKey from GEOMAlgo, Integer from Standard, PassKeyMapHasher from GEOMAlgo); - class IndexedDataMapOfPassKeyShapeListOfShape + class IndexedDataMapOfPassKeyShapeListOfShape instantiates IndexedDataMap from TCollection (PassKeyShape from GEOMAlgo, ListOfShape from TopTools, PassKeyShapeMapHasher from GEOMAlgo); + class IndexedDataMapOfShapeShapeInfo + instantiates IndexedDataMap from TCollection (Shape from TopoDS, + ShapeInfo from GEOMAlgo, + ShapeMapHasher from TopTools); end GEOMAlgo; diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx new file mode 100644 index 000000000..2c37056e2 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx @@ -0,0 +1,139 @@ +// File generated by CPPExt (Transient) +// +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile +#define _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile +#include +#endif + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +class TopoDS_Shape; +class GEOMAlgo_ShapeInfo; +class TopTools_ShapeMapHasher; +class GEOMAlgo_IndexedDataMapOfShapeShapeInfo; + + + +class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo : public TCollection_MapNode { + +public: + // Methods PUBLIC + // + +GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo(const TopoDS_Shape& K1,const Standard_Integer K2,const GEOMAlgo_ShapeInfo& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2); + + TopoDS_Shape& Key1() const; + + Standard_Integer& Key2() const; + + TCollection_MapNodePtr& Next2() const; + + GEOMAlgo_ShapeInfo& Value() const; +//Standard_EXPORT ~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +TopoDS_Shape myKey1; +Standard_Integer myKey2; +GEOMAlgo_ShapeInfo myValue; +TCollection_MapNodePtr myNext2; + + +}; + +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem GEOMAlgo_ShapeInfo +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_hxx +#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() +#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_IndexedDataMapNode +#undef TCollection_IndexedDataMapNode_hxx +#undef Handle_TCollection_IndexedDataMapNode +#undef TCollection_IndexedDataMapNode_Type_ +#undef TCollection_IndexedDataMap +#undef TCollection_IndexedDataMap_hxx + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx new file mode 100644 index 000000000..6afae1194 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx @@ -0,0 +1,100 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif +#ifndef _TopTools_ShapeMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile +#include +#endif +//GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::~GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo", + sizeof(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo))) { + _anOtherObject = Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)((Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) ; +} +//Standard_Boolean GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) == AType || TCollection_MapNode::IsKind(AType)); +//} +//Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo::~Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo() {} +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem GEOMAlgo_ShapeInfo +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_hxx +#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() +#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx new file mode 100644 index 000000000..ef912354e --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx @@ -0,0 +1,172 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile +#define _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_OutOfRange; +class Standard_NoSuchObject; +class TopoDS_Shape; +class GEOMAlgo_ShapeInfo; +class TopTools_ShapeMapHasher; +class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_IndexedDataMapOfShapeShapeInfo : public TCollection_BasicMap { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeShapeInfo(const Standard_Integer NbBuckets = 1); + + +Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Assign(const GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Other) ; + GEOMAlgo_IndexedDataMapOfShapeShapeInfo& operator =(const GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Other) +{ + return Assign(Other); +} + + + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; + + +Standard_EXPORT void Clear() ; +~GEOMAlgo_IndexedDataMapOfShapeShapeInfo() +{ + Clear(); +} + + + +Standard_EXPORT Standard_Integer Add(const TopoDS_Shape& K,const GEOMAlgo_ShapeInfo& I) ; + + +Standard_EXPORT void Substitute(const Standard_Integer I,const TopoDS_Shape& K,const GEOMAlgo_ShapeInfo& T) ; + + +Standard_EXPORT void RemoveLast() ; + + +Standard_EXPORT Standard_Boolean Contains(const TopoDS_Shape& K) const; + + +Standard_EXPORT const TopoDS_Shape& FindKey(const Standard_Integer I) const; + + +Standard_EXPORT const GEOMAlgo_ShapeInfo& FindFromIndex(const Standard_Integer I) const; + const GEOMAlgo_ShapeInfo& operator ()(const Standard_Integer I) const +{ + return FindFromIndex(I); +} + + + +Standard_EXPORT GEOMAlgo_ShapeInfo& ChangeFromIndex(const Standard_Integer I) ; + GEOMAlgo_ShapeInfo& operator ()(const Standard_Integer I) +{ + return ChangeFromIndex(I); +} + + + +Standard_EXPORT Standard_Integer FindIndex(const TopoDS_Shape& K) const; + + +Standard_EXPORT const GEOMAlgo_ShapeInfo& FindFromKey(const TopoDS_Shape& K) const; + + +Standard_EXPORT GEOMAlgo_ShapeInfo& ChangeFromKey(const TopoDS_Shape& K) ; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + +Standard_EXPORT GEOMAlgo_IndexedDataMapOfShapeShapeInfo(const GEOMAlgo_IndexedDataMapOfShapeShapeInfo& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx new file mode 100644 index 000000000..96604846e --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx @@ -0,0 +1,60 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_OutOfRange_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif +#ifndef _TopTools_ShapeMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile +#include +#endif + + +#define TheKey TopoDS_Shape +#define TheKey_hxx +#define TheItem GEOMAlgo_ShapeInfo +#define TheItem_hxx +#define Hasher TopTools_ShapeMapHasher +#define Hasher_hxx +#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_hxx +#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_() +#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo +#define TCollection_IndexedDataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx new file mode 100644 index 000000000..ba0043ebb --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx @@ -0,0 +1,37 @@ +// File generated by CPPExt (Enum) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_KindOfBounds_HeaderFile +#define _GEOMAlgo_KindOfBounds_HeaderFile + + +enum GEOMAlgo_KindOfBounds { + GEOMAlgo_KB_UNKNOWN, +GEOMAlgo_KB_TRIMMED, +GEOMAlgo_KB_INFINITE +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx new file mode 100644 index 000000000..9854aed36 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx @@ -0,0 +1,37 @@ +// File generated by CPPExt (Enum) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_KindOfClosed_HeaderFile +#define _GEOMAlgo_KindOfClosed_HeaderFile + + +enum GEOMAlgo_KindOfClosed { + GEOMAlgo_KC_UNKNOWN, +GEOMAlgo_KC_CLOSED, +GEOMAlgo_KC_NOTCLOSED +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx new file mode 100644 index 000000000..74c83eb78 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx @@ -0,0 +1,54 @@ +// File generated by CPPExt (Enum) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_KindOfName_HeaderFile +#define _GEOMAlgo_KindOfName_HeaderFile + + +enum GEOMAlgo_KindOfName { + GEOMAlgo_KN_UNKNOWN, +GEOMAlgo_KN_SPHERE, +GEOMAlgo_KN_CYLINDER, +GEOMAlgo_KN_TORUS, +GEOMAlgo_KN_CONE, +GEOMAlgo_KN_ELLIPSE, +GEOMAlgo_KN_CIRCLE, +GEOMAlgo_KN_PLANE, +GEOMAlgo_KN_LINE, +GEOMAlgo_KN_BOX, +GEOMAlgo_KN_SEGMENT, +GEOMAlgo_KN_ARCCIRCLE, +GEOMAlgo_KN_POLYGON, +GEOMAlgo_KN_POLYHEDRON, +GEOMAlgo_KN_DISKCIRCLE, +GEOMAlgo_KN_DISKELLIPSE, +GEOMAlgo_KN_RECTANGLE, +GEOMAlgo_KN_TRIANGLE, +GEOMAlgo_KN_QUADRANGLE, +GEOMAlgo_KN_ARCELLIPSE +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx new file mode 100644 index 000000000..1b5ead9f9 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx @@ -0,0 +1,45 @@ +// File generated by CPPExt (Enum) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _GEOMAlgo_KindOfShape_HeaderFile +#define _GEOMAlgo_KindOfShape_HeaderFile + + +enum GEOMAlgo_KindOfShape { + GEOMAlgo_KS_UNKNOWN, +GEOMAlgo_KS_SPHERE, +GEOMAlgo_KS_CYLINDER, +GEOMAlgo_KS_BOX, +GEOMAlgo_KS_TORUS, +GEOMAlgo_KS_CONE, +GEOMAlgo_KS_ELLIPSE, +GEOMAlgo_KS_PLANE, +GEOMAlgo_KS_CIRCLE, +GEOMAlgo_KS_LINE, +GEOMAlgo_KS_DEGENERATED +}; + + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl new file mode 100644 index 000000000..625638b67 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl @@ -0,0 +1,190 @@ +-- File: GEOMAlgo_ShapeInfo.cdl +-- Created: Mon Apr 2 14:04:24 2007 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2007 + + +class ShapeInfo from GEOMAlgo + + ---Purpose: + +uses + Pnt from gp, + Dir from gp, + Ax2 from gp, + Ax3 from gp, + + ShapeEnum from TopAbs, + Shape from TopoDS, + + KindOfShape from GEOMAlgo, + KindOfBounds from GEOMAlgo, + KindOfClosed from GEOMAlgo, + KindOfName from GEOMAlgo +--raises + +is + Create + returns ShapeInfo from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeInfo();" + + Reset(me:out); + + SetType(me:out; + aType:ShapeEnum from TopAbs); + + Type(me) + returns ShapeEnum from TopAbs; + + SetNbSubShapes(me:out; + aType:ShapeEnum from TopAbs; + aNb :Integer from Standard); + + NbSubShapes(me; + aType:ShapeEnum from TopAbs) + returns Integer from Standard; + + SetKindOfShape (me:out; + aT:KindOfShape from GEOMAlgo); + + KindOfShape (me) + returns KindOfShape from GEOMAlgo; + + SetKindOfName (me:out; + aT: KindOfName from GEOMAlgo); + + KindOfName(me) + returns KindOfName from GEOMAlgo; + + SetKindOfBounds (me:out; + aT:KindOfBounds from GEOMAlgo); + + KindOfBounds (me) + returns KindOfBounds from GEOMAlgo; + + SetKindOfClosed (me:out; + aT:KindOfClosed from GEOMAlgo); + + KindOfClosed(me) + returns KindOfClosed from GEOMAlgo; + + SetLocation (me:out; + aP: Pnt from gp); + + Location (me) + returns Pnt from gp; + ---C++: return const& + + SetDirection (me:out; + aD:Dir from gp); + + Direction (me) + returns Dir from gp; + ---C++: return const& + + SetPosition (me:out; + aAx2 : Ax2 from gp); + + SetPosition (me:out; + aAx3 : Ax3 from gp); + + Position (me) + returns Ax3 from gp; + ---C++: return const& + + SetPnt1 (me:out; + aP: Pnt from gp); + + Pnt1 (me) + returns Pnt from gp; + ---C++: return const& + + SetPnt2 (me:out; + aP: Pnt from gp); + + Pnt2 (me) + returns Pnt from gp; + ---C++: return const& + + SetRadius1 (me:out; + aR: Real from Standard); + + Radius1(me) + returns Real from Standard; + + SetRadius2 (me:out; + aR: Real from Standard); + + Radius2(me) + returns Real from Standard; + + SetLength(me:out; + aL: Real from Standard); + + Length(me) + returns Real from Standard; + + SetWidth(me:out; + aW: Real from Standard); + + Width(me) + returns Real from Standard; + + SetHeight(me:out; + aH: Real from Standard); + + Height(me) + returns Real from Standard; + -- + -- Dump + -- + Dump(me); + + DumpVertex(me) + is protected; + + DumpEdge(me) + is protected; + + DumpWire(me) + is protected; + + DumpFace(me) + is protected; + + DumpShell(me) + is protected; + + DumpSolid(me) + is protected; + + DumpCompSolid(me) + is protected; + + DumpCompound(me) + is protected; + +fields + myType : ShapeEnum from TopAbs is protected; + myNbSubShapes : Integer from Standard[9] is protected; + myKindOfShape : KindOfShape from GEOMAlgo is protected; + myKindOfName : KindOfName from GEOMAlgo is protected; + myKindOfBounds : KindOfBounds from GEOMAlgo is protected; + myKindOfClosed : KindOfClosed from GEOMAlgo is protected; + -- + myLocation : Pnt from gp is protected; + myDirection : Dir from gp is protected; + myPosition : Ax3 from gp is protected; + -- + myRadius1 : Real from Standard is protected; + myRadius2 : Real from Standard is protected; + myLength : Real from Standard is protected; + myWidth : Real from Standard is protected; + myHeight : Real from Standard is protected; + -- + myPnt1 : Pnt from gp is protected; + myPnt2 : Pnt from gp is protected; + -- + myNbTypes : Integer from Standard is protected; +end ShapeInfo; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx new file mode 100644 index 000000000..c12606236 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx @@ -0,0 +1,871 @@ +#include + + +static + Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType); +static + void DumpKindOfShape(const GEOMAlgo_KindOfShape aKS); +static + void DumpKindOfClosed(const GEOMAlgo_KindOfClosed aKC); +static + void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB); +static + void DumpKindOfName(const GEOMAlgo_KindOfName aKS); +static + void DumpPosition(const gp_Ax3& aAx3); +static + void DumpLocation(const gp_Pnt& aP); +static + void DumpDirection(const gp_Dir& aD); +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo() +{ + Reset(); +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo() +{ +} +//======================================================================= +//function : Reset +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfo::Reset() +{ + Standard_Integer i; + // + myType=TopAbs_SHAPE; + // + myNbTypes=9; + for (i=0; i=0 && iN=0 && iN +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_KindOfShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_KindOfName_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_KindOfBounds_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_KindOfClosed_HeaderFile +#include +#endif +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _gp_Dir_HeaderFile +#include +#endif +#ifndef _gp_Ax3_HeaderFile +#include +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +class gp_Pnt; +class gp_Dir; +class gp_Ax2; +class gp_Ax3; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_ShapeInfo { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_ShapeInfo(); +Standard_EXPORT virtual ~GEOMAlgo_ShapeInfo(); + + +Standard_EXPORT void Reset() ; + + +Standard_EXPORT void SetType(const TopAbs_ShapeEnum aType) ; + + +Standard_EXPORT TopAbs_ShapeEnum Type() const; + + +Standard_EXPORT void SetNbSubShapes(const TopAbs_ShapeEnum aType,const Standard_Integer aNb) ; + + +Standard_EXPORT Standard_Integer NbSubShapes(const TopAbs_ShapeEnum aType) const; + + +Standard_EXPORT void SetKindOfShape(const GEOMAlgo_KindOfShape aT) ; + + +Standard_EXPORT GEOMAlgo_KindOfShape KindOfShape() const; + + +Standard_EXPORT void SetKindOfName(const GEOMAlgo_KindOfName aT) ; + + +Standard_EXPORT GEOMAlgo_KindOfName KindOfName() const; + + +Standard_EXPORT void SetKindOfBounds(const GEOMAlgo_KindOfBounds aT) ; + + +Standard_EXPORT GEOMAlgo_KindOfBounds KindOfBounds() const; + + +Standard_EXPORT void SetKindOfClosed(const GEOMAlgo_KindOfClosed aT) ; + + +Standard_EXPORT GEOMAlgo_KindOfClosed KindOfClosed() const; + + +Standard_EXPORT void SetLocation(const gp_Pnt& aP) ; + + +Standard_EXPORT const gp_Pnt& Location() const; + + +Standard_EXPORT void SetDirection(const gp_Dir& aD) ; + + +Standard_EXPORT const gp_Dir& Direction() const; + + +Standard_EXPORT void SetPosition(const gp_Ax2& aAx2) ; + + +Standard_EXPORT void SetPosition(const gp_Ax3& aAx3) ; + + +Standard_EXPORT const gp_Ax3& Position() const; + + +Standard_EXPORT void SetPnt1(const gp_Pnt& aP) ; + + +Standard_EXPORT const gp_Pnt& Pnt1() const; + + +Standard_EXPORT void SetPnt2(const gp_Pnt& aP) ; + + +Standard_EXPORT const gp_Pnt& Pnt2() const; + + +Standard_EXPORT void SetRadius1(const Standard_Real aR) ; + + +Standard_EXPORT Standard_Real Radius1() const; + + +Standard_EXPORT void SetRadius2(const Standard_Real aR) ; + + +Standard_EXPORT Standard_Real Radius2() const; + + +Standard_EXPORT void SetLength(const Standard_Real aL) ; + + +Standard_EXPORT Standard_Real Length() const; + + +Standard_EXPORT void SetWidth(const Standard_Real aW) ; + + +Standard_EXPORT Standard_Real Width() const; + + +Standard_EXPORT void SetHeight(const Standard_Real aH) ; + + +Standard_EXPORT Standard_Real Height() const; + + +Standard_EXPORT void Dump() const; + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT void DumpVertex() const; + + +Standard_EXPORT void DumpEdge() const; + + +Standard_EXPORT void DumpWire() const; + + +Standard_EXPORT void DumpFace() const; + + +Standard_EXPORT void DumpShell() const; + + +Standard_EXPORT void DumpSolid() const; + + +Standard_EXPORT void DumpCompSolid() const; + + +Standard_EXPORT void DumpCompound() const; + + + // Fields PROTECTED + // +TopAbs_ShapeEnum myType; +Standard_Integer myNbSubShapes[9]; +GEOMAlgo_KindOfShape myKindOfShape; +GEOMAlgo_KindOfName myKindOfName; +GEOMAlgo_KindOfBounds myKindOfBounds; +GEOMAlgo_KindOfClosed myKindOfClosed; +gp_Pnt myLocation; +gp_Dir myDirection; +gp_Ax3 myPosition; +Standard_Real myRadius1; +Standard_Real myRadius2; +Standard_Real myLength; +Standard_Real myWidth; +Standard_Real myHeight; +gp_Pnt myPnt1; +gp_Pnt myPnt2; +Standard_Integer myNbTypes; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx new file mode 100644 index 000000000..4d87536e8 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx @@ -0,0 +1,26 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx new file mode 100644 index 000000000..493c1c8a7 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx @@ -0,0 +1,15 @@ +#ifndef _gp_Pnt_HeaderFile +#include +#endif +#ifndef _gp_Dir_HeaderFile +#include +#endif +#ifndef _gp_Ax2_HeaderFile +#include +#endif +#ifndef _gp_Ax3_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl new file mode 100644 index 000000000..599a77d85 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl @@ -0,0 +1,132 @@ +-- File: GEOMAlgo_ShapeInfoFiller.cdl +-- Created: Mon Apr 2 15:05:34 2007 +-- Author: Peter KURNEV +-- +---Copyright: Matra Datavision 2007 + + +class ShapeInfoFiller from GEOMAlgo + inherits Algo from GEOMAlgo + + ---Purpose: + +uses + Pln from gp, + Sphere from gp, + Cylinder from gp, + Cone from gp, + Torus from gp, + + Shape from TopoDS, + Face from TopoDS, + Solid from TopoDS, + + ShapeInfo from GEOMAlgo, + KindOfName from GEOMAlgo, + IndexedDataMapOfShapeShapeInfo from GEOMAlgo + +--raises + +is + + Create + returns ShapeInfoFiller from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeInfoFiller();" + + SetShape(me:out; + aS:Shape from TopoDS); + + Shape(me) + returns Shape from TopoDS; + ---C++:return const & + + SetTolerance(me:out; + aT:Real from Standard); + + Tolerance(me) + returns Real from Standard; + + Info(me) + returns ShapeInfo from GEOMAlgo; + ---C++:return const & + + Info(me; + aS:Shape from TopoDS) + returns ShapeInfo from GEOMAlgo; + ---C++:return const & + + Perform(me:out) + is redefined; + + CheckData(me:out) + is redefined protected; + + FillNbSubShapes(me:out; + aS:Shape from TopoDS; + aInfo: out ShapeInfo from GEOMAlgo) + is protected; + + FillSubShapes(me:out; + aS:Shape from TopoDS) + is protected; + + FillShape(me:out; + aS:Shape from TopoDS) + is protected; + + FillVertex(me:out; + aS:Shape from TopoDS) + is protected; + + FillEdge(me:out; + aS:Shape from TopoDS) + is protected; + + FillFace(me:out; + aS:Shape from TopoDS) + is protected; + + FillSolid(me:out; + aS:Shape from TopoDS) + is protected; + + FillContainer(me:out; + aS:Shape from TopoDS) + is protected; + + + FillDetails(me:out; + aF:Face from TopoDS; + aPln:Pln from gp) + is protected; + + FillDetails(me:out; + aF:Face from TopoDS; + aSph:Sphere from gp) + is protected; + + FillDetails(me:out; + aF:Face from TopoDS; + aCyl:Cylinder from gp) + is protected; + + FillDetails(me:out; + aF:Face from TopoDS; + aCone:Cone from gp) + is protected; + + FillDetails(me:out; + aF:Face from TopoDS; + aTorus:Torus from gp) + is protected; + + FillDetails(me:out; + aS:Solid from TopoDS) + is protected; + +fields + myShape : Shape from TopoDS is protected; + myEmptyInfo : ShapeInfo from GEOMAlgo is protected; + myMapInfo : IndexedDataMapOfShapeShapeInfo from GEOMAlgo is protected; + myTolerance : Real from Standard is protected; +end ShapeInfoFiller; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx new file mode 100644 index 000000000..fc8fb0854 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx @@ -0,0 +1,782 @@ +#include + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + + +static + Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT); +static + Standard_Boolean IsAllowedType(const GeomAbs_SurfaceType aST); +static + Standard_Integer NbWires(const TopoDS_Face& aF); +static + Standard_Integer NbShells(const TopoDS_Solid& aS); + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_ShapeInfoFiller::GEOMAlgo_ShapeInfoFiller() +: + GEOMAlgo_Algo() +{ + myTolerance=0.0001; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_ShapeInfoFiller::~GEOMAlgo_ShapeInfoFiller() +{ +} +//======================================================================= +//function : SetTolerance +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::SetTolerance(const Standard_Real aT) +{ + myTolerance=aT; +} +//======================================================================= +//function : Tolerance +//purpose : +//======================================================================= + Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const +{ + return myTolerance; +} +//======================================================================= +//function : SetShape +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS) +{ + myShape=aS; +} +//======================================================================= +//function : Shape +//purpose : +//======================================================================= + const TopoDS_Shape& GEOMAlgo_ShapeInfoFiller::Shape() const +{ + return myShape; +} +//======================================================================= +//function : Info +//purpose : +//======================================================================= + const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info() const +{ + return Info(myShape); +} +//======================================================================= +//function : Info +//purpose : +//======================================================================= + const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info(const TopoDS_Shape& aS) const +{ + if (!aS.IsNull()) { + if (myMapInfo.Contains(aS)) { + const GEOMAlgo_ShapeInfo& aInfo=myMapInfo.FindFromKey(aS); + return aInfo; + } + } + return myEmptyInfo; +} + +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::CheckData() +{ + myErrorStatus=0; + // + if (myShape.IsNull()) { + myErrorStatus=10; + return; + } +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::Perform() +{ + myErrorStatus=0; + // + myMapInfo.Clear(); + // + CheckData(); + if (myErrorStatus) { + return; + } + // + FillShape(myShape); +} +//======================================================================= +//function :FillShape +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillShape(const TopoDS_Shape& aS) +{ + TopAbs_ShapeEnum aType; + // + aType=aS.ShapeType(); + switch(aType) { + // + case TopAbs_VERTEX: + FillVertex(aS); + break; + // + case TopAbs_EDGE: + FillEdge(aS); + break; + // + case TopAbs_FACE: + FillFace(aS); + break; + // + case TopAbs_SOLID: + FillSolid(aS); + break; + // + case TopAbs_WIRE: + case TopAbs_SHELL: + case TopAbs_COMPSOLID: + case TopAbs_COMPOUND: + FillContainer(aS); + break; + // + default: + break; + } +} +//======================================================================= +//function :FillSubShapes +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillSubShapes(const TopoDS_Shape& aS) +{ + TopoDS_Iterator aIt; + // + aIt.Initialize(aS); + for (; aIt.More(); aIt.Next()){ + const TopoDS_Shape& aSx=aIt.Value(); + FillShape(aSx); + } +} +//======================================================================= +//function : FillContainer +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + // + Standard_Boolean bIsClosed; + TopAbs_ShapeEnum aType; + GEOMAlgo_KindOfClosed aKC; + // + aType=aS.ShapeType(); + //---------------------------------------------------- + if (myMapInfo.Contains(aS)) { + return; + } + else { + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + } + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); + //---------------------------------------------------- + aInfo.SetType(aType); + FillNbSubShapes(aS, aInfo); + // + if (aType==TopAbs_SHELL) { + bIsClosed=BRep_Tool::IsClosed(aS); + aKC=(bIsClosed) ? GEOMAlgo_KC_CLOSED :GEOMAlgo_KC_NOTCLOSED; + aInfo.SetKindOfClosed(aKC); + } + else if (aType==TopAbs_WIRE) { + TopoDS_Wire aW; + TopoDS_Vertex aV1, aV2; + // + aW=TopoDS::Wire(aS); + TopExp::Vertices(aW, aV1, aV2); + // + bIsClosed=aV1.IsSame(aV2); + aKC=(bIsClosed) ? GEOMAlgo_KC_CLOSED :GEOMAlgo_KC_NOTCLOSED; + aInfo.SetKindOfClosed(aKC); + } + // + FillSubShapes(aS); +} +//======================================================================= +//function : FillSolid +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS) +{ + Standard_Integer aNbShells; + TopoDS_Solid aSd; + // + myErrorStatus=0; + //---------------------------------------------------- + if (myMapInfo.Contains(aS)) { + return; + } + else { + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + } + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); + //---------------------------------------------------- + aInfo.SetType(TopAbs_SOLID); + FillNbSubShapes(aS, aInfo); + FillSubShapes(aS); + // + aSd=TopoDS::Solid(aS); + // + aNbShells=NbShells(aSd); + if (aNbShells>1) { + return; + } + // + FillDetails(aSd); +} +//======================================================================= +//function :FillFace +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + // + Standard_Boolean bIsAllowedType; + Standard_Integer aNbWires;//, iRet + Standard_Boolean bInf, bInfU1, bInfU2, bInfV1, bInfV2; + Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2; + gp_Pnt aP0; + gp_Dir aDN; + gp_Ax3 aAx3; + GeomAbs_SurfaceType aST; + Handle(Geom_Surface) aSurf; + TopoDS_Face aF; + //GEOMAlgo_KindOfName aKindOfName; + //---------------------------------------------------- + if (myMapInfo.Contains(aS)) { + return; + } + else { + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + } + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); + //---------------------------------------------------- + aInfo.SetType(TopAbs_FACE); + // + FillNbSubShapes(aS, aInfo); + // + FillSubShapes(aS); + // + aF=TopoDS::Face(aS); + // + aNbWires=NbWires(aF); + if (aNbWires>1) { + return; + } + // + aSurf=BRep_Tool::Surface(aF); + GeomAdaptor_Surface aGAS(aSurf); + aST=aGAS.GetType(); + bIsAllowedType=IsAllowedType(aST); + if (!bIsAllowedType) { + return; + } + // + // 1. Plane + if (aST==GeomAbs_Plane) { + gp_Pln aPln; + // + aPln=aGAS.Plane(); + aP0=aPln.Location(); + aAx3=aPln.Position(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_PLANE); + aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + // + //aSurf->Bounds(aUMin, aUMax, aVMin, aVMax); + BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); + bInfU1=Precision::IsNegativeInfinite(aUMin); + bInfU2=Precision::IsPositiveInfinite(aUMax); + bInfV1=Precision::IsNegativeInfinite(aVMin); + bInfV2=Precision::IsPositiveInfinite(aVMax); + // + bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); + if (bInf) { + aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + } + else { + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + } + // + FillDetails(aF, aPln); + }// if (aCT==GeomAbs_Line) { + // + // 2. Sphere + else if (aST==GeomAbs_Sphere) { + gp_Sphere aSphere; + // + aSphere=aGAS.Sphere(); + aP0=aSphere.Location(); + aAx3=aSphere.Position(); + aR1=aSphere.Radius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_SPHERE); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + aInfo.SetRadius1(aR1); + // + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED); + // + FillDetails(aF, aSphere); + }// else if (aST==GeomAbs_Sphere) { + // + // 3. Cylinder + else if (aST==GeomAbs_Cylinder) { + gp_Cylinder aCyl; + // + aCyl=aGAS.Cylinder(); + aP0=aCyl.Location(); + aAx3=aCyl.Position(); + aR1=aCyl.Radius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_CYLINDER); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + aInfo.SetRadius1(aR1); + // + BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); + bInfU1=Precision::IsNegativeInfinite(aUMin); + bInfU2=Precision::IsPositiveInfinite(aUMax); + bInfV1=Precision::IsNegativeInfinite(aVMin); + bInfV2=Precision::IsPositiveInfinite(aVMax); + // + bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); + if (bInf) { + aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + } + else { + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + } + FillDetails(aF, aCyl); + } + // + // 4. Cone + else if (aST==GeomAbs_Cone) { + gp_Cone aCone; + // + aCone=aGAS.Cone(); + aP0=aCone.Location(); + aAx3=aCone.Position(); + //aR1=aCyl.Radius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_CONE); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + //aInfo.SetRadius1(aR1); + // + BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); + bInfU1=Precision::IsNegativeInfinite(aUMin); + bInfU2=Precision::IsPositiveInfinite(aUMax); + bInfV1=Precision::IsNegativeInfinite(aVMin); + bInfV2=Precision::IsPositiveInfinite(aVMax); + // + bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); + if (bInf) { + aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + } + else { + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + } + FillDetails(aF, aCone); + } + // + // 5. Torus + else if (aST==GeomAbs_Torus) { + gp_Torus aTorus; + // + aTorus=aGAS.Torus(); + aP0=aTorus.Location(); + aAx3=aTorus.Position(); + aR1=aTorus.MajorRadius(); + aR2=aTorus.MinorRadius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_TORUS); + aInfo.SetLocation(aP0); + aInfo.SetPosition(aAx3); + aInfo.SetRadius1(aR1); + aInfo.SetRadius2(aR2); + // + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + + FillDetails(aF, aTorus); + } +} +//======================================================================= +//function :FillEdge +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + // + Standard_Boolean bDegenerated, bIsAllowedType; + Standard_Integer aNbV; + Standard_Real aR1, aR2; + gp_Pnt aP, aP1, aP2, aPc; + gp_Dir aD; + gp_Ax2 aAx2; + Standard_Real aT1, aT2; + GeomAbs_CurveType aCT; + Handle(Geom_Curve) aC3D; + TopoDS_Edge aE; + //---------------------------------------------------- + if (myMapInfo.Contains(aS)) { + return; + } + else { + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + } + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); + //---------------------------------------------------- + aInfo.SetType(TopAbs_EDGE); + // + FillNbSubShapes(aS, aInfo); + // + aE=TopoDS::Edge(aS); + // + bDegenerated=BRep_Tool::Degenerated(aE); + if (bDegenerated) { + aInfo.SetKindOfShape(GEOMAlgo_KS_DEGENERATED); + FillSubShapes(aS); + return; + } + // + aC3D=BRep_Tool::Curve(aE, aT1, aT2); + GeomAdaptor_Curve aGAC(aC3D); + aCT=aGAC.GetType(); + bIsAllowedType=IsAllowedType(aCT); + if (!bIsAllowedType) { + FillSubShapes(aS); + return; + } + // Line + if (aCT==GeomAbs_Line) { + Standard_Boolean bInf1, bInf2; + Standard_Real aLength; + gp_Lin aLin; + gp_XYZ aXYZ1, aXYZ2, aXYZc; + // + aLin=aGAC.Line(); + aP=aLin.Location(); + aD=aLin.Direction(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_LINE); + aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); + aInfo.SetLocation(aP); + aInfo.SetDirection(aD); + // + bInf1=Precision::IsNegativeInfinite(aT1); + bInf2=Precision::IsPositiveInfinite(aT2); + if (bInf1||bInf2) { + aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + aInfo.SetKindOfName(GEOMAlgo_KN_LINE); + } + else { + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + aInfo.SetKindOfName(GEOMAlgo_KN_SEGMENT); + aGAC.D0(aT1, aP1); + aGAC.D0(aT2, aP2); + aInfo.SetPnt1(aP1); + aInfo.SetPnt2(aP2); + // + aLength=aP1.Distance(aP2); + aXYZ1=aP1.XYZ(); + aXYZ2=aP2.XYZ(); + aXYZc=aXYZ1+aXYZ2; + aXYZc.Multiply(0.5); + // + aPc.SetXYZ(aXYZc); + gp_Vec aVec(aPc, aP2); + gp_Dir aDir(aVec); + // + aInfo.SetLocation(aPc); + aInfo.SetDirection(aDir); + aInfo.SetLength(aLength); + } + }// if (aCT==GeomAbs_Line) { + // + // Circle + else if (aCT==GeomAbs_Circle) { + gp_Circ aCirc; + // + aCirc=aGAC.Circle(); + aP=aCirc.Location(); + aAx2=aCirc.Position(); + aR1=aCirc.Radius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_CIRCLE); + aInfo.SetLocation(aP); + aInfo.SetPosition(aAx2); + aInfo.SetRadius1(aR1); + // + aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); + if (!aNbV) { + myErrorStatus=11; // circle edge without vertices + return; + } + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + aGAC.D0(aT1, aP1); + aGAC.D0(aT2, aP2); + aInfo.SetPnt1(aP1); + aInfo.SetPnt2(aP2); + // + if (aNbV==1) { + aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED); + aInfo.SetKindOfName(GEOMAlgo_KN_CIRCLE); + } + else { + aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); + aInfo.SetKindOfName(GEOMAlgo_KN_ARCCIRCLE); + } + }// else if (aCT==GeomAbs_Circle) { + // + // Ellipse + else if (aCT==GeomAbs_Ellipse) { + gp_Elips aElips; + // + aElips=aGAC.Ellipse(); + aP=aElips.Location(); + aAx2=aElips.Position(); + aR1=aElips.MajorRadius(); + aR2=aElips.MinorRadius(); + // + aInfo.SetKindOfShape(GEOMAlgo_KS_ELLIPSE); + aInfo.SetLocation(aP); + aInfo.SetPosition(aAx2); + aInfo.SetRadius1(aR1); + aInfo.SetRadius2(aR2); + // + aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); + if (!aNbV) { + myErrorStatus=11; // ellipse edge without vertices + return; + } + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + aGAC.D0(aT1, aP1); + aGAC.D0(aT2, aP2); + aInfo.SetPnt1(aP1); + aInfo.SetPnt2(aP2); + // + if (aNbV==1) { + aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED); + aInfo.SetKindOfName(GEOMAlgo_KN_ELLIPSE); + } + else { + aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); + aInfo.SetKindOfName(GEOMAlgo_KN_ARCELLIPSE); + } + }// else if (aCT==GeomAbs_Ellipse) { + // + FillSubShapes(aS); +} +//======================================================================= +//function :FillVertex +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS) +{ + myErrorStatus=0; + // + gp_Pnt aP; + TopoDS_Vertex aV; + // + if (myMapInfo.Contains(aS)) { + return; + } + else { + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + } + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); + // + aV=TopoDS::Vertex(aS); + aP=BRep_Tool::Pnt(aV); + // + aInfo.SetType(TopAbs_VERTEX); + aInfo.SetLocation(aP); + myMapInfo.Add(aS, aInfo); +} +//======================================================================= +//function : FillNbSubshapes +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillNbSubShapes(const TopoDS_Shape& aS, + GEOMAlgo_ShapeInfo& aInfo) +{ + myErrorStatus=0; + // + Standard_Integer i, aNb, aNbS; + TopTools_IndexedMapOfShape aM; + TopAbs_ShapeEnum aST; + TopAbs_ShapeEnum aTypes[]= { + //TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX + TopAbs_COMPOUND, + TopAbs_COMPSOLID, + TopAbs_SOLID, + TopAbs_SHELL, + TopAbs_FACE, + TopAbs_WIRE, + TopAbs_EDGE, + TopAbs_VERTEX + }; + + // + aST=aS.ShapeType(); + aNb=sizeof(aTypes)/sizeof(aTypes[0]); + for (i=0; i +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile +#include +#endif +#ifndef _Standard_Real_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Algo_HeaderFile +#include +#endif +class TopoDS_Shape; +class GEOMAlgo_ShapeInfo; +class TopoDS_Face; +class gp_Pln; +class gp_Sphere; +class gp_Cylinder; +class gp_Cone; +class gp_Torus; +class TopoDS_Solid; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_ShapeInfoFiller : public GEOMAlgo_Algo { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_ShapeInfoFiller(); +Standard_EXPORT virtual ~GEOMAlgo_ShapeInfoFiller(); + + +Standard_EXPORT void SetShape(const TopoDS_Shape& aS) ; + + +Standard_EXPORT const TopoDS_Shape& Shape() const; + + +Standard_EXPORT void SetTolerance(const Standard_Real aT) ; + + +Standard_EXPORT Standard_Real Tolerance() const; + + +Standard_EXPORT const GEOMAlgo_ShapeInfo& Info() const; + + +Standard_EXPORT const GEOMAlgo_ShapeInfo& Info(const TopoDS_Shape& aS) const; + + +Standard_EXPORT virtual void Perform() ; + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT virtual void CheckData() ; + + +Standard_EXPORT void FillNbSubShapes(const TopoDS_Shape& aS,GEOMAlgo_ShapeInfo& aInfo) ; + + +Standard_EXPORT void FillSubShapes(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillShape(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillVertex(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillEdge(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillFace(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillSolid(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillContainer(const TopoDS_Shape& aS) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Pln& aPln) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Sphere& aSph) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Cylinder& aCyl) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Cone& aCone) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Face& aF,const gp_Torus& aTorus) ; + + +Standard_EXPORT void FillDetails(const TopoDS_Solid& aS) ; + + + // Fields PROTECTED + // +TopoDS_Shape myShape; +GEOMAlgo_ShapeInfo myEmptyInfo; +GEOMAlgo_IndexedDataMapOfShapeShapeInfo myMapInfo; +Standard_Real myTolerance; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx new file mode 100644 index 000000000..a56973ba8 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx @@ -0,0 +1,26 @@ +// File generated by CPPExt (Value) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx new file mode 100644 index 000000000..f3d77a35b --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx @@ -0,0 +1,30 @@ +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfo_HeaderFile +#include +#endif +#ifndef _TopoDS_Face_HeaderFile +#include +#endif +#ifndef _gp_Pln_HeaderFile +#include +#endif +#ifndef _gp_Sphere_HeaderFile +#include +#endif +#ifndef _gp_Cylinder_HeaderFile +#include +#endif +#ifndef _gp_Cone_HeaderFile +#include +#endif +#ifndef _gp_Torus_HeaderFile +#include +#endif +#ifndef _TopoDS_Solid_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ShapeInfoFiller_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx new file mode 100644 index 000000000..be832c487 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx @@ -0,0 +1,684 @@ +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +//======================================================================= +//function : FillDetails +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) +{ + Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct, aNbCrc, aNbX; + TopoDS_Shape aFCyl, aFCon; + TopTools_IndexedMapOfShape aMF; + GEOMAlgo_KindOfName aKNF; + // + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aSd); + aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN); + // + TopExp::MapShapes(aSd, TopAbs_FACE, aMF); + // + aNbF=aMF.Extent(); + if (!aNbF) { + return; + } + // + if (aNbF==1) { + const TopoDS_Shape& aF=aMF(1); + GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF); + aKNF=aInfoF.KindOfName(); // mb: sphere, torus + if (aKNF==GEOMAlgo_KN_SPHERE || + aKNF==GEOMAlgo_KN_TORUS) { + aInfo.SetKindOfName(aKNF); + aInfo.SetLocation(aInfoF.Location()); + aInfo.SetPosition(aInfoF.Position()); + aInfo.SetRadius1(aInfoF.Radius1()); + if(aKNF==GEOMAlgo_KN_TORUS) { + aInfo.SetRadius2(aInfoF.Radius2()); + } + return; + } + } + // + aNbCyl=0; + aNbCon=0; + aNbPgn=0; + aNbRct=0; + aNbCrc=0; + for (i=1; i<=aNbF; ++i) { + const TopoDS_Shape& aF=aMF(i); + GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF); + aKNF=aInfoF.KindOfName(); + if (aKNF==GEOMAlgo_KN_CYLINDER) { + aFCyl=aF; + ++aNbCyl; + } + else if (aKNF==GEOMAlgo_KN_CONE) { + aFCon=aF; + ++aNbCon; + } + else if (aKNF==GEOMAlgo_KN_DISKCIRCLE) { + ++aNbCrc; + } + else if (aKNF==GEOMAlgo_KN_POLYGON || + aKNF==GEOMAlgo_KN_TRIANGLE || + aKNF==GEOMAlgo_KN_QUADRANGLE) { + ++aNbPgn; + + } + else if (aKNF==GEOMAlgo_KN_RECTANGLE) { + ++aNbPgn; + ++aNbRct; + } + } + // + aNbX=aNbCyl+aNbCrc; + if (aNbCyl==1 && aNbCrc==2 && aNbX==aNbF) { + // cylinder (as they understand it) + GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aFCyl); + aKNF=aInfoF.KindOfName(); + aInfo.SetKindOfName(aKNF); + aInfo.SetLocation(aInfoF.Location()); + aInfo.SetPosition(aInfoF.Position()); + aInfo.SetRadius1(aInfoF.Radius1()); + aInfo.SetHeight(aInfoF.Height()); + return; + } + // + aNbX=aNbCon+aNbCrc; + if (aNbCon==1 && (aNbCrc==1 || aNbCrc==2) && aNbX==aNbF) { + // cone + GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aFCon); + aKNF=aInfoF.KindOfName(); + aInfo.SetKindOfName(aKNF); + aInfo.SetLocation(aInfoF.Location()); + aInfo.SetPosition(aInfoF.Position()); + aInfo.SetRadius1(aInfoF.Radius1()); + aInfo.SetRadius2(aInfoF.Radius2()); + aInfo.SetHeight(aInfoF.Height()); + return; + } + // + if (aNbPgn!=6) { + aInfo.SetKindOfName(GEOMAlgo_KN_POLYHEDRON); + return; + } + if (aNbPgn!=aNbRct) { + aInfo.SetKindOfName(GEOMAlgo_KN_POLYHEDRON); + return; + } + //=================================================== + // aNbRct=6; + // box + Standard_Integer j, aNbFi, aNbV, iMax, iMin, iMid; + Standard_Real aDot, aLength, aWidth, aHeight, aDist[3]; + Standard_Real aDistMin, aDistMax; + gp_Pnt aPi, aPc; + gp_Dir aDir[3]; + gp_XYZ aXYZc; + TColStd_IndexedMapOfInteger aMp; + TopTools_IndexedMapOfShape aMV, aMFi; + // + // barycenter aPc + TopExp::MapShapes(aSd, TopAbs_VERTEX, aMV); + aNbV=aMV.Extent(); + if (aNbV!=8) { + return; + } + // + aXYZc.SetCoord(0.,0.,0.); + for (i=1; i<=aNbV; ++i) { + const TopoDS_Vertex& aVi=TopoDS::Vertex(aMV(i)); + aPi=BRep_Tool::Pnt(aVi); + const gp_XYZ& aXYZ=aPi.XYZ(); + aXYZc=aXYZc+aXYZ; + } + // + aXYZc.Divide(aNbV); + aPc.SetXYZ(aXYZc); + // + // 3 faces + for (i=1; i<=aNbF; ++i) { + if (aMp.Contains(i)) { + continue; + } + // + const TopoDS_Shape& aFi=aMF(i); + const GEOMAlgo_ShapeInfo& aIFi=myMapInfo.FindFromKey(aFi); + const gp_Dir& aDNi=aIFi.Position().Direction(); + // + for (j=i+1; j<=aNbF; ++j) { + if (aMp.Contains(j)) { + continue; + } + // + const TopoDS_Shape& aFj=aMF(j); + const GEOMAlgo_ShapeInfo& aIFj=myMapInfo.FindFromKey(aFj); + const gp_Dir& aDNj=aIFj.Position().Direction(); + // + aDot=aDNi*aDNj; + if (fabs(1.-aDot)<0.0001) { + aMp.Add(i); + aMp.Add(j); + aMFi.Add(aFi); + break; + } + // + } + } + aNbFi=aMFi.Extent(); + if (aNbFi!=3) { + return; + } + // + aDistMin=1.e15; + aDistMax=-aDistMin; + for (i=0; iaDistMax) { + aDistMax=aDist[i]; + iMax=i; + } + if (aDist[i] myTolerance) { + aInfo.SetKindOfName(GEOMAlgo_KN_QUADRANGLE); + return; + } + } + // + // rectangle + aInfo.SetKindOfName(GEOMAlgo_KN_RECTANGLE); + // + // shift location to the center and calc. sizes + aXYZc.SetCoord(0.,0.,0.); + TopExp::MapShapes(aF, TopAbs_VERTEX, aMV); + for (i=1; i<=aNbV; ++i) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i)); + aP=BRep_Tool::Pnt(aV); + const gp_XYZ& aXYZ=aP.XYZ(); + aXYZc=aXYZc+aXYZ; + } + // + // Location : aPc in center of rectangle + // Position : 0z is plane normal + // 0x is along length + // + aXYZc.Divide(4.); + aPc.SetXYZ(aXYZc); + // + gp_Lin aL0(aPx[0], aDx[0]); + gp_Lin aL1(aPx[1], aDx[1]); + // + aD0=aL0.Distance(aPc); + aD1=aL1.Distance(aPc); + // + aLength=aD0; + aWidth =aD1; + aDX=aL1.Direction(); + if (aD0aT1) { + aPc=aPC[1]; + } + aHeight=aPC[0].Distance(aPC[1]); + // + aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER); + aInfo.SetLocation(aPc); + aInfo.SetHeight(aHeight); +} + +//======================================================================= +//function : FillDetails +//purpose : +//======================================================================= + void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, + const gp_Torus& ) +{ + Standard_Integer aNbV, aNbE, aNbSE; + TopoDS_Edge aE; + TopExp_Explorer aExp; + TopTools_MapOfShape aM; + GEOMAlgo_KindOfShape aKS; + // + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); + aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN); + // + aKS=aInfo.KindOfShape(); + if (aKS!=GEOMAlgo_KS_TORUS) { + return; + } + // + aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); + aNbE=aInfo.NbSubShapes(TopAbs_EDGE); + if (!(aNbV==1 && aNbE==2)) { + return; + } + // + aNbSE=0; + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + aE=TopoDS::Edge(aExp.Current()); + if (aM.Add(aE)) { + //const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); + if (BRep_Tool::IsClosed(aE, aF)) { + ++aNbSE; + } + } + } + // + if (aNbSE!=2) { + return; + } + aInfo.SetKindOfName(GEOMAlgo_KN_TORUS); +} diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx new file mode 100644 index 000000000..ef425b4c2 --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx @@ -0,0 +1,74 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991 - 2000 by +// Matra Datavision SA. All rights reserved. +// +// Copyright (C) 2001 - 2004 by +// Open CASCADE SA. All rights reserved. +// +// This file is part of the Open CASCADE Technology software. +// +// This software may be distributed and/or modified under the terms and +// conditions of the Open CASCADE Public License as defined by Open CASCADE SA +// and appearing in the file LICENSE included in the packaging of this file. +// +// This software is distributed on an "AS IS" basis, without warranty of any +// kind, and Open CASCADE SA hereby disclaims all such warranties, +// including without limitation, any warranties of merchantability, fitness +// for a particular purpose or non-infringement. Please see the License for +// the specific terms and conditions governing rights and limitations under the +// License. + +#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile +#define _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo); + +class Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) : public Handle(TCollection_MapNode) { + public: + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)():Handle(TCollection_MapNode)() {} + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& operator=(const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)& operator=(const GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo* operator->() const + { + return (GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo)(); + + Standard_EXPORT static const Handle(GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMAlgo/Makefile.in b/src/GEOMAlgo/Makefile.in index 5cd728723..4c46e9ed9 100644 --- a/src/GEOMAlgo/Makefile.in +++ b/src/GEOMAlgo/Makefile.in @@ -82,11 +82,13 @@ LIB_SRC = \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape_0.cxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox_0.cxx \ + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_0.cxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState_0.cxx \ GEOMAlgo_IndexedDataMapOfIntegerShape_0.cxx \ GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx \ GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_0.cxx \ GEOMAlgo_IndexedDataMapOfShapeBox_0.cxx \ + GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx \ GEOMAlgo_IndexedDataMapOfShapeState_0.cxx \ GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_0.cxx \ GEOMAlgo_ListIteratorOfListOfPnt_0.cxx \ @@ -99,6 +101,9 @@ LIB_SRC = \ GEOMAlgo_PassKeyShape.cxx \ GEOMAlgo_PassKeyShapeMapHasher.cxx \ GEOMAlgo_ShapeAlgo.cxx \ + GEOMAlgo_ShapeInfo.cxx \ + GEOMAlgo_ShapeInfoFiller.cxx \ + GEOMAlgo_ShapeInfoFiller_1.cxx \ GEOMAlgo_ShapeSet.cxx \ GEOMAlgo_ShapeSolid.cxx \ GEOMAlgo_ShellSolid.cxx \ @@ -157,12 +162,18 @@ EXPORT_HEADERS = \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx \ + GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx \ GEOMAlgo_IndexedDataMapOfIntegerShape.hxx \ GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx \ GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx \ GEOMAlgo_IndexedDataMapOfShapeBox.hxx \ + GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx \ GEOMAlgo_IndexedDataMapOfShapeState.hxx \ + GEOMAlgo_KindOfBounds.hxx \ + GEOMAlgo_KindOfClosed.hxx \ + GEOMAlgo_KindOfName.hxx \ + GEOMAlgo_KindOfShape.hxx \ GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx \ GEOMAlgo_ListIteratorOfListOfPnt.hxx \ GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx \ @@ -175,6 +186,8 @@ EXPORT_HEADERS = \ GEOMAlgo_PassKeyShapeMapHasher.hxx \ GEOMAlgo_PWireEdgeSet.hxx \ GEOMAlgo_ShapeAlgo.hxx \ + GEOMAlgo_ShapeInfo.hxx \ + GEOMAlgo_ShapeInfoFiller.hxx \ GEOMAlgo_ShapeSet.hxx \ GEOMAlgo_ShapeSolid.hxx \ GEOMAlgo_ShellSolid.hxx \ @@ -202,6 +215,7 @@ EXPORT_HEADERS = \ Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx \ Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyShapeListOfShape.hxx \ Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeBox.hxx \ + Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx \ Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeState.hxx \ Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx \ Handle_GEOMAlgo_ListNodeOfListOfPnt.hxx