• Hello,

    I use Hotspots to mark several spots in my Gigapixels (Restaurants, Mountains, ...) - and I want to show/hide them independently (group wide)
    How can I achive this? (Group Hotspots together)
    Tried it with a parent Hotspot - but if I hide the parent Hotspot - the children stay visible? Do I miss something?

    Thank you
    Andreas Schnederle-Wagner

  • Add group attribute to hotspot object:

    Code
    <hotspot name ="..." ... group="restaurants"  ... />
    <hotspot name ="..." ... group="hotels"  ... />
    <hotspot name ="..." ... group="hotels"  ... />

    And create an action with loop to control groups:

    Code
    <action name="switchHotspots">
        for(set(i, 0), i LT hotspot.count, inc(i), 
            if(hotspot[get(i)].group == %1, 
                switch(hotspot[get(i)].visible);
            );
        );
    </action>

    Each time you will call this function with goup's name, you will switch their visibility:

    eg:

    Code
    ... onclick="switchHotspots(hotels)"...
  • good one. I am thinking about what in case that one points can be in several groups. You turn off first group but as there are other groups with this point is means it must stay visible until last group is deactivated. What ideas you have in that direction.

  • I would use testing substring. Something like that:

    Hotspots (use several group names separated by eg. comma):

    Code
    <hotspot name="h1" ... group="hotels,restaurants" ... />
    <hotspot name="h2" ... group="hotels" ... />
    <hotspot name="h3" ... group="restaurants" ... />

    And action:

    Code
    <action name="switchHotspots">
    	
        for(set(i, 0), i LT hotspot.count, inc(i), 
            indexoftxt(sindex, hotspot[get(i)].group, %1);
            if(sindex GE 0, 
                switch(hotspot[get(i)].visible);
            );
        );
    </action>

    It's not the best solution but in most cases should work fine.

  • I got your point but this is not on the right way. When one of the group element is turned off you should somehow mark this item in the pin group as turned off. Only when all items assigned to this point were turned off the pin visibility should be also turned off. I have developed algorithm for this but it is to slow and complex in Krpano. Now I'm thinking loud with you to stretch the brain searching for some quick and dirty but working solution.

    Imagine one panorama that you want to be part of: Restaurant, Park, Main Square. You have check box on the GUI for switching some POI on and off. In case one point have only one group it is clear, but when one point is assigned to several POIs than you have to make checks if more than one POI assigned and than check status of all POIs. That's why I asked if there is a way to easy define two dimensional array to work with. Unfortunately not so...I still think about other possibilities.


    Thanks for thinking with me, loud *thumbup*

  • The question was "how to control group of hotspots". So I gave simple solution. But you are talking about complex solution: storing data, saving status etc. I think the only reliable way is storing data in arrays (2 or even 3 if you want to make many-to-many data model) and then make hotspots and checkbox dynamically. I use this technique in many of my projects.

    One of them is http://ai360.pl/projekty/rawik/ - interactive map based on KRPano. All data are stored in xml file (http://ai360.pl/projekty/rawik/data.xml). Groups and hotspots are in a one-to-many relationship. But creating many-to-many relationship also shouldn't be a problem.

  • Yeah, you are right. I turned away from the topic. Your suggestion and example will be helpful for the initial question.
    Maybe I should open new topic for many to many relation and searching with the community for some solution that will not be so demanding for krpano.

  • Hi panomaster,

    thank you for your elegant solution! *wink*
    Didn't even know there is "group" parameter for hotspots! (not mentioned in XML doc?)

    In the meantime I already solved this problem pretty similiar - but I did not use the group parameter but the parent parameter and cycle through it. But I guess I will change it to group - it's more transparent! :)

    Andreas

  • There is no group parameter. You can define your own parameters next to those defined by the Krpano. E.g. you can add paramenter: checked="false" and use it afterwards. Or what ever you need.


    alright - that explains a lot ... hehe ... thank you!
    Not too much knowledge about krpano XML yet ... but it's getting better! :)

Participate now!

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