Unable to reload xml with new hotspots and spots from disk

  • I was able to load dynamic hotspots and spots into krpano. But I was not able to reload an xml containing new hotspots and spots from disk. The new xml file is created dynamically by a webservice. This is issue is related to another post (request - load spot data from "other" source) but I need to reload the xml from disk each time a spot or hotspot is clicked. Without leaving fullscreen, new spots and hotspots should be displayed. How can I do this?

  • I tried removing keep=true inside the plugin map definition but the map disappears and the xml is not reloaded from disk when I call
    loadpano('%CURRENTXML%/%1', null, MERGE, BLEND(1));

  • I am using javascript now. This way I can load and reload spots and hotspots dynamically. But I have a new problem: some hotspots don't appear on the image. The code below loads the picture and then adds many hotspots (for example, 10). How can I have all hotspots appear?



    function getSVPOption(pano) {[size=10]
    $.ajax({async: [color=#0000ff][size=10][color=#0000ff][size=10]false[size=10],[size=10]
    url: [color=#a31515][size=10][color=#a31515][size=10]'<%= Url.Action("getSVPOption","Image") %>?pano='[size=10] + pano,dataType: [color=#a31515][size=10][color=#a31515][size=10]"json"[size=10],[size=10]
    success: [color=#0000ff][size=10][color=#0000ff][size=10]function[size=10](data1) {[color=#0000ff][size=10][color=#0000ff][size=10]var[size=10] k = document.getElementById([color=#a31515][size=10][color=#a31515][size=10]"krpanoSWFObject"[size=10]);[size=10]
    k.call([color=#a31515][size=10][color=#a31515][size=10]"loadpano(null,sphere="[size=10] + data1.PanoProvider.Tiles.TileUrl + [color=#a31515][size=10][color=#a31515][size=10]",keepbase);"[size=10]);k.call([color=#a31515][size=10][color=#a31515][size=10]"showtext('"[size=10] + data1.PanoProvider.Location.Description + [color=#a31515][size=10][color=#a31515][size=10]"','description');"[size=10]);[size=10]
    k.[color=#0000ff][size=10][color=#0000ff][size=10]set[size=10]([color=#a31515][size=10][color=#a31515][size=10]"view.hlookat"[size=10], data1.Pov.Heading);k.[color=#0000ff][size=10][color=#0000ff][size=10]set[size=10]([color=#a31515][size=10][color=#a31515][size=10]"view.vlookat"[size=10], data1.Pov.Pitch);[size=10]
    [color=#0000ff][size=10][color=#0000ff][size=10]var[size=10] link = data1.PanoProvider.Links;[color=#0000ff][size=10][color=#0000ff][size=10]for[size=10] (i = 0; i < link.length; i++) {[size=10]
    k.call([color=#a31515][size=10][color=#a31515][size=10]"addhotspot(link"[size=10] + link[i].Pano + [color=#a31515][size=10][color=#a31515][size=10]");"[size=10]);k.[color=#0000ff][size=10][color=#0000ff][size=10]set[size=10]([color=#a31515][size=10][color=#a31515][size=10]"hotspot["[size=10] + link[i].Pano + [color=#a31515][size=10][color=#a31515][size=10]"].url"[size=10], [color=#a31515][size=10][color=#a31515][size=10]"%SWFPATH%/hotspot.png"[size=10]);[size=10]
    k.[color=#0000ff][size=10][color=#0000ff][size=10]set[size=10]([color=#a31515][size=10][color=#a31515][size=10]"hotspot["[size=10] + link[i].Pano + [color=#a31515][size=10][color=#a31515][size=10]"].ath"[size=10], link[i].Heading);k.[color=#0000ff][size=10][color=#0000ff][size=10]set[size=10]([color=#a31515][size=10][color=#a31515][size=10]"hotspot["[size=10] + link[i].Pano + [color=#a31515][size=10][color=#a31515][size=10]"].onhover"[size=10], [color=#a31515][size=10][color=#a31515][size=10]"showtext('"[size=10] + link[i].Description + [color=#a31515][size=10][color=#a31515][size=10]"')"[size=10]);[size=10]k.[color=#0000ff][size=10][color=#0000ff][size=10]set[size=10]([color=#a31515][size=10][color=#a31515][size=10]"hotspot["[size=10] + link[i].Pano + [color=#a31515][size=10][color=#a31515][size=10]"].onclick"[size=10], [color=#a31515][size=10][color=#a31515][size=10]"update_all("[size=10] + link[i].Pano + [color=#a31515][size=10][color=#a31515][size=10]")"[size=10]);[size=10]

    }
    }
    });
    }

    I am using a similar function to reload map spots. It reloads all spots. But another problem is that if I call [color=#a31515][size=10][color=#a31515][size=10][color=#a31515][size=10]
    plugin[map].resetspots before loading new spots, all previous and new spots disappear from the map. How can I start with an empty map to load the new array of spots?

  • I also can not load the saved pano xml file with the new hotspots. My script (plugin) creates a new hotspots dynamically and saves the pano xml file to disk. Next comes the loadpano command. I tried various combinations of parameters and loadpano
    flags. Panorama is loaded with no new
    hotspots
    . The spots appear only after a full load through the main file (krpano.xml). This is a serious inconvenience.

  • Hi,

    are you now talking about hotspots or googlemaps spots?
    remember you have posted in the googlemaps sub-forum? wysiwyg image

    beside of that - adding the hotspots this way shouldn't be a problem as long as the hotspots names don't start with a number - is this the case?

    and the code itself seems to have a bug,
    when creating the hotspot by addhotspot you use "link"+link.Pano as hotspot name,
    but later when setting the values you are using link.Pano as hotspot name:

    k.call("addhotspot(link" + link.Pano + ");");
    k.set("hotspot[" + link.Pano + "].url", "%SWFPATH%/hotspot.png");

    best regards,
    Klaus

  • Thanks for the reply, Klaus!
    This is a simple hotspots, not Google. I'm creating hotspots by direct editing of the control xml pano file of my plug-in interface. Hotspots have names like "hs" + number. I guess when you reload the xml pano file (loadpano(pano.xml)) must be loaded all the hotspots recorded in it. But this does not happen. Hotspots begin to appear only when a global reset of the project (reload krpano.xml). If I load only the control file with the panorama (pano.xml), the point does not appear.

  • Hi,

    there is no reason why this shouldn't work, technically there is no difference compared to loading an other xml files and loading new xml files with new hotspots is definitively working,

    have you verified that the xml itself is okay and that the loading works and no browser caching or so causing the problem?

    btw - what do you mean with 'load only the control file' ?
    you know - when loading just a new xml by loadpano (without KEEPHOTSPOTS) then alls hotspots (without keep=true) of the current pano will be removed of course, this is the normal behavior,

    see here:
    https://krpano.com/docu/actions/#loadpano

    best regards,
    Klaus

  • I have a similar problem, except I'm using reload(), not loadpano(), so I don't think the KEEPALL stuff is available to me. I have a pano, and I want to show a simple before/after kinda thing. I go through the six faces, adjust their src to a different path for the jpg. That doesn't do anything (as your documentation notes), so I have to call reload() which actually grabs and displays the new images. The problem is, my hotspots are gone! Why would those be affected if the scene is the exact same and I'm just swapping out the src of some images?

    Here's the code, it's really simple. Figure if you want the before or after, then adjust the src values, then call reload().

    Please view this example at:
    http://archive.cyark.org/manzanar-reloc…ter-virtualtour

    Click the little blue "bump" at the bottom to see the problem. There is a hotspot (due south) that goes to other panos that disappear.

    I know about the keep="all" in the <hotspot>, but I don't want to do that because if I leave the pano, I want new hotspots.

    I understand why you would wipe the hotspots on loadpano(). But would would you wipe the hotspots on reload()?

    What should I do?

  • Hi,

    sorry, but this is a limitation of the current reloadpano() action,
    that action itself doesn't have any keep flags so only the keep="true" elements will be kept,

    maybe try that:

    1. saving the current keep setting from all elements
    2. then set keep=true for all elements
    3. call reloadpano
    4. restore the saved keep settings


    e.g. as xml code:

    Code
    for(set(i,0), i LT plugin.count, inc(i), copy(plugin[get(i)].keepbackup,plugin[get(i)].keep);set(plugin[get(i)].keep,true); );
    for(set(i,0), i LT hotspot.count, inc(i), copy(hotspot[get(i)].keepbackup,hotspot[get(i)].keep);set(hotspot[get(i)].keep,true); );
    reloadpano();
    for(set(i,0), i LT plugin.count, inc(i), copy(plugin[get(i)].keep,plugin[get(i)].keepbackup); );
    for(set(i,0), i LT hotspot.count, inc(i), copy(hotspot[get(i)].keep,hotspot[get(i)].keepbackup); );

    best regards,
    Klaus

Participate now!

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