Skip to content

File OsgFactory.h

File List > detail > io > OsgFactory.h

Go to the documentation of this file

// Copyright (c) 2012-2013, IGN France.
// Copyright (c) 2012-2022, Oslandia.
// SPDX-License-Identifier: LGPL-2.0-or-later

#ifndef _SFCGAL_IO_OSGFACTORY_H_
#define _SFCGAL_IO_OSGFACTORY_H_

#include "SFCGAL/config.h"

#ifndef SFCGAL_WITH_OSG
#error                                                                         \
    "SFCGAL is not built with OpenSceneGraph support, this header can't be included"
#endif

#include <osg/Geometry>

#include "SFCGAL/Geometry.h"

namespace SFCGAL {
namespace detail {
namespace io {

class SFCGAL_API OsgFactory {
public:
  osg::Geometry *
  createGeometry(const Geometry &g);

  osg::Vec3
  createVec3(const Point &g) const;

protected:
  size_t
  createVertex(osg::Vec3Array *vertices, const Point &g);
  size_t
  createVertex(osg::Vec3Array *vertices, const osg::Vec3 &g);

  void
  addToGeometry(osg::Geometry *, const Geometry &);

  void
  addToGeometry(osg::Geometry *, const Point &);

  void
  addToGeometry(osg::Geometry *, const LineString &);

  void
  addToGeometry(osg::Geometry *, const Triangle &);

  void
  addToGeometry(osg::Geometry *, const Polygon &);

  void
  addToGeometry(osg::Geometry *, const TriangulatedSurface &);

  void
  addToGeometry(osg::Geometry *, const PolyhedralSurface &);

  void
  addToGeometry(osg::Geometry *, const Solid &);

  void
  addToGeometry(osg::Geometry *, const GeometryCollection &);
};

} // namespace io
} // namespace detail
} // namespace SFCGAL

#endif