Commit 105d49d3 authored by Will Schroeder's avatar Will Schroeder
Browse files

*** empty log message ***

parent b07019bf
......@@ -71,7 +71,8 @@ public:
this->Ia.InsertValue(id,pts[npts-1]);
this->Ia[id-npts] = npts;
for (int i=0; i<npts-1; i++) this->Ia[id-npts+i+1] = pts[i];
NumberOfCells++;
this->NumberOfCells++;
this->Location += npts + 1;
}
// create cells by specifying count, and then adding points one at a time using
......@@ -79,7 +80,7 @@ public:
void InsertNextCell(int npts)
{
this->Location = this->Ia.InsertNextValue(npts) + 1;
NumberOfCells++;
this->NumberOfCells++;
}
void InsertCellPoint(int id)
{this->Ia.InsertValue(this->Location++,id);};
......@@ -92,7 +93,8 @@ public:
this->Ia.InsertValue(id,cell->PointIds.GetId(npts-1));
this->Ia[id-npts] = npts;
for (int i=0; i<npts-1; i++) this->Ia[id-npts+i+1] = cell->PointIds.GetId(i);
NumberOfCells++;
this->NumberOfCells++;
this->Location += npts + 1;
}
// access methods for building data structures
......
......@@ -28,10 +28,12 @@ class vlPointSet : virtual public vlDataSet
{
public:
vlPointSet();
vlPointSet(const vlPointSet& ps);
char *GetClassName() {return "vlPointSet";};
void PrintSelf(ostream& os, vlIndent indent);
// dataset interface
void Initialize();
int GetNumberOfPoints()
{if (this->Points) return this->Points->GetNumberOfPoints();
else return 0;};
......
......@@ -36,7 +36,7 @@ public:
void PrintSelf(ostream& os, vlIndent indent);
// dataset interface
vlDataSet *MakeObject();
vlDataSet *MakeObject() {return new vlPolyData(*this);};
int GetNumberOfCells();
vlCell *GetCell(int cellId);
vlMapper *MakeMapper();
......
......@@ -105,6 +105,8 @@ void vlDataSet::PrintSelf(ostream& os, vlIndent indent)
vlObject::PrintSelf(os,indent);
os << indent << "Number Of Points: " << this->GetNumberOfPoints() << "\n";
os << indent << "Number Of Cells: " << this->GetNumberOfCells() << "\n";
os << indent << "Point Data:\n";
this->PointData.PrintSelf(os,indent.GetNextIndent());
bounds = this->GetBounds();
......
......@@ -21,6 +21,31 @@ vlPointSet::vlPointSet ()
this->Locator = 0;
}
vlPointSet::vlPointSet(const vlPointSet& ps)
{
this->Points = ps.Points;
if (this->Points) this->Points->Register((void *)this);
this->Locator = ps.Locator;
if (this->Locator) this->Locator->Register((void *)this);
}
void vlPointSet::Initialize()
{
vlDataSet::Initialize();
if ( this->Points )
{
this->Points->UnRegister((void *)this);
this->Points = 0;
}
if ( this->Locator )
{
this->Locator->UnRegister((void *)this);
this->Locator = 0;
}
}
void vlPointSet::ComputeBounds()
{
float *bounds;
......
......@@ -13,9 +13,6 @@ written consent of the authors.
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 1993, 1994
=========================================================================*/
//
// DataSet methods
//
#include "PolyData.hh"
#include "PolyMap.hh"
#include "Point.hh"
......@@ -36,8 +33,6 @@ vlCellArray *vlPolyData::Dummy = 0;
vlPolyData::vlPolyData ()
{
this->Points = 0;
this->Verts = 0;
this->Lines = 0;
this->Polys = 0;
......@@ -60,10 +55,6 @@ vlPolyData::vlPolyData ()
vlPolyData::vlPolyData(const vlPolyData& pd)
{
this->Points = pd.Points;
if (this->Points) this->Points->Register((void *)this);
this->Verts = pd.Verts;
if (this->Verts) this->Verts->Register((void *)this);
......@@ -84,9 +75,11 @@ vlPolyData::vlPolyData(const vlPolyData& pd)
this->TriangleMesh = pd.TriangleMesh;
this->Writable = pd.Writable;
// these guys are not shared
this->Cells = 0;
this->Links = 0;
this->Cells = pd.Cells;
if (this->Cells) this->Cells->Register((void *)this);
this->Links = pd.Links;
if (this->Links) this->Links->Register((void *)this);
}
vlPolyData::~vlPolyData()
......@@ -94,11 +87,6 @@ vlPolyData::~vlPolyData()
vlPolyData::Initialize();
}
vlDataSet* vlPolyData::MakeObject()
{
return new vlPolyData(*this);
}
vlCell *vlPolyData::GetCell(int cellId)
{
static vlPoint point;
......@@ -236,13 +224,7 @@ vlCellArray* vlPolyData::GetStrips()
void vlPolyData::Initialize()
{
vlDataSet::Initialize();
if ( this->Points )
{
this->Points->UnRegister((void *)this);
this->Points = 0;
}
vlPointSet::Initialize();
if ( this->Verts )
{
......@@ -270,13 +252,13 @@ void vlPolyData::Initialize()
if ( this->Cells )
{
delete this->Cells;
this->Cells->UnRegister((void *)this);
this->Cells = 0;
}
if ( this->Links )
{
delete this->Links;
this->Links->UnRegister((void *)this);
this->Links = 0;
}
......@@ -325,7 +307,7 @@ void vlPolyData::PrintSelf(ostream& os, vlIndent indent)
{
if (this->ShouldIPrint(vlPolyData::GetClassName()))
{
vlDataSet::PrintSelf(os,indent);
vlPointSet::PrintSelf(os,indent);
os << indent << "Number Of Vertices: " << this->GetNumberOfVerts() << "\n";
os << indent << "Number Of Lines: " << this->GetNumberOfLines() << "\n";
......@@ -383,12 +365,13 @@ void vlPolyData::BuildCells()
else
{
this->Cells = cells = new vlCellList(numCells,3*numCells);
this->Cells->Register((void *)this);
}
//
// If we are just reading the data structure, can use the input data
// without any copying or allocation. Otherwise have to allocate
// working storage that is a copy of the input data. Triangle meshes always
// require new atorage.
// require new storage.
//
if ( ! this->Writable && ! this->TriangleMesh )
{
......@@ -529,6 +512,7 @@ void vlPolyData::BuildLinks()
{
if ( ! this->Cells ) this->BuildCells();
this->Links = new vlLinkList(this->GetNumberOfPoints());
this->Links->Register((void *)this);
this->Links->BuildLinks(this);
}
......
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