The default trail for MASON has a width of 0.5f. However you could make a new trail. Here is one that is 0.1f: public class MyTrail extends SimpleEdgePortrayal2D { BasicStroke stroke = new BasicStroke(0.1f, /// NOTE HERE!!!!! BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); public void draw(Object object, Graphics2D graphics, DrawInfo2D info) { info.precise = true; // force non-awt graphics float linewidth = stroke.getLineWidth(); if (linewidth * 2 != info.draw.width) stroke = new BasicStroke((float)(info.draw.width / 2), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); graphics.setStroke(stroke); TrailedPortrayal.TrailDrawInfo2D t = (TrailedPortrayal.TrailDrawInfo2D) info; toPaint = fromPaint = defaultMap.getColor(t.value); super.draw(object, graphics, info); } } You could use it like this: new TrailedPortrayal(....., new MyTrail(), ...); Sean On Jun 6, 2016, at 2:26 PM, Giovanni Reina <[log in to unmask]> wrote: > Hi, > > I recently upgraded my Mason from version 1.6 to v.1.9. > > My previous code seems to work fine except for one thing. > Now when I visualise the agent's trail, it is very thick! > My agents are only 0.5 big and the trail has the same 0.5 size. > > I tried to change the trail width without success. > Someone knows how is it possible to change that? > > > I paste here the relevant code of my GUI class: > > public class SpatialCaseStudyWithUI extends GUIState { > > ...... > ContinuousPortrayal2D trailsPortrayal = new ContinuousPortrayal2D(); > > public SimplePortrayal2D makeAgent(){ > return new TrailedPortrayal2D( > this, > new OrientedPortrayal2D( new SimplePortrayal2D(), 0, 0.5, new Color(255, 0, 0), > OrientedPortrayal2D.SHAPE_COMPASS){ > public void draw(Object object, Graphics2D graphics, DrawInfo2D info){ > MyState myState =((SpatialAgent)object).commitmentState; > paint = (myState == MyState.UNCOMMITTED)? new Color(255, 255, 255) : (myState == MyState.OPTION_1)? new Color(150, 0, 0) : new Color(0, 100, 0) ; > super.draw(object, graphics, info); > } > }, trailsPortrayal, 100); > > } > > > public void setupPortrayals() { > ..... > trailsPortrayal.setField( currentState.arena ); > arenaPortrayal.setField( currentState.arena ); > for(int x=0; x < currentState.arena.allObjects.numObjs; x++) { > SimplePortrayal2D p = makeAgent(); > arenaPortrayal.setPortrayalForObject(currentState.arena.allObjects.objs[x], new MovablePortrayal2D(p)); > trailsPortrayal.setPortrayalForObject(currentState.arena.allObjects.objs[x], p); > } > ..... > } > > > > > > I tried to modify the draw method by adding (before the super.draw) this code: > > BasicStroke stroke = new BasicStroke(0.1f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); > graphics.setStroke(stroke); > > but it didn't help. > > Any advice is welcome. > Thanks, > Giovanni > > > -- > Andreagiovanni Reina > Research Associate in Collective Robotics > University of Sheffield, UK > http://areina.staff.shef.ac.uk