Slicer  4.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLTextNode.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3  Portions (c) Copyright 2009 Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See Doc/copyright/copyright.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8  Program: 3D Slicer
9  Module: $RCSfile: vtkMRMLTextNode.h,v $
10  Date: $Date: 2006/03/19 17:12:29 $
11  Version: $Revision: 1.3 $
12 
13 =========================================================================auto=*/
14 
15 #ifndef __vtkMRMLTextNode_h
16 #define __vtkMRMLTextNode_h
17 
18 // MRML includes
19 #include <vtkMRMLStorableNode.h>
20 
21 class VTK_MRML_EXPORT vtkMRMLTextNode : public vtkMRMLStorableNode
22 {
23 public:
24 
25  static vtkMRMLTextNode* New();
27  void PrintSelf(ostream& os, vtkIndent indent) override;
28 
29  enum
30  {
33  CreateStorageNodeNever
34  };
35 
36  vtkMRMLNode* CreateNodeInstance() override;
37 
40  void ReadXMLAttributes(const char** atts) override;
41 
44  void WriteXML(ostream& of, int indent) override;
45 
49 
52  const char* GetNodeTagName() override { return "Text"; };
53 
57  void SetText(const std::string &text, int encoding=-1);
58  vtkGetMacro(Text, std::string);
59 
65  void SetEncoding(int encoding);
66  vtkGetMacro(Encoding, int);
67  std::string GetEncodingAsString();
68 
74  vtkSetClampMacro(ForceCreateStorageNode, int, CreateStorageNodeAuto, CreateStorageNodeNever);
75  vtkGetMacro(ForceCreateStorageNode, int);
76 
81 
84  std::string GetDefaultStorageNodeClassName(const char* filename=nullptr) override;
85 
86  enum
87  {
88  TextModifiedEvent = 51000, // Invoked if the text OR encoding is changed with SetText() and SetEncoding() methods and is not invoked
89  // if the text and encoding specified in the set methods are the same as the current text and encoding
90  };
91 
92 protected:
94  ~vtkMRMLTextNode() override;
96  void operator=(const vtkMRMLTextNode&);
97 
98  std::string Text;
99  int Encoding{VTK_ENCODING_US_ASCII};
100  int ForceCreateStorageNode{CreateStorageNodeAuto};
101 
102 };
103 
104 #endif
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
virtual vtkMRMLStorageNode * CreateDefaultStorageNode()
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file
std::string Text
vtkMRMLNode * CreateNodeInstance() override=0
MRMLNode methods.
virtual std::string GetDefaultStorageNodeClassName(const char *filename=nullptr)
MRML node to represent a 3D surface model.
A superclass for other storage nodes.
vtkMRMLCopyContentMacro(vtkMRMLStorableNode)
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
void operator=(const vtkMRMLStorableNode &)
void WriteXML(ostream &of, int indent) override
Write this node&#39;s information to a MRML file in XML format.
void PrintSelf(ostream &os, vtkIndent indent) override