kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #31961
Re: All kinds of glitches because polygons don't have an origin. Also: Outline ?
On 25 November 2017 at 07:01, Wayne Stambaugh <stambaughw@xxxxxxxxx> wrote:
> I though Tom mentioned he had done some work on this but that may have
> been some other board editing tool.
So I looked a little more into it, it looks like this is mostly
because the GetStart()/GetPosition() etc. return (0,0) for S_POLYGON
in class DRAWSEGMENT. Many parts that handle drawsegments assume these
to have reasonable values. It happens to draw correctly when drawn the
first time, but rotating or moving does not result in a properly
placed polygon.
Things to do:
* SetStart()/GetStart()/SetPosition()/GetPostion() should return
something reasonable; That way, rotation would have a proper anchor
point.
* DRAWSEGMENT::Move() should iterate through m_Poly to move each point.
* something strange: in PCB_PAINTER::draw( const DRAWSEGMENT*
aSegment, int aLayer ), there is a strange
m_gal->Translate( aSegment->GetPosition() )
which right now is a no-op, but once GetPosition() returns
something proper, this won't change.
These are too many moving parts to digg into while Thanksgiving family
stuff is going on in the background :) But someone more familiar with
the code might use the above as a starting point for debugging.
It looks like this became fragile because class DRAWSEGMENT is trying
to do too much: it can represent a line, a polyogn, an arc, a bezier
coruve; each of these have slightly different interpretations of what
m_Start/m_End means, which makes things a little fragile. Might be
worthwhile looking into this this more detailed after the release; I
am happy to help with this once I got myself more into the code base
again after a 2 year hiatus.
Anyway, maybe it might be a good idea to disable the polygon drawing
button in pcbnew before the imminent release until that is fixed ? It
might just be frustrating to users.
[ The artifacts show up similarly in Ciaro and OpenGL. To reproduce:
draw a polygon. Select it and attempt to move or rotate. Observe how
they seem to 'disappear', but this is only because they are moved
around the imaginary position (0,0). ]
Cheers,
Henner.
>
> On 11/25/2017 08:28 AM, Henner Zeller wrote:
>> Is someone working on this bug or should I have a stab at it ?
>>
>> On 20 November 2017 at 21:26, Henner Zeller <h.zeller@xxxxxxx> wrote:
>>> Hi,
>>> I am playing with polygons currently and notice that they only really
>>> can be created, but not moved or copied.
>>>
>>> A move (m) creates a phantom polygon on the screen that is offset from
>>> the polygon the same distance as the original polygon from the origin.
>>> A similar glitch happens when attempting to copy a polygon.
>>>
>>> This indicates that the polygon does not really have a position that
>>> is rooted in the e.g. top-left point, but that its Position is always
>>> kept at (0,0).
>>> This is confirmed when reading the board with the Python API and
>>> printing GetPosition().
>>>
>>> The dialog for the polygon (edit dialog) also shows that all positions
>>> Start (x,y) and End (x,y) are zero.
>>>
>>> I think the whole confusion comes because the original idea of a draw
>>> segment has the concept of a line which has a clear start/endpoint. So
>>> maybe some SetStart() needs to be done whenever a polygon is moved ?
>>>
>>> I wonder if the concept of Polygons and Zones can be merged: both of
>>> them allow to fill an area in the layer and have the same editing
>>> controls with the control points (and zones work).
>>>
>>> -h
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help : https://help.launchpad.net/ListHelp
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
References