Package org.worldbank.transport.tamt.shared

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


   
    int vertexCount = vertices.size();
    //TODO: handle null vertices
    Coordinate[] coords = new Coordinate[vertexCount];
    for (int i = 0; i < vertexCount; i++) {
      Vertex v = vertices.get(i);
      Coordinate c = new Coordinate(v.getLng(), v.getLat());
      coords[i] = c;
    }
   
    // now create a line string from the coordinates array where null = no holes in the polygon
    LinearRing ring = new GeometryFactory().createLinearRing(coords);
View Full Code Here


    ArrayList<Vertex> vertices = new ArrayList<Vertex>();
    if( polyline != null)
    {
      for (int i = 0; i < polyline.getVertexCount(); i++) {
        LatLng latLng = polyline.getVertex(i);
        Vertex v = new Vertex();
        v.setLat(latLng.getLatitude());
        v.setLng(latLng.getLongitude());
        vertices.add(v);
      }
    } else {
      throw new Exception("Please draw a road before saving road details");
    }
View Full Code Here

   
    int vertexCount = vertices.size();
    //TODO: handle null vertices
    Coordinate[] coords = new Coordinate[vertexCount];
    for (int i = 0; i < vertexCount; i++) {
      Vertex v = vertices.get(i);
      Coordinate c = new Coordinate(v.getLng(), v.getLat());
      coords[i] = c;
    }
   
    // now create a line string from the coordinates array where null = no holes in the polygon
    LinearRing ring = new GeometryFactory().createLinearRing(coords);
    Geometry geometry = new GeometryFactory().createPolygon(ring, null);
   
    // create a point from the mapCenter vertex
    // TODO: mapCenter is null when creating a new study region.
    Vertex mapCenterVertex = studyRegion.getMapCenter();
    logger.debug("mapCenter=" + studyRegion.getMapCenter());
    Coordinate mapCenterCoord = new Coordinate(mapCenterVertex.getLng(), mapCenterVertex.getLat());
    Geometry mapCenter = new GeometryFactory().createPoint(mapCenterCoord);
   
    StudyRegion savedStudyRegion = null;
   
    try {
View Full Code Here

          {
            LatLng center = event.center;
            int mapZoomLevel = event.zoomLevel;
           
            // convert LatLng to Vertex
            Vertex mapCenter = new Vertex();
            mapCenter.setLat(center.getLatitude());
            mapCenter.setLng(center.getLongitude());
           
            studyRegion.setMapCenter(mapCenter);
            studyRegion.setMapZoomLevel(mapZoomLevel);
           
            GWT.log("DUPE Study region now has map view:" + studyRegion);
View Full Code Here

    ArrayList<Vertex> vertices = new ArrayList<Vertex>();
    if( polygon != null)
    {
      for (int i = 0; i < polygon.getVertexCount(); i++) {
        LatLng latLng = polygon.getVertex(i);
        Vertex v = new Vertex();
        v.setLat(latLng.getLatitude());
        v.setLng(latLng.getLongitude());
        vertices.add(v);
      }
    } else {
      throw new Exception("Please draw a study region on the map before trying to save");
    }
View Full Code Here

 
  public void loadRegionDetails(StudyRegion studyRegion)
  {
    // send a message to RegionMap to set the associated polygon to editable
    String id = studyRegion.getId();
    Vertex v = studyRegion.getMapCenter();
    LatLng center = LatLng.newInstance(v.getLat(), v.getLng());
    int zoomLevel = studyRegion.getMapZoomLevel();
   
    eventBus.fireEvent(new EditRegionSegmentEvent(id, center, zoomLevel));
   
    name.setText(studyRegion.getName());
View Full Code Here

    ArrayList<Vertex> vertices = new ArrayList<Vertex>();
    Coordinate[] coords = geometry.getCoordinates();
    for (int i = 0; i < coords.length; i++) {
      Coordinate c = coords[i];
      //logger.debug("coordinate=" + c);
      Vertex v = new Vertex();
      v.setLat(c.y);
      v.setLng(c.x);
      //logger.debug("vertex=" + v);
      vertices.add(v);
    }
    return vertices;
  }
View Full Code Here

        if( mapFirstLoad )
        {
          currentStudyRegion = event.studyRegion;
          if( currentStudyRegion != null )
          {
            Vertex v = currentStudyRegion.getMapCenter();
            final LatLng center = LatLng.newInstance(v.getLat(), v.getLng());
           
            // do this as a deferred command
                  DeferredCommand.addCommand(new Command() {
                      public void execute() {
                        GWT.log("RegionMap - (on first load only) update to current study region" + currentStudyRegion);
View Full Code Here

              final RegionPolygon p = new RegionPolygon(points);
              p.setRegionDetailsId(currentPolygon.getRegionDetailsId());
             
              // add a mapCenter and mapZoomLevel to the polygon
              LatLng center = event.getSender().getBounds().getCenter();
              Vertex mapCenter = new Vertex();
              mapCenter.setLat(center.getLatitude());
              mapCenter.setLng(center.getLongitude());
              int mapZoomLevel = map.getZoomLevel();
              p.setMapCenter(mapCenter);
              p.setMapZoomLevel(mapZoomLevel);
             
              eventBus.fireEvent(new EndEditRegionPolygonEvent(p));
View Full Code Here

    if( vertices != null)
    {
      LatLng[] points = new LatLng[vertices.size()];
      int count = 0;
      for (Iterator iterator = vertices.iterator(); iterator.hasNext();) {
        Vertex v = (Vertex) iterator.next();
        LatLng p = LatLng.newInstance(v.getLat(), v.getLng());
        points[count] = p;
        count++;
      }
      final RegionPolygon polygon = new RegionPolygon(points, polygonColor, weight, opacity, polygonColor, opacity);
      polygon.setRegionDetailsId(zoneDetailsId);
View Full Code Here

TOP

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

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.