Select Git revision
OCCAttributes.h
OCCAttributes.h 8.81 KiB
// Gmsh - Copyright (C) 1997-2019 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
#ifndef OCC_ATTRIBUTES_H
#define OCC_ATTRIBUTES_H
#include <vector>
#include <string>
#include "GmshConfig.h"
#include "GmshMessage.h"
#include "OS.h"
#include "rtree.h"
#if defined(HAVE_OCC)
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include <TopoDS_Shape.hxx>
#include <BRepTools.hxx>
class OCCAttributes {
private:
int _dim;
TopoDS_Shape _shape;
double _meshSize;
ExtrudeParams *_extrude;
int _sourceDim;
TopoDS_Shape _sourceShape;
std::string _label;
public:
OCCAttributes() : _dim(-1), _meshSize(MAX_LC), _extrude(0), _sourceDim(-1)
{
}
OCCAttributes(int dim, TopoDS_Shape shape)
: _dim(dim), _shape(shape), _meshSize(MAX_LC), _extrude(0), _sourceDim(-1)
{
}
OCCAttributes(int dim, TopoDS_Shape shape, double size)
: _dim(dim), _shape(shape), _meshSize(size), _extrude(0), _sourceDim(-1)
{
}
OCCAttributes(int dim, TopoDS_Shape shape, ExtrudeParams *e,
int sourceDim, TopoDS_Shape sourceShape)
: _dim(dim), _shape(shape), _meshSize(MAX_LC), _extrude(e),
_sourceDim(sourceDim), _sourceShape(sourceShape)
{
}
OCCAttributes(int dim, TopoDS_Shape shape, const std::string &label)
: _dim(dim), _shape(shape), _meshSize(MAX_LC), _extrude(0), _sourceDim(-1),
_label(label)
{
}
~OCCAttributes() {}
int getDim() { return _dim; }
TopoDS_Shape getShape() { return _shape; }
double getMeshSize() { return _meshSize; }
ExtrudeParams *getExtrudeParams() { return _extrude; }
int getSourceDim() { return _sourceDim; }
TopoDS_Shape getSourceShape() { return _sourceShape; }
const std::string &getLabel() { return _label; }
};
// attributes are stored according to the center of their associated shape
// bounding box; this allows to efficiently search for potential matches, even
// if the actual underlying shape has been modified (typically through boolean
// fragments)
class OCCAttributesRTree {