Select Git revision
OCCAttributes.h
OCCAttributes.h 10.51 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 "Context.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;
std::vector<double> _color;
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 dim, TopoDS_Shape shape, double r, double g, double b,
double a = 1., int boundary = 0)
: _dim(dim), _shape(shape), _meshSize(MAX_LC), _extrude(0), _sourceDim(-1)
{
_color.resize(boundary ? 5 : 4);
_color[0] = r;
_color[1] = g;
_color[2] = b;
_color[3] = a;
if(boundary) _color[4] = boundary;
}
~OCCAttributes() {}
int getDim() { return _dim; }