//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "XiMapUtilF.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

//---------------------------------------------------------------------------
//TXiMapUtil *XiMapUtil = NULL;
//---------------------------------------------------------------------------
TXiMapUtil::TXiMapUtil(TXiClient *AXiClient)
{
	FXiClient = AXiClient;
}
//---------------------------------------------------------------------------
TXiMapUtil::~TXiMapUtil()
{
}
//---------------------------------------------------------------------------
void TXiMapUtil::MovePoint(double AdX, double AdY, double AdValue)
{
	if (!FXiClient)
		return;

	FXiClient->Start(DDRect(AdX - AdValue,
							AdX + AdValue,
							AdY - AdValue,
							AdY + AdValue));
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveLink(String ALinkId)
{
	TItsLink *pLink = ItsLinkManager->FLists.Find(ALinkId);

	MoveLink(pLink);
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveLink(TItsLink *ALink)
{
	FXiClient->ClearPathInfo();

	if (!ALink) return;

	TArrInt      vObjIDxs;
	TDDPoints    pts;
	TDDRect      objmbr;
	TDDLineStyle Linestyle;
	TStringList *Linkids = new TStringList();
	int nLayerIndex = FXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV7.dvf");
    if (nLayerIndex < 0) return;

	Linkids->Add(ALink->LINK_ID);
	Linkids->Add(ALink->LINK_ID);

	TDDRect DDRect_Move;
	DDRect_Move.MinX = 200;
	DDRect_Move.MaxX = 0;
	DDRect_Move.MinY = 50;
	DDRect_Move.MaxY = 0;

	try
	{
		if (FXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
		{
			for(int i = 0; i < vObjIDxs.High; i++)
			{
				pts = FXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);

				if (vObjIDxs[i] == -1)
					continue;

				Linestyle.PenWidth = 4;
				Linestyle.PenColor = clPurple;
				Linestyle.OutLineType = true;
				Linestyle.ArrowType = false;

				FXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);

				if (DDRect_Move.MinX > objmbr.MinX)
					DDRect_Move.MinX = objmbr.MinX;
				if (DDRect_Move.MaxX < objmbr.MaxX)
					DDRect_Move.MaxX = objmbr.MaxX;
				if (DDRect_Move.MinY > objmbr.MinY)
					DDRect_Move.MinY = objmbr.MinY;
				if (DDRect_Move.MaxY < objmbr.MaxY)
					DDRect_Move.MaxY = objmbr.MaxY;
			}

			DDRect_Move.MinX -= 0.002;
			DDRect_Move.MaxX += 0.002;
			DDRect_Move.MinY -= 0.002;
			DDRect_Move.MaxY += 0.002;

			FXiClient->ExtentDraw(DDRect_Move);
		}
	}
	catch(...)
	{
	}

	delete Linkids;
	FXiClient->ReDraw();
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveServiceLink(String AServiceLinkId)
{
	TItsServiceLink *ServiceLink = ItsServiceLinkManager->FLists.Find(AServiceLinkId);

	MoveServiceLink(ServiceLink);
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveServiceLink(TItsServiceLink *AServiceLink)
{
	FXiClient->ClearPathInfo();

	if (!AServiceLink)
		return;

	TArrInt vObjIDxs;
	TDDPoints pts;
	TDDRect objmbr;
	TDDLineStyle Linestyle;
	TStringList *Linkids = new TStringList();
	int nLayerIndex = FXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV6.dvf");
    if (nLayerIndex < 0) return;

	Linkids->Add(AServiceLink->IFSC_ID);
	Linkids->Add(AServiceLink->IFSC_ID);

	TDDRect DDRect_Move;
	DDRect_Move.MinX = 200;
	DDRect_Move.MaxX = 0;
	DDRect_Move.MinY = 50;
	DDRect_Move.MaxY = 0;

	try
	{
		if (FXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
		{
			for(int i = 0; i < vObjIDxs.High; i++)
			{
				pts = FXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);

				if (vObjIDxs[i] == -1)
					continue;

				Linestyle.PenWidth = 4;
				Linestyle.PenColor = clPurple;
				Linestyle.OutLineType = true;
				Linestyle.ArrowType = false;

				FXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);

				if (DDRect_Move.MinX > objmbr.MinX)
					DDRect_Move.MinX = objmbr.MinX;
				if (DDRect_Move.MaxX < objmbr.MaxX)
					DDRect_Move.MaxX = objmbr.MaxX;
				if (DDRect_Move.MinY > objmbr.MinY)
					DDRect_Move.MinY = objmbr.MinY;
				if (DDRect_Move.MaxY < objmbr.MaxY)
					DDRect_Move.MaxY = objmbr.MaxY;
			}

			DDRect_Move.MinX -= 0.002;
			DDRect_Move.MaxX += 0.002;
			DDRect_Move.MinY -= 0.002;
			DDRect_Move.MaxY += 0.002;

			FXiClient->ExtentDraw(DDRect_Move);
		}
	}
	catch(...)
	{
	}

	delete Linkids;
	FXiClient->ReDraw();
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveRoad(String ARoadId)
{
	TItsRoad *pRoad = ItsRoadManager->FLists.Find(ARoadId);

	MoveRoad(pRoad);
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveRoad(TItsRoad *ARoad)
{
	FXiClient->ClearPathInfo();

	if (!ARoad)
		return;

	TArrInt vObjIDxs;
	TDDPoints pts;
	TDDRect objmbr;
	TDDLineStyle Linestyle;
	TStringList *Linkids = new TStringList();
	int nLayerIndex = FXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV5.dvf");
    if (nLayerIndex < 0) return;

	Linkids->Add(ARoad->ROAD_ID);
	Linkids->Add(ARoad->ROAD_ID);

	TDDRect DDRect_Move;
	DDRect_Move.MinX = 200;
	DDRect_Move.MaxX = 0;
	DDRect_Move.MinY = 50;
	DDRect_Move.MaxY = 0;

	try
	{
		if (FXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
		{
			for(int i = 0; i < vObjIDxs.High; i++)
			{
				pts = FXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);

				if (vObjIDxs[i] == -1)
					continue;

				Linestyle.PenWidth = 4;
				Linestyle.PenColor = clPurple;
				Linestyle.OutLineType = true;
				Linestyle.ArrowType = false;

				FXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);

				if (DDRect_Move.MinX > objmbr.MinX)
					DDRect_Move.MinX = objmbr.MinX;
				if (DDRect_Move.MaxX < objmbr.MaxX)
					DDRect_Move.MaxX = objmbr.MaxX;
				if (DDRect_Move.MinY > objmbr.MinY)
					DDRect_Move.MinY = objmbr.MinY;
				if (DDRect_Move.MaxY < objmbr.MaxY)
					DDRect_Move.MaxY = objmbr.MaxY;
			}

			DDRect_Move.MinX -= 0.002;
			DDRect_Move.MaxX += 0.002;
			DDRect_Move.MinY -= 0.002;
			DDRect_Move.MaxY += 0.002;

			FXiClient->ExtentDraw(DDRect_Move);
		}
	}
	catch(...)
	{
	}

	delete Linkids;
	FXiClient->ReDraw();
}
//---------------------------------------------------------------------------


void TXiMapUtil::ClearPath(TXiClient *AXiClient)
{
	if (!AXiClient)
		return;

    AXiClient->ClearUserDrawPolyGon();
    AXiClient->ClearPathInfo();
    AXiClient->ReDraw();
}
//---------------------------------------------------------------------------

void TXiMapUtil::MovePoint(TXiClient *AXiClient, double AdX, double AdY, double AdValue)
{
	if (!AXiClient)
		return;

	AXiClient->Start(DDRect(AdX - AdValue,
							AdX + AdValue,
							AdY - AdValue,
							AdY + AdValue));
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveNode(TXiClient *AXiClient, String ANodeId)
{
	TItsNode *pNode = ItsNodeManager->FLists.Find(ANodeId);

	MoveNode(AXiClient, pNode);
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveNode(TXiClient *AXiClient, TItsNode *ANode)
{
	if (!AXiClient)
		return;

	AXiClient->ClearPathInfo();

	if (!ANode)
		return;

    TDDPoint tdpPoint;
    try {
        tdpPoint.X = StrToFloat(ANode->X_CRDN);    //X 좌표
        tdpPoint.Y = StrToFloat(ANode->Y_CRDN);    //Y 좌표
    } catch(...) { return; }

    AXiClient->MoveExtentDraw(tdpPoint);
    AXiClient->LevelView(7);
    AXiClient->CreateDrawFocusRectThread(tdpPoint, 4);
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveLink(TXiClient *AXiClient, String ALinkId)
{
	TItsLink *pLink = ItsLinkManager->FLists.Find(ALinkId);

	MoveLink(AXiClient, pLink);
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveLink(TXiClient *AXiClient, TItsLink *ALink)
{
	if (!AXiClient)
		return;

	AXiClient->ClearPathInfo();

	if (!ALink)
		return;

	TArrInt vObjIDxs;
	TDDPoints pts;
	TDDRect objmbr;
	TDDLineStyle Linestyle;
	TStringList *Linkids = new TStringList();
	int nLayerIndex = AXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV7.dvf");
    if (nLayerIndex < 0) return;

	Linkids->Add(ALink->LINK_ID);
	Linkids->Add(ALink->LINK_ID);

	TDDRect DDRect_Move;
	DDRect_Move.MinX = 200;
	DDRect_Move.MaxX = 0;
	DDRect_Move.MinY = 50;
	DDRect_Move.MaxY = 0;

	try
	{
		if (AXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
		{
			for(int i = 0; i < vObjIDxs.High; i++)
			{
				pts = AXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);

				if (vObjIDxs[i] == -1)
					continue;

				Linestyle.PenWidth = 4;
				Linestyle.PenColor = clPurple;
				Linestyle.OutLineType = true;
				Linestyle.ArrowType = false;

				AXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);

				if (DDRect_Move.MinX > objmbr.MinX)
					DDRect_Move.MinX = objmbr.MinX;
				if (DDRect_Move.MaxX < objmbr.MaxX)
					DDRect_Move.MaxX = objmbr.MaxX;
				if (DDRect_Move.MinY > objmbr.MinY)
					DDRect_Move.MinY = objmbr.MinY;
				if (DDRect_Move.MaxY < objmbr.MaxY)
					DDRect_Move.MaxY = objmbr.MaxY;
			}

			DDRect_Move.MinX -= 0.002;
			DDRect_Move.MaxX += 0.002;
			DDRect_Move.MinY -= 0.002;
			DDRect_Move.MaxY += 0.002;

			AXiClient->ExtentDraw(DDRect_Move);
		}
	}
	catch(...)
	{
	}

	delete Linkids;
	AXiClient->ReDraw();
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveServiceLink(TXiClient *AXiClient, String AServiceLinkId)
{
	TItsServiceLink *ServiceLink = ItsServiceLinkManager->FLists.Find(AServiceLinkId);

	MoveServiceLink(AXiClient, ServiceLink);
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveServiceLink(TXiClient *AXiClient, TItsServiceLink *AServiceLink)
{
	if (!AXiClient)
		return;

	AXiClient->ClearPathInfo();

	if (!AServiceLink)
		return;

	TArrInt vObjIDxs;
	TDDPoints pts;
	TDDRect objmbr;
	TDDLineStyle Linestyle;
	TStringList *Linkids = new TStringList();
	int nLayerIndex = AXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV6.dvf");
    if (nLayerIndex < 0) return;

	Linkids->Add(AServiceLink->IFSC_ID);
	Linkids->Add(AServiceLink->IFSC_ID);

	TDDRect DDRect_Move;
	DDRect_Move.MinX = 200;
	DDRect_Move.MaxX = 0;
	DDRect_Move.MinY = 50;
	DDRect_Move.MaxY = 0;

	try
	{
		if (AXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
		{
			for(int i = 0; i < vObjIDxs.High; i++)
			{
				pts = AXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);

				if (vObjIDxs[i] == -1)
					continue;

				Linestyle.PenWidth = 4;
				Linestyle.PenColor = clPurple;
				Linestyle.OutLineType = true;
				Linestyle.ArrowType = false;

				AXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);

				if (DDRect_Move.MinX > objmbr.MinX)
					DDRect_Move.MinX = objmbr.MinX;
				if (DDRect_Move.MaxX < objmbr.MaxX)
					DDRect_Move.MaxX = objmbr.MaxX;
				if (DDRect_Move.MinY > objmbr.MinY)
					DDRect_Move.MinY = objmbr.MinY;
				if (DDRect_Move.MaxY < objmbr.MaxY)
					DDRect_Move.MaxY = objmbr.MaxY;
			}

			DDRect_Move.MinX -= 0.002;
			DDRect_Move.MaxX += 0.002;
			DDRect_Move.MinY -= 0.002;
			DDRect_Move.MaxY += 0.002;

			AXiClient->ExtentDraw(DDRect_Move);
		}
	}
	catch(...)
	{
	}

	delete Linkids;
	AXiClient->ReDraw();
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveRoad(TXiClient *AXiClient, String ARoadId)
{
	TItsRoad *pRoad = ItsRoadManager->FLists.Find(ARoadId);

	MoveRoad(AXiClient, pRoad);
}
//---------------------------------------------------------------------------
void TXiMapUtil::MoveRoad(TXiClient *AXiClient, TItsRoad *ARoad)
{
	if (!AXiClient)
		return;

	AXiClient->ClearPathInfo();

	if (!ARoad)
		return;

	TArrInt vObjIDxs;
	TDDPoints pts;
	TDDRect objmbr;
	TDDLineStyle Linestyle;
	TStringList *Linkids = new TStringList();
	int nLayerIndex = AXiClient->XiMapServer->GetLayerIndex("GD_LINK_LV5.dvf");
    if (nLayerIndex < 0) return;

	Linkids->Add(ARoad->ROAD_ID);
	Linkids->Add(ARoad->ROAD_ID);

	TDDRect DDRect_Move;
	DDRect_Move.MinX = 200;
	DDRect_Move.MaxX = 0;
	DDRect_Move.MinY = 50;
	DDRect_Move.MaxY = 0;

	try
	{
		if (AXiClient->XiMapServer->Get_MultiAtt(nLayerIndex, "SD_LINK_ID", Linkids, vObjIDxs))
		{
			for(int i = 0; i < vObjIDxs.High; i++)
			{
				pts = AXiClient->XiMapServer->Get_NstObj(nLayerIndex, vObjIDxs[i], objmbr);

				if (vObjIDxs[i] == -1)
					continue;

				Linestyle.PenWidth = 4;
				Linestyle.PenColor = clPurple;
				Linestyle.OutLineType = true;
				Linestyle.ArrowType = false;

				AXiClient->ADDPathInfo(TDDPolyLine(pts), "--=", 1, 1, Linestyle);

				if (DDRect_Move.MinX > objmbr.MinX)
					DDRect_Move.MinX = objmbr.MinX;
				if (DDRect_Move.MaxX < objmbr.MaxX)
					DDRect_Move.MaxX = objmbr.MaxX;
				if (DDRect_Move.MinY > objmbr.MinY)
					DDRect_Move.MinY = objmbr.MinY;
				if (DDRect_Move.MaxY < objmbr.MaxY)
					DDRect_Move.MaxY = objmbr.MaxY;
			}

			DDRect_Move.MinX -= 0.002;
			DDRect_Move.MaxX += 0.002;
			DDRect_Move.MinY -= 0.002;
			DDRect_Move.MaxY += 0.002;

			AXiClient->ExtentDraw(DDRect_Move);
		}
	}
	catch(...)
	{
	}

	delete Linkids;
	AXiClient->ReDraw();
}
//---------------------------------------------------------------------------

void TXiMapUtil::SelectLinkByPos(TXiServer *AXiServer, TXiClient *AXiClient, int ALayerIdx, int X, int Y, String &ALinkId)
{
    TDDPoints ddptsArea;
    ALinkId = "";
    try
    {
    	TDVAInfo	  DVAInfo;
        TStringList	 *slstGeo    = new TStringList();
        TStringList	 *slFldName  = new TStringList();
        TStringList	 *slFldValue = new TStringList();

        AXiServer->GetDVAInfo(ALayerIdx, DVAInfo);
        TShpType shpType = AXiServer->GetShpType(ALayerIdx);
        if (AXiServer->ShpObjInfo2(X, Y, ALayerIdx, slFldName, slFldValue, slstGeo))
        {
            if (slstGeo->Count)
            {
                ddptsArea.Length = 0;

                if (slstGeo->Strings[0] == "POLYGON")
                {
                    ddptsArea.Length = 0;

                    ALinkId = slFldValue->Strings[1];
                    if (shpType == iLine)  // polyline shape
                    {
                        TStringList *slDel = new TStringList();
                        TStringList *slPos = new TStringList();

                        slDel->Clear();
                        slDel->Delimiter = '/';
                        slDel->DelimitedText = slstGeo->Strings[3];

                        ddptsArea.Length = slDel->Count+1;

                        int nCnt = 0;
                        for (int ii = 0; ii < slDel->Count; ii++)
                        {
                            slPos->Clear();
                            slPos->Delimiter = '|';
                            slPos->DelimitedText = slDel->Strings[ii];

                            for (int jj = 0; jj < slPos->Count; jj++)
                            {
                                if (!(jj % 2))
                                {
                                    ddptsArea[nCnt].X = slPos->Strings[jj].ToDouble();
                                }
                                else
                                {
                                    ddptsArea[nCnt].Y = slPos->Strings[jj].ToDouble();
                                    nCnt++;
                                }
                            }
                            ddptsArea[nCnt].X = ddptsArea[nCnt-1].X;
                            ddptsArea[nCnt].Y = ddptsArea[nCnt-1].Y;
                        }
                        delete slDel;
                        delete slPos;
                    }
                    else    // polygon shape
                    {
                        AnsiString  strLnkID = "SD_LINK_ID";
                        TStringList *linkids;
                        TArrInt     vObjIdxs;
                        TDDRect     objMBR;

                        linkids	= new TStringList( );

                        linkids->Add(AnsiString(ALinkId));
                        linkids->Add(AnsiString("2100031100")); // 아이템이 1개 이상이어야 검색이됨
                        if (AXiServer->Get_MultiAtt(ALayerIdx, strLnkID, linkids, vObjIdxs))
                        {
                            for ( int i = 0; i < vObjIdxs.High ; i++ )
                            {
                                if ( vObjIdxs[i] == -1 )
                                    continue;
                                ddptsArea = AXiServer->Get_NstObj(ALayerIdx, vObjIdxs[i], objMBR);
                                break;
                            }
                        }
                        delete linkids;
                    }
                }
            }
        }

        delete slstGeo;
        delete slFldName;
        delete slFldValue;
    }
    catch(...)
    {
    }
    if (ddptsArea.Length > 0)
    {
        TDDPolygonStyle dpgStyle;
        dpgStyle.BrushStyle = bsCross;
        dpgStyle.BrushColor = clWhite;
        dpgStyle.LineStyle.PenWidth = 2;
        dpgStyle.LineStyle.PenStyle = psSolid;
        dpgStyle.LineStyle.PenMode = pmMask;
        dpgStyle.LineStyle.PenColor = clBlue;
        dpgStyle.LineStyle.OutLineType = true;

        AXiClient->ADDUserDrawPolyGon(ddptsArea, "", dpgStyle);
    }
}
//---------------------------------------------------------------------------

void TXiMapUtil::SelectLinkByPos2(TXiServer *AXiServer, TXiClient *AXiClient, int ALayerIdx, double X, double Y)
{
    TDDPoints ddptsArea;
    try
    {
    	TDVAInfo	  DVAInfo;
        TStringList	 *slstGeo    = new TStringList();
        TStringList	 *slFldName  = new TStringList();
        TStringList	 *slFldValue = new TStringList();

        AXiServer->GetDVAInfo(ALayerIdx, DVAInfo);
        TShpType shpType = AXiServer->GetShpType(ALayerIdx);
        if (AXiServer->ShpObjInfo2(X, Y, ALayerIdx, slFldName, slFldValue, slstGeo))
        {
            if (slstGeo->Count)
            {
                ddptsArea.Length = 0;

                if (slstGeo->Strings[0] == "POLYGON")
                {
                    ddptsArea.Length = 0;

                    if (shpType == iLine)  // polyline shape
                    {
                        TStringList *slDel = new TStringList();
                        TStringList *slPos = new TStringList();

                        slDel->Clear();
                        slDel->Delimiter = '/';
                        slDel->DelimitedText = slstGeo->Strings[3];

                        ddptsArea.Length = slDel->Count+1;

                        int nCnt = 0;
                        for (int ii = 0; ii < slDel->Count; ii++)
                        {
                            slPos->Clear();
                            slPos->Delimiter = '|';
                            slPos->DelimitedText = slDel->Strings[ii];

                            for (int jj = 0; jj < slPos->Count; jj++)
                            {
                                if (!(jj % 2))
                                {
                                    ddptsArea[nCnt].X = slPos->Strings[jj].ToDouble();
                                }
                                else
                                {
                                    ddptsArea[nCnt].Y = slPos->Strings[jj].ToDouble();
                                    nCnt++;
                                }
                            }
                            ddptsArea[nCnt].X = ddptsArea[nCnt-1].X;
                            ddptsArea[nCnt].Y = ddptsArea[nCnt-1].Y;
                        }
                        delete slDel;
                        delete slPos;
                    }
                }
            }
        }

        delete slstGeo;
        delete slFldName;
        delete slFldValue;
    }
    catch(...)
    {
    }
    if (ddptsArea.Length > 0)
    {
        TDDPolygonStyle dpgStyle;
        dpgStyle.BrushStyle = bsCross;
        dpgStyle.BrushColor = clWhite;
        dpgStyle.LineStyle.PenWidth = 2;
        dpgStyle.LineStyle.PenStyle = psSolid;
        dpgStyle.LineStyle.PenMode = pmMask;
        dpgStyle.LineStyle.PenColor = clBlue;
        dpgStyle.LineStyle.OutLineType = true;

        AXiClient->ADDUserDrawPolyGon(ddptsArea, "", dpgStyle);
    }
}
//---------------------------------------------------------------------------

void TXiMapUtil::SelectLinkById(TXiServer *AXiServer, TXiClient *AXiClient, int ALayerIdx, String ALinkId)
{
    TDDRect      objmbr;
    TDDPoints    pts;
    TStringList *Linkids = NULL;
    TArrInt      vObjIDxs;

    try
    {
        Linkids = new TStringList();
        Linkids->Add(ALinkId);
        Linkids->Add(ALinkId);

        if (AXiServer->Get_MultiAtt(ALayerIdx, "SD_LINK_ID", Linkids, vObjIDxs))
        {
            for(int ii = 0; ii < vObjIDxs.High; ii++)
            {
                if (vObjIDxs[ii] == -1)
                {
                    continue;
                }
                pts = AXiServer->Get_NstObj(ALayerIdx, vObjIDxs[ii], objmbr);

                TDDLineStyle Linestyle;
                Linestyle.PenWidth = 4;
                Linestyle.PenColor = clPurple;
                Linestyle.OutLineType = true;
                Linestyle.ArrowType   = true;
                AXiClient->ADDPathInfo(TDDPolyLine(pts), "", 0, 0, Linestyle);
            }
        }
    }
    __finally
    {
        if (Linkids) delete Linkids;
    }
}
//---------------------------------------------------------------------------

