How can I show/filter just one node marker

Special forum to share and discuss skins for Pano2VR and Object2VR
Post Reply
ccyeh0901
Posts: 17
Joined: Tue Jul 14, 2020 11:51 am

Wed Jul 15, 2020 1:58 am

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 :)
ccyeh0901
Posts: 17
Joined: Tue Jul 14, 2020 11:51 am

Mon Jul 20, 2020 3:41 pm

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:
ccyeh0901
Posts: 17
Joined: Tue Jul 14, 2020 11:51 am

Mon Jul 20, 2020 4:39 pm

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 ...:)
ccyeh0901
Posts: 17
Joined: Tue Jul 14, 2020 11:51 am

Mon Jul 20, 2020 5:53 pm

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... ><
User avatar
Hopki
Gnome
Posts: 11279
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Mon Jul 20, 2020 8:45 pm

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,
Hopki
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
ccyeh0901
Posts: 17
Joined: Tue Jul 14, 2020 11:51 am

Tue Jul 21, 2020 1:47 am

Hi~ many thanks to give such useful suggestion, I'll follow that in building large amount of panos project :)
Post Reply