From b52b78f29741aa03bae506f431754d3e1b8258a9 Mon Sep 17 00:00:00 2001 From: gdd Date: Wed, 11 May 2011 20:27:15 +0000 Subject: [PATCH] Fix when getting values from hypothesis --- src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx | 47 +++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx index bc91a1e..d24ad09 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx @@ -634,9 +634,9 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& h_data.myEnforcedVertices.clear(); for (int i=0 ; ilength() ; i++) { TEnfVertex* myVertex; - myVertex->name = vertices[i].name; - myVertex->geomEntry = vertices[i].geomEntry; - myVertex->groupName = vertices[i].groupName; + myVertex->name = CORBA::string_dup(vertices[i].name.in()); + myVertex->geomEntry = CORBA::string_dup(vertices[i].geomEntry.in()); + myVertex->groupName = CORBA::string_dup(vertices[i].groupName.in()); myVertex->size = vertices[i].size; if (vertices[i].coords.length()) { for (int c = 0; c < vertices[i].coords.length() ; c++) @@ -714,27 +714,29 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD TEnfVertexList::const_iterator it; for(it = h_data.myEnforcedVertices.begin() ; it != h_data.myEnforcedVertices.end(); it++ ) { TEnfVertex* enfVertex = (*it); - double x = enfVertex->coords.at(0); - double y = enfVertex->coords.at(1); - double z = enfVertex->coords.at(2); - double size = enfVertex->size; - MESSAGE("(" << x << ", " - << y << ", " - << z << ") = " - << size ); - double mySize; - try { - mySize = h->GetEnforcedVertex(x,y,z); - MESSAGE("Old size: " << mySize); - if (mySize != size) { + if (enfVertex->coords.size()) { + double x = enfVertex->coords.at(0); + double y = enfVertex->coords.at(1); + double z = enfVertex->coords.at(2); + double size = enfVertex->size; + MESSAGE("(" << x << ", " + << y << ", " + << z << ") = " + << size ); + double mySize; + try { + mySize = h->GetEnforcedVertex(x,y,z); + MESSAGE("Old size: " << mySize); + if (mySize != size) { + MESSAGE("Setting new size: " << size); + h->SetEnforcedVertex(x,y,z,size); + } + } + catch (...) { MESSAGE("Setting new size: " << size); - h->SetEnforcedVertex(x,y,z,size); + h->SetEnforcedVertex( x, y, z, size); } } - catch (...) { - MESSAGE("Setting new size: " << size); - h->SetEnforcedVertex( x, y, z, size); - } } } catch ( const SALOME::SALOME_Exception& ex ) @@ -765,6 +767,9 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisDat for (int i=0 ; irowCount() ; i++) { TEnfVertex *myVertex; + myVertex->name = ""; + myVertex->geomEntry = ""; + myVertex->groupName = ""; myVertex->coords.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble()); myVertex->coords.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble()); myVertex->coords.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble()); -- 2.39.2