}
// Init flyout point for radius rotation
FeaturePtr aFeature = myCurrentSelection.begin().key();
-
get2dPoint(theWnd, theEvent, myCurrentPoint);
if (isSketcher) {
if (aCanDrag) {
/// Internal edit should not be stored as editing operation as the result will be a
/// creation operation, where previous selection should not be used(and will be cleared)
myIsEditLaunching = !myModule->sketchReentranceMgr()->isInternalEditActive();
- aFOperation->commit();
+
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(aFOperation->feature());
+ bool isRelaunchEditing = true;
+ if (aSPFeature->isExternal()) {
+ foreach(FeaturePtr aF, myCurrentSelection.keys()) {
+ FeaturePtr aProducerFeature = PartSet_Tools::findRefsToMeFeature(aF,
+ aSPFeature->getKind());
+ if (aProducerFeature == aSPFeature) {
+ isRelaunchEditing = false;
+ break;
+ }
+ }
+ }
+ else
+ isRelaunchEditing = !myCurrentSelection.contains(aSPFeature);
+
+ if (isRelaunchEditing)
+ aFOperation->commit();
if (aCanDrag) {
myIsDragging = true;
myDragDone = false;
}
myPreviousDrawModeEnabled = aViewer->enableDrawMode(false);
- launchEditing();
+ if (isRelaunchEditing)
+ launchEditing();
myIsEditLaunching = aPrevLaunchingState;
if (aFeature.get() != NULL) {
std::shared_ptr<SketchPlugin_Feature> aSPFeature =
(theId == SketchPlugin_Arc::ID()) ||
(theId == SketchPlugin_Circle::ID()) ||
(theId == SketchPlugin_Ellipse::ID()) ||
+ (theId == SketchPlugin_Projection::ID()) ||
+ (theId == SketchPlugin_IntersectionPoint::ID()) ||
(theId == SketchPlugin_EllipticArc::ID());
}
if (aPrevState != theState) {
/// call all sketch features redisplay, the expression state will be corrected in customize
/// of distance presentation
+ SketcherPrs_Tools::
+ sendExpressionShownEvent(myIsConstraintsShown[PartSet_Tools::Expressions]);
Events_ID anEventId = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
PartSet_Tools::sendSubFeaturesEvent(myCurrentSketch, anEventId);
}
return true;
}
-
-void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject,
- const AISObjectPtr& thePrs) const
+//**************************************************************************************
+std::vector<int> PartSet_SketcherMgr::colorOfObject(const ObjectPtr& theObject,
+ const FeaturePtr& theFeature, bool isConstruction) const
{
- FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+ static const QStringList& aConstrIds = constraintsIdList();
PartSet_OverconstraintListener* aOCListener = myModule->overconstraintListener();
+ std::string aKind = theFeature->getKind();
- // Check constraints objects
- const QStringList& aConstrIds = constraintsIdList();
- std::string aKind = aFeature->getKind();
- if (aConstrIds.contains(QString(aKind.c_str()))) {
- std::vector<int> aColor;
+ if (isDistanceKind(aKind)) {
if (aOCListener->isConflictingObject(theObject))
- aColor = Config_PropManager::color("Visualization", "sketch_overconstraint_color");
- else if (isDistanceKind(aKind))
- aColor = Config_PropManager::color("Visualization", "sketch_dimension_color");
+ return Config_PropManager::color("Visualization", "sketch_overconstraint_color");
+ return Config_PropManager::color("Visualization", "sketch_dimension_color");
+ }
+ if (isExternal(theFeature))
+ return Config_PropManager::color("Visualization", "sketch_external_color");
+ if (isConstruction)
+ return Config_PropManager::color("Visualization", "sketch_auxiliary_color");
- if (!aColor.empty())
- thePrs->setColor(aColor[0], aColor[1], aColor[2]);
- return;
+ if (aOCListener->isFullyConstrained()) {
+ return Config_PropManager::color("Visualization", "sketch_fully_constrained_color");
}
- int aShapeType = thePrs->getShapeType();
- // a compound is processed like the edge because the
- // arc feature uses the compound for presentable AIS
- if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/ && aShapeType != 0/*compound*/)
- return;
+ else if (aOCListener->isConflictingObject(theObject)) {
+ return Config_PropManager::color("Visualization", "sketch_overconstraint_color");
+ }
+ return Config_PropManager::color("Visualization", "sketch_entity_color");
+}
+
+//**************************************************************************************
+void PartSet_SketcherMgr::customizeSketchPresentation(const ObjectPtr& theObject,
+ const AISObjectPtr& thePrs) const
+{
+ FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
// set color from preferences
std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
aFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID());
bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value();
- std::vector<int> aColor;
- if (aOCListener->isFullyConstrained())
- aColor = Config_PropManager::color("Visualization", "sketch_fully_constrained_color");
- else if (aOCListener->isConflictingObject(theObject))
- aColor = Config_PropManager::color("Visualization", "sketch_overconstraint_color");
- else {
- if (isConstruction)
- aColor = Config_PropManager::color("Visualization", "sketch_auxiliary_color");
- else if (isExternal(aFeature))
- aColor = Config_PropManager::color("Visualization", "sketch_external_color");
- else
- aColor = Config_PropManager::color("Visualization", "sketch_entity_color");
- }
+ std::vector<int> aColor = colorOfObject(theObject, aFeature, isConstruction);
if (!aColor.empty()) {
// The code below causes redisplay again
if (ModelAPI_Session::get()->isOperation()) {
thePrs->setColor(aColor[0], aColor[1], aColor[2]);
}
+ int aShapeType = thePrs->getShapeType();
+ // a compound is processed like the edge because the
+ // arc feature uses the compound for presentable AIS
+ if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/ && aShapeType != 0/*compound*/)
+ return;
+
+ if (isExternal(aFeature)) {
+ thePrs->setWidth(1);
+ return;
+ }
+ std::string aKind = aFeature->getKind();
+ if (isDistanceKind(aKind))
+ return;
+
if (aShapeType == 6 || aShapeType == 0) { // if this is an edge or a compound
if (isConstruction) {
// Set axilliary line