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><br></div><br><div class="gmail_quote">On Tue, Aug 31, 2010 at 7:55 AM, David Doria <span dir="ltr"><<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Currently when you use a vtkGraphLayoutView you must use a look up table to color the points. I modified vtkApplyColors and vtkRenderedGraphRepresentation to allow a user to color graph vertices directly with a vtkUnsignedCharArray. Here is an example usage:<div>


<br></div><div><div>  vtkSmartPointer<vtkUnsignedCharArray> vertexColors =</div><div>    vtkSmartPointer<vtkUnsignedCharArray>::New();</div>

<div>  vertexColors->SetNumberOfComponents(3);</div><div>  vertexColors->SetName("PassVertexColors");</div><div><br></div><div>// ... add colors ... ///</div><div><br></div><div>  vtkSmartPointer<vtkRenderedGraphRepresentation> representation =</div>




<div>    vtkSmartPointer<vtkRenderedGraphRepresentation>::New();</div><div>  std::cout << representation->GetClassName() << std::endl;</div><div>  representation->SetInputConnection(tree->GetProducerPort());</div>




<div>  representation->ColorVerticesByArrayOn();</div><div><b>  representation->SetPassThroughPointColors(vertexColors);</b></div><div><br></div><div>  vtkSmartPointer<vtkGraphLayoutView> graphLayoutView =</div>



<div>
    vtkSmartPointer<vtkGraphLayoutView>::New();</div><div>  graphLayoutView->AddRepresentation(representation);</div></div><div><br></div><div>The branch is here:</div><div><br></div><div>repo: git@github.com:daviddoria/daviddoria-vtk.git</div>




<div>branch: VTK-GraphColors</div><div><br clear="all">Please let me know what you think.<br><br>David<br>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br></blockquote></div><br><br clear="all"><br>-- <br>William J. Schroeder, PhD<br>Kitware, Inc.<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com">will.schroeder@kitware.com</a><br>

<a href="http://www.kitware.com">http://www.kitware.com</a><br>(518) 881-4902<br>
</div>