Package com.lbslocal.cc.objects.v0.common

Examples of com.lbslocal.cc.objects.v0.common.Point


    /* retornar ponto encontrado */
    return point;
  }

  public MapInfo getXYRadiusWithMap(Address address, MapOptions mo, int radius, int idLicenca, int methodID) throws Exception {
    MapInfo mi = new MapInfo();
    try {
      /*
       * chama webMethod getXY para saber a coordenada do endere�o
       * informado
       */
 
View Full Code Here


        response.setCharacterEncoding("UTF-8");
       
        ObjectsHelper[] dependencyObjects = new ObjectsHelper[6];
       
        dependencyObjects[0] = cr.new ObjectsHelper();
        dependencyObjects[0].object = new MapInfo();
        dependencyObjects[0].alias = "MapInfo";
       
        dependencyObjects[1] = cr.new ObjectsHelper();
        dependencyObjects[1].object = new SegmentDescription();
        dependencyObjects[1].alias = "SegmentDescription";
View Full Code Here

       
        mapOptionsDependencyObjects[3] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[3].object = new Point();
        mapOptionsDependencyObjects[3].alias = "point";
 
        MapOptions mo = (MapOptions) cr.getObjectFromXML(ph.XMLFile, "mo", MapOptions.class, mapOptionsDependencyObjects);
       
        String routeId = cr.getFieldFromXML(ph.XMLFile, "routeId");
        int radius = Integer.valueOf(cr.getFieldFromXML(ph.XMLFile, "radius"));
       
        try
        {
          mi = cMr.getZoomRadius(routeId, point, radius, mo, id_licenca, mapType);
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
       
        response.setContentType("text/xml");
        response.setCharacterEncoding("UTF-8");
       
        ObjectsHelper[] dependencyObjects = new ObjectsHelper[2];
       
        dependencyObjects[0] = cr.new ObjectsHelper();
        dependencyObjects[0].object = new Extent();
        dependencyObjects[0].alias = "extent";
       
        dependencyObjects[1] = cr.new ObjectsHelper();
        dependencyObjects[1].object = new MapInfo();
        dependencyObjects[1].alias = "MapInfo";

        response.getWriter().write("<?xml version='1.0' encoding='UTF-8'?>\n" + cr.getXMLFromObject(mi, dependencyObjects) + "");
      }
      if (ph.fields[0].equals("getMap"))
      {
        MapInfo mi = new MapInfo();
       
        String mapType = cr.getFieldFromXML(ph.XMLFile, "maptype");
       
        if (!mapType.toLowerCase().equals("gif") && !mapType.toLowerCase().equals("png") && !mapType.toLowerCase().equals("jpg") ){
          mapType = "png";
        }
       
        Extent extent = (Extent) cr.getObjectFromXML(ph.XMLFile, "extent", Extent.class, null);
       
        ObjectsHelper[] mapOptionsDependencyObjects = new ObjectsHelper[4];
       
        mapOptionsDependencyObjects[0] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[0].object = new MapSize();
        mapOptionsDependencyObjects[0].alias = "mapSize";
       
        mapOptionsDependencyObjects[1] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[1].object = new Icon[0];
        mapOptionsDependencyObjects[1].alias = "icon";
       
        mapOptionsDependencyObjects[2] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[2].object = new Icon();
        mapOptionsDependencyObjects[2].alias = "Icon";
       
        mapOptionsDependencyObjects[3] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[3].object = new Point();
        mapOptionsDependencyObjects[3].alias = "point";
 
        MapOptions mo = (MapOptions) cr.getObjectFromXML(ph.XMLFile, "mo", MapOptions.class, mapOptionsDependencyObjects);
       
        String routeId = cr.getFieldFromXML(ph.XMLFile, "routeId");

       
        try
View Full Code Here

    String routeID = _maquina + "_" + Calendar.getInstance().getTimeInMillis();

    try {

      response = requestRoute(routeID, true, rs, ro, new Extent(), new MapSize(), null, idLicenca, _dataSource, methodID);

      ri.setRouteId(routeID);

      // ri.setProximityList(getRouteProximity(response, ro.radius,
      // idLicenca, ro.routeDetails.getRouteType()));
View Full Code Here

    SegmentDescription[] segRet = new SegmentDescription[0];

    String routeID = _maquina + "_" + Calendar.getInstance().getTimeInMillis();

    try {
      response = requestRoute(routeID, true, rs, ro, ext, new MapSize(), null, idLicenca, _dataSource, methodID);
      segRet = getSegmentDescriptionAlternative(response, ro.getVehicle().getTollFeeCat(), ro, rs, _dataSource, idLicenca);
    } catch (Exception ex) {
      Utils.LogError("CC", "getRouteWithMap - IdWebservice : Interno ", ex.getMessage() + "|" + ex.getStackTrace());

      throw (ex);
View Full Code Here

  }

  public RouteTotals getRouteTotals(int idLicenca, RouteStop[] rs, RouteProximityOptions ro, int methodID) throws Exception {
    String barriersRoute = "";

    String response = requestRoute("", false, rs, ro, new Extent(), new MapSize(), barriersRoute, idLicenca, _dataSource, methodID);

    SegmentDescription[] segDescription = getSegmentDescriptionAlternative(response, ro.getVehicle().getTollFeeCat(), ro, rs, _dataSource,
        idLicenca);
    RouteTotals rt = getTotals(segDescription, ro, rs, totalPedagios);
View Full Code Here

  }

  public RouteSummary[] getRouteSummary(int idLicenca, RouteStop[] rs, RouteProximityOptions ro, int methodID) throws Exception {
    String barriersRoute = "";

    String response = requestRoute("", false, rs, ro, new Extent(), new MapSize(), barriersRoute, idLicenca, _dataSource, methodID);

    SegmentDescription[] segDescription = getSegmentDescriptionAlternative(response, ro.getVehicle().getTollFeeCat(), ro, rs, _dataSource,
        idLicenca);
    RouteSummary[] routeSummary = getSummary(segDescription, rs, ro);
View Full Code Here

        Point point = (Point) cr.getObjectFromXML(ph.XMLFile, "point", Point.class, null);
       
        ObjectsHelper[] mapOptionsDependencyObjects = new ObjectsHelper[4];
       
        mapOptionsDependencyObjects[0] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[0].object = new MapSize();
        mapOptionsDependencyObjects[0].alias = "mapSize";
       
        mapOptionsDependencyObjects[1] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[1].object = new Icon[0];
        mapOptionsDependencyObjects[1].alias = "icon";
       
        mapOptionsDependencyObjects[2] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[2].object = new Icon();
        mapOptionsDependencyObjects[2].alias = "Icon";
       
        mapOptionsDependencyObjects[3] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[3].object = new Point();
        mapOptionsDependencyObjects[3].alias = "point";
 
        MapOptions mo = (MapOptions) cr.getObjectFromXML(ph.XMLFile, "mo", MapOptions.class, mapOptionsDependencyObjects);
       
        String routeId = cr.getFieldFromXML(ph.XMLFile, "routeId");
        int radius = Integer.valueOf(cr.getFieldFromXML(ph.XMLFile, "radius"));
       
        try
        {
          mi = cMr.getZoomRadius(routeId, point, radius, mo, id_licenca, mapType);
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
       
        response.setContentType("text/xml");
        response.setCharacterEncoding("UTF-8");
       
        ObjectsHelper[] dependencyObjects = new ObjectsHelper[2];
       
        dependencyObjects[0] = cr.new ObjectsHelper();
        dependencyObjects[0].object = new Extent();
        dependencyObjects[0].alias = "extent";
       
        dependencyObjects[1] = cr.new ObjectsHelper();
        dependencyObjects[1].object = new MapInfo();
        dependencyObjects[1].alias = "MapInfo";

        response.getWriter().write("<?xml version='1.0' encoding='UTF-8'?>\n" + cr.getXMLFromObject(mi, dependencyObjects) + "");
      }
      if (ph.fields[0].equals("getMap"))
      {
        MapInfo mi = new MapInfo();
       
        String mapType = cr.getFieldFromXML(ph.XMLFile, "maptype");
       
        if (!mapType.toLowerCase().equals("gif") && !mapType.toLowerCase().equals("png") && !mapType.toLowerCase().equals("jpg") ){
          mapType = "png";
        }
       
        Extent extent = (Extent) cr.getObjectFromXML(ph.XMLFile, "extent", Extent.class, null);
       
        ObjectsHelper[] mapOptionsDependencyObjects = new ObjectsHelper[4];
       
        mapOptionsDependencyObjects[0] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[0].object = new MapSize();
        mapOptionsDependencyObjects[0].alias = "mapSize";
       
        mapOptionsDependencyObjects[1] = cr.new ObjectsHelper();
        mapOptionsDependencyObjects[1].object = new Icon[0];
        mapOptionsDependencyObjects[1].alias = "icon";
View Full Code Here

  public Point getRoadXY(Road road, int idLicenca) throws Exception {
    int iCount = 0, roadNumber = 0;

    Point pt = new Point();
    Pagination pg;

    boolean hasState = (road.getCity().getState() != null && road.getCity().getState().compareTo("") != 0);

    if (!hasState) {
      throw (new Exception("O estado deve ser informado."));
    }

    if (Functions.IsNullOrEmpty(road.getCity().getCountry()))
      road.getCity().setCountry("Brasil");

    try {
      // transformar valores null em "" para n�o dar null pointer
      // exception
      if (road.getName() == null)
        road.setName("");
      if (road.getRoadNumber() == null)
        road.setRoadNumber("");
      if (road.getCity().getName() == null)
        road.getCity().setName("");
      if (road.getCity().getState() == null)
        road.getCity().setState("");
      if (road.getZip() == null)
        road.setZip("");

      // validando n�mero
      if (!road.getRoadNumber().equals("")) {
        if (Functions.isNumeric(road.getRoadNumber().replace(".", "").replace(",", "").replace("-", "").replace("e", "")))
          roadNumber = Integer.parseInt(road.getRoadNumber());
      }
      if (roadNumber == 0)
        road.setRoadNumber("");
      else
        road.setRoadNumber(String.valueOf(roadNumber));

      // se o valor de endere�o, cidade e estado for em branco erro
      // se cepe o cep forem em brancos da a mensagem de erro
      if (road.getZip() == "")
        if ((road.getName() == "") && ((road.getCity().getName() == "") || (road.getCity().getState() == "")))
          throw (new Exception(
              "Os atributos address.street, city.name e city.state devem ser informados quando o atributo address.zip nao e informado."));

      if (road.getZip().length() == 8)
        road.setZip(road.getZip().substring(0, 5) + "-" + road.getZip().substring(5, 8));

      Connection con = dataBase.getConnection(Functions.getDataBase(idLicenca, "Brasil").getSource());

      CallableStatement cst = con.prepareCall("{call cp_WS_KM(?,?,?,?,?)}");
      cst.setString(1, road.getRoadNumber());
      cst.setString(2, road.getName());
      cst.setString(3, road.getCity().getName());
      cst.setString(4, road.getCity().getState());
      cst.setString(5, road.getZip());

      cst.execute();

      ResultSet rs1 = cst.getResultSet();

      CachedRowSetImpl crs = new CachedRowSetImpl();
      crs.populate(rs1);

      int TotalRecords = crs.size();

      if (TotalRecords > 0) {
        try {
          pg = Functions.definePage(TotalRecords, 1, 0);
          // RoadLocation[] rl;

          if (pg.getRecordsInitial() <= TotalRecords) {
            // rl = new RoadLocation[(pg.getRecordsFinal() -
            // pg.getRecordsInitial()) + 1];

            for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
              if (rs1.absolute(intI)) {
                pt.setX(Double.parseDouble(rs1.getString("X")));
                pt.setY(Double.parseDouble(rs1.getString("Y")));

                iCount++;
View Full Code Here

    }
  }

  public POIInfo findPOI(String name, City city, ResultRange resultRange, int idLicenca) throws Exception {
    POIInfo poii = new POIInfo();
    Pagination pg;

    int iCount = 0;

    String country;

    if (!Functions.IsNullOrEmpty(city.getCountry()))
      country = city.getCountry();
    else
      country = "BRASIL";

    if (!country.toUpperCase().equals("BRASIL"))
      return poii;

    boolean hasState = (city.getState() != null && city.getState().compareTo("") != 0);

    boolean hasCity = (city.getName() != null && city.getName().compareTo("") != 0);

    if (!hasCity || !hasState) {
      throw (new Exception("Cidade e estado devem ser informados."));
    }

    try {
      Connection con = dataBase.getConnection(Functions.getDataBase(idLicenca, country).getSource());

      CallableStatement cst = con.prepareCall("{call CP_WS_TB_POI_BRASIL(?,?,?)}");
      cst.setString(1, name);
      cst.setString(2, city.getName());
      cst.setString(3, city.getState());

      cst.execute();

      ResultSet rs1 = cst.getResultSet();

      CachedRowSetImpl crs = new CachedRowSetImpl();
      crs.populate(rs1);

      int TotalRecords = crs.size();

      if (TotalRecords > 0) {
        pg = Functions.definePage(TotalRecords, resultRange.getRecordsPerPage(), resultRange.getPageIndex());

        POILocation[] poil;

        if (pg.getRecordsInitial() <= TotalRecords) {
          poil = new POILocation[(pg.getRecordsFinal() - pg.getRecordsInitial()) + 1];

          for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
            if (rs1.absolute(intI)) {
              poil[iCount] = new POILocation();
              poil[iCount].setName(rs1.getString("NOME"));
              poil[iCount].setDistrict(rs1.getString("BAIRRO"));
              poil[iCount].setCarAccess(rs1.getBoolean("ROTAPE"));

              poil[iCount].setPoint(new Point());
              poil[iCount].getPoint().setX(Double.parseDouble(rs1.getString("X")));
              poil[iCount].getPoint().setY(Double.parseDouble(rs1.getString("Y")));

              poil[iCount].setCity(new City());
              poil[iCount].setCity(city);
              poil[iCount].setDataSource(city.getState().toUpperCase());

              iCount++;
            }
          }
        } else {
          poil = new POILocation[0];
        }

        poii.setRecordCount((int) pg.getRecordCount());
        poii.setPageCount(pg.getPageCount());
        poii.setPoiLocations(poil);
      } else {
        poii.setPoiLocations(new POILocation[0]);
      }
View Full Code Here

TOP

Related Classes of com.lbslocal.cc.objects.v0.common.Point

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.