<div class="gmail_quote">On Tue, Jan 25, 2011 at 9:15 AM, Xiaopeng Yang <span dir="ltr"><<a href="mailto:yxp233@postech.ac.kr">yxp233@postech.ac.kr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal">Greetings!</p><p class="MsoNormal"> </p><p class="MsoNormal">May I ask how to set decimal digits in vtkVariant? For example, I would like to set one decimal digit for the double type variable: vol2/1000. </p>
<p class="MsoNormal"> </p><p class="MsoNormal" style="text-autospace:none">Here is part of my code:</p><p class="MsoNormal" style="text-autospace:none"> </p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt">std::string message = <span style="color:#A31515">"Resected volume = "</span>;</span></p>
<p class="MsoNormal" style="text-indent:10.5pt"><span style="font-size:10.0pt">message += vtkVariant( vol2/1000 ).ToString();</span><span style="font-size:10.0pt"></span></p><p class="MsoNormal" style="text-indent:10.5pt">
<span style="font-size:10.0pt"></span></p></div></div></blockquote><div><br></div><div>There is currently no way of doing this with vtkVariant. The conversions use the default settings of STL ostringstream and there is currently no API to change them. The string conversions are meant to produce something reasonable for presentation (e.g. for displaying in a UI text box), but not for anything rigorous like serialization. You should go through a more standard technique (e.g. ostringstream) to accomplish this.<br>
</div><div><br></div><div>Jeff</div></div><br>