From 5a4c14ecc1774c3972fbcb2cfa080a74d8070052 Mon Sep 17 00:00:00 2001 From: jriegel Date: Tue, 9 Dec 2014 23:48:22 +0100 Subject: [PATCH] start new Jt Reader --- src/Mod/JtReader/App/AppJtReader.cpp | 6 +- src/Mod/JtReader/App/AppJtReaderPy.cpp | 170 +++++++++++++------------ src/Mod/JtReader/App/CMakeLists.txt | 53 ++++++++ src/Mod/JtReader/App/JrJt/Context.h | 48 +++++++ src/Mod/JtReader/App/JrJt/GUID.h | 83 ++++++++++++ src/Mod/JtReader/App/JrJt/I32.h | 55 ++++++++ src/Mod/JtReader/App/JrJt/JtReader.cpp | 66 ++++++++++ src/Mod/JtReader/App/JrJt/JtReader.h | 21 +++ src/Mod/JtReader/App/JrJt/TOC_Entry.h | 67 ++++++++++ src/Mod/JtReader/App/JrJt/U16.h | 55 ++++++++ src/Mod/JtReader/App/JrJt/U32.h | 56 ++++++++ src/Mod/JtReader/App/JrJt/U8.h | 57 +++++++++ src/Mod/JtReader/App/JrJt/UChar.h | 56 ++++++++ src/Mod/JtReader/App/TestJtReader.cpp | 20 +++ src/Mod/JtReader/App/TestJtReader.h | 15 +++ src/Mod/JtReader/AppJtReader.sln | 20 --- src/Mod/JtReader/CMakeLists.txt | 13 ++ 17 files changed, 755 insertions(+), 106 deletions(-) create mode 100644 src/Mod/JtReader/App/CMakeLists.txt create mode 100644 src/Mod/JtReader/App/JrJt/Context.h create mode 100644 src/Mod/JtReader/App/JrJt/GUID.h create mode 100644 src/Mod/JtReader/App/JrJt/I32.h create mode 100644 src/Mod/JtReader/App/JrJt/JtReader.cpp create mode 100644 src/Mod/JtReader/App/JrJt/JtReader.h create mode 100644 src/Mod/JtReader/App/JrJt/TOC_Entry.h create mode 100644 src/Mod/JtReader/App/JrJt/U16.h create mode 100644 src/Mod/JtReader/App/JrJt/U32.h create mode 100644 src/Mod/JtReader/App/JrJt/U8.h create mode 100644 src/Mod/JtReader/App/JrJt/UChar.h create mode 100644 src/Mod/JtReader/App/TestJtReader.cpp create mode 100644 src/Mod/JtReader/App/TestJtReader.h delete mode 100644 src/Mod/JtReader/AppJtReader.sln create mode 100644 src/Mod/JtReader/CMakeLists.txt diff --git a/src/Mod/JtReader/App/AppJtReader.cpp b/src/Mod/JtReader/App/AppJtReader.cpp index d0c12b98b3..3badf0ecf9 100644 --- a/src/Mod/JtReader/App/AppJtReader.cpp +++ b/src/Mod/JtReader/App/AppJtReader.cpp @@ -28,7 +28,7 @@ #include #include -#include +//#include extern struct PyMethodDef JtReader_methods[]; @@ -43,13 +43,13 @@ void AppJtReaderExport initJtReader() { Base::Interpreter().loadModule("Mesh"); // Initialize JtTk - JtkEntityFactory::init(); + //JtkEntityFactory::init(); // Note, non-evaluation JT Open Toolkit licensees must uncomment the // following line, inserting their "Sold_To_ID". Each licensee has a // unique Sold_To_ID issued by UGS Corp. // - JtkEntityFactory::registerCustomer( 1103193 ); + //JtkEntityFactory::registerCustomer( 1103193 ); //JtkEntityFactory::registerCustomer(1103103); Base::Console().Log("Loading JtReader module... done\n"); diff --git a/src/Mod/JtReader/App/AppJtReaderPy.cpp b/src/Mod/JtReader/App/AppJtReaderPy.cpp index 8182a38cf7..05387a4d9d 100644 --- a/src/Mod/JtReader/App/AppJtReaderPy.cpp +++ b/src/Mod/JtReader/App/AppJtReaderPy.cpp @@ -36,11 +36,9 @@ #include #include #include -#include #include -#include "JtReader.h" - +#include "TestJtReader.h" using std::vector; using namespace MeshCore; @@ -57,31 +55,29 @@ static PyObject * read(PyObject *self, PyObject *args) PyMem_Free(Name); PY_TRY { - std::auto_ptr apcKernel(new MeshCore::MeshKernel()); + //std::auto_ptr apcKernel(new MeshCore::MeshKernel()); - readFile(EncodedName.c_str(),0); + //vector facets; + //facets.resize(0 /* some size*/); - vector facets; - facets.resize(iterSize()); + //const SimpleMeshFacet* It=iterStart(); + //int i=0; + //while(It=iterGetNext()) + //{ + // facets[i]._aclPoints[0].x = It->p1[0]; + // facets[i]._aclPoints[0].y = It->p1[1]; + // facets[i]._aclPoints[0].z = It->p1[2]; + // facets[i]._aclPoints[1].x = It->p2[0]; + // facets[i]._aclPoints[1].y = It->p2[1]; + // facets[i]._aclPoints[1].z = It->p2[2]; + // facets[i]._aclPoints[2].x = It->p3[0]; + // facets[i]._aclPoints[2].y = It->p3[1]; + // facets[i]._aclPoints[2].z = It->p3[2]; + //} + + //(*apcKernel) = facets; - const SimpleMeshFacet* It=iterStart(); - int i=0; - while(It=iterGetNext()) - { - facets[i]._aclPoints[0].x = It->p1[0]; - facets[i]._aclPoints[0].y = It->p1[1]; - facets[i]._aclPoints[0].z = It->p1[2]; - facets[i]._aclPoints[1].x = It->p2[0]; - facets[i]._aclPoints[1].y = It->p2[1]; - facets[i]._aclPoints[1].z = It->p2[2]; - facets[i]._aclPoints[2].x = It->p3[0]; - facets[i]._aclPoints[2].y = It->p3[1]; - facets[i]._aclPoints[2].z = It->p3[2]; - } - clearData(); - (*apcKernel) = facets; - - return new Mesh::MeshPy(new Mesh::MeshObject(*(apcKernel.release()))); + //return new Mesh::MeshPy(new Mesh::MeshObject(*(apcKernel.release()))); } PY_CATCH; @@ -108,38 +104,46 @@ open(PyObject *self, PyObject *args) if(file.hasExtension("jt")) { + + TestJtReader reader; + + reader.setFile(EncodedName.c_str()); + + reader.readToc(); + + // create new document and add Import feature - App::Document *pcDoc = App::GetApplication().newDocument("Unnamed"); - Mesh::Feature *pcFeature = (Mesh::Feature*)pcDoc->addObject("Mesh::Feature",file.fileNamePure().c_str()); - - std::auto_ptr apcKernel(new MeshCore::MeshKernel()); + // App::Document *pcDoc = App::GetApplication().newDocument("Unnamed"); + // Mesh::Feature *pcFeature = (Mesh::Feature*)pcDoc->addObject("Mesh::Feature",file.fileNamePure().c_str()); + // + // std::auto_ptr apcKernel(new MeshCore::MeshKernel()); - readFile(EncodedName.c_str(),0); + // readFile(EncodedName.c_str(),0); - vector facets; - facets.resize(iterSize()); + // vector facets; + // facets.resize(iterSize()); - const SimpleMeshFacet* It=iterStart(); - int i=0; - while(It=iterGetNext()) - { - facets[i]._aclPoints[0].x = It->p1[0]; - facets[i]._aclPoints[0].y = It->p1[1]; - facets[i]._aclPoints[0].z = It->p1[2]; - facets[i]._aclPoints[1].x = It->p2[0]; - facets[i]._aclPoints[1].y = It->p2[1]; - facets[i]._aclPoints[1].z = It->p2[2]; - facets[i]._aclPoints[2].x = It->p3[0]; - facets[i]._aclPoints[2].y = It->p3[1]; - facets[i]._aclPoints[2].z = It->p3[2]; - i++; - } - clearData(); - (*apcKernel) = facets; - pcFeature->Mesh.setValue(*(apcKernel.get())); + // const SimpleMeshFacet* It=iterStart(); + // int i=0; + // while(It=iterGetNext()) + // { + // facets[i]._aclPoints[0].x = It->p1[0]; + // facets[i]._aclPoints[0].y = It->p1[1]; + // facets[i]._aclPoints[0].z = It->p1[2]; + // facets[i]._aclPoints[1].x = It->p2[0]; + // facets[i]._aclPoints[1].y = It->p2[1]; + // facets[i]._aclPoints[1].z = It->p2[2]; + // facets[i]._aclPoints[2].x = It->p3[0]; + // facets[i]._aclPoints[2].y = It->p3[1]; + // facets[i]._aclPoints[2].z = It->p3[2]; + // i++; + // } + // clearData(); + // (*apcKernel) = facets; + // pcFeature->Mesh.setValue(*(apcKernel.get())); - //pcFeature->FileName.setValue( Name ); - pcDoc->recompute(); + ////pcFeature->FileName.setValue( Name ); + // pcDoc->recompute(); } else { @@ -183,42 +187,42 @@ insert(PyObject *self, PyObject *args) Py_Error(Base::BaseExceptionFreeCADError,szBuf); } - readFile(EncodedName.c_str(),0); + //readFile(EncodedName.c_str(),0); - vector facets; + //vector facets; - if(iterSize()>0){ - facets.resize(iterSize()); + //if(iterSize()>0){ + // facets.resize(iterSize()); - const SimpleMeshFacet* It=iterStart(); - int i=0; - while(It=iterGetNext()) - { - facets[i]._aclPoints[0].x = It->p1[0]; - facets[i]._aclPoints[0].y = It->p1[1]; - facets[i]._aclPoints[0].z = It->p1[2]; - facets[i]._aclPoints[1].x = It->p2[0]; - facets[i]._aclPoints[1].y = It->p2[1]; - facets[i]._aclPoints[1].z = It->p2[2]; - facets[i]._aclPoints[2].x = It->p3[0]; - facets[i]._aclPoints[2].y = It->p3[1]; - facets[i]._aclPoints[2].z = It->p3[2]; - i++; - } - clearData(); - Mesh::Feature *pcFeature = (Mesh::Feature*)pcDoc->addObject("Mesh::Feature",file.fileNamePure().c_str()); - - std::auto_ptr apcKernel(new MeshCore::MeshKernel()); - (*apcKernel) = facets; - pcFeature->Mesh.setValue(*(apcKernel.get())); + // const SimpleMeshFacet* It=iterStart(); + // int i=0; + // while(It=iterGetNext()) + // { + // facets[i]._aclPoints[0].x = It->p1[0]; + // facets[i]._aclPoints[0].y = It->p1[1]; + // facets[i]._aclPoints[0].z = It->p1[2]; + // facets[i]._aclPoints[1].x = It->p2[0]; + // facets[i]._aclPoints[1].y = It->p2[1]; + // facets[i]._aclPoints[1].z = It->p2[2]; + // facets[i]._aclPoints[2].x = It->p3[0]; + // facets[i]._aclPoints[2].y = It->p3[1]; + // facets[i]._aclPoints[2].z = It->p3[2]; + // i++; + // } + // clearData(); + // Mesh::Feature *pcFeature = (Mesh::Feature*)pcDoc->addObject("Mesh::Feature",file.fileNamePure().c_str()); + // + // std::auto_ptr apcKernel(new MeshCore::MeshKernel()); + // (*apcKernel) = facets; + // pcFeature->Mesh.setValue(*(apcKernel.get())); - //pcDoc->recompute(); + // //pcDoc->recompute(); - }else{ - clearData(); - //Py_Error(Base::BaseExceptionFreeCADError,"No Mesh in file"); - Base::Console().Warning("No Mesh in file: %s\n",EncodedName.c_str()); - } + //}else{ + // clearData(); + // //Py_Error(Base::BaseExceptionFreeCADError,"No Mesh in file"); + // Base::Console().Warning("No Mesh in file: %s\n",EncodedName.c_str()); + //} } else { diff --git a/src/Mod/JtReader/App/CMakeLists.txt b/src/Mod/JtReader/App/CMakeLists.txt new file mode 100644 index 0000000000..83b03fe6ba --- /dev/null +++ b/src/Mod/JtReader/App/CMakeLists.txt @@ -0,0 +1,53 @@ +if(MSVC) + add_definitions(-DFCAppImport -DHAVE_ACOSH -DHAVE_ASINH -DHAVE_ATANH) +else(MSVC) + add_definitions(-DHAVE_LIMITS_H -DHAVE_CONFIG_H) +endif(MSVC) + + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${Boost_INCLUDE_DIRS} + ${OCC_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIR} + ${PYTHON_INCLUDE_PATH} + ${XERCESC_INCLUDE_DIR} + ${QT_INCLUDE_DIR} +) + +link_directories(${OCC_LIBRARY_DIR}) + +set(JtReader_LIBS + Mesh + #${OCC_OCAF_LIBRARIES} + #${OCC_OCAF_DEBUG_LIBRARIES} +) + +SET(JtReader_SRCS + AppJtReader.cpp + AppJtReaderPy.cpp + PreCompiled.cpp + PreCompiled.h + TestJtReader.cpp + TestJtReader.h +) + +FILE( GLOB JRJT_SRCS JrJt/*.cpp JrJt/*.h ) + +SOURCE_GROUP("JrJt" FILES ${JRJT_SRCS} ) + +SOURCE_GROUP("Module" FILES ${JtReader_SRCS}) + +add_library(JtReader SHARED ${JtReader_SRCS} ${JRJT_SRCS} ) +target_link_libraries(JtReader ${JtReader_LIBS}) + +fc_target_copy_resource(JtReader + ${CMAKE_SOURCE_DIR}/src/Mod/JtReader + ${CMAKE_BINARY_DIR}/Mod/JtReader + Init.py ) + +SET_BIN_DIR(JtReader JtReader /Mod/JtReader) +SET_PYTHON_PREFIX_SUFFIX(JtReader) + +INSTALL(TARGETS JtReader DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/Mod/JtReader/App/JrJt/Context.h b/src/Mod/JtReader/App/JrJt/Context.h new file mode 100644 index 0000000000..e43f035dfe --- /dev/null +++ b/src/Mod/JtReader/App/JrJt/Context.h @@ -0,0 +1,48 @@ +/*************************************************************************** +* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +* * +* This file is part of the FreeCAD CAx development system. * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 of the License, or (at your option) any later version. * +* * +* This library is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public * +* License along with this library; see the file COPYING.LIB. If not, * +* write to the Free Software Foundation, Inc., 59 Temple Place, * +* Suite 330, Boston, MA 02111-1307, USA * +* * +***************************************************************************/ + +#ifndef Context_HEADER +#define Context_HEADER + +#include +#include +#include "Context.h" + +using namespace std; + +class Context +{ +public: + Context(istream &s) :Strm(s){}; + uint8_t VersionMinor; + uint8_t VersionMajor; + + bool Endiness; + + istream & Strm; + +}; + + + +#endif + diff --git a/src/Mod/JtReader/App/JrJt/GUID.h b/src/Mod/JtReader/App/JrJt/GUID.h new file mode 100644 index 0000000000..93b007cb4f --- /dev/null +++ b/src/Mod/JtReader/App/JrJt/GUID.h @@ -0,0 +1,83 @@ +/*************************************************************************** +* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +* * +* This file is part of the FreeCAD CAx development system. * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 of the License, or (at your option) any later version. * +* * +* This library is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public * +* License along with this library; see the file COPYING.LIB. If not, * +* write to the Free Software Foundation, Inc., 59 Temple Place, * +* Suite 330, Boston, MA 02111-1307, USA * +* * +***************************************************************************/ + +#ifndef GUID_HEADER +#define GUID_HEADER + +#include +#include + +#include "U8.h" +#include "U16.h" +#include "U32.h" + + + +using namespace std; + +#undef _C2 + +struct GUID +{ + GUID(){}; + + GUID(Context& cont) + { + read(cont); + } + + inline void read(Context& cont) + { + _A1.read(cont); + + _B1.read(cont); + _B2.read(cont); + + _C1.read(cont); + _C2.read(cont); + _C3.read(cont); + _C4.read(cont); + _C5.read(cont); + _C6.read(cont); + _C7.read(cont); + _C8.read(cont); + } + + U32 _A1; + + U16 _B1; + U16 _B2; + + U8 _C1; + U8 _C2; + U8 _C3; + U8 _C4; + U8 _C5; + U8 _C6; + U8 _C7; + U8 _C8; + +}; + + + +#endif \ No newline at end of file diff --git a/src/Mod/JtReader/App/JrJt/I32.h b/src/Mod/JtReader/App/JrJt/I32.h new file mode 100644 index 0000000000..2416a98e0c --- /dev/null +++ b/src/Mod/JtReader/App/JrJt/I32.h @@ -0,0 +1,55 @@ +/*************************************************************************** +* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +* * +* This file is part of the FreeCAD CAx development system. * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 of the License, or (at your option) any later version. * +* * +* This library is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public * +* License along with this library; see the file COPYING.LIB. If not, * +* write to the Free Software Foundation, Inc., 59 Temple Place, * +* Suite 330, Boston, MA 02111-1307, USA * +* * +***************************************************************************/ + +#ifndef I32_HEADER +#define I32_HEADER + +#include +#include + +using namespace std; + +struct I32 +{ + I32(){}; + + I32(Context& cont) + { + read(cont); + } + + inline operator int32_t() const + { + return _I32; + } + + inline void read(Context& cont) + { + cont.Strm.read((char*)&_I32, 4); + } + + int32_t _I32; +}; + + + +#endif \ No newline at end of file diff --git a/src/Mod/JtReader/App/JrJt/JtReader.cpp b/src/Mod/JtReader/App/JrJt/JtReader.cpp new file mode 100644 index 0000000000..87b490c704 --- /dev/null +++ b/src/Mod/JtReader/App/JrJt/JtReader.cpp @@ -0,0 +1,66 @@ +#include "JtReader.h" + +#include +#include +#include + +#include + +#include "TOC_Entry.h" +#include "GUID.h" +#include "UChar.h" +#include "I32.h" +#include "TOC_Entry.h" + + +using namespace std; + + +JtReader::JtReader() +{ +} + + +JtReader::~JtReader() +{ +} + +void JtReader::setFile(const std::string fileName) +{ + this->_fileName = fileName; +} + +void JtReader::readToc() +{ + ifstream strm; + + strm.open(_fileName, ios::binary); + + if (!strm) + throw "cannot open file"; + + + Context cont(strm); + + char headerString[80]; + strm.read(headerString, 80); + + UChar Byte_Order(cont); + I32 Empty_Field(cont); + I32 TOC_Offset(cont); + + GUID LSG_Segment_ID(cont); + + + cont.Strm.seekg((int32_t)TOC_Offset); + + I32 Entry_Count(cont); + + vector TocEntries(Entry_Count); + + + + + + +} diff --git a/src/Mod/JtReader/App/JrJt/JtReader.h b/src/Mod/JtReader/App/JrJt/JtReader.h new file mode 100644 index 0000000000..23ecbf63b9 --- /dev/null +++ b/src/Mod/JtReader/App/JrJt/JtReader.h @@ -0,0 +1,21 @@ +#pragma once + +#include + + +class JtReader +{ +public: + JtReader(); + ~JtReader(); + + void setFile(const std::string fileName); + + void readToc(); + + +protected: + std::string _fileName; + +}; + diff --git a/src/Mod/JtReader/App/JrJt/TOC_Entry.h b/src/Mod/JtReader/App/JrJt/TOC_Entry.h new file mode 100644 index 0000000000..f2c5d8cae0 --- /dev/null +++ b/src/Mod/JtReader/App/JrJt/TOC_Entry.h @@ -0,0 +1,67 @@ +/*************************************************************************** +* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +* * +* This file is part of the FreeCAD CAx development system. * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 of the License, or (at your option) any later version. * +* * +* This library is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public * +* License along with this library; see the file COPYING.LIB. If not, * +* write to the Free Software Foundation, Inc., 59 Temple Place, * +* Suite 330, Boston, MA 02111-1307, USA * +* * +***************************************************************************/ + +#ifndef TOC_Entry_HEADER +#define TOC_Entry_HEADER + +#include +#include + +#include "Context.h" +#include "GUID.h" +#include "U16.h" +#include "U32.h" +#include "I32.h" + + + +using namespace std; + + +struct TOC_Entry +{ + TOC_Entry(){}; + + TOC_Entry(Context& cont) + { + read(cont); + }; + + inline void read(Context& cont) + { + Segment_ID.read(cont); + Segment_Offset.read(cont); + Segment_Length.read(cont); + Segment_Attributes.read(cont); + }; + + GUID Segment_ID; + I32 Segment_Offset; + I32 Segment_Length; + U32 Segment_Attributes; + + +}; + + + +#endif \ No newline at end of file diff --git a/src/Mod/JtReader/App/JrJt/U16.h b/src/Mod/JtReader/App/JrJt/U16.h new file mode 100644 index 0000000000..ddffc633a0 --- /dev/null +++ b/src/Mod/JtReader/App/JrJt/U16.h @@ -0,0 +1,55 @@ +/*************************************************************************** +* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +* * +* This file is part of the FreeCAD CAx development system. * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 of the License, or (at your option) any later version. * +* * +* This library is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public * +* License along with this library; see the file COPYING.LIB. If not, * +* write to the Free Software Foundation, Inc., 59 Temple Place, * +* Suite 330, Boston, MA 02111-1307, USA * +* * +***************************************************************************/ + +#ifndef U16_HEADER +#define U16_HEADER + +#include +#include + +using namespace std; + +struct U16 +{ + U16(){}; + + U16(Context& cont) + { + read(cont); + } + + inline void read(Context& cont) + { + cont.Strm.read((char*)&_U16, 2); + } + + inline operator uint16_t() const + { + return _U16; + } + + uint16_t _U16; +}; + + + +#endif \ No newline at end of file diff --git a/src/Mod/JtReader/App/JrJt/U32.h b/src/Mod/JtReader/App/JrJt/U32.h new file mode 100644 index 0000000000..f2df9df6cf --- /dev/null +++ b/src/Mod/JtReader/App/JrJt/U32.h @@ -0,0 +1,56 @@ +/*************************************************************************** +* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +* * +* This file is part of the FreeCAD CAx development system. * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 of the License, or (at your option) any later version. * +* * +* This library is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public * +* License along with this library; see the file COPYING.LIB. If not, * +* write to the Free Software Foundation, Inc., 59 Temple Place, * +* Suite 330, Boston, MA 02111-1307, USA * +* * +***************************************************************************/ + +#ifndef U32_HEADER +#define U32_HEADER + +#include +#include + +using namespace std; + +struct U32 +{ + U32(){}; + + U32(Context& cont) + { + read(cont); + } + + inline operator uint32_t() const + { + return _U32; + } + + inline void read(Context& cont) + { + cont.Strm.read((char*)&_U32, 4); + } + + uint32_t _U32; +}; + + + + +#endif \ No newline at end of file diff --git a/src/Mod/JtReader/App/JrJt/U8.h b/src/Mod/JtReader/App/JrJt/U8.h new file mode 100644 index 0000000000..f4e8f93251 --- /dev/null +++ b/src/Mod/JtReader/App/JrJt/U8.h @@ -0,0 +1,57 @@ +/*************************************************************************** +* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +* * +* This file is part of the FreeCAD CAx development system. * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 of the License, or (at your option) any later version. * +* * +* This library is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public * +* License along with this library; see the file COPYING.LIB. If not, * +* write to the Free Software Foundation, Inc., 59 Temple Place, * +* Suite 330, Boston, MA 02111-1307, USA * +* * +***************************************************************************/ + +#ifndef U8_HEADER +#define U8_HEADER + +#include +#include +#include "Context.h" + +using namespace std; + +struct U8 +{ + U8(){}; + + U8(Context& cont) + { + read(cont); + } + + inline void read(Context& cont) + { + cont.Strm.read((char*)&_U8, 1); + } + + inline operator uint8_t() const + { + return _U8; + } + + + + uint8_t _U8; +}; + + +#endif \ No newline at end of file diff --git a/src/Mod/JtReader/App/JrJt/UChar.h b/src/Mod/JtReader/App/JrJt/UChar.h new file mode 100644 index 0000000000..610af8089c --- /dev/null +++ b/src/Mod/JtReader/App/JrJt/UChar.h @@ -0,0 +1,56 @@ +/*************************************************************************** +* Copyright (c) Juergen Riegel (juergen.riegel@web.de) 2014 * +* * +* This file is part of the FreeCAD CAx development system. * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 of the License, or (at your option) any later version. * +* * +* This library is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public * +* License along with this library; see the file COPYING.LIB. If not, * +* write to the Free Software Foundation, Inc., 59 Temple Place, * +* Suite 330, Boston, MA 02111-1307, USA * +* * +***************************************************************************/ + +#ifndef UChar_HEADER +#define UChar_HEADER + +#include +#include +#include "Context.h" + +using namespace std; + +struct UChar +{ + UChar(){}; + + UChar(Context& cont) + { + read(cont); + } + + inline operator uint8_t() const + { + return _UChar; + } + + inline void read(Context& cont) + { + cont.Strm.read((char*)&_UChar, 1); + } + + uint8_t _UChar; +}; + + + +#endif \ No newline at end of file diff --git a/src/Mod/JtReader/App/TestJtReader.cpp b/src/Mod/JtReader/App/TestJtReader.cpp new file mode 100644 index 0000000000..2e9cc2df52 --- /dev/null +++ b/src/Mod/JtReader/App/TestJtReader.cpp @@ -0,0 +1,20 @@ +#include "TestJtReader.h" + + +TestJtReader::TestJtReader() +{ +} + + +TestJtReader::~TestJtReader() +{ +} + +void TestJtReader::read(void) +{ + readToc(); + + + + +} diff --git a/src/Mod/JtReader/App/TestJtReader.h b/src/Mod/JtReader/App/TestJtReader.h new file mode 100644 index 0000000000..701e75150d --- /dev/null +++ b/src/Mod/JtReader/App/TestJtReader.h @@ -0,0 +1,15 @@ +#pragma once +#include "JrJt/JtReader.h" + + +class TestJtReader: public JtReader +{ +public: + TestJtReader(); + ~TestJtReader(); + + void read(void); + + +}; + diff --git a/src/Mod/JtReader/AppJtReader.sln b/src/Mod/JtReader/AppJtReader.sln deleted file mode 100644 index b2b2ad0926..0000000000 --- a/src/Mod/JtReader/AppJtReader.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppJtReader", "App\AppJtReader.vcproj", "{E62A766A-E6A5-4065-B2F9-561D6A787EF0}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E62A766A-E6A5-4065-B2F9-561D6A787EF0}.Debug|Win32.ActiveCfg = Debug|Win32 - {E62A766A-E6A5-4065-B2F9-561D6A787EF0}.Debug|Win32.Build.0 = Debug|Win32 - {E62A766A-E6A5-4065-B2F9-561D6A787EF0}.Release|Win32.ActiveCfg = Release|Win32 - {E62A766A-E6A5-4065-B2F9-561D6A787EF0}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/Mod/JtReader/CMakeLists.txt b/src/Mod/JtReader/CMakeLists.txt new file mode 100644 index 0000000000..382e387fa1 --- /dev/null +++ b/src/Mod/JtReader/CMakeLists.txt @@ -0,0 +1,13 @@ + +add_subdirectory(App) +if(BUILD_GUI) + #add_subdirectory(Gui) +endif(BUILD_GUI) + +INSTALL( + FILES + Init.py + InitGui.py + DESTINATION + Mod/JtReader +)