Commit 400df480 authored by Karl Palmen's avatar Karl Palmen
Browse files

Rename Geometry::Object class to Geometry::CSGObject re #12827



The files are yet to be renamed

Signed-off-by: default avatarKarl Palmen <karl.palmen@stfc.ac.uk>
parent a2d24486
......@@ -57,7 +57,7 @@ private:
public:
vtkGeometryCacheReader(std::string filename); ///< Constructor
~vtkGeometryCacheReader(); ///< Destructor
void readCacheForObject(Object *obj);
void readCacheForObject(CSGObject *obj);
};
} // NAMESPACE Geometry
......
......@@ -43,7 +43,7 @@ namespace Geometry {
File change history is stored at: <https://github.com/mantidproject/mantid>
*/
class Object;
class CSGObject;
class MANTID_GEOMETRY_DLL vtkGeometryCacheWriter {
private:
Poco::XML::Document *mDoc; ///< The XML document
......@@ -56,7 +56,7 @@ private:
public:
vtkGeometryCacheWriter(std::string); ///< Constructor
~vtkGeometryCacheWriter(); ///< Destructor
void addObject(Object *obj);
void addObject(CSGObject *obj);
void write(); ///< Write the XML to a file
};
......
......@@ -55,7 +55,7 @@ ComponentInfo::ComponentInfo(
componentIds,
boost::shared_ptr<const std::unordered_map<Geometry::IComponent *, size_t>>
componentIdToIndexMap,
boost::shared_ptr<std::vector<boost::shared_ptr<const Geometry::Object>>>
boost::shared_ptr<std::vector<boost::shared_ptr<const Geometry::CSGObject>>>
shapes)
: m_componentInfo(std::move(componentInfo)),
m_componentIds(std::move(componentIds)),
......@@ -166,7 +166,7 @@ void ComponentInfo::setRotation(const size_t componentIndex,
Kernel::toQuaterniond(newRotation));
}
const Object &ComponentInfo::shape(const size_t componentIndex) const {
const CSGObject &ComponentInfo::shape(const size_t componentIndex) const {
return *(*m_shapes)[componentIndex];
}
......
......@@ -49,7 +49,7 @@ void updateTreeValues(Poco::XML::Element *root,
* Construct a container providing an XML definition shape
* @param xml Definition of the shape in xml
*/
Container::Container(std::string xml) : Object(xml) {}
Container::Container(std::string xml) : CSGObject(xml) {}
/**
* @return True if the can contains a defintion of the sample shape
......@@ -87,7 +87,7 @@ Container::createSampleShape(const Container::ShapeArgs &args) const {
updateTreeValues(root, args);
ShapeFactory factory;
return factory.createShape<Object>(root);
return factory.createShape<CSGObject>(root);
}
/**
......
......@@ -39,7 +39,7 @@ Detector::Detector(const std::string &name, int id, IComponent *parent)
* @param parent :: The parent component
*/
Detector::Detector(const std::string &name, int id,
boost::shared_ptr<Object> shape, IComponent *parent)
boost::shared_ptr<CSGObject> shape, IComponent *parent)
: IDetector(), ObjComponent(name, shape, parent), m_id(id) {}
/** Gets the detector id
......
......@@ -1253,7 +1253,7 @@ void InstrumentDefinitionParser::appendAssembly(
}
if (pType->getAttribute("object_created") == "no") {
pType->setAttribute("object_created", "yes");
boost::shared_ptr<Geometry::Object> obj = objAss->createOutline();
boost::shared_ptr<Geometry::CSGObject> obj = objAss->createOutline();
if (obj) {
mapTypeNameToShape[pType->getAttribute("name")] = obj;
} else { // object failed to be created
......@@ -1402,7 +1402,7 @@ void InstrumentDefinitionParser::createRectangularDetector(
// Given that this leaf component is actually an assembly, its constituent
// component detector shapes comes from its type attribute.
const std::string shapeType = pType->getAttribute("type");
boost::shared_ptr<Geometry::Object> shape = mapTypeNameToShape[shapeType];
boost::shared_ptr<Geometry::CSGObject> shape = mapTypeNameToShape[shapeType];
// These parameters are in the TYPE defining RectangularDetector
if (pType->hasAttribute("xpixels"))
......@@ -1502,7 +1502,7 @@ void InstrumentDefinitionParser::createStructuredDetector(
// Given that this leaf component is actually an assembly, its constituent
// component detector shapes comes from its type attribute.
const std::string shapeType = pType->getAttribute("type");
boost::shared_ptr<Geometry::Object> shape = mapTypeNameToShape[shapeType];
boost::shared_ptr<Geometry::CSGObject> shape = mapTypeNameToShape[shapeType];
std::string typeName = pType->getAttribute("name");
// These parameters are in the TYPE defining StructuredDetector
......@@ -2460,7 +2460,7 @@ void InstrumentDefinitionParser::applyCache(IDFObject_const_sptr cacheToApply) {
const std::string cacheFullPath = cacheToApply->getFileFullPathStr();
g_log.information("Loading geometry cache from " + cacheFullPath);
// create a vtk reader
std::map<std::string, boost::shared_ptr<Geometry::Object>>::iterator objItr;
std::map<std::string, boost::shared_ptr<Geometry::CSGObject>>::iterator objItr;
boost::shared_ptr<Mantid::Geometry::vtkGeometryCacheReader> reader(
new Mantid::Geometry::vtkGeometryCacheReader(cacheFullPath));
for (objItr = mapTypeNameToShape.begin(); objItr != mapTypeNameToShape.end();
......@@ -2499,7 +2499,7 @@ InstrumentDefinitionParser::writeAndApplyCache(
const std::string cacheFullPath = usedCache->getFileFullPathStr();
g_log.information() << "Creating cache in " << cacheFullPath << "\n";
// create a vtk writer
std::map<std::string, boost::shared_ptr<Geometry::Object>>::iterator objItr;
std::map<std::string, boost::shared_ptr<Geometry::CSGObject>>::iterator objItr;
boost::shared_ptr<Mantid::Geometry::vtkGeometryCacheWriter> writer(
new Mantid::Geometry::vtkGeometryCacheWriter(cacheFullPath));
for (objItr = mapTypeNameToShape.begin(); objItr != mapTypeNameToShape.end();
......
......@@ -80,8 +80,8 @@ InstrumentVisitor::InstrumentVisitor(
m_orderedDetectorIds->size())),
m_monitorIndices(boost::make_shared<std::vector<size_t>>()),
m_instrument(std::move(instrument)), m_pmap(nullptr),
m_nullShape(boost::make_shared<const Object>()),
m_shapes(boost::make_shared<std::vector<boost::shared_ptr<const Object>>>(
m_nullShape(boost::make_shared<const CSGObject>()),
m_shapes(boost::make_shared<std::vector<boost::shared_ptr<const CSGObject>>>(
m_orderedDetectorIds->size(), m_nullShape)),
m_scaleFactors(boost::make_shared<std::vector<Eigen::Vector3d>>(
m_orderedDetectorIds->size(), Eigen::Vector3d{1, 1, 1})),
......
......@@ -367,7 +367,7 @@ size_t ObjCompAssembly::registerContents(
* The shape can be either a box or a cylinder.
* @return The shape of the outline: "cylinder", "box", ...
*/
boost::shared_ptr<Object> ObjCompAssembly::createOutline() {
boost::shared_ptr<CSGObject> ObjCompAssembly::createOutline() {
if (group.empty()) {
throw Kernel::Exception::InstrumentDefinitionError("Empty ObjCompAssembly");
}
......@@ -382,7 +382,7 @@ boost::shared_ptr<Object> ObjCompAssembly::createOutline() {
int otype;
std::vector<Kernel::V3D> vectors;
double radius, height;
boost::shared_ptr<const Object> obj = group.front()->shape();
boost::shared_ptr<const CSGObject> obj = group.front()->shape();
if (!obj) {
throw Kernel::Exception::InstrumentDefinitionError(
"Found ObjComponent without shape");
......@@ -596,18 +596,18 @@ boost::shared_ptr<Object> ObjCompAssembly::createOutline() {
}
if (!obj_str.str().empty()) {
boost::shared_ptr<Object> s = ShapeFactory().createShape(obj_str.str());
boost::shared_ptr<CSGObject> s = ShapeFactory().createShape(obj_str.str());
setOutline(s);
return s;
}
return boost::shared_ptr<Object>();
return boost::shared_ptr<CSGObject>();
}
/**
* Sets the outline shape for this assembly
* @param obj :: The outline shape created previously fith createOutline()
*/
void ObjCompAssembly::setOutline(boost::shared_ptr<const Object> obj) {
void ObjCompAssembly::setOutline(boost::shared_ptr<const CSGObject> obj) {
m_shape = obj;
}
......
......@@ -35,7 +35,7 @@ ObjComponent::ObjComponent(const std::string &name, IComponent *parent)
* @param parent :: The Parent geometry object of this component
*/
ObjComponent::ObjComponent(const std::string &name,
boost::shared_ptr<const Object> shape,
boost::shared_ptr<const CSGObject> shape,
IComponent *parent)
: IObjComponent(), Component(name, parent), m_shape(shape) {}
......
......@@ -367,7 +367,7 @@ V3D RectangularDetector::getRelativePosAtXY(int x, int y) const {
* and idstep=100 and idstart=1 then (0,0)=1; (0,1)=101; and so on
*
*/
void RectangularDetector::initialize(boost::shared_ptr<Object> shape,
void RectangularDetector::initialize(boost::shared_ptr<CSGObject> shape,
int xpixels, double xstart, double xstep,
int ypixels, double ystart, double ystep,
int idstart, bool idfillbyfirst_y,
......@@ -701,7 +701,7 @@ void RectangularDetector::initDraw() const {
//-------------------------------------------------------------------------------------------------
/// Returns the shape of the Object
const boost::shared_ptr<const Object> RectangularDetector::shape() const {
const boost::shared_ptr<const CSGObject> RectangularDetector::shape() const {
// --- Create a cuboid shape for your pixels ----
double szX = m_xpixels;
double szY = m_ypixels;
......@@ -720,7 +720,7 @@ const boost::shared_ptr<const Object> RectangularDetector::shape() const {
std::string xmlCuboidShape(xmlShapeStream.str());
Geometry::ShapeFactory shapeCreator;
boost::shared_ptr<Geometry::Object> cuboidShape =
boost::shared_ptr<Geometry::CSGObject> cuboidShape =
shapeCreator.createShape(xmlCuboidShape);
return cuboidShape;
......
......@@ -29,7 +29,7 @@ RectangularDetectorPixel::RectangularDetectorPixel(
* @param col :: column of the pixel in the panel
*/
RectangularDetectorPixel::RectangularDetectorPixel(
const std::string &name, int id, boost::shared_ptr<Object> shape,
const std::string &name, int id, boost::shared_ptr<CSGObject> shape,
IComponent *parent, RectangularDetector *panel, size_t row, size_t col)
: Detector(name, id, shape, parent), m_panel(panel), m_row(row),
m_col(col) {
......
......@@ -157,7 +157,7 @@ void SampleEnvironmentSpecParser::parseAndAddComponents(
if (nodeName == CONTAINERS_TAG) {
parseAndAddContainers(spec, childElement);
} else if (nodeName == COMPONENT_TAG) {
spec->addComponent(parseComponent<Object>(childElement));
spec->addComponent(parseComponent<CSGObject>(childElement));
}
node = nodeIter.nextNode();
}
......@@ -237,7 +237,7 @@ Mantid::Geometry::SampleEnvironmentSpecParser::parseComponent(
// Concrete instantions
//------------------------------------------------------------------------------
///@cond
template boost::shared_ptr<Object>
template boost::shared_ptr<CSGObject>
Mantid::Geometry::SampleEnvironmentSpecParser::parseComponent(Element *) const;
template boost::shared_ptr<Container>
Mantid::Geometry::SampleEnvironmentSpecParser::parseComponent(Element *) const;
......
......@@ -420,7 +420,7 @@ Detector *StructuredDetector::addDetector(CompAssembly *parent,
ylb -= ypos;
ShapeFactory factory;
boost::shared_ptr<Mantid::Geometry::Object> shape =
boost::shared_ptr<Mantid::Geometry::CSGObject> shape =
factory.createHexahedralShape(xlb, xlf, xrf, xrb, ylb, ylf, yrf, yrb);
// Create detector
......@@ -572,7 +572,7 @@ void StructuredDetector::initDraw() const {
}
/// Returns the shape of the Object
const boost::shared_ptr<const Object> StructuredDetector::shape() const {
const boost::shared_ptr<const CSGObject> StructuredDetector::shape() const {
// --- Create a hexahedral shape for your pixels ----
auto w = this->xPixels() + 1;
auto xlb = m_xvalues[0];
......
This diff is collapsed.
......@@ -983,7 +983,7 @@ void CompObj::setObjN(const int Ky)
objN = Ky;
}
void CompObj::setObj(Object *val)
void CompObj::setObj(CSGObject *val)
/**
Sets the object
@param val :: Object value
......
......@@ -1385,7 +1385,7 @@ V3D ShapeFactory::parsePosition(Poco::XML::Element *pElem) {
@returns the newly created hexahedral shape object
*/
boost::shared_ptr<Object>
boost::shared_ptr<CSGObject>
ShapeFactory::createHexahedralShape(double xlb, double xlf, double xrf,
double xrb, double ylb, double ylf,
double yrf, double yrb) {
......@@ -1404,7 +1404,7 @@ ShapeFactory::createHexahedralShape(double xlb, double xlf, double xrf,
int l_id = 1;
auto algebra = parseHexahedronFromStruct(hex, prim, l_id);
auto shape = boost::make_shared<Object>();
auto shape = boost::make_shared<CSGObject>();
shape->setObject(21, algebra);
shape->populate(prim);
......@@ -1423,7 +1423,7 @@ ShapeFactory::createHexahedralShape(double xlb, double xlf, double xrf,
/// create a special geometry handler for the known finite primitives
void ShapeFactory::createGeometryHandler(Poco::XML::Element *pElem,
boost::shared_ptr<Object> Obj) {
boost::shared_ptr<CSGObject> Obj) {
auto geomHandler = boost::make_shared<GluGeometryHandler>(Obj);
Obj->setGeometryHandler(geomHandler);
......@@ -1481,12 +1481,12 @@ void ShapeFactory::createGeometryHandler(Poco::XML::Element *pElem,
///@cond
// Template instantations
template MANTID_GEOMETRY_DLL boost::shared_ptr<Object>
template MANTID_GEOMETRY_DLL boost::shared_ptr<CSGObject>
ShapeFactory::createShape(std::string shapeXML, bool addTypeTag);
template MANTID_GEOMETRY_DLL boost::shared_ptr<Container>
ShapeFactory::createShape(std::string shapeXML, bool addTypeTag);
template MANTID_GEOMETRY_DLL boost::shared_ptr<Object>
template MANTID_GEOMETRY_DLL boost::shared_ptr<CSGObject>
ShapeFactory::createShape(Poco::XML::Element *pElem);
template MANTID_GEOMETRY_DLL boost::shared_ptr<Container>
ShapeFactory::createShape(Poco::XML::Element *pElem);
......
......@@ -109,7 +109,7 @@ void Track::removeCojoins() {
* @param compID :: ID of the component that this link is about (Default=NULL)
*/
void Track::addPoint(const int directionFlag, const V3D &endPoint,
const Object &obj, const ComponentID compID) {
const CSGObject &obj, const ComponentID compID) {
IntersectionPoint newPoint(directionFlag, endPoint,
endPoint.distance(m_startPoint), obj, compID);
auto lowestPtr =
......@@ -128,7 +128,7 @@ void Track::addPoint(const int directionFlag, const V3D &endPoint,
* @retval Index of link within the track
*/
int Track::addLink(const V3D &firstPoint, const V3D &secondPoint,
const double distanceAlongTrack, const Object &obj,
const double distanceAlongTrack, const CSGObject &obj,
const ComponentID compID) {
// Process First Point
Link newLink(firstPoint, secondPoint, distanceAlongTrack, obj, compID);
......
......@@ -25,7 +25,7 @@ BitmapGeometryHandler::BitmapGeometryHandler(RectangularDetector *comp)
}
BitmapGeometryHandler::BitmapGeometryHandler()
: GeometryHandler(static_cast<Object *>(nullptr)), m_rectDet(nullptr) {}
: GeometryHandler(static_cast<CSGObject *>(nullptr)), m_rectDet(nullptr) {}
///< Create an instance of concrete geometry handler for ObjComponent
BitmapGeometryHandler *
......@@ -36,13 +36,13 @@ BitmapGeometryHandler::createInstance(IObjComponent *comp) {
///< Create an instance of concrete geometry handler for Object
BitmapGeometryHandler *
BitmapGeometryHandler::createInstance(boost::shared_ptr<Object> obj) {
BitmapGeometryHandler::createInstance(boost::shared_ptr<CSGObject> obj) {
(void)obj;
return new BitmapGeometryHandler();
}
///< Create an instance of concrete geometry handler for Object
GeometryHandler *BitmapGeometryHandler::createInstance(Object *obj) {
GeometryHandler *BitmapGeometryHandler::createInstance(CSGObject *obj) {
(void)obj;
return new BitmapGeometryHandler();
}
......
......@@ -16,7 +16,7 @@ namespace Geometry {
* Constructor
* @param obj :: input object
*/
CacheGeometryGenerator::CacheGeometryGenerator(Object *obj) : Obj(obj) {
CacheGeometryGenerator::CacheGeometryGenerator(CSGObject *obj) : Obj(obj) {
mNoOfVertices = 0;
mNoOfTriangles = 0;
mFaces = nullptr;
......
......@@ -17,13 +17,13 @@ CacheGeometryHandler::CacheGeometryHandler(IObjComponent *comp)
Renderer = new CacheGeometryRenderer();
}
CacheGeometryHandler::CacheGeometryHandler(boost::shared_ptr<Object> obj)
CacheGeometryHandler::CacheGeometryHandler(boost::shared_ptr<CSGObject> obj)
: GeometryHandler(obj) {
Triangulator = new CacheGeometryGenerator(obj.get());
Renderer = new CacheGeometryRenderer();
}
CacheGeometryHandler::CacheGeometryHandler(Object *obj) : GeometryHandler(obj) {
CacheGeometryHandler::CacheGeometryHandler(CSGObject *obj) : GeometryHandler(obj) {
Triangulator = new CacheGeometryGenerator(obj);
Renderer = new CacheGeometryRenderer();
}
......@@ -50,11 +50,11 @@ GeometryHandler *CacheGeometryHandler::createInstance(IObjComponent *comp) {
}
GeometryHandler *
CacheGeometryHandler::createInstance(boost::shared_ptr<Object> obj) {
CacheGeometryHandler::createInstance(boost::shared_ptr<CSGObject> obj) {
return new CacheGeometryHandler(obj);
}
GeometryHandler *CacheGeometryHandler::createInstance(Object *obj) {
GeometryHandler *CacheGeometryHandler::createInstance(CSGObject *obj) {
return new CacheGeometryHandler(obj);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment