Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

Tourvista

Fortgeschrittener

  • »Tourvista« ist der Autor dieses Themas

Beiträge: 246

Wohnort: Leicester UK

  • Nachricht senden

1

Freitag, 11. Dezember 2009, 18:30

Home made solution to find where to place hot spots

UPDATED 15-12-2009



DOWNLOAD:
Coordinates finder

INSTALLATION:
- Unzip in same directory as the HTML file
- Copy and paste the following code inside the HTML file, anywere between the tags <head></head>

Quellcode

1
<script type="text/javascript" src="coord_finder/double_click.js"></script>


-Copy and past the following code in your pano.xml file

Quellcode

1
<include url="%HTMLPATH%/coord_finder/coord_finder.xml"/>


INSTRUCTIONS:
- Right click on the panorama and select 'Coordinates finder - ON'
- Move the panorama and see how the values change
- Alternatively double click on the panorama to obtain the coordinates of that point
- To close it, click on the 'X' or right click and select 'Coordinates finder - OFF'

THANKS:
Michel you are a genius!
And of course thanks to Mr. K for Krpano!

NOTES:
I've included the textfield plugin in order to simplify the "intallation". It is the version 1.0.8-beta8
--------------------------------------------------------------------------------------------------

Hello everybody!

Recently a client asked to be able to create hotspots himself. So I am trying to make things really easy.
I have created an action to create hot spots, so he only has to edit one line in the xml file introducing some parameters.
Of course two of the parameters are "ath "and "atv" so I have made the following "home made hot spot editor":

http://clients.tourvista.co.uk/vt/orca/t…index_orca.html

Please ignore all the buttons, thumbnails and stuff... my "cool" editor consist on:

- A cross in the middle of the window: the plan is that he will move the panorama and choose where he wants to place the hot spot.
- A white button that shows the ath and atv coordinates when is clicked.

Ideally I would like to show the coordinates all the time without the hassle of clicking all the time. Also, if it is possible, I would like to show entire numbers (without decimals). Any ideas?

I know I could use "options.swf" to see those coordinates, but I don't want to confuse the client with such a mixture of parameters and numbers.

A really cool alternative would be to show a little box with the coordinates when he click twice somewhere on the panorama, but I have no idea how to achieve that!

My code is the following:

In the HTML file:

Quellcode

1
so.addVariable("onstart", "action(run_hs_editor); ");


In the xml file:

Quellcode

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
36
37
38
39
40
<!-- ***************** HOT SPOTS EDITOR  ********************** -->
	
	<action name="run_hs_editor">
	
	addplugin(hs_editor);
			set(plugin[hs_editor].url,%HTMLPATH%/files/panos/images/cross.png);
			set(plugin[hs_editor].zorder,5);
			set(plugin[hs_editor].align,center);
			set(plugin[hs_editor].handcursor,false);
			set(plugin[hs_editor].keep,true);	
			
	addplugin(click);
			set(plugin[click].url,%HTMLPATH%/files/panos/images/click.png);
			set(plugin[click].zorder,10);
			set(plugin[click].align,center);
			set(plugin[click].keep,true);	
			set(plugin[click].edge,topleft);	
			set(plugin[click].x,20);
			set(plugin[click].y,20);
			set(plugin[click].onclick,action(buildtext););			
	</action>

	<data name="coordinates"></data>
	
	<action name="buildtext">
	
	  txtadd(data[coordinates].content, get(view.hlookat), ' <br/> ', get(view.vlookat) );
	
		addplugin(hs_coordinates);
			set(plugin[hs_coordinates].url,%HTMLPATH%/files/krpano/textfield.swf);
			set(plugin[hs_coordinates].html,data:coordinates);
			set(plugin[hs_coordinates].width,120);
			set(plugin[hs_coordinates].height,35);
			set(plugin[hs_coordinates].zorder,11);
			set(plugin[hs_coordinates].background,false);
			set(plugin[hs_coordinates].align,center);
			set(plugin[hs_coordinates].x,122);
			set(plugin[hs_coordinates].y,40);
			set(plugin[hs_coordinates].keep,true);
	</action>



Thank you very much !

Dieser Beitrag wurde bereits 5 mal editiert, zuletzt von »Tourvista« (15. Dezember 2009, 20:53)


2

Freitag, 11. Dezember 2009, 18:38

Hi Tourvista,

Zitat

I would like to show entire numbers (without decimals).
There is a new action in krpano 1.0.8 beta 9:

Quellcode

1
roundval(val,precision);


Look here for more info: 1.0.8 beta 9 - fovtype setting

SAlut

Tourvista

Fortgeschrittener

  • »Tourvista« ist der Autor dieses Themas

Beiträge: 246

Wohnort: Leicester UK

  • Nachricht senden

3

Freitag, 11. Dezember 2009, 19:01

Thanks for that Michel!

Unfortunately I've noticed that after a full rotation, the ath value keep on growing instead of reset to 0.
So after 5 full rotations it returns 1600!

*cry*

4

Freitag, 11. Dezember 2009, 19:59

Hi Tourvista,

Try the following code for your buildtext action:

Quellcode

1
2
3
4
5
6
7
8
9
	<action name="buildtext">
	
		mod(hdistance,get(view.hlookat),360);
		roundval(hdistance,0);
		set(vdistance,get(view.vlookat));
		roundval(vdistance,0);

		txtadd(data[coordinates].content, get(hdistance), ' <br/> ', get(vdistance) );
		......


note: I do not know why but the roundval(hdistance,0); adds a . after the value at first... *confused* KLAUS can you explain *question*
SAlut.

Tourvista

Fortgeschrittener

  • »Tourvista« ist der Autor dieses Themas

Beiträge: 246

Wohnort: Leicester UK

  • Nachricht senden

5

Samstag, 12. Dezember 2009, 00:56

Genius! *cool*

It works!
It is true a "dot" appears when hlookat value is between -0.9 and 0.9
I am happy with the result so far.

Thanks!!!

bulp

Fortgeschrittener

Beiträge: 389

Wohnort: Malaysia

  • Nachricht senden

6

Samstag, 12. Dezember 2009, 13:06

GREAT WORK!!! ..

im curently looking into tag! just like google tag or facebook tag that allowed visitor to put comments ...

this is possible ?



bulp...

7

Samstag, 12. Dezember 2009, 14:00

great thing!

is it possible to extend it to show the fov?
__close to the rainbow__
_D300S|Sunwayfoto|iMaci7|PM|APP|KRP_
www.panographie.net

Tourvista

Fortgeschrittener

  • »Tourvista« ist der Autor dieses Themas

Beiträge: 246

Wohnort: Leicester UK

  • Nachricht senden

8

Samstag, 12. Dezember 2009, 14:11

Hi all,

I have updated it.

In order to see it you have to right click and select "Corrdinates finder" (the first option)

If someone wants to use it or modify it you can download it here:

It contains an xml file and a folder with two graphics,
What I do is to add it to my virtual tours is to write the following:

Quellcode

1
<include url="coord_editor.xml"/>


If it doesn't work for you, check the path to the images.

PS: I've set it up to show a decimal in order to avoid the 0. issue
PS2: I've never heard of google or facebook tags (am I getting old fashion?) :-)
PS3: To show the fov look michel post underneath:

Cheers!

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Tourvista« (12. Dezember 2009, 14:31)


9

Samstag, 12. Dezember 2009, 14:17

Hi machart,

This modified code will do ;-) :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
	<action name="buildtext">
	
		mod(hdistance,get(view.hlookat),360);
		roundval(hdistance,0);
		set(vdistance,get(view.vlookat));
		roundval(vdistance,0);
		set(fovdistance,get(view.fov));
		roundval(fovdistance,0);

		txtadd(data[coordinates].content, get(hdistance), ' <br/> ', get(vdistance), ' <br/> ', get(fovdistance) );
	
		addplugin(hs_coordinates);
			set(plugin[hs_coordinates].url,%SWFPATH%/plugins/textfield.swf);
			set(plugin[hs_coordinates].html,data:coordinates);
			set(plugin[hs_coordinates].width,120);
			set(plugin[hs_coordinates].height,50);


note: line 16 -- set(plugin[hs_coordinates].height,50); (needed to make the fov visible)
also, the click.png should be adapted to fit with the new value (more height)

SAlut.

10

Samstag, 12. Dezember 2009, 14:19

Hi tourvista,

That is great you share... Really great... *thumbup*

SAlut.

11

Samstag, 12. Dezember 2009, 15:01

ahh, thank you, guys! *thumbup*
__close to the rainbow__
_D300S|Sunwayfoto|iMaci7|PM|APP|KRP_
www.panographie.net

Tourvista

Fortgeschrittener

  • »Tourvista« ist der Autor dieses Themas

Beiträge: 246

Wohnort: Leicester UK

  • Nachricht senden

12

Samstag, 12. Dezember 2009, 15:14

Using Michel code, I have created a more propitiated interface:



You can download it here

Cheers!

13

Samstag, 12. Dezember 2009, 23:30

@Tourvista & Michel

Zitat

note: I do not know why but the roundval(hdistance,0); adds a . after the value at first... *confused* KLAUS can you explain *question*
that's a flashplayer bug! (the as3 tofixed() function returns that)
I have now added a quick workaround for it (the next release will not have this problem)

best regards,
Klaus

14

Montag, 14. Dezember 2009, 19:28

Hi Tourvista,

Great the context menu to activate the Coordinates finder *attention* *thumbup*
Perhaps you would edit your first post for tell about this change ... (the first time I has returned to the link, I was not able to see the cursor *g* )

Ideally I would like to show the coordinates all the time without the hassle of clicking all the time.
This can be done using the onviewchange event...

Quellcode

1
<events onviewchange="action(buildtext);"/>


A really cool alternative would be to show a little box with the coordinates when he click twice somewhere on the panorama, but I have no idea how to achieve that!
This can be done too ;-) ... an onDoubleClick event can be simulated using JavaScript. See this thread for more info: OnDoubleClick -- MoveTo() -- ScreenToSphere()

So, using the explained above, a possible code would be:
Add the following JavaScript code inside your html file:

Quellcode

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
<script type="text/javascript">
// <![CDATA[

function krpano() {
	return document.getElementById("krpanoSWFObject");
	}

function krpanodbclick(arg) {
	setTimeout("numclick = 0",300);
	numclick = numclick + 1;
	if (numclick == 2) {
		eval(arg);
		}
	}

function movetoscreentosphere() {

	var mousex = krpano().get("mouse.x");
	var mousey = krpano().get("mouse.y");
	var hvs = krpano().get("screentosphere("+mousex +","+mousey +")");
	var hva = hvs.split(",");

	var ath = Number( hva[0] );
	var atv = Number( hva[1] );

	krpano().call("moveto("+ ath +","+ atv +")");

	}

// ]]>
</script>

Add the xml file would be:

Quellcode

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!-- ***************** HOT SPOTS EDITOR  ********************** -->
	
	<contextmenu fullscreen="false">
		<item	name="coord_finder" 
				caption="Coordinates finder - ON" 	
				onclick="action(run_hs_editor); " 
				/>
	</contextmenu>
	
	<action name="run_hs_editor">
	
	copy(Back_onviewchange,events.onviewchange);
	copy(Back_onclick,events.onclick);
	
	set(events.onviewchange,action(buildtext););
	set(events.onclick,js(krpanodbclick(movetoscreentosphere())););	
	
	addplugin(hs_editor);
			set(plugin[hs_editor].url,%HTMLPATH%/images/cross.png);
			set(plugin[hs_editor].zorder,5);
			set(plugin[hs_editor].align,center);
			set(plugin[hs_editor].handcursor,false);
			set(plugin[hs_editor].keep,true);	
			
	addplugin(click);
			set(plugin[click].url,%HTMLPATH%/images/click.png);
			set(plugin[click].zorder,10);
			set(plugin[click].align,center);
			set(plugin[click].keep,true);	
			set(plugin[click].edge,topleft);	
			set(plugin[click].x,20);
			set(plugin[click].y,20);
			set(plugin[click].onclick,action(close_hs_editor););

	set(contextmenu.item[coord_finder].caption,Coordinates finder - OFF);
	set(contextmenu.item[coord_finder].onclick,action(close_hs_editor));
	
	action(buildtext);
	
	</action>
	
	<action name="close_hs_editor">
	
	set(events.onviewchange,get(Back_onviewchange));
	set(events.onclick,get(Back_onclick));
	
	removeplugin(hs_editor);				
	removeplugin(click);	
	removeplugin(hs_coordinates);

	set(contextmenu.item[coord_finder].caption,Coordinates finder - ON);
	set(contextmenu.item[coord_finder].onclick,action(run_hs_editor));
	
	</action>

	<data name="coordinates"></data>
	
	<action name="buildtext">
		
		mod(hdistance,get(view.hlookat),360);
		roundval(hdistance,0);
		set(vdistance,get(view.vlookat));
		roundval(vdistance,0);
		set(fovdistance,get(view.fov));
		roundval(fovdistance,0);

		txtadd(data[coordinates].content, get(hdistance), ' <br/> ', get(vdistance), ' <br/> ', get(fovdistance) );

		addplugin(hs_coordinates);
			set(plugin[hs_coordinates].url,%SWFPATH%/plugins/textfield.swf);
			set(plugin[hs_coordinates].html,data:coordinates);
			set(plugin[hs_coordinates].css,p{font-family:Arial;font-weight:bold;font-size:14;text-align:center;});
			set(plugin[hs_coordinates].width,40);
			set(plugin[hs_coordinates].height,50);
			set(plugin[hs_coordinates].zorder,11);
			set(plugin[hs_coordinates].background,false);
			set(plugin[hs_coordinates].align,center);
			set(plugin[hs_coordinates].x,135);
			set(plugin[hs_coordinates].y,45);
			set(plugin[hs_coordinates].keep,true);
	</action>


Some explanation of the xml...
changes for the contextmenu to make an Coordinates finder on/off :
line 5 -- changed the caption for the contextmenu item : Coordinates finder - ON
lines 35 -- setting the caption for the contextmenu item : Coordinates finder - OFF
lines 36 -- setting the onclick for the contextmenu item : action(close_hs_editor)
lines 51 -- setting the caption for the contextmenu item : Coordinates finder - ON
lines 52 -- setting the onclick for the contextmenu item : action(run_hs_editor)

changes inside the action(run_hs_editor):
lines 12 -- Back_onviewchange... a variable to retrieve the value of event onviewchange if already exist...
lines 13 -- Back_onclick... a variable to retrieve the value of event onclick if already exist...
lines 15 -- set the event onviewchange to call the action(buildtext); on each view change...
lines 16 -- set the event onclick to call the javascript js(krpanodbclick(movetoscreentosphere())); that simulate an ondoubleclick...
lines 33 -- change the onclick to close the Coordinates finder instead of display the coordinates...
lines 35,36 -- see above contextmenu
lines 38 -- caling the action(buildtext); to force displaying the coordinates at first...

Added a new action to close the Coordinates finder -- action(close_hs_editor):
line 44 -- set back the event onviewchange...
line 45 -- set back the event onclick...
lines 47-49 -- removing the plugings of the Coordinates finder
lines 51,52 -- see above contextmenu

OUF !!! That's all *smile* . I think all it's correct. Comments are welcome...

SAlut.

Tuur

Erleuchteter

Beiträge: 2 774

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

15

Montag, 14. Dezember 2009, 20:32

Like it !!

very nice!

Thanks!!

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

16

Montag, 14. Dezember 2009, 21:25

Hi,

Thank you Tuur, the major merit is for Tourvista of course *thumbup* . I am just trying to improve the code and LEARN *attention* *smile* .

17

Montag, 14. Dezember 2009, 22:47

Hi,

The code works correctly... but ;-) ....

There is a WARNING: using the xml code above: http://www.krpano.com/forum/wbb/index.ph…10173#post10173

Quellcode

1
WARNING: unknown action command: undefined


The problem appear when the onclick event is not defined at first...
line 45 try to redefine it back again and fails..

Quellcode

45
set(events.onclick,get(Back_onclick));


This does not happens with the onviewchange event ...

Quellcode

44
set(events.onviewchange,get(Back_onviewchange));


So, I do not understand why this happends with the onclick event...

I have noticed that when the events are not defined at first:
trace(events.onviewchange); ---> result on : null
trace(events.onclick); ---> result on : undefined

It seems the onviewchange event it is defined by default... then hi returns null...
but onclick event seems to not be defined by default and returns undefined....

I have tried many ways (IF...) to solve this WARNING without success...

KLAUS can you explain what is the problem and give a solution *question* *squint* Thank you in advance *thumbup*

SAlut.

18

Dienstag, 15. Dezember 2009, 00:33

KLAUS can you explain what is the problem and give a solution *question* *squint* Thank you in advance
Hi,

you're right!
the "onclick" event was not set to 'null' initially, but to the flash default 'undefined'...
(but that's not intended, in the next release it (and all other events) will be null at start)

with the krpano.swf from the tools 1.0.8 beta 9 you could fix
that warning for the moment for example with this check:

Quellcode

1
2
if(Back_onviewchange === undefined, set(Back_onviewchange,null));
if(Back_onclick === undefined, set(Back_onclick,null));


best regards,
Klaus

19

Dienstag, 15. Dezember 2009, 00:43

Hi Klaus,

Thank you *smile* === *thumbup*

I had tried:
if(events.onclick == undefined, set(Back_onclick,null));
and many others.... No one has worked. *g* *g* *g*

SAlut.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »michel« (15. Dezember 2009, 14:41)


20

Dienstag, 15. Dezember 2009, 20:30

Hi Tourvista,

*thumbsup* great... your last edited DOWNLOAD and simple INSTALLATION process (UPDATED 15-12-2009 )... *thumbup*

Only one note: You have included the textfield.swf (to simplify the install I supose ;-) )... But I think you must notify the version you give!!! Because each version of Krpano needs his own version of plugins like the textfield.swf... KLAUS explains this somewhere but I am not able now to find where *sad* .

Also, you can add the following code after line 13 to avoid an WARNING on current versions of Krpano (see here )...

Quellcode

14
if(Back_onclick === undefined, set(Back_onclick,null));


If you are thinking in include a licence agreement, I will suggest this one ;-) : careware

SAlut. *smile*

Ähnliche Themen