[vtk-developers] Add FindCell(double[3]) to vtkImageData

David Cole david.cole at kitware.com
Tue Apr 13 12:36:40 EDT 2010


On Tue, Apr 13, 2010 at 12:21 PM, David Doria
<daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> wrote:

> On Tue, Apr 13, 2010 at 12:15 PM, Andy Bauer <andy.bauer at kitware.com>
> wrote:
> > Hi David,
> >
> > The reason you're getting the compiler warning is that the FindCell that
> > you've declared in the derived class hides the virtual FindCell class in
> the
> > base class because they have the same name but different signatures.
> You'd
> > have to do something like imageData->Superclass::FindCell(x, cell,
> > cellId,...); in order to call the base class directly or play around with
> > the derived class definition.
> >
> > Read
> http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.9
> > for more info.
> >
> > With all this said, you'll want to rename your simplified FindCell
> function.
> >
> > Andy
>
> I see, thanks for that link.
>
> So what do we name it? FindCellSimple()?
>
> or maybe something like
>
> bool IsInsideCell(double p[3], vtkIdType& cellId)
>
> vtkIdType PointInsideCell(double p[3])
>
> Other thoughts?
>
>
>
Alternatively, if you do not want to rename it because FindCell is really
the perfect name for it, then simply add the other FindCell signature at the
derived level as well, and do the simple "call parent class" implementation
for it. That converts it to an "overload" instead of a "hide"... at the
expense of having to re-implement the method in question.

But if you can rename it reasonably, then that's probably the better way to
go.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100413/5f7be8bc/attachment.html>


More information about the vtk-developers mailing list