Do not update the presentation if plane is not selected yet.
}
bool SketcherPrs_Collinear::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
{
bool aReadyToDisplay = false;
-
- ObjectPtr aObj1 =
- SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
- SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
-
- aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
- SketcherPrs_Tools::getShape(aObj2).get() != NULL;
-
+ if (thePlane) {
+ ObjectPtr aObj1 =
+ SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
+ ObjectPtr aObj2 =
+ SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
+
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
+ SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+ }
return aReadyToDisplay;
}
}
bool SketcherPrs_Middle::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
{
bool aReadyToDisplay = false;
-
- ObjectPtr aObj1 =
- SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
- SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
-
- // one object is a feature Line, other object is a point result. We check shape of point result
- aReadyToDisplay = aObj1.get() && aObj2.get() &&
- (SketcherPrs_Tools::getShape(aObj1).get() != NULL ||
- SketcherPrs_Tools::getShape(aObj2).get() != NULL);
-
+ if (thePlane) {
+ ObjectPtr aObj1 =
+ SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
+ ObjectPtr aObj2 =
+ SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
+
+ // one object is a feature Line, other object is a point result. We check shape of point result
+ aReadyToDisplay = aObj1.get() && aObj2.get() &&
+ (SketcherPrs_Tools::getShape(aObj1).get() != NULL ||
+ SketcherPrs_Tools::getShape(aObj2).get() != NULL);
+ }
return aReadyToDisplay;
}
}
bool SketcherPrs_Mirror::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
{
bool aReadyToDisplay = false;
+ if (!thePlane)
+ return aReadyToDisplay;
// Get axis of mirror
ObjectPtr aAxisObj =
}
bool SketcherPrs_Parallel::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
{
bool aReadyToDisplay = false;
-
- ObjectPtr aObj1 =
- SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
- SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
-
- aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
- SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+ if (thePlane) {
+ ObjectPtr aObj1 =
+ SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
+ ObjectPtr aObj2 =
+ SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
+
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
+ SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+ }
return aReadyToDisplay;
}
}
bool SketcherPrs_Perpendicular::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
{
bool aReadyToDisplay = false;
-
- ObjectPtr aObj1 =
- SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
- ObjectPtr aObj2 =
- SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
-
- aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
- SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+ if (thePlane) {
+ ObjectPtr aObj1 =
+ SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
+ ObjectPtr aObj2 =
+ SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
+
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
+ SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+ }
return aReadyToDisplay;
}
* A class Position Manager which manages position of constraints symbols along a source object line.
* it expects that symbol icons have size 16x16 px
*/
-class SKETCHERPRS_EXPORT SketcherPrs_PositionMgr
+class SketcherPrs_PositionMgr
{
public:
/// Returns current instance of position manager
- static SketcherPrs_PositionMgr* get();
+ SKETCHERPRS_EXPORT static SketcherPrs_PositionMgr* get();
/// Returns position of symbol for the given presentation
/// \param theLine constrained object
/// \param thePrs a presentation of constraint
/// \param theStep step between symbols
- gp_Pnt getPosition(ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs,
- double theStep = 20, GeomPointPtr thePnt = GeomPointPtr());
+ SKETCHERPRS_EXPORT gp_Pnt getPosition(ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs,
+ double theStep = 20, GeomPointPtr thePnt = GeomPointPtr());
/// Deletes constraint object from internal structures. Has to be called on constraint delete.
/// \param thePrs a constraint presentation
- void deleteConstraint(const SketcherPrs_SymbolPrs* thePrs);
+ SKETCHERPRS_EXPORT void deleteConstraint(const SketcherPrs_SymbolPrs* thePrs);
/// Cleares all stored positions for all constraints
void clearAll() { myShapes.clear(); myPntShapes.clear(); }
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
{
bool aReadyToDisplay = false;
+ if (!thePlane)
+ return aReadyToDisplay;
std::shared_ptr<ModelAPI_Data> aData = theConstraint->data();
std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
}
bool SketcherPrs_Transformation::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane)
{
bool aReadyToDisplay = false;
+ if (!thePlane)
+ return aReadyToDisplay;
std::shared_ptr<ModelAPI_Data> aData = theConstraint->data();
// Get transformated objects list