@Activate
  void activate() throws Exception {
    try {
      track = new Tracks<>(ti.getSegments().values(), new LayoutAdapter());
      track.getRoot().get().layout(0, 0, null);
      for (SegmentHandler<Layout> sh : track.getHandlers()) {
        sh.get().adjustWidth();
      }
      positions =
          Collections.unmodifiableMap(
              track
                  .getHandlers()
                  .stream()
                  .map(sh -> sh.get().getPosition())
                  .collect(Collectors.toMap(p -> ((SegmentPosition) p).segment.id, p -> p)));

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 public void assign(String train, String segment) {
   security();
   ti.assign(train, segment);
   ;
 }
 public List<String> getTrains() {
   security();
   return ti.getTrains();
 }
 public Map<String, Segment> getSegments() {
   security();
   return ti.getSegments();
 }