<div class="gmail_quote">On Tue, Aug 31, 2010 at 8:09 AM, Will Schroeder <span dir="ltr"><<a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
David-<div><br></div><div>Can you make it consistent with vtkMapper? vtkMapper has a color mode to determine how to treat unsigned char as follows:</div><div><br></div><div><div> // Description:</div><div> // Control how the scalar data is mapped to colors. By default</div>
<div> // (ColorModeToDefault), unsigned char scalars are treated as colors, and</div><div> // NOT mapped through the lookup table, while everything else is. Setting</div><div> // ColorModeToMapScalars means that all scalar data will be mapped through</div>
<div> // the lookup table. (Note that for multi-component scalars, the</div><div> // particular component to use for mapping can be specified using the</div><div> // SelectColorArray() method.)</div><div> vtkSetMacro(ColorMode,int);</div>
<div> vtkGetMacro(ColorMode,int);</div><div> void SetColorModeToDefault() </div><div> {this->SetColorMode(VTK_COLOR_MODE_DEFAULT);};</div><div> void SetColorModeToMapScalars() </div><div> {this->SetColorMode(VTK_COLOR_MODE_MAP_SCALARS);};</div>
<div></div></div></blockquote></div><div><br></div>Thanks for the quick feedback!<div><br><div>I added<span style="font-family:arial, sans-serif;font-size:12.5px;border-collapse:collapse"> SetColorModeToDefault and SetColorModeToMapScalars to both </span><span style="font-family:arial, sans-serif;font-size:12.5px;border-collapse:collapse">vtkRenderedGraphRepresentation and vtkGraphLayoutView</span><span style="font-family:arial, sans-serif;font-size:12.5px;border-collapse:collapse">. The procedure is now very easy:</span></div>
<div><br></div><div><div> // Add the color array to the graph</div><div> tree->GetVertexData()->SetScalars(vertexColors);</div><div><br></div><div> vtkSmartPointer<vtkGraphLayoutView> graphLayoutView =</div>
<div> vtkSmartPointer<vtkGraphLayoutView>::New();</div><div> graphLayoutView->AddRepresentationFromInput(tree);</div><div> graphLayoutView->SetLayoutStrategyToTree();</div><div> graphLayoutView->ColorVerticesOn();</div>
<div> graphLayoutView->SetColorModeToDefault(); // new functionality (color by Scalars)</div><div> //graphLayoutView->SetColorModeToMapScalars(); //old functionality</div><div> graphLayoutView->ResetCamera();</div>
<div> graphLayoutView->Render();</div><div> graphLayoutView->GetInteractor()->Start();</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 12.5px; border-collapse: collapse; "><div>
repo: git@github.com:daviddoria/daviddoria-vtk.git</div><div>branch: VTK-GraphColors</div><div><br></div></span></div>David</div>
</div>