#include <GeomAPI_Vertex.h>
#include <GeomAPI_Curve.h>
-#include <Events_Error.h>
+#include <Events_InfoMessage.h>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_BndBox4f.hxx>
: AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane), myIsConflicting(false)
{
SetAutoHilight(Standard_False);
+ myPntArray = new Graphic3d_ArrayOfPoints(1);
+ myPntArray->AddVertex(0., 0., 0.);
}
SketcherPrs_SymbolPrs::~SketcherPrs_SymbolPrs()
return myIconsMap[iconName()];
}
// Load icon for the presentation
- char* aEnv = getenv("SHAPER_ROOT_DIR");
- if (aEnv != NULL) {
- TCollection_AsciiString aFile(aEnv);
- aFile+=FSEP;
- aFile+="resources";
- aFile += FSEP;
- aFile += iconName();
- Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap();
- if (aPixMap->Load(aFile)) {
- myIconsMap[iconName()] = aPixMap;
- return aPixMap;
- }
+ std::string aFile;
+ char* anEnv = getenv("SHAPER_ROOT_DIR");
+ if (anEnv) {
+ aFile = std::string(anEnv) +
+ FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper";
+ } else {
+ anEnv = getenv("OPENPARTS_ROOT_DIR");
+ if (anEnv)
+ aFile = std::string(anEnv) + FSEP + "resources";
+ }
+
+ aFile += FSEP;
+ aFile += iconName();
+ Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap();
+ if (aPixMap->Load(aFile.c_str())) {
+ myIconsMap[iconName()] = aPixMap;
+ return aPixMap;
}
// The icon for constraint is not found
static const char aMsg[] = "Error! constraint images are not found";
cout<<aMsg<<endl;
- Events_Error::send(aMsg);
+ Events_InfoMessage("SketcherPrs_SymbolPrs", aMsg).send();
myIconsMap[iconName()] = Handle(Image_AlienPixMap)();
return Handle(Image_AlienPixMap)();
}
}
// Update points with default shift value
- if (!updatePoints(20)) {
- Events_Error::throwException("An empty AIS presentation: SketcherPrs_SymbolPrs");
- return;
- }
+ // it updates array of points if the presentation is ready to display, or the array of points
+ // contains the previous values
+
+ bool aReadyToDisplay = updateIfReadyToDisplay(20);
int aNbVertex = myPntArray->VertexNumber();
if (myOwner.IsNull()) {
// Disable frustum culling for this object by marking it as mutable
aGroup->Structure()->SetMutable(true);
//aGroup->AddPrimitiveArray(myPntArray);
+
+ if (!aReadyToDisplay)
+ SketcherPrs_Tools::sendEmptyPresentationError(myConstraint,
+ "An empty AIS presentation: SketcherPrs_LengthDimension");
}
// ShaperModification:start
double aScale = aView->Camera()->Scale();
// Update points coordinate taking the viewer scale into account
- if (!updatePoints(MyDist * aScale))
- return;
+ updateIfReadyToDisplay(MyDist * aScale);
+
// ShaperModification:end
Handle(Graphic3d_Buffer) aAttribs = myPntArray->Attributes();