|
I'm playing with morphs but having trouble getting it achieved. I have a set of geo coordinates that form a polygon. Over the polygon I want to lay a grid. The polygon I do with
lineMorph
^ lineMorph ifNil: [
lineMorph := (LineMorph
vertices: self coordinates
color: Color red
borderWidth: 1
borderColor: Color black) ]
The grid I do with
activeGridOn: aMorph
| min max stepHorizontal stepVertical |
min := self coordinates min.
max := self coordinates max.
stepHorizontal := (max x - min x) / 10.
stepVertical := (max y - min y) / 10.
min y to: max y by: stepVertical do: [ :y|
min x to: max x by: (stepHorizontal) do: [ :x | | r |
r := Rectangle
origin: x@y
extent: stepHorizontal@stepVertical.
Transcript show: 'drawing rectangle ', r asString; cr.
aMorph addMorph: (BorderedMorph new
position: (r topLeft);
extent: (r width@r height);
color: Color red;
borderWidth: 1;
borderColor: Color black)
]
]
But I cannot see the rectangles because they are too small. It seems the coordinate systems of the line morph and the added morphs are different. Is there a kind of transform need so that the line morph and an added morph can have the same sized coordinate values?
Norbert
|