File: vtkPath.cxx

package info (click to toggle)
vtk9 9.3.0%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 267,116 kB
  • sloc: cpp: 2,195,914; ansic: 285,452; python: 104,858; sh: 4,061; yacc: 4,035; java: 3,977; xml: 2,771; perl: 2,189; lex: 1,762; objc: 153; makefile: 150; javascript: 90; tcl: 59
file content (121 lines) | stat: -rw-r--r-- 3,710 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
#include "vtkPath.h"

#include "vtkGenericCell.h"
#include "vtkIdList.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkIntArray.h"
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"

#include <cassert>

//------------------------------------------------------------------------------
VTK_ABI_NAMESPACE_BEGIN
vtkStandardNewMacro(vtkPath);

//------------------------------------------------------------------------------
vtkPath::vtkPath()
{
  vtkNew<vtkPoints> points;
  this->SetPoints(points);

  vtkNew<vtkIntArray> controlPointCodes;
  controlPointCodes->SetNumberOfComponents(1);
  this->PointData->SetScalars(controlPointCodes);
}

//------------------------------------------------------------------------------
vtkPath::~vtkPath() = default;

//------------------------------------------------------------------------------
void vtkPath::Allocate(vtkIdType size, int extSize)
{
  this->Points->Allocate(size, extSize);
  this->PointData->Allocate(size, extSize);
}

//------------------------------------------------------------------------------
void vtkPath::GetCell(vtkIdType, vtkGenericCell* cell)
{
  cell->SetCellTypeToEmptyCell();
}

//------------------------------------------------------------------------------
void vtkPath::GetCellPoints(vtkIdType, vtkIdList* ptIds)
{
  ptIds->Reset();
}

//------------------------------------------------------------------------------
void vtkPath::GetPointCells(vtkIdType, vtkIdList* cellIds)
{
  cellIds->Reset();
}

//------------------------------------------------------------------------------
void vtkPath::Reset()
{
  this->Points->Reset();
  this->PointData->Reset();
}

//------------------------------------------------------------------------------
vtkPath* vtkPath::GetData(vtkInformation* info)
{
  return info ? vtkPath::SafeDownCast(info->Get(DATA_OBJECT())) : nullptr;
}

//------------------------------------------------------------------------------
vtkPath* vtkPath::GetData(vtkInformationVector* v, int i)
{
  return vtkPath::GetData(v->GetInformationObject(i));
}

//------------------------------------------------------------------------------
void vtkPath::PrintSelf(ostream& os, vtkIndent indent)
{
  this->Superclass::PrintSelf(os, indent);
}

//------------------------------------------------------------------------------
void vtkPath::InsertNextPoint(float pts[3], int code)
{
  this->Points->InsertNextPoint(pts);

  vtkIntArray* codes = vtkArrayDownCast<vtkIntArray>(this->PointData->GetScalars());
  assert("control point code array is int type" && codes);
  codes->InsertNextValue(code);
}

//------------------------------------------------------------------------------
void vtkPath::InsertNextPoint(double pts[3], int code)
{
  this->InsertNextPoint(pts[0], pts[1], pts[2], code);
}

//------------------------------------------------------------------------------
void vtkPath::InsertNextPoint(double x, double y, double z, int code)
{
  this->Points->InsertNextPoint(x, y, z);

  vtkIntArray* codes = vtkArrayDownCast<vtkIntArray>(this->PointData->GetScalars());
  assert("control point code array is int type" && codes);
  codes->InsertNextValue(code);
}

//------------------------------------------------------------------------------
void vtkPath::SetCodes(vtkIntArray* codes)
{
  this->PointData->SetScalars(codes);
}

//------------------------------------------------------------------------------
vtkIntArray* vtkPath::GetCodes()
{
  return vtkArrayDownCast<vtkIntArray>(this->PointData->GetScalars());
}
VTK_ABI_NAMESPACE_END