Package org.worldbank.transport.tamt.shared

Examples of org.worldbank.transport.tamt.shared.RoadDetails


            polylineHash.put(p.getRoadDetailsId(), p);
            polyline.setText(p.getRoadDetailsId());
            String n = "";
            for (Iterator iterator = roadDetailsList.iterator(); iterator
              .hasNext();) {
            RoadDetails roadDetails = (RoadDetails) iterator.next();
            if(roadDetails.getId().equals(currentPolyline.getRoadDetailsId()))
            {
              n = roadDetails.getName();
            }
          }
            vertices.setText("Current polyline in RoadListing=" + n);
           
            String roadName = Window.prompt("Name this road", "");
            if( roadName == null)
            {
              eventBus.fireEvent(new CancelRoadEvent(p.getRoadDetailsId()));
              //refreshRoadDetails = true;
              //fetchRoadDetails();
             
            } else {
              name.setText(roadName);
              description.setText("");
            }
           
          }
    });
   
    eventBus.addHandler(GetRoadsEvent.TYPE,
      new GetRoadsEventHandler() {
          public void onGetRoads(GetRoadsEvent event) {
            clearRoadEditView();
            // TODO: remove force reload after testing is complete
            refreshRoadDetails = true;
            fetchRoadDetails();
            }
    });   
   
   
    eventBus.addHandler(SentUpdatedPolylineEvent.TYPE,
      new SentUpdatedPolylineEventHandler() {
          public void onSentUpdatedPolyline(SentUpdatedPolylineEvent event) {
            currentPolyline = event.tagPolyline;
            //Window.alert("SentUpdatedPolylineEvent id=" + currentPolyline.getRoadDetailsId());
            //saveRoadDetails();
            }
    })
   
    eventBus.addHandler(DebugEvent.TYPE,
      new DebugEventHandler() {
          public void onDebug(DebugEvent event) {
            GWT.log("DEBUG ========================= BEGIN DEBUG EVENT IN ROADLISTING ===============");
            GWT.log("DEBUG RoadListing: polylineHash keys=" + polylineHash.keySet());
            GWT.log("DEBUG RoadListing: currentPolyline=" + currentPolyline);
           
            }
    })
   
    eventBus.addHandler(EditRoadDetailsBySegmentEvent.TYPE,
      new EditRoadDetailsBySegmentEventHandler() {
        @Override
        public void onEditRoadDetailsBySegment(EditRoadDetailsBySegmentEvent event) {
          String id = event.getId();
          //GWT.log("EDIT road details id=" + id);
          if( id == null )
          {
            clearRoadEditView();
            return;
          }
          // find the roadDetails with this id in
          for (Iterator iterator = roadDetailsList.iterator(); iterator
              .hasNext();) {
            RoadDetails roadDetails = (RoadDetails) iterator.next();
            //GWT.log("EDIT road details loop, working on id=" + roadDetails.getId());
            if( roadDetails.getId().equals(id))
            {
              loadRoadDetails(roadDetails);
              break;
            }
          }
View Full Code Here


 
  private void saveRoadDetails(final boolean refresh) {
   
    //refreshRoadDetails = true;
   
    RoadDetails roadDetails = new RoadDetails();
    roadDetails.setName(name.getText());
    roadDetails.setDescription(description.getText());
    roadDetails.setId(currentRoadDetailId);
    roadDetails.setRegion(currentStudyRegion);
   
    /*
     * Take tag field from suggest box, look up the tagID
     */
    String selectedTag = tagSuggestBox.getText();
    for (Iterator iterator = tagDetailsList.iterator(); iterator.hasNext();) {
      TagDetails tagDetails = (TagDetails) iterator.next();
      if( tagDetails.getName().equals(selectedTag))
      {
        roadDetails.setTagId(tagDetails.getId());
        break;
      }
    }
    GWT.log("selectedTag("+selectedTag+"), tagId("+roadDetails.getTagId()+")");
   
    /*
     * Polyline can't RPC, so we need to convert the vertices
     * to Vertex, and store in the RoadDetails
     */
    ArrayList<Vertex> vertices = new ArrayList<Vertex>();
    try {
     
      /*
       * If we have are trying to save without first drawing
       * a line (and thereby created a temp ID, then set
       * the currentPolyline to null to prevent the last
       * rendered polyline in TagMap from being duplicated
       * as this road's new shape
       */
      //Window.alert("currentRoadDetailId=" + currentRoadDetailId);
      if( currentRoadDetailId == null)
      {
        currentPolyline = null;
      }
      //Window.alert("currentPolyline=" + currentPolyline);
     
      vertices = polylineToVertexArrayList(currentPolyline);
      //Window.alert("vertex count=" + vertices.size());
     
      roadDetails.setVertices(vertices);
     
      roadService.saveRoadDetails(roadDetails, new AsyncCallback<RoadDetails>() {

        @Override
        public void onFailure(Throwable caught) {
View Full Code Here

        checkboxes.clear();
        uncheckMasterCheckBox();
       
        for (int i = 0; i < roadDetailsList.size(); i++) {
        final int count = i;
      final RoadDetails roadDetails = roadDetailsList.get(i);
     
      // stick the vertices for this roadDetail in the vertexHash
      vertexHash.put(roadDetails.getId(), roadDetails.getVertices());
     
      GWT.log(roadDetails.getName());
     
      CheckBox cb = new CheckBox();
      cb.setFormValue(roadDetails.getId()); //store the id in the checkbox value
      checkboxes.add(cb); // keep track for selecting all|none to delete
      cb.setStyleName(style.checkbox());
      // if a checkbox is checked, deselect the master checkbox
      cb.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          uncheckMasterCheckBox();
        }
      });
      Label name = new Label(roadDetails.getName());
      name.setStyleName(style.roadList());
      name.addStyleName(style.clickable());
      name.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
View Full Code Here

    polyline.setText(roadDetails.getId());
   
    String n = "";
    for (Iterator iterator = roadDetailsList.iterator(); iterator
        .hasNext();) {
      RoadDetails rd = (RoadDetails) iterator.next();
      if(rd.getId().equals(currentPolyline.getRoadDetailsId()))
      {
        n = rd.getName();
      }
    }
    vertices.setText("Current polyline in RoadListing=" + n);
   
    // i don't think this is current
View Full Code Here

     
      // delete roads
      ArrayList<RoadDetails> roads = roadDAO.getRoadDetails(region);
      ArrayList<String> roadIds = new ArrayList<String>();
      for (Iterator iterator = roads.iterator(); iterator.hasNext();) {
        RoadDetails road = (RoadDetails) iterator.next();
        roadIds.add(road.getId());
      }
      logger.debug("Deleting roads for study region: " + studyRegionId);
      roadDAO.deleteRoadDetails(roadIds);
     
      // delete tag
View Full Code Here

            // convert a linestring to a JTS geometry
            WKTReader reader = new WKTReader();
            Geometry geometry = reader.read(lineString);
            Point centroidJTS = geometry.getCentroid();
           
            RoadDetails roadDetails = new RoadDetails();
            roadDetails.setId(id);
            roadDetails.setName(name);
            roadDetails.setDescription(description);
            roadDetails.setTagId(tagId);
           
            // now convert the geometry to an ArrayList<Vertex> and
            // set in the roadDetails
            ArrayList<Vertex> vertices = Utils.geometryToVertexArrayList(geometry);
            roadDetails.setVertices(vertices);
           
            // convert the centroid point into a Vertex
            Vertex centroid = new Vertex();
            centroid.setLat(centroidJTS.getY());
            centroid.setLng(centroidJTS.getX());
            roadDetails.setCentroid(centroid);
           
            //TODO: Do we need to include the study region name, description here?
            StudyRegion sr = new StudyRegion();
            sr.setId(regionId);
           
View Full Code Here

  {
    ArrayList<RoadDetails> roadDetails = new ArrayList<RoadDetails>();
    int sample = 10;
    for (int i = 0; i < sample; i++) {
      UUID id = UUID.randomUUID();
      RoadDetails t = new RoadDetails();
      t.setName("Name-" + id.toString());
      t.setDescription("Desc-"+id.toString());
      roadDetails.add(t);
    }
    return roadDetails;
  }
View Full Code Here

TOP

Related Classes of org.worldbank.transport.tamt.shared.RoadDetails

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.