Multiple use of DataRenderers

Hi all,

We had this a few months ago but now I ran in new troubles. I have
designed a class called DisplayData that holds everything related to a
Data object similar to SSCellData. One difference to SSCellData is that
you can assign a special DataRenderer to your DisplayData such as a
DirectManipulationRenderer. Then I have a subroutine that adds these
DisplayDatas to my DisplayImpl. The following is a code snippet of this

for (int i = 0 ; i < dataArray.length ; i++) {
  if (dataArray[i].getDataRenderer() == null) {
    if (dataArray[i].getConstantMaps() == null) {
    } else {
  } else {
    DataRenderer renderer
    if (dataArray[i].getConstantMaps() == null) {
      display.addReferences(renderer, dataArray[i].getReference());
    } else {
      display.addReferences(renderer, dataArray[i].getReference(),

That works fine for all kinds of DataRenderers that need no arguments in
their constructor. But now I have to use a RubberBandBoxRendererJ3D
which needs at least two RealTypes as arguments. I could catch this by
asking if renderer is a RubberBandBoxRendererJ3D and then constructing
the new Renderer directly. But that would be a bad workaround because I
want to support all possible DataRenderers, even others without default
constructors. And it would be bad style to catch all possible

Are there any ideas for better workarounds? What about implementing a
copy constructor in the DataRenderers or a clone()-method?

Thanks a lot, Mathias

Mathias Stümpert
email: mathias@xxxxxxxxxxxx

  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: