Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:05

0001 // Created on: 1999-09-08
0002 // Created by: Andrey BETENEV
0003 // Copyright (c) 1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _STEPConstruct_ValidationProps_HeaderFile
0018 #define _STEPConstruct_ValidationProps_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <StepBasic_Unit.hxx>
0025 #include <STEPConstruct_Tool.hxx>
0026 #include <Standard_CString.hxx>
0027 #include <TColStd_SequenceOfTransient.hxx>
0028 class StepBasic_ProductDefinition;
0029 class StepData_Factors;
0030 class XSControl_WorkSession;
0031 class TopoDS_Shape;
0032 class StepRepr_RepresentationItem;
0033 class StepRepr_CharacterizedDefinition;
0034 class StepRepr_RepresentationContext;
0035 class gp_Pnt;
0036 class StepRepr_NextAssemblyUsageOccurrence;
0037 class StepRepr_PropertyDefinition;
0038 
0039 
0040 //! This class provides tools for access (write and read)
0041 //! the validation properties on shapes in the STEP file.
0042 //! These are surface area, solid volume and centroid.
0043 class STEPConstruct_ValidationProps  : public STEPConstruct_Tool
0044 {
0045 public:
0046 
0047   DEFINE_STANDARD_ALLOC
0048 
0049   
0050   //! Creates an empty tool
0051   Standard_EXPORT STEPConstruct_ValidationProps();
0052   
0053   //! Creates a tool and loads it with worksession
0054   Standard_EXPORT STEPConstruct_ValidationProps(const Handle(XSControl_WorkSession)& WS);
0055   
0056   //! Load worksession; returns True if succeeded
0057   Standard_EXPORT Standard_Boolean Init (const Handle(XSControl_WorkSession)& WS);
0058   
0059   //! General method for adding (writing) a validation property
0060   //! for shape which should be already mapped on writing itself.
0061   //! It uses FindTarget() to find target STEP entity
0062   //! resulting from given shape, and associated context
0063   //! Returns True if success, False in case of fail
0064   Standard_EXPORT Standard_Boolean AddProp (const TopoDS_Shape& Shape, const Handle(StepRepr_RepresentationItem)& Prop, const Standard_CString Descr, const Standard_Boolean instance = Standard_False);
0065   
0066   //! General method for adding (writing) a validation property
0067   //! for shape which should be already mapped on writing itself.
0068   //! It takes target and Context entities which correspond to shape
0069   //! Returns True if success, False in case of fail
0070   Standard_EXPORT Standard_Boolean AddProp (const StepRepr_CharacterizedDefinition& target, const Handle(StepRepr_RepresentationContext)& Context, const Handle(StepRepr_RepresentationItem)& Prop, const Standard_CString Descr);
0071   
0072   //! Adds surface area property for given shape (already mapped).
0073   //! Returns True if success, False in case of fail
0074   Standard_EXPORT Standard_Boolean AddArea (const TopoDS_Shape& Shape, const Standard_Real Area);
0075   
0076   //! Adds volume property for given shape (already mapped).
0077   //! Returns True if success, False in case of fail
0078   Standard_EXPORT Standard_Boolean AddVolume (const TopoDS_Shape& Shape, const Standard_Real Vol);
0079   
0080   //! Adds centroid property for given shape (already mapped).
0081   //! Returns True if success, False in case of fail
0082   //! If instance is True, then centroid is assigned to
0083   //! an instance of component in assembly
0084   Standard_EXPORT Standard_Boolean AddCentroid (const TopoDS_Shape& Shape, const gp_Pnt& Pnt, const Standard_Boolean instance = Standard_False);
0085   
0086   //! Finds target STEP entity to which validation props should
0087   //! be assigned, and corresponding context, starting from shape
0088   //! Returns True if success, False in case of fail
0089   Standard_EXPORT Standard_Boolean FindTarget (const TopoDS_Shape& S, StepRepr_CharacterizedDefinition& target, Handle(StepRepr_RepresentationContext)& Context, const Standard_Boolean instance = Standard_False);
0090   
0091   //! Searches for entities of the type PropertyDefinitionRepresentation
0092   //! in the model and fills the sequence by them
0093   Standard_EXPORT Standard_Boolean LoadProps (TColStd_SequenceOfTransient& seq) const;
0094   
0095   //! Returns CDSR associated with given PpD or NULL if not found
0096   //! (when, try GetPropSDR)
0097   Standard_EXPORT Handle(StepRepr_NextAssemblyUsageOccurrence) GetPropNAUO (const Handle(StepRepr_PropertyDefinition)& PD) const;
0098   
0099   //! Returns SDR associated with given PpD or NULL if not found
0100   //! (when, try GetPropCDSR)
0101   Standard_EXPORT Handle(StepBasic_ProductDefinition) GetPropPD (const Handle(StepRepr_PropertyDefinition)& PD) const;
0102   
0103   //! Returns Shape associated with given SDR or Null Shape
0104   //! if not found
0105   Standard_EXPORT TopoDS_Shape GetPropShape (const Handle(StepBasic_ProductDefinition)& ProdDef) const;
0106   
0107   //! Returns Shape associated with given PpD or Null Shape
0108   //! if not found
0109   Standard_EXPORT TopoDS_Shape GetPropShape (const Handle(StepRepr_PropertyDefinition)& PD) const;
0110   
0111   //! Returns value of Real-Valued property (Area or Volume)
0112   //! If Property is neither Area nor Volume, returns False
0113   //! Else returns True and isArea indicates whether property
0114   //! is area or volume
0115   Standard_EXPORT Standard_Boolean GetPropReal (const Handle(StepRepr_RepresentationItem)& item,
0116                                                 Standard_Real& Val,
0117                                                 Standard_Boolean& isArea,
0118                                                 const StepData_Factors& theLocalFactors) const;
0119   
0120   //! Returns value of Centriod property (or False if it is not)
0121   Standard_EXPORT Standard_Boolean GetPropPnt (const Handle(StepRepr_RepresentationItem)& item,
0122                                                const Handle(StepRepr_RepresentationContext)& Context,
0123                                                gp_Pnt& Pnt,
0124                                                const StepData_Factors& theLocalFactors) const;
0125   
0126   //! Sets current assembly shape SDR (for FindCDSR calls)
0127   Standard_EXPORT void SetAssemblyShape (const TopoDS_Shape& shape);
0128 
0129 
0130 
0131 
0132 protected:
0133 
0134 
0135 
0136 
0137 
0138 private:
0139 
0140 
0141 
0142   StepBasic_Unit areaUnit;
0143   StepBasic_Unit volUnit;
0144   Handle(StepBasic_ProductDefinition) myAssemblyPD;
0145 
0146 
0147 };
0148 
0149 
0150 
0151 
0152 
0153 
0154 
0155 #endif // _STEPConstruct_ValidationProps_HeaderFile