comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: FG translation and fg getData/setData

FG translation and fg getData/setData
type: item
description: Hi, I'm setting up a system to draw annotation in data space on an image and I've encountered (another!) problem with fg. So here is the (relatively) short story: I draw a square on an image in data space and I handle events a "graphic event handler class". Say I have an object selected, then I want to move this by clicking anywhere on the image and dragging the mouse and releasing. So what I do is: - catch the position of the click in the mouse down event - calculate the difference between current position in the mouse motion event with respect to the last position (eventually given by mouse down event or updated after processing) - translate the object in one of either methods: [Translation method] delta = newPos-PreviousPos self.myObj->tranlsate, delta[0], delta[1] [getData/setData method] delta = newPos-PreviousPos self.myObj->getData, xx, yy xx += delta[0] yy += delta[1] self.myObj->setData, xx, yy Now here are the problems with these two approaches: [Translation method] This works, as long as one does not try to translate in data space. This proved to be tricky because if the object was scaled before, also the translations where scaled. I could not find a consistent pattern to reproduce, so forgive me for just throwing this out like this. However, using the translate method with normal coordinates works well. [getData/setData method] This proved to generate a clear error. The highlighted corners of the square are place elsewhere. Yeah, can't describe this any better, but the good thing, is that it's reproducible and the code is below. After a couple of hours spent trying to figure out what was happening with data coordinates and with the get/set method, I resorted to using normal coordinates with the translation method. However, there is a bug hidden somewhere with the get/set. Below is the code to test. Cheers, Helder Instructions: Run the code below, then click on the edge of the square and move it with the mouse. In my case the result is terrible and obviou…
creator: Helder Marchetto
date: 2015-03-13T16:18:36-00:00