VMTK
Loading...
Searching...
No Matches
vtkvmtkDataSetItems.cxx
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: VMTK
4 Module: $RCSfile: vtkvmtkDataSetItems.cxx,v $
5 Language: C++
6 Date: $Date: 2005/11/15 17:39:25 $
7 Version: $Revision: 1.3 $
8
9 Copyright (c) Luca Antiga, David Steinman. All rights reserved.
10 See LICENSE file for details.
11
12 Portions of this code are covered under the VTK copyright.
13 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
14 for details.
15
16 This software is distributed WITHOUT ANY WARRANTY; without even
17 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 PURPOSE. See the above copyright notices for more information.
19
20=========================================================================*/
21
22#include "vtkvmtkDataSetItems.h"
23
24#include "vtkObjectFactory.h"
25#include "vtkvmtkDataSetItem.h"
26
27
28
30 {
31 vtkIdType numPts;
32 vtkIdType pointId;
33 vtkvmtkDataSetItem *dataSetItem;
34
35 if (this->DataSet==NULL)
36 {
37 vtkErrorMacro(<<"No DataSet specified.");
38 return;
39 }
40
41 numPts = this->DataSet->GetNumberOfPoints();
42
43 if (!this->Array || (this->Array && this->ReallocateOnBuild))
44 {
45 this->Allocate(numPts);
46 this->MaxId = numPts - 1;
47 }
48
49 for (pointId=0; pointId<numPts; pointId++)
50 {
51 dataSetItem = vtkvmtkDataSetItem::SafeDownCast(this->Array[pointId]);
52 if (dataSetItem==NULL)
53 {
54 vtkErrorMacro(<<"Cannot build non-vtkvmtkDataSetItem item.");
55 return;
56 }
57
58 dataSetItem->SetDataSet(this->DataSet);
59 dataSetItem->SetDataSetPointId(pointId);
60 dataSetItem->Build();
61 }
62 }
63
Create an item instance associated with a data set and a particular point id.
virtual void Build()=0
virtual void SetDataSetPointId(vtkIdType)
static vtkvmtkDataSetItem * SafeDownCast(vtkObjectBase *o)
void SetDataSet(vtkDataSet *dataSet)
void Allocate(vtkIdType numItems, vtkIdType ext=1000)
vtkIdType MaxId
vtkvmtkItem ** Array