From 0ab427528dcf2fe28ba3f54a5702cfc7ceb91efb Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 21 May 2015 12:40:18 +0300 Subject: [PATCH] Make working possible when constraint images are not accessible --- src/SketcherPrs/CMakeLists.txt | 2 ++ src/SketcherPrs/SketcherPrs_SymbolPrs.cpp | 30 +++++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) 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<