Page 1 of 1

How can I show/filter just one node marker

Posted: Wed Jul 15, 2020 1:58 am
by ccyeh0901
Hi~ I am building the floorplan map, and wondering if I can filter just one node marker using node ID or other ID instead of using tag as the filter? found no way from pano2vr javascript API ><
I want to build a search function, in which user enter the keyword, select that node and the node marker (only one) related will be showed on floorplan map. in order to show marker related, I used node id/custom node id to help select that node... but get nowhere >< As to using tag, I think, is useful to filter a group of nodes...

Here is my javascript code to filter tag:
parent.skin._map_2.ggFilter = "sometag";
parent.skin._map_2.ggInitMapMarkers(false);

Any suggestion is much appreciated :)

Re: How can I show/filter just one node marker

Posted: Mon Jul 20, 2020 3:41 pm
by ccyeh0901
I found a way to show only one marker, that is to add tag (using node id) to each node, but it is laborious doing this if the node number is 500 above... Has anyone ever encounter this problem?...help:~~~ :roll:

Re: How can I show/filter just one node marker

Posted: Mon Jul 20, 2020 4:39 pm
by ccyeh0901
I just traced the skin.js and found the filter code:

var ids=player.getNodeIds();
me._map_1.ggFilteredIds = [];
if (me._map_1.ggFilter != '') {
var filter = me._map_1.ggFilter.split(',');
for (i=0; i < ids.length; i++) {
var nodeId = ids;
var nodeData = player.getNodeUserdata(nodeId);
for (var j=0; j < filter.length; j++) {
if (nodeData['tags'].indexOf(filter[j].trim()) != -1) me._map_1.ggFilteredIds.push(nodeId);
}
}
if (me._map_1.ggFilteredIds.length > 0) ids = me._map_1.ggFilteredIds;
}


it looks like it's filtered by tags only.... so I just wonder if there is a way to extend the skin.js function on my own? like in this case, create a function to filter marker by node id.... hope someone can help ...:)

Re: How can I show/filter just one node marker

Posted: Mon Jul 20, 2020 5:53 pm
by ccyeh0901
if (me._map_1.ggFilter != '') {
var filter = me._map_1.ggFilter.split(',');
for (i=0; i < ids.length; i++) {
var nodeId = ids;
var nodeData = player.getNodeUserdata(nodeId);
for (var j=0; j < filter.length; j++) {
//if (nodeData['tags'].indexOf(filter[j].trim()) != -1) me._map_1.ggFilteredIds.push(nodeId);
if (nodeId == filter[j].trim()) me._map_1.ggFilteredIds.push(nodeId); // <= hacked here
}
}
if (me._map_1.ggFilteredIds.length > 0) ids = me._map_1.ggFilteredIds;
}

I hacked the code to achieve this finally... but everytime when generating output it will be overwritten again... ><

Re: How can I show/filter just one node marker

Posted: Mon Jul 20, 2020 8:45 pm
by Hopki
Hi,
Tags are the way to go but to add tags automatically just add nodes in subfolders.
As an example, if you have a three-floor building, add each floor panoramas in their own subfolders, so ground, first and second.
Open and save the project file to the project folder then drag in the folders.
The nodes will use the folder as a tag.
So all the ground floor panoramas will get the tag, ground and so on.
Regards,

Re: How can I show/filter just one node marker

Posted: Tue Jul 21, 2020 1:47 am
by ccyeh0901
Hi~ many thanks to give such useful suggestion, I'll follow that in building large amount of panos project :)