You are not logged in.

Fernando

Intermediate

  • "Fernando" started this thread

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

1

Tuesday, November 27th 2018, 1:24am

working with 1000+ hotspot [solved]

Hi, please I need a general advice to start a idea:

My project is a plain map with 10 categories, and 100 hotspot each. Total 1000 hs.

What is the most efficient way?

a) To build 10 scenes with 100 hotspot each.
b) Only one scene with 1000 hotspot, only 100 are visibles. (Are the invisible hotspot charged in memory or not?)
c) Dynamically create 100 hotspot (with addhotspot code) when active a category and remove it for other category... then create new 100 hotspot...etc.
d) Other idea?

Please base your answer (Why a), b), c) or another?)


Thanks very much, best regards,
Fernando.

This post has been edited 1 times, last edit by "Fernando" (Nov 27th 2018, 5:42pm)


jordi

Intermediate

Posts: 427

Location: Barcelona

Occupation: creating ideas & coding them

  • Send private message

2

Tuesday, November 27th 2018, 2:39pm

If what you look is performance go for a good C
everpano.com smart virtual tours

3

Wednesday, November 28th 2018, 12:23pm

Hi,

I would say a) or c) depending on your needs.

Hotspot related both cases would be the same.

And for the most efficient way do it via type="Javascript" actions,
e.g.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<action name="test_add_and_remove_100_spots" type="Javascript"><![CDATA[

  // remove all current spots
  while ( krpano.hotspot.count > 0 )
  {
    krpano.actions.removehotspot(0);
  }
  
  // add new spots
  for (var i=0; i < 100; i++)
  {
    var hs = krpano.actions.addhotspot("spot" + i);
    hs.type = "text";
    hs.html = "Spot " + (i+1);
    hs.oversampling = 2;
    hs.ath = Math.random() * 360 - 180;
    hs.atv = Math.random() * 180 - 90;
  }

]]></action>


Best regards,
Klaus

Fernando

Intermediate

  • "Fernando" started this thread

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

4

Wednesday, November 28th 2018, 4:05pm

Thanks, Jordi and Klaus. The "Javascript actions" was comment by Jordi in PV, now with the klaus example it is a little more clear for me.
I was trying the klaus code with 100, 300, 500 until 1000 hotspot... With this useful code I answer my main doubts.

But I would like to know more about action type "javascript", for example: How to convert this xml code to javascript code in order to gain more efficient behavior.
Here my xml code:
This is example for create 100 hs at click "test" button:

Source code

1
2
<layer name="test" type="text" html="create 100 hotel hotspot" 
onclick="creahs_hotel(hotel);"/>


Source code

1
2
3
4
5
6
7
<style 
name="hotel" 
url="%SWFPATH%/../list/img/hs/hotel.png"
scale.normal="0.6"
onloaded.normal="loadstyle(tooltip);"
onloaded.handheld="add_all_the_time_tooltip();"
/>


Source code

1
2
3
4
5
6
7
<action name="creahs">
addhotspot(%1);
assignstyle(hotspot[%1], '%2');
set(hotspot[%1].ath,%3);
set(hotspot[%1].atv,%4);
set(hotspot[%1].tooltip,%5);
</action>


Source code

1
2
3
4
5
6
<action name="creahs_hotel">
creahs(ambos,%1,-0.074434,-0.108655,Hotel # 1 Riviera);
creahs(hlibre,%1,-0.138722,-0.109009,Hotel # 2 Capri);
//(...)
creahs(parque1,%1,-0.091118,-0.106737,Hotel # 100 Comodoro);
</actions>


Best regards,
Fernando

This post has been edited 3 times, last edit by "Fernando" (Nov 30th 2018, 1:41am)