SOLVED-multiple radars and their headings

  • Hi, excuse my stupidity but I can not figure where I should add heading for each mapspots.
    I play with the Klaus's example code and I can also find the right headings for each panorama using the radar.swf and its editmode="true".

    But I have different heading values and I can not find the right place in the code to put it to each mapspot. I will have 3 floors and 31 mapspots in my project.
    Thanks in advance

    <?xml version="1.0" encoding="utf-8"?>
    <krpano>
    <!-- the image map -->
    <layer name="prvnipatro" url="%SWFPATH%/skin/prvnipatro700.png" keep="true" align="topright" x="10" y="10" width="64" height="45" handcursor="true" scalechildren="true" maskchildren="true" onclick="openmap();">
    <!-- 'rooms' and spots - the 'room' container elements were used for masking the radar -->

    <layer name="mapspot1" url="%SWFPATH%/skin/mappoint.png" align="lefttop" edge="center" x="426" y="361" zorder="2" onhover="showtext(Vstupní terasa,DEFAULT);" onclick="loadscene(scene_01panocorr, null, MERGE, BLEND(1));" />


    <layer name="mapspot2" url="%SWFPATH%/skin/mappoint.png" align="lefttop" edge="center" x="61" y="104" zorder="2" onclick="loadscene(scene_02panocorr, null, MERGE, BLEND(1));" />


    <layer name="mapspot3" url="%SWFPATH%/skin/mappoint.png" align="lefttop" edge="center" x="92" y="46" zorder="2" onclick="loadscene(scene_03panocorr, null, MERGE, BLEND(1));" />

    </layer>

    <!-- radar plugin, will be assigned to be a child of spot -->
    <layer name="radar" keep="true" visible="false" url="%SWFPATH%/plugins/radar.swf" alturl="%SWFPATH%/plugins/radar.js" align="center" edge="center" fillcolor="0x273233" fillalpha="0.4" scale="0.5" editmode="true" headingoffset="0" />
    <!-- activated spot image (child of the radar layer) -->
    <layer name="activespot" parent="radar" url="%SWFPATH%/skin/mappointactive.png" keep="true" align="center" edge="center" />
    <!-- actions -->
    <action name="closemap">
    set(onclick, openmap() );
    tween(width,64);
    tween(height,45);
    </action>
    <action name="openmap">
    set(onclick, closemap() );
    tween(width,700);
    tween(height,437);
    </action>
    <!-- activatespot action - %1 = the current spot, %2 = the current radar heading -->
    <action name="activatespot">
    set(layer[radar].parent, layer[%1]);
    set(layer[radar].visible, true);
    set(layer[radar].heading, %2);
    </action>
    </krpano>

    Edited once, last by martyhr (December 17, 2012 at 11:03 PM).

  • Hi!

    I guess you are talking about the image-map example in the download package.

    Let's see...

    There are three scenes in that example. Each of them has onstart(); action

    Code
    onstart="activatespot(spot1, 0);

    This action has two parametres: spot1 and 0. So when scene1 is loaded these parameters are passed to the action.

    The action itself is:

    Code
    <action name="activatespot">
    		set(layer[radar].parent, layer[%1]);
    		set(layer[radar].visible, true);
    		set(layer[radar].heading, %2);
     </action>


    Where %1 is parameter No.1 and %2 is parameter No.2. As we see from the onstart(); action of the first scene, these are spot1 and 0.

    So for the first scene the action will run as follows:

    Code
    <action name="activatespot">
     	set(layer[radar].parent, layer[spot1]);
    		set(layer[radar].visible, true);
     	set(layer[radar].heading, 0);
    	</action>

    In other words, action sets layer "spot1" as parent for the radar, makes the radar visible and sets its heading to "0'.
    In the second scene these two parameters are "spot2" and "90", so when it's loaded, these two values will be used in the action as %1 and %2.
    To sum up... In each scene state onloaded="activatespot(your_mapspot_name,its_heading).
    Hope this helps *wink*

    Regards,

    Alexey

  • Hi!

    I'm glad this helped. If it's more convenient to put headings inside the "mapspots" layers, then just use one parameter - the name of the mapspot layer.
    So the action would be:

    Code
    <action name="activatespot">
    		set(layer[radar].parent, layer[%1]);
    		set(layer[radar].visible, true);
    set(layer[radar].heading, get(layer[%1].heading));
     </action>

    and inside the mapspot layer indicate the heading the way you do it in your post:

    Code
    <layer name="spot2" url="skin/mappoint.png" align="lefttop" heading="200" ... >

    Regards,

    Alexey

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!