package cn.map.szmap;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

@SuppressWarnings("all")
public class LayerConstant{
	private static Log logger = LogFactory.getLog(LayerConstant.class);
	public static final Long LAYER_TYPE_MONITOR = 1L;// 摄像机图层
	public static final Long LAYER_TYPE_MONITORLOCATION = 2L;// 车辆卡口图层
	public static final Long LAYER_TYPE_CHEGPS = 3L;// 车载球GPS图层
	public static final Long LAYER_TYPE_ELECTRICFENCE = 4L;// 电子围栏图层
	private static Map<String,Integer> layerMap = new HashMap<String,Integer>();

	public static Map<String,Integer> getAllCacheLayer(){
		
		if(layerMap.size() >0) return layerMap;
		
		Field[] fields = LayerConstant.class.getDeclaredFields();
			
		for(Field field : fields){
			field.setAccessible(true);
			String filedname = field.getName();
			if(filedname.startsWith("LAYER_TYPE_")){
				try {
					layerMap.put(filedname ,Integer.getInteger(field.get(LayerConstant.class).toString()));
				} catch (Exception e) {
					logger.error("地图模块:"+filedname +",添加到缓存池失败！" + e);
					e.printStackTrace();
					continue;
				}
			}
		}
		return layerMap;
	}
	
	 
	
}
