Radar plugin active spot

  • Ive been working on the radar plugin most of the day. Im having problems positioning the active radar with each "spot". The active radar spot seems to not want to link with each "spot" scene. The following is my code along with a picture of the radar. I have two spot links to the left of the map and the active radar is to the right.


    <!-- the image map -->
    <layer name="map" url="skin/Floorplan.png" keep="true" align="righttop" x="16" y="16" width="316" height="222"
    handcursor="false"
    scalechildren="true"
    maskchildren="true"
    onclick="closemap();"
    >
    <!-- 'rooms' and spots - the 'room' container elements were used for masking the radar -->
    <layer name="room1" type="container" align="lefttop" x="2" y="120" width="187" height="115" maskchildren="true">
    <layer name="spot1" url="skin/mappoint.png" align="lefttop" edge="center" x="91" y="59" zorder="2" onclick="loadscene(scene__DSC1933_Panorama, null, MERGE, BLEND(1));" />
    </layer>
    <layer name="room2" type="container" align="lefttop" x="70" y="190" width="117" height="214" maskchildren="true">
    <layer name="spot2" url="skin/mappoint.png" align="lefttop" edge="center" x="100" y="200" zorder="2" onclick="loadscene(scene__DSC2041_Panorama, null, MERGE, BLEND(1));" />
    </layer>

    </layer>


    <!-- radar plugin, will be assigned to be a child of spot -->
    <layer name="radar" keep="true" visible="true"
    url="%SWFPATH%/plugins/radar.swf"
    alturl="%SWFPATH%/plugins/radar.js"
    align="righttop" edge="righttop"
    fillcolor="0xFFFFFF" fillalpha="0.5" scale="1.0"
    headingoffset="0"
    />

    <!-- activated spot image (child of the radar layer) -->
    <layer name="activespot" parent="radar" url="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,316);
    tween(height,222);
    </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>


    <!-- the scenes -->
    <scene name="scene__DSC1933_Panorama" onstart="activatespot(spot1, 0);">

    <view hlookat="122.501" vlookat="7.196" fov="120" />

    <preview type="grid(cube,32,32,256,0xDD3322,0xCC3322,0xFF0000);" details="16" />

    </scene>

    <scene name="scene__DSC2041_Panorama" onstart="activatespot(spot2, 90);">

    <view hlookat="122.501" vlookat="7.196" fov="120" />

    <preview type="grid(cube,32,32,256,0x33DD22,0x33CC22,0x00FF00);" details="16" />


    </scene>

    </krpano>

  • Just wondering if anyone could please help with radar plugin problem? I simply used the supplied radar xml/plugins with download package. Map is in bottom left corner, but radar is in middle of the screen by default. I can reposition the radar by changing "center" to "left", "right" etc... but I need radar to be linked with the active "scene". Thank you

  • I haven't uploaded it to online server yet because I have yet to get radar to work properly. If I need to upload I can, but map is in bottom left corner with active radar display in middle of the screen. Active radar doesn't correspond with "spots". Here is scenes-with-imagemap.xml for two scene tour:


    <!--
    scenes with imagemap example
    - tour navigation via image map
    - radar at current map point
    - radar room masking via parent container layer elements
    -->

    <krpano onstart="loadscene(0);" >

    <!-- the image map -->
    <layer name="map" url="skin/Floorplan.png" keep="true" align="leftbottom" x="16" y="16" width="316" height="222"
    handcursor="false"
    scalechildren="true"
    maskchildren="true"
    onclick="closemap();"
    >
    <!-- 'rooms' and spots - the 'room' container elements were used for masking the radar -->
    <layer name="room1" type="container" align="lefttop" x="125" y="4" width="187" height="115" maskchildren="true">
    <layer name="spot1" url="skin/mappoint.png" align="lefttop" edge="center" x="91" y="59" zorder="2" onclick="loadscene(scene__DSC1933_Panorama, null, MERGE, BLEND(1));" />
    </layer>
    <layer name="room2" type="container" align="lefttop" x="4" y="4" width="117" height="214" maskchildren="true">
    <layer name="spot2" url="skin/mappoint.png" align="lefttop" edge="center" x="61" y="104" zorder="2" onclick="loadscene(scene__DSC2041_Panorama, null, MERGE, BLEND(1));" />
    </layer>

    </layer>


    <!-- radar plugin, will be assigned to be a child of spot -->
    <layer name="radar" keep="true" visible="true"
    url="%SWFPATH%/plugins/radar.swf"
    alturl="%SWFPATH%/plugins/radar.js"
    align="center" edge="center"
    fillcolor="0xFFFFFF" fillalpha="0.5" scale="2.0"
    headingoffset="0"
    />

    <!-- activated spot image (child of the radar layer) -->
    <layer name="activespot" parent="radar" url="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,316);
    tween(height,222);
    </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>


    <!-- the scenes -->
    <scene name="scene__DSC1933_Panorama" onstart="activatespot(spot1, 0);">

    <view hlookat="0" vlookat="0" fov="100" />

    <preview type="grid(cube,32,32,256,0xDD3322,0xCC3322,0xFF0000);" details="16" />

    </scene>

    <scene name="scene__DSC2041_Panorama" onstart="activatespot(spot2, 90);">

    <view hlookat="0" vlookat="0" fov="75" />

    <preview type="grid(cube,32,32,256,0x33DD22,0x33CC22,0x00FF00);" details="16" />


    </scene>

    </krpano>

  • Sorry, but I do not understand what the problem is)
    You have image - map, ok. We know size of this image(HxW, px -see red text in code), right?
    <!-- the image map -->
    <layer name="map" url="imagemap.png" keep="true" align="leftbottom" x="16" y="16" width="316" height="222"
    handcursor="false"
    scalechildren="true"
    maskchildren="true"
    onclick="closemap();"
    >

    Well, we draw "invisible" container(zone, mask) for first room inside of this image(imagemap.png), x="125" y="4" - it's a offset on imagemap.png, align="lefttop", it's a start point for this offset = top left corner of imagemap, and width="187" height="115" - size of this container:
    <!-- 'rooms' and spots - the 'room' container elements were used for masking the radar -->
    <layer name="room1" type="container" align="lefttop" x="125" y="4"
    width="187" height="115"
    maskchildren="true">

    PS: These invisible zones (containers) are only needed if you want to mask the radar beams, inside the walls on the map!

    Next, we set the coordinates for each point of the radar(offset and etc. same as container), inside our invisible container(rectangle mask. This coordinates not inside imagemap.png!):
    <layer name="spot1" url="mappoint.png" align="lefttop" edge="center" x="91" y="59" zorder="2" onclick="loadscene(scene__DSC1933_Panorama, null, MERGE, BLEND(1));" />
    </layer>

    And second zone(container), and coordinates of mappoint inside of this scontainer, for our second room, the same way:
    <layer name="room2" type="container" align="lefttop" x="4" y="4" width="117" height="214" maskchildren="true">
    <layer name="spot2" url="mappoint.png" align="lefttop" edge="center" x="61" y="104" zorder="2" onclick="loadscene(scene__DSC2041_Panorama, null, MERGE, BLEND(1));" />
    </layer>
    </layer>

    And next, you set start angle for our radar beams for each radar points:
    ........
    <scene name="scene__DSC2041_Panorama" onstart="activatespot(spot2, 90);">
    ........

    To understand this, please read the documentation for a start!
    https://krpano.com/docu/xml/#pluginpositioning

    PS: In order to know the coordinates of each zone on your map, open the image in Photoshop(info panel, x,y in pixels ruler) or another editor, and draw outline over the areas that you need, the offset, size and make a note these data!

    Good luck! *thumbup*
    Ars

    Panoreal — to make and see this wonderful world! *whistling*

    Edited 7 times, last by Arsdezi (March 12, 2014 at 5:10 AM).

  • Hi! In your first post the radar plugin had

    Code
    align="righttop" edge="righttop"

    whereas in your second post it had

    Code
    align="center" edge="center"

    when set to "righttop" the radar shifts down to the left. When set to "center" it works okay.

    Regards,

    Alexey

  • Arsdezi, from looking at radar xml I do understand the code. Its seems relatively straight forward, but I still cant seem to find my error. I will look at code again when I get on home computer. If I fail to make correction I may upload to server cause I need radar to work.

    Alexey, the first example I tried to move map to upper right corner, but had difficulty. I then started over and kept map in default location which is bottom left (second post). In both instances the active radar remained in center of pano and not the map! :(

Participate now!

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