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

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


      } catch (Exception e) {
      }
     
      if (ph.fields[0].equals("getZoomRadius"))
      {
        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";
        }
       
        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";
       
        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
        {
          mi = cMr.getMap(routeId, extent, 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) + "");
      }
     
View Full Code Here


    if (mo.getMapSize().getWidth() <= 0 || mo.getMapSize().getWidth() <= 0) {
      mo.getMapSize().setHeight(1);
      mo.getMapSize().setWidth(1);
    }

    MapInfo mi = new MapInfo();
    String response = "";
    String fileName = "";

    try {
      try {
       
       
        Calendar lCDateTime = Calendar.getInstance();
        fileName = _maquina + "_" + lCDateTime.getTimeInMillis() + "." + mapType;

        StringBuilder sb = new StringBuilder("IMAG|");
       
        if (mapType.equals("png")){
          if (!"".equals(routeId) || mo.isShowPoint())
            sb.append("%PNGCOLORS=24%FORMAT=PNG");
          else
            sb.append("%PNGCOLORS=8%FORMAT=PNG");
        }else if (mapType.equals("gif"))
          sb.append("%FORMAT=GIF");
        else if (mapType.equals("jpg"))
          sb.append("%FORMAT=JPG");
       
        sb.append("%LLMAX=");
        sb.append(String.valueOf(extent.getYMax()).replace(',', '.') + "," + String.valueOf(extent.getXMax()).replace(',', '.'));
        sb.append("%LLMIN=");
        sb.append(String.valueOf(extent.getYMin()).replace(',', '.') + "," + String.valueOf(extent.getXMin()).replace(',', '.'));
        sb.append("%PD=");
        sb.append(String.valueOf(mo.getMapSize().getWidth()) + "," + String.valueOf(mo.getMapSize().getHeight()));
        sb.append("%FN=");

        sb.append(_output + File.separator + fileName);

        sb.append("|%CUST=" + idLicenca + ":" + methodID + "%TIMEOUT=50000%DS=" + _dataSource.replace("_livemaps", ""));
        sb.append("%LLMAX%LLMIN");

        if (_dataSource.toLowerCase().contains("lbslocal_rodoviaria"))
          sb.append("%SETTINGS=MAPLINK_ROD||");
        else {
          if (_dataSource.toLowerCase().contains("livemaps"))
            sb.append("%SETTINGS=LIVEMAPS-TILE||");
          else
            sb.append("%SETTINGS=MAPLINK||");
        }

        try {
          response = tcpDecarta.Send(sb.toString());
        } catch (Exception ex) {
          throw (new Exception("Falha chamada deCarta"));
        }

        if (!(response.indexOf("=ERROR") > 0)) {
          //IMAG|%LLMIN=-23.553799257,-46.644085595%N=0%S=OK%LLMAX=-23.544086747,-46.633550405||
         
          String XMaxYMax = response.substring(response.indexOf("LLMAX=") + 6); //.substring(0, response.substring(response.indexOf("LLMAX=") + 6).indexOf(Pattern.quote("|")));
          XMaxYMax = XMaxYMax.substring(0, XMaxYMax.indexOf("|"));
          String XMinYMin = response.substring(response.indexOf("LLMIN=") + 6); //.substring(0, response.substring(response.indexOf("LLMIN=") + 6).indexOf(Pattern.quote("%")));
          XMinYMin = XMinYMin.substring(0, XMinYMin.indexOf("%"));
          Extent miEx = new Extent();

          miEx.setXMax(Double.parseDouble(XMaxYMax.split(",")[1].replace(",", ".")));
          miEx.setXMin(Double.parseDouble(XMinYMin.split(",")[1].replace(",", ".")));
          miEx.setYMax(Double.parseDouble(XMaxYMax.split(",")[0].replace(",", ".")));
          miEx.setYMin(Double.parseDouble(XMinYMin.split(",")[0].replace(",", ".")));

          mi.setExtent(miEx);

        } else {
          throw (new Exception("Falha ao gerar mapa"));
        }
      } catch (Exception ex) {
        throw (new Exception("Falha ao gerar mapa" + ex.getMessage()));
      }

      // inserir rota
      if (!"".equals(routeId)) {
        fileName = insertRoute(routeId, routeResponse, mi.getExtent(), mo.getMapSize(), mi, idLicenca, _output + File.separator  + fileName, mapType);
        fileName = fileName.substring(fileName.lastIndexOf(File.separator)+1);
      }

      // inserir icones
      if (mo.isShowPoint()) {
        fileName = insertPointsInMap(mo, mi, _output + File.separator + fileName, mapType);
        fileName = fileName.substring(fileName.lastIndexOf(File.separator)+1);
      }
     
      mi.setUrl(_dns + fileName);
    } catch (Exception ex) {
      Utils.LogError("CC","renderMap - IdWebservice : Interno", ex.getMessage() + "|" + ex.getStackTrace() + " - EXTENT : YMIN = "
          + extent.getYMin() + " | YMAX = " + extent.getYMax() + " | XMIN = " + extent.getXMin() + " | XMAX = " + extent.getXMax()
          + " - MAPSIZE : W = " + mo.getMapSize().getWidth() + " | H = " + mo.getMapSize().getHeight());
View Full Code Here

      percNavegation *= -1; // deve ser positivo

    if (percNavegation > 10)
      percNavegation = 1;

    MapInfo mi = new MapInfo();
    try {
      extent = doPan(extent, direction, percNavegation);
      mi = renderMap(routeId, "", extent, mo, idLicenca, methodID);
    } catch (Exception ex) {
      throw (new Exception("getPan: Falha ao navegar no mapa. "));
View Full Code Here

    }
    return mi;
  }

  public MapInfo getZoom(String routeId, Extent extent, double percZoom, MapOptions mo, int idLicenca, int methodID) throws Exception {
    MapInfo mi = new MapInfo();

    try {
      /*** Gerar o zoom da imagem ***/
      Extent extTmp = Functions.doZoom(extent, percZoom);
      mi = renderMap(routeId, "", extTmp, mo, idLicenca, methodID);
View Full Code Here

    }
    return mi;
  }

  public MapInfo getZoomRadius(String routeId, Point point, int radius, MapOptions mo, int idLicenca, int methodID, String mapType) throws Exception {
    MapInfo mi = new MapInfo();

    try {
      // Envelope env = new EnvelopeClass();
      Extent ext = Functions.CalcRadius(radius, point);
      mi = renderMap(routeId, "", ext, mo, idLicenca, methodID, mapType);
View Full Code Here

      throw (ex);
    }
  }

  public MapInfo getZoomRadius(String routeId, String routeResponse, Extent extent, MapOptions mo, int idLicenca, int methodID) throws Exception {
    MapInfo mi = new MapInfo();

    try {
      // Envelope env = new EnvelopeClass();
      Extent ext = extent;
View Full Code Here

    return mi;
  }

  public MapInfo getZoomWindow(String routeId, Extent oldExtent, Extent newExtentInPixels, MapOptions mo, int idLicenca, int methodID)
      throws Exception {
    MapInfo mi = new MapInfo();

    try {
      Extent newExtent = getNewExtent(oldExtent, newExtentInPixels, mo.getMapSize());
      mi = renderMap(routeId, "", newExtent, mo, idLicenca, methodID);
View Full Code Here

    }
    return mi;
  }

  public MapInfo getZoomCity(String routeId, MapOptions mo, City city, int idLicenca, int methodID) throws Exception {
    MapInfo mi = new MapInfo();

    // *** validar se a cidade foi informada ***//*
    if (city.getName() == null || city.getName().compareTo("") == 0) {
      throw (new Exception("getZoomCity: Cidade n�o foi informada. "));
    }

    // *** for�ar em letras maiusculas ***//*
    city.setName(city.getName().toUpperCase());
    String uf = city.getState().toUpperCase();

    // *** validar se a uf foi informada ***//*
    String codUf = Functions.retornaCodUf(uf);

    if (codUf.compareTo("") == 0)
      throw (new Exception("getZoomCity: Uf informado � inv�lido (" + uf + "). Cidade informada: " + city.getName()));

    try {
      mi.setExtent(getExtentCitySQL(city, idLicenca));

      // gerar mapa com base no extent retornado
      mi = renderMap(routeId, "", mi.getExtent(), mo, idLicenca, methodID);
    } catch (Exception ex) {
      Utils.LogError("CC","getZoomCity- IdWebservice : 6", "city.name-> " + city.getName() + " | " + "city.state -> " + city.getState()
          + " | " + ex.getMessage() + "|" + ex.getStackTrace());

      throw (new Exception("getZoomCity: Falha ao gerar o zoom da cidade informada (" + city.getName() + "-" + city.getState() + ")."));
View Full Code Here

    // *** validar se a uf foi informada ***//*
    if (uf.compareTo("") == 0) {
      throw (new Exception("getZoomCity: Uf deve ser informada."));
    }

    MapInfo mi = new MapInfo();

    try {
      mi.setExtent(getExtentStateSQL(uf, idLicenca, "Brasil"));

      // gerar mapa com base no extent retornado
      mi = renderMap(routeId, "", mi.getExtent(), mo, idLicenca, methodID);
    } catch (Exception ex) {
      Utils.LogError("CC","getZoomState- IdWebservice : 4", "estado -> " + uf + " | " + ex.getMessage() + "|" + ex.getStackTrace());

      throw (new Exception("getZoomState: Falha ao gerar o zoom do estado informado: " + ex.getMessage()));
    }
View Full Code Here

    }
    return mi;
  }

  public MapInfo getZoomFullExtent(String routeId, MapOptions mo, int idLicenca, int methodID) throws Exception {
    MapInfo mi = new MapInfo();

    try {
      Point point = new Point(-62.9569009522848, -21.3320991286825);

      Extent ext = Functions.CalcRadius(3800045, point);
View Full Code Here

TOP

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

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.