[vtkusers] vtkDistanceWidget unit conversion

Alex Malyushytsky malyushytsky at gmail.com
Tue Mar 17 21:13:33 EDT 2015


I did it by subclassing vtkDistanceRepresentation2D and then setting
presentation to vtkDistanceWidget.

I can't provide complete code since it was written for commercial product,
but
can tell how:

-  add member to store scale factor there (set it to 1 by default);

- override vtkDistanceRepresentation2D::BuildRepresentation()

- do in there everything exactly the way original code did ( look at source
code )

- before call to this->AxisActor->SetTitle(string) provide to sprint scaled
distance value instead of original

 sprintf(string, this->LabelFormat, scaledDistance );


Regards,

   Alex



On Mon, Mar 16, 2015 at 7:58 PM, Barry Hathaway <bhathaw1 at nycap.rr.com>
wrote:

> I'm using vtkDistanceWidget and was wondering if it is possible to scale
> the distance measurement that is displayed
> in the label by a factor of 1000 - basically I want to measurement
> displayed in mm rather than meters.
> Also, is it possible to augment the label with the distance in only the Z
> direction?
> Thanks in advance.
>
> Barry Hathaway
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150317/e9913fcd/attachment.html>


More information about the vtkusers mailing list