start new Jt Reader
This commit is contained in:
parent
5271a24476
commit
248b228dbf
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <JtTk/JtkEntityFactory.h>
|
||||
//#include <JtTk/JtkEntityFactory.h>
|
||||
|
||||
|
||||
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");
|
||||
|
|
|
@ -36,11 +36,9 @@
|
|||
#include <Mod/Mesh/App/Core/MeshKernel.h>
|
||||
#include <Mod/Mesh/App/Core/Elements.h>
|
||||
#include <Mod/Mesh/App/MeshPy.h>
|
||||
#include <Mod/Mesh/App/MeshPy.h>
|
||||
#include <Mod/Mesh/App/MeshFeature.h>
|
||||
|
||||
#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<MeshCore::MeshKernel> apcKernel(new MeshCore::MeshKernel());
|
||||
//std::auto_ptr<MeshCore::MeshKernel> apcKernel(new MeshCore::MeshKernel());
|
||||
|
||||
readFile(EncodedName.c_str(),0);
|
||||
//vector<MeshGeomFacet> facets;
|
||||
//facets.resize(0 /* some size*/);
|
||||
|
||||
vector<MeshGeomFacet> 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<MeshCore::MeshKernel> 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<MeshCore::MeshKernel> apcKernel(new MeshCore::MeshKernel());
|
||||
|
||||
readFile(EncodedName.c_str(),0);
|
||||
// readFile(EncodedName.c_str(),0);
|
||||
|
||||
vector<MeshGeomFacet> facets;
|
||||
facets.resize(iterSize());
|
||||
// vector<MeshGeomFacet> 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<MeshGeomFacet> facets;
|
||||
//vector<MeshGeomFacet> 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<MeshCore::MeshKernel> 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<MeshCore::MeshKernel> 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
|
||||
{
|
||||
|
|
53
src/Mod/JtReader/App/CMakeLists.txt
Normal file
53
src/Mod/JtReader/App/CMakeLists.txt
Normal file
|
@ -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})
|
48
src/Mod/JtReader/App/JrJt/Context.h
Normal file
48
src/Mod/JtReader/App/JrJt/Context.h
Normal file
|
@ -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 <istream>
|
||||
#include <stdint.h>
|
||||
#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
|
||||
|
83
src/Mod/JtReader/App/JrJt/GUID.h
Normal file
83
src/Mod/JtReader/App/JrJt/GUID.h
Normal file
|
@ -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 <istream>
|
||||
#include <stdint.h>
|
||||
|
||||
#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
|
55
src/Mod/JtReader/App/JrJt/I32.h
Normal file
55
src/Mod/JtReader/App/JrJt/I32.h
Normal file
|
@ -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 <istream>
|
||||
#include <stdint.h>
|
||||
|
||||
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
|
66
src/Mod/JtReader/App/JrJt/JtReader.cpp
Normal file
66
src/Mod/JtReader/App/JrJt/JtReader.cpp
Normal file
|
@ -0,0 +1,66 @@
|
|||
#include "JtReader.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#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<TOC_Entry> TocEntries(Entry_Count);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
21
src/Mod/JtReader/App/JrJt/JtReader.h
Normal file
21
src/Mod/JtReader/App/JrJt/JtReader.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
class JtReader
|
||||
{
|
||||
public:
|
||||
JtReader();
|
||||
~JtReader();
|
||||
|
||||
void setFile(const std::string fileName);
|
||||
|
||||
void readToc();
|
||||
|
||||
|
||||
protected:
|
||||
std::string _fileName;
|
||||
|
||||
};
|
||||
|
67
src/Mod/JtReader/App/JrJt/TOC_Entry.h
Normal file
67
src/Mod/JtReader/App/JrJt/TOC_Entry.h
Normal file
|
@ -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 <istream>
|
||||
#include <stdint.h>
|
||||
|
||||
#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
|
55
src/Mod/JtReader/App/JrJt/U16.h
Normal file
55
src/Mod/JtReader/App/JrJt/U16.h
Normal file
|
@ -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 <istream>
|
||||
#include <stdint.h>
|
||||
|
||||
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
|
56
src/Mod/JtReader/App/JrJt/U32.h
Normal file
56
src/Mod/JtReader/App/JrJt/U32.h
Normal file
|
@ -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 <istream>
|
||||
#include <stdint.h>
|
||||
|
||||
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
|
57
src/Mod/JtReader/App/JrJt/U8.h
Normal file
57
src/Mod/JtReader/App/JrJt/U8.h
Normal file
|
@ -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 <istream>
|
||||
#include <stdint.h>
|
||||
#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
|
56
src/Mod/JtReader/App/JrJt/UChar.h
Normal file
56
src/Mod/JtReader/App/JrJt/UChar.h
Normal file
|
@ -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 <istream>
|
||||
#include <stdint.h>
|
||||
#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
|
20
src/Mod/JtReader/App/TestJtReader.cpp
Normal file
20
src/Mod/JtReader/App/TestJtReader.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "TestJtReader.h"
|
||||
|
||||
|
||||
TestJtReader::TestJtReader()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TestJtReader::~TestJtReader()
|
||||
{
|
||||
}
|
||||
|
||||
void TestJtReader::read(void)
|
||||
{
|
||||
readToc();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
15
src/Mod/JtReader/App/TestJtReader.h
Normal file
15
src/Mod/JtReader/App/TestJtReader.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
#include "JrJt/JtReader.h"
|
||||
|
||||
|
||||
class TestJtReader: public JtReader
|
||||
{
|
||||
public:
|
||||
TestJtReader();
|
||||
~TestJtReader();
|
||||
|
||||
void read(void);
|
||||
|
||||
|
||||
};
|
||||
|
|
@ -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
|
13
src/Mod/JtReader/CMakeLists.txt
Normal file
13
src/Mod/JtReader/CMakeLists.txt
Normal file
|
@ -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
|
||||
)
|
Loading…
Reference in New Issue
Block a user