ARX TIN网入口函数

来源:百度文库 编辑:神马文学网 时间:2024/04/30 23:16:45
static void arxDelaunaytin(void)
 {
  // Add your code for command arxDelaunay.tin here
  CADOConn *con=new CADOConn();
  CString server=L"钱家营矿";
  con->OnInitADOConn(server);
  ACHAR aMine[20];
  int rt;
book: rt=acedGetString(0,L"煤层",aMine); 
  if (rt==RTNONE)
  {
   goto book;
  }
  CString strMine=aMine;
  CString strSql=L"SELECT ZBX,ZBY,DBBG FROM MCZH where DBBG<0 and MCDM='"+strMine+L"' and zbx is not null and zby is not null and dbbg is not null and ID not in(select a.ID from MCZH as a,MCZH as b where a.ID<>b.ID and a.ZBX=b.ZBX and a.ZBY=b.ZBY)";
  _bstr_t bStrql=strSql;
  //con->ExecuteSQL(bStrql,server);
  _RecordsetPtr recordset=con->GetRecordSet(bStrql,server);
  CDelaunayTIN *pDelaunay=new CDelaunayTIN();
  pDelaunay->CreateTIN(recordset);
  pDelaunay->DeleteRepeatTri();
  pDelaunay->FillEdgeInfo();
   pDelaunay->OptimizeDelaunayTIN();
//   for (int i=1;pDelaunay->EdgeArray[i].flag==true;i++)
//   {
//    if ((int)pDelaunay->EdgeArray[i].triNo.size()>=3)
//    {
//     CString str;
//     str.Format(L"%d",(int)pDelaunay->EdgeArray[i].triNo.size());
//     AfxMessageBox(str);
//    }
//   }
//   pDelaunay->FillEdgeInfo();
//   for (int i=1;i<=pDelaunay->HowMany;i++)
//   {
//    AcGePoint3dArray ptArray;
//    ptArray=CCreateEnts::TriangleTo3Point(pDelaunay,i);
//    CCreateEnts::CreateLine(ptArray[0],ptArray[1]);
//    CCreateEnts::CreateLine(ptArray[0],ptArray[2]);
//    CCreateEnts::CreateLine(ptArray[2],ptArray[1]); 
//   }
  for (int i=1;pDelaunay->EdgeArray[i].flag==true;i++)
  {
   AcGePoint3dArray ptArray;
   ptArray=CCreateEnts::LineTo2Point(pDelaunay,i);
   CCreateEnts::CreateLine(ptArray[0],ptArray[1]);
  }
  acedCommand(RTSTR,L"zoom",RTSTR,L"E",RTNONE);
 }