Package org.onebusaway.api.model.transit.tripplanning

Examples of org.onebusaway.api.model.transit.tripplanning.GraphResultV2Bean


    BeanFactoryV2 factory = getBeanFactoryV2();
    ItineraryV2BeanFactory itineraryFactory = new ItineraryV2BeanFactory(
        factory);

    GraphResultV2Bean bean = itineraryFactory.getGraphResult(vertices.getList());
    return setOkResponse(factory.entry(bean));
  }
View Full Code Here


    return bean;
  }

  public GraphResultV2Bean getGraphResult(List<VertexBean> list) {

    GraphResultV2Bean result = new GraphResultV2Bean();

    List<VertexV2Bean> vertices = new ArrayList<VertexV2Bean>();

    for (VertexBean vertex : list) {
      VertexV2Bean bean = new VertexV2Bean();
      bean.setId(vertex.getId());
      bean.setLocation(vertex.getLocation());

      Map<String, String> tags = getTags(vertex.getTags());

      bean.setTags(tags);
      vertices.add(bean);
    }

    if (!vertices.isEmpty())
      result.setVertices(vertices);

    List<EdgeV2Bean> edges = new ArrayList<EdgeV2Bean>();

    for (VertexBean vertex : list) {
      List<EdgeNarrativeBean> out = vertex.getOutgoing();
      if (out != null) {
        for (EdgeNarrativeBean narrative : out) {
          EdgeV2Bean bean = new EdgeV2Bean();
          bean.setFromId(narrative.getFrom().getId());
          bean.setToId(narrative.getTo().getId());
          bean.setName(narrative.getName());
          bean.setPath(narrative.getPath());
          Map<String, String> tags = getTags(narrative.getTags());
          bean.setTags(tags);

          edges.add(bean);
        }
      }
    }

    if (!edges.isEmpty())
      result.setEdges(edges);

    return result;
  }
View Full Code Here

TOP

Related Classes of org.onebusaway.api.model.transit.tripplanning.GraphResultV2Bean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.