<div dir="ltr">Thankyou all for your comments and input.<div><br></div><div style>Setting colors by name is needed in many classes scattered across several modules, namely:</div><div style>vtkLookupTable in module CommonCore</div>
<div style>vtkPrpperty, vtkRenderer, vtkTextProperty in module RenderingCore</div><div style>vtkPlot in module ChartsCore,</div><div style>vtkPen in module RenderingContext2D,</div><div style>using vtkNamedColor in module CommonCoreColor.</div>
<div style>All these classes inherit from vtkObject so it is logical to create virtual functions in vtkObject to facilitate the use of vtkNamedColors to set colors by name.</div><div style><br></div><div style>I agree with David in that we need some kind of SetProperty in vtkObject to get around module dependencies. It certainly looks like that in vtkPlot.h the authors were leaning towards this idea in that:</div>
<div style><div>virtual void SetProperty (const vtkStdString &property, const vtkVariant &var);</div><div>virtual vtkVariant  GetProperty (const vtkStdString &property);</div><div style>are defined.</div><div style>
One question here David is that in the signature you propose:</div><div style><span style="font-family:arial,sans-serif;font-size:13px">    virtual void SetProperty(</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">        const std::string& property, int component, const vtkVariant&);</span><br style="font-family:arial,sans-serif;font-size:13px">I am not sure what the int component is meant to refer to.</div>
<div style><br></div><div style>Pat, I like your idea better than mine, I think the coding is simpler so I will look at doing something along these lines. I was too focussed on vtkNamedColors in my proposal. I would also like to see some sort of dynamic property despatching, so any comments on how to implement this would be appreciated.</div>
<div style><br></div><div style>One other question: Why not just use vtkVariantArray as I did in SetProperty1 - it is simple to parse?</div><div style><br></div><div style>Thanks once again for all your comments.</div><div style>
<br></div><div style>Andrew</div><div style><br></div><div style><br></div></div><div style></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jun 15, 2013 at 2:21 AM, Pat Marion <span dir="ltr"><<a href="mailto:pat.marion@kitware.com" target="_blank">pat.marion@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>The set color by name api in the example looks like:<br><br><table><tbody><tr valign="top">
<td><br></td><td><span>nc</span><span>.</span><span>SetColor</span><span>(</span><span>sphereActor</span><span>.</span><span>GetProperty</span><span>(),</span><span>"AmbientColor"</span><span>,</span><span>"Yellow"</span><span>)</span></td>


</tr></tbody></table><br></div>Perhaps an API like this instead:<br><br></div>sphereActor.GetProperty().SetAmbientColor(nc.GetColor("Yellow"))<br><br></div><br></div>I think that if the goal is to have dynamic properties in VTK's C++ api, it should be automated using the mechanism that is used for Python, client-server, Java, etc.  In the patch up for gerrit review, the dynamic property dispatch is manually implemented inside the SetProperty1() virtual function overload, which doesn't seem scalable.<br>


<br><br>Pat<br><div><div><br><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Fri, Jun 14, 2013 at 12:15 PM, David Thompson <span dir="ltr"><<a href="mailto:david.thompson@kitware.com" target="_blank">david.thompson@kitware.com</a>></span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">Hi John,<br>
<div><br>
> Modifying vtkObject just so that you can set colours in Lookuptables strikes me as shockingly bad.<br>
<br>
</div>I think that there is a general need for an abstract interface to set properties; setting colors just happens to be driving the change. For example, vtkPlot already has a similar method as do the statistics filters (vtkStatisticsAlgorithm::SetParameter). We are just talking about moving these down to vtkObject in order to allow the functionality elsewhere and get around some module dependency issues.<br>



<br>
I am obviously in favor of adding something, although I would rather see a single method with this signature:<br>
<br>
    virtual void SetProperty(<br>
        const std::string& property, int component, const vtkVariant&);<br>
<br>
There is no reason vtkPlot cannot keep its alternate signature (as a deprecated method).<br>
<br>
        David<br></div></div>
_______________________________________________<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>
</blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>___________________________________________<br>Andrew J. P. Maclean<br><br>___________________________________________
</div>