<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 10/26/2010 10:02 AM, David Doria wrote:
<blockquote
cite="mid:AANLkTi=eoF4Xc+0DKLL+JVKtZOqW9VcdwBSdHzF3wKg3@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
<div>
<div class="h5">David,</div>
</div>
<br>
It works fine with PointData and CellData; however I could
not figure out how to proceed with FieldData (There is no
method SetActive at this level in the hierarchy :-/, and my
values are attributes to one mesh (constant for a single
mesh).<br>
Is there a way to proceed with vtkFieldData?<br>
<br>
---<br>
<br>
If not, I can use CellData instead. In this case, I can
switch from active scalar array to original mesh colors by
setting it to one that does not belong to the mesh:<br>
<br>
polydata->GetCellData->SetActiveScalars( "" );<br>
<br>
Is there a better way to proceed?<br>
<br>
Thanks,<br>
Arnaud</div>
</blockquote>
<div><br>
</div>
The reason that you can't set active scalars on the FieldData is
probably that it doesn't always make sense to apply arrays from
the FieldData to the data because it is not necessarily
"aligned" (the same length). </div>
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote">Since it is a single color per
object/mesh, can you color the actor based on the field data
value (the 0th value in the array)?</div>
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote">Something like: </div>
<div class="gmail_quote"><br>
</div>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<div class="gmail_quote">vtkFloatArray* colorArray
= vtkFloatArray::SafeDownCast(polydata->GetFieldData()->GetArray("color1"));</div>
<div class="gmail_quote">float color[3];</div>
<div class="gmail_quote">colorArray->GetTupleValue(0, color);</div>
<div class="gmail_quote"><br>
</div>
<div class="gmail_quote"><span class="Apple-style-span"
style="font-family: monospace; font-size: 12.5px; white-space:
pre;">actor<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span
class="sy1" style="color: rgb(0, 0, 128);">></span>GetProperty<span
class="br0" style="color: rgb(0, 128, 0);">(</span><span
class="br0" style="color: rgb(0, 128, 0);">)</span><span
class="sy2" style="color: rgb(0, 0, 64);">-</span><span
class="sy1" style="color: rgb(0, 0, 128);">></span>SetColor<span
class="br0" style="color: rgb(0, 128, 0);">(</span><span
class="br0"><font class="Apple-style-span" color="#800080">color</font></span><span
class="br0" style="color: rgb(0, 128, 0);">)</span><span
class="sy4" style="color: rgb(0, 128, 128);">;</span></span><br>
<br>
</div>
<div class="gmail_quote">?</div>
<div class="gmail_quote"><br>
<div>David</div>
</div>
</blockquote>
<br>
I have tried to set a color (see attached code), but I still need to
remove the active scalar array ?<br>
<br>
Arnaud<br>
<br>
<br>
</body>
</html>