1 // Copyright (c) 2020 OPEN CASCADE SAS 2 // 3 // This file is part of the examples of the Open CASCADE Technology software library. 4 // 5 // Permission is hereby granted, free of charge, to any person obtaining a copy 6 // of this software and associated documentation files (the "Software"), to deal 7 // in the Software without restriction, including without limitation the rights 8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 // copies of the Software, and to permit persons to whom the Software is 10 // furnished to do so, subject to the following conditions: 11 // 12 // The above copyright notice and this permission notice shall be included in all 13 // copies or substantial portions of the Software. 14 // 15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE 21 22 #ifndef DATAEXCHANGESAMPLES_H 23 #define DATAEXCHANGESAMPLES_H 24 25 #include "BaseSample.h" 26 27 #include <STEPControl_StepModelType.hxx> 28 #include <V3d_View.hxx> 29 30 //! Implements Data Exchange samples 31 class DataExchangeSamples : public BaseSample 32 { DEFINE_STANDARD_RTTI_INLINE(DataExchangeSamples,BaseSample)33 DEFINE_STANDARD_RTTI_INLINE(DataExchangeSamples, BaseSample) 34 public: 35 36 DataExchangeSamples (const TCollection_AsciiString& theSampleSourcePath, 37 const Handle(V3d_View)& theView, 38 const Handle(AIS_InteractiveContext)& theContext) 39 : BaseSample (theSampleSourcePath, theContext), 40 myStepType (STEPControl_AsIs), 41 myView (theView) 42 { 43 // 44 } 45 46 virtual void Process (const TCollection_AsciiString& theSampleName) Standard_OVERRIDE; 47 48 void AppendBottle(); SetFileName(TCollection_AsciiString theFileName)49 void SetFileName(TCollection_AsciiString theFileName) { myFileName = theFileName; }; SetStepType(STEPControl_StepModelType theStepType)50 void SetStepType(STEPControl_StepModelType theStepType) { myStepType = theStepType; }; 51 IsExportSample(const TCollection_AsciiString & theSampleName)52 static Standard_Boolean IsExportSample(const TCollection_AsciiString& theSampleName) { return theSampleName == "BrepExportSample" 53 || theSampleName == "StepExportSample" 54 || theSampleName == "IgesExportSample" 55 || theSampleName == "StlExportSample" 56 || theSampleName == "VrmlExportSample" 57 || theSampleName == "ImageExportSample"; } IsImportSample(const TCollection_AsciiString & theSampleName)58 static Standard_Boolean IsImportSample(const TCollection_AsciiString& theSampleName) { return theSampleName == "BrepImportSample" 59 || theSampleName == "StepImportSample" 60 || theSampleName == "IgesImportSample"; } IsBrepSample(const TCollection_AsciiString & theSampleName)61 static Standard_Boolean IsBrepSample (const TCollection_AsciiString& theSampleName) { return theSampleName == "BrepExportSample" || theSampleName == "BrepImportSample"; } IsStepSample(const TCollection_AsciiString & theSampleName)62 static Standard_Boolean IsStepSample (const TCollection_AsciiString& theSampleName) { return theSampleName == "StepExportSample" || theSampleName == "StepImportSample"; } IsIgesSample(const TCollection_AsciiString & theSampleName)63 static Standard_Boolean IsIgesSample (const TCollection_AsciiString& theSampleName) { return theSampleName == "IgesExportSample" || theSampleName == "IgesImportSample"; } IsStlSample(const TCollection_AsciiString & theSampleName)64 static Standard_Boolean IsStlSample (const TCollection_AsciiString& theSampleName) { return theSampleName == "StlExportSample"; } IsVrmlSample(const TCollection_AsciiString & theSampleName)65 static Standard_Boolean IsVrmlSample (const TCollection_AsciiString& theSampleName) { return theSampleName == "VrmlExportSample"; } IsImageSample(const TCollection_AsciiString & theSampleName)66 static Standard_Boolean IsImageSample (const TCollection_AsciiString& theSampleName) { return theSampleName == "ImageExportSample"; } 67 68 protected: 69 virtual void ExecuteSample (const TCollection_AsciiString& theSampleName) Standard_OVERRIDE; 70 71 private: 72 TCollection_AsciiString myFileName; 73 STEPControl_StepModelType myStepType; 74 Handle(V3d_View) myView; 75 76 private: 77 Standard_Boolean CheckFacetedBrep(); 78 // One function for every sample 79 void BrepExportSample(); 80 void StepExportSample(); 81 void IgesExportSample(); 82 void StlExportSample(); 83 void VrmlExportSample(); 84 void ImageExportSample(); 85 void BrepImportSample(); 86 void StepImportSample(); 87 void IgesImportSample(); 88 }; 89 90 #endif //DATAEXCHANGESAMPLES_H 91