Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "vtkDualGraph.h"
- #include "vtkBoostGraphAdapter.h"
- #include "vtkInformationVector.h"
- #include "vtkObjectFactory.h"
- //----------------------------------------------------------------------------
- #include <iostream>
- #include <vector>
- #include <boost/tuple/tuple.hpp>
- #include <boost/graph/adjacency_list.hpp>
- #include <boost/graph/boyer_myrvold_planar_test.hpp>
- #include <boost/planar_dual.hpp>
- //----------------------------------------------------------------------------
- using namespace boost;
- vtkStandardNewMacro(vtkDualGraph);
- //----------------------------------------------------------------------------
- vtkDualGraph::vtkDualGraph(){}
- //----------------------------------------------------------------------------
- vtkDualGraph::~vtkDualGraph(){}
- //----------------------------------------------------------------------------
- void vtkDualGraph::PrintSelf(ostream& os, vtkIndent indent){
- this->Superclass::PrintSelf(os, indent);
- }
- //----------------------------------------------------------------------------
- int vtkDualGraph::RequestData(vtkInformation* vtkNotUsed(request),
- vtkInformationVector** inputVector,
- vtkInformationVector* outputVector){
- // get the info objects
- vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
- vtkInformation *outInfo = outputVector->GetInformationObject(0);
- // get the input and output
- vtkGraph *input = vtkGraph::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
- vtkGraph *output = vtkGraph::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
- vtkUndirectedGraph* in = vtkUndirectedGraph::SafeDownCast(input);
- vtkMutableUndirectedGraph* dual = vtkMutableUndirectedGraph::SafeDownCast(output);
- // Compute the planar embedding - we know the input graph is planar,
- // so we're ignoring the return value of the test
- typedef std::vector<graph_traits<vtkUndirectedGraph*>::edge_descriptor> vec_t;
- std::vector<vec_t> embedding(num_vertices(in));
- boyer_myrvold_planarity_test(boyer_myrvold_params::graph = in, boyer_myrvold_params::embedding = &embedding[0]);
- create_dual_graph(in, dual, &embedding[0]);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement