- // Draw first line
- ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
- std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getShape(aObj);
- if (aLine.get() == NULL)
- return;
- drawShape(aLine, thePrs);
-
- // Draw second line
- aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
- aLine = SketcherPrs_Tools::getShape(aObj);
- if (aLine.get() == NULL)
- return;
- drawShape(aLine, thePrs);
+ // Draw objects
+ ObjectPtr aObject =
+ SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
+ drawLine(thePrs, theColor, aObject);
+
+ aObject = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
+ drawLine(thePrs, theColor, aObject);
+}
+
+void SketcherPrs_Middle::drawLine(const Handle(Prs3d_Presentation)& thePrs,
+ Quantity_Color theColor, const ObjectPtr& theObject) const
+{
+ FeaturePtr aLineFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+ if (aLineFeature.get()) {
+ std::list<ResultPtr> aResults = aLineFeature->results();
+ if (aResults.size() == 1) {
+ ResultPtr aResult = aResults.front();
+ std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getShape(aResult);
+ if (aLine.get() != NULL)
+ drawShape(aLine, thePrs);
+ }
+ }
+ else {
+ std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getShape(theObject);
+ if (aLine.get() != NULL)
+ drawShape(aLine, thePrs);
+ }