X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHEXABLOCK%2FHexGroup.cxx;h=7f66196eb2a66fc8ff6f009792313b2c0ac673c8;hb=76a04c833d6dbc5affe2455f372fb625050f5746;hp=0871dcaf6aa8e0d3c83c28aaef3bfbc187211c1b;hpb=6924a056f811baefa30f31083b93b10f7dae3a35;p=modules%2Fhexablock.git diff --git a/src/HEXABLOCK/HexGroup.cxx b/src/HEXABLOCK/HexGroup.cxx old mode 100755 new mode 100644 index 0871dca..7f66196 --- a/src/HEXABLOCK/HexGroup.cxx +++ b/src/HEXABLOCK/HexGroup.cxx @@ -1,12 +1,12 @@ // C++ : Implementation des groupes -// Copyright (C) 2009-2013 CEA/DEN, EDF R&D +// Copyright (C) 2009-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,34 +21,25 @@ // #include "HexGroup.hxx" -#include "HexEltBase.hxx" #include "HexXmlWriter.hxx" BEGIN_NAMESPACE_HEXA -int Group::last_grp_id = 0; static const cpchar kind_name[] = { "HexaCell", "QuadCell", "EdgeCell", - "HexaNode", "QuadNode", "EdgeNode", "VertexNode" }; + "HexaNode", "QuadNode", "EdgeNode", "VertexNode" }; // ======================================================== Constructeur -Group::Group (cpchar nom, EnumGroup grp) +Group::Group (Document* dad, cpchar nom, EnumGroup grp) + : EltBase (dad, EL_GROUP) { - grp_id = last_grp_id++; + std::string name = std::string(nom); + name.erase (name.find_last_not_of (" \n\r\t" ) + 1); + name.erase (0, name.find_first_not_of (" \n\r\t" )); - //Initialisation du nom du groupe: un nom par défaut est donné s'il n'est pas fourni - std::string _nom = std::string(nom); - _nom.erase (_nom.find_last_not_of (" \n\r\t" ) + 1); - _nom.erase (0, _nom.find_first_not_of (" \n\r\t" )); - if (!_nom.empty()) - grp_name = _nom; - else { - char buffer [16]; - sprintf (buffer, "g%04d", grp_id); - grp_name = std::string(buffer); - } + if (NOT name.empty()) + setName (name); grp_kind = grp; - switch (grp_kind) { case HexaCell : case HexaNode : @@ -113,7 +104,7 @@ void Group::saveXml (XmlWriter* xml) xml->addMark ("Group"); xml->openMark ("Identification"); - xml->addAttribute ("name", grp_name); + xml->addAttribute ("name", el_name); xml->addAttribute ("kind", kind_name [grp_kind]); xml->closeMark (); @@ -128,14 +119,6 @@ void Group::saveXml (XmlWriter* xml) } xml->closeMark (); } - -// ========================================================= getNextName -char* Group::getNextName (pchar buffer) -{ - sprintf (buffer, "g%04d", last_grp_id); - return buffer; -} - // ======================================================== getKind EnumGroup Group::getKind (cpchar kind) {