Hi,
This is possibly something I am doing wrong and just not spotting it.
All I am doing is adding a new pure virtual function in the base
Painter class and then implementing it in the painters. Right now they
are empty. The first attempt the GLPainter version had some code.
I get the following compile error every time,
/Users/mhanwell/devel/avogadro-git/libavogadro/src/glwidget.cpp: In
member function ‘void Avogadro::GLWidget::constructor(const
Avogadro::GLWidget*)’:
/Users/mhanwell/devel/avogadro-git/libavogadro/src/glwidget.cpp:423:
error: cannot allocate an object of abstract type ‘Avogadro::GLPainter’
/usr/local/include/avogadro/glpainter.h:50: note: because the
following virtual functions are pure within ‘Avogadro::GLPainter’:
/Users/mhanwell/devel/avogadro-git/libavogadro/include/avogadro/…/…/
src/painter.h:132: note: virtual void
Avogadro::Painter::drawCone(const Eigen::Vector3d&, const
Eigen::Vector3d&, double)
The diff for the minimal commit is included below. I would really
appreciate someone letting me know what I am missing. Geoff took a
look but couldn’t spot it but the definition is basically identical to
drawLine…
Any ideas?
Thanks,
Marcus
diff --git a/libavogadro/src/glpainter.h b/libavogadro/src/glpainter.h
index 0e0cb74…c4b7a56 100644
— a/libavogadro/src/glpainter.h
+++ b/libavogadro/src/glpainter.h
@@ -146,6 +146,9 @@ namespace Avogadro
void drawMultiCylinder (const Eigen::Vector3d &end1, const
Eigen::Vector3
double radius, int order, double shift);
-
void drawCone(const Eigen::Vector3d &p1, const Eigen::Vector3d
&p2,
-
double radius) { }
-
/** * Draws a GL line between the given points of the given width. * @param start the position of the start of the line.
diff --git a/libavogadro/src/painter.h b/libavogadro/src/painter.h
index d679287…4f88ad5 100644
— a/libavogadro/src/painter.h
+++ b/libavogadro/src/painter.h
@@ -128,6 +128,9 @@ namespace Avogadro
virtual void drawMultiCylinder (const Eigen::Vector3d &end1,
const Eigen:
double radius, int order, double
shift) = 0;
-
virtual void drawCone(const Eigen::Vector3d &p1, const
Eigen::Vector3d &p
-
double radius) = 0;
-
/** * Draws a line between the given points of the given width. * @param start the position of the start of the line.
diff --git a/libavogadro/src/povpainter.h b/libavogadro/src/povpainter.h
index 06c37a5…beb4083 100644
— a/libavogadro/src/povpainter.h
+++ b/libavogadro/src/povpainter.h
@@ -141,6 +141,9 @@ namespace Avogadro
void drawMultiCylinder (const Vector3d &end1, const Vector3d &end2,
double radius, int order, double shift);
- void drawCone(const Eigen::Vector3d &, const Eigen::Vector3d &,
-
double) { }
- /**
* Draws a line between the given points of the given width.
* @param start the position of the start of the line.