diff --git a/src/Mod/JtReader/App/FcLodHandler.cpp b/src/Mod/JtReader/App/FcLodHandler.cpp
new file mode 100644
index 000000000..268107012
--- /dev/null
+++ b/src/Mod/JtReader/App/FcLodHandler.cpp
@@ -0,0 +1,40 @@
+/***************************************************************************
+* 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 *
+* *
+***************************************************************************/
+
+
+#include "PreCompiled.h"
+#ifndef _PreComp_
+#endif
+
+#include
+
+#include "FcLodHandler.h"
+
+
+
+
+
+
+void FcLodHandler::startLod()
+{
+ Base::Console().Log("FcLodHandler::startLod()");
+}
diff --git a/src/Mod/JtReader/App/FcLodHandler.h b/src/Mod/JtReader/App/FcLodHandler.h
new file mode 100644
index 000000000..bd4fad3d7
--- /dev/null
+++ b/src/Mod/JtReader/App/FcLodHandler.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+* 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 FcLodHandler_HEADER
+#define FcLodHandler_HEADER
+
+#include "JrJt/LodHandler.h"
+
+class FcLodHandler: public LodHandler
+{
+public:
+ virtual void startLod();
+
+
+
+};
+
+
+
+#endif
+
+
+
+
+
diff --git a/src/Mod/JtReader/App/JrJt/Element_Header.h b/src/Mod/JtReader/App/JrJt/Element_Header.h
new file mode 100644
index 000000000..23c9e8a34
--- /dev/null
+++ b/src/Mod/JtReader/App/JrJt/Element_Header.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+* 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 Element_Header_HEADER
+#define Element_Header_HEADER
+
+#include
+#include
+#include
+
+#include "Context.h"
+#include "GUID.h"
+#include "UChar.h"
+#include "I32.h"
+
+
+
+using namespace std;
+
+
+struct Element_Header
+{
+ Element_Header(){};
+
+ Element_Header(Context& cont, bool zLib=false)
+ {
+ read(cont, zLib);
+ };
+
+ inline void read(Context& cont ,bool zLib=false)
+ {
+ // only zip less implemented so far...
+ assert(zLib == false);
+
+ Element_Lenght.read(cont);
+ Object_Type_ID.read(cont);
+ Object_Base_Type.read(cont);
+ };
+
+ I32 Element_Lenght;
+ GUID Object_Type_ID;
+ UChar Object_Base_Type;
+
+
+};
+
+
+
+#endif
+
+
+
+
+
+
+
diff --git a/src/Mod/JtReader/App/JrJt/GUID.h b/src/Mod/JtReader/App/JrJt/GUID.h
index 2e4571f51..3afcd55df 100644
--- a/src/Mod/JtReader/App/JrJt/GUID.h
+++ b/src/Mod/JtReader/App/JrJt/GUID.h
@@ -41,11 +41,34 @@ struct 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(Context& cont)
{
read(cont);
}
+ 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;
+ }
+
inline void read(Context& cont)
{
_A1.read(cont);
diff --git a/src/Mod/JtReader/App/JrJt/JtReader.cpp b/src/Mod/JtReader/App/JrJt/JtReader.cpp
index 34a0b03a9..e67f5a43b 100644
--- a/src/Mod/JtReader/App/JrJt/JtReader.cpp
+++ b/src/Mod/JtReader/App/JrJt/JtReader.cpp
@@ -3,19 +3,25 @@
#include
#include
#include
-
+#include
#include
+
#include "TOC_Entry.h"
#include "GUID.h"
#include "UChar.h"
#include "I32.h"
#include "TOC_Entry.h"
+#include "LodHandler.h"
+#include "Segment_Header.h"
+#include "Element_Header.h"
using namespace std;
+const GUID JtReader::TriStripSetShapeLODElement_ID(0x10dd10ab, 0x2ac8, 0x11d1, 0x9b, 0x6b, 0x0, 0x80, 0xc7, 0xbb, 0x59, 0x97);
+
JtReader::JtReader()
{
}
@@ -63,4 +69,32 @@ const std::vector& JtReader::readToc()
return TocEntries;
+
+}
+
+void JtReader::readLodSegment(const TOC_Entry& toc, LodHandler& handler)
+{
+ std::ifstream strm;
+ strm.open(_fileName, ios::binary);
+
+ if (!strm) throw "cannot open file";
+
+ strm.seekg((int32_t)toc.Segment_Offset);
+
+ Context cont(strm);
+
+
+ // check if called with the right Toc
+ assert(toc.getSegmentType() == 7);
+
+ // read the segment header
+ Segment_Header header(cont);
+
+ // read the non zip Element header
+ Element_Header eHeader(cont, false);
+
+ if ( eHeader.Object_Type_ID != TriStripSetShapeLODElement_ID)
+ return;
+
+
}
diff --git a/src/Mod/JtReader/App/JrJt/JtReader.h b/src/Mod/JtReader/App/JrJt/JtReader.h
index a0310a1d4..04b8893a5 100644
--- a/src/Mod/JtReader/App/JrJt/JtReader.h
+++ b/src/Mod/JtReader/App/JrJt/JtReader.h
@@ -4,6 +4,9 @@
#include
#include "TOC_Entry.h"
+class LodHandler;
+
+
class JtReader
{
@@ -17,7 +20,9 @@ public:
void readSegment(int tocIndex);
-
+ void readLodSegment(const TOC_Entry&, LodHandler&);
+
+ static const GUID TriStripSetShapeLODElement_ID;
protected:
diff --git a/src/Mod/JtReader/App/JrJt/LodHandler.h b/src/Mod/JtReader/App/JrJt/LodHandler.h
new file mode 100644
index 000000000..0d830e1c3
--- /dev/null
+++ b/src/Mod/JtReader/App/JrJt/LodHandler.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+* 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 LodHandler_HEADER
+#define LodHandler_HEADER
+
+
+
+class LodHandler
+{
+public:
+ virtual void startLod(){};
+
+
+
+};
+
+
+
+#endif
+
+
diff --git a/src/Mod/JtReader/App/JrJt/Segment_Header.h b/src/Mod/JtReader/App/JrJt/Segment_Header.h
new file mode 100644
index 000000000..3dd4d6f34
--- /dev/null
+++ b/src/Mod/JtReader/App/JrJt/Segment_Header.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+* 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 Segment_Header_HEADER
+#define Segment_Header_HEADER
+
+#include
+#include
+
+#include "Context.h"
+#include "GUID.h"
+#include "U16.h"
+#include "U32.h"
+#include "I32.h"
+
+
+
+using namespace std;
+
+
+struct Segment_Header
+{
+ Segment_Header(){};
+
+ Segment_Header(Context& cont)
+ {
+ read(cont);
+ };
+
+ inline void read(Context& cont)
+ {
+ Segment_ID.read(cont);
+ Segment_Type.read(cont);
+ Segment_Length.read(cont);
+ };
+
+ GUID Segment_ID;
+ I32 Segment_Type;
+ I32 Segment_Length;
+
+
+};
+
+
+
+#endif
+
+
+
diff --git a/src/Mod/JtReader/App/JrJt/TOC_Entry.h b/src/Mod/JtReader/App/JrJt/TOC_Entry.h
index 2c530c5fb..0605c7558 100644
--- a/src/Mod/JtReader/App/JrJt/TOC_Entry.h
+++ b/src/Mod/JtReader/App/JrJt/TOC_Entry.h
@@ -56,7 +56,7 @@ struct TOC_Entry
uint8_t getSegmentType()const
{
- return Segment_Attributes << 24;
+ return Segment_Attributes >> 24;
}
std::string toString()const{
diff --git a/src/Mod/JtReader/App/JrJt/U16.h b/src/Mod/JtReader/App/JrJt/U16.h
index ddffc633a..422f830c9 100644
--- a/src/Mod/JtReader/App/JrJt/U16.h
+++ b/src/Mod/JtReader/App/JrJt/U16.h
@@ -32,6 +32,8 @@ struct U16
{
U16(){};
+ U16(uint16_t ui) :_U16(ui){}
+
U16(Context& cont)
{
read(cont);
diff --git a/src/Mod/JtReader/App/JrJt/U32.h b/src/Mod/JtReader/App/JrJt/U32.h
index f2df9df6c..f1d30e311 100644
--- a/src/Mod/JtReader/App/JrJt/U32.h
+++ b/src/Mod/JtReader/App/JrJt/U32.h
@@ -32,6 +32,8 @@ struct U32
{
U32(){};
+ U32(uint32_t ui) :_U32(ui){}
+
U32(Context& cont)
{
read(cont);
diff --git a/src/Mod/JtReader/App/JrJt/U8.h b/src/Mod/JtReader/App/JrJt/U8.h
index f4e8f9325..5ed935758 100644
--- a/src/Mod/JtReader/App/JrJt/U8.h
+++ b/src/Mod/JtReader/App/JrJt/U8.h
@@ -33,6 +33,8 @@ struct U8
{
U8(){};
+ U8(uint8_t ui) :_U8(ui){}
+
U8(Context& cont)
{
read(cont);
diff --git a/src/Mod/JtReader/App/TestJtReader.cpp b/src/Mod/JtReader/App/TestJtReader.cpp
index f6fb8f8f4..30eb82bb8 100644
--- a/src/Mod/JtReader/App/TestJtReader.cpp
+++ b/src/Mod/JtReader/App/TestJtReader.cpp
@@ -25,12 +25,14 @@
#endif
-#include
+#include
+#include
#include
#include
#include "TestJtReader.h"
+#include "FcLodHandler.h"
TestJtReader::TestJtReader()
@@ -49,6 +51,15 @@ void TestJtReader::read(void)
for (std::vector::const_iterator i = TocEntries.begin(); i != TocEntries.end(); ++i){
int segType = i->getSegmentType();
+ if (segType == 7){
+ FcLodHandler handler;
+
+ readLodSegment(*i, handler);
+
+
+ }
+
+
Base::Console().Log(i->toString().c_str());
}