Menu

Pushpin by speed

Help
2019-01-25
2019-01-25
  • Martin Hofgesang

    Hello everybody,

    I got trouble changing the pushpin color on the speed.

    The FAQ says there is a change necessary at in jmaps.js in the "evHeadingMarkerURL" but there are many functions starting with evHeadingMarkerURL and neither of them changes anything.

    I managed to change my Pushpins by modification of the function "evHeadingGreenURL" as described below, but I am wondering what the preferred way of the developer is.

    Does anyone have an idea?

    /**
    *** Pushpin: 
    *** Returns a 'green' pushpin/icon URL based on the event heading
    *** @param e  The 'MapEventRecord' object
    **/
    function evHeadingGreenURL(e)
    {
        var ppImg = "images/pp/pin30"; // "extra/images/pp/circle"
        if ((MAX_CREATION_AGE_SEC > 0) && (e.createAge > MAX_CREATION_AGE_SEC)) {
            if (e.speedKPH < 1.0) {
                return ppImg + "_black.png";
            } else {
                var x = Math.round(e.heading / 45.0) % 8;
                return ppImg + "_black_h"+x+".png";
            }
        } else
        if (e.speedKPH < 1.0) {
            // probably not moving
            return ppImg + "_green_dot.png";
        } else 
        if (e.speedKPH < 60.0) {
            var x = Math.round(e.heading / 45.0) % 8;
            return ppImg + "_yellow_h"+x+".png";
        } else 
        if (e.speedKPH < 130.0) {
            var x = Math.round(e.heading / 45.0) % 8;
            return ppImg + "_green_h"+x+".png";
        } else {
            var x = Math.round(e.heading / 45.0) % 8;
            return ppImg + "_black_h"+x+".png";
        }
    };
    

    Regards

    Martin

     
  • tea4two

    tea4two - 2019-01-25

    Hi,
    if I well emember it's possible to define new Icons in Private.XML

    <pushpins baseurl="custom/images/pp/">
    <pushpin iconoffset="9,30" shadowsize="30,30" iconsize="60,60" key="new_stop" shadow="" icon="new_stop.png">
    <pushpin iconoffset="9,30" shadowsize="30,30" iconsize="30,30" key="new_start" shadow="" icon="new_start.png">
    </pushpin></pushpin></pushpins>

    and the function to manipulate view conditions inside the same private.xml

        <IconSelector type="device" ruleFactoryName="GTSRulesEngine"><![CDATA[
            ((mph<5)?"stop":(mph<20)?"yellowh":"greenh")
            ]]></IconSelector>
    

    I'm not sure if the function works only on the GTS Enterprise......

    Read remarks in the Private.xml file

    Regards
    - Pierluigi

     

Log in to post a comment.