]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Sketcher: Avoid changing radius of circular edges while moving
authorazv <azv@opencascade.com>
Wed, 20 Sep 2017 11:19:39 +0000 (14:19 +0300)
committerazv <azv@opencascade.com>
Wed, 20 Sep 2017 11:19:39 +0000 (14:19 +0300)
CMakeLists.txt
src/SketchPlugin/CMakeLists.txt
src/SketchSolver/PlaneGCSSolver/CMakeLists.txt
src/SketchSolver/SketchSolver_ConstraintMovement.cpp

index 4b7dbabeabf7d707c856d629ad5350fa8df24c89..4c423b4d401b0e50135b28f8f3edadc16b5c1683 100644 (file)
@@ -82,6 +82,9 @@ ELSE(${HAVE_SALOME})
     SET(SHAPER_INSTALL_TUI_DOC doc CACHE INTERNAL "" FORCE)
 ENDIF(${HAVE_SALOME})
 
+# Sketcher: Change radius of circular edges while dragging a point on the edge
+SET(SKETCHER_CHANGE_RADIUS_WHEN_MOVE FALSE)
+
 ADD_SUBDIRECTORY (src/Config)
 ADD_SUBDIRECTORY (src/Events)
 ADD_SUBDIRECTORY (src/Model)
index c22dad503fdf1786aa7951cb8d0cc3daab505cfc..e5b9bc0ca868d214cbaf3e16e0ac86e002f9c4d7 100644 (file)
@@ -212,11 +212,6 @@ ADD_UNIT_TESTS(TestSketchPointLine.py
                TestTrimCircleAndArc01.py
                TestTrimLine01.py
                TestTrimLine02.py
-               TestMovePoint.py
-               TestMoveLine.py
-               TestMoveCircle.py
-               TestMoveArc.py
-               TestMovementComplex.py
                TestDistanceSignedVsUnsigned01.py
                TestDistanceSignedVsUnsigned02.py
                TestDistanceSignedVsUnsigned03.py
@@ -225,3 +220,13 @@ ADD_UNIT_TESTS(TestSketchPointLine.py
                TestSignedDistancePointPoint.py
                TestSignedDistancePointLine.py
 )
+
+if(${SKETCHER_CHANGE_RADIUS_WHEN_MOVE})
+  ADD_UNIT_TESTS(
+               TestMovePoint.py
+               TestMoveLine.py
+               TestMoveCircle.py
+               TestMoveArc.py
+               TestMovementComplex.py
+  )
+endif()
\ No newline at end of file
index 081f3425c55397d70cd94d9b5470db542acafdd0..722d0ed24b14dec4cbaaf91d8e78323d1aaefab7 100644 (file)
@@ -112,6 +112,10 @@ SET(PROJECT_SOURCES
     ${SKETCHSOLVER_CONSTRAINT_SOURCES}
 )
 
+if(${SKETCHER_CHANGE_RADIUS_WHEN_MOVE})
+  ADD_DEFINITIONS(-DCHANGE_RADIUS_WHILE_MOVE)
+endif()
+
 ADD_LIBRARY(PlaneGCSSolver MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${SKETCHSOLVER_TEXT_RESOURCES})
 TARGET_LINK_LIBRARIES(PlaneGCSSolver ${PROJECT_LIBRARIES} ${SKETCHSOLVER_LIBRARIES})
 INSTALL(TARGETS PlaneGCSSolver DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES})
index 94c6d7af10066fa33f4489933acae9427abbdb76..f5d6df055692edda89410318425c4c0cc87cb211 100644 (file)
@@ -78,12 +78,14 @@ void SketchSolver_ConstraintMovement::process()
 static bool isSimpleMove(FeaturePtr theMovedFeature, AttributePtr theDraggedPoint)
 {
   bool isSimple = true;
+#ifdef CHANGE_RADIUS_WHILE_MOVE
   if (theMovedFeature->getKind() == SketchPlugin_Circle::ID())
     isSimple = (theDraggedPoint.get() != 0);
   else if (theMovedFeature->getKind() == SketchPlugin_Arc::ID()) {
     isSimple = (theDraggedPoint.get() != 0 &&
                 theDraggedPoint->id() == SketchPlugin_Arc::CENTER_ID());
   }
+#endif
   return isSimple;
 }
 
@@ -213,7 +215,11 @@ void SketchSolver_ConstraintMovement::moveTo(
   double aDelta[2] = { theDestinationPoint->x() - myStartPoint->x(),
                        theDestinationPoint->y() - myStartPoint->y() };
 
+#ifdef CHANGE_RADIUS_WHILE_MOVE
   int aMaxSize = mySimpleMove ? (int)myFixedValues.size() : 2;
+#else
+  int aMaxSize = myMovedFeature->getKind() == SketchPlugin_Line::ID() && !myDraggedPoint ? 4 : 2;
+#endif
   for (int i = 0; i < aMaxSize; ++i)
     myFixedValues[i] += aDelta[i % 2];
 }