From 62142525ee50129481583fa3d00de8394cb33018 Mon Sep 17 00:00:00 2001
From: "Joseph F. Boudreau" <boudreau@pitt.edu>
Date: Wed, 18 Mar 2020 12:16:08 -0400
Subject: [PATCH] Deprecation of custom shape and introduction of the
 GeoUnidentifiedShape

---
 .../GeoModelKernel/GeoShapeAction.h           |  7 +-
 .../GeoModelKernel/GeoUnidentifiedShape.h     | 85 +++++++++++++++++++
 GeoModelKernel/src/GeoShapeAction.cxx         | 12 +--
 GeoModelKernel/src/GeoUnidentifiedShape.cxx   | 55 ++++++++++++
 4 files changed, 149 insertions(+), 10 deletions(-)
 create mode 100644 GeoModelKernel/GeoModelKernel/GeoUnidentifiedShape.h
 create mode 100644 GeoModelKernel/src/GeoUnidentifiedShape.cxx

diff --git a/GeoModelKernel/GeoModelKernel/GeoShapeAction.h b/GeoModelKernel/GeoModelKernel/GeoShapeAction.h
index 813ccff..1258b06 100755
--- a/GeoModelKernel/GeoModelKernel/GeoShapeAction.h
+++ b/GeoModelKernel/GeoModelKernel/GeoShapeAction.h
@@ -33,9 +33,7 @@ class GeoTubs;
 class GeoTube;
 class GeoEllipticalTube;
 class GeoTorus;
-
-class LArCustomShape;
-
+class GeoUnidentifiedShape;
 class GeoSimplePolygonBrep;
 class GeoTessellatedSolid;
 
@@ -106,13 +104,14 @@ class GeoShapeAction
   //	Returns a pointer to the path object.
   GeoShapePath * getPath ();
 
-  virtual void handleLArCustom (const LArCustomShape *);
   virtual void handleSimplePolygonBrep (const GeoSimplePolygonBrep *);
   virtual void handleTessellatedSolid (const GeoTessellatedSolid *);
   virtual void handleEllipticalTube (const GeoEllipticalTube *);
   virtual void handleTorus (const GeoTorus *);
   virtual void handleGenericTrap (const GeoGenericTrap *);
+  virtual void handleUnidentifiedShape(const GeoUnidentifiedShape *shape);
 
+  
  private:
   GeoShapeAction(const GeoShapeAction &right);
   GeoShapeAction & operator=(const GeoShapeAction &right);
diff --git a/GeoModelKernel/GeoModelKernel/GeoUnidentifiedShape.h b/GeoModelKernel/GeoModelKernel/GeoUnidentifiedShape.h
new file mode 100644
index 0000000..22428ec
--- /dev/null
+++ b/GeoModelKernel/GeoModelKernel/GeoUnidentifiedShape.h
@@ -0,0 +1,85 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+//=========================================================================
+//
+// GeoUnidentifiedShape
+//
+// This class is essentially a bundle of data with no fixed format.
+// ASCII information can be added and retreived. It serves as a
+// proxy for shapes that are not part of the kernel, i.e. extender-
+// class shapes. 
+//
+// Joe Boudreau 2020
+//
+//=========================================================================
+
+#ifndef _GeoUnidentifiedShape_h_
+#define _GeoUnidentifiedShape_h_
+#include "GeoModelKernel/GeoShape.h"
+#include "GeoModelKernel/Query.h"
+#include <string>
+class GeoUnidentifiedShape: public GeoShape {
+
+ public:
+
+  // Constructor:
+  GeoUnidentifiedShape(const std::string & name);
+  
+  // Constructor:
+  GeoUnidentifiedShape(const std::string & name, const std::string & asciiData);
+  
+  // Constructor with volume: 
+  GeoUnidentifiedShape(const std::string & name, const std::string & asciiData, double volume);
+
+  // Returns the user-provided name of the volume (eg "MySpecialShape");
+  const std::string & name() const;
+
+  // Returns the ascii data associated with this object (possibly empty);
+  const std::string & asciiData() const;
+  
+  // Returns the volume of the shape, for mass inventory
+  virtual double volume () const;
+  
+  // Returns the shape type, as a string.
+  virtual const std::string & type () const;
+  
+  // Returns the shape type, as an coded integer.
+  virtual ShapeType typeID () const;
+
+  //	For type identification.
+  static const std::string& getClassType ();
+
+  //	For type identification.,
+  static ShapeType getClassTypeID ();
+  
+  
+  // Executes a GeoShapeAction
+  virtual void exec (GeoShapeAction *action) const;
+
+
+  
+ protected:
+  // Destructor:
+  ~GeoUnidentifiedShape();
+  
+ private:
+
+  const std::string         _name;
+  const std::string         _asciiData;
+  const Query<double>       _volume;
+  static const std::string         _classType;
+  static const ShapeType           _classTypeID;
+  
+};
+
+inline const std::string& GeoUnidentifiedShape::getClassType ()
+{
+  return _classType;
+}
+
+inline ShapeType GeoUnidentifiedShape::getClassTypeID ()
+{
+  return _classTypeID;
+}
+#endif
diff --git a/GeoModelKernel/src/GeoShapeAction.cxx b/GeoModelKernel/src/GeoShapeAction.cxx
index ebe7978..af4ea97 100755
--- a/GeoModelKernel/src/GeoShapeAction.cxx
+++ b/GeoModelKernel/src/GeoShapeAction.cxx
@@ -23,7 +23,7 @@
 #include "GeoModelKernel/GeoEllipticalTube.h"
 #include "GeoModelKernel/GeoTorus.h"
 #include "GeoModelKernel/GeoGenericTrap.h"
-
+#include "GeoModelKernel/GeoUnidentifiedShape.h"
 
 GeoShapeAction::GeoShapeAction()
   : m_terminate(false)
@@ -133,11 +133,6 @@ GeoShapePath * GeoShapeAction::getPath ()
   return &m_path;
 }
 
-void GeoShapeAction::handleLArCustom (const LArCustomShape *lar)
-{
-  handleShape( (GeoShape *) lar);
-}
-
 void GeoShapeAction::handleSimplePolygonBrep (const GeoSimplePolygonBrep* brep)
 {
   handleShape(brep);
@@ -163,4 +158,9 @@ void GeoShapeAction::handleGenericTrap (const GeoGenericTrap * gentrap)
   handleShape(gentrap);
 }
 
+void GeoShapeAction::handleUnidentifiedShape (const GeoUnidentifiedShape * uShape)
+{
+  handleShape(uShape);
+}
+
 
diff --git a/GeoModelKernel/src/GeoUnidentifiedShape.cxx b/GeoModelKernel/src/GeoUnidentifiedShape.cxx
new file mode 100644
index 0000000..cdae19b
--- /dev/null
+++ b/GeoModelKernel/src/GeoUnidentifiedShape.cxx
@@ -0,0 +1,55 @@
+#include "GeoModelKernel/GeoUnidentifiedShape.h"
+#include "GeoModelKernel/Query.h"
+#include "GeoModelKernel/GeoShapeAction.h"
+
+const std::string         GeoUnidentifiedShape::_classType="UnidentifiedShape";
+const ShapeType           GeoUnidentifiedShape::_classTypeID=0xFFFFFFFF;
+
+// Destructor:
+GeoUnidentifiedShape::~GeoUnidentifiedShape() {
+}
+
+// Constructor:
+GeoUnidentifiedShape::GeoUnidentifiedShape(const std::string & name):
+  _name(name) {}
+
+// Constructor:
+GeoUnidentifiedShape::GeoUnidentifiedShape(const std::string & name, const std::string & asciiData) :
+  _name(name),
+  _asciiData(asciiData) {}
+
+// Constructor with volume: 
+GeoUnidentifiedShape::GeoUnidentifiedShape(const std::string & name, const std::string & asciiData, double volume):
+  _name(name),
+  _asciiData(asciiData),
+  _volume(volume) {}
+
+// Returns the user-provided name of the volume (eg "MySpecialShape");
+const std::string & GeoUnidentifiedShape::name() const {
+  return _name;
+}
+
+// Returns the ascii data associated with this object (possibly empty);
+const std::string & GeoUnidentifiedShape::asciiData() const {
+  return _asciiData;
+}
+
+// Returns the volume of the shape, for mass inventory
+double GeoUnidentifiedShape::volume () const {
+  return _volume;
+}
+  
+// Returns the shape type, as a string.
+const std::string & GeoUnidentifiedShape::type () const {
+  return _classType;
+}
+
+// Returns the shape type, as an coded integer.
+ShapeType GeoUnidentifiedShape::typeID () const {
+  return _classTypeID;
+}
+
+// Executes a GeoShapeAction
+void GeoUnidentifiedShape::exec (GeoShapeAction *action) const {
+  action->handleUnidentifiedShape(this);
+}
-- 
GitLab