1 // Copyright (c) 2022 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _RWPly_ConfigurationNode_HeaderFile
15 #define _RWPly_ConfigurationNode_HeaderFile
17 #include <DE_ConfigurationNode.hxx>
18 #include <Precision.hxx>
19 #include <RWMesh_CoordinateSystem.hxx>
21 class DE_ConfigurationContext;
23 //! The purpose of this class is to configure the transfer process for PLY format
24 //! Stores the necessary settings for RWPly_Provider.
25 //! Configures and creates special provider to transfer PLY files.
27 //! Nodes grouped by Vendor name and Format type.
28 //! The Vendor name is "OCC"
29 //! The Format type is "PLY"
30 //! The supported CAD extension is ".ply"
31 //! The import process isn't supported.
32 //! The export process is supported.
33 class RWPly_ConfigurationNode : public DE_ConfigurationNode
35 DEFINE_STANDARD_RTTIEXT(RWPly_ConfigurationNode, DE_ConfigurationNode)
38 //! Initializes all field by default
39 Standard_EXPORT RWPly_ConfigurationNode();
41 //! Copies values of all fields
42 //! @param[in] theNode object to copy
43 Standard_EXPORT RWPly_ConfigurationNode(const Handle(RWPly_ConfigurationNode)& theNode);
45 //! Updates values according the resource
46 //! @param[in] theResource input resource to use
47 //! @return true if theResource loading has ended correctly
48 Standard_EXPORT virtual bool Load(const Handle(DE_ConfigurationContext)& theResource) Standard_OVERRIDE;
50 //! Writes configuration to the string
51 //! @return result resource string
52 Standard_EXPORT virtual TCollection_AsciiString Save() const Standard_OVERRIDE;
54 //! Copies values of all fields
55 //! @return new object with the same field values
56 Standard_EXPORT virtual Handle(DE_ConfigurationNode) Copy() const Standard_OVERRIDE;
58 //! Creates new provider for the own format
59 //! @return new created provider
60 Standard_EXPORT virtual Handle(DE_Provider) BuildProvider() Standard_OVERRIDE;
64 //! Checks the import supporting
65 //! @return true if import is supported
66 Standard_EXPORT virtual bool IsImportSupported() const Standard_OVERRIDE;
68 //! Checks the export supporting
69 //! @return true if export is supported
70 Standard_EXPORT virtual bool IsExportSupported() const Standard_OVERRIDE;
72 //! Gets CAD format name of associated provider
73 //! @return provider CAD format
74 Standard_EXPORT virtual TCollection_AsciiString GetFormat() const Standard_OVERRIDE;
76 //! Gets provider's vendor name of associated provider
77 //! @return provider's vendor name
78 Standard_EXPORT virtual TCollection_AsciiString GetVendor() const Standard_OVERRIDE;
80 //! Gets list of supported file extensions
81 //! @return list of extensions
82 Standard_EXPORT virtual TColStd_ListOfAsciiString GetExtensions() const Standard_OVERRIDE;
84 //! Checks the file content to verify a format
85 //! @param[in] theBuffer read stream buffer to check content
86 //! @return Standard_True if file is supported by a current provider
87 Standard_EXPORT virtual bool CheckContent(const Handle(NCollection_Buffer)& theBuffer) const Standard_OVERRIDE;
90 struct RWPly_InternalSection
93 double FileLengthUnit = 1.; //!< File length units to convert from while reading the file, defined as scale factor for m (meters)
94 RWMesh_CoordinateSystem SystemCS = RWMesh_CoordinateSystem_Zup; //!< System origin coordinate system to perform conversion into during read
95 RWMesh_CoordinateSystem FileCS = RWMesh_CoordinateSystem_Yup; //!< File origin coordinate system to perform conversion during read
97 bool WriteNormals = true; //!< Flag for write normals
98 bool WriteColors = true; //!< Flag for write colors
99 bool WriteTexCoords = false; //!< Flag for write UV / texture coordinates
100 bool WritePartId = true; //!< Flag for write part Id as element attribute
101 bool WriteFaceId = false; //!< Flag for write face Id as element attribute. Cannot be combined with HasPartId
102 TCollection_AsciiString WriteComment; //!< Export special comment
103 TCollection_AsciiString WriteAuthor; //!< Author of exported file name
104 } InternalParameters;
107 #endif // _RWPly_ConfigurationNode_HeaderFile