mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-31 20:34:29 +05:00
NPAL15298: KindOfShape(). A tool by PKV.
This commit is contained in:
parent
db3bc223f3
commit
52a39bebf3
@ -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;
|
||||
|
@ -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 <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile
|
||||
#include <Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _TopoDS_Shape_HeaderFile
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_ShapeInfo_HeaderFile
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
#endif
|
||||
#ifndef _TCollection_MapNodePtr_HeaderFile
|
||||
#include <TCollection_MapNodePtr.hxx>
|
||||
#endif
|
||||
#ifndef _TCollection_MapNode_HeaderFile
|
||||
#include <TCollection_MapNode.hxx>
|
||||
#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 <TopoDS_Shape.hxx>
|
||||
#define TheItem GEOMAlgo_ShapeInfo
|
||||
#define TheItem_hxx <GEOMAlgo_ShapeInfo.hxx>
|
||||
#define Hasher TopTools_ShapeMapHasher
|
||||
#define Hasher_hxx <TopTools_ShapeMapHasher.hxx>
|
||||
#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo
|
||||
#define TCollection_IndexedDataMapNode_hxx <GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo
|
||||
#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_()
|
||||
#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo
|
||||
#define TCollection_IndexedDataMap_hxx <GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx>
|
||||
|
||||
#include <TCollection_IndexedDataMapNode.lxx>
|
||||
|
||||
#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
|
@ -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 <GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx>
|
||||
|
||||
#ifndef _Standard_TypeMismatch_HeaderFile
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _TopoDS_Shape_HeaderFile
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_ShapeInfo_HeaderFile
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
#endif
|
||||
#ifndef _TopTools_ShapeMapHasher_HeaderFile
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#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 <TopoDS_Shape.hxx>
|
||||
#define TheItem GEOMAlgo_ShapeInfo
|
||||
#define TheItem_hxx <GEOMAlgo_ShapeInfo.hxx>
|
||||
#define Hasher TopTools_ShapeMapHasher
|
||||
#define Hasher_hxx <TopTools_ShapeMapHasher.hxx>
|
||||
#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo
|
||||
#define TCollection_IndexedDataMapNode_hxx <GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo
|
||||
#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_()
|
||||
#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo
|
||||
#define TCollection_IndexedDataMap_hxx <GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#include <TCollection_IndexedDataMapNode.gxx>
|
||||
|
172
src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
Normal file
172
src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
Normal file
@ -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 <TCollection_BasicMap.hxx>
|
||||
#endif
|
||||
#ifndef _Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile
|
||||
#include <Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Boolean_HeaderFile
|
||||
#include <Standard_Boolean.hxx>
|
||||
#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 <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Macro_HeaderFile
|
||||
#include <Standard_Macro.hxx>
|
||||
#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
|
60
src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx
Normal file
60
src/GEOMAlgo/GEOMAlgo_IndexedDataMapOfShapeShapeInfo_0.cxx
Normal file
@ -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 <GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx>
|
||||
|
||||
#ifndef _Standard_DomainError_HeaderFile
|
||||
#include <Standard_DomainError.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_OutOfRange_HeaderFile
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_NoSuchObject_HeaderFile
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#endif
|
||||
#ifndef _TopoDS_Shape_HeaderFile
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_ShapeInfo_HeaderFile
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
#endif
|
||||
#ifndef _TopTools_ShapeMapHasher_HeaderFile
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_HeaderFile
|
||||
#include <GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
#define TheKey TopoDS_Shape
|
||||
#define TheKey_hxx <TopoDS_Shape.hxx>
|
||||
#define TheItem GEOMAlgo_ShapeInfo
|
||||
#define TheItem_hxx <GEOMAlgo_ShapeInfo.hxx>
|
||||
#define Hasher TopTools_ShapeMapHasher
|
||||
#define Hasher_hxx <TopTools_ShapeMapHasher.hxx>
|
||||
#define TCollection_IndexedDataMapNode GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo
|
||||
#define TCollection_IndexedDataMapNode_hxx <GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#define Handle_TCollection_IndexedDataMapNode Handle_GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo
|
||||
#define TCollection_IndexedDataMapNode_Type_() GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfShapeShapeInfo_Type_()
|
||||
#define TCollection_IndexedDataMap GEOMAlgo_IndexedDataMapOfShapeShapeInfo
|
||||
#define TCollection_IndexedDataMap_hxx <GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#include <TCollection_IndexedDataMap.gxx>
|
||||
|
37
src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx
Normal file
37
src/GEOMAlgo/GEOMAlgo_KindOfBounds.hxx
Normal file
@ -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 <Standard_PrimitiveTypes.hxx>
|
||||
#endif
|
||||
|
||||
#endif
|
37
src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx
Normal file
37
src/GEOMAlgo/GEOMAlgo_KindOfClosed.hxx
Normal file
@ -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 <Standard_PrimitiveTypes.hxx>
|
||||
#endif
|
||||
|
||||
#endif
|
54
src/GEOMAlgo/GEOMAlgo_KindOfName.hxx
Normal file
54
src/GEOMAlgo/GEOMAlgo_KindOfName.hxx
Normal file
@ -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 <Standard_PrimitiveTypes.hxx>
|
||||
#endif
|
||||
|
||||
#endif
|
45
src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx
Normal file
45
src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx
Normal file
@ -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 <Standard_PrimitiveTypes.hxx>
|
||||
#endif
|
||||
|
||||
#endif
|
190
src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl
Normal file
190
src/GEOMAlgo/GEOMAlgo_ShapeInfo.cdl
Normal file
@ -0,0 +1,190 @@
|
||||
-- File: GEOMAlgo_ShapeInfo.cdl
|
||||
-- Created: Mon Apr 2 14:04:24 2007
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---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;
|
871
src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx
Normal file
871
src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx
Normal file
@ -0,0 +1,871 @@
|
||||
#include <GEOMAlgo_ShapeInfo.ixx>
|
||||
|
||||
|
||||
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<myNbTypes; ++i) {
|
||||
myNbSubShapes[i]=0;
|
||||
}
|
||||
//
|
||||
myKindOfShape=GEOMAlgo_KS_UNKNOWN;
|
||||
myKindOfBounds=GEOMAlgo_KB_UNKNOWN;
|
||||
myKindOfClosed=GEOMAlgo_KC_UNKNOWN;
|
||||
myKindOfName=GEOMAlgo_KN_UNKNOWN;
|
||||
//
|
||||
myLocation.SetCoord(99., 99., 99.);
|
||||
myDirection.SetCoord(1.,0.,0.);
|
||||
//
|
||||
myRadius1=-1.;
|
||||
myRadius2=-2.;
|
||||
myLength=-3.;
|
||||
myWidth=-3.;
|
||||
myHeight=-3.;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType)
|
||||
{
|
||||
myType=aType;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const
|
||||
{
|
||||
return myType;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetNbSubShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetNbSubShapes(const TopAbs_ShapeEnum aType,
|
||||
const Standard_Integer aNb)
|
||||
{
|
||||
Standard_Integer iN;
|
||||
|
||||
iN=TypeToInteger(aType);
|
||||
if (iN>=0 && iN<myNbTypes) {
|
||||
myNbSubShapes[iN]=aNb;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : NbSubShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes(const TopAbs_ShapeEnum aType) const
|
||||
{
|
||||
Standard_Integer iN;
|
||||
|
||||
iN=TypeToInteger(aType);
|
||||
if (iN>=0 && iN<myNbTypes) {
|
||||
return myNbSubShapes[iN];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetKindOfShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT)
|
||||
{
|
||||
myKindOfShape=aT;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : KindOfShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const
|
||||
{
|
||||
return myKindOfShape;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetKindOfName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT)
|
||||
{
|
||||
myKindOfName=aT;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : KindOfName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const
|
||||
{
|
||||
return myKindOfName;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetKindOfBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT)
|
||||
{
|
||||
myKindOfBounds=aT;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : KindOfBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const
|
||||
{
|
||||
return myKindOfBounds;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetKindOfClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT)
|
||||
{
|
||||
myKindOfClosed=aT;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : KindOfClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
GEOMAlgo_KindOfClosed GEOMAlgo_ShapeInfo::KindOfClosed() const
|
||||
{
|
||||
return myKindOfClosed;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetLocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetLocation(const gp_Pnt& aP)
|
||||
{
|
||||
myLocation=aP;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Location
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const
|
||||
{
|
||||
return myLocation;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetDirection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD)
|
||||
{
|
||||
myDirection=aD;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Direction
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const
|
||||
{
|
||||
return myDirection;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetPosition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax2& aAx2)
|
||||
{
|
||||
gp_Ax3 aAx3(aAx2);
|
||||
SetPosition(aAx3);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetPosition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3)
|
||||
{
|
||||
myPosition=aAx3;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Position
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const
|
||||
{
|
||||
return myPosition;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetPnt1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP)
|
||||
{
|
||||
myPnt1=aP;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Pnt1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const
|
||||
{
|
||||
return myPnt1;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetPnt2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP)
|
||||
{
|
||||
myPnt2=aP;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Pnt2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const
|
||||
{
|
||||
return myPnt2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetRadius1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR)
|
||||
{
|
||||
myRadius1=aR;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Radius1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GEOMAlgo_ShapeInfo::Radius1() const
|
||||
{
|
||||
return myRadius1;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetRadius2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR)
|
||||
{
|
||||
myRadius2=aR;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Radius2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GEOMAlgo_ShapeInfo::Radius2() const
|
||||
{
|
||||
return myRadius2;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetLength
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL)
|
||||
{
|
||||
myLength=aL;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GEOMAlgo_ShapeInfo::Length() const
|
||||
{
|
||||
return myLength;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetWidth
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW)
|
||||
{
|
||||
myWidth=aW;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Width
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GEOMAlgo_ShapeInfo::Width() const
|
||||
{
|
||||
return myWidth;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetHeight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH)
|
||||
{
|
||||
myHeight=aH;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Height
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real GEOMAlgo_ShapeInfo::Height() const
|
||||
{
|
||||
return myHeight;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : TypeToInteger
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
|
||||
{
|
||||
Standard_Integer iN;
|
||||
//
|
||||
iN=(Standard_Integer)aType;
|
||||
return iN;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::Dump()const
|
||||
{
|
||||
switch (myType) {
|
||||
//
|
||||
case TopAbs_VERTEX:
|
||||
DumpVertex();
|
||||
break;
|
||||
//
|
||||
case TopAbs_EDGE:
|
||||
DumpEdge();
|
||||
break;
|
||||
//
|
||||
case TopAbs_WIRE:
|
||||
DumpWire();
|
||||
break;
|
||||
//
|
||||
case TopAbs_FACE:
|
||||
DumpFace();
|
||||
break;
|
||||
//
|
||||
case TopAbs_SHELL:
|
||||
DumpShell();
|
||||
break;
|
||||
//
|
||||
case TopAbs_SOLID:
|
||||
DumpSolid();
|
||||
break;
|
||||
//
|
||||
case TopAbs_COMPSOLID:
|
||||
DumpCompSolid();
|
||||
break;
|
||||
//
|
||||
case TopAbs_COMPOUND:
|
||||
DumpCompound();
|
||||
break;
|
||||
//
|
||||
default:
|
||||
printf(" * not implememted yet\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpCompound
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::DumpCompound()const
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, aNbF, aNbS, aNbC, aNbP;
|
||||
GEOMAlgo_KindOfShape aKS;
|
||||
GEOMAlgo_KindOfName aKN;
|
||||
GEOMAlgo_KindOfBounds aKB;
|
||||
GEOMAlgo_KindOfClosed aKC;
|
||||
//
|
||||
aNbV=NbSubShapes(TopAbs_VERTEX);
|
||||
aNbE=NbSubShapes(TopAbs_EDGE);
|
||||
aNbF=NbSubShapes(TopAbs_FACE);
|
||||
aNbS=NbSubShapes(TopAbs_SOLID);
|
||||
aNbC=NbSubShapes(TopAbs_COMPSOLID);
|
||||
aNbP=NbSubShapes(TopAbs_COMPOUND);
|
||||
aKS=KindOfShape();
|
||||
aKN=KindOfName();
|
||||
aKB=KindOfBounds();
|
||||
aKC=KindOfClosed();
|
||||
//
|
||||
printf(" *COMPOUND\n");
|
||||
printf(" number of vertices : %d\n", aNbV);
|
||||
printf(" number of edges : %d\n", aNbE);
|
||||
printf(" number of faces : %d\n", aNbF);
|
||||
printf(" number of solids : %d\n", aNbS);
|
||||
printf(" number of compsolids : %d\n", aNbC);
|
||||
printf(" number of compounds : %d\n", aNbP);
|
||||
DumpKindOfShape (aKS);
|
||||
DumpKindOfName (aKN);
|
||||
DumpKindOfBounds(aKB);
|
||||
DumpKindOfClosed(aKC);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpCompSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::DumpCompSolid()const
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, aNbF, aNbS;
|
||||
GEOMAlgo_KindOfShape aKS;
|
||||
GEOMAlgo_KindOfName aKN;
|
||||
GEOMAlgo_KindOfBounds aKB;
|
||||
GEOMAlgo_KindOfClosed aKC;
|
||||
//
|
||||
aNbV=NbSubShapes(TopAbs_VERTEX);
|
||||
aNbE=NbSubShapes(TopAbs_EDGE);
|
||||
aNbF=NbSubShapes(TopAbs_FACE);
|
||||
aNbS=NbSubShapes(TopAbs_SOLID);
|
||||
aKS=KindOfShape();
|
||||
aKN=KindOfName();
|
||||
aKB=KindOfBounds();
|
||||
aKC=KindOfClosed();
|
||||
//
|
||||
printf(" *COMPSOLID\n");
|
||||
printf(" number of vertices: %d\n", aNbV);
|
||||
printf(" number of edges : %d\n", aNbE);
|
||||
printf(" number of faces : %d\n", aNbF);
|
||||
printf(" number of solids : %d\n", aNbS);
|
||||
DumpKindOfShape (aKS);
|
||||
DumpKindOfName (aKN);
|
||||
DumpKindOfBounds(aKB);
|
||||
DumpKindOfClosed(aKC);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::DumpSolid()const
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, aNbF;
|
||||
GEOMAlgo_KindOfShape aKS;
|
||||
GEOMAlgo_KindOfName aKN;
|
||||
GEOMAlgo_KindOfBounds aKB;
|
||||
GEOMAlgo_KindOfClosed aKC;
|
||||
//
|
||||
aNbV=NbSubShapes(TopAbs_VERTEX);
|
||||
aNbE=NbSubShapes(TopAbs_EDGE);
|
||||
aNbF=NbSubShapes(TopAbs_FACE);
|
||||
aKS=KindOfShape();
|
||||
aKN=KindOfName();
|
||||
aKB=KindOfBounds();
|
||||
aKC=KindOfClosed();
|
||||
//
|
||||
printf(" *SOLID\n");
|
||||
printf(" number of vertices: %d\n", aNbV);
|
||||
printf(" number of edges : %d\n", aNbE);
|
||||
printf(" number of faces : %d\n", aNbF);
|
||||
DumpKindOfShape (aKS);
|
||||
DumpKindOfName (aKN);
|
||||
DumpKindOfBounds(aKB);
|
||||
DumpKindOfClosed(aKC);
|
||||
//
|
||||
if (aKN==GEOMAlgo_KN_SPHERE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
}
|
||||
if (aKN==GEOMAlgo_KN_CYLINDER) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
printf(" Height : %.3lf\n", myHeight);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_CONE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
printf(" Radius2 : %.3lf\n", myRadius2);
|
||||
printf(" Height : %.3lf\n", myHeight);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_TORUS) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
printf(" Radius2 : %.3lf\n", myRadius2);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_POLYHEDRON) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_BOX) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Length : %.3lf\n", myLength);
|
||||
printf(" Width : %.3lf\n", myWidth);
|
||||
printf(" Height : %.3lf\n", myHeight);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DumpFace
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::DumpFace()const
|
||||
{
|
||||
Standard_Integer aNbV, aNbE;
|
||||
GEOMAlgo_KindOfShape aKS;
|
||||
GEOMAlgo_KindOfName aKN;
|
||||
GEOMAlgo_KindOfBounds aKB;
|
||||
GEOMAlgo_KindOfClosed aKC;
|
||||
//
|
||||
aNbV=NbSubShapes(TopAbs_VERTEX);
|
||||
aNbE=NbSubShapes(TopAbs_EDGE);
|
||||
aKS=KindOfShape();
|
||||
aKN=KindOfName();
|
||||
aKB=KindOfBounds();
|
||||
aKC=KindOfClosed();
|
||||
//
|
||||
printf(" *FACE\n");
|
||||
printf(" number of vertices: %d\n", aNbV);
|
||||
printf(" number of edges : %d\n", aNbE);
|
||||
DumpKindOfShape (aKS);
|
||||
DumpKindOfName (aKN);
|
||||
DumpKindOfBounds(aKB);
|
||||
DumpKindOfClosed(aKC);
|
||||
//
|
||||
// PLANE
|
||||
if (aKN==GEOMAlgo_KN_PLANE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_DISKCIRCLE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_DISKELLIPSE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
printf(" Radius2 : %.3lf\n", myRadius2);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_RECTANGLE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Length : %.3lf\n", myLength);
|
||||
printf(" Width : %.3lf\n", myWidth);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_TRIANGLE ||
|
||||
aKN==GEOMAlgo_KN_QUADRANGLE||
|
||||
aKN==GEOMAlgo_KN_POLYGON) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
}
|
||||
//
|
||||
// SPHERE
|
||||
else if (aKN==GEOMAlgo_KN_SPHERE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf", myRadius1);
|
||||
}
|
||||
//
|
||||
// CYLINDER
|
||||
else if (aKN==GEOMAlgo_KN_CYLINDER) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
printf(" Height : %.3lf\n", myHeight);
|
||||
}
|
||||
//
|
||||
// CONE
|
||||
else if (aKN==GEOMAlgo_KN_CONE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
printf(" Radius2 : %.3lf\n", myRadius2);
|
||||
printf(" Height : %.3lf\n", myHeight);
|
||||
}
|
||||
//
|
||||
// TORUS
|
||||
else if (aKN==GEOMAlgo_KN_TORUS) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
printf(" Radius2 : %.3lf\n", myRadius2);
|
||||
}
|
||||
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpShell
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::DumpShell()const
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, aNbF;
|
||||
GEOMAlgo_KindOfClosed aKC;
|
||||
//
|
||||
printf(" *SHELL\n");
|
||||
//
|
||||
aNbV=NbSubShapes(TopAbs_VERTEX);
|
||||
aNbE=NbSubShapes(TopAbs_EDGE);
|
||||
aNbF=NbSubShapes(TopAbs_FACE);
|
||||
printf(" number of vertices: %d\n", aNbV);
|
||||
printf(" number of edges : %d\n", aNbE);
|
||||
printf(" number of faces : %d\n", aNbF);
|
||||
aKC=KindOfClosed();
|
||||
DumpKindOfClosed(aKC);
|
||||
printf("\n");
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpWire
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::DumpWire()const
|
||||
{
|
||||
Standard_Integer aNbV, aNbE;
|
||||
GEOMAlgo_KindOfClosed aKC;
|
||||
//
|
||||
printf(" *WIRE\n");
|
||||
//
|
||||
aNbV=NbSubShapes(TopAbs_VERTEX);
|
||||
aNbE=NbSubShapes(TopAbs_EDGE);
|
||||
printf(" number of vertices: %d\n", aNbV);
|
||||
printf(" number of edges : %d\n", aNbE);
|
||||
|
||||
aKC=KindOfClosed();
|
||||
DumpKindOfClosed(aKC);
|
||||
printf("\n");
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::DumpEdge()const
|
||||
{
|
||||
Standard_Integer aNbV;
|
||||
Standard_Real aX, aY, aZ;
|
||||
GEOMAlgo_KindOfShape aKS;
|
||||
GEOMAlgo_KindOfName aKN;
|
||||
GEOMAlgo_KindOfBounds aKB;
|
||||
GEOMAlgo_KindOfClosed aKC;
|
||||
//
|
||||
aNbV=NbSubShapes(TopAbs_VERTEX);
|
||||
aKS=KindOfShape();
|
||||
aKN=KindOfName();
|
||||
aKB=KindOfBounds();
|
||||
aKC=KindOfClosed();
|
||||
//
|
||||
printf(" *EDGE\n");
|
||||
printf(" number of vertices: %d\n", aNbV);
|
||||
DumpKindOfShape (aKS);
|
||||
DumpKindOfName (aKN);
|
||||
DumpKindOfBounds(aKB);
|
||||
DumpKindOfClosed(aKC);
|
||||
//
|
||||
// LINE
|
||||
if (aKN==GEOMAlgo_KN_LINE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpDirection(myDirection);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_SEGMENT) {
|
||||
DumpLocation (myLocation);
|
||||
DumpDirection(myDirection);
|
||||
printf(" Length : %.3lf\n", myLength);
|
||||
myPnt1.Coord(aX, aY, aZ);
|
||||
printf(" Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
|
||||
myPnt2.Coord(aX, aY, aZ);
|
||||
printf(" Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
|
||||
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_CIRCLE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_ARCCIRCLE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
myPnt1.Coord(aX, aY, aZ);
|
||||
printf(" Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
|
||||
myPnt2.Coord(aX, aY, aZ);
|
||||
printf(" Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_ELLIPSE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
printf(" Radius2 : %.3lf\n", myRadius2);
|
||||
}
|
||||
else if (aKN==GEOMAlgo_KN_ARCELLIPSE) {
|
||||
DumpLocation (myLocation);
|
||||
DumpPosition (myPosition);
|
||||
printf(" Radius1 : %.3lf\n", myRadius1);
|
||||
printf(" Radius2 : %.3lf\n", myRadius2);
|
||||
myPnt1.Coord(aX, aY, aZ);
|
||||
printf(" Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
|
||||
myPnt2.Coord(aX, aY, aZ);
|
||||
printf(" Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpVertex
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfo::DumpVertex()const
|
||||
{
|
||||
printf(" *VERTEX\n");
|
||||
DumpLocation(myLocation);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpLocation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DumpLocation(const gp_Pnt& aP)
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
//
|
||||
aP.Coord(aX, aY, aZ);
|
||||
printf(" Location : %.3lf %.3lf %.3lf \n", aX, aY, aZ);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpDirection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DumpDirection(const gp_Dir& aD)
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
//
|
||||
aD.Coord(aX, aY, aZ);
|
||||
printf(" Direction: %.3lf %.3lf %.3lf \n", aX, aY, aZ);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpPosition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DumpPosition(const gp_Ax3& aAx3)
|
||||
{
|
||||
const gp_Dir& aDZ=aAx3.Axis().Direction();
|
||||
const gp_Dir& aDX=aAx3.XDirection();
|
||||
const gp_Dir& aDY=aAx3.YDirection();
|
||||
printf(" Position:\n");
|
||||
printf(" Axis: %.3lf %.3lf %.3lf \n", aDZ.X(), aDZ.Y(), aDZ.Z());
|
||||
printf(" X : %.3lf %.3lf %.3lf \n", aDX.X(), aDX.Y(), aDX.Z());
|
||||
printf(" Y : %.3lf %.3lf %.3lf \n", aDY.X(), aDY.Y(), aDY.Z());
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpKindOfBounds
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB)
|
||||
{
|
||||
char *pStr[]={
|
||||
"KB_UNKNOWN",
|
||||
"KB_TRIMMED",
|
||||
"KB_INFINITE"
|
||||
};
|
||||
int i;
|
||||
//
|
||||
i=(Standard_Integer)aKB;
|
||||
printf(" KindOfBounds: %s\n", pStr[i]);
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpKindOfClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DumpKindOfClosed(const GEOMAlgo_KindOfClosed aKC)
|
||||
{
|
||||
char *pStr[]={
|
||||
"KC_UNKNOWN",
|
||||
"KC_CLOSED",
|
||||
"KC_NOTCLOSED"
|
||||
};
|
||||
int i;
|
||||
//
|
||||
i=(Standard_Integer)aKC;
|
||||
printf(" KindOfClosed: %s\n", pStr[i]);
|
||||
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpKindOfShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DumpKindOfShape(const GEOMAlgo_KindOfShape aKS)
|
||||
{
|
||||
char *pStr[]={
|
||||
"KS_UNKNOWN",
|
||||
"KS_SPHERE",
|
||||
"KS_CYLINDER",
|
||||
"KS_BOX",
|
||||
"KS_TORUS",
|
||||
"KS_CONE",
|
||||
"KS_ELLIPSE",
|
||||
"KS_PLANE",
|
||||
"KS_CIRCLE",
|
||||
"KS_LINE",
|
||||
"KS_DEGENERATED"
|
||||
};
|
||||
int i;
|
||||
//
|
||||
i=(Standard_Integer)aKS;
|
||||
printf(" KindOfShape : %s\n", pStr[i]);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : DumpKindOfName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void DumpKindOfName(const GEOMAlgo_KindOfName aKS)
|
||||
{
|
||||
char *pStr[]={
|
||||
"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"
|
||||
};
|
||||
int i;
|
||||
//
|
||||
i=(Standard_Integer)aKS;
|
||||
printf(" KindOfName : %s\n", pStr[i]);
|
||||
}
|
272
src/GEOMAlgo/GEOMAlgo_ShapeInfo.hxx
Normal file
272
src/GEOMAlgo/GEOMAlgo_ShapeInfo.hxx
Normal file
@ -0,0 +1,272 @@
|
||||
// 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_ShapeInfo_HeaderFile
|
||||
#define _GEOMAlgo_ShapeInfo_HeaderFile
|
||||
|
||||
#ifndef _TopAbs_ShapeEnum_HeaderFile
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Integer_HeaderFile
|
||||
#include <Standard_Integer.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_KindOfShape_HeaderFile
|
||||
#include <GEOMAlgo_KindOfShape.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_KindOfName_HeaderFile
|
||||
#include <GEOMAlgo_KindOfName.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_KindOfBounds_HeaderFile
|
||||
#include <GEOMAlgo_KindOfBounds.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_KindOfClosed_HeaderFile
|
||||
#include <GEOMAlgo_KindOfClosed.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Pnt_HeaderFile
|
||||
#include <gp_Pnt.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Dir_HeaderFile
|
||||
#include <gp_Dir.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Ax3_HeaderFile
|
||||
#include <gp_Ax3.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Real_HeaderFile
|
||||
#include <Standard_Real.hxx>
|
||||
#endif
|
||||
class gp_Pnt;
|
||||
class gp_Dir;
|
||||
class gp_Ax2;
|
||||
class gp_Ax3;
|
||||
|
||||
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Macro_HeaderFile
|
||||
#include <Standard_Macro.hxx>
|
||||
#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
|
26
src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx
Normal file
26
src/GEOMAlgo/GEOMAlgo_ShapeInfo.ixx
Normal file
@ -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 <GEOMAlgo_ShapeInfo.jxx>
|
||||
|
||||
|
||||
|
||||
|
15
src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx
Normal file
15
src/GEOMAlgo/GEOMAlgo_ShapeInfo.jxx
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef _gp_Pnt_HeaderFile
|
||||
#include <gp_Pnt.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Dir_HeaderFile
|
||||
#include <gp_Dir.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Ax2_HeaderFile
|
||||
#include <gp_Ax2.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Ax3_HeaderFile
|
||||
#include <gp_Ax3.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_ShapeInfo_HeaderFile
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
#endif
|
132
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl
Normal file
132
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cdl
Normal file
@ -0,0 +1,132 @@
|
||||
-- File: GEOMAlgo_ShapeInfoFiller.cdl
|
||||
-- Created: Mon Apr 2 15:05:34 2007
|
||||
-- Author: Peter KURNEV
|
||||
-- <pkv@irinox>
|
||||
---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;
|
782
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx
Normal file
782
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx
Normal file
@ -0,0 +1,782 @@
|
||||
#include <GEOMAlgo_ShapeInfoFiller.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopExp.hxx>
|
||||
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <gp_Cone.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
|
||||
|
||||
|
||||
|
||||
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<aNb; ++i) {
|
||||
if (aTypes[i]==aST) {
|
||||
continue;
|
||||
}
|
||||
aM.Clear();
|
||||
TopExp::MapShapes(aS, aTypes[i], aM);
|
||||
aNbS=aM.Extent();
|
||||
aInfo.SetNbSubShapes(aTypes[i], aNbS);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function :NbShells
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer NbShells(const TopoDS_Solid& aSd)
|
||||
{
|
||||
Standard_Integer iCnt;
|
||||
TopoDS_Iterator aIt;
|
||||
//
|
||||
iCnt=0;
|
||||
//
|
||||
aIt.Initialize(aSd);
|
||||
for (; aIt.More(); aIt.Next()){
|
||||
//const TopoDS_Shape& aSh=aIt.Value();
|
||||
++iCnt;
|
||||
}
|
||||
return iCnt;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : NbWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer NbWires(const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Integer iCnt;
|
||||
TopoDS_Iterator aIt;
|
||||
//
|
||||
iCnt=0;
|
||||
//
|
||||
aIt.Initialize(aF);
|
||||
for (; aIt.More(); aIt.Next()){
|
||||
//const TopoDS_Shape& aW=aIt.Value();
|
||||
++iCnt;
|
||||
}
|
||||
return iCnt;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsAllowedType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer i, aNb;
|
||||
GeomAbs_CurveType aTypes[]={
|
||||
GeomAbs_Line, GeomAbs_Circle, GeomAbs_Ellipse
|
||||
};
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aNb=sizeof(aTypes)/sizeof(aTypes[0]);
|
||||
for (i=0; i<aNb && !bRet; ++i) {
|
||||
bRet=(aCT==aTypes[i]);
|
||||
}
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsAllowedType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsAllowedType(const GeomAbs_SurfaceType aST)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer i, aNb;
|
||||
GeomAbs_SurfaceType aTypes[]={
|
||||
GeomAbs_Plane, GeomAbs_Cylinder,
|
||||
GeomAbs_Cone, GeomAbs_Sphere,
|
||||
GeomAbs_Torus
|
||||
};
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aNb=sizeof(aTypes)/sizeof(aTypes[0]);
|
||||
for (i=0; i<aNb && !bRet; ++i) {
|
||||
bRet=(aST==aTypes[i]);
|
||||
}
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
// myErrorStatus
|
||||
//
|
||||
// 0 - Ok
|
||||
// 1 - The object is just initialized
|
||||
//
|
||||
// 10 - Null shape
|
||||
// 11 - circle/ellipse edge without vertices
|
186
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.hxx
Normal file
186
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.hxx
Normal file
@ -0,0 +1,186 @@
|
||||
// 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_ShapeInfoFiller_HeaderFile
|
||||
#define _GEOMAlgo_ShapeInfoFiller_HeaderFile
|
||||
|
||||
#ifndef _TopoDS_Shape_HeaderFile
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_ShapeInfo_HeaderFile
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_IndexedDataMapOfShapeShapeInfo_HeaderFile
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Real_HeaderFile
|
||||
#include <Standard_Real.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_Algo_HeaderFile
|
||||
#include <GEOMAlgo_Algo.hxx>
|
||||
#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 <Standard.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_Macro_HeaderFile
|
||||
#include <Standard_Macro.hxx>
|
||||
#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
|
26
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx
Normal file
26
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.ixx
Normal file
@ -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 <GEOMAlgo_ShapeInfoFiller.jxx>
|
||||
|
||||
|
||||
|
||||
|
30
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx
Normal file
30
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.jxx
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef _TopoDS_Shape_HeaderFile
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_ShapeInfo_HeaderFile
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
#endif
|
||||
#ifndef _TopoDS_Face_HeaderFile
|
||||
#include <TopoDS_Face.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Pln_HeaderFile
|
||||
#include <gp_Pln.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Sphere_HeaderFile
|
||||
#include <gp_Sphere.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Cylinder_HeaderFile
|
||||
#include <gp_Cylinder.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Cone_HeaderFile
|
||||
#include <gp_Cone.hxx>
|
||||
#endif
|
||||
#ifndef _gp_Torus_HeaderFile
|
||||
#include <gp_Torus.hxx>
|
||||
#endif
|
||||
#ifndef _TopoDS_Solid_HeaderFile
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#endif
|
||||
#ifndef _GEOMAlgo_ShapeInfoFiller_HeaderFile
|
||||
#include <GEOMAlgo_ShapeInfoFiller.hxx>
|
||||
#endif
|
684
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx
Normal file
684
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx
Normal file
@ -0,0 +1,684 @@
|
||||
#include <GEOMAlgo_ShapeInfoFiller.ixx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//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; i<aNbFi; ++i) {
|
||||
const TopoDS_Shape& aFi=aMFi(i+1);
|
||||
const GEOMAlgo_ShapeInfo& aIFi=myMapInfo.FindFromKey(aFi);
|
||||
aPi=aIFi.Location();
|
||||
aDist[i]=aPc.Distance(aPi);
|
||||
if (aDist[i]>aDistMax) {
|
||||
aDistMax=aDist[i];
|
||||
iMax=i;
|
||||
}
|
||||
if (aDist[i]<aDistMin) {
|
||||
aDistMin=aDist[i];
|
||||
iMin=i;
|
||||
}
|
||||
gp_Vec aVi(aPc, aPi);
|
||||
gp_Dir aDi(aVi);
|
||||
aDir[i]=aDi;
|
||||
}
|
||||
//
|
||||
if (iMax==iMin) {
|
||||
iMax=0;
|
||||
iMin=1;
|
||||
}
|
||||
iMid=3-iMax-iMin;
|
||||
//
|
||||
aLength=2.*aDist[iMax];
|
||||
aWidth=2.*aDist[iMid];
|
||||
aHeight=2.*aDist[iMin];
|
||||
//
|
||||
gp_Ax2 aAx2(aPc, aDir[iMin], aDir[iMax]);
|
||||
gp_Ax3 aAx3(aAx2);
|
||||
//
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_BOX);
|
||||
aInfo.SetLocation(aPc);
|
||||
aInfo.SetLength(aLength);
|
||||
aInfo.SetWidth(aWidth);
|
||||
aInfo.SetHeight(aHeight);
|
||||
aInfo.SetPosition(aAx3);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FillDetails
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Pln& aPln)
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, i, j;
|
||||
Standard_Real aDot, aD0, aD1, aLength, aWidth;
|
||||
gp_Dir aDx[4], aDX;
|
||||
gp_Pnt aPx[4], aP, aPc;
|
||||
gp_XYZ aXYZc;
|
||||
TopExp_Explorer aExp;
|
||||
TopoDS_Shape aE;
|
||||
TopoDS_Wire aW;
|
||||
TopoDS_Edge aEx;
|
||||
TopoDS_Iterator aIt;
|
||||
TopTools_IndexedMapOfShape aMV;
|
||||
BRepTools_WireExplorer aWExp;
|
||||
GEOMAlgo_KindOfName aKN, aKNE;
|
||||
GEOMAlgo_KindOfShape aKS;
|
||||
//
|
||||
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
|
||||
aKN=GEOMAlgo_KN_UNKNOWN;
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
|
||||
//
|
||||
aKS=aInfo.KindOfShape();
|
||||
if (aKS!=GEOMAlgo_KS_PLANE) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
|
||||
return;
|
||||
}
|
||||
//
|
||||
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
|
||||
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
|
||||
//
|
||||
// 1. may be it is circle/ellipse
|
||||
if (aNbV==1 && aNbE==1) {
|
||||
aExp.Init(aF, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
aE=aExp.Current();
|
||||
break;
|
||||
}
|
||||
//
|
||||
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
|
||||
aKNE=aInfoE.KindOfName();
|
||||
if (aKNE==GEOMAlgo_KN_CIRCLE) {
|
||||
aKN=GEOMAlgo_KN_DISKCIRCLE;
|
||||
aInfo.SetKindOfName(aKN);
|
||||
aInfo.SetRadius1(aInfoE.Radius1());
|
||||
}
|
||||
if (aKNE==GEOMAlgo_KN_ELLIPSE) {
|
||||
aKN=GEOMAlgo_KN_DISKELLIPSE;
|
||||
aInfo.SetKindOfName(aKN);
|
||||
aInfo.SetRadius1(aInfoE.Radius1());
|
||||
aInfo.SetRadius2(aInfoE.Radius2());
|
||||
}
|
||||
}
|
||||
//
|
||||
// 2. may be it is rectangle
|
||||
else {
|
||||
aExp.Init(aF, TopAbs_EDGE);
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
aE=aExp.Current();
|
||||
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
|
||||
aKNE=aInfoE.KindOfName();
|
||||
if (aKNE!=GEOMAlgo_KN_SEGMENT) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_POLYGON);
|
||||
//
|
||||
if (aNbV==3 && aNbE==3) {
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_TRIANGLE);
|
||||
return;
|
||||
}
|
||||
if (!(aNbV==4 && aNbE==4)) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
// aNbV==4 && aNbE==4 and all edges are segments
|
||||
aIt.Initialize(aF);
|
||||
for (; aIt.More(); aIt.Next()){
|
||||
aW=TopoDS::Wire(aIt.Value());
|
||||
break;
|
||||
}
|
||||
//
|
||||
aWExp.Init(aW, aF);
|
||||
for (i=0; aWExp.More(); aWExp.Next(), ++i) {
|
||||
aEx=aWExp.Current();
|
||||
const GEOMAlgo_ShapeInfo& aInfoEx=myMapInfo.FindFromKey(aEx);
|
||||
aDx[i]=aInfoEx.Direction();
|
||||
aPx[i]=aInfoEx.Location();
|
||||
}
|
||||
//
|
||||
for (i=0; i<4; ++i) {
|
||||
j=(i==3) ? 0 : i+1;
|
||||
aDot=aDx[i]*aDx[j];
|
||||
if (fabs (aDot) > 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 (aD0<aD1) {
|
||||
aLength=aD1;
|
||||
aWidth =aD0;
|
||||
aDX=aL0.Direction();
|
||||
}
|
||||
//
|
||||
aLength=2.*aLength;
|
||||
aWidth =2.*aWidth;
|
||||
//
|
||||
aInfo.SetLocation(aPc);
|
||||
aInfo.SetLength(aLength);
|
||||
aInfo.SetWidth(aWidth);
|
||||
//
|
||||
const gp_Dir& aDZ=aPln.Axis().Direction();
|
||||
gp_Ax2 aAx2(aPc, aDZ, aDX);
|
||||
gp_Ax3 aAx3(aAx2);
|
||||
aInfo.SetPosition(aAx3);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FillDetails
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Sphere& )
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, aNbSE, aNbDE;
|
||||
TopoDS_Edge aE;
|
||||
TopExp_Explorer aExp;
|
||||
TopTools_MapOfShape aM;
|
||||
GEOMAlgo_KindOfShape aKS, aKSE;
|
||||
//
|
||||
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
|
||||
//
|
||||
aKS=aInfo.KindOfShape();
|
||||
if (aKS!=GEOMAlgo_KS_SPHERE) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
|
||||
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
|
||||
if (!(aNbV==2 && aNbE==3)) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
aNbSE=0;
|
||||
aNbDE=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);
|
||||
aKSE=aInfoE.KindOfShape();
|
||||
//
|
||||
if (BRep_Tool::IsClosed(aE, aF)) {
|
||||
++aNbSE;
|
||||
}
|
||||
else if (aKSE==GEOMAlgo_KS_DEGENERATED) {
|
||||
++aNbDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!(aNbSE==1 && aNbDE==2)) {
|
||||
return;
|
||||
}
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FillDetails
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Cone& )//aCone)
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i;
|
||||
Standard_Real aR[3], aHeight;
|
||||
gp_Pnt aPC[3], aPD, aPc, aPX[3];
|
||||
TopoDS_Vertex aVD;
|
||||
TopoDS_Edge aE;
|
||||
TopoDS_Iterator aIt;
|
||||
TopExp_Explorer aExp;
|
||||
TopTools_MapOfShape aM;
|
||||
GEOMAlgo_KindOfShape aKS, aKSE;
|
||||
GEOMAlgo_KindOfName aKN, aKNE;
|
||||
GEOMAlgo_KindOfClosed aKCE;
|
||||
//
|
||||
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
|
||||
aKN=GEOMAlgo_KN_UNKNOWN;
|
||||
aInfo.SetKindOfName(aKN);
|
||||
//
|
||||
aKS=aInfo.KindOfShape();
|
||||
if (aKS!=GEOMAlgo_KS_CONE) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
|
||||
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
|
||||
if (!(aNbV==2 && aNbE==3)) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
i=0;
|
||||
aNbCE=0;
|
||||
aNbSE=0;
|
||||
aNbDE=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);
|
||||
aKNE=aInfoE.KindOfName();
|
||||
aKCE=aInfoE.KindOfClosed();
|
||||
aKSE=aInfoE.KindOfShape();
|
||||
if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
|
||||
aPC[i]=aInfoE.Location();
|
||||
aR[i]=aInfoE.Radius1();
|
||||
//
|
||||
aIt.Initialize(aE);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aVD=TopoDS::Vertex(aIt.Value());
|
||||
break;
|
||||
}
|
||||
aPX[i]=BRep_Tool::Pnt(aVD);
|
||||
//
|
||||
++i;
|
||||
++aNbCE;
|
||||
}
|
||||
else if (aKNE==GEOMAlgo_KN_SEGMENT) {
|
||||
if (BRep_Tool::IsClosed(aE, aF)) {
|
||||
++aNbSE;
|
||||
}
|
||||
}
|
||||
else if (aKSE==GEOMAlgo_KS_DEGENERATED) {
|
||||
aIt.Initialize(aE);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
aVD=TopoDS::Vertex(aIt.Value());
|
||||
break;
|
||||
}
|
||||
//
|
||||
aPD=BRep_Tool::Pnt(aVD);
|
||||
//
|
||||
++aNbDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1)) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (aNbDE==1) {
|
||||
aPC[1]=aPD;
|
||||
aR[1]=0.;
|
||||
}
|
||||
gp_Vec aVz(aPC[0], aPC[1]);
|
||||
gp_Vec aVx(aPC[0], aPX[0]);
|
||||
gp_Dir aDz(aVz);
|
||||
gp_Dir aDx(aVx);
|
||||
gp_Ax2 aAx2(aPC[0], aDz, aDx);
|
||||
gp_Ax3 aAx3(aAx2);
|
||||
//
|
||||
aHeight=aPC[0].Distance(aPC[1]);
|
||||
//
|
||||
aInfo.SetLocation(aPC[0]);
|
||||
aInfo.SetPosition(aAx3);
|
||||
aInfo.SetRadius1(aR[0]);
|
||||
aInfo.SetRadius2(aR[1]);
|
||||
aInfo.SetHeight(aHeight);
|
||||
//
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_CONE);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : FillDetails
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Cylinder& aCyl)
|
||||
{
|
||||
Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE;
|
||||
Standard_Real aT0, aT1, aHeight;
|
||||
gp_Pnt aPC[3], aPc;
|
||||
TopoDS_Edge aE;
|
||||
TopExp_Explorer aExp;
|
||||
TopTools_MapOfShape aM;
|
||||
GEOMAlgo_KindOfShape aKS;
|
||||
GEOMAlgo_KindOfName aKN, aKNE;
|
||||
GEOMAlgo_KindOfClosed aKCE;
|
||||
//
|
||||
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
|
||||
aKN=GEOMAlgo_KN_UNKNOWN;
|
||||
aInfo.SetKindOfName(aKN);
|
||||
//
|
||||
aKS=aInfo.KindOfShape();
|
||||
if (aKS!=GEOMAlgo_KS_CYLINDER) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
|
||||
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
|
||||
if (!(aNbV==2 && aNbE==3)) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
i=0;
|
||||
aNbCE=0;
|
||||
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);
|
||||
aKNE=aInfoE.KindOfName();
|
||||
aKCE=aInfoE.KindOfClosed();
|
||||
if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
|
||||
aPC[aNbCE]=aInfoE.Location();
|
||||
++aNbCE;
|
||||
}
|
||||
else if (aKNE==GEOMAlgo_KN_SEGMENT) {
|
||||
if (BRep_Tool::IsClosed(aE, aF)) {
|
||||
++aNbSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (!(aNbCE==2 && aNbSE==1)) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
const gp_Ax1& aAx1=aCyl.Axis();
|
||||
const gp_Dir& aDir=aAx1.Direction();
|
||||
const gp_Pnt& aPLoc=aAx1.Location();
|
||||
gp_Lin aLin(aPLoc, aDir);
|
||||
//
|
||||
aT0=ElCLib::Parameter(aLin, aPC[0]);
|
||||
aT1=ElCLib::Parameter(aLin, aPC[1]);
|
||||
//
|
||||
aPc=aPC[0];;
|
||||
if (aT0>aT1) {
|
||||
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);
|
||||
}
|
@ -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 <Standard_Macro.hxx>
|
||||
#endif
|
||||
#ifndef _Standard_HeaderFile
|
||||
#include <Standard.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _Handle_TCollection_MapNode_HeaderFile
|
||||
#include <Handle_TCollection_MapNode.hxx>
|
||||
#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
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user