vtkPolyDataMapperNode.h 2.77 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPolyDataMapperNode.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
15 16 17 18 19 20 21
/**
 * @class   vtkPolyDataMapperNode
 * @brief   vtkViewNode specialized for vtkPolyDataMappers
 *
 * State storage and graph traversal for vtkPolyDataMapper/PolyDataMapper and Property
 * Made a choice to merge PolyDataMapper, PolyDataMapper and property together. If there
 * is a compelling reason to separate them we can.
22
 */
23 24 25 26 27

#ifndef vtkPolyDataMapperNode_h
#define vtkPolyDataMapperNode_h

#include "vtkMapperNode.h"
28
#include "vtkRenderingSceneGraphModule.h" // For export macro
29 30 31 32 33 34 35

#include <vector> //for results

class vtkActor;
class vtkPolyDataMapper;
class vtkPolyData;

36
class VTKRENDERINGSCENEGRAPH_EXPORT vtkPolyDataMapperNode : public vtkMapperNode
37 38 39 40
{
public:
  static vtkPolyDataMapperNode* New();
  vtkTypeMacro(vtkPolyDataMapperNode, vtkMapperNode);
41
  void PrintSelf(ostream& os, vtkIndent indent) override;
42

43
  struct vtkPDConnectivity_t
44
  {
45 46 47 48 49 50 51 52
    std::vector<unsigned int> vertex_index;
    std::vector<unsigned int> vertex_reverse;
    std::vector<unsigned int> line_index;
    std::vector<unsigned int> line_reverse;
    std::vector<unsigned int> triangle_index;
    std::vector<unsigned int> triangle_reverse;
    std::vector<unsigned int> strip_index;
    std::vector<unsigned int> strip_reverse;
53 54
  };
  using vtkPDConnectivity = struct vtkPDConnectivity_t;
55

56 57
protected:
  vtkPolyDataMapperNode();
Ken Martin's avatar
Ken Martin committed
58
  ~vtkPolyDataMapperNode() override;
59

60
  // Utilities for children
61 62 63 64
  /**
   * Makes a cleaned up version of the polydata's geometry in which NaN are removed
   * (substituted with neighbor) and the PolyDataMapper's transformation matrix is applied.
   */
65
  static void TransformPoints(vtkActor* act, vtkPolyData* poly, std::vector<double>& vertices);
66

67 68 69 70 71 72
  /**
   * Homogenizes the entire polydata using internal CreateXIndexBuffer functions.
   * They flatten the input polydata's Points, Lines, Polys, and Strips contents into
   * the output arrays. The output "index" arrays contain indices into the Points. The
   * output "reverse" array contains indices into the original CellArray.
   */
73
  static void MakeConnectivity(vtkPolyData* poly, int representation, vtkPDConnectivity& conn);
74

75
private:
76 77
  vtkPolyDataMapperNode(const vtkPolyDataMapperNode&) = delete;
  void operator=(const vtkPolyDataMapperNode&) = delete;
78 79 80
};

#endif