You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Friday, August 20th 2010, 11:51pm

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?

2

Monday, August 23rd 2010, 11:11am

Hi,

do you mean a new xml with a new googlemaps spots?
in this case don't use keep="true" and no KEEP flag on the loadpano() call,

best regards,
Klaus

3

Monday, August 23rd 2010, 3:14pm

Still unable to reload spots from xml on disk

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));

4

Monday, August 23rd 2010, 3:23pm

Hi,

do you have a link to an example?

best regards,
Klaus

5

Tuesday, August 24th 2010, 3:08pm

Update

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

}
}
});
}

I am using a similar function to reload map spots. It reloads all spots. But another problem is that if I call
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?

Paranorma

Beginner

Posts: 20

Location: Russia, St.Petersburg

  • Send private message

6

Monday, March 12th 2012, 9:52am

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.

7

Monday, March 12th 2012, 10:10am

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

Paranorma

Beginner

Posts: 20

Location: Russia, St.Petersburg

  • Send private message

8

Monday, March 12th 2012, 10:46am

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.

9

Tuesday, March 13th 2012, 12:12pm

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:
http://krpano.com/docu/actions/#loadpano

best regards,
Klaus

10

Wednesday, April 11th 2012, 2:01am

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().

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var switchpano=false;

function showAltImg(){

    switchpano=!switchpano;

    var search='.jpg';

    var replace='_alt.jpg';

    if(!switchpano){

   	 search='_alt.jpg';

   	 replace='.jpg';

    }

    var sides=['front','back','left','right','up','down'];

    for(var i=0;i<sides.length;i++){

   	 var src=document.getElementById("krpanoSWFObject").get('image.'+sides[i]+'.url').replace(search,replace);

   	 document.getElementById("krpanoSWFObject").set('image.'+sides[i]+'.url', src);

    }

	document.getElementById("krpanoSWFObject").call('reloadpano();');

}


Please view this example at:
http://archive.cyark.org/manzanar-reloca…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?

11

Monday, April 16th 2012, 6:56pm

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:

Source code

1
2
3
4
5
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

Similar threads