Revision 331:ec0eecbbf58d

View differences:

src/main/java/tt/jointeuclid2ni/probleminstance/VisUtil.java
40 40

  
41 41
public class VisUtil {
42 42
	
43
	private static boolean SHOW_MISSION_NUMBER = false;
43
	private static boolean SHOW_MISSION_NUMBER_START = true;
44
	private static boolean SHOW_MISSION_NUMBER_GOAL = false;
45
	
44 46
    private static final int SINGLE_TRAJECTORY_COLOR_SHIFT = 32;
45 47
    private static int singleTrajectoryColorCounter = 0;
46 48
    
......
213 215
        KeyToggleLayer missionToggle = KeyToggleLayer.create("m");
214 216
        missionToggle.setEnabled(false);
215 217
        
218
        // mission arrows        
219
		missionToggle.addSubLayer(ArrowLayer.create(new LineElements() {
220

  
221
			@Override
222
			public Color getColor() {
223
				return Color.BLUE;
224
			}
225

  
226
			@Override
227
			public int getStrokeWidth() {
228
				return 1;
229
			}
230

  
231
			@Override
232
			public Iterable<? extends cz.agents.alite.vis.element.Line> getLines() {
233
				ArrayList<cz.agents.alite.vis.element.Line> lines = new ArrayList<cz.agents.alite.vis.element.Line>();
234
				for (int i = 0; i < problem.getStarts().length; i++) {
235

  
236
					Point start = problem.getStart(i);
237
					Point end = problem.getTarget(i);
238

  
239
					if (start != null && end != null) {
240
						Point3d startLine = new Point3d(start.x, start.y, 0);
241
						Point3d endLine = new Point3d(end.x, end.y, 0);
242

  
243
						lines.add(new LineImpl(startLine, endLine));
244
					}
245

  
246
				}
247

  
248
				return lines;
249
			}
250
		}));
251
        
216 252
       // starts
217 253
       missionToggle.addSubLayer(LabeledCircleLayer.create(new LabeledCircleLayer.LabeledCircleProvider<tt.euclid2i.Point>() {
218 254

  
......
221 257
                LinkedList<LabeledCircleLayer.LabeledCircle<tt.euclid2i.Point>> list = new LinkedList<LabeledCircleLayer.LabeledCircle<tt.euclid2i.Point>>();
222 258

  
223 259
                for (int i = 0; i < problem.getStarts().length; i++) {
224
                    list.add(new LabeledCircleLayer.LabeledCircle<tt.euclid2i.Point>(problem.getStart(i), problem.getBodyRadius(i), "" + (SHOW_MISSION_NUMBER ? i : "") , Color.BLUE /*AgentColors.getColorForAgent(i)*/));
260
                    list.add(new LabeledCircleLayer.LabeledCircle<tt.euclid2i.Point>(problem.getStart(i), 
261
                    		problem.getBodyRadius(i), "" + (SHOW_MISSION_NUMBER_START ? i : "") , 
262
                    		Color.BLUE /*AgentColors.getColorForAgent(i)*/,
263
                    		Color.WHITE,
264
                    		Color.BLUE));
225 265
                }
226 266

  
227 267
                return list;
......
239 279

  
240 280
                for (int i = 0; i < problem.getStarts().length; i++) {
241 281
                	if (problem.getTarget(i) != null)
242
                		list.add(new LabeledCircleLayer.LabeledCircle<tt.euclid2i.Point>(problem.getTarget(i), problem.getBodyRadius(i), "" + (SHOW_MISSION_NUMBER ? i : ""), Color.BLUE));
282
                		list.add(new LabeledCircleLayer.LabeledCircle<tt.euclid2i.Point>(problem.getTarget(i), problem.getBodyRadius(i), "" + (SHOW_MISSION_NUMBER_GOAL ? i : ""), Color.BLUE));
243 283
                }
244 284

  
245 285
                return list;
......
247 287

  
248 288
        }, new tt.euclid2i.vis.ProjectionTo2d()));
249 289
        
250
        // missions
290

  
251 291
        
252
        missionToggle.addSubLayer(ArrowLayer.create(new LineElements() {
253

  
254
            @Override
255
            public Color getColor() {
256
                return Color.BLUE;
257
            }
258

  
259
            @Override
260
            public int getStrokeWidth() {
261
                return 1;
262
            }
263

  
264
            @Override
265
            public Iterable<? extends cz.agents.alite.vis.element.Line> getLines() {
266
            	ArrayList<cz.agents.alite.vis.element.Line> lines = new ArrayList<cz.agents.alite.vis.element.Line>();
267
                for (int i = 0; i < problem.getStarts().length; i++) {
268
                	
269
                	Point start = problem.getStart(i);
270
                	Point end = problem.getTarget(i);
271
                	
272
                	if (start != null && end != null) {
273
                    	Point3d startLine = new Point3d(start.x, start.y, 0);
274
                    	Point3d endLine = new Point3d(end.x, end.y, 0);
275
                    	
276
                    	lines.add(new LineImpl(startLine, endLine));
277
                	}
278
                		
279

  
280
                }
281
                
282
                return lines;
283
            }
284
        }));
285 292

  
286 293
        VisManager.registerLayer(missionToggle);
287 294
        

Also available in: Unified diff