<html>
<head>
<script language="javascript">
<!--
var img_start, img_end, img_pos;
var sflag, eflag;
//------------------------------------------------------------------------------
// Click Notify Event Call
//------------------------------------------------------------------------------
function CallClickNotify(Type)
{
var ctrlman = m_Map.GetCtrlMan();
ctrlman.SetClickNotify(Type);
}
//------------------------------------------------------------------------------
// Evnet Click Notify
//------------------------------------------------------------------------------
function MapEvent_OnClickNotify(Type, X, Y)
{
var ctrlman = m_Map.GetCtrlMan();
var ctrlstate = ctrlman.GetControlState();
var lonlat = ctrlstate.DPToLL(X, Y);
AddPoint(Type, lonlat._Lon, lonlat._Lat);
}
//------------------------------------------------------------------------------
// Departure / Destination / Add Via
//------------------------------------------------------------------------------
function AddPoint(flag, X, Y)
{
var ctrlman = m_Map.GetCtrlMan();
var routeman = ctrlman.GetRouteMan();
var util = m_Map.GetUtility();
var poiman = ctrlman.GetPOIMan();
var route = routeman.GetCurrentRoute();
if (route == null) route = routeman.NewRoute();
if (flag == 100) { // Departure
route.SetSourceInfo("E:\\TalMap\\Data\\Region.TMRPF", 1);
route.ClearOriginFlag(); // Delete Departure
sflag = null;
sflag = route.AddOrigin(X, Y); x1 = X; y1 = Y;
var style = poiman.FindStyle(1);
if (!style) {
style = poiman.NewStyle(1);
style.SetImage(255, img_start);
style.SetGDIFont("Tahoma", 0, 9);
style.SetFontColor(util.RGBColor(255, 0, 0));
}
sflag.SetCaption("");
sflag.SetPOIStyle(style);
} else if (flag == 200){ // Destination
route.ClearDestinationFlag(); // Delete Destination
eflag = null;
eflag = route.AddDestination(X, Y);
var style = poiman.FindStyle(2);
if (!style) {
style = poiman.NewStyle(2);
style.SetImage(255, img_end);
style.SetGDIFont("Tahoma", 0, 9);
style.SetFontColor(util.RGBColor(255, 0, 0));
}
eflag.SetCaption("");
eflag.SetPOIStyle(style);
} else if (flag == 300){ // Waypoint : currently not supported.
route.ClearViaFlag(); // Delete Waypoint
var pFlag = route.AddVia(X, Y);
var style = poiman.FindStyle(3);
if (!style) {
style = poiman.NewStyle(3);
style.SetImage(255, img_pos);
style.SetGDIFont("Tahoma", 0, 9);
style.SetFontColor(util.RGBColor(255, 0, 0));
}
pFlag.SetCaption("");
pFlag.SetPOIStyle(style);
}
}
//------------------------------------------------------------------------------
// Route Search
// For less than 5km in straight-line distance, use 5K Under.TMRPC data for search.
// XRouteFlag.SetDirectionToBoth : Search route regardless of its direction.
//------------------------------------------------------------------------------
function SearchRP()
{
var route= m_Map.GetCtrlMan().GetRouteMan().GetCurrentRoute();
var rect = route.GetMapRect();
// Straight-line Distance between departure and destination
var dist = m_Map.GetCoordSys().GetRealDistance(rect._LLong, rect._LLat, rect._RLong, rect._ULat) ;
var cost = null;
if (route) {
if (dist > 5000) { // 5Km ±âÁØÀ¸·Î Cost ÆÄÀÏ ¼³Á¤ // Choose a Cost file based on the distance
cost = route.LoadCost("E:\\TalMap\\Data\\RPCost.TMRPC", 1);
} else {
cost = route.LoadCost("E:\\TalMap\\Data\\5KUnder.TMRPC", 1);
sflag.SetDirectionToBoth(); // Exclude direction
eflag.SetDirectionToBoth(); // Exclude direction
}
if (route.FindPath(cost)) {
var style = m_Map.GetCtrlMan().GetLayerMan().FindStyle(9910);
if (style == null) {
style = m_Map.GetCtrlMan().GetLayerMan().NewStyle(9910);
style.SetPen(Map.GetUtility().RGBColor(255,0, 0), 2, m_Map.GetUtility().GetConstToValue("PS_SOLID"));
}
route.SetLayerStyle(style);
}
route.FreeCost(cost);
}
}
//------------------------------------------------------------------------------
// Clear Route
//------------------------------------------------------------------------------
function ClearRP()
{
m_Map.GetCtrlMan().GetRouteMan().ClearRoute();
}
-->
</script>
<script language="javascript" for="m_Map" event="OnCreate(Flag)">
<!--
MapEvent_OnCreate(Flag);
var ctrlman = m_Map.GetCtrlMan();
ctrlman.SetDefaultPath("http://www.talmap.co.kr/");
var ImageMan = ctrlman.GetImageMan();
ImageMan.SetDefaultPath(defaultURL + "tutorial/image/");
// Load the Image to be used for route search.
img_start= ImageMan.LoadImageList("poi1", "car_start.png", 44, 44);
img_end = ImageMan.LoadImageList("poi2", "car_end.png", 44, 44);
img_pos = ImageMan.LoadImageList("poi3", "car_pos.png", 44, 44);
-->
</script>
<script language="javascript" for="m_Map" event="OnGPSNotify(XGPSMan, Flag, Data)">
<!--
MapEvent_GPS_Notify(XGPSMan, Flag, Data);
-->
</script>
</head>
<body>
<table>
<tr>
<td>
<OBJECT ID="m_Map" CLASSID="CLSID:DD9B48AD-EDDC-4D2C-BD68-D1FB4B382024"
codebase='http://localhost/TalMapX_Web.CAB#version=1,0,0,17' width=100% height=80%>
</OBJECT>
</td>
</tr>
</table>
</body>
</html>