|
|
function NewStyleTest(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)
//var path = ctrlMan.ExpandPathFromRoot("Image", "CAR.png");
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);
|
|