XiMapUtilF.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "XiMapUtilF.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. //---------------------------------------------------------------------------
  8. //TXiMapUtil *XiMapUtil = NULL;
  9. //---------------------------------------------------------------------------
  10. TXiMapUtil::TXiMapUtil(TXiClient *AXiClient)
  11. {
  12. FXiClient = AXiClient;
  13. }
  14. //---------------------------------------------------------------------------
  15. TXiMapUtil::~TXiMapUtil()
  16. {
  17. }
  18. //---------------------------------------------------------------------------
  19. void TXiMapUtil::MovePoint(double AdX, double AdY, double AdValue)
  20. {
  21. if (!FXiClient)
  22. return;
  23. FXiClient->Start(DDRect(AdX - AdValue,
  24. AdX + AdValue,
  25. AdY - AdValue,
  26. AdY + AdValue));
  27. }
  28. //---------------------------------------------------------------------------
  29. void TXiMapUtil::MoveLink(String ALinkId)
  30. {
  31. TItsLink *pLink = ItsLinkManager->FLists.Find(ALinkId);
  32. MoveLink(pLink);
  33. }
  34. //---------------------------------------------------------------------------
  35. void TXiMapUtil::MoveLink(TItsLink *ALink)
  36. {
  37. FXiClient->ClearPathInfo();
  38. if (!ALink) return;
  39. TArrInt vObjIDxs;
  40. TDDPoints pts;
  41. TDDRect objmbr;
  42. TDDLineStyle Linestyle;
  43. TStringList *Linkids = new TStringList();
  44. int nLayerIndex = FXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV7.dvf");
  45. if (nLayerIndex < 0) return;
  46. Linkids->Add(ALink->LINK_ID);
  47. Linkids->Add(ALink->LINK_ID);
  48. TDDRect DDRect_Move;
  49. DDRect_Move.MinX = 200;
  50. DDRect_Move.MaxX = 0;
  51. DDRect_Move.MinY = 50;
  52. DDRect_Move.MaxY = 0;
  53. try
  54. {
  55. if (FXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
  56. {
  57. for(int i = 0; i < vObjIDxs.High; i++)
  58. {
  59. pts = FXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);
  60. if (vObjIDxs[i] == -1)
  61. continue;
  62. Linestyle.PenWidth = 4;
  63. Linestyle.PenColor = clPurple;
  64. Linestyle.OutLineType = true;
  65. Linestyle.ArrowType = false;
  66. FXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);
  67. if (DDRect_Move.MinX > objmbr.MinX)
  68. DDRect_Move.MinX = objmbr.MinX;
  69. if (DDRect_Move.MaxX < objmbr.MaxX)
  70. DDRect_Move.MaxX = objmbr.MaxX;
  71. if (DDRect_Move.MinY > objmbr.MinY)
  72. DDRect_Move.MinY = objmbr.MinY;
  73. if (DDRect_Move.MaxY < objmbr.MaxY)
  74. DDRect_Move.MaxY = objmbr.MaxY;
  75. }
  76. DDRect_Move.MinX -= 0.002;
  77. DDRect_Move.MaxX += 0.002;
  78. DDRect_Move.MinY -= 0.002;
  79. DDRect_Move.MaxY += 0.002;
  80. FXiClient->ExtentDraw(DDRect_Move);
  81. }
  82. }
  83. catch(...)
  84. {
  85. }
  86. delete Linkids;
  87. FXiClient->ReDraw();
  88. }
  89. //---------------------------------------------------------------------------
  90. void TXiMapUtil::MoveServiceLink(String AServiceLinkId)
  91. {
  92. TItsServiceLink *ServiceLink = ItsServiceLinkManager->FLists.Find(AServiceLinkId);
  93. MoveServiceLink(ServiceLink);
  94. }
  95. //---------------------------------------------------------------------------
  96. void TXiMapUtil::MoveServiceLink(TItsServiceLink *AServiceLink)
  97. {
  98. FXiClient->ClearPathInfo();
  99. if (!AServiceLink)
  100. return;
  101. TArrInt vObjIDxs;
  102. TDDPoints pts;
  103. TDDRect objmbr;
  104. TDDLineStyle Linestyle;
  105. TStringList *Linkids = new TStringList();
  106. int nLayerIndex = FXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV6.dvf");
  107. if (nLayerIndex < 0) return;
  108. Linkids->Add(AServiceLink->IFSC_ID);
  109. Linkids->Add(AServiceLink->IFSC_ID);
  110. TDDRect DDRect_Move;
  111. DDRect_Move.MinX = 200;
  112. DDRect_Move.MaxX = 0;
  113. DDRect_Move.MinY = 50;
  114. DDRect_Move.MaxY = 0;
  115. try
  116. {
  117. if (FXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
  118. {
  119. for(int i = 0; i < vObjIDxs.High; i++)
  120. {
  121. pts = FXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);
  122. if (vObjIDxs[i] == -1)
  123. continue;
  124. Linestyle.PenWidth = 4;
  125. Linestyle.PenColor = clPurple;
  126. Linestyle.OutLineType = true;
  127. Linestyle.ArrowType = false;
  128. FXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);
  129. if (DDRect_Move.MinX > objmbr.MinX)
  130. DDRect_Move.MinX = objmbr.MinX;
  131. if (DDRect_Move.MaxX < objmbr.MaxX)
  132. DDRect_Move.MaxX = objmbr.MaxX;
  133. if (DDRect_Move.MinY > objmbr.MinY)
  134. DDRect_Move.MinY = objmbr.MinY;
  135. if (DDRect_Move.MaxY < objmbr.MaxY)
  136. DDRect_Move.MaxY = objmbr.MaxY;
  137. }
  138. DDRect_Move.MinX -= 0.002;
  139. DDRect_Move.MaxX += 0.002;
  140. DDRect_Move.MinY -= 0.002;
  141. DDRect_Move.MaxY += 0.002;
  142. FXiClient->ExtentDraw(DDRect_Move);
  143. }
  144. }
  145. catch(...)
  146. {
  147. }
  148. delete Linkids;
  149. FXiClient->ReDraw();
  150. }
  151. //---------------------------------------------------------------------------
  152. void TXiMapUtil::MoveRoad(String ARoadId)
  153. {
  154. TItsRoad *pRoad = ItsRoadManager->FLists.Find(ARoadId);
  155. MoveRoad(pRoad);
  156. }
  157. //---------------------------------------------------------------------------
  158. void TXiMapUtil::MoveRoad(TItsRoad *ARoad)
  159. {
  160. FXiClient->ClearPathInfo();
  161. if (!ARoad)
  162. return;
  163. TArrInt vObjIDxs;
  164. TDDPoints pts;
  165. TDDRect objmbr;
  166. TDDLineStyle Linestyle;
  167. TStringList *Linkids = new TStringList();
  168. int nLayerIndex = FXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV5.dvf");
  169. if (nLayerIndex < 0) return;
  170. Linkids->Add(ARoad->ROAD_ID);
  171. Linkids->Add(ARoad->ROAD_ID);
  172. TDDRect DDRect_Move;
  173. DDRect_Move.MinX = 200;
  174. DDRect_Move.MaxX = 0;
  175. DDRect_Move.MinY = 50;
  176. DDRect_Move.MaxY = 0;
  177. try
  178. {
  179. if (FXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
  180. {
  181. for(int i = 0; i < vObjIDxs.High; i++)
  182. {
  183. pts = FXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);
  184. if (vObjIDxs[i] == -1)
  185. continue;
  186. Linestyle.PenWidth = 4;
  187. Linestyle.PenColor = clPurple;
  188. Linestyle.OutLineType = true;
  189. Linestyle.ArrowType = false;
  190. FXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);
  191. if (DDRect_Move.MinX > objmbr.MinX)
  192. DDRect_Move.MinX = objmbr.MinX;
  193. if (DDRect_Move.MaxX < objmbr.MaxX)
  194. DDRect_Move.MaxX = objmbr.MaxX;
  195. if (DDRect_Move.MinY > objmbr.MinY)
  196. DDRect_Move.MinY = objmbr.MinY;
  197. if (DDRect_Move.MaxY < objmbr.MaxY)
  198. DDRect_Move.MaxY = objmbr.MaxY;
  199. }
  200. DDRect_Move.MinX -= 0.002;
  201. DDRect_Move.MaxX += 0.002;
  202. DDRect_Move.MinY -= 0.002;
  203. DDRect_Move.MaxY += 0.002;
  204. FXiClient->ExtentDraw(DDRect_Move);
  205. }
  206. }
  207. catch(...)
  208. {
  209. }
  210. delete Linkids;
  211. FXiClient->ReDraw();
  212. }
  213. //---------------------------------------------------------------------------
  214. void TXiMapUtil::ClearPath(TXiClient *AXiClient)
  215. {
  216. if (!AXiClient)
  217. return;
  218. AXiClient->ClearUserDrawPolyGon();
  219. AXiClient->ClearPathInfo();
  220. AXiClient->ReDraw();
  221. }
  222. //---------------------------------------------------------------------------
  223. void TXiMapUtil::MovePoint(TXiClient *AXiClient, double AdX, double AdY, double AdValue)
  224. {
  225. if (!AXiClient)
  226. return;
  227. AXiClient->Start(DDRect(AdX - AdValue,
  228. AdX + AdValue,
  229. AdY - AdValue,
  230. AdY + AdValue));
  231. }
  232. //---------------------------------------------------------------------------
  233. void TXiMapUtil::MoveNode(TXiClient *AXiClient, String ANodeId)
  234. {
  235. TItsNode *pNode = ItsNodeManager->FLists.Find(ANodeId);
  236. MoveNode(AXiClient, pNode);
  237. }
  238. //---------------------------------------------------------------------------
  239. void TXiMapUtil::MoveNode(TXiClient *AXiClient, TItsNode *ANode)
  240. {
  241. if (!AXiClient)
  242. return;
  243. AXiClient->ClearPathInfo();
  244. if (!ANode)
  245. return;
  246. TDDPoint tdpPoint;
  247. try {
  248. tdpPoint.X = StrToFloat(ANode->X_CRDN); //X 좌표
  249. tdpPoint.Y = StrToFloat(ANode->Y_CRDN); //Y 좌표
  250. } catch(...) { return; }
  251. AXiClient->MoveExtentDraw(tdpPoint);
  252. AXiClient->LevelView(7);
  253. AXiClient->CreateDrawFocusRectThread(tdpPoint, 4);
  254. }
  255. //---------------------------------------------------------------------------
  256. void TXiMapUtil::MoveLink(TXiClient *AXiClient, String ALinkId)
  257. {
  258. TItsLink *pLink = ItsLinkManager->FLists.Find(ALinkId);
  259. MoveLink(AXiClient, pLink);
  260. }
  261. //---------------------------------------------------------------------------
  262. void TXiMapUtil::MoveLink(TXiClient *AXiClient, TItsLink *ALink)
  263. {
  264. if (!AXiClient)
  265. return;
  266. AXiClient->ClearPathInfo();
  267. if (!ALink)
  268. return;
  269. TArrInt vObjIDxs;
  270. TDDPoints pts;
  271. TDDRect objmbr;
  272. TDDLineStyle Linestyle;
  273. TStringList *Linkids = new TStringList();
  274. int nLayerIndex = AXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV7.dvf");
  275. if (nLayerIndex < 0) return;
  276. Linkids->Add(ALink->LINK_ID);
  277. Linkids->Add(ALink->LINK_ID);
  278. TDDRect DDRect_Move;
  279. DDRect_Move.MinX = 200;
  280. DDRect_Move.MaxX = 0;
  281. DDRect_Move.MinY = 50;
  282. DDRect_Move.MaxY = 0;
  283. try
  284. {
  285. if (AXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
  286. {
  287. for(int i = 0; i < vObjIDxs.High; i++)
  288. {
  289. pts = AXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);
  290. if (vObjIDxs[i] == -1)
  291. continue;
  292. Linestyle.PenWidth = 4;
  293. Linestyle.PenColor = clPurple;
  294. Linestyle.OutLineType = true;
  295. Linestyle.ArrowType = false;
  296. AXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);
  297. if (DDRect_Move.MinX > objmbr.MinX)
  298. DDRect_Move.MinX = objmbr.MinX;
  299. if (DDRect_Move.MaxX < objmbr.MaxX)
  300. DDRect_Move.MaxX = objmbr.MaxX;
  301. if (DDRect_Move.MinY > objmbr.MinY)
  302. DDRect_Move.MinY = objmbr.MinY;
  303. if (DDRect_Move.MaxY < objmbr.MaxY)
  304. DDRect_Move.MaxY = objmbr.MaxY;
  305. }
  306. DDRect_Move.MinX -= 0.002;
  307. DDRect_Move.MaxX += 0.002;
  308. DDRect_Move.MinY -= 0.002;
  309. DDRect_Move.MaxY += 0.002;
  310. AXiClient->ExtentDraw(DDRect_Move);
  311. }
  312. }
  313. catch(...)
  314. {
  315. }
  316. delete Linkids;
  317. AXiClient->ReDraw();
  318. }
  319. //---------------------------------------------------------------------------
  320. void TXiMapUtil::MoveServiceLink(TXiClient *AXiClient, String AServiceLinkId)
  321. {
  322. TItsServiceLink *ServiceLink = ItsServiceLinkManager->FLists.Find(AServiceLinkId);
  323. MoveServiceLink(AXiClient, ServiceLink);
  324. }
  325. //---------------------------------------------------------------------------
  326. void TXiMapUtil::MoveServiceLink(TXiClient *AXiClient, TItsServiceLink *AServiceLink)
  327. {
  328. if (!AXiClient)
  329. return;
  330. AXiClient->ClearPathInfo();
  331. if (!AServiceLink)
  332. return;
  333. TArrInt vObjIDxs;
  334. TDDPoints pts;
  335. TDDRect objmbr;
  336. TDDLineStyle Linestyle;
  337. TStringList *Linkids = new TStringList();
  338. int nLayerIndex = AXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV6.dvf");
  339. if (nLayerIndex < 0) return;
  340. Linkids->Add(AServiceLink->IFSC_ID);
  341. Linkids->Add(AServiceLink->IFSC_ID);
  342. TDDRect DDRect_Move;
  343. DDRect_Move.MinX = 200;
  344. DDRect_Move.MaxX = 0;
  345. DDRect_Move.MinY = 50;
  346. DDRect_Move.MaxY = 0;
  347. try
  348. {
  349. if (AXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
  350. {
  351. for(int i = 0; i < vObjIDxs.High; i++)
  352. {
  353. pts = AXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);
  354. if (vObjIDxs[i] == -1)
  355. continue;
  356. Linestyle.PenWidth = 4;
  357. Linestyle.PenColor = clPurple;
  358. Linestyle.OutLineType = true;
  359. Linestyle.ArrowType = false;
  360. AXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);
  361. if (DDRect_Move.MinX > objmbr.MinX)
  362. DDRect_Move.MinX = objmbr.MinX;
  363. if (DDRect_Move.MaxX < objmbr.MaxX)
  364. DDRect_Move.MaxX = objmbr.MaxX;
  365. if (DDRect_Move.MinY > objmbr.MinY)
  366. DDRect_Move.MinY = objmbr.MinY;
  367. if (DDRect_Move.MaxY < objmbr.MaxY)
  368. DDRect_Move.MaxY = objmbr.MaxY;
  369. }
  370. DDRect_Move.MinX -= 0.002;
  371. DDRect_Move.MaxX += 0.002;
  372. DDRect_Move.MinY -= 0.002;
  373. DDRect_Move.MaxY += 0.002;
  374. AXiClient->ExtentDraw(DDRect_Move);
  375. }
  376. }
  377. catch(...)
  378. {
  379. }
  380. delete Linkids;
  381. AXiClient->ReDraw();
  382. }
  383. //---------------------------------------------------------------------------
  384. void TXiMapUtil::MoveRoad(TXiClient *AXiClient, String ARoadId)
  385. {
  386. TItsRoad *pRoad = ItsRoadManager->FLists.Find(ARoadId);
  387. MoveRoad(AXiClient, pRoad);
  388. }
  389. //---------------------------------------------------------------------------
  390. void TXiMapUtil::MoveRoad(TXiClient *AXiClient, TItsRoad *ARoad)
  391. {
  392. if (!AXiClient)
  393. return;
  394. AXiClient->ClearPathInfo();
  395. if (!ARoad)
  396. return;
  397. TArrInt vObjIDxs;
  398. TDDPoints pts;
  399. TDDRect objmbr;
  400. TDDLineStyle Linestyle;
  401. TStringList *Linkids = new TStringList();
  402. int nLayerIndex = AXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV5.dvf");
  403. if (nLayerIndex < 0) return;
  404. Linkids->Add(ARoad->ROAD_ID);
  405. Linkids->Add(ARoad->ROAD_ID);
  406. TDDRect DDRect_Move;
  407. DDRect_Move.MinX = 200;
  408. DDRect_Move.MaxX = 0;
  409. DDRect_Move.MinY = 50;
  410. DDRect_Move.MaxY = 0;
  411. try
  412. {
  413. if (AXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
  414. {
  415. for(int i = 0; i < vObjIDxs.High; i++)
  416. {
  417. pts = AXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);
  418. if (vObjIDxs[i] == -1)
  419. continue;
  420. Linestyle.PenWidth = 4;
  421. Linestyle.PenColor = clPurple;
  422. Linestyle.OutLineType = true;
  423. Linestyle.ArrowType = false;
  424. AXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);
  425. if (DDRect_Move.MinX > objmbr.MinX)
  426. DDRect_Move.MinX = objmbr.MinX;
  427. if (DDRect_Move.MaxX < objmbr.MaxX)
  428. DDRect_Move.MaxX = objmbr.MaxX;
  429. if (DDRect_Move.MinY > objmbr.MinY)
  430. DDRect_Move.MinY = objmbr.MinY;
  431. if (DDRect_Move.MaxY < objmbr.MaxY)
  432. DDRect_Move.MaxY = objmbr.MaxY;
  433. }
  434. DDRect_Move.MinX -= 0.002;
  435. DDRect_Move.MaxX += 0.002;
  436. DDRect_Move.MinY -= 0.002;
  437. DDRect_Move.MaxY += 0.002;
  438. AXiClient->ExtentDraw(DDRect_Move);
  439. }
  440. }
  441. catch(...)
  442. {
  443. }
  444. delete Linkids;
  445. AXiClient->ReDraw();
  446. }
  447. //---------------------------------------------------------------------------
  448. void TXiMapUtil::SelectLinkByPos(TXiServer *AXiServer, TXiClient *AXiClient, int ALayerIdx, int X, int Y, String &ALinkId)
  449. {
  450. TDDPoints ddptsArea;
  451. ALinkId = "";
  452. try
  453. {
  454. TDVAInfo DVAInfo;
  455. TStringList *slstGeo = new TStringList();
  456. TStringList *slFldName = new TStringList();
  457. TStringList *slFldValue = new TStringList();
  458. AXiServer->GetDVAInfo(ALayerIdx, DVAInfo);
  459. TShpType shpType = AXiServer->GetShpType(ALayerIdx);
  460. if (AXiServer->ShpObjInfo2(X, Y, ALayerIdx, slFldName, slFldValue, slstGeo))
  461. {
  462. if (slstGeo->Count)
  463. {
  464. ddptsArea.Length = 0;
  465. if (slstGeo->Strings[0] == "POLYGON")
  466. {
  467. ddptsArea.Length = 0;
  468. ALinkId = slFldValue->Strings[1];
  469. if (shpType == iLine) // polyline shape
  470. {
  471. TStringList *slDel = new TStringList();
  472. TStringList *slPos = new TStringList();
  473. slDel->Clear();
  474. slDel->Delimiter = '/';
  475. slDel->DelimitedText = slstGeo->Strings[3];
  476. ddptsArea.Length = slDel->Count+1;
  477. int nCnt = 0;
  478. for (int ii = 0; ii < slDel->Count; ii++)
  479. {
  480. slPos->Clear();
  481. slPos->Delimiter = '|';
  482. slPos->DelimitedText = slDel->Strings[ii];
  483. for (int jj = 0; jj < slPos->Count; jj++)
  484. {
  485. if (!(jj % 2))
  486. {
  487. ddptsArea[nCnt].X = slPos->Strings[jj].ToDouble();
  488. }
  489. else
  490. {
  491. ddptsArea[nCnt].Y = slPos->Strings[jj].ToDouble();
  492. nCnt++;
  493. }
  494. }
  495. ddptsArea[nCnt].X = ddptsArea[nCnt-1].X;
  496. ddptsArea[nCnt].Y = ddptsArea[nCnt-1].Y;
  497. }
  498. delete slDel;
  499. delete slPos;
  500. }
  501. else // polygon shape
  502. {
  503. AnsiString strLnkID = "SD_LINK_ID";
  504. TStringList *linkids;
  505. TArrInt vObjIdxs;
  506. TDDRect objMBR;
  507. linkids = new TStringList( );
  508. linkids->Add(AnsiString(ALinkId));
  509. linkids->Add(AnsiString("2100031100")); // 아이템이 1개 이상이어야 검색이됨
  510. if (AXiServer->Get_MultiAtt(ALayerIdx, strLnkID, linkids, vObjIdxs))
  511. {
  512. for ( int i = 0; i < vObjIdxs.High ; i++ )
  513. {
  514. if ( vObjIdxs[i] == -1 )
  515. continue;
  516. ddptsArea = AXiServer->Get_NstObj(ALayerIdx, vObjIdxs[i], objMBR);
  517. break;
  518. }
  519. }
  520. delete linkids;
  521. }
  522. }
  523. }
  524. }
  525. delete slstGeo;
  526. delete slFldName;
  527. delete slFldValue;
  528. }
  529. catch(...)
  530. {
  531. }
  532. if (ddptsArea.Length > 0)
  533. {
  534. TDDPolygonStyle dpgStyle;
  535. dpgStyle.BrushStyle = bsCross;
  536. dpgStyle.BrushColor = clWhite;
  537. dpgStyle.LineStyle.PenWidth = 2;
  538. dpgStyle.LineStyle.PenStyle = psSolid;
  539. dpgStyle.LineStyle.PenMode = pmMask;
  540. dpgStyle.LineStyle.PenColor = clBlue;
  541. dpgStyle.LineStyle.OutLineType = true;
  542. AXiClient->ADDUserDrawPolyGon(ddptsArea, "", dpgStyle);
  543. }
  544. }
  545. //---------------------------------------------------------------------------
  546. void TXiMapUtil::SelectLinkByPos2(TXiServer *AXiServer, TXiClient *AXiClient, int ALayerIdx, double X, double Y)
  547. {
  548. TDDPoints ddptsArea;
  549. try
  550. {
  551. TDVAInfo DVAInfo;
  552. TStringList *slstGeo = new TStringList();
  553. TStringList *slFldName = new TStringList();
  554. TStringList *slFldValue = new TStringList();
  555. AXiServer->GetDVAInfo(ALayerIdx, DVAInfo);
  556. TShpType shpType = AXiServer->GetShpType(ALayerIdx);
  557. if (AXiServer->ShpObjInfo2(X, Y, ALayerIdx, slFldName, slFldValue, slstGeo))
  558. {
  559. if (slstGeo->Count)
  560. {
  561. ddptsArea.Length = 0;
  562. if (slstGeo->Strings[0] == "POLYGON")
  563. {
  564. ddptsArea.Length = 0;
  565. if (shpType == iLine) // polyline shape
  566. {
  567. TStringList *slDel = new TStringList();
  568. TStringList *slPos = new TStringList();
  569. slDel->Clear();
  570. slDel->Delimiter = '/';
  571. slDel->DelimitedText = slstGeo->Strings[3];
  572. ddptsArea.Length = slDel->Count+1;
  573. int nCnt = 0;
  574. for (int ii = 0; ii < slDel->Count; ii++)
  575. {
  576. slPos->Clear();
  577. slPos->Delimiter = '|';
  578. slPos->DelimitedText = slDel->Strings[ii];
  579. for (int jj = 0; jj < slPos->Count; jj++)
  580. {
  581. if (!(jj % 2))
  582. {
  583. ddptsArea[nCnt].X = slPos->Strings[jj].ToDouble();
  584. }
  585. else
  586. {
  587. ddptsArea[nCnt].Y = slPos->Strings[jj].ToDouble();
  588. nCnt++;
  589. }
  590. }
  591. ddptsArea[nCnt].X = ddptsArea[nCnt-1].X;
  592. ddptsArea[nCnt].Y = ddptsArea[nCnt-1].Y;
  593. }
  594. delete slDel;
  595. delete slPos;
  596. }
  597. }
  598. }
  599. }
  600. delete slstGeo;
  601. delete slFldName;
  602. delete slFldValue;
  603. }
  604. catch(...)
  605. {
  606. }
  607. if (ddptsArea.Length > 0)
  608. {
  609. TDDPolygonStyle dpgStyle;
  610. dpgStyle.BrushStyle = bsCross;
  611. dpgStyle.BrushColor = clWhite;
  612. dpgStyle.LineStyle.PenWidth = 2;
  613. dpgStyle.LineStyle.PenStyle = psSolid;
  614. dpgStyle.LineStyle.PenMode = pmMask;
  615. dpgStyle.LineStyle.PenColor = clBlue;
  616. dpgStyle.LineStyle.OutLineType = true;
  617. AXiClient->ADDUserDrawPolyGon(ddptsArea, "", dpgStyle);
  618. }
  619. }
  620. //---------------------------------------------------------------------------
  621. void TXiMapUtil::SelectLinkById(TXiServer *AXiServer, TXiClient *AXiClient, int ALayerIdx, String ALinkId)
  622. {
  623. TDDRect objmbr;
  624. TDDPoints pts;
  625. TStringList *Linkids = NULL;
  626. TArrInt vObjIDxs;
  627. try
  628. {
  629. Linkids = new TStringList();
  630. Linkids->Add(ALinkId);
  631. Linkids->Add(ALinkId);
  632. if (AXiServer->Get_MultiAtt(ALayerIdx, "SD_LINK_ID", Linkids, vObjIDxs))
  633. {
  634. for(int ii = 0; ii < vObjIDxs.High; ii++)
  635. {
  636. if (vObjIDxs[ii] == -1)
  637. {
  638. continue;
  639. }
  640. pts = AXiServer->Get_NstObj(ALayerIdx, vObjIDxs[ii], objmbr);
  641. TDDLineStyle Linestyle;
  642. Linestyle.PenWidth = 4;
  643. Linestyle.PenColor = clPurple;
  644. Linestyle.OutLineType = true;
  645. Linestyle.ArrowType = true;
  646. AXiClient->ADDPathInfo(TDDPolyLine(pts), "", 0, 0, Linestyle);
  647. }
  648. }
  649. }
  650. __finally
  651. {
  652. if (Linkids) delete Linkids;
  653. }
  654. }
  655. //---------------------------------------------------------------------------