Package com.lbslocal.cc.view

Source Code of com.lbslocal.cc.view.CMapRenderAPI

package com.lbslocal.cc.view;

import com.lbslocal.cc.common.Functions;
import com.lbslocal.cc.core.CommonMap;
import com.lbslocal.cc.objects.v0.common.City;
import com.lbslocal.cc.objects.v0.common.Extent;
import com.lbslocal.cc.objects.v0.common.MapInfo;
import com.lbslocal.cc.objects.v0.common.MapOptions;
import com.lbslocal.cc.objects.v0.common.Point;


public class CMapRenderAPI {
  long iniDate;
  CommonMap commonMap;

  // private String _maquina;

  public CMapRenderAPI(String maquina, String server, int port, String output, String dns, String dataSource) {
    // this._maquina = maquina;

    commonMap = new CommonMap(server, port, maquina, output, dns, dataSource);
  }

  public MapInfo getMap(String routeId, Extent extent, MapOptions mo, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    MapInfo mi = new MapInfo();
    try {
      mi = commonMap.getMap(routeId, extent, mo, idLicenca, CommonMap._getMap);

      Functions.gravarLogUnique(idLicenca, CommonMap._getMap, 0, iniDate, 0);
    } catch (Exception e) {
      throw e;
    }

    return mi;
  }

  public MapInfo getPan(String routeId, int direction, double percNavegation, Extent extent, MapOptions mo, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    MapInfo mi = new MapInfo();
    try {
      mi = commonMap.getPan(routeId, direction, percNavegation, extent, mo, idLicenca, CommonMap._getPan);
      Functions.gravarLogUnique(idLicenca, CommonMap._getPan, 0, iniDate, 0);
    } catch (Exception e) {
      throw e;
    }

    return mi;
  }

  public MapInfo getZoom(String routeId, Extent extent, double percZoom, MapOptions mo, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    MapInfo mi = new MapInfo();
    try {
      mi = commonMap.getZoom(routeId, extent, percZoom, mo, idLicenca, CommonMap._getZoom);
      Functions.gravarLogUnique(idLicenca, CommonMap._getZoom, 0, iniDate, 0);
    } catch (Exception e) {
      throw e;
    }

    return mi;
  }

  public MapInfo getZoomRadius(String routeId, Point point, int radius, MapOptions mo, int idLicenca, String mapType) throws Exception {
    iniDate = System.currentTimeMillis();

    MapInfo mi = new MapInfo();
    try {
      mi = commonMap.getZoomRadius(routeId, point, radius, mo, idLicenca, CommonMap._getZoomRadius, mapType);
      Functions.gravarLogUnique(idLicenca, CommonMap._getZoomRadius, 0, iniDate, 0);
    } catch (Exception e) {
      throw e;
    }

    return mi;
  }

  public MapInfo getZoomWindow(String routeId, Extent oldExtent, Extent newExtentInPixels, MapOptions mo, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    MapInfo mi = new MapInfo();
    try {
      mi = commonMap.getZoomWindow(routeId, oldExtent, newExtentInPixels, mo, idLicenca, CommonMap._getZoomWindow);
      Functions.gravarLogUnique(idLicenca, CommonMap._getZoomWindow, 0, iniDate, 0);
    } catch (Exception e) {
      throw e;
    }

    return mi;
  }

  public MapInfo getZoomCity(String routeId, MapOptions mo, City city, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    MapInfo mi = new MapInfo();
    try {
      mi = commonMap.getZoomCity(routeId, mo, city, idLicenca, CommonMap._getZoomCity);
      Functions.gravarLogUnique(idLicenca, CommonMap._getZoomCity, 0, iniDate, 0);
    } catch (Exception e) {
      throw e;
    }

    return mi;
  }

  public MapInfo getZoomState(String routeId, MapOptions mo, String uf, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    MapInfo mi = new MapInfo();
    try {
      mi = commonMap.getZoomState(routeId, mo, uf, idLicenca, CommonMap._getZoomState);
      Functions.gravarLogUnique(idLicenca, CommonMap._getZoomState, 0, iniDate, 0);
    } catch (Exception e) {
      throw e;
    }

    return mi;
  }

  public MapInfo getZoomFullExtent(String routeId, MapOptions mo, int idLicenca) throws Exception {
    iniDate = System.currentTimeMillis();

    MapInfo mi = new MapInfo();
    try {
      MapOptions mapOptions = new MapOptions();
      mapOptions.setMapSize(mo.getMapSize());
      mapOptions.setScaleBar(mo.isScaleBar());

      mi = commonMap.getZoomFullExtent(routeId, mapOptions, idLicenca, CommonMap._getZoomFullExtent);
      Functions.gravarLogUnique(idLicenca, CommonMap._getZoomFullExtent, 0, iniDate, 0);
    } catch (Exception e) {
      throw e;
    }

    return mi;
  }

  public MapInfo getMap(String routeId, Extent extent, MapOptions mo, int idLicenca, String mapType) throws Exception {
    iniDate = System.currentTimeMillis();

    MapInfo mi = new MapInfo();
    try {
      mi = commonMap.getMap(routeId, extent, mo, idLicenca, CommonMap._getMap, mapType);

      Functions.gravarLogUnique(idLicenca, CommonMap._getMap, 0, iniDate, 0);
    } catch (Exception e) {
      throw e;
    }

    return mi;
  }
}
TOP

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

TOP
Copyright © 2018 www.massapi.com. 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.