/usr/include/paraview/vtkSMSILModel.h is in paraview-dev 5.0.1+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | /*=========================================================================
Program: ParaView
Module: vtkSMSILModel.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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.
=========================================================================*/
// .NAME vtkSMSILModel - is a helper for to work with SILs.
//
// .SECTION Description
// vtkSMSILModel makes it easier to make checks/unchecks for the SIL while
// respecting the links/dependencies defined by the SIL.
//
// There are two ways of initializing the model:
// \li One way is to initialize it with a SIL (using Initialize(vtkGraph*).
// Then the model can be used as a simple API to check/uncheck elements.
// \li Second way is to initialize with a proxy and property (using
// Initialize(vtkSMProxy, vtkSMProperty*). In that case, the SIL is obtained
// from the property's vtkSMSILDomain. Also as the user changes the check
// states, the property is updated/pushed.
//
// .SECTION Events
// \li vtkCommand::UpdateDataEvent -- fired when the check state of any element
// changes. calldata = vertexid for the element whose check state changed.
#ifndef vtkSMSILModel_h
#define vtkSMSILModel_h
#include "vtkPVServerManagerCoreModule.h" //needed for exports
#include "vtkSMObject.h"
#include <set> // required for vtkset
class vtkGraph;
class vtkSMStringVectorProperty;
class vtkSMProxy;
class VTKPVSERVERMANAGERCORE_EXPORT vtkSMSILModel : public vtkSMObject
{
public:
static vtkSMSILModel* New();
vtkTypeMacro(vtkSMSILModel, vtkSMObject);
void PrintSelf(ostream& os, vtkIndent indent);
//BTX
enum CheckState
{
UNCHECKED = 0,
PARTIAL = 1,
CHECKED = 2
};
//ETX
// Description:
// Initialize the model using a SIL.
// There are two ways of initializing the model:
// \li One way is to initialize it with a SIL (using Initialize(vtkGraph*).
// Then the model can be used as a simple API to check/uncheck elements.
// \li Second way is to initialize with a proxy and property (using
// Initialize(vtkSMProxy, vtkSMProperty*). In that case, the SIL is obtained
// from the property's vtkSMSILDomain. Also as the user changes the check
// states, the property is updated/pushed.
void Initialize(vtkGraph* sil);
vtkGetObjectMacro(SIL, vtkGraph);
// Description:
// Initialize the model using a proxy and its property.
// If a property is set, then the model keeps the property updated when the
// check states are changed or when the property changes, the model's internal
// check states are updated. If the property has a SILDomain, then the model
// attaches itself to the domain so that whenever the domains is updated (i.e.
// a new SIL is obtained from the server) the model updates the sil as well.
//
// There are two ways of initializing the model:
// \li One way is to initialize it with a SIL (using Initialize(vtkGraph*).
// Then the model can be used as a simple API to check/uncheck elements.
// \li Second way is to initialize with a proxy and property (using
// Initialize(vtkSMProxy, vtkSMProperty*). In that case, the SIL is obtained
// from the property's vtkSMSILDomain. Also as the user changes the check
// states, the property is updated/pushed.
void Initialize(vtkSMProxy*, vtkSMStringVectorProperty*);
vtkGetObjectMacro(Proxy, vtkSMProxy);
vtkGetObjectMacro(Property, vtkSMStringVectorProperty);
// Description:
// Returns the number of children for the given vertex.
// A node is a child node if it has no out-going edges or all out-going edges
// have "CrossEdges" set to 1. If vertex id is invalid, returns -1.
int GetNumberOfChildren(vtkIdType vertexid);
// Description:
// Returns the vertex id for the n-th child where n=child_index. Returns 0 if
// request is invalid.
vtkIdType GetChildVertex(vtkIdType parentid, int child_index);
// Description:
// Returns the parent vertex i.e. the vertex at the end of an in-edge which is
// not a cross-edge. It's an error to call this method for the root vertex id
// i.e. 0.
vtkIdType GetParentVertex(vtkIdType parent);
// Description:
// Get the name for the vertex.
const char* GetName(vtkIdType vertex);
// Description:
// Get the check state for a vertex.
int GetCheckStatus(vtkIdType vertex);
// Description:
// Set the check state for a vertex.
// Returns true if the status was changed, false if unaffected.
bool SetCheckState(vtkIdType vertex, int status);
bool SetCheckState(const char* name, int status)
{
vtkIdType vertex = this->FindVertex(name);
if (vertex != -1)
{
return this->SetCheckState(vertex, status);
}
vtkErrorMacro("Failed to locate " << name);
return false;
}
// Description:
// Convenience methods to check/uncheck all items.
void CheckAll();
void UncheckAll();
// Description:
// Updates the property using the check states maintained by the model.
void UpdatePropertyValue(vtkSMStringVectorProperty*);
// Description:
// Updates the check states maintained internally by the model using the
// status from the property.
void UpdateStateFromProperty(vtkSMStringVectorProperty*);
// Description:
// Locate a vertex with the given name. Returns -1 if the vertex is not found.
vtkIdType FindVertex(const char* name);
//BTX
void GetLeaves(std::set<vtkIdType>& leaves,
vtkIdType root, bool traverse_cross_edges);
protected:
vtkSMSILModel();
virtual ~vtkSMSILModel();
void UpdateProperty();
void OnPropertyModified();
void OnDomainModified();
/// Called to check/uncheck an item.
void Check(vtkIdType vertexid, bool checked, vtkIdType inedgeid = -1);
/// Determine vertexid's check state using its immediate children.
/// If the check-state for the vertex has changed, then it propagates the call
/// to the parent node.
void UpdateCheck(vtkIdType vertexid);
bool BlockUpdate;
void SetSIL(vtkGraph*);
vtkSMProxy* Proxy;
vtkSMStringVectorProperty* Property;
vtkGraph* SIL;
vtkCommand* PropertyObserver;
vtkCommand* DomainObserver;
private:
vtkSMSILModel(const vtkSMSILModel&); // Not implemented.
void operator=(const vtkSMSILModel&); // Not implemented.
class vtkInternals;
vtkInternals* Internals;
//ETX
};
#endif
|