/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright (C) 2004-2012 HUBzero Foundation, LLC * * Author: Leif Delgass */ #include #include #include #include #include #include "Arrow.h" #include "Trace.h" using namespace VtkVis; Arrow::Arrow() : Shape() { } Arrow::~Arrow() { TRACE("Deleting Arrow"); } void Arrow::update() { if (_arrow == NULL) { _arrow = vtkSmartPointer::New(); } if (_pdMapper == NULL) { _pdMapper = vtkSmartPointer::New(); _pdMapper->SetResolveCoincidentTopologyToPolygonOffset(); _pdMapper->ScalarVisibilityOff(); } vtkSmartPointer normalFilter = vtkSmartPointer::New(); normalFilter->SetFeatureAngle(90.); normalFilter->SetInputConnection(_arrow->GetOutputPort()); _pdMapper->SetInputConnection(_arrow->GetOutputPort()); initProp(); getActor()->SetMapper(_pdMapper); _pdMapper->Update(); } void Arrow::flipNormals(bool state) { if (_arrow == NULL || _pdMapper == NULL) return; if (state) { vtkSmartPointer filter = vtkSmartPointer::New(); filter->ReverseCellsOn(); filter->ReverseNormalsOn(); filter->SetInputConnection(_arrow->GetOutputPort()); _pdMapper->SetInputConnection(filter->GetOutputPort()); } else { _pdMapper->SetInputConnection(_arrow->GetOutputPort()); } }