From: vsv Date: Thu, 21 May 2015 09:40:18 +0000 (+0300) Subject: Make working possible when constraint images are not accessible X-Git-Tag: V_1.2.0~125 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0ab427528dcf2fe28ba3f54a5702cfc7ceb91efb;p=modules%2Fshaper.git Make working possible when constraint images are not accessible --- diff --git a/src/SketcherPrs/CMakeLists.txt b/src/SketcherPrs/CMakeLists.txt index 833d9b62b..fb508fed7 100644 --- a/src/SketcherPrs/CMakeLists.txt +++ b/src/SketcherPrs/CMakeLists.txt @@ -43,6 +43,7 @@ SET(PROJECT_LIBRARIES Config ModelAPI GeomAPI + Events ${CAS_KERNEL} ${CAS_MODELER} ${CAS_VIEWER} @@ -76,6 +77,7 @@ ADD_LIBRARY(SketcherPrs SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/Config + ${PROJECT_SOURCE_DIR}/src/Events ${PROJECT_SOURCE_DIR}/src/ModelAPI ${PROJECT_SOURCE_DIR}/src/GeomAPI ${PROJECT_SOURCE_DIR}/src/GeomDataAPI diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 9a7e9a431..d5119b1b1 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -12,6 +12,8 @@ #include #include +#include + #include #include @@ -247,13 +249,21 @@ Handle(Image_AlienPixMap) SketcherPrs_SymbolPrs::icon() if (myIconsMap.count(iconName()) == 1) { return myIconsMap[iconName()]; } - TCollection_AsciiString aFile(getenv("NewGeomResources")); - aFile += FSEP; - aFile += iconName(); - Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap(); - if (aPixMap->Load(aFile)) { - myIconsMap[iconName()] = aPixMap; - return aPixMap; + char* aEnv = getenv("NewGeomResources"); + if (aEnv != NULL) { + TCollection_AsciiString aFile(aEnv); + aFile += FSEP; + aFile += iconName(); + Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap(); + if (aPixMap->Load(aFile)) { + myIconsMap[iconName()] = aPixMap; + return aPixMap; + } + } else { + static const char aMsg[] = "Error! NewGeomResources environment variable is not defined: constraint images are not found"; + cout<