Package com.lbslocal.cc.view

Examples of com.lbslocal.cc.view.CMapRenderAPI


     
      int id_licenca = Integer.parseInt(cm.getAppSettings("ID"));
     

     
      CMapRenderAPI cMr = new CMapRenderAPI(
          cm.getAppSettings("MAQUINA"),
          cm.getAppSettings("SERVER"),
          11188,
          cm.getAppSettings("PATH_FILE_IMAGES"),
          cm.getAppSettings("WEBOUTPUT"),
          cm.getAppSettings("M_BASEDECARTA_MAPAS"));
     
      CommonRest cr = new CommonRest();
     
      PostHelper ph = cr.getDataFromPost(request);
     
      String strLicenca = cr.getFieldFromXML(ph.XMLFile, "token");
      try {
        id_licenca = Integer.parseInt(strLicenca);
      } 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();
        }
View Full Code Here


  public static String runService(Proxy proxy, TokenValidated tk) throws Exception {
    Object[] o;
    MapInfo mInfo;
    String respostaWs = "";
    ConfigurationManager cm = ConfigurationManager.getInstance();
    CMapRenderAPI mapRender = new CMapRenderAPI(cm.getAppSettings("Maquina"), cm.getAppSettings("Server"), 11188, cm.getAppSettings("dirOutPut"),
        cm.getAppSettings("webOutPut"), cm.getAppSettings("M_BASEDECARTA_MAPAS"));

    switch (getService(proxy.GetService())) {
    case getMap:
      o = Common.getArrayByJSon(proxy.getParameters("tjss"), new Class[] { String.class, Extent.class, MapOptions.class });
      mInfo = mapRender.getMap((String) o[0], (Extent) o[1], (MapOptions) o[2], tk.getId());
      respostaWs = Common.SerializeJSObject(mInfo);
      break;
    case getZoom:
      o = Common.getArrayByJSon(proxy.getParameters("tjss"), new Class[] { String.class, Extent.class, Double.class, MapOptions.class });
      mInfo = mapRender.getZoom((String) o[0], (Extent) o[1], (Double) o[2], (MapOptions) o[3], tk.getId());
      respostaWs = Common.SerializeJSObject(mInfo);
      break;
    case getPan:
      o = Common.getArrayByJSon(proxy.getParameters("tjss"), new Class[] { String.class, Integer.class, Double.class, Extent.class,
          MapOptions.class });
      double trans = ((Integer) o[2] * 1);
      mInfo = mapRender.getPan((String) o[0], (Integer) o[1], trans, (Extent) o[3], (MapOptions) o[4], tk.getId());
      respostaWs = Common.SerializeJSObject(mInfo);
      break;
    case getZoomRadius:
      o = Common.getArrayByJSon(proxy.getParameters("tjss"), new Class[] { String.class, Point.class, Integer.class, MapOptions.class });
      mInfo = mapRender.getZoomRadius((String) o[0], (Point) o[1], (Integer) o[2], (MapOptions) o[3], tk.getId(), "png");
      respostaWs = Common.SerializeJSObject(mInfo);
      break;
    case getZoomWindow:
      o = Common.getArrayByJSon(proxy.getParameters("tjss"), new Class[] { String.class, Extent.class, Extent.class, MapOptions.class });
      mInfo = mapRender.getZoomWindow((String) o[0], (Extent) o[1], (Extent) o[2], (MapOptions) o[3], tk.getId());
      respostaWs = Common.SerializeJSObject(mInfo);
      break;
    case getZoomState:
      o = Common.getArrayByJSon(proxy.getParameters("tjss"), new Class[] { String.class, MapOptions.class, String.class });
      mInfo = mapRender.getZoomState((String) o[0], (MapOptions) o[1], (String) o[2], tk.getId());
      respostaWs = Common.SerializeJSObject(mInfo);
      break;
    case getZoomCity:
      o = Common.getArrayByJSon(proxy.getParameters("tjss"), new Class[] { String.class, MapOptions.class, City.class });
      mInfo = mapRender.getZoomCity((String) o[0], (MapOptions) o[1], (City) o[2], tk.getId());
      respostaWs = Common.SerializeJSObject(mInfo);
      break;
    }
    return respostaWs;
  }
View Full Code Here

TOP

Related Classes of com.lbslocal.cc.view.CMapRenderAPI

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.