26
26
#include " PreCompiled.h"
27
27
28
28
#ifndef _PreComp_
29
- #include < Inventor/nodes/SoCylinder.h>
30
- #include < Inventor/nodes/SoMaterial.h>
31
- #include < Inventor/nodes/SoRotation.h>
32
- #include < Inventor/nodes/SoSeparator.h>
33
- #include < Inventor/nodes/SoSphere.h>
34
- #include < Inventor/nodes/SoTranslation.h>
35
29
#endif
36
30
37
31
#include " Mod/Fem/App/FemConstraintTemperature.h"
@@ -48,7 +42,9 @@ PROPERTY_SOURCE(FemGui::ViewProviderFemConstraintTemperature,
48
42
ViewProviderFemConstraintTemperature::ViewProviderFemConstraintTemperature()
49
43
{
50
44
sPixmap = " FEM_ConstraintTemperature" ;
51
- ADD_PROPERTY (FaceColor, (0 .2f , 0 .3f , 0 .2f ));
45
+ loadSymbol ((resourceSymbolDir + " ConstraintTemperature.iv" ).c_str ());
46
+
47
+ FaceColor.setValue (1 .0f , 0 .0f , 0 .0f );
52
48
}
53
49
54
50
ViewProviderFemConstraintTemperature::~ViewProviderFemConstraintTemperature () = default ;
@@ -94,92 +90,7 @@ bool ViewProviderFemConstraintTemperature::setEdit(int ModNum)
94
90
}
95
91
}
96
92
97
- #define HEIGHT (1.5 )
98
- #define RADIUS (0.3 )
99
- // #define USE_MULTIPLE_COPY //OvG: MULTICOPY fails to update scaled display on initial drawing -
100
- // so disable
101
-
102
93
void ViewProviderFemConstraintTemperature::updateData (const App::Property* prop)
103
94
{
104
- // Gets called whenever a property of the attached object changes
105
- Fem::ConstraintTemperature* pcConstraint =
106
- static_cast <Fem::ConstraintTemperature*>(this ->getObject ());
107
- float scaledradius =
108
- RADIUS * pcConstraint->Scale .getValue (); // OvG: Calculate scaled values once only
109
- float scaledheight = HEIGHT * pcConstraint->Scale .getValue ();
110
- // float temperature = pcConstraint->temperature.getValue();
111
-
112
- if (prop == &pcConstraint->Points ) {
113
- const std::vector<Base::Vector3d>& points = pcConstraint->Points .getValues ();
114
- const std::vector<Base::Vector3d>& normals = pcConstraint->Normals .getValues ();
115
- if (points.size () != normals.size ()) {
116
- return ;
117
- }
118
- std::vector<Base::Vector3d>::const_iterator n = normals.begin ();
119
-
120
- // Note: Points and Normals are always updated together
121
- Gui::coinRemoveAllChildren (pShapeSep);
122
-
123
- for (const auto & point : points) {
124
- // Define base and normal directions
125
- SbVec3f base (point.x , point.y , point.z );
126
- SbVec3f dir (n->x , n->y , n->z ); // normal
127
-
128
- // / Temperature indication
129
- // define separator
130
- SoSeparator* sep = new SoSeparator ();
131
-
132
- // / draw a temp gauge,with sphere and a cylinder
133
- // first move to correct position
134
- SoTranslation* trans = new SoTranslation ();
135
- SbVec3f newPos = base + scaledradius * dir * 0 .7f ;
136
- trans->translation .setValue (newPos);
137
- sep->addChild (trans);
138
-
139
- // adjust orientation
140
- SoRotation* rot = new SoRotation ();
141
- rot->rotation .setValue (SbRotation (SbVec3f (0 , 1 , 0 ), dir));
142
- sep->addChild (rot);
143
-
144
- // define color of shape
145
- SoMaterial* myMaterial = new SoMaterial;
146
- myMaterial->diffuseColor .set1Value (0 , SbColor (1 , 0 , 0 )); // RGB
147
- // myMaterial->diffuseColor.set1Value(1,SbColor(.1,.1,.1));//possible to adjust sides
148
- // separately
149
- sep->addChild (myMaterial);
150
-
151
- // draw a sphere
152
- SoSphere* sph = new SoSphere ();
153
- sph->radius .setValue (scaledradius * 0.75 );
154
- sep->addChild (sph);
155
- // translate position
156
- SoTranslation* trans2 = new SoTranslation ();
157
- trans2->translation .setValue (SbVec3f (0 , scaledheight * 0.375 , 0 ));
158
- sep->addChild (trans2);
159
- // draw a cylinder
160
- SoCylinder* cyl = new SoCylinder ();
161
- cyl->height .setValue (scaledheight * 0.5 );
162
- cyl->radius .setValue (scaledradius * 0.375 );
163
- sep->addChild (cyl);
164
- // translate position
165
- SoTranslation* trans3 = new SoTranslation ();
166
- trans3->translation .setValue (SbVec3f (0 , scaledheight * 0.375 , 0 ));
167
- sep->addChild (trans3);
168
- // define color of shape
169
- SoMaterial* myMaterial2 = new SoMaterial;
170
- myMaterial2->diffuseColor .set1Value (0 , SbColor (1 , 1 , 1 )); // RGB
171
- sep->addChild (myMaterial2);
172
- // draw a cylinder
173
- SoCylinder* cyl2 = new SoCylinder ();
174
- cyl2->height .setValue (scaledheight * 0.25 );
175
- cyl2->radius .setValue (scaledradius * 0.375 );
176
- sep->addChild (cyl2);
177
-
178
- pShapeSep->addChild (sep);
179
-
180
- n++;
181
- }
182
- }
183
- // Gets called whenever a property of the attached object changes
184
95
ViewProviderFemConstraint::updateData (prop);
185
96
}
0 commit comments