38 #include "vtkCompositeDataGeometryFilter.h"
39 #include "vtkFeatureEdges.h"
40 #include "vtkMultiPieceDataSet.h"
41 #include "vtkPolyData.h"
42 #include "vtkPolyDataMapper.h"
43 #include "vtkProperty.h"
44 #include "vtkRenderer.h"
45 #include "vtkSmartPointer.h"
51 namespace functionObjects
53 namespace runTimePostPro
68 { representationType::rtNone,
"none" },
69 { representationType::rtGlyph,
"glyph" },
70 { representationType::rtWireframe,
"wireframe" },
71 { representationType::rtSurface,
"surface" },
72 { representationType::rtSurfaceWithEdges,
"surfaceWithEdges" },
82 if (dataset)
return dataset->GetCellData();
88 if (dataset)
return dataset->GetPointData();
100 geometryBase::initialiseActor(actor);
102 switch (representation_)
106 actor->VisibilityOff();
112 actor->GetProperty()->SetRepresentationToWireframe();
118 actor->GetProperty()->SetBackfaceCulling(backFaceCulling_);
119 actor->GetProperty()->SetFrontfaceCulling(frontFaceCulling_);
120 actor->GetProperty()->SetRepresentationToSurface();
123 case rtSurfaceWithEdges:
125 actor->GetProperty()->SetBackfaceCulling(backFaceCulling_);
126 actor->GetProperty()->SetFrontfaceCulling(frontFaceCulling_);
127 actor->GetProperty()->SetRepresentationToSurface();
128 actor->GetProperty()->EdgeVisibilityOn();
137 vtkRenderer* renderer,
138 vtkFeatureEdges* featureEdges
146 featureEdges->BoundaryEdgesOn();
147 featureEdges->FeatureEdgesOn();
148 featureEdges->ManifoldEdgesOff();
149 featureEdges->NonManifoldEdgesOff();
151 featureEdges->ColoringOff();
152 featureEdges->Update();
155 mapper->SetInputConnection(featureEdges->GetOutputPort());
156 mapper->ScalarVisibilityOff();
158 edgeActor_->GetProperty()->SetSpecular(0);
159 edgeActor_->GetProperty()->SetSpecularPower(20);
160 edgeActor_->GetProperty()->SetRepresentationToWireframe();
161 edgeActor_->SetMapper(mapper);
163 renderer->AddActor(edgeActor_);
169 vtkRenderer* renderer,
176 featureEdges->SetInputData(
data);
178 addFeatureEdges(renderer, featureEdges);
185 vtkRenderer* renderer,
186 vtkCompositeDataGeometryFilter* input
192 featureEdges->SetInputConnection(input->GetOutputPort());
194 addFeatureEdges(renderer, featureEdges);
211 representationTypeNames.get(
"representation",
dict)
213 featureEdges_(
dict.getOrDefault(
"featureEdges",
false)),
214 backFaceCulling_(
dict.getOrDefault(
"backFaceCulling",
false)),
215 frontFaceCulling_(
dict.getOrDefault(
"frontFaceCulling",
true)),
216 surfaceColour_(
nullptr),
217 edgeColour_(
nullptr),
225 if (
dict.found(
"surfaceColour"))
231 surfaceColour_.reset(colours[
"surface"]->clone().ptr());
234 if (
dict.found(
"edgeColour"))
240 edgeColour_.reset(colours[
"edge"]->clone().ptr());
243 if (representation_ == rtGlyph)
245 dict.readEntry(
"maxGlyphLength", maxGlyphLength_);
258 const word& surfaceType
263 auto cstrIter = dictionaryConstructorTablePtr_->cfind(surfaceType);
265 if (!cstrIter.found())
272 *dictionaryConstructorTablePtr_
290 const scalar position
298 vtkProperty* edgeProp = edgeActor_->GetProperty();
300 edgeProp->SetLineWidth(2);
301 edgeProp->SetOpacity(opacity(position));
303 const vector ec = edgeColour_->value(position);
304 edgeProp->SetColor(ec[0], ec[1], ec[2]);
305 edgeProp->SetEdgeColor(ec[0], ec[1], ec[2]);