Coin Logo http://www.sim.no/
http://www.coin3d.org/

SoSTLFileKit.h

00001 #ifndef COIN_SOSTLFILEKIT_H
00002 #define COIN_SOSTLFILEKIT_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) by Kongsberg Oil & Gas Technologies.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Kongsberg Oil & Gas Technologies
00018  *  about acquiring a Coin Professional Edition License.
00019  *
00020  *  See http://www.coin3d.org/ for more information.
00021  *
00022  *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/SbBasic.h>
00028 
00029 #include <Inventor/fields/SoSFString.h>
00030 #include <Inventor/fields/SoSFBool.h>
00031 #include <Inventor/fields/SoSFEnum.h>
00032 
00033 #include <ForeignFiles/SoForeignFileKit.h>
00034 
00035 class SbVec3f;
00036 class SoCallbackAction;
00037 class SoPrimitiveVertex;
00038 class SoSTLFileKitP;
00039 
00040 class COIN_DLL_API SoSTLFileKit : public SoForeignFileKit {
00041   typedef SoForeignFileKit inherited;
00042 
00043   SO_KIT_HEADER(SoSTLFileKit);
00044   SO_KIT_CATALOG_ENTRY_HEADER(shapehints);
00045   SO_KIT_CATALOG_ENTRY_HEADER(texture);
00046   SO_KIT_CATALOG_ENTRY_HEADER(normalbinding);
00047   SO_KIT_CATALOG_ENTRY_HEADER(normals);
00048   SO_KIT_CATALOG_ENTRY_HEADER(materialbinding);
00049   SO_KIT_CATALOG_ENTRY_HEADER(material);
00050   SO_KIT_CATALOG_ENTRY_HEADER(coordinates);
00051   SO_KIT_CATALOG_ENTRY_HEADER(facets);
00052 
00053 public:
00054   static void initClass(void);
00055   SoSTLFileKit(void);
00056 
00057   enum Colorization { GREY, MATERIALISE, TNO_VISICAM };
00058 
00059   SoSFString info;
00060   SoSFBool binary;
00061   SoSFEnum colorization;
00062 
00063   static SbBool identify(const char * filename);
00064   virtual SbBool canReadFile(const char * filename = NULL) const;
00065   virtual SbBool readFile(const char * filename);
00066   virtual SbBool canReadScene(void) const;
00067   virtual SbBool readScene(SoNode * scene);
00068 
00069   virtual SbBool canWriteFile(const char * filename = NULL) const;
00070   virtual SbBool writeFile(const char * filename);
00071   virtual SbBool canWriteScene(const char * format = NULL) const;
00072   virtual SbBool writeScene(SoNode *& root, const char * format = NULL);
00073 
00074 protected:
00075   virtual ~SoSTLFileKit(void);
00076 
00077   void reset(void);
00078   SbBool addFacet(const SbVec3f & v1, const SbVec3f & v2, const SbVec3f & v3,
00079                   const SbVec3f & normal);
00080   void organizeModel(void);
00081 
00082 private:
00083   SoSTLFileKitP * pimpl;
00084 
00085   static void add_facet_cb(void * closure, SoCallbackAction * action, const SoPrimitiveVertex * v1, const SoPrimitiveVertex * v2, const SoPrimitiveVertex * v3);
00086   static void put_facet_cb(void * closure, SoCallbackAction * action, const SoPrimitiveVertex * v1, const SoPrimitiveVertex * v2, const SoPrimitiveVertex * v3);
00087 
00088 }; // SoSTLFileKit
00089 
00090 #endif // !COIN_SOSTLFILEKIT_H

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Sun May 1 2011 02:58:22 for Coin by Doxygen 1.7.3.