Home › Forum › SOFA › Programming with SOFA › How to map pointData in a DataDisplay using C++
Tagged: 64_bits, DataDisplay pointData C++, Linux_ubuntu, SOFA_2006
- This topic has 3 replies, 2 voices, and was last updated 4 years, 2 months ago by Hugo.
-
AuthorPosts
-
30 September 2020 at 04:09 #17228CésarBlocked
How are you,
I am translating a scene from XML to C ++, but I am stuck trying to map a pointData to a DataDisplay using C ++.
Below is an example of what works for me in XML and what I have in C ++. Thanks!
XML
<DataDisplay pointData=”@../dist.distance” />
C++
DataDisplay::SPtr bed_data_DataDisplay = addNew<DataDisplay>(bed_data);
XML
<EvalPointsDistance name=”dist” object1=”@/mesh_bed/MS” object2=”@.” listening=”true” period=”0.05″ draw=”true” /> <Node name=”data”> <DataDisplay pointData=”@../dist.distance” /> <OglColorMap colorScheme=”Blue to Red” /> <IdentityMapping input=”@../.” output=”@.”/> </Node>
C++
valPointsDistance3::SPtr bed_EvalPointsDistance = addNew<EvalPointsDistance3>(bed); bed_EvalPointsDistance->setName(“dist”); bed_EvalPointsDistance->setPeriod(0.05); bed_EvalPointsDistance->setPathToMS1(“@../mesh_bed/.”); bed_EvalPointsDistance->setPathToMS2(“@.”); Node::SPtr bed_data = bed->createChild(“data”); DataDisplay::SPtr bed_data_DataDisplay = addNew<DataDisplay>(bed_data); OglColorMap::SPtr bed_data_OglColorMap = addNew<OglColorMap>(bed_data); bed_data_OglColorMap->f_colorScheme.beginEdit()->setSelectedItem(“Red to Blue”); IdentityMapping3::SPtr bed_data_IdentityMapping = addNew<IdentityMapping3>(bed_data); bed_data_IdentityMapping->setPathInputObject(“@../.”); bed_data_IdentityMapping->setPathOutputObject(“@.”);
5 October 2020 at 22:38 #17285HugoKeymasterI guess you are having an error right? runtime or compilation one?
Could you share it with us please?Best
Hugo
5 October 2020 at 23:19 #17288CésarBlockedHi Hugo.
Thank you for your response. Actually, I am not having an error, I am just figuring out how to implement the following XML in C++, especially this part
<DataDisplay pointData=”@../dist.distance” /> <EvalPointsDistance name=”dist” object1=”@/mesh_bed/MS” object2=”@.” listening=”true” period=”0.05″ draw=”true” /> <Node name=”data”> <DataDisplay pointData=”@../dist.distance” /> <OglColorMap colorScheme=”Blue to Red” /> <IdentityMapping input=”@../.” output=”@.”/> </Node>
This is what I have:
valPointsDistance3::SPtr bed_EvalPointsDistance = addNew<EvalPointsDistance3>(bed); bed_EvalPointsDistance->setName(“dist”); bed_EvalPointsDistance->setPeriod(0.05); bed_EvalPointsDistance->setPathToMS1(“@../mesh_bed/.”); bed_EvalPointsDistance->setPathToMS2(“@.”); Node::SPtr bed_data = bed->createChild(“data”); DataDisplay::SPtr bed_data_DataDisplay = addNew<DataDisplay>(bed_data); OglColorMap::SPtr bed_data_OglColorMap = addNew<OglColorMap>(bed_data); bed_data_OglColorMap->f_colorScheme.beginEdit()->setSelectedItem(“Red to Blue”); IdentityMapping3::SPtr bed_data_IdentityMapping = addNew<IdentityMapping3>(bed_data); bed_data_IdentityMapping->setPathInputObject(“@../.”); bed_data_IdentityMapping->setPathOutputObject(“@.”);
Thank you so much!
9 October 2020 at 23:31 #17340HugoKeymasterAlright @cesar-vargas ! My bad I did not get your point.
Most of it looks correct, just for the OglColorMap I would rather write:
bed_data_OglColorMap->f_colorScheme.setValue("Red to Blue");
Else :+1:
Best
Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.