Print

Print


I pushed past ignorance and fear of the MASON source code :-) , and think I figured out how to fix the problem--although I don’t understand it.

Comparing the drawBorder() methods in ObjectGridPortrayal2D.java and ContinuousPortrayal2D.java (which draws the border correctly), there’s a difference in one line:

ObjectGridPortrayal2D:
d.setRect(info.draw.x, info.draw.y, info.draw.x + info.draw.width, info.draw.y + info.draw.height);

ContrinuousPortrayal2D:
d.setRect(info.draw.x, info.draw.y, info.draw.width, info.draw.height);

Here d is a java.awt.geom.Rectangle2D.Double.

Replacing the ObjectGridPortrayal2D line with the line from ContinuousPortrayal2D causes the border to be drawn correctly using ObjectGridPortrayal2D.  I don’t understand why the original version causes drawBorder to behave as it did, however.

Not sure if I should issue a pull request for this change.  SparseGridPortrayal2D and ValueGridPortrayal have the same version of the d.setRect line in drawBorder() as ObjectGridPortrayal2D has.  I could change those two source files, too, but I wouldn’t want to do a pull request for them without testing them, and I don’t believe I’m going to have time for that.

Marshall

On Dec 20, 2016, at 10:23 AM, Marshall <[log in to unmask]> wrote:

Thanks for asking, Stewart.  It doesn’t make any difference whether I setBorder for snipe-field-portrayal, mushroom-field-portrayal, or both.  In all three cases I get left and top borders that seem to extend infinitely down and right.  Shrinking the scale leaves the appearance of the “borders" unchanged, although the insides of the field portryals eventually become too small to see.

There’s a pure Java illustration here (with one portrayal only): https://github.com/mars0i/masonborder/tree/master/students

I’m also exploring hexagonal portrayals, which don’t asupport setBorder, and having a border isn’t crucial in any case, but it’s kind of a nice addition if it’s available.

Marshall


On Dec 20, 2016, at 3:46 AM, Stewart Aitken <[log in to unmask]> wrote:

Hi,

Can I ask, what happens if you only set the border for either the snipe or the mushroom instead of setting them both?

Regards,

Stewart.

On 18 December 2016 at 18:42, Marshall <[log in to unmask]> wrote:
Hi everyone,

I’m displaying an ObjectGrid2D using an ObjectGridPortrayal2D.  I tried turning on the border with setBorder(true), and what I’m getting is a upper border line that extends infinitely to the right, and a left border line that extends infinitely down, but no right or bottom border lines.  I can see where the right and bottom borders should go because I can see where the agents are present/not present.  If I turn on grid lines, they show where the grid portrayal ends as well.  Looked through the manual and the classdocs for something I’m not doing, etc., but haven’t yet found anything.  I poked around a little bit in the MASON source for ObjectGridPortral2D, FieldPortrayal2D, and DrawInfo2D, but nothing jumped out at me as an explanation or as a possible bug, but I don’t understand the code very well.

Any ideas about why this would be happening?

Thanks-

Marshall

Marshall Abrams, Associate Professor
Department of Philosophy, University of Alabama at Birmingham
Email: [log in to unmask]; Cell: 205-222-3442
Website: http://members.logical.net/~marshall



--