|
|
var ctrlman = m_Map.GetCtrlMan();
var ctrlstate = ctrlman.GetControlState();
var util = m_Map.GetUtility();
var posLL = ctrlstate.GetLLCenter(); // ÁöµµÀÇ Á᫐ ÁÂÇ¥
// Step 1. POI Manger ¾ò±â
var poiman = ctrlman.GetPOIMan();
var baseman = poiman.CastToBaseManager();
// Step 2. Make POI Group »ý¼º
var group = poiman.FindGroup(1234);
if (!group)
group = poiman.NewGroup(1234);
// Step 2-1. POI Style »ý¼º
var gstyle = poiman.FindStyle(1);
if (!gstyle)
{
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À» µû¸£°Ô µÈ´Ù.
group.SetStyle(gstyle);
var style = poiman.FindStyle(2);
if (!style)
{
style = poiman.NewStyle(2);
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 3. POI Item »ý¼º
var imageman = ctrlman.GetImageMan();
imageman.SetDefaultPath("http://www.talmap.co.kr/tutorial/");
var image = imageman.LoadImageList("CAR_IMAGE", "image/CAR.png", 64, 64);
if (image.IsValid() != true)
{
alert("Image ÀÌ»ó");
}
var angle = 0;
for (i = 0; i < 3; i++)
{
var item = group.NewItem(i+1);
item.SetLonLat(posLL._X + i * 250, posLL._Y - i * 250);
item.SetImage(image);
item.SetShowImage(1);
item.SetImageIndex(1);
item.SetImageOffset(4);
item.SetTextStyle(0x12);
if (i % 2)
item.SetStyle(style);
item.SetCaption("[" + i + "]Test POI");
item.SetContents("[" + i + "] Contents\nHello");
item.SetAnimation(200); // 1000 = 1ÃÊ , 1ÃÊ ´ÜÀ§
item.SetSyncAngle(1);
item.SetAngle(angle);
item.SetAlpha(100);
angle = angle + 10;
if (angle > 360)
{
angle = 0;
}
}
// ƯÁ¤ POI Item À» ¾ò¾î °¡Àå »óÀ§¿¡ Ç¥Ãâ
var finditem = group.FindItem(1);
poiman.SetTopItem(finditem);
|
|
|
#include "CXCtrlMan.h"
#include "CXControlState.h"
#include "CXUtility.h"
#include "CXPoint.h"
#include "CXPOIMan.h"
#include "CXPOIBaseMan.h"
#include "CXPOIGroup.h"
#include "CXPOIStyle.h"
#include "CXImageMan.h"
#include "CXMagicImageList.h"
#include "CXPOIItem.h"
CXCtrlMan ctrlman = m_Map.GetCtrlMan();
CXControlState ctrlstate = ctrlman.GetControlState();
CXUtility util = m_Map.GetUtility();
CXPoint posLL = ctrlstate.GetLLCenter(); // ÁöµµÀÇ Á᫐ ÁÂÇ¥
CXPOIMan poiman = ctrlman.GetPOIMan();
CXPOIBaseMan baseman = poiman.CastToBaseManager();
// Step 2. Make POI Group »ý¼º
CXPOIGroup group = poiman.FindGroup(1234);
if (!group)
group = poiman.NewGroup(1234);
// Step 2-1. POI Style »ý¼º
CXPOIStyle gstyle = poiman.FindStyle(1);
if (!gstyle)
{
gstyle = poiman.NewStyle(1); // -1: ¾ÆÀ̵ð ÀÚµ¿ »ý¼º
gstyle.SetGDIFont(_T("±¼¸²"), 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À» µû¸£°Ô µÈ´Ù.
group.SetStyle(gstyle);
CXPOIStyle style = poiman.FindStyle(2);
if (!style)
{
style = poiman.NewStyle(2);
style.SetGDIFont(_T("±¼¸²"), 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 3. POI Item »ý¼º
CXImageMan imageman = ctrlman.GetImageMan();
imageman.SetDefaultPath(_T("http://www.talmap.co.kr/tutorial/"));
CXMagicImageList image = imageman.LoadImageList(_T("CAR_IMAGE"), _T("image/CAR.png"), 64, 64);
if (image.IsValid() != TRUE)
{
AfxMessageBox(_T("Image ÀÌ»ó"));
}
int angle = 0;
for (int i = 0; i < 3; i++)
{
CXPOIItem item = group.NewItem(i+1);
item.SetLonLat(posLL.GetX() + i * 250, posLL.GetY() - i * 250);
item.SetImage(image);
item.SetShowImage(1);
item.SetImageIndex(1);
item.SetImageOffset(4);
item.SetTextStyle(0x12);
if (i % 2)
item.SetStyle(style);
item.SetAnimation(200); // 1000 = 1ÃÊ , 1ÃÊ ´ÜÀ§
item.SetSyncAngle(1);
item.SetAngle(angle);
item.SetAlpha(100);
angle = angle + 10;
if (angle > 360)
{
angle = 0;
}
}
// ƯÁ¤ POI Item À» ¾ò¾î °¡Àå »óÀ§¿¡ Ç¥Ãâ
CXPOIItem finditem = group.FindItem(1);
poiman.SetTopItem(finditem);
|
|