|
||||
File indexing completed on 2025-01-18 10:05:34
0001 // Created on: 2015-05-14 0002 // Created by: Ilya Novikov 0003 // Copyright (c) 2000-2015 OPEN CASCADE SAS 0004 // 0005 // This file is part of Open CASCADE Technology software library. 0006 // 0007 // This library is free software; you can redistribute it and/or modify it under 0008 // the terms of the GNU Lesser General Public License version 2.1 as published 0009 // by the Free Software Foundation, with special exception defined in the file 0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0011 // distribution for complete text of the license and disclaimer of any warranty. 0012 // 0013 // Alternatively, this file may be used under the terms of Open CASCADE 0014 // commercial license or contractual agreement. 0015 0016 #ifndef _XCAFDoc_Editor_HeaderFile 0017 #define _XCAFDoc_Editor_HeaderFile 0018 0019 #include <TDataStd_Name.hxx> 0020 #include <TDF_Label.hxx> 0021 #include <TDF_LabelDataMap.hxx> 0022 #include <TDF_LabelSequence.hxx> 0023 0024 class XCAFDoc_VisMaterial; 0025 class XCAFDoc_ShapeTool; 0026 0027 //! Tool for edit structure of document. 0028 class XCAFDoc_Editor 0029 { 0030 public: 0031 0032 DEFINE_STANDARD_ALLOC 0033 0034 //! Converts shape (compound/compsolid/shell/wire) to assembly. 0035 //! @param[in] theDoc input document 0036 //! @param[in] theShape input shape label 0037 //! @param[in] theRecursively recursively expand a compound subshape 0038 //! @return True if shape successfully expanded 0039 Standard_EXPORT static Standard_Boolean Expand(const TDF_Label& theDoc, 0040 const TDF_Label& theShape, 0041 const Standard_Boolean theRecursively = Standard_True); 0042 0043 //! Converts all compounds shapes in the document to assembly 0044 //! @param[in] theDoc input document 0045 //! @param[in] theRecursively recursively expand a compound subshape 0046 //! @return True if shape successfully expanded 0047 Standard_EXPORT static Standard_Boolean Expand(const TDF_Label& theDoc, 0048 const Standard_Boolean theRecursively = Standard_True); 0049 0050 //! Clones all labels to a new position, keeping the structure with all the attributes 0051 //! @param[in] theSrcLabels original labels to copy from 0052 //! @param[in] theDstLabel label to set result as a component of or a main document's label to simply set new shape 0053 //! @param[in] theIsNoVisMat get a VisMaterial attributes as is or convert to color 0054 //! @return True if shape successfully extracted 0055 Standard_EXPORT static Standard_Boolean Extract(const TDF_LabelSequence& theSrcLabels, 0056 const TDF_Label& theDstLabel, 0057 const Standard_Boolean theIsNoVisMat = Standard_False); 0058 0059 //! Clones the label to a new position, keeping the structure with all the attributes 0060 //! @param[in] theSrcLabel original label to copy from 0061 //! @param[in] theDstLabel label to set result as a component of or a main document's label to simply set new shape 0062 //! @param[in] theIsNoVisMat get a VisMaterial attributes as is or convert to color 0063 //! @return True if shape successfully extracted 0064 Standard_EXPORT static Standard_Boolean Extract(const TDF_Label& theSrcLabel, 0065 const TDF_Label& theDstLabel, 0066 const Standard_Boolean theIsNoVisMat = Standard_False); 0067 0068 //! Copies shapes label with keeping of shape structure (recursively) 0069 //! @param[in] theSrcLabel original label to copy from 0070 //! @param[in] theSrcShapeTool shape tool to get 0071 //! @param[in] theDstShapeTool shape tool to set 0072 //! @param[out] theMap relating map of the original shapes label and labels created from them 0073 //! @return result shape label 0074 Standard_EXPORT static TDF_Label CloneShapeLabel(const TDF_Label& theSrcLabel, 0075 const Handle(XCAFDoc_ShapeTool)& theSrcShapeTool, 0076 const Handle(XCAFDoc_ShapeTool)& theDstShapeTool, 0077 TDF_LabelDataMap& theMap); 0078 0079 //! Copies metadata contains from the source label to the destination label. 0080 //! Protected against creating a new label for non-existent tools 0081 //! @param[in] theSrcLabel original label to copy from 0082 //! @param[in] theDstLabel destination shape label to set attributes 0083 //! @param[in] theVisMatMap relating map of the original VisMaterial and created. Can be NULL for the same document 0084 //! @param[in] theToCopyColor copying visible value and shape color (handled all color type) 0085 //! @param[in] theToCopyLayer copying layer 0086 //! @param[in] theToCopyMaterial copying material 0087 //! @param[in] theToCopyVisMaterial copying visual material 0088 //! @param[in] theToCopyAttributes copying of other node attributes, for example, a shape's property 0089 Standard_EXPORT static void CloneMetaData(const TDF_Label& theSrcLabel, 0090 const TDF_Label& theDstLabel, 0091 NCollection_DataMap<Handle(XCAFDoc_VisMaterial), Handle(XCAFDoc_VisMaterial)>* theVisMatMap, 0092 const Standard_Boolean theToCopyColor = Standard_True, 0093 const Standard_Boolean theToCopyLayer = Standard_True, 0094 const Standard_Boolean theToCopyMaterial = Standard_True, 0095 const Standard_Boolean theToCopyVisMaterial = Standard_True, 0096 const Standard_Boolean theToCopyAttributes = Standard_True); 0097 0098 //! Applies geometrical scaling to the following assembly components: 0099 //! - part geometry 0100 //! - sub-assembly/part occurrence location 0101 //! - part's centroid, area and volume attributes 0102 //! - PMIs (warnings and errors are reported if it is impossible to make changes) 0103 //! Normally, should start from a root sub-assembly, but if theForceIfNotRoot true 0104 //! scaling will be applied forcibly. If theLabel corresponds to the shape tool 0105 //! scaling is applied to the whole assembly. 0106 //! @param[in] theLabel starting label 0107 //! @param[in] theScaleFactor scale factor, should be positive 0108 //! @param[in] theForceIfNotRoot allows scaling of a non root assembly if true, 0109 //! otherwise - returns false 0110 //! @return true in case of success, otherwise - false. 0111 Standard_EXPORT static Standard_Boolean RescaleGeometry(const TDF_Label& theLabel, 0112 const Standard_Real theScaleFactor, 0113 const Standard_Boolean theForceIfNotRoot = Standard_False); 0114 0115 }; 0116 0117 #endif // _XCAFDoc_Editor_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |