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>

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

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

    Code
    <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/towns/…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:

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

    In the xml file:


    Thank you very much !

  • Hi Tourvista,

    Try the following code for your buildtext action:

    Code
    <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.

  • 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:

    Code
    <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?) *smile*
    PS3: To show the fov look michel post underneath:

    Cheers!

  • Hi machart,

    This modified code will do *wink* :

    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.

  • 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...

    Code
    <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 *wink* ... 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:


    Add the xml file would be:

    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.

  • Hi,

    The code works correctly... but *wink* ....

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

    Code
    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..

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

    This does not happens with the onviewchange event ...

    Code
    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.

  • 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:

    Code
    if(Back_onviewchange === undefined, set(Back_onviewchange,null));
    if(Back_onclick === undefined, set(Back_onclick,null));

    best regards,
    Klaus

  • 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 *wink* )... 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 )...

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

    If you are thinking in include a licence agreement, I will suggest this one *wink* : careware

    SAlut. *smile*

Participate now!

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