JtReader: Apply clang format

This commit is contained in:
wmayer
2023-09-10 11:17:04 +02:00
committed by wwmayer
parent ac020f6ea9
commit 780ce5c766
25 changed files with 1209 additions and 1290 deletions

View File

@@ -30,32 +30,30 @@ extern struct PyMethodDef JtReader_methods[];
extern "C" {
void AppJtReaderExport initJtReader() {
void AppJtReaderExport initJtReader()
{
static struct PyModuleDef JtReaderAPIDef = {
PyModuleDef_HEAD_INIT,
"JtReader", 0, -1, JtReader_methods,
NULL, NULL, NULL, NULL
};
PyModule_Create(&JtReaderAPIDef);
static struct PyModuleDef JtReaderAPIDef =
{PyModuleDef_HEAD_INIT, "JtReader", 0, -1, JtReader_methods, NULL, NULL, NULL, NULL};
PyModule_Create(&JtReaderAPIDef);
// load dependent module
Base::Interpreter().loadModule("Mesh");
// load dependent module
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(1103103);
// 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(1103103);
Base::Console().Log("Loading JtReader module... done\n");
Base::Console().Log("Loading JtReader module... done\n");
return;
return;
}
} // extern "C" {
}// extern "C" {

View File

@@ -36,198 +36,199 @@
using std::vector;
using namespace MeshCore;
//using namespace JtReader;
// using namespace JtReader;
/* module functions */
static PyObject * read(PyObject * /*self*/, PyObject *args)
static PyObject* read(PyObject* /*self*/, PyObject* args)
{
char* Name;
if (!PyArg_ParseTuple(args, "et","utf-8",&Name))
char* Name;
if (!PyArg_ParseTuple(args, "et", "utf-8", &Name)) {
return NULL;
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
}
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
PY_TRY {
//std::auto_ptr<MeshCore::MeshKernel> apcKernel(new MeshCore::MeshKernel());
PY_TRY
{
// std::auto_ptr<MeshCore::MeshKernel> apcKernel(new MeshCore::MeshKernel());
//vector<MeshGeomFacet> facets;
//facets.resize(0 /* some size*/);
// vector<MeshGeomFacet> facets;
// facets.resize(0 /* some size*/);
//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];
// }
//return new Mesh::MeshPy(new Mesh::MeshObject(*(apcKernel.release())));
//(*apcKernel) = facets;
} PY_CATCH;
// return new Mesh::MeshPy(new Mesh::MeshObject(*(apcKernel.release())));
}
PY_CATCH;
Py_Return;
Py_Return;
}
static PyObject *
open(PyObject * /*self*/, PyObject *args)
static PyObject* open(PyObject* /*self*/, PyObject* args)
{
char* Name;
if (!PyArg_ParseTuple(args, "et","utf-8",&Name))
char* Name;
if (!PyArg_ParseTuple(args, "et", "utf-8", &Name)) {
return NULL;
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
PY_TRY {
//Base::Console().Log("Open in Mesh with %s",Name);
Base::FileInfo file(EncodedName.c_str());
// extract ending
if(file.extension() == "")
Py_Error(Base::PyExc_FC_GeneralError, "no file ending");
if(file.hasExtension("jt"))
{
TestJtReader reader;
reader.setFile(EncodedName.c_str());
reader.read();
// 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());
// readFile(EncodedName.c_str(),0);
// 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()));
////pcFeature->FileName.setValue( Name );
// pcDoc->recompute();
}
else
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
PY_TRY
{
Py_Error(Base::PyExc_FC_GeneralError, "unknown file ending");
}
// Base::Console().Log("Open in Mesh with %s",Name);
Base::FileInfo file(EncodedName.c_str());
} PY_CATCH;
Py_Return;
}
/* module functions */
static PyObject *
insert(PyObject * /*self*/, PyObject *args)
{
char* Name;
const char* DocName;
if (!PyArg_ParseTuple(args, "ets","utf-8",&Name,&DocName))
return NULL;
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
PY_TRY {
Base::FileInfo file(EncodedName.c_str());
// extract ending
if(file.extension() == "")
Py_Error(Base::PyExc_FC_GeneralError, "no file ending");
if(file.hasExtension("jt") )
{
// add Import feature
App::Document *pcDoc = App::GetApplication().getDocument(DocName);
if (!pcDoc)
{
char szBuf[200];
snprintf(szBuf, 200, "Import called to the non-existing document '%s'", DocName);
Py_Error(Base::PyExc_FC_GeneralError, szBuf);
// extract ending
if (file.extension() == "") {
Py_Error(Base::PyExc_FC_GeneralError, "no file ending");
}
//readFile(EncodedName.c_str(),0);
if (file.hasExtension("jt")) {
TestJtReader reader;
reader.setFile(EncodedName.c_str());
reader.read();
//vector<MeshGeomFacet> facets;
// 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());
//if(iterSize()>0){
// facets.resize(iterSize());
// readFile(EncodedName.c_str(),0);
// 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()));
// vector<MeshGeomFacet> facets;
// facets.resize(iterSize());
// //pcDoc->recompute();
// 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()));
//}else{
// clearData();
// //Py_Error(Base::BaseExceptionFreeCADError,"No Mesh in file");
// Base::Console().Warning("No Mesh in file: %s\n",EncodedName.c_str());
//}
}
else
{
Py_Error(Base::PyExc_FC_GeneralError, "unknown file ending");
////pcFeature->FileName.setValue( Name );
// pcDoc->recompute();
}
else {
Py_Error(Base::PyExc_FC_GeneralError, "unknown file ending");
}
}
PY_CATCH;
} PY_CATCH;
Py_Return;
}
Py_Return;
/* module functions */
static PyObject* insert(PyObject* /*self*/, PyObject* args)
{
char* Name;
const char* DocName;
if (!PyArg_ParseTuple(args, "ets", "utf-8", &Name, &DocName)) {
return NULL;
}
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
PY_TRY
{
Base::FileInfo file(EncodedName.c_str());
// extract ending
if (file.extension() == "") {
Py_Error(Base::PyExc_FC_GeneralError, "no file ending");
}
if (file.hasExtension("jt")) {
// add Import feature
App::Document* pcDoc = App::GetApplication().getDocument(DocName);
if (!pcDoc) {
char szBuf[200];
snprintf(szBuf, 200, "Import called to the non-existing document '%s'", DocName);
Py_Error(Base::PyExc_FC_GeneralError, szBuf);
}
// readFile(EncodedName.c_str(),0);
// vector<MeshGeomFacet> facets;
// 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()));
// //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 {
Py_Error(Base::PyExc_FC_GeneralError, "unknown file ending");
}
}
PY_CATCH;
Py_Return;
}
/* registration table */
struct PyMethodDef JtReader_methods[] = {
{"open" ,open , Py_NEWARGS, "open a jt file in a new Document"},
{"insert" ,insert, Py_NEWARGS, "isert a jt file in a existing document"},
{"read" ,read, Py_NEWARGS, "Read a Mesh from a jt file and returns a Mesh object."},
{NULL, NULL, 0, NULL}
};
{"open", open, Py_NEWARGS, "open a jt file in a new Document"},
{"insert", insert, Py_NEWARGS, "isert a jt file in a existing document"},
{"read", read, Py_NEWARGS, "Read a Mesh from a jt file and returns a Mesh object."},
{NULL, NULL, 0, NULL}};

View File

@@ -1,24 +1,24 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
#include "PreCompiled.h"
@@ -29,5 +29,5 @@
void FcLodHandler::startLod()
{
Base::Console().Log("FcLodHandler::startLod()");
Base::Console().Log("FcLodHandler::startLod()");
}

View File

@@ -1,24 +1,24 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 FcLodHandler_HEADER
#define FcLodHandler_HEADER
@@ -29,16 +29,7 @@ class FcLodHandler: public LodHandler
{
public:
virtual void startLod();
};
#endif

View File

@@ -1,46 +1,44 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 "Context.h"
#include <istream>
#include <stdint.h>
#include "Context.h"
using namespace std;
class Context
{
public:
Context(istream &s) :Strm(s){};
Context(istream& s)
: Strm(s) {};
uint8_t VersionMinor;
uint8_t VersionMajor;
istream & Strm;
istream& Strm;
};
#endif

View File

@@ -1,37 +1,36 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 Element_Header_HEADER
#define Element_Header_HEADER
#include <assert.h>
#include <istream>
#include <stdint.h>
#include <assert.h>
#include "Context.h"
#include "GUID.h"
#include "UChar.h"
#include "I32.h"
#include "UChar.h"
using namespace std;
@@ -39,14 +38,14 @@ using namespace std;
struct Element_Header
{
Element_Header(){};
Element_Header() {};
Element_Header(Context& cont, bool zLib=false)
Element_Header(Context& cont, bool zLib = false)
{
read(cont, zLib);
};
inline void read(Context& cont ,bool zLib=false)
inline void read(Context& cont, bool zLib = false)
{
// only zip less implemented so far...
assert(zLib == false);
@@ -56,20 +55,10 @@ struct Element_Header
Object_Base_Type.read(cont);
};
I32 Element_Length;
I32 Element_Length;
GUID Object_Type_ID;
UChar Object_Base_Type;
};
#endif

View File

@@ -1,24 +1,24 @@
/***************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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
@@ -27,10 +27,9 @@
#include <sstream>
#include <stdint.h>
#include "U8.h"
#include "U16.h"
#include "U32.h"
#include "U8.h"
using namespace std;
@@ -39,10 +38,30 @@ using namespace std;
struct GUID
{
GUID(){};
GUID() {};
GUID(uint32_t a1, uint16_t b1, uint16_t b2, uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4, uint8_t c5, uint8_t c6, uint8_t c7, uint8_t c8)
:_A1(a1), _B1(b1), _B2(b2), _C1(c1), _C2(c2), _C3(c3), _C4(c4), _C5(c5), _C6(c6), _C7(c7), _C8(c8)
GUID(uint32_t a1,
uint16_t b1,
uint16_t b2,
uint8_t c1,
uint8_t c2,
uint8_t c3,
uint8_t c4,
uint8_t c5,
uint8_t c6,
uint8_t c7,
uint8_t c8)
: _A1(a1)
, _B1(b1)
, _B2(b2)
, _C1(c1)
, _C2(c2)
, _C3(c3)
, _C4(c4)
, _C5(c5)
, _C6(c6)
, _C7(c7)
, _C8(c8)
{}
GUID(Context& cont)
@@ -50,23 +69,16 @@ struct GUID
read(cont);
}
bool operator!=(const GUID& other) const {
return !operator == (other);
bool operator!=(const GUID& other) const
{
return !operator==(other);
}
bool operator==(const GUID& other) const {
return
_A1 == other._A1
&& _B1 == other._B1
&& _B2 == other._B2
&& _C1 == other._C1
&& _C2 == other._C2
&& _C3 == other._C3
&& _C4 == other._C4
&& _C5 == other._C5
&& _C6 == other._C6
&& _C7 == other._C7
&& _C8 == other._C8;
bool operator==(const GUID& other) const
{
return _A1 == other._A1 && _B1 == other._B1 && _B2 == other._B2 && _C1 == other._C1
&& _C2 == other._C2 && _C3 == other._C3 && _C4 == other._C4 && _C5 == other._C5
&& _C6 == other._C6 && _C7 == other._C7 && _C8 == other._C8;
}
inline void read(Context& cont)
@@ -86,9 +98,11 @@ struct GUID
_C8.read(cont);
}
std::string toString()const{
std::string toString() const
{
std::stringstream strm;
strm << "{" << std::hex << _A1 << "-" << _B1 << _B2 << "-" << _C1 << _C2 << _C3 << _C4 << _C5 << _C6 << _C7 << _C8 << "}";
strm << "{" << std::hex << _A1 << "-" << _B1 << _B2 << "-" << _C1 << _C2 << _C3 << _C4
<< _C5 << _C6 << _C7 << _C8 << "}";
return strm.str();
}
@@ -97,17 +111,15 @@ struct GUID
U16 _B1;
U16 _B2;
U8 _C1;
U8 _C2;
U8 _C3;
U8 _C4;
U8 _C5;
U8 _C6;
U8 _C7;
U8 _C8;
U8 _C1;
U8 _C2;
U8 _C3;
U8 _C4;
U8 _C5;
U8 _C6;
U8 _C7;
U8 _C8;
};
#endif
#endif

View File

@@ -1,24 +1,24 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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
@@ -30,7 +30,7 @@ using namespace std;
struct I32
{
I32(){};
I32() {};
I32(Context& cont)
{
@@ -51,5 +51,4 @@ struct I32
};
#endif
#endif

View File

@@ -5,10 +5,10 @@
#include <iostream>
#include <vector>
#include "Element_Header.h"
#include "GUID.h"
#include "I32.h"
#include "LodHandler.h"
#include "Element_Header.h"
#include "Segment_Header.h"
#include "TOC_Entry.h"
#include "UChar.h"
@@ -17,81 +17,90 @@
using namespace std;
const GUID JtReader::TriStripSetShapeLODElement_ID(0x10dd10ab, 0x2ac8, 0x11d1, 0x9b, 0x6b, 0x0, 0x80, 0xc7, 0xbb, 0x59, 0x97);
const GUID JtReader::TriStripSetShapeLODElement_ID(0x10dd10ab,
0x2ac8,
0x11d1,
0x9b,
0x6b,
0x0,
0x80,
0xc7,
0xbb,
0x59,
0x97);
JtReader::JtReader()
{
}
{}
JtReader::~JtReader()
{
}
{}
void JtReader::setFile(const std::string fileName)
{
this->_fileName = fileName;
this->_fileName = fileName;
}
const std::vector<TOC_Entry>& JtReader::readToc()
{
ifstream strm;
ifstream strm;
strm.open(_fileName, ios::binary);
strm.open(_fileName, ios::binary);
if (!strm)
throw "cannot open file";
if (!strm) {
throw "cannot open file";
}
Context cont(strm);
Context cont(strm);
char headerString[80];
strm.read(headerString, 80);
char headerString[80];
strm.read(headerString, 80);
UChar Byte_Order(cont);
I32 Empty_Field(cont);
I32 TOC_Offset(cont);
UChar Byte_Order(cont);
I32 Empty_Field(cont);
I32 TOC_Offset(cont);
GUID LSG_Segment_ID(cont);
GUID LSG_Segment_ID(cont);
cont.Strm.seekg((int32_t)TOC_Offset);
I32 Entry_Count(cont);
cont.Strm.seekg((int32_t)TOC_Offset);
I32 Entry_Count(cont);
TocEntries.resize(Entry_Count);
for (std::vector<TOC_Entry>::iterator i = TocEntries.begin(); i != TocEntries.end(); ++i)
i->read(cont);
return TocEntries;
for (std::vector<TOC_Entry>::iterator i = TocEntries.begin(); i != TocEntries.end(); ++i) {
i->read(cont);
}
return TocEntries;
}
void JtReader::readLodSegment(const TOC_Entry& toc, LodHandler& /*handler*/)
{
std::ifstream strm;
strm.open(_fileName, ios::binary);
std::ifstream strm;
strm.open(_fileName, ios::binary);
if (!strm) throw "cannot open file";
if (!strm) {
throw "cannot open file";
}
strm.seekg((int32_t)toc.Segment_Offset);
strm.seekg((int32_t)toc.Segment_Offset);
Context cont(strm);
Context cont(strm);
// check if called with the right Toc
assert(toc.getSegmentType() == 7);
// read the segment header
Segment_Header header(cont);
// check if called with the right Toc
assert(toc.getSegmentType() == 7);
// read the non zip Element header
Element_Header eHeader(cont, false);
// read the segment header
Segment_Header header(cont);
if ( eHeader.Object_Type_ID != TriStripSetShapeLODElement_ID)
return;
// read the non zip Element header
Element_Header eHeader(cont, false);
if (eHeader.Object_Type_ID != TriStripSetShapeLODElement_ID) {
return;
}
}

View File

@@ -1,33 +1,30 @@
#pragma once
#include "TOC_Entry.h"
#include <string>
#include <vector>
#include "TOC_Entry.h"
class LodHandler;
class JtReader
{
public:
JtReader();
~JtReader();
JtReader();
~JtReader();
void setFile(const std::string fileName);
void setFile(const std::string fileName);
const std::vector<TOC_Entry>& readToc();
const std::vector<TOC_Entry>& readToc();
void readSegment(int tocIndex);
void readSegment(int tocIndex);
void readLodSegment(const TOC_Entry&, LodHandler&);
void readLodSegment(const TOC_Entry&, LodHandler&);
static const GUID TriStripSetShapeLODElement_ID;
static const GUID TriStripSetShapeLODElement_ID;
protected:
std::string _fileName;
vector<TOC_Entry> TocEntries;
std::string _fileName;
vector<TOC_Entry> TocEntries;
};

View File

@@ -1,41 +1,34 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 LodHandler_HEADER
#define LodHandler_HEADER
class LodHandler
{
public:
virtual void startLod(){};
virtual void startLod() {};
};
#endif

View File

@@ -1,24 +1,24 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 Segment_Header_HEADER
#define Segment_Header_HEADER
@@ -28,10 +28,9 @@
#include "Context.h"
#include "GUID.h"
#include "I32.h"
#include "U16.h"
#include "U32.h"
#include "I32.h"
using namespace std;
@@ -39,7 +38,7 @@ using namespace std;
struct Segment_Header
{
Segment_Header(){};
Segment_Header() {};
Segment_Header(Context& cont)
{
@@ -54,15 +53,9 @@ struct Segment_Header
};
GUID Segment_ID;
I32 Segment_Type;
I32 Segment_Length;
I32 Segment_Type;
I32 Segment_Length;
};
#endif

View File

@@ -1,24 +1,24 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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
@@ -28,10 +28,9 @@
#include "Context.h"
#include "GUID.h"
#include "I32.h"
#include "U16.h"
#include "U32.h"
#include "I32.h"
using namespace std;
@@ -39,7 +38,7 @@ using namespace std;
struct TOC_Entry
{
TOC_Entry(){};
TOC_Entry() {};
TOC_Entry(Context& cont)
{
@@ -54,26 +53,25 @@ struct TOC_Entry
Segment_Attributes.read(cont);
};
uint8_t getSegmentType()const
uint8_t getSegmentType() const
{
return Segment_Attributes >> 24;
}
std::string toString()const{
std::string toString() const
{
stringstream strm;
strm << getSegmentType() << ":" << Segment_Offset << ":" << Segment_Length << ":" << Segment_ID.toString();
strm << getSegmentType() << ":" << Segment_Offset << ":" << Segment_Length << ":"
<< Segment_ID.toString();
return strm.str();
}
GUID Segment_ID;
I32 Segment_Offset;
I32 Segment_Length;
U32 Segment_Attributes;
I32 Segment_Offset;
I32 Segment_Length;
U32 Segment_Attributes;
};
#endif
#endif

View File

@@ -1,24 +1,24 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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
@@ -30,9 +30,11 @@ using namespace std;
struct U16
{
U16(){};
U16() {};
U16(uint16_t ui) :_U16(ui){}
U16(uint16_t ui)
: _U16(ui)
{}
U16(Context& cont)
{
@@ -53,5 +55,4 @@ struct U16
};
#endif
#endif

View File

@@ -1,24 +1,24 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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
@@ -30,9 +30,11 @@ using namespace std;
struct U32
{
U32(){};
U32() {};
U32(uint32_t ui) :_U32(ui){}
U32(uint32_t ui)
: _U32(ui)
{}
U32(Context& cont)
{
@@ -53,6 +55,4 @@ struct U32
};
#endif
#endif

View File

@@ -1,39 +1,41 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 "Context.h"
#include <istream>
#include <stdint.h>
#include "Context.h"
using namespace std;
struct U8
{
U8(){};
U8() {};
U8(uint8_t ui) :_U8(ui){}
U8(uint8_t ui)
: _U8(ui)
{}
U8(Context& cont)
{
@@ -51,9 +53,8 @@ struct U8
}
uint8_t _U8;
};
#endif
#endif

View File

@@ -1,37 +1,37 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 "Context.h"
#include <istream>
#include <stdint.h>
#include "Context.h"
using namespace std;
struct UChar
{
UChar(){};
UChar() {};
UChar(Context& cont)
{
@@ -52,5 +52,4 @@ struct UChar
};
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -9,13 +9,14 @@
/** simple facet structure */
struct SimpleMeshFacet {
float p1[3],p2[3],p3[3],n[3];
struct SimpleMeshFacet
{
float p1[3], p2[3], p3[3], n[3];
};
/** Reads a JT File an build up the internal data structure
* imports all the meshes of all Parts, recursing the Assamblies.
*/
* imports all the meshes of all Parts, recursing the Assamblies.
*/
void readFile(const char* FileName, int iLods = 0);
/** Write the read Part to a file */
@@ -33,4 +34,4 @@ unsigned int iterSize(void);
/** clears the internal structure */
void clearData(void);
#endif // __JtReader_h__
#endif// __JtReader_h__

View File

@@ -4,4 +4,4 @@
***************************************************************************/
#include "PreCompiled.h"
#include "PreCompiled.h"

View File

@@ -11,11 +11,11 @@
// Importing of App classes
#ifdef FC_OS_WIN32
# define MeshExport __declspec(dllimport)
# define AppJtReaderExport __declspec(dllexport)
#else // for Linux
# define MeshExport
# define AppJtReaderExport
#define MeshExport __declspec(dllimport)
#define AppJtReaderExport __declspec(dllexport)
#else// for Linux
#define MeshExport
#define AppJtReaderExport
#endif
#ifdef _PreComp_
@@ -23,16 +23,16 @@
/// point at which warnings of overly long specifiers disabled (needed for VC6)
#ifdef _MSC_VER
# pragma warning( disable : 4251 )
# pragma warning( disable : 4503 )
# pragma warning( disable : 4275 )
# pragma warning( disable : 4786 ) // specifier longer then 255 chars
#pragma warning(disable : 4251)
#pragma warning(disable : 4503)
#pragma warning(disable : 4275)
#pragma warning(disable : 4786)// specifier longer then 255 chars
#endif
// standard
#include <cstdio>
#include <cassert>
#include <cstdio>
// STL
#include <algorithm>
@@ -51,6 +51,6 @@
// sys
#include <sys/types.h>
#endif //_PreComp_
#endif//_PreComp_
#endif

View File

@@ -1,24 +1,24 @@
/**************************************************************************
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
* Copyright (c) 2014 Juergen Riegel <juergen.riegel@web.de> *
* *
* 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 *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
@@ -28,39 +28,32 @@
#include <Base/Console.h>
#include <Base/FileInfo.h>
#include "TestJtReader.h"
#include "FcLodHandler.h"
#include "TestJtReader.h"
TestJtReader::TestJtReader()
{
}
{}
TestJtReader::~TestJtReader()
{
}
{}
void TestJtReader::read(void)
{
//const std::vector<TOC_Entry>& toc = readToc();
// const std::vector<TOC_Entry>& toc = readToc();
for (std::vector<TOC_Entry>::const_iterator i = TocEntries.begin(); i != TocEntries.end(); ++i){
for (std::vector<TOC_Entry>::const_iterator i = TocEntries.begin(); i != TocEntries.end();
++i) {
int segType = i->getSegmentType();
if (segType == 7){
if (segType == 7) {
FcLodHandler handler;
readLodSegment(*i, handler);
}
Base::Console().Log(i->toString().c_str());
}
}

View File

@@ -9,11 +9,8 @@
class TestJtReader: public JtReader
{
public:
TestJtReader();
~TestJtReader();
void read(void);
TestJtReader();
~TestJtReader();
void read(void);
};

View File

@@ -2,4 +2,4 @@
# (c) 2007 Juergen Riegel LGPL
# Append the open handler
FreeCAD.addImportType("JtOpen (*.jt)","JtReader")
FreeCAD.addImportType("JtOpen (*.jt)", "JtReader")

View File

@@ -1,29 +1,28 @@
#***************************************************************************
#* Copyright (c) 2002,2003 Juergen Riegel <juergen.riegel@web.de> *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* FreeCAD 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 Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************
# ***************************************************************************
# * Copyright (c) 2002,2003 Juergen Riegel <juergen.riegel@web.de> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * FreeCAD 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 Lesser General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with FreeCAD; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
# JtReader gui init module
#
# Gathering all the information to start FreeCAD
# This is the second one of three init scripts, the third one
# runs when the gui is up