| 1 |
/*************************************************************************** |
| 2 |
* Copyright (c) 2010 Werner Mayer <wmayer[at]users.sourceforge.net> * |
| 3 |
* * |
| 4 |
* This file is part of the FreeCAD CAx development system. * |
| 5 |
* * |
| 6 |
* This library is free software; you can redistribute it and/or * |
| 7 |
* modify it under the terms of the GNU Library General Public * |
| 8 |
* License as published by the Free Software Foundation; either * |
| 9 |
* version 2 of the License, or (at your option) any later version. * |
| 10 |
* * |
| 11 |
* This library is distributed in the hope that it will be useful, * |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 |
* GNU Library General Public License for more details. * |
| 15 |
* * |
| 16 |
* You should have received a copy of the GNU Library General Public * |
| 17 |
* License along with this library; see the file COPYING.LIB. If not, * |
| 18 |
* write to the Free Software Foundation, Inc., 59 Temple Place, * |
| 19 |
* Suite 330, Boston, MA 02111-1307, USA * |
| 20 |
* * |
| 21 |
***************************************************************************/ |
| 22 |
|
| 23 |
#ifndef GUI_SOFCVECTORIZEU3DACTION_H |
| 24 |
#define GUI_SOFCVECTORIZEU3DACTION_H |
| 25 |
|
| 26 |
#include <fstream> |
| 27 |
|
| 28 |
#include <Inventor/annex/HardCopy/SoVectorizeAction.h> |
| 29 |
#include <Inventor/annex/HardCopy/SoVectorOutput.h> |
| 30 |
|
| 31 |
#include <FCGlobal.h> |
| 32 |
|
| 33 |
namespace Gui |
| 34 |
{ |
| 35 |
|
| 36 |
class GuiExport SoU3DVectorOutput: public SoVectorOutput |
| 37 |
{ |
| 38 |
public: |
| 39 |
SoU3DVectorOutput(); |
| 40 |
~SoU3DVectorOutput() override; |
| 41 |
|
| 42 |
SbBool openFile(const char* filename) override; |
| 43 |
void closeFile() override; |
| 44 |
std::fstream& getFileStream(); |
| 45 |
|
| 46 |
private: |
| 47 |
std::fstream file; |
| 48 |
}; |
| 49 |
|
| 50 |
/** |
| 51 |
* @author Werner Mayer |
| 52 |
*/ |
| 53 |
class SoFCVectorizeU3DActionP; |
| 54 |
class GuiExport SoFCVectorizeU3DAction: public SoVectorizeAction |
| 55 |
{ |
| 56 |
using inherited = SoVectorizeAction; |
| 57 |
|
| 58 |
SO_ACTION_HEADER(SoFCVectorizeU3DAction); |
| 59 |
|
| 60 |
public: |
| 61 |
SoFCVectorizeU3DAction(); |
| 62 |
~SoFCVectorizeU3DAction() override; |
| 63 |
|
| 64 |
static void initClass(); |
| 65 |
SoU3DVectorOutput* getU3DOutput() const; |
| 66 |
|
| 67 |
protected: |
| 68 |
void beginTraversal(SoNode* node) override; |
| 69 |
void endTraversal(SoNode* node) override; |
| 70 |
void printHeader() const override; |
| 71 |
void printFooter() const override; |
| 72 |
void printBackground() const override; |
| 73 |
void printItem(const SoVectorizeItem* item) const override; |
| 74 |
void printViewport() const override; |
| 75 |
|
| 76 |
private: |
| 77 |
static void actionMethod(SoAction*, SoNode*); |
| 78 |
|
| 79 |
private: |
| 80 |
SoFCVectorizeU3DActionP* p; |
| 81 |
friend class SoFCVectorizeU3DActionP; |
| 82 |
}; |
| 83 |
|
| 84 |
} // namespace Gui |
| 85 |
|
| 86 |
#endif // GUI_SOFCVECTORIZEU3DACTION_H |