﻿//eGGP_AICEM.js created by Feizel Daud Kidia 08.09.2008 as part of EGGP159 Change Request.
//This javascript file is a common location for the collection of code for use by external application to control the eGGP interface.

//This code just makes it easy for external application to call common commands which are then translated into more complicated interface
//routines. It also houses the code that contains tag variables that are set by the parent application and sent back (unprocessed) for
//tracking, or other purposes by the parent applications.

//eGGP_AICEM = eGGP Application Interface Control Embedded Module.

var tag; //This variable is a 'flag' that is set by calling applications which is returned to it via the JS callback feature.

//setReturnTag(tagIn) method enables a calling application to set the tag with required data of interest.
function setReturnTag(tagIn) {
    tag = tagIn;
    return true;
}

//getCurrentScript() is a method call for calling application to obtain the current map script open in eGGP.
function getCurrentScript() {
    return objeGGP.script();
}

//recentreMap(cpx, cpy) is a method that will recenter and refresh the map.
function recentreMap(cpx, cpy) {
    if (objeGGP.script() == "" || objeGGP.script() == null) {
        return false;
    }
    else {
        objeGGP.recentre(cpx, cpy);
        return true;
    }
}

//loadNewScript(scriptIn) will be used toset a new script and refresh the map.
function loadNewScript(scriptIn) {
    mySetScript(scriptIn);
}

//setMarker(x, y, caption, imageLocation) - Allows external application to register trackpoints on the map
function setMarker(x, y, caption) {
    if (objeGGP.script() == "" || objeGGP.script() == null) {
        return false;
    }
    else {
        var newMarkerId = objeGGP.registerTrackPoint(x, y, caption, "");
        return newMarkerId;
    }
}

//removeMarker(markerID) - Removes a marker based on the supplied trackpoint ID
function removeMarker(markerID) {
    objeGGP.unregisterTrackPoint(markerID);
    return true;
}

//geteGGPMode() - This returns the mode that the application is currently set in (the mode it was started in).
function geteGGPMode() {
    return objeGGP.mode();
}

//refreshMap() - Allows the calling application to refresh the map whenever required.
function refreshMap() {
    myRefreshMap();
}
