Skip to content

Commit b8c5d19

Browse files
lelandaisbnicolaslg
authored andcommitted
DescriptionServices added for GeomEntity instances
1 parent 1376ace commit b8c5d19

File tree

11 files changed

+831
-3
lines changed

11 files changed

+831
-3
lines changed

src/Core/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ find_package (GUIToolkitsVariables REQUIRED)
77
include (${GUIToolkitsVariables_CMAKE_DIR}/python_binding.cmake)
88

99
file (GLOB HEADERS protected/*/*.h)
10-
file (GLOB CPP_SOURCES Internal/*.cpp Geom/*.cpp Topo/*.cpp Mesh/*.cpp Structured/*.cpp Group/*.cpp SysCoord/*.cpp Smoothing/*.cpp )
10+
file (GLOB CPP_SOURCES Internal/*.cpp Geom/*.cpp Topo/*.cpp Mesh/*.cpp Services/*.cpp Structured/*.cpp Group/*.cpp SysCoord/*.cpp Smoothing/*.cpp )
1111

1212
# Répertoire d'en-têtes installés. Certains sont optionnels et ajoutés plus loin.
13-
set (HEADERS_DIRECTORIES protected/Geom protected/Group protected/Internal protected/Mesh protected/Smoothing protected/Structured protected/SysCoord protected/Topo)
13+
set (HEADERS_DIRECTORIES protected/Geom protected/Group protected/Internal protected/Mesh protected/Services protected/Smoothing protected/Structured protected/SysCoord protected/Topo)
1414

1515
# On ajoute les en-têtes aux sources. C'est utile pour cmake dans certains cas,
1616
# par exemple lorsqu'ils doivent être pré-processés (moc, ...).

src/Core/Geom/GeomManager.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
#include "Topo/CommandExtrudeTopo.h"
9191
#include "Topo/TopoHelper.h"
9292
#include "SysCoord/SysCoord.h"
93+
#include "Services/DescriptionService.h"
9394
#ifdef USE_MDLPARSER
9495
#include "Internal/CommandChangeLengthUnit.h"
9596
#endif
@@ -200,6 +201,42 @@ Geom::GeomInfo GeomManager::getInfos(const GeomEntity* e)
200201
return infos;
201202
}
202203
/*----------------------------------------------------------------------------*/
204+
std::string GeomManager::getTextualDescription(std::string name, int dim, bool useService)
205+
{
206+
GeomEntity* e = 0;
207+
switch(dim){
208+
case(0):{
209+
e =getVertex(name);
210+
}
211+
break;
212+
case(1):{
213+
e =getCurve(name);
214+
}
215+
break;
216+
case(2):{
217+
e =getSurface(name);
218+
}
219+
break;
220+
case(3):{
221+
e =getVolume(name);
222+
}
223+
break;
224+
default:{
225+
throw TkUtil::Exception (TkUtil::UTF8String ("Dimension erronée", TkUtil::Charset::UTF_8));
226+
}
227+
break;
228+
}
229+
return getTextualDescription(e, useService);
230+
}
231+
/*----------------------------------------------------------------------------*/
232+
std::string GeomManager::getTextualDescription(const GeomEntity* e, bool useService)
233+
{
234+
if (useService)
235+
return Services::DescriptionService::describe(e, true)->toString();
236+
else
237+
return e->getDescription(true)->toString();
238+
}
239+
/*----------------------------------------------------------------------------*/
203240
Utils::Math::Point GeomManager::getCoord(const std::string& name) const
204241
{
205242
Vertex* vtx = GeomManager::getVertex (name);

0 commit comments

Comments
 (0)