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

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


      CommonRoute r = new CommonRoute(_maquina, _server, _port, _output, _dns, _dataSource, _dataSourceMapa);
      rpi = r.getRouteWithMap(idLicenca, CommonRoute._getRouteWithMap, rs, routeOptions, mo);

      ri.setMapInfo(new MapInfo());
      ri.getMapInfo().setExtent(new Extent());
      ri.getMapInfo().getExtent().setXMax(rpi.getMapInfo().getExtent().getXMax());
      ri.getMapInfo().getExtent().setXMin(rpi.getMapInfo().getExtent().getXMin());
      ri.getMapInfo().getExtent().setYMax(rpi.getMapInfo().getExtent().getYMax());
      ri.getMapInfo().getExtent().setYMin(rpi.getMapInfo().getExtent().getYMin());
      ri.getMapInfo().setUrl(rpi.getMapInfo().getUrl());
View Full Code Here


        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";
View Full Code Here

    line = new LinePoint[coords.split(";").length];

    // l� inversamente caso necess�rio
    if (!blnInverse) {
      for (i = 0; i < line.length; i++) {
        line[i] = new LinePoint();
        line[i].setPoint(new Point());
        line[i].getPoint().setX(Double.parseDouble(coords.split(";")[i].split(" ")[0].toString()));
        line[i].getPoint().setY(Double.parseDouble(coords.split(";")[i].split(" ")[1].toString()));
      }
    } else {
      for (i = line.length - 1; i > -1; i--) {
        line[z] = new LinePoint();
        line[z].setPoint(new Point());
        line[z].getPoint().setX(Double.parseDouble(coords.split(";")[i].split(" ")[0].toString()));
        line[z].getPoint().setY(Double.parseDouble(coords.split(";")[i].split(" ")[1].toString()));
        z++;
      }
View Full Code Here

      ri.setRouteId(routeID);

      // ri.setProximityList(getRouteProximity(response, ro.radius,
      // idLicenca, ro.routeDetails.getRouteType()));

      MapInfo mapInfo = new MapInfo();
      mapInfo.setUrl("");

      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("%"));

      mapInfo.setExtent(new Extent());
      mapInfo.getExtent().setXMax(Double.parseDouble(XMaxYMax.split(Pattern.quote(","))[1]));
      mapInfo.getExtent().setXMin(Double.parseDouble(XMinYMin.split(Pattern.quote(","))[1]));
      mapInfo.getExtent().setYMax(Double.parseDouble(XMaxYMax.split(Pattern.quote(","))[0]));
      mapInfo.getExtent().setYMin(Double.parseDouble(XMinYMin.split(Pattern.quote(","))[0]));

      ri.setMapInfo(mapInfo);
      ri.setSegDescription(getSegmentDescriptionAlternative(response, ro.getVehicle().getTollFeeCat(), ro, rs, _dataSource, idLicenca));
      ri.setRouteTotals(getTotals(ri.getSegDescription(), ro, rs, totalPedagios));
      ri.setRoadType(getRoadType(ri.getSegDescription()));
View Full Code Here

      } 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

TOP

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

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.