Article View: comp.windows.interviews
Article #1513Re: Problems programming a small graph-editor
From: Haiying Wang
Date: Sat, 22 Jun 1991 19:31
Date: Sat, 22 Jun 1991 19:31
36 lines
2415 bytes
2415 bytes
In article <1991Jun19.172322.27647@forwiss.uni-passau.de> fraus@forwiss.uni-passau.de (Uli Fraus) writes:
...
But I have to two nasty problems:
- Second: If I click inside the GraphicBlock to set a new node, the node
appears about 2 inch left and up of the click-point. BUT if I click on a
node for moving (function from graphics) it work quite well. So I think
I have a problem with relative and absolute coordinates.
I had this problem before.
A picture object's state is concatenated with the state of its
components when it is drawn. That is when the picture is draw each
component's transformer is postmultiplied by the picture's
transformer. When you pick a point from a picture object, its
coordinates has been transfomed the picture's transformer. If you use
this coordinates as a reference point to create another graphical
object and append this graphical object to the picture, this graphical
object will be transformed by the picture transformer again when the
picture is drawn. This is the reason that the new component is in the
wrong place. I have used two methods to avoid this problem:
a) Before you append the new graphical object to the picture, call
Picture::Propagate() method. This method concatenates each component's
state with the picture's own state (modifying each component's transformer
by postmultiplying the picture's transformer). The picture's
transformer is set to nil;
b) Before you use the coordinate of the picked point, get the
picture's transformer (GetTransformer) and undo the transform on the
coordinate (Transformer::InvTransform()).
I perfer the second one which keeps the picture's transformer.
Haiying Wang
University of Alberta
haiying@cs.ualberta.ca
Technical Details
Message-ID:
<HAIYING.91Jun22123102@menaik.scapa>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!lll-winken!aunro!alberta!scapa!haiyingReferences:
<1991Jun19.172322.27647@forwiss.uni-passau.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!lll-winken!aunro!alberta!scapa!haiying From: haiying@menaik.scapa (Haiying Wang) Newsgroups: comp.windows.interviews Subject: Re: Problems programming a small graph-editor Message-ID: <HAIYING.91Jun22123102@menaik.scapa> Date: 22 Jun 91 19:31:02 GMT References: <1991Jun19.172322.27647@forwiss.uni-passau.de> Sender: news@cs.UAlberta.CA (News Administrator) Followup-To: comp.windows.interviews Organization: University of Alberta, Edmonton, Canada Lines: 36 In-Reply-To: fraus@forwiss.uni-passau.de's message of 19 Jun 91 17: 23:22 GMT