"getImageWidth": function (node) {
return 50;
},
"getImageHeight": function (node) {
return 50;
},
Let me know if you need any help or more info for your implementation and do not esitate to send me your feedback or feature request on Popoto.js.
Thanks,Frederic
popoto.provider.nodeProviders = {
"EMAIL": {
"returnAttributes": ["email","name", "uid"],
popoto.provider.nodeProviders = {
"WINDOW": {
"returnAttributes": ["dimension","name", "uid"],
........................Hi Mehmet,
Sorry for the late reply I was in vacation for the past two weeks.
I’m really happy if Popoto can be useful for your project.
I think Popoto still lacks some event customization on graph manipulation but maybe this feature can be useful for your use case:
I added an example using movie dataset where you can select an instance object (Person or movie) which reset the graph and uses it as root value:
http://www.popotojs.com/live/node-images/selection.html
You can look directly in the source code of the page to see the full code with comments.
In this example I added a global variable (instanceData) which can contain an instance object (for example a movie or a person)
I added a few instances objects in the UI next to the graph displayed as clickable images (in your use case it could be instances coming from your 3D model)
<img height="100" width="68" src="../node-images-filter/persons/Tom%20Hanks.jpg" onclick="selectInstance('Person', {name:'Tom Hanks'})">
When the image is clicked the function selectInstance is called with its data.
This function saves the data in the “instanceData” variable and resets the graph.
Then for this variable to be used I customized the popoto.graph.Events.NODE_ROOT_ADD event fired when root node is added to the graph to set an initial value.
popoto.graph.on(popoto.graph.Events.NODE_ROOT_ADD, rootNodeListener);
The "rootNodeListener" actually just set the instance node value in the graph if the variable is set
var rootNodeListener = function (rootNode) {
// Only change root node data if instanceData is defined
if (instanceData) {
// Change root node type and label with instanceData
rootNode.value = {
type: popoto.graph.node.NodeTypes.VALUE,
label: instanceData.label
};
rootNode.value.attributes = instanceData.attributes;
// Set node as immutable, in this state the value cannot be deselected.
rootNode.immutable = true;
}
};
For your second question, Popoto still dont have event listeners on node selection, I think I'll add them in future.
Maybe you can use the popoto.result.onResultReceived event customization to update your 3D model
In the example I customized it to display the selection in a div just below the cypher query when the results contains only one element:
popoto.result.onResultReceived(
function (resultObjects) {
// Only display selected data if results contains only one element
if (resultObjects.length == 1) {
var html = "";
for (var property in resultObjects[0].attributes) {
if (resultObjects[0].attributes.hasOwnProperty(property)) {
html = html + property + ":'" +
resultObjects[0].attributes[property] + "'<br>";
}
}
// Display and set div content with selection.
d3.select("#selection").style("display", "block").html(html);
} else {
d3.select("#selection").style("display", "none").html("");
}
}
);
Let me know if you need more info or if it doesn't fit your use case.