VTK/Examples/Cxx/Broken/Graphs/NodeShape

From KitwarePublic

Jump to: navigation, search

Currently broken: Can you glyph something besides a vertex at each point? What are "icons"?

NodeShape.cxx

#include <vtkSmartPointer.h>
#include <vtkMutableUndirectedGraph.h>
#include <vtkGraphWriter.h>
#include <vtkGraphLayoutView.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkGraphLayoutStrategy.h>
#include <vtkSimple2DLayoutStrategy.h>
 
int main(int, char *[])
{
  vtkSmartPointer<vtkMutableUndirectedGraph> g =
    vtkSmartPointer<vtkMutableUndirectedGraph>::New();
 
  vtkIdType v1 = g->AddVertex();
  vtkIdType v2 = g->AddVertex();
 
  g->AddEdge(v1, v2);
  g->AddEdge(v1, v2);
 
  vtkSmartPointer<vtkGraphLayoutView> graphLayoutView =
    vtkSmartPointer<vtkGraphLayoutView>::New();
  graphLayoutView->AddRepresentationFromInput(g);
  graphLayoutView->ResetCamera();
  graphLayoutView->Render();
  graphLayoutView->IconVisibilityOn();
  graphLayoutView->GetInteractor()->Start();
 
  return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
PROJECT(NodeShape)
 
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
 
ADD_EXECUTABLE(NodeShape NodeShape.cxx)
TARGET_LINK_LIBRARIES(NodeShape vtkHybrid  vtkViews)
Personal tools