|
|
function FindGroupTest(groupID, itemCount)
{
var ctrlMan = m_Map.GetCtrlMan();
var ctrlstate = ctrlMan.GetControlState();
var poiMan = ctrlMan.GetPOIMan();
var util = m_Map.GetUtility();
// Step 1. Make POI Group
var poiGroup = poiMan.FindGroup(groupID);
if (!poiGroup) {
poiGroup = poiMan.NewGroup(groupID);
}
// Step 1-1. Make POI Style
var gstyle = poiMan.NewStyle(-1); // -1: 아이디 자동 생성
gstyle.SetGDIFont("굴림", 0, 8);
gstyle.SetFontColor(util.RGBColor(255, 0, 0));
gstyle.SetFontOutColor(util.RGBColor(255, 255, 255));
gstyle.SetBrush(util.RGBColor(100, 0, 255), 0);
gstyle.SetPen(util.RGBColor(0, 0, 0), 1, 0);
// Group에 Style을 지정하면 하위 Item은 별도의 Style을 가지지 않는 한 Group의 Style을 따르게 된다.
poiGroup.SetStyle(gstyle);
var style = poiMan.NewStyle(-1);
style.SetGDIFont("굴림", 0, 8);
style.SetFontColor(util.RGBColor(0, 0, 0));
style.SetFontOutColor(util.RGBColor(255, 255, 255));
style.SetBrush(util.RGBColor(100, 0, 255), 0);
style.SetPen(util.RGBColor(0, 0, 0), 1, 0);
// Step 2. Make POI Items
var centerLL = ctrlstate.GetLLCenter(); // 지도의 중심 좌표
var imageman = ctrlMan.GetImageMan();
imageman.SetDefaultPath("http://www.talmap.co.kr/tutorial/");
var image = imageman.LoadImageList("CAR_IMAGE", "image/CAR.png", 64, 64)
for (i = 1 ; i <= itemCount ; i++) {
var item = poiGroup.NewItem(i); // -1: 아이디 자동 생성
item.SetLonLat(centerLL._X + i * 250, centerLL._Y - i * 250)
item.SetShowImage(1);
item.SetImageIndex(1);
item.SetImageOffset(4);
item.SetTextStyle(0x12);
item.SetImage(image);
if (i % 2) {
item.SetStyle(style);
}
item.SetCaption("[" + i + "]Test POI");
item.SetContents("[" + i + "] Contents\nHello");
item.SetAnimation(200); // 1초 단위
item.SetAngle(i*10);
item.SetAlpha(50);
}
}
|
|
|
CXUtility util = m_Map.GetUtility();
// Step1. 지도중심좌표를 구합니다.
CXControlState ctrlstate = ctrlman.GetControlState();
CXPoint posLL = ctrlstate.GetLLCenter();
// Step2. POI Group 을 생성 합니다.
CXPOIMan poiman = ctrlman.GetPOIMan();
CXPOIGroup group = poiman.FindGroup(100);
if (group.m_lpDispatch == NULL)
group = poiman.NewGroup(100);
// Step3. POI Style 을 생성 합니다.
CXPOIStyle style = poiman.FindStyle(1000);
if (style.m_lpDispatch == NULL) {
style = poiman.NewStyle(1000);
style.SetGDIFont(_T("굴림"), 0, 8);
style.SetFontColor(util.RGBColor(255, 0, 0));
style.SetFontOutColor(util.RGBColor(255, 255, 255));
style.SetBrush(util.RGBColor(100, 0, 255), 0);
style.SetPen(util.RGBColor(0, 0, 0), 1, 0);
}
group.SetStyle(style);
// Step4. POI에 사용할 이미지를 로딩 합니다.
CXImageMan imageman = ctrlman.GetImageMan();
imageman.SetDefaultPath(ctrlman.GetDefaultPath()+_T("\\Theme\\"));
CXMagicImageList image = imageman.LoadImageList(_T("CAR_IMAGE"), _T("Image\\CAR.png"), 64, 64);
// Step5. POI Item 을 생성 합니다.
CXPOIItem poi = group.NewItem(-1); // ID가 -1 이면 순차적 ID 자동생성.
poi.SetLonLat(posLL.GetX(), posLL.GetY()); // POI 좌표 설정
poi.SetImage(image); // POI 이미지 설정
poi.SetShowImage(1); // POI 이미지 표출 (0 이면 표출 하지 않음)
poi.SetImageIndex(0); // ImageList 를 사용할 경우 이미지의 Index
poi.SetImageOffset(3); // 이미지 offset
poi.SetTextStyle(0x12); // 텍스트 스타일
poi.SetStyle(style); // 위에서 생성한 스타일 지정, group 에서 지정했으면 생략 가능
poi.SetCaption(_T("Caption")); // 캡션
poi.SetContents(_T("Contents \r\nContents \r\nContents \r\nContents \r\nContents \r\n"));// 컨텐츠
poi.SetAnimation(200); // ImageList 를 사용한 경우 애니메이션 기능.
poi.SetAngle(90); // 회전각도
poi.SetAlpha(100); // 투명도 0~100
poi.SetPerspectiveImage(1);
|
|