Salome HOME
updated copyright message
[modules/shaper.git] / src / PartSet / PartSet_Tools.cpp
index fc615f4d1e00a6b55014ab567973208d652ac182..315abbd77907f4c240cc7c230734e82a59db0f9e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -93,7 +93,6 @@
 #include <AIS_InteractiveObject.hxx>
 #include <StdSelect_BRepOwner.hxx>
 #include <SelectMgr_IndexedMapOfOwner.hxx>
-#include <V3d_Coordinate.hxx>
 
 #include <QMouseEvent>
 
@@ -115,7 +114,7 @@ gp_Pnt PartSet_Tools::convertClickToPoint(QPoint thePoint, Handle(V3d_View) theV
   if (theView.IsNull())
     return gp_Pnt();
 
-  V3d_Coordinate XAt, YAt, ZAt;
+  Standard_Real XAt, YAt, ZAt;
   theView->At(XAt, YAt, ZAt);
   gp_Pnt AtPoint(XAt, YAt, ZAt);
 
@@ -157,7 +156,7 @@ Handle(V3d_View) theView,
   gp_Vec aVec(anOriginPnt, thePoint);
 
   if (!theView.IsNull()) {
-    V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt;
+    Standard_Real XEye, YEye, ZEye, XAt, YAt, ZAt;
     theView->Eye(XEye, YEye, ZEye);
 
     theView->At(XAt, YAt, ZAt);
@@ -384,10 +383,13 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(
   anIntoResult->setValue(SKETCH_PROJECTION_INCLUDE_INTO_RESULT);
   aProjectionFeature->execute();
 
+  ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
+  bool isValid = aValidators->validate(aProjectionFeature);
+
   // if projection feature has not been created, exit
   AttributeRefAttrPtr aRefAttr = aProjectionFeature->data()->refattr(
     SketchPlugin_Projection::PROJECTED_FEATURE_ID());
-  if (!aRefAttr || !aRefAttr->isInitialized())
+  if (!isValid || !aRefAttr || !aRefAttr->isInitialized())
   {
     // remove external feature if the attribute is not filled
     std::set<FeaturePtr> aFeatures;
@@ -856,12 +858,10 @@ void PartSet_Tools::getDefaultColor(ObjectPtr theObject, const bool isEmptyColor
 {
   theColor.clear();
   // get default color from the preferences manager for the given result
-  if (theColor.empty()) {
-    std::string aSection, aName, aDefault;
-    theObject->colorConfigInfo(aSection, aName, aDefault);
-    if (!aSection.empty() && !aName.empty()) {
-      theColor = Config_PropManager::color(aSection, aName);
-    }
+  std::string aSection, aName, aDefault;
+  theObject->colorConfigInfo(aSection, aName, aDefault);
+  if (!aSection.empty() && !aName.empty()) {
+    theColor = Config_PropManager::color(aSection, aName);
   }
   if (!isEmptyColorValid && theColor.empty()) {
     // all AIS objects, where the color is not set, are in black.