Commit b43b1ce7 authored by Will Schroeder's avatar Will Schroeder
Browse files

ERR: Misc bug fixes.

parent a9a2e294
......@@ -19,7 +19,8 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
#ifndef __vlDataSetMapper_h
#define __vlDataSetMapper_h
#include "Mapper.hh"
#include "GeomF.hh"
#include "PolyMap.hh"
#include "DataSet.hh"
#include "Renderer.hh"
......@@ -36,9 +37,9 @@ public:
virtual vlDataSet* GetInput();
protected:
int CreateMapper();
vlDataSet *Input;
vlMapper *Mapper;
vlGeometryFilter *GeometryExtractor;
vlPolyMapper *PolyMapper;
};
#endif
......
......@@ -14,17 +14,16 @@ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// Methods for polygon mapper
// Methods to map abstract DataSet through concrete mappers.
//
#include "DSMapper.hh"
#include "PolyMap.hh"
#include "UGridMap.hh"
#include "UPtsMap.hh"
vlDataSetMapper::vlDataSetMapper()
{
this->Input = NULL;
this->Mapper = NULL;
this->GeometryExtractor = NULL;
this->PolyMapper = NULL;
}
vlDataSetMapper::~vlDataSetMapper()
......@@ -34,9 +33,14 @@ vlDataSetMapper::~vlDataSetMapper()
this->Input->UnRegister(this);
}
if ( this->Mapper )
if ( this->GeometryExtractor )
{
this->Mapper->UnRegister(this);
this->GeometryExtractor->UnRegister(this);
}
if ( this->PolyMapper )
{
this->PolyMapper->UnRegister(this);
}
}
......@@ -82,76 +86,31 @@ void vlDataSetMapper::Render(vlRenderer *ren)
vlErrorMacro(<< "No input!\n");
return;
}
else
{
//
// Now can create appropriate mapper
//
if ( this->CreateMapper() )
this->Mapper->Render(ren);
}
}
int vlDataSetMapper::CreateMapper()
{
vlMapper *mapper;
char *InputType;
char *OldMapperType = NULL;
InputType = this->Input->GetDataType();
// if we have an old mapper get its type otherwise set it to none
if (this->Mapper)
{
OldMapperType = this->Mapper->GetClassName();
}
else
{
OldMapperType = "none";
}
if (!strcmp("vlPolyData",InputType))
{
if (strcmp(OldMapperType,"vlPolyMapper"))
{
if (this->Mapper) this->Mapper->UnRegister(this);
this->Mapper = new vlPolyMapper;
this->Mapper->Register(this);
}
}
if (!strcmp("vlStructuredPoints",InputType))
if ( this->PolyMapper == NULL )
{
vlErrorMacro(<< "Structured Points Mapper not supported");
}
vlGeometryFilter *gf = new vlGeometryFilter();
vlPolyMapper *pm = new vlPolyMapper;
pm->SetInput(gf);
if (!strcmp("vlStructuredGrid",InputType))
{
vlErrorMacro(<< "Structured Grid Mapper not supported");
}
this->GeometryExtractor = gf;
this->GeometryExtractor->Register(this);
if (!strcmp("vlUnstructuredGrid",InputType))
{
if (strcmp(OldMapperType,"vlUnstructuredGridMapper"))
{
if (this->Mapper) this->Mapper->UnRegister(this);
this->Mapper = new vlUnstructuredGridMapper;
this->Mapper->Register(this);
}
this->PolyMapper = pm;
this->PolyMapper->Register(this);
}
// update ourselves in case something has changed
this->PolyMapper->SetLookupTable(this->GetLookupTable());
this->PolyMapper->SetScalarsVisible(this->GetScalarsVisible());
this->PolyMapper->SetScalarRange(this->GetScalarRange());
if (!strcmp("vlUnstructuredPoints",InputType))
{
if (strcmp(OldMapperType,"vlUnstructuredPointsMapper"))
{
if (this->Mapper) this->Mapper->UnRegister(this);
this->Mapper = new vlUnstructuredPointsMapper;
this->Mapper->Register(this);
}
}
this->GeometryExtractor->SetInput(this->Input);
this->PolyMapper->Render(ren);
return 1;
}
}
void vlDataSetMapper::PrintSelf(ostream& os, vlIndent indent)
{
......@@ -168,14 +127,22 @@ void vlDataSetMapper::PrintSelf(ostream& os, vlIndent indent)
os << indent << "Input: (none)\n";
}
if ( this->Mapper )
if ( this->PolyMapper )
{
os << indent << "Poly Mapper: (" << this->PolyMapper << ")\n";
}
else
{
os << indent << "Poly Mapper: (none)\n";
}
if ( this->GeometryExtractor )
{
os << indent << "Mapper: (" << this->Mapper << ")\n";
os << indent << "Mapper type: " << this->Mapper->GetClassName() << "\n";
os << indent << "Geometry Extractor: (" << this->GeometryExtractor << ")\n";
}
else
{
os << indent << "Mapper: (none)\n";
os << indent << "Geometry Extractor: (none)\n";
}
}
}
......@@ -37,18 +37,13 @@ vlMapper::~vlMapper()
void vlMapper::operator=(const vlMapper& m)
{
if (this->LookupTable) this->LookupTable->UnRegister(this);
this->LookupTable = m.LookupTable;
if (this->LookupTable) this->LookupTable->Register(this);
this->SetLookupTable(m.LookupTable);
this->ScalarsVisible = m.ScalarsVisible;
this->ScalarRange[0] = m.ScalarRange[0];
this->ScalarRange[1] = m.ScalarRange[1];
this->SetScalarsVisible(m.ScalarsVisible);
this->SetScalarRange(m.ScalarRange[0], m.ScalarRange[1]);
this->StartRender = m.StartRender;
this->EndRender = m.EndRender;
this->Modified();
this->SetStartRender(m.StartRender);
this->SetEndRender(m.EndRender);
}
void vlMapper::SetStartRender(void (*f)())
......
......@@ -89,7 +89,7 @@ void vlPolyMapper::Render(vlRenderer *ren)
else
this->Input->Update();
if ( ! this->LookupTable ) this->LookupTable = new vlLookupTable;
if ( ! this->LookupTable ) this->SetLookupTable(new vlLookupTable);
this->LookupTable->Build();
//
......
Markdown is supported
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