示例#1
0
 /**
  * 查询需要定位的事故
  *
  * @param obj
  */
 public void spAcc(String time) {
   try {
     Object acc[][] = getAcc("");
     if (acc != null && acc.length != 0) {
       // 定位初始化
       System.out.println("定位初始化!");
       SDEAccess sde = new SDEAccess();
       try {
         pgs = new PointUtil(sde.initConnection(), "LCB_PT");
       } catch (Exception e) {
         loger.error("里程碑图层初始化失败!" + e);
       } finally {
         sde.closeAO();
       }
       // 定位
       for (int i = 0; i < acc.length; i++) {
         addPoint(acc[i]);
       }
     } else {
       System.out.println("查询不到未定位的事故信息!");
     }
   } catch (Exception e) {
     loger.error("事故定位失败!" + e);
   }
   System.out.println("事故定位结束!");
 }
  /** 获得鼠标点击位置附近的道路 */
  public Object[][] getLineByMouse(String point) throws Throwable {

    Object[][] lines = null;
    String strFields = "DLBH,DLMC,SHAPE";

    try {
      LineUtil lineUtil = new LineUtil(sde.initConnection(), roadLayerName);
      lines = lineUtil.getFieldsByPosition(point, "30", strFields);
    } catch (Exception ex) {
      throw new RuntimeException();
    } finally {
      sde.closeAO();
    }

    return lines;
  }