2012-07-19 18:26:47 +00:00
|
|
|
/********************************************************************************
|
2011-08-24 12:35:42 +00:00
|
|
|
* *
|
|
|
|
|
* This file is part of IfcOpenShell. *
|
|
|
|
|
* *
|
|
|
|
|
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the Lesser GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* IfcOpenShell 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 *
|
|
|
|
|
* Lesser GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the Lesser GNU General Public License *
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
|
* *
|
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "IfcGeom.h"
|
|
|
|
|
|
|
|
|
|
namespace IfcGeom {
|
|
|
|
|
namespace Cache {
|
|
|
|
|
std::map<int,TopoDS_Shape> Shape;
|
|
|
|
|
void PurgeShapeCache() {
|
|
|
|
|
Shape.clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-17 22:13:55 +00:00
|
|
|
using namespace IfcSchema;
|
2011-08-24 12:35:42 +00:00
|
|
|
using namespace IfcUtil;
|
|
|
|
|
|
2013-05-05 08:49:25 +00:00
|
|
|
bool IfcGeom::convert_shapes(const IfcBaseClass* l, IfcRepresentationShapeItems& r) {
|
2011-10-23 17:11:06 +00:00
|
|
|
#include "IfcRegisterConvertShapes.h"
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_ERROR,"No operation defined for:",l->entity);
|
2011-10-23 17:11:06 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
bool IfcGeom::is_shape_collection(const IfcBaseClass* l) {
|
|
|
|
|
#include "IfcRegisterIsShapeCollection.h"
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2013-05-05 08:49:25 +00:00
|
|
|
bool IfcGeom::convert_shape(const IfcBaseClass* l, TopoDS_Shape& r) {
|
2011-08-24 12:35:42 +00:00
|
|
|
const unsigned int id = l->entity->id();
|
2013-11-24 15:44:27 +00:00
|
|
|
bool success = false;
|
|
|
|
|
bool processed = false;
|
2011-08-24 12:35:42 +00:00
|
|
|
std::map<int,TopoDS_Shape>::const_iterator it = Cache::Shape.find(id);
|
2013-05-05 08:49:25 +00:00
|
|
|
if ( it != Cache::Shape.end() ) { r = it->second; return true; }
|
2011-08-24 12:35:42 +00:00
|
|
|
#include "IfcRegisterConvertShape.h"
|
2013-11-24 15:44:27 +00:00
|
|
|
if ( processed ) {
|
|
|
|
|
const double precision = IfcGeom::GetValue(GV_PRECISION);
|
|
|
|
|
IfcGeom::apply_tolerance(r, precision);
|
|
|
|
|
Cache::Shape[id] = r;
|
|
|
|
|
} else {
|
|
|
|
|
Logger::Message(Logger::LOG_ERROR,"No operation defined for:",l->entity);
|
|
|
|
|
}
|
|
|
|
|
return success;
|
2011-08-24 12:35:42 +00:00
|
|
|
}
|
2011-09-03 13:58:59 +00:00
|
|
|
bool IfcGeom::convert_wire(const IfcBaseClass* l, TopoDS_Wire& r) {
|
2011-08-24 12:35:42 +00:00
|
|
|
#include "IfcRegisterConvertWire.h"
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_ERROR,"No operation defined for:",l->entity);
|
2011-08-24 12:35:42 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
2011-09-03 13:58:59 +00:00
|
|
|
bool IfcGeom::convert_face(const IfcBaseClass* l, TopoDS_Face& r) {
|
2011-08-24 12:35:42 +00:00
|
|
|
#include "IfcRegisterConvertFace.h"
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_ERROR,"No operation defined for:",l->entity);
|
2011-08-24 12:35:42 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
2011-09-03 13:58:59 +00:00
|
|
|
bool IfcGeom::convert_curve(const IfcBaseClass* l, Handle(Geom_Curve)& r) {
|
2011-08-24 12:35:42 +00:00
|
|
|
#include "IfcRegisterConvertCurve.h"
|
2012-08-11 13:24:08 +00:00
|
|
|
Logger::Message(Logger::LOG_ERROR,"No operation defined for:",l->entity);
|
2011-08-24 12:35:42 +00:00
|
|
|
return false;
|
|
|
|
|
}
|