You are not logged in.

xhe

Beginner

  • "xhe" started this thread

Posts: 33

Location: Sunnyvale, California, USA

  • Send private message

1

Thursday, August 29th 2019, 9:56am

loadxml string doesn't work

I was trying to load xml string direclty, this is my code:



Source code

1
2
3
4
5
6
7
8
9
10
11
12
ngOnChanges(changes: SimpleChanges) {
 if (
 'panoXML' in changes &&
 !changes.panoXML.firstChange &&
 changes.panoXML.currentValue !== changes.panoXML.previousValue
 ) {
 console.log('new value:');
 console.log(changes.panoXML.currentValue);
 this.krpano.call('loadxml(' + changes.panoXML.currentValue + ', null, MERGE, BLEND(0.5));');
 }

 }

You can see here, I am using angular 6 to listen to property change, if property changed, then I hope the pano can automatically load the new panorama.

The console log is already printing the xml content like below:

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
32
33
34
35
<krpano onstart="startup();" logkey="false" debugmode="true" showerrors="false">
<include url="%SWFPATH%/plugins/showtext.xml" />
<include url="/assets/lib/krpano/skin/vtourskin.xml"/>

<style name="alt_hotspot_ani_white"
alturl="/assets/panos/demo1/hotspots/hotspot_ani_white_64x64x20.png"
frames="20" framewidth="64" frameheight="64" frame="0"
altonloaded="set(crop,'0|0|64|64'); resetsize(); set(alpha,1.0); hotspot_animate();"
/>
<action name="hotspot_animate">
if(loaded,
inc(frame,1,get(frames),0);
mul(ypos,frame,frameheight);
txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));
delayedcall(0.05, hotspot_animate() );
);
</action>

<action name="startup">
if(startscene === null, set(startscene,get(scene[0].name)) );
loadscene(get(startscene),null,MERGE);
</action>
<view fov="110" fovtype="MFOV" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto"/>
<scene title="my new pano" thumburl="https://guoyi5d-dev-pano.s3-us-west-2.amazonaws.com/123/98853df2d6/thumb.jpg">
<preview url="https://guoyi5d-dev-pano.s3-us-west-2.amazonaws.com/123/98853df2d6/preview.jpg" />
<image>
<cube url="https://guoyi5d-dev-pano.s3-us-west-2.amazonaws.com/123/98853df2d6/web_%s.jpg" />
<mobile>
<cube url="https://guoyi5d-dev-pano.s3-us-west-2.amazonaws.com/123/98853df2d6/mobile_%s.jpg" />
</mobile>
</image>

</scene>

</krpano> 





but in the UI, still the original pano, not changed at all.

anything wrong here?

2

Thursday, August 29th 2019, 10:44am

Hi,

the problem might be related to the escaping, when calling loadxml this way, the xml content should be escaped to avoid parsing conflicts (e.g. when parsing the ',' characters as separators of the loadxml parameters).

Or as you are in JS, better do a direct call to loadxml, then no escaping is necessary,

e.g.

Source code

1
2
var krpanoapi = this.krpano.get("global");
krpanoapi.actions.loadxml(changes.panoXML.currentValue, null, "MERGE", "BLEND(0.5)");


Best regards,
Klaus

xhe

Beginner

  • "xhe" started this thread

Posts: 33

Location: Sunnyvale, California, USA

  • Send private message

3

Thursday, August 29th 2019, 5:49pm

thanks, don't know if you have experienced situation that loading xml is not updating to new pano, but still the old pano.

xhe

Beginner

  • "xhe" started this thread

Posts: 33

Location: Sunnyvale, California, USA

  • Send private message

4

Thursday, August 29th 2019, 7:09pm

are there anyway we can debug and see why pano is not updated even if we have already called loadxml...