]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Sources formated according to the codeing standards
authorsbh <sergey.belash@opencascade.com>
Thu, 21 Aug 2014 11:55:17 +0000 (15:55 +0400)
committersbh <sergey.belash@opencascade.com>
Thu, 21 Aug 2014 11:55:17 +0000 (15:55 +0400)
328 files changed:
src/Config/Config_Common.cpp
src/Config/Config_Common.h
src/Config/Config_FeatureMessage.h
src/Config/Config_FeatureReader.cpp
src/Config/Config_FeatureReader.h
src/Config/Config_Keywords.h
src/Config/Config_ModuleReader.cpp
src/Config/Config_ModuleReader.h
src/Config/Config_PointerMessage.cpp
src/Config/Config_PointerMessage.h
src/Config/Config_Prop.h
src/Config/Config_PropManager.cpp
src/Config/Config_PropManager.h
src/Config/Config_ValidatorMessage.cpp
src/Config/Config_ValidatorMessage.h
src/Config/Config_WidgetAPI.cpp
src/Config/Config_WidgetAPI.h
src/Config/Config_WidgetReader.cpp
src/Config/Config_WidgetReader.h
src/Config/Config_XMLReader.cpp
src/Config/Config_XMLReader.h
src/Config/Config_def.h
src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
src/ConstructionPlugin/ConstructionPlugin_Plugin.h
src/ConstructionPlugin/ConstructionPlugin_Point.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.h
src/Events/Events_Error.cpp
src/Events/Events_Error.h
src/Events/Events_Listener.h
src/Events/Events_LongOp.cpp
src/Events/Events_LongOp.h
src/Events/Events_Loop.cpp
src/Events/Events_Loop.h
src/Events/Events_Message.h
src/Events/Events_MessageGroup.h
src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp
src/FeaturesPlugin/FeaturesPlugin_Extrusion.h
src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp
src/FeaturesPlugin/FeaturesPlugin_Plugin.h
src/GeomAPI/GeomAPI_AISObject.cpp
src/GeomAPI/GeomAPI_AISObject.h
src/GeomAPI/GeomAPI_Circ.cpp
src/GeomAPI/GeomAPI_Circ.h
src/GeomAPI/GeomAPI_Circ2d.cpp
src/GeomAPI/GeomAPI_Circ2d.h
src/GeomAPI/GeomAPI_Dir.cpp
src/GeomAPI/GeomAPI_Dir.h
src/GeomAPI/GeomAPI_Dir2d.cpp
src/GeomAPI/GeomAPI_Dir2d.h
src/GeomAPI/GeomAPI_Edge.cpp
src/GeomAPI/GeomAPI_Edge.h
src/GeomAPI/GeomAPI_IPresentable.h
src/GeomAPI/GeomAPI_Interface.h
src/GeomAPI/GeomAPI_Lin.cpp
src/GeomAPI/GeomAPI_Lin.h
src/GeomAPI/GeomAPI_Lin2d.cpp
src/GeomAPI/GeomAPI_Lin2d.h
src/GeomAPI/GeomAPI_Pln.cpp
src/GeomAPI/GeomAPI_Pln.h
src/GeomAPI/GeomAPI_Pnt.cpp
src/GeomAPI/GeomAPI_Pnt.h
src/GeomAPI/GeomAPI_Pnt2d.cpp
src/GeomAPI/GeomAPI_Pnt2d.h
src/GeomAPI/GeomAPI_Shape.cpp
src/GeomAPI/GeomAPI_Shape.h
src/GeomAPI/GeomAPI_XY.cpp
src/GeomAPI/GeomAPI_XY.h
src/GeomAPI/GeomAPI_XYZ.cpp
src/GeomAPI/GeomAPI_XYZ.h
src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.h
src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.h
src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.h
src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h
src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h
src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.h
src/GeomData/GeomData_Dir.cpp
src/GeomData/GeomData_Dir.h
src/GeomData/GeomData_Point.cpp
src/GeomData/GeomData_Point.h
src/GeomData/GeomData_Point2D.cpp
src/GeomData/GeomData_Point2D.h
src/GeomDataAPI/GeomDataAPI_Dir.h
src/GeomDataAPI/GeomDataAPI_Point.h
src/GeomDataAPI/GeomDataAPI_Point2D.h
src/Model/Model_Application.cpp
src/Model/Model_Application.h
src/Model/Model_AttributeBoolean.cpp
src/Model/Model_AttributeBoolean.h
src/Model/Model_AttributeDocRef.cpp
src/Model/Model_AttributeDocRef.h
src/Model/Model_AttributeDouble.h
src/Model/Model_AttributeRefAttr.cpp
src/Model/Model_AttributeRefAttr.h
src/Model/Model_AttributeRefList.cpp
src/Model/Model_AttributeRefList.h
src/Model/Model_AttributeReference.cpp
src/Model/Model_AttributeReference.h
src/Model/Model_Data.cpp
src/Model/Model_Data.h
src/Model/Model_Document.cpp
src/Model/Model_Document.h
src/Model/Model_Events.cpp
src/Model/Model_Events.h
src/Model/Model_FeatureValidator.cpp
src/Model/Model_FeatureValidator.h
src/Model/Model_PluginManager.cpp
src/Model/Model_PluginManager.h
src/Model/Model_ResultBody.cpp
src/Model/Model_ResultBody.h
src/Model/Model_ResultConstruction.h
src/Model/Model_ResultPart.cpp
src/Model/Model_ResultPart.h
src/Model/Model_ResultValidators.cpp
src/Model/Model_ResultValidators.h
src/Model/Model_Update.cpp
src/Model/Model_Update.h
src/Model/Model_Validator.cpp
src/Model/Model_Validator.h
src/ModelAPI/ModelAPI_Attribute.h
src/ModelAPI/ModelAPI_AttributeBoolean.h
src/ModelAPI/ModelAPI_AttributeDocRef.h
src/ModelAPI/ModelAPI_AttributeDouble.h
src/ModelAPI/ModelAPI_AttributeRefAttr.h
src/ModelAPI/ModelAPI_AttributeRefList.h
src/ModelAPI/ModelAPI_AttributeReference.h
src/ModelAPI/ModelAPI_AttributeValidator.h
src/ModelAPI/ModelAPI_Data.h
src/ModelAPI/ModelAPI_Document.h
src/ModelAPI/ModelAPI_Events.h
src/ModelAPI/ModelAPI_Feature.cpp
src/ModelAPI/ModelAPI_Feature.h
src/ModelAPI/ModelAPI_FeatureValidator.h
src/ModelAPI/ModelAPI_Object.h
src/ModelAPI/ModelAPI_Plugin.h
src/ModelAPI/ModelAPI_PluginManager.cpp
src/ModelAPI/ModelAPI_PluginManager.h
src/ModelAPI/ModelAPI_Result.h
src/ModelAPI/ModelAPI_ResultBody.h
src/ModelAPI/ModelAPI_ResultConstruction.h
src/ModelAPI/ModelAPI_ResultParameters.h
src/ModelAPI/ModelAPI_ResultPart.h
src/ModelAPI/ModelAPI_ResultValidator.h
src/ModelAPI/ModelAPI_Tools.cpp
src/ModelAPI/ModelAPI_Tools.h
src/ModelAPI/ModelAPI_Validator.h
src/ModuleBase/ModuleBase.h
src/ModuleBase/ModuleBase_Definitions.h
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_IOperation.cpp
src/ModuleBase/ModuleBase_IOperation.h
src/ModuleBase/ModuleBase_ISelection.h
src/ModuleBase/ModuleBase_IWorkshop.h
src/ModuleBase/ModuleBase_ModelWidget.cpp
src/ModuleBase/ModuleBase_ModelWidget.h
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/ModuleBase/ModuleBase_OperationDescription.cpp
src/ModuleBase/ModuleBase_OperationDescription.h
src/ModuleBase/ModuleBase_ResultValidators.cpp
src/ModuleBase/ModuleBase_ResultValidators.h
src/ModuleBase/ModuleBase_SelectionValidator.h
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_Tools.h
src/ModuleBase/ModuleBase_ViewerPrs.h
src/ModuleBase/ModuleBase_WidgetBoolValue.cpp
src/ModuleBase/ModuleBase_WidgetBoolValue.h
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
src/ModuleBase/ModuleBase_WidgetDoubleValue.h
src/ModuleBase/ModuleBase_WidgetEditor.cpp
src/ModuleBase/ModuleBase_WidgetEditor.h
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetFactory.h
src/ModuleBase/ModuleBase_WidgetFeature.cpp
src/ModuleBase/ModuleBase_WidgetFeature.h
src/ModuleBase/ModuleBase_WidgetFeatureOrAttribute.cpp
src/ModuleBase/ModuleBase_WidgetFeatureOrAttribute.h
src/ModuleBase/ModuleBase_WidgetPoint2D.cpp
src/ModuleBase/ModuleBase_WidgetPoint2D.h
src/ModuleBase/ModuleBase_WidgetPoint2dDistance.cpp
src/ModuleBase/ModuleBase_WidgetPoint2dDistance.h
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/ModuleBase/ModuleBase_WidgetSelector.h
src/ModuleBase/ModuleBase_WidgetSwitch.cpp
src/ModuleBase/ModuleBase_WidgetSwitch.h
src/ModuleBase/ModuleBase_WidgetValue.h
src/ModuleBase/ModuleBase_WidgetValueFeature.h
src/NewGeom/NewGeom.h
src/NewGeom/NewGeom_DataModel.cpp
src/NewGeom/NewGeom_DataModel.h
src/NewGeom/NewGeom_Module.cpp
src/NewGeom/NewGeom_Module.h
src/NewGeom/NewGeom_OCCSelector.cpp
src/NewGeom/NewGeom_OCCSelector.h
src/NewGeom/NewGeom_SalomeViewer.cpp
src/NewGeom/NewGeom_SalomeViewer.h
src/PartSet/PartSet.h
src/PartSet/PartSet_EditLine.cpp
src/PartSet/PartSet_EditLine.h
src/PartSet/PartSet_Listener.cpp
src/PartSet/PartSet_Listener.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_OperationFeatureCreate.cpp
src/PartSet/PartSet_OperationFeatureCreate.h
src/PartSet/PartSet_OperationFeatureEdit.cpp
src/PartSet/PartSet_OperationFeatureEdit.h
src/PartSet/PartSet_OperationFeatureEditMulti.cpp
src/PartSet/PartSet_OperationFeatureEditMulti.h
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSet/PartSet_OperationSketchBase.h
src/PartSet/PartSet_TestOCC.cpp
src/PartSet/PartSet_TestOCC.h
src/PartSet/PartSet_Tools.cpp
src/PartSet/PartSet_Tools.h
src/PartSet/PartSet_Validators.cpp
src/PartSet/PartSet_Validators.h
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/PartSet/PartSet_WidgetSketchLabel.h
src/PartSetPlugin/PartSetPlugin_Duplicate.cpp
src/PartSetPlugin/PartSetPlugin_Duplicate.h
src/PartSetPlugin/PartSetPlugin_Part.cpp
src/PartSetPlugin/PartSetPlugin_Part.h
src/PartSetPlugin/PartSetPlugin_Plugin.cpp
src/PartSetPlugin/PartSetPlugin_Plugin.h
src/PartSetPlugin/PartSetPlugin_Remove.cpp
src/PartSetPlugin/PartSetPlugin_Remove.h
src/SketchPlugin/SketchPlugin_Arc.cpp
src/SketchPlugin/SketchPlugin_Arc.h
src/SketchPlugin/SketchPlugin_Circle.cpp
src/SketchPlugin/SketchPlugin_Circle.h
src/SketchPlugin/SketchPlugin_Constraint.h
src/SketchPlugin/SketchPlugin_ConstraintBase.cpp
src/SketchPlugin/SketchPlugin_ConstraintBase.h
src/SketchPlugin/SketchPlugin_ConstraintCoincidence.h
src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp
src/SketchPlugin/SketchPlugin_ConstraintDistance.h
src/SketchPlugin/SketchPlugin_ConstraintLength.cpp
src/SketchPlugin/SketchPlugin_ConstraintLength.h
src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp
src/SketchPlugin/SketchPlugin_ConstraintParallel.h
src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp
src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.h
src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp
src/SketchPlugin/SketchPlugin_ConstraintRadius.h
src/SketchPlugin/SketchPlugin_Feature.cpp
src/SketchPlugin/SketchPlugin_Feature.h
src/SketchPlugin/SketchPlugin_Line.cpp
src/SketchPlugin/SketchPlugin_Line.h
src/SketchPlugin/SketchPlugin_Plugin.cpp
src/SketchPlugin/SketchPlugin_Plugin.h
src/SketchPlugin/SketchPlugin_Point.cpp
src/SketchPlugin/SketchPlugin_Point.h
src/SketchPlugin/SketchPlugin_Sketch.cpp
src/SketchPlugin/SketchPlugin_Sketch.h
src/SketchPlugin/SketchPlugin_Validators.cpp
src/SketchPlugin/SketchPlugin_Validators.h
src/SketchSolver/SketchSolver_Constraint.cpp
src/SketchSolver/SketchSolver_Constraint.h
src/SketchSolver/SketchSolver_ConstraintGroup.cpp
src/SketchSolver/SketchSolver_ConstraintGroup.h
src/SketchSolver/SketchSolver_ConstraintManager.cpp
src/SketchSolver/SketchSolver_ConstraintManager.h
src/SketchSolver/SketchSolver_Solver.cpp
src/SketchSolver/SketchSolver_Solver.h
src/XGUI/XGUI_ActionsMgr.cpp
src/XGUI/XGUI_ActionsMgr.h
src/XGUI/XGUI_Command.cpp
src/XGUI/XGUI_Command.h
src/XGUI/XGUI_Constants.h
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_ContextMenuMgr.h
src/XGUI/XGUI_DataTreeModel.h
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_DocumentDataModel.cpp
src/XGUI/XGUI_DocumentDataModel.h
src/XGUI/XGUI_ErrorDialog.cpp
src/XGUI/XGUI_ErrorDialog.h
src/XGUI/XGUI_MainMenu.cpp
src/XGUI/XGUI_MainMenu.h
src/XGUI/XGUI_MainWindow.cpp
src/XGUI/XGUI_MainWindow.h
src/XGUI/XGUI_MenuGroupPanel.cpp
src/XGUI/XGUI_MenuGroupPanel.h
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_ModuleConnector.h
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_ObjectsBrowser.h
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_OperationMgr.h
src/XGUI/XGUI_PartDataModel.cpp
src/XGUI/XGUI_PartDataModel.h
src/XGUI/XGUI_Preferences.cpp
src/XGUI/XGUI_Preferences.h
src/XGUI/XGUI_PropertyPanel.cpp
src/XGUI/XGUI_PropertyPanel.h
src/XGUI/XGUI_RubberBand.cpp
src/XGUI/XGUI_RubberBand.h
src/XGUI/XGUI_SalomeConnector.h
src/XGUI/XGUI_SalomeViewer.h
src/XGUI/XGUI_Selection.cpp
src/XGUI/XGUI_Selection.h
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_SelectionMgr.h
src/XGUI/XGUI_Tools.cpp
src/XGUI/XGUI_Tools.h
src/XGUI/XGUI_ViewBackground.cpp
src/XGUI/XGUI_ViewBackground.h
src/XGUI/XGUI_ViewPort.cpp
src/XGUI/XGUI_ViewPort.h
src/XGUI/XGUI_ViewWindow.cpp
src/XGUI/XGUI_ViewWindow.h
src/XGUI/XGUI_Viewer.cpp
src/XGUI/XGUI_Viewer.h
src/XGUI/XGUI_ViewerProxy.cpp
src/XGUI/XGUI_ViewerProxy.h
src/XGUI/XGUI_Workbench.cpp
src/XGUI/XGUI_Workbench.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index 84e6328a26eacf9259c3cd9dc0f6031ff5a86ca6..a6a9ee512e055782f0b7ff46968d63088633ab44 100644 (file)
@@ -1,98 +1,96 @@
-/*
- * Config_Common.cpp
- *
- *  Created on: Apr 17, 2014
- *      Author: sbh
- */
-
-#include "Config_Common.h"
-#include <Config_Keywords.h>
-
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-
-#include <sstream> //for stringstream
-
-bool isElementNode(xmlNodePtr theNode)
-{
-  return theNode->type == XML_ELEMENT_NODE;
-}
-
-bool isNode(xmlNodePtr theNode, const char* theNodeName, ...)
-{
-  bool result = false;
-  const xmlChar* aName = theNode->name;
-  if (!aName || !isElementNode(theNode)) {
-    return false;
-  }
-  if (!xmlStrcmp(aName, (const xmlChar *) theNodeName)) {
-    return true;
-  }
-  va_list args; // define argument list variable
-  va_start(args, theNodeName); // init list; point to last defined argument
-  while(true) {
-    char *anArg = va_arg (args, char*); // get next argument
-    if (anArg == NULL)
-      break;
-    if (!xmlStrcmp(aName, (const xmlChar *) anArg)) {
-      va_end(args); // cleanup the system stack
-      return true;
-    }
-  }
-  va_end(args); // cleanup the system stack
-  return false;
-}
-
-bool hasChild(xmlNodePtr theNode)
-{
-  xmlNodePtr aNode = theNode->children;
-  for( ; aNode; aNode = aNode->next) {
-    if (isElementNode(theNode)) {
-      return true;
-    }
-  }
-  return false;
-}
-
-bool getValidatorInfo(xmlNodePtr theNode,
-                      std::string& outValidatorId,
-                      std::list<std::string>& outValidatorParameters)
-{
-  //Validator id:
-  char* anIdProp = (char*) xmlGetProp(theNode, BAD_CAST _ID);
-  if (!anIdProp || anIdProp[0] == 0) {
-    return false;
-  }
-  outValidatorId = std::string(anIdProp);
-
-  //Validator parameters:
-  char* aParamProp = (char*) xmlGetProp(theNode, BAD_CAST VALIDATOR_PARAMETERS);
-  if (aParamProp && aParamProp[0] != 0) {
-    std::string aPropString = std::string(aParamProp);
-    std::stringstream aPropStringStream(aPropString);
-    char COMMA_DELIM = ',';
-    std::string aValidatorParameter;
-    while (std::getline(aPropStringStream, aValidatorParameter, ',')) {
-      outValidatorParameters.push_back(aValidatorParameter);
-    }
-  }
-  return true;
-}
-
-std::string library(const std::string& theLibName)
-{
-  std::string aLibName = theLibName;
-#ifndef WIN32
-  static std::string aLibExt( ".so" );
-  if (aLibName.size() < 3 || aLibName.substr(0, 3) !="lib") {
-    aLibName = "lib" + aLibName;
-  }
-#else
-  static std::string aLibExt(".dll");
-#endif
-  std::string anExt = aLibName.substr(aLibName.size() - 4);
-  if (anExt != aLibExt)
-    aLibName += aLibExt;
-
-  return aLibName;
-}
+/*\r
+ * Config_Common.cpp\r
+ *\r
+ *  Created on: Apr 17, 2014\r
+ *      Author: sbh\r
+ */\r
+\r
+#include "Config_Common.h"\r
+#include <Config_Keywords.h>\r
+\r
+#include <libxml/parser.h>\r
+#include <libxml/tree.h>\r
+\r
+#include <sstream> //for stringstream\r\r
+bool isElementNode(xmlNodePtr theNode)\r
+{\r
+  return theNode->type == XML_ELEMENT_NODE;\r
+}\r
+\r
+bool isNode(xmlNodePtr theNode, const char* theNodeName, ...)\r
+{\r
+  bool result = false;\r
+  const xmlChar* aName = theNode->name;\r
+  if (!aName || !isElementNode(theNode)) {\r
+    return false;\r
+  }\r
+  if (!xmlStrcmp(aName, (const xmlChar *) theNodeName)) {\r
+    return true;\r
+  }\r
+  va_list args;  // define argument list variable\r
+  va_start(args, theNodeName);  // init list; point to last defined argument\r
+  while (true) {\r
+    char *anArg = va_arg (args, char*);  // get next argument\r
+    if (anArg == NULL)\r
+      break;\r
+    if (!xmlStrcmp(aName, (const xmlChar *) anArg)) {\r
+      va_end(args);  // cleanup the system stack\r
+      return true;\r
+    }\r
+  }\r
+  va_end(args);  // cleanup the system stack\r
+  return false;\r
+}\r
+\r
+bool hasChild(xmlNodePtr theNode)\r
+{\r
+  xmlNodePtr aNode = theNode->children;\r
+  for (; aNode; aNode = aNode->next) {\r
+    if (isElementNode(theNode)) {\r
+      return true;\r
+    }\r
+  }\r
+  return false;\r
+}\r
+\r
+bool getValidatorInfo(xmlNodePtr theNode, std::string& outValidatorId,\r
+                      std::list<std::string>& outValidatorParameters)\r
+{\r
+  //Validator id:\r
+  char* anIdProp = (char*) xmlGetProp(theNode, BAD_CAST _ID);\r
+  if (!anIdProp || anIdProp[0] == 0) {\r
+    return false;\r
+  }\r
+  outValidatorId = std::string(anIdProp);\r
+\r
+  //Validator parameters:\r
+  char* aParamProp = (char*) xmlGetProp(theNode, BAD_CAST VALIDATOR_PARAMETERS);\r
+  if (aParamProp && aParamProp[0] != 0) {\r
+    std::string aPropString = std::string(aParamProp);\r
+    std::stringstream aPropStringStream(aPropString);\r
+    char COMMA_DELIM = ',';\r
+    std::string aValidatorParameter;\r
+    while (std::getline(aPropStringStream, aValidatorParameter, ',')) {\r
+      outValidatorParameters.push_back(aValidatorParameter);\r
+    }\r
+  }\r
+  return true;\r
+}\r
+\r
+std::string library(const std::string& theLibName)\r
+{\r
+  std::string aLibName = theLibName;\r
+#ifndef WIN32\r
+  static std::string aLibExt( ".so" );\r
+  if (aLibName.size() < 3 || aLibName.substr(0, 3) !="lib") {\r
+    aLibName = "lib" + aLibName;\r
+  }\r
+#else\r
+  static std::string aLibExt(".dll");\r
+#endif\r
+  std::string anExt = aLibName.substr(aLibName.size() - 4);\r
+  if (anExt != aLibExt)\r
+    aLibName += aLibExt;\r
+\r
+  return aLibName;\r
+}\r
index 4a204f59b3a88cb12de1145639911f4ce84ad8ce..a8459c10790f0acd9bd74184e6daf6a5749bf7ae 100644 (file)
@@ -53,8 +53,7 @@ CONFIG_EXPORT bool hasChild(xmlNodePtr theNode);
 /*
  *
  */
-CONFIG_EXPORT bool getValidatorInfo(xmlNodePtr theNode,
-                                    std::string& outValidatorId,
+CONFIG_EXPORT bool getValidatorInfo(xmlNodePtr theNode, std::string& outValidatorId,
                                     std::list<std::string>& outValidatorParameters);
 
 /*!
index 752169fb4d0bb673653ed465d3881663ee15abfc..4c32b0b8639f666c2bb287e2ac4ba68581ef77c0 100644 (file)
@@ -14,52 +14,38 @@ static const char * EVENT_FEATURE_LOADED = "FeatureLoaded";
  * Example of the feature entry:\r
  * <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>\r
  */\r
-class Config_FeatureMessage: public Events_Message\r
+class Config_FeatureMessage : public Events_Message\r
 {\r
   std::string myId;  //Feature unique id\r
-  std::string myText; //Represents action's text\r
+  std::string myText;  //Represents action's text\r
   std::string myTooltip;  //Represents action's tooltip\r
-  std::string myIcon; //Represents action's icon\r
+  std::string myIcon;  //Represents action's icon\r
   std::string myKeysequence;  //Represents action's key sequence\r
 \r
   std::string myGroupId;  //Id of feature's group\r
   std::string myWorkbenchId;  //Id of feature's workbench\r
   std::string myPluginLibrary;  //Name of feature's library\r
 \r
-  bool myUseInput; //Action is being checked until user commit the operation\r
-  bool myInternal; //Internal feature without GUI representation\r
+  bool myUseInput;  //Action is being checked until user commit the operation\r
+  bool myInternal;  //Internal feature without GUI representation\r
   std::string myNestedFeatures;\r
 \r
-public:\r
+ public:\r
   //const Events_ID theID, const void* theSender = 0\r
-  CONFIG_EXPORT Config_FeatureMessage(const Events_ID theId, const void* theParent = 0);\r
-  CONFIG_EXPORT virtual ~Config_FeatureMessage();\r
+  CONFIG_EXPORT Config_FeatureMessage(const Events_ID theId, const void* theParent = 0);CONFIG_EXPORT virtual ~Config_FeatureMessage();\r
 \r
   //Auto-generated getters/setters\r
-  CONFIG_EXPORT const std::string& icon() const;\r
-  CONFIG_EXPORT const std::string& id() const;\r
-  CONFIG_EXPORT const std::string& keysequence() const;\r
-  CONFIG_EXPORT const std::string& text() const;\r
-  CONFIG_EXPORT const std::string& tooltip() const;\r
+  CONFIG_EXPORT const std::string& icon() const;CONFIG_EXPORT const std::string& id() const;CONFIG_EXPORT const std::string& keysequence() const;CONFIG_EXPORT const std::string& text() const;CONFIG_EXPORT const std::string& tooltip() const;\r
 \r
-  CONFIG_EXPORT const std::string& groupId() const;\r
-  CONFIG_EXPORT const std::string& workbenchId() const;\r
-  CONFIG_EXPORT const std::string& pluginLibrary() const;\r
-  CONFIG_EXPORT const std::string& nestedFeatures() const;\r
-  CONFIG_EXPORT bool isUseInput() const;\r
-  CONFIG_EXPORT bool isInternal() const;\r
+  CONFIG_EXPORT const std::string& groupId() const;CONFIG_EXPORT const std::string& workbenchId() const;CONFIG_EXPORT const std::string& pluginLibrary() const;CONFIG_EXPORT const std::string& nestedFeatures() const;CONFIG_EXPORT bool isUseInput() const;CONFIG_EXPORT bool isInternal() const;\r
 \r
-  CONFIG_EXPORT void setIcon(const std::string& icon);\r
-  CONFIG_EXPORT void setId(const std::string& id);\r
-  CONFIG_EXPORT void setKeysequence(const std::string& keysequence);\r
-  CONFIG_EXPORT void setText(const std::string& text);\r
-  CONFIG_EXPORT void setTooltip(const std::string& tooltip);\r
-  CONFIG_EXPORT void setGroupId(const std::string& groupId);\r
-  CONFIG_EXPORT void setWorkbenchId(const std::string& workbenchId);\r
-  CONFIG_EXPORT void setPluginLibrary(const std::string& thePluginLibrary);\r
-  CONFIG_EXPORT void setNestedFeatures(const std::string& theNestedFeatures);\r
-  CONFIG_EXPORT void setUseInput(bool isUseInput);\r
-  CONFIG_EXPORT void setInternal(bool isInternal);\r
+  CONFIG_EXPORT void setIcon(const std::string& icon);CONFIG_EXPORT void setId(\r
+      const std::string& id);CONFIG_EXPORT void setKeysequence(const std::string& keysequence);CONFIG_EXPORT void setText(\r
+      const std::string& text);CONFIG_EXPORT void setTooltip(const std::string& tooltip);CONFIG_EXPORT void setGroupId(\r
+      const std::string& groupId);CONFIG_EXPORT void setWorkbenchId(const std::string& workbenchId);CONFIG_EXPORT void setPluginLibrary(\r
+      const std::string& thePluginLibrary);CONFIG_EXPORT void setNestedFeatures(\r
+      const std::string& theNestedFeatures);CONFIG_EXPORT void setUseInput(bool isUseInput);CONFIG_EXPORT void setInternal(\r
+      bool isInternal);\r
 };\r
 \r
-#endif // CONFIG_MESSAGE_H\r
+#endif // CONFIG_MESSAGE_H\r
\ No newline at end of file
index bdd6e0801e09f4661816e72a896ac7e7f3d05011..69d7176e4f22c195114462d25f64a0b0479afdd2 100644 (file)
@@ -24,7 +24,6 @@
 #include <iostream>
 #endif
 
-
 Config_FeatureReader::Config_FeatureReader(const std::string& theXmlFile,
                                            const std::string& theLibraryName,
                                            const char* theEventGenerated)
@@ -54,12 +53,12 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
     //If a feature has xml definition for it's widget:
     aMessage.setUseInput(hasChild(theNode));
     aEvLoop->send(aMessage);
-  //The m_last* variables always defined before fillFeature() call. XML is a tree.
+    //The m_last* variables always defined before fillFeature() call. XML is a tree.
   } else if (isNode(theNode, NODE_GROUP, NULL)) {
     myLastGroup = getProperty(theNode, _ID);
   } else if (isNode(theNode, NODE_WORKBENCH, NULL)) {
     myLastWorkbench = getProperty(theNode, _ID);
-  //Process SOURCE, VALIDATOR nodes.
+    //Process SOURCE, VALIDATOR nodes.
   }
   Config_XMLReader::processNode(theNode);
 }
@@ -69,8 +68,7 @@ bool Config_FeatureReader::processChildren(xmlNodePtr theNode)
   return isNode(theNode, NODE_WORKBENCH, NODE_GROUP, NODE_FEATURE, NULL);
 }
 
-void Config_FeatureReader::fillFeature(xmlNodePtr theNode,
-                                       Config_FeatureMessage& outFeatureMessage)
+void Config_FeatureReader::fillFeature(xmlNodePtr theNode, Config_FeatureMessage& outFeatureMessage)
 {
   outFeatureMessage.setId(getProperty(theNode, _ID));
   outFeatureMessage.setPluginLibrary(myLibraryName);
@@ -78,7 +76,7 @@ void Config_FeatureReader::fillFeature(xmlNodePtr theNode,
 
   bool isInternal = isInternalFeature(theNode);
   outFeatureMessage.setInternal(isInternal);
-  if(isInternal) {
+  if (isInternal) {
     //Internal feature has no visual representation.
     return;
   }
@@ -94,7 +92,7 @@ bool Config_FeatureReader::isInternalFeature(xmlNodePtr theNode)
 {
   std::string prop = getProperty(theNode, FEATURE_INTERNAL);
   std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower);
-  if(prop.empty() || prop == "false" || prop == "0") {
+  if (prop.empty() || prop == "false" || prop == "0") {
     return false;
   }
   return true;
index 468cb9911165f8c09faa902d6d0b55c23f317b53..f7547785ce39c245a18bbf8e381018351b2a4b4c 100644 (file)
 
 class Config_FeatureMessage;
 
-class Config_FeatureReader: public Config_XMLReader
+class Config_FeatureReader : public Config_XMLReader
 {
-public:
-  Config_FeatureReader(const std::string& theXmlFile,
-                       const std::string& theLibraryName,
+ public:
+  Config_FeatureReader(const std::string& theXmlFile, const std::string& theLibraryName,
                        const char* theEventGenerated = 0);
   virtual ~Config_FeatureReader();
 
   std::list<std::string> features() const;
 
-protected:
+ protected:
   void processNode(xmlNodePtr aNode);
   bool processChildren(xmlNodePtr aNode);
 
   void fillFeature(xmlNodePtr theRoot, Config_FeatureMessage& outFeatureMessage);
   bool isInternalFeature(xmlNodePtr theRoot);
 
-private:
+ private:
   std::string myLastWorkbench;
   std::string myLastGroup;
   std::string myLibraryName;
index f8f4f222fa7006f14f69bc24363bb8e38cdc017b..434857827fbf6137ef20dd5c78d6a4b15ef85899 100644 (file)
@@ -66,7 +66,6 @@ const static char* DOUBLE_WDG_DFLT = "default";
 //toolbox/switch properties
 const static char* CONTAINER_PAGE_NAME = "title";
 
-
 /*
  * Hardcoded xml entities of plugins.xml
  */
index ab9a42f351c9fcd977979801ef23a02fd34aa5bc..f2fcda4b717278ae83d5787a0d497623b47bcb95 100644 (file)
@@ -24,7 +24,8 @@
 #endif
 
 Config_ModuleReader::Config_ModuleReader(const char* theEventGenerated)
-    : Config_XMLReader("plugins.xml"), myEventGenerated(theEventGenerated)
+    : Config_XMLReader("plugins.xml"),
+      myEventGenerated(theEventGenerated)
 {
 }
 
@@ -57,7 +58,7 @@ void Config_ModuleReader::processNode(xmlNodePtr theNode)
     std::string aPluginLibrary = getProperty(theNode, PLUGIN_LIBRARY);
     std::list<std::string> aFeatures = importPlugin(aPluginLibrary, aPluginConf);
     std::list<std::string>::iterator it = aFeatures.begin();
-    for(; it != aFeatures.end(); it++) {
+    for (; it != aFeatures.end(); it++) {
       myFeaturesInFiles[*it] = aPluginConf;
     }
   }
@@ -71,7 +72,7 @@ bool Config_ModuleReader::processChildren(xmlNodePtr theNode)
 std::list<std::string> Config_ModuleReader::importPlugin(const std::string& thePluginLibrary,
                                                          const std::string& thePluginFile)
 {
-  if (thePluginFile.empty()) { //probably a third party library
+  if (thePluginFile.empty()) {  //probably a third party library
     loadLibrary(thePluginLibrary);
     return std::list<std::string>();
   }
@@ -90,14 +91,14 @@ void Config_ModuleReader::loadLibrary(const std::string theLibName)
 
 #ifdef WIN32
   HINSTANCE aModLib = ::LoadLibrary(aFileName.c_str());
-  if (!aModLib && theLibName != "DFBrowser") { // don't shor error for internal debugging tool
+  if (!aModLib && theLibName != "DFBrowser") {  // don't shor error for internal debugging tool
     std::string errorMsg = "Failed to load " + aFileName;
     std::cerr << errorMsg << std::endl;
     Events_Error::send(errorMsg);
   }
 #else
   void* aModLib = dlopen( aFileName.c_str(), RTLD_LAZY | RTLD_GLOBAL );
-  if ( !aModLib  && theLibName != "DFBrowser") { // don't shor error for internal debugging tool
+  if ( !aModLib && theLibName != "DFBrowser") {  // don't shor error for internal debugging tool
     std::cerr << "Failed to load " << aFileName.c_str() << std::endl;
   }
 #endif
index 3bd5d39f3f75c8289f5566e5fc44ec8bfc1e553f..18962f3488b9dbc03f7c41173fa143052e43946b 100644 (file)
 #include <list>
 #include <string>
 
-
-class Config_ModuleReader: public Config_XMLReader
+class Config_ModuleReader : public Config_XMLReader
 {
 
-public:
-  CONFIG_EXPORT Config_ModuleReader(const char* theEventGenerated = 0);
-  CONFIG_EXPORT virtual ~Config_ModuleReader();
+ public:
+  CONFIG_EXPORT Config_ModuleReader(const char* theEventGenerated = 0);CONFIG_EXPORT virtual ~Config_ModuleReader();
 
   CONFIG_EXPORT const std::map<std::string, std::string>& featuresInFiles() const;
 
@@ -30,15 +28,14 @@ public:
   /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
   CONFIG_EXPORT static void loadLibrary(const std::string theLibName);
 
-protected:
+ protected:
   void processNode(xmlNodePtr aNode);
   bool processChildren(xmlNodePtr aNode);
 
   std::list<std::string> importPlugin(const std::string& thePluginLibrary,
                                       const std::string& thePluginFile);
 
-
-private:
+ private:
   std::map<std::string, std::string> myFeaturesInFiles;
   const char* myEventGenerated;
 
index 91e9d10f335d14df142ce0e6743aa8bbacaf7bac..60f27398f3ad3d7e0df993f7b9c843ebe4359529 100644 (file)
@@ -8,7 +8,8 @@
 #include <Config_PointerMessage.h>
 
 Config_PointerMessage::Config_PointerMessage(const Events_ID theId, const void* theParent)
-    : Events_Message(theId, theParent), myPointer(0)
+    : Events_Message(theId, theParent),
+      myPointer(0)
 {
 
 }
index 0e3c726caa094e05e0392032a357952e35b2fafb..87aee317179fc98fc8599e5fcdd6461feb6d2229 100644 (file)
 /*
  * A general class to pass pointers over the event loop.
  */
-class CONFIG_EXPORT Config_PointerMessage: public Events_Message
+class CONFIG_EXPORT Config_PointerMessage : public Events_Message
 {
-public:
+ public:
   Config_PointerMessage(const Events_ID theId, const void* theParent = 0);
   virtual ~Config_PointerMessage();
 
   void* pointer() const;
   void setPointer(void* pointer);
 
-private:
+ private:
   void* myPointer;
 };
 
index 246df80748f82e0882f6a9ef3a7fbd17d1cc6c02..f74137c3c7ab125e0cb7ed84eaa024ae9442e563 100644 (file)
 /// Class which describes a one property
 class Config_Prop
 {
-public:
-
-  enum PropType { Disabled, Space, Bool, Color, String, Selector,
-                  DblSpin, IntSpin, Double, Integer,
-                  GroupBox, Tab, Frame, Font, DirList, File,
-                             Slider, Shortcut, ShortcutTree, BiColor, Background };
+ public:
 
+  enum PropType
+  {
+    Disabled,
+    Space,
+    Bool,
+    Color,
+    String,
+    Selector,
+    DblSpin,
+    IntSpin,
+    Double,
+    Integer,
+    GroupBox,
+    Tab,
+    Frame,
+    Font,
+    DirList,
+    File,
+    Slider,
+    Shortcut,
+    ShortcutTree,
+    BiColor,
+    Background
+  };
 
   /** 
-  * Creates a one property
-  * \param theSection - name of section (domain of using) of the property.
-  * \param theName - name (title) of the value.
-  * \param theType - type of the value.
-  * \param theValue - initial value of the property.
-  */
-  Config_Prop(const std::string& theSection,
-              const std::string& theName,
-              const std::string& theTitle,
-              PropType theType,
-              const std::string& theValue ) {
+   * Creates a one property
+   * \param theSection - name of section (domain of using) of the property.
+   * \param theName - name (title) of the value.
+   * \param theType - type of the value.
+   * \param theValue - initial value of the property.
+   */
+  Config_Prop(const std::string& theSection, const std::string& theName,
+              const std::string& theTitle, PropType theType, const std::string& theValue)
+  {
     mySection = theSection;
     myName = theName;
     myTitle = theTitle;
@@ -40,24 +57,48 @@ public:
     myValue = theValue;
   }
 
-  std::string section() const { return mySection; }
-  std::string name() const { return myName; }
+  std::string section() const
+  {
+    return mySection;
+  }
+  std::string name() const
+  {
+    return myName;
+  }
 
-  std::string title() const { return myTitle; }
-  void setTitle(const std::string& theTitle) { myTitle = theTitle; }
+  std::string title() const
+  {
+    return myTitle;
+  }
+  void setTitle(const std::string& theTitle)
+  {
+    myTitle = theTitle;
+  }
 
-  PropType type() const { return myType; }
-  void setType(PropType theType) { myType = theType; }
+  PropType type() const
+  {
+    return myType;
+  }
+  void setType(PropType theType)
+  {
+    myType = theType;
+  }
 
-  std::string value() const { return myValue; }
-  void setValue(const std::string& theValue) { myValue = theValue; }
+  std::string value() const
+  {
+    return myValue;
+  }
+  void setValue(const std::string& theValue)
+  {
+    myValue = theValue;
+  }
 
   bool operator==(const Config_Prop* theProp) const
   {
     return (mySection == theProp->section()) && (myName == theProp->name());
   }
 
-private:
+ private:
   std::string mySection;
   std::string myName;
   std::string myTitle;
@@ -67,4 +108,4 @@ private:
 
 typedef std::list<Config_Prop*> Config_Properties;
 
-#endif
\ No newline at end of file
+#endif
index 4fa3d7090043cbf73b7200b3069ccae48c02fd97..c296cc864772f6b0c66a95cc8bd7b8d07f47898d 100644 (file)
@@ -4,21 +4,14 @@
 
 #include "Config_PropManager.h"
 
-
-
 std::vector<int> stringToRGB(const std::string& theColor);
 int stringToInteger(const std::string& theInt);
 double stringToDouble(const std::string& theDouble);
 
-
 Config_Properties Config_PropManager::myProps;
 
-
-
-bool Config_PropManager::registerProp(const std::string& theSection,
-                                      const std::string& theName,
-                                      const std::string& theTitle,
-                                      Config_Prop::PropType theType,
+bool Config_PropManager::registerProp(const std::string& theSection, const std::string& theName,
+                                      const std::string& theTitle, Config_Prop::PropType theType,
                                       const std::string& theValue)
 {
   Config_Prop* aProp = findProp(theSection, theName);
@@ -35,8 +28,7 @@ bool Config_PropManager::registerProp(const std::string& theSection,
   return true;
 }
 
-Config_Prop* Config_PropManager::findProp(const std::string& theSection,
-                                          const std::string& theName)
+Config_Prop* Config_PropManager::findProp(const std::string& theSection, const std::string& theName)
 {
   Config_Properties::const_iterator aIt;
   for (aIt = myProps.cbegin(); aIt != myProps.cend(); ++aIt) {
@@ -47,7 +39,6 @@ Config_Prop* Config_PropManager::findProp(const std::string& theSection,
   return NULL;
 }
 
-
 Config_Properties Config_PropManager::getProperties()
 {
   Config_Properties aRes;
@@ -86,10 +77,8 @@ Config_Properties Config_PropManager::getProperties(const std::string& theSectio
   return aRes;
 }
 
-
-std::string Config_PropManager::string(const std::string& theSection, 
-                                      const std::string& theName,
-                                      const std::string& theDefault)
+std::string Config_PropManager::string(const std::string& theSection, const std::string& theName,
+                                       const std::string& theDefault)
 {
   Config_Properties aProps = getProperties(theSection);
   Config_Properties::const_iterator aIt;
@@ -101,8 +90,7 @@ std::string Config_PropManager::string(const std::string& theSection,
   return theDefault;
 }
 
-
-std::vector<int> Config_PropManager::color(const std::string& theSection, 
+std::vector<int> Config_PropManager::color(const std::string& theSection,
                                            const std::string& theName,
                                            const std::string& theDefault)
 {
@@ -110,24 +98,20 @@ std::vector<int> Config_PropManager::color(const std::string& theSection,
   return stringToRGB(aStr);
 }
 
-int Config_PropManager::integer(const std::string& theSection, 
-                      const std::string& theName,
-                      const std::string& theDefault)
+int Config_PropManager::integer(const std::string& theSection, const std::string& theName,
+                                const std::string& theDefault)
 {
   std::string aStr = string(theSection, theName, theDefault);
   return stringToInteger(aStr);
 }
 
-double Config_PropManager::real(const std::string& theSection, 
-                      const std::string& theName,
-                      const std::string& theDefault)
+double Config_PropManager::real(const std::string& theSection, const std::string& theName,
+                                const std::string& theDefault)
 {
   std::string aStr = string(theSection, theName, theDefault);
   return stringToDouble(aStr);
 }
 
-
-
 std::vector<int> stringToRGB(const std::string& theColor)
 {
   std::vector<int> aRes(3);
index d650b0e387c6b54dfeacde5d01b2828d5b4a1cae..8f36c3500fadc1939c216d02895b8b3e372de9d6 100644 (file)
 //! Class wihich let to register properties
 class CONFIG_EXPORT Config_PropManager
 {
-public:
+ public:
 
   /** 
-  * Registers property parameters
-  * \param theOwnerId - name of owner (name of plugin for example)
-  * \param theSection - name of section (domain of using) of the property.
-  * \param theName - name (title) of the value.
-  * \param theType - type of the value.
-  * \param theValue - initial value of the property
-  * Returns True if the property succesfully registered
-  */
-  static bool registerProp(const std::string& theSection,
-                           const std::string& theName,
-                           const std::string& theTitle,
-                           Config_Prop::PropType theType,
+   * Registers property parameters
+   * \param theOwnerId - name of owner (name of plugin for example)
+   * \param theSection - name of section (domain of using) of the property.
+   * \param theName - name (title) of the value.
+   * \param theType - type of the value.
+   * \param theValue - initial value of the property
+   * Returns True if the property succesfully registered
+   */
+  static bool registerProp(const std::string& theSection, const std::string& theName,
+                           const std::string& theTitle, Config_Prop::PropType theType,
                            const std::string& theValue);
 
-  static Config_Prop* findProp(const std::string& theSection,
-                               const std::string& theName);
+  static Config_Prop* findProp(const std::string& theSection, const std::string& theName);
 
   static Config_Properties getProperties();
 
@@ -44,22 +41,17 @@ public:
   static Config_Properties getProperties(const std::string& theSection);
 
   //! Returns value of the property by its owner, section, and name
-  static std::string string(const std::string& theSection, 
-                            const std::string& theName,
-                            const std::string& theDefault);              
-  static std::vector<int> color(const std::string& theSection, 
-                                const std::string& theName,
-                                const std::string& theDefault);              
-  static int integer(const std::string& theSection, 
-                      const std::string& theName,
-                      const std::string& theDefault);              
-  static double real(const std::string& theSection, 
-                      const std::string& theName,
-                      const std::string& theDefault);              
-
-private:
+  static std::string string(const std::string& theSection, const std::string& theName,
+                            const std::string& theDefault);
+  static std::vector<int> color(const std::string& theSection, const std::string& theName,
+                                const std::string& theDefault);
+  static int integer(const std::string& theSection, const std::string& theName,
+                     const std::string& theDefault);
+  static double real(const std::string& theSection, const std::string& theName,
+                     const std::string& theDefault);
+
+ private:
   static Config_Properties myProps;
 };
 
-
-#endif
\ No newline at end of file
+#endif
index b70511796daa17c7e5c8f15e551299b723d8c72c..61ee376c00d87c6b7f9ba2a1bffa3676137b1ccf 100644 (file)
@@ -8,7 +8,7 @@
 #include <Config_ValidatorMessage.h>
 
 Config_ValidatorMessage::Config_ValidatorMessage(const Events_ID theId, const void* theParent)
-: Events_Message(theId, theParent)
+    : Events_Message(theId, theParent)
 {
   myValidatorId = "";
   myFeatureId = "";
index f43c351b00fc23d6b8670752765829af852c71de..e344cd8863fcfd2f7b6461e70b55e54c0ea0a554 100644 (file)
@@ -24,22 +24,17 @@ class Config_ValidatorMessage : public Events_Message
   std::string myAttributeId;
   std::list<std::string> myVaidatorParameters;
 
-public:
-  CONFIG_EXPORT Config_ValidatorMessage(const Events_ID theId, const void* theParent = 0);
-  CONFIG_EXPORT virtual ~Config_ValidatorMessage();
+ public:
+  CONFIG_EXPORT Config_ValidatorMessage(const Events_ID theId, const void* theParent = 0);CONFIG_EXPORT virtual ~Config_ValidatorMessage();
 
   //CONFIG_EXPORT static const char* UID() const;
 
-  CONFIG_EXPORT const std::string& validatorId() const;
-  CONFIG_EXPORT const std::string& featureId() const;
-  CONFIG_EXPORT const std::string& attributeId() const;
-  CONFIG_EXPORT const std::list<std::string>& parameters() const;
-  CONFIG_EXPORT bool isValid() const;
+  CONFIG_EXPORT const std::string& validatorId() const;CONFIG_EXPORT const std::string& featureId() const;CONFIG_EXPORT const std::string& attributeId() const;CONFIG_EXPORT const std::list<
+      std::string>& parameters() const;CONFIG_EXPORT bool isValid() const;
 
-  CONFIG_EXPORT void setValidatorId(const std::string& theId);
-  CONFIG_EXPORT void setFeatureId(const std::string& theId);
-  CONFIG_EXPORT void setAttributeId(const std::string& theId);
-  CONFIG_EXPORT void setValidatorParameters(const std::list<std::string>& parameters);
+  CONFIG_EXPORT void setValidatorId(const std::string& theId);CONFIG_EXPORT void setFeatureId(
+      const std::string& theId);CONFIG_EXPORT void setAttributeId(const std::string& theId);CONFIG_EXPORT void setValidatorParameters(
+      const std::list<std::string>& parameters);
 };
 
 #endif /* Config_ValidatorMessage_H_ */
index 8d295ce05a64e6ae50d8c4adf9ae109f7b26eb4a..333f9219a37594c61f653bdd7b529c76dbc6d216 100644 (file)
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
-
 Config_WidgetAPI::Config_WidgetAPI(std::string theRawXml)
 {
   myDoc = xmlParseDoc(BAD_CAST theRawXml.c_str());
   myCurrentNode = xmlDocGetRootElement(myDoc);
 }
 
-
 Config_WidgetAPI::~Config_WidgetAPI()
 {
   xmlFreeDoc(myDoc);
@@ -31,9 +29,9 @@ bool Config_WidgetAPI::toNextWidget()
   xmlNodePtr aNextNode = myCurrentNode;
   do {
     aNextNode = aNextNode->next;
-  } while(aNextNode && !isElementNode(aNextNode));
+  } while (aNextNode && !isElementNode(aNextNode));
 
-  if(!aNextNode) {
+  if (!aNextNode) {
     toParentWidget();
     return false;
   }
@@ -43,11 +41,11 @@ bool Config_WidgetAPI::toNextWidget()
 
 bool Config_WidgetAPI::toChildWidget()
 {
-  if(myCurrentNode && hasChild(myCurrentNode)) {
+  if (myCurrentNode && hasChild(myCurrentNode)) {
     myCurrentNode = myCurrentNode->children;
-    while(!isElementNode(myCurrentNode)) {
+    while (!isElementNode(myCurrentNode)) {
       myCurrentNode = myCurrentNode->next;
-    } 
+    }
     return true;
   }
   return false;
@@ -55,7 +53,7 @@ bool Config_WidgetAPI::toChildWidget()
 
 bool Config_WidgetAPI::toParentWidget()
 {
-  if(myCurrentNode) {
+  if (myCurrentNode) {
     myCurrentNode = myCurrentNode->parent;
   }
   return myCurrentNode != NULL;
@@ -64,7 +62,7 @@ bool Config_WidgetAPI::toParentWidget()
 std::string Config_WidgetAPI::widgetType() const
 {
   std::string result = "";
-  if(myCurrentNode) {
+  if (myCurrentNode) {
     result = std::string((char *) myCurrentNode->name);
   }
   return result;
@@ -73,13 +71,13 @@ std::string Config_WidgetAPI::widgetType() const
 bool Config_WidgetAPI::isContainerWidget() const
 {
   return isNode(myCurrentNode, WDG_GROUP, WDG_CHECK_GROUP,
-                               NULL);
+  NULL);
 }
 
 bool Config_WidgetAPI::isPagedWidget() const
 {
   return isNode(myCurrentNode, WDG_TOOLBOX, WDG_SWITCH,
-                               NULL);
+  NULL);
 }
 
 std::string Config_WidgetAPI::getProperty(const char* thePropName) const
index 190ccfc7fafd450dcd7ea1ea931414cf43b35455..d7c12e957e09f7bbcc587f0945971e498aacaa1e 100644 (file)
@@ -25,10 +25,9 @@ typedef xmlDoc *xmlDocPtr;
 struct _xmlDoc;
 //<<
 
-
 class CONFIG_EXPORT Config_WidgetAPI
 {
-public:
+ public:
   Config_WidgetAPI(std::string theRawXml);
   virtual ~Config_WidgetAPI();
 
@@ -47,7 +46,7 @@ public:
 
   std::string getProperty(const char* thePropName) const;
 
-private:
+ private:
   xmlDocPtr myDoc;
   xmlNodePtr myCurrentNode;
 
index f0214657bb339201c81a8ee1d5fda147189b4838..e4125b3e688049f15812d0e01188d0c4cb74def5 100644 (file)
@@ -20,7 +20,6 @@
 #include <iostream>
 #endif
 
-
 Config_WidgetReader::Config_WidgetReader(const std::string& theXmlFile)
     : Config_XMLReader(theXmlFile)
 
@@ -41,7 +40,6 @@ std::string Config_WidgetReader::featureDescription(const std::string& theFeatur
   return myDescriptionCache[theFeatureName];
 }
 
-
 void Config_WidgetReader::processNode(xmlNodePtr theNode)
 {
   if (isNode(theNode, NODE_FEATURE, NULL)) {
@@ -63,7 +61,7 @@ void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode)
 {
   xmlNodePtr aNode = xmlFirstElementChild(theNode);
   std::list<xmlNodePtr> aSourceNodes;
-  while(aNode != NULL) {
+  while (aNode != NULL) {
     if (isNode(aNode, NODE_SOURCE, NULL)) {
       Config_XMLReader aSourceReader = Config_XMLReader(getProperty(aNode, SOURCE_FILE));
       xmlNodePtr aSourceRoot = aSourceReader.findRoot();
@@ -72,7 +70,7 @@ void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode)
       }
       xmlNodePtr aSourceNode = xmlFirstElementChild(aSourceRoot);
       xmlNodePtr aTargetNode = xmlDocCopyNodeList(aNode->doc, aSourceNode);
-      while(aTargetNode != NULL) {
+      while (aTargetNode != NULL) {
         xmlNodePtr aNextNode = xmlNextElementSibling(aTargetNode);
         xmlAddPrevSibling(aNode, aTargetNode);
         aTargetNode = aNextNode;
@@ -83,7 +81,7 @@ void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode)
   }
   //Remove "SOURCE" node.
   std::list<xmlNodePtr>::iterator it = aSourceNodes.begin();
-  for(; it != aSourceNodes.end(); it++) {
+  for (; it != aSourceNodes.end(); it++) {
     xmlUnlinkNode(*it);
     xmlFreeNode(*it);
   }
index c9c2f060267d353e9356dcdfaf6794190abde845..55ce4e932b06183b0c8aa35ebc7bacb53af05539 100644 (file)
 #include <map>
 #include <string>
 
-
-class Config_WidgetReader: public Config_XMLReader
+class Config_WidgetReader : public Config_XMLReader
 {
-public:
-  CONFIG_EXPORT Config_WidgetReader(const std::string& theXmlFile);
-  CONFIG_EXPORT virtual ~Config_WidgetReader();
+ public:
+  CONFIG_EXPORT Config_WidgetReader(const std::string& theXmlFile);CONFIG_EXPORT virtual ~Config_WidgetReader();
 
-  CONFIG_EXPORT std::string featureWidgetCfg(const std::string& theFeatureName);
-  CONFIG_EXPORT std::string featureDescription(const std::string& theFeatureName);
+  CONFIG_EXPORT std::string featureWidgetCfg(const std::string& theFeatureName);CONFIG_EXPORT std::string featureDescription(
+      const std::string& theFeatureName);
 
-protected:
+ protected:
   void processNode(xmlNodePtr theNode);
   bool processChildren(xmlNodePtr theNode);
   std::string dumpNode(xmlNodePtr theNode);
   void resolveSourceNodes(xmlNodePtr theNode);
 
-private:
+ private:
   std::map<std::string, std::string> myWidgetCache;
   std::map<std::string, std::string> myDescriptionCache;
 
index 8d618b102f0731f9e5d424808d8e67f0aab52719..f75748f1847a091e635de8664a963f99fd9531ad 100644 (file)
 #include <libxml/tree.h>
 
 /*
-#ifdef WIN32
-//For GetModuleFileNameW
-#include <windows.h>
-#endif
-*/
+ #ifdef WIN32
+ //For GetModuleFileNameW
+ #include <windows.h>
+ #endif
+ */
 
 #ifdef _DEBUG
 #include <iostream>
@@ -70,9 +70,9 @@ void Config_XMLReader::processNode(xmlNodePtr theNode)
     std::string aSourceFile = getProperty(theNode, SOURCE_FILE);
     Config_XMLReader aSourceReader = Config_XMLReader(aSourceFile);
     readRecursively(aSourceReader.findRoot());
-    #ifdef _DEBUG
+#ifdef _DEBUG
     std::cout << "Config_XMLReader::sourced node: " << aSourceFile << std::endl;
-    #endif
+#endif
   } else if (isNode(theNode, NODE_VALIDATOR, NULL)) {
     processValidator(theNode);
   }
@@ -121,9 +121,9 @@ void Config_XMLReader::readRecursively(xmlNodePtr theParent)
   if (!theParent)
     return;
   xmlNodePtr aNode = theParent->xmlChildrenNode;
-  for(; aNode; aNode = aNode->next) {
+  for (; aNode; aNode = aNode->next) {
     //Still no text processing in features...
-    if(!isElementNode(aNode)) {
+    if (!isElementNode(aNode)) {
       continue;
     }
     processNode(aNode);
@@ -165,7 +165,7 @@ void Config_XMLReader::processValidator(xmlNodePtr theNode)
   aMessage.setValidatorId(aValidatorId);
   aMessage.setValidatorParameters(aValidatorParameters);
   xmlNodePtr aFeatureOrWdgNode = theNode->parent;
-  if(isNode(aFeatureOrWdgNode, NODE_FEATURE, NULL)) {
+  if (isNode(aFeatureOrWdgNode, NODE_FEATURE, NULL)) {
     aMessage.setFeatureId(getProperty(aFeatureOrWdgNode, _ID));
   } else {
     aMessage.setAttributeId(getProperty(aFeatureOrWdgNode, _ID));
index 3a8219cdae749d348877a38e552c232edd38b828..b3e1554ee00d0c0752a69f2f2aed6ea060109788 100644 (file)
@@ -32,16 +32,15 @@ struct _xmlDoc;
  */
 class Config_XMLReader
 {
-public:
-  CONFIG_EXPORT Config_XMLReader(const std::string& theXmlFile);
-  CONFIG_EXPORT virtual ~Config_XMLReader();
+ public:
+  CONFIG_EXPORT Config_XMLReader(const std::string& theXmlFile);CONFIG_EXPORT virtual ~Config_XMLReader();
 
   CONFIG_EXPORT void readAll();
 
-public:
+ public:
   CONFIG_EXPORT xmlNodePtr findRoot();
 
-protected:
+ protected:
   virtual void processNode(xmlNodePtr aNode);
   virtual bool processChildren(xmlNodePtr aNode);
 
@@ -51,12 +50,12 @@ protected:
   std::string getProperty(xmlNodePtr theNode, const char* property);
   void processValidator(xmlNodePtr theNode);
 
-protected:
+ protected:
   std::string myCurrentFeature;
 
-protected:
+ protected:
   std::string myDocumentPath;
-  xmlDocPtr   myXmlDoc;
+  xmlDocPtr myXmlDoc;
 };
 
 #endif /* CONFIG_XMLREADER_H_ */
index 587ac534d71db68af33881dfbeeb0dccb3180627..1edcc6c10227d85502136482bddee2de5d22a448 100644 (file)
@@ -1,18 +1,18 @@
-#ifndef CONFIG_H
-#define CONFIG_H
-
-#if defined CONFIG_EXPORTS
-#if defined WIN32
-#define CONFIG_EXPORT              __declspec( dllexport )
-#else
-#define CONFIG_EXPORT
-#endif
-#else
-#if defined WIN32
-#define CONFIG_EXPORT              __declspec( dllimport )
-#else
-#define CONFIG_EXPORT
-#endif
-#endif
-
-#endif //CONFIG_H
+#ifndef CONFIG_H\r
+#define CONFIG_H\r
+\r
+#if defined CONFIG_EXPORTS\r
+#if defined WIN32\r
+#define CONFIG_EXPORT              __declspec( dllexport )\r
+#else\r
+#define CONFIG_EXPORT\r
+#endif\r
+#else\r
+#if defined WIN32\r
+#define CONFIG_EXPORT              __declspec( dllimport )\r
+#else\r
+#define CONFIG_EXPORT\r
+#endif\r
+#endif\r
+\r
+#endif //CONFIG_H\r
\ No newline at end of file
index 6b0d729a44c68919eb1cdfe1fe29276cf9de4037..60d5694f581cd0e328b481759a95abe52efe05b4 100644 (file)
@@ -9,7 +9,7 @@ using namespace std;
 // the only created instance of this plugin
 static ConstructionPlugin_Plugin* MY_INSTANCE = new ConstructionPlugin_Plugin();
 
-ConstructionPlugin_Plugin::ConstructionPlugin_Plugin() 
+ConstructionPlugin_Plugin::ConstructionPlugin_Plugin()
 {
   // register this plugin
   ModelAPI_PluginManager::get()->registerPlugin(this);
index 95ab19376e52ed4921a86fd68f5ce4c382445201..143b786e55d931542e4350dd2b0ab72753680755 100644 (file)
@@ -5,18 +5,17 @@
 #ifndef ConstructionPlugin_Plugin_H_
 #define ConstructionPlugin_Plugin_H_
 
-
 #include "ConstructionPlugin.h"
 #include "ModelAPI_Plugin.h"
 #include "ModelAPI_Feature.h"
 
-class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin: public ModelAPI_Plugin
+class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin : public ModelAPI_Plugin
 {
-public:
+ public:
   /// Creates the feature object of this plugin by the feature string ID
   virtual FeaturePtr createFeature(std::string theFeatureID);
 
-public:
+ public:
   /// Is needed for python wrapping by swig
   ConstructionPlugin_Plugin();
 };
index 5a879d49d7df64f9aaace7e1251898cdd8e9c7c7..e39bcc06efd38d8591c7f833c06ef193011a183a 100644 (file)
@@ -24,12 +24,11 @@ void ConstructionPlugin_Point::initAttributes()
   data()->addAttribute(POINT_ATTR_Z, ModelAPI_AttributeDouble::type());
 }
 
-void ConstructionPlugin_Point::execute() 
+void ConstructionPlugin_Point::execute()
 {
-  boost::shared_ptr<GeomAPI_Pnt> aPnt(new GeomAPI_Pnt(
-    data()->real(POINT_ATTR_X)->value(), 
-    data()->real(POINT_ATTR_Y)->value(), 
-    data()->real(POINT_ATTR_Z)->value()));
+  boost::shared_ptr<GeomAPI_Pnt> aPnt(
+      new GeomAPI_Pnt(data()->real(POINT_ATTR_X)->value(), data()->real(POINT_ATTR_Y)->value(),
+                      data()->real(POINT_ATTR_Z)->value()));
 
   boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
   aConstr->setShape(GeomAlgoAPI_PointBuilder::point(aPnt));
index a5f183690e4e960ae6b5feda5570a26c3003f0e1..63a13422614b10b26b218487c5657141b14d41fd 100644 (file)
@@ -22,16 +22,22 @@ const std::string POINT_ATTR_Z = "z";
  * \ingroup DataModel
  * \brief Feature for creation of the new part in PartSet.
  */
-class ConstructionPlugin_Point: public ModelAPI_Feature
+class ConstructionPlugin_Point : public ModelAPI_Feature
 {
-public:
+ public:
   /// Returns the kind of a feature
-  CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = CONSTRUCTION_POINT_KIND; return MY_KIND;}
+  CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = CONSTRUCTION_POINT_KIND;
+    return MY_KIND;
+  }
 
   /// Returns to which group in the document must be added feature
-  CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Construction"; return MY_GROUP;}
+  CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getGroup()
+  {
+    static std::string MY_GROUP = "Construction";
+    return MY_GROUP;
+  }
 
   /// Creates a new part document if needed
   CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
index ff3fd58e82ee0c7fad634b73c4ed86a8445bb5a2..7fe307b6a9c16d08ec78f537494cabf6439c7343 100644 (file)
@@ -9,7 +9,7 @@
 #include <Events_Loop.h>
 
 Events_Error::Events_Error(char* theDescription, const void* theSender)
- : Events_Message(Events_Error::errorID(), theSender)
   : Events_Message(Events_Error::errorID(), theSender)
 {
   myDescription = theDescription;
 }
@@ -37,5 +37,5 @@ void Events_Error::send(char* theDescription, const void* theSender)
 
 void Events_Error::send(std::string theDescription, const void* theSender)
 {
-  Events_Error::send((char*)theDescription.c_str(), theSender);
+  Events_Error::send((char*) theDescription.c_str(), theSender);
 }
index 7e2e62e293ac15c691ef55c01aeab06fb4f05f03..f3c7f8024f84707aa9f0b7fa502414112fad3b1a 100644 (file)
 
 #include <string>
 
-class EVENTS_EXPORT Events_Error: public Events_Message
+class EVENTS_EXPORT Events_Error : public Events_Message
 {
-  char* myDescription; ///< pointer to the description of the error
+  char* myDescription;  ///< pointer to the description of the error
 
-public:
+ public:
   virtual ~Events_Error();
 
   static Events_ID errorID();
@@ -25,7 +25,7 @@ public:
   static void send(char* theDescription, const void* theSender = 0);
   static void send(std::string theDescription, const void* theSender = 0);
 
-protected:
+ protected:
   Events_Error(char* theDescription, const void* theSender = 0);
 };
 
index 5bac8dc8a8bf444330d716c3bd5f93f1fb5c36a2..ac7714f021520c589d8571b4ecf6d0ffbbc8480f 100644 (file)
@@ -15,9 +15,10 @@ class Events_Message;
  * If some object wants to listen some events it must inherit
  * this class and register in the Loop.
  */
-class EVENTS_EXPORT Events_Listener {
+class EVENTS_EXPORT Events_Listener
+{
 
-public:
+ public:
   //! This method is called by loop when the event is started to process.
   virtual void processEvent(const Events_Message* theMessage) = 0;
 };
index 647d2bb4c545d576631a0420a42889e92f0eb661..b4718608a518bfa47cd59bc31e879c95b68fbcbc 100644 (file)
@@ -10,7 +10,7 @@
 std::map<void*, int> MY_SENDERS;
 
 Events_LongOp::Events_LongOp(void* theSender)
- : Events_Message(Events_LongOp::eventID(), theSender)
   : Events_Message(Events_LongOp::eventID(), theSender)
 {
 }
 
@@ -29,7 +29,7 @@ void Events_LongOp::start(void* theSender)
   bool toSend = MY_SENDERS.empty();
   if (MY_SENDERS.find(theSender) == MY_SENDERS.end())
     MY_SENDERS[theSender] = 1;
-  else 
+  else
     MY_SENDERS[theSender]++;
 
   if (toSend) {
@@ -42,8 +42,10 @@ void Events_LongOp::end(void* theSender)
 {
   if (MY_SENDERS.find(theSender) != MY_SENDERS.end()) {
     int aCount = MY_SENDERS[theSender];
-    if (aCount <= 1) MY_SENDERS.erase(theSender);
-    else MY_SENDERS[theSender] = aCount - 1;
+    if (aCount <= 1)
+      MY_SENDERS.erase(theSender);
+    else
+      MY_SENDERS[theSender] = aCount - 1;
   }
   if (MY_SENDERS.empty()) {
     Events_LongOp anEvent(theSender);
index dfb06cae444ec8ad1dabc843851a421589ca72a2..32240f7c13a23ddb0c66299281184dafc9c10125 100644 (file)
@@ -12,9 +12,9 @@
  * Informs the application that the long operation is performed.
  * Causes waiting coursor in GUI.
  */
-class EVENTS_EXPORT Events_LongOp: public Events_Message
+class EVENTS_EXPORT Events_LongOp : public Events_Message
 {
-public:
+ public:
   virtual ~Events_LongOp();
   /// Returns the identifier of this event
   static Events_ID eventID();
@@ -23,9 +23,9 @@ public:
   /// Stops the long operation
   static void end(void* theSender = 0);
   /// Returns true if the long operation is performed
-  static bool isPerformed(); 
+  static bool isPerformed();
 
-protected:
+ protected:
   Events_LongOp(void* theSender = 0);
 };
 
index 40917a64f710c5b7d7c815fb3e8f62313ed0bd0d..c8cf0e86e8874d5c71ce14fa4b1094f80c44046c 100644 (file)
@@ -24,8 +24,8 @@ Events_ID Events_Loop::eventByName(const char* theName)
   char* aResult;
   string aName(theName);
   map<string, char*>::iterator aFound = CREATED_EVENTS.find(aName);
-  if (aFound == CREATED_EVENTS.end()) { //not created yet
-    aResult = strdup(theName); // copy to make unique internal pointer
+  if (aFound == CREATED_EVENTS.end()) {  //not created yet
+    aResult = strdup(theName);  // copy to make unique internal pointer
     CREATED_EVENTS[aName] = aResult;
   } else
     aResult = aFound->second;
@@ -39,9 +39,9 @@ void Events_Loop::send(Events_Message& theMessage, bool isGroup)
   if (isGroup) {
     Events_MessageGroup* aGroup = dynamic_cast<Events_MessageGroup*>(&theMessage);
     if (aGroup) {
-      std::map<char*, Events_MessageGroup*>::iterator aMyGroup = 
-        myGroups.find(aGroup->eventID().eventText());
-      if (aMyGroup == myGroups.end()) { // create a new group of messages for accumulation
+      std::map<char*, Events_MessageGroup*>::iterator aMyGroup = myGroups.find(
+          aGroup->eventID().eventText());
+      if (aMyGroup == myGroups.end()) {  // create a new group of messages for accumulation
         myGroups[aGroup->eventID().eventText()] = aGroup->newEmpty();
         aMyGroup = myGroups.find(aGroup->eventID().eventText());
       }
@@ -59,14 +59,14 @@ void Events_Loop::send(Events_Message& theMessage, bool isGroup)
         theMessage.sender());
     if (aFindSender != aFindID->second.end()) {
       list<Events_Listener*>& aListeners = aFindSender->second;
-      for(list<Events_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
+      for (list<Events_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
         (*aL)->processEvent(&theMessage);
     }
-    if (theMessage.sender()) { // also call for NULL senders registered
+    if (theMessage.sender()) {  // also call for NULL senders registered
       aFindSender = aFindID->second.find(NULL);
       if (aFindSender != aFindID->second.end()) {
         list<Events_Listener*>& aListeners = aFindSender->second;
-        for(list<Events_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
+        for (list<Events_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
           (*aL)->processEvent(&theMessage);
       }
     }
@@ -74,34 +74,33 @@ void Events_Loop::send(Events_Message& theMessage, bool isGroup)
 }
 
 void Events_Loop::registerListener(Events_Listener* theListener, const Events_ID theID,
-                                  void* theSender)
+                                   void* theSender)
 {
   map<char*, map<void*, list<Events_Listener*> > >::iterator aFindID = myListeners.find(
       theID.eventText());
-  if (aFindID == myListeners.end()) { // create container associated with ID
+  if (aFindID == myListeners.end()) {  // create container associated with ID
     myListeners[theID.eventText()] = map<void*, list<Events_Listener*> >();
     aFindID = myListeners.find(theID.eventText());
   }
 
   map<void*, list<Events_Listener*> >::iterator aFindSender = aFindID->second.find(theSender);
-  if (aFindSender == aFindID->second.end()) { // create container associated with sender
+  if (aFindSender == aFindID->second.end()) {  // create container associated with sender
     aFindID->second[theSender] = list<Events_Listener*>();
     aFindSender = aFindID->second.find(theSender);
   }
   // check that listener was not registered wit hsuch parameters before
   list<Events_Listener*>& aListeners = aFindSender->second;
-  for(list<Events_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
+  for (list<Events_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
     if (*aL == theListener)
-      return; // avoid duplicates
+      return;  // avoid duplicates
 
   aListeners.push_back(theListener);
 }
 
 void Events_Loop::flush(const Events_ID& theID)
 {
-  std::map<char*, Events_MessageGroup*>::iterator aMyGroup = 
-    myGroups.find(theID.eventText());
-  if (aMyGroup != myGroups.end()) { // really sends
+  std::map<char*, Events_MessageGroup*>::iterator aMyGroup = myGroups.find(theID.eventText());
+  if (aMyGroup != myGroups.end()) {  // really sends
     Events_MessageGroup* aGroup = aMyGroup->second;
     myGroups.erase(aMyGroup);
     send(*aGroup, false);
index e7a0b3a2a04f6ce033c6a3424ed0d63d8a7a8eb4..d62cea6add1f17f6b4fffe17f021c89df90b42bd 100644 (file)
@@ -23,17 +23,20 @@ class Events_MessageGroup;
  * Performing of events is processed in separated thread, so, sender takes 
  * control back immideately.
  */
-class Events_Loop {
+class Events_Loop
+{
   /// map from event ID to sender pointer to listeners that must be called for this
-  std::map<char*, std::map<void*, std::list<Events_Listener*> > >
-    myListeners;
+  std::map<char*, std::map<void*, std::list<Events_Listener*> > > myListeners;
 
   /// map from event ID to groupped messages (accumulated on flush)
   std::map<char*, Events_MessageGroup*> myGroups;
 
   //! The empty constructor, will be called at startup of the application, only once
-  Events_Loop() {};
-public:
+  Events_Loop()
+  {
+  }
+  ;
+ public:
   ///! Returns the main object of the loop, one per application.
   EVENTS_EXPORT static Events_Loop* loop();
   //! Returns the unique event by the given name. Call this method only on initialization of object
@@ -46,8 +49,8 @@ public:
 
   //! Registers (or adds if such listener is already registered) a listener 
   //! that will be called on the event and from the defined sender
-  EVENTS_EXPORT void registerListener(Events_Listener* theListener, const Events_ID theID, 
-    void* theSender = 0);
+  EVENTS_EXPORT void registerListener(Events_Listener* theListener, const Events_ID theID,
+                                      void* theSender = 0);
 
   //! Initializes sending of a group-message by the given ID
   EVENTS_EXPORT void flush(const Events_ID& theID);
index fe829a46895ad8da1c6049ebe5978a3088fc9909..ef8837c93f51d929f7c85896c584a0390bac811d 100644 (file)
  * used as an identifier (this is usefull for debugging of the events
  * with log files and in debugger).
  */
-class EVENTS_EXPORT Events_ID {
-  char* myID; ///< pointer to the text-identifier of the event, unique pointer for all events of such type
+class EVENTS_EXPORT Events_ID
+{
+  char* myID;  ///< pointer to the text-identifier of the event, unique pointer for all events of such type
 
-  Events_ID(char* theID) {myID = theID;}
+  Events_ID(char* theID)
+  {
+    myID = theID;
+  }
 
   friend class Events_Loop;
-public:
+ public:
   /// Returns the text-identifier of the event (for debugging reasons)
-  char* eventText() const {return myID;}
+  char* eventText() const
+  {
+    return myID;
+  }
   /// Allows to compare identifiers
-  bool operator==(const Events_ID& theID) const {return myID == theID.myID;}
+  bool operator==(const Events_ID& theID) const
+  {
+    return myID == theID.myID;
+  }
 };
 
 /**\class Events_Message
@@ -35,23 +45,35 @@ public:
  * \brief Message for communication between sender and listener of event.
  * Normally it is inherited by the higher-level 
  */
-class EVENTS_EXPORT Events_Message {
-  Events_ID myEventsId; ///< identifier of the event
-  void* mySender; ///< the sender object
+class EVENTS_EXPORT Events_Message
+{
+  Events_ID myEventsId;  ///< identifier of the event
+  void* mySender;  ///< the sender object
 
-public:
+ public:
 
   //! Creates the message
   Events_Message(const Events_ID theID, const void* theSender = 0)
-    : myEventsId(theID), mySender((void*) theSender) {}
+      : myEventsId(theID),
+        mySender((void*) theSender)
+  {
+  }
   //! do nothing in the destructor yet
-  virtual ~Events_Message() {}
+  virtual ~Events_Message()
+  {
+  }
 
   //! Returns identifier of the message
-  const Events_ID& eventID() const {return myEventsId;}
+  const Events_ID& eventID() const
+  {
+    return myEventsId;
+  }
 
   //! Returns sender of the message or NULL if it is anonymous message
-  void* sender() const {return mySender;}
+  void* sender() const
+  {
+    return mySender;
+  }
 };
 
 #endif
index 46d7c420a5fd11d3913a779268de2d32d2f8ee6d..232c8d1b636a5b04adf93dfe4f181d53be447b01 100644 (file)
  * Loop detects such messages and accumulates them without sending. On "flush" loop sends it
  * as a group-message.
  */
-class EVENTS_EXPORT Events_MessageGroup : public Events_Message {
+class EVENTS_EXPORT Events_MessageGroup : public Events_Message
+{
 
-public:
+ public:
 
   //! Creates the message
   Events_MessageGroup(const Events_ID theID, const void* theSender = 0)
-    : Events_Message(theID, theSender) {}
+      : Events_Message(theID, theSender)
+  {
+  }
   //! do nothing in the destructor yet
-  virtual ~Events_MessageGroup() {}
+  virtual ~Events_MessageGroup()
+  {
+  }
 
   //! Creates a new empty group (to store it in the loop before flush)
   virtual Events_MessageGroup* newEmpty() = 0;
index b232f18e7bd732b7f9d0fa8307654beb1b12e3c6..7c6a0eaebb82f4763ebcd333163a2e127c346648 100644 (file)
@@ -29,13 +29,13 @@ void FeaturesPlugin_Extrusion::initAttributes()
 
 void FeaturesPlugin_Extrusion::execute()
 {
-  boost::shared_ptr<ModelAPI_AttributeReference> aFaceRef = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(data()->attribute(FeaturesPlugin_Extrusion::FACE_ID()));
+  boost::shared_ptr<ModelAPI_AttributeReference> aFaceRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeReference>(data()->attribute(FeaturesPlugin_Extrusion::FACE_ID()));
   if (!aFaceRef)
     return;
-  boost::shared_ptr<ModelAPI_ResultConstruction> aConstr =
-    boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aFaceRef->value());
-  if (!aConstr) 
+  boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = boost::dynamic_pointer_cast<
+      ModelAPI_ResultConstruction>(aFaceRef->value());
+  if (!aConstr)
     return;
   boost::shared_ptr<GeomAPI_Shape> aFace = aConstr->shape();
   if (!aFace)
index f42a7d7f5c16aa535dc7b85aff22e06a5c643241..13a8c226e9ea2bc48ae7d6d936b6290fe656218e 100644 (file)
@@ -8,9 +8,9 @@
 #include "FeaturesPlugin.h"
 #include <ModelAPI_Feature.h>
 
-class FeaturesPlugin_Extrusion: public ModelAPI_Feature
+class FeaturesPlugin_Extrusion : public ModelAPI_Feature
 {
-public:
+ public:
   /// Extrusion kind
   inline static const std::string& ID()
   {
@@ -29,7 +29,7 @@ public:
     static const std::string MY_SIZE_ID("extrusion_size");
     return MY_SIZE_ID;
   }
-    /// attribute name of reverse direction
+  /// attribute name of reverse direction
   inline static const std::string& REVERSE_ID()
   {
     static const std::string MY_REVERSE_ID("extrusion_reverse");
@@ -37,8 +37,11 @@ public:
   }
 
   /// Returns the kind of a feature
-  FEATURESPLUGIN_EXPORT virtual const std::string& getKind() 
-  { static std::string MY_KIND = FeaturesPlugin_Extrusion::ID(); return MY_KIND; }
+  FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = FeaturesPlugin_Extrusion::ID();
+    return MY_KIND;
+  }
 
   /// Creates a new part document if needed
   FEATURESPLUGIN_EXPORT virtual void execute();
index 1ae9381cd9253ab3b3bb5792bd65b1bd8384a9fa..c84ddf680f65bf0731af7932c38e866c607d27d7 100644 (file)
@@ -9,7 +9,7 @@ using namespace std;
 // the only created instance of this plugin
 static FeaturesPlugin_Plugin* MY_INSTANCE = new FeaturesPlugin_Plugin();
 
-FeaturesPlugin_Plugin::FeaturesPlugin_Plugin() 
+FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
 {
   // register this plugin
   ModelAPI_PluginManager::get()->registerPlugin(this);
index 1b49efe5833a2308024bd31be37c84f729688ef6..560a2242a88e73a25f8747e802a716ac2029be75 100644 (file)
@@ -5,18 +5,17 @@
 #ifndef FeaturesPlugin_Plugin_H_
 #define FeaturesPlugin_Plugin_H_
 
-
 #include "FeaturesPlugin.h"
 #include <ModelAPI_Plugin.h>
 #include <ModelAPI_Feature.h>
 
-class FEATURESPLUGIN_EXPORT FeaturesPlugin_Plugin: public ModelAPI_Plugin
+class FEATURESPLUGIN_EXPORT FeaturesPlugin_Plugin : public ModelAPI_Plugin
 {
-public:
+ public:
   /// Creates the feature object of this plugin by the feature string ID
   virtual FeaturePtr createFeature(std::string theFeatureID);
 
-public:
+ public:
   /// Is needed for python wrapping by swig
   FeaturesPlugin_Plugin();
 };
index ec44e1c6392da25dff9e702b0205e21885cf74b3..4ba7232b37e44506e1f4ebbe8c69d9733619a4f6 100644 (file)
@@ -23,9 +23,8 @@
 #include <AIS_RadiusDimension.hxx>
 #include <AIS_Shape.hxx>
 
-
-const int CONSTRAINT_TEXT_HEIGHT = 28; /// the text height of the constraint
-const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20; /// the text selection tolerance
+const int CONSTRAINT_TEXT_HEIGHT = 28;  /// the text height of the constraint
+const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20;  /// the text selection tolerance
 
 // Initialization of color constants
 int Colors::COLOR_BROWN = Quantity_NOC_BROWN;
@@ -33,23 +32,21 @@ int Colors::COLOR_RED = Quantity_NOC_RED;
 int Colors::COLOR_GREEN = Quantity_NOC_GREEN;
 int Colors::COLOR_BLUE = Quantity_NOC_BLUE1;
 
-
 GeomAPI_AISObject::GeomAPI_AISObject()
-  : GeomAPI_Interface(new Handle(AIS_InteractiveObject)())
+    : GeomAPI_Interface(new Handle(AIS_InteractiveObject)())
 {
 }
 
 void GeomAPI_AISObject::createShape(boost::shared_ptr<GeomAPI_Shape> theShape)
 {
-  const TopoDS_Shape& aTDS = (theShape && theShape->implPtr<TopoDS_Shape>()) ?
-                             theShape->impl<TopoDS_Shape>() : TopoDS_Shape();
+  const TopoDS_Shape& aTDS =
+      (theShape && theShape->implPtr<TopoDS_Shape>()) ?
+          theShape->impl<TopoDS_Shape>() : TopoDS_Shape();
 
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
-  if (!anAIS.IsNull())
-  {
+  if (!anAIS.IsNull()) {
     Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
-    if (aShapeAIS)
-    {
+    if (aShapeAIS) {
       // if the AIS object is displayed in the opened local context in some mode, additional
       // AIS sub objects are created there. They should be rebuild for correct selecting.
       // It is possible to correct it by closing local context before the shape set and opening
@@ -59,27 +56,24 @@ void GeomAPI_AISObject::createShape(boost::shared_ptr<GeomAPI_Shape> theShape)
       aShapeAIS->Set(aTDS);
       aShapeAIS->Redisplay(Standard_True);
     }
-  }
-  else
+  } else
     setImpl(new Handle(AIS_InteractiveObject)(new AIS_Shape(aTDS)));
 }
 
-
 void GeomAPI_AISObject::createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
                                        boost::shared_ptr<GeomAPI_Pnt> theEndPoint,
                                        boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
-                                       boost::shared_ptr<GeomAPI_Pln> thePlane,
-                                       double                         theDistance)
+                                       boost::shared_ptr<GeomAPI_Pln> thePlane, double theDistance)
 {
   double aFlyout = 0;
-  if (theFlyoutPoint)
-  {
-    boost::shared_ptr<GeomAPI_Lin> aLine = 
-      boost::shared_ptr<GeomAPI_Lin>(new GeomAPI_Lin(theStartPoint, theEndPoint));
+  if (theFlyoutPoint) {
+    boost::shared_ptr<GeomAPI_Lin> aLine = boost::shared_ptr<GeomAPI_Lin>(
+        new GeomAPI_Lin(theStartPoint, theEndPoint));
     double aDist = aLine->distance(theFlyoutPoint);
 
     boost::shared_ptr<GeomAPI_XYZ> aLineDir = theEndPoint->xyz()->decreased(theStartPoint->xyz());
-    boost::shared_ptr<GeomAPI_XYZ> aFOutDir = theFlyoutPoint->xyz()->decreased(theStartPoint->xyz());
+    boost::shared_ptr<GeomAPI_XYZ> aFOutDir = theFlyoutPoint->xyz()->decreased(
+        theStartPoint->xyz());
     boost::shared_ptr<GeomAPI_XYZ> aNorm = thePlane->direction()->xyz();
     if (aLineDir->cross(aFOutDir)->dot(aNorm) < 0)
       aDist = -aDist;
@@ -87,14 +81,14 @@ void GeomAPI_AISObject::createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPo
   }
 
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
-  if (anAIS.IsNull())
-  {
-    Handle(AIS_LengthDimension) aDimAIS = new AIS_LengthDimension(
-      theStartPoint->impl<gp_Pnt>(), theEndPoint->impl<gp_Pnt>(), thePlane->impl<gp_Pln>());
+  if (anAIS.IsNull()) {
+    Handle(AIS_LengthDimension) aDimAIS = new AIS_LengthDimension(theStartPoint->impl<gp_Pnt>(),
+                                                                  theEndPoint->impl<gp_Pnt>(),
+                                                                  thePlane->impl<gp_Pln>());
     aDimAIS->SetCustomValue(theDistance);
 
     Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
-    anAspect->MakeArrows3d (Standard_False);
+    anAspect->MakeArrows3d(Standard_False);
     anAspect->MakeText3d(false);
     anAspect->TextAspect()->SetHeight(CONSTRAINT_TEXT_HEIGHT);
     anAspect->MakeTextShaded(false);
@@ -104,12 +98,11 @@ void GeomAPI_AISObject::createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPo
     aDimAIS->SetFlyout(aFlyout);
 
     setImpl(new Handle(AIS_InteractiveObject)(aDimAIS));
-  }
-  else {
+  } else {
     // update presentation
     Handle(AIS_LengthDimension) aDimAIS = Handle(AIS_LengthDimension)::DownCast(anAIS);
     if (!aDimAIS.IsNull()) {
-      aDimAIS->SetMeasuredGeometry(theStartPoint->impl<gp_Pnt>(), theEndPoint->impl<gp_Pnt>(), 
+      aDimAIS->SetMeasuredGeometry(theStartPoint->impl<gp_Pnt>(), theEndPoint->impl<gp_Pnt>(),
                                    thePlane->impl<gp_Pln>());
       aDimAIS->SetCustomValue(theDistance);
       aDimAIS->SetFlyout(aFlyout);
@@ -120,8 +113,8 @@ void GeomAPI_AISObject::createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPo
 }
 
 void GeomAPI_AISObject::createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
-                                     boost::shared_ptr<GeomAPI_Pnt>  theFlyoutPoint,
-                                     double                          theRadius)
+                                     boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+                                     double theRadius)
 {
   boost::shared_ptr<GeomAPI_Pnt> aCenter = theCircle->center();
 
@@ -141,29 +134,25 @@ void GeomAPI_AISObject::createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
   anAnchor->setZ(anAnchor->z() + aDelta * aDeltaDir->z());
 
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
-  if (anAIS.IsNull())
-  {
-    Handle(AIS_RadiusDimension) aDimAIS = 
-      new AIS_RadiusDimension(theCircle->impl<gp_Circ>(), anAnchor->impl<gp_Pnt>());
+  if (anAIS.IsNull()) {
+    Handle(AIS_RadiusDimension) aDimAIS = new AIS_RadiusDimension(theCircle->impl<gp_Circ>(),
+                                                                  anAnchor->impl<gp_Pnt>());
     aDimAIS->SetCustomValue(theRadius);
 
     Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
-    anAspect->MakeArrows3d (Standard_False);
+    anAspect->MakeArrows3d(Standard_False);
     anAspect->MakeText3d(false);
     anAspect->TextAspect()->SetHeight(CONSTRAINT_TEXT_HEIGHT);
     anAspect->MakeTextShaded(false);
     aDimAIS->DimensionAspect()->MakeUnitsDisplayed(false);
-    aDimAIS->SetDimensionAspect (anAspect);
+    aDimAIS->SetDimensionAspect(anAspect);
     aDimAIS->SetSelToleranceForText2d(CONSTRAINT_TEXT_SELECTION_TOLERANCE);
 
     setImpl(new Handle(AIS_InteractiveObject)(aDimAIS));
-  }
-  else
-  {
+  } else {
     // update presentation
     Handle(AIS_RadiusDimension) aDimAIS = Handle(AIS_RadiusDimension)::DownCast(anAIS);
-    if (!aDimAIS.IsNull())
-    {
+    if (!aDimAIS.IsNull()) {
       aDimAIS->SetMeasuredGeometry(theCircle->impl<gp_Circ>(), anAnchor->impl<gp_Pnt>());
       aDimAIS->SetCustomValue(theRadius);
       aDimAIS->Redisplay(Standard_True);
@@ -173,25 +162,21 @@ void GeomAPI_AISObject::createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
 
 void GeomAPI_AISObject::createParallel(boost::shared_ptr<GeomAPI_Shape> theLine1,
                                        boost::shared_ptr<GeomAPI_Shape> theLine2,
-                                       boost::shared_ptr<GeomAPI_Pnt>   theFlyoutPoint,
-                                       boost::shared_ptr<GeomAPI_Pln>   thePlane)
+                                       boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+                                       boost::shared_ptr<GeomAPI_Pln> thePlane)
 {
   Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
-  if (anAIS.IsNull())
-  {
-    Handle(AIS_ParallelRelation) aParallel = 
-      new AIS_ParallelRelation(theLine1->impl<TopoDS_Shape>(), theLine2->impl<TopoDS_Shape>(), aPlane);
+  if (anAIS.IsNull()) {
+    Handle(AIS_ParallelRelation) aParallel = new AIS_ParallelRelation(
+        theLine1->impl<TopoDS_Shape>(), theLine2->impl<TopoDS_Shape>(), aPlane);
     if (theFlyoutPoint)
       aParallel->SetPosition(theFlyoutPoint->impl<gp_Pnt>());
 
     setImpl(new Handle(AIS_InteractiveObject)(aParallel));
-  }
-  else
-  {
+  } else {
     Handle(AIS_ParallelRelation) aParallel = Handle(AIS_ParallelRelation)::DownCast(anAIS);
-    if (!aParallel.IsNull())
-    {
+    if (!aParallel.IsNull()) {
       aParallel->SetFirstShape(theLine1->impl<TopoDS_Shape>());
       aParallel->SetSecondShape(theLine2->impl<TopoDS_Shape>());
       aParallel->SetPlane(aPlane);
@@ -204,22 +189,19 @@ void GeomAPI_AISObject::createParallel(boost::shared_ptr<GeomAPI_Shape> theLine1
 
 void GeomAPI_AISObject::createPerpendicular(boost::shared_ptr<GeomAPI_Shape> theLine1,
                                             boost::shared_ptr<GeomAPI_Shape> theLine2,
-                                            boost::shared_ptr<GeomAPI_Pln>   thePlane)
+                                            boost::shared_ptr<GeomAPI_Pln> thePlane)
 {
   Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
-  if (anAIS.IsNull())
-  {
-    Handle(AIS_PerpendicularRelation) aPerpendicular = 
-      new AIS_PerpendicularRelation(theLine1->impl<TopoDS_Shape>(), theLine2->impl<TopoDS_Shape>(), aPlane);
+  if (anAIS.IsNull()) {
+    Handle(AIS_PerpendicularRelation) aPerpendicular = new AIS_PerpendicularRelation(
+        theLine1->impl<TopoDS_Shape>(), theLine2->impl<TopoDS_Shape>(), aPlane);
 
     setImpl(new Handle(AIS_InteractiveObject)(aPerpendicular));
-  }
-  else
-  {
-    Handle(AIS_PerpendicularRelation) aPerpendicular = Handle(AIS_PerpendicularRelation)::DownCast(anAIS);
-    if (!aPerpendicular.IsNull())
-    {
+  } else {
+    Handle(AIS_PerpendicularRelation) aPerpendicular = Handle(AIS_PerpendicularRelation)::DownCast(
+        anAIS);
+    if (!aPerpendicular.IsNull()) {
       aPerpendicular->SetFirstShape(theLine1->impl<TopoDS_Shape>());
       aPerpendicular->SetSecondShape(theLine2->impl<TopoDS_Shape>());
       aPerpendicular->SetPlane(aPlane);
@@ -228,13 +210,12 @@ void GeomAPI_AISObject::createPerpendicular(boost::shared_ptr<GeomAPI_Shape> the
   }
 }
 
-
 void GeomAPI_AISObject::setColor(const int& theColor)
 {
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
   if (anAIS.IsNull())
-    return ;
-  Quantity_Color aColor((Quantity_NameOfColor)theColor);
+    return;
+  Quantity_Color aColor((Quantity_NameOfColor) theColor);
   anAIS->SetColor(aColor);
   Handle(AIS_Dimension) aDimAIS = Handle(AIS_Dimension)::DownCast(anAIS);
   if (!aDimAIS.IsNull()) {
@@ -246,7 +227,7 @@ void GeomAPI_AISObject::setWidth(const double& theWidth)
 {
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
   if (anAIS.IsNull())
-    return ;
+    return;
   anAIS->SetWidth(theWidth);
 }
 
@@ -254,8 +235,8 @@ void GeomAPI_AISObject::setColor(int theR, int theG, int theB)
 {
   Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
   if (anAIS.IsNull())
-    return ;
-  Quantity_Color aColor(theR/255., theG/255., theB/255., Quantity_TOC_RGB);
+    return;
+  Quantity_Color aColor(theR / 255., theG / 255., theB / 255., Quantity_TOC_RGB);
   anAIS->SetColor(aColor);
   Handle(AIS_Dimension) aDimAIS = Handle(AIS_Dimension)::DownCast(anAIS);
   if (!aDimAIS.IsNull()) {
@@ -265,8 +246,8 @@ void GeomAPI_AISObject::setColor(int theR, int theG, int theB)
 
 bool GeomAPI_AISObject::empty() const
 {
-  Handle(AIS_InteractiveObject) anAIS = 
-    const_cast<GeomAPI_AISObject*>(this)->impl<Handle(AIS_InteractiveObject)>();
+  Handle(AIS_InteractiveObject) anAIS = const_cast<GeomAPI_AISObject*>(this)
+      ->impl<Handle(AIS_InteractiveObject)>();
   if (anAIS.IsNull())
     return true;
   return false;
index 215aa69b7589da470f05c15ac9608bfe58067bb0..574d39f137c26ed6688c73c77f830cc077eea80e 100644 (file)
@@ -30,7 +30,7 @@ struct GEOMAPI_EXPORT Colors
 
 class GEOMAPI_EXPORT GeomAPI_AISObject : public GeomAPI_Interface
 {
-public:
+ public:
   /// \brief Creation of empty AIS object
   GeomAPI_AISObject();
 
@@ -47,8 +47,7 @@ public:
   void createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
                       boost::shared_ptr<GeomAPI_Pnt> theEndPoint,
                       boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
-                      boost::shared_ptr<GeomAPI_Pln> thePlane,
-                      double                         theDistance);
+                      boost::shared_ptr<GeomAPI_Pln> thePlane, double theDistance);
 
   /** \brief Creates AIS_RadiusDimension object
    *  \param[in] theCircle      the radius is created for this circle
@@ -56,8 +55,7 @@ public:
    *  \param[in] theRadius      value of the radius to be shown
    */
   void createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
-                    boost::shared_ptr<GeomAPI_Pnt>  theFlyoutPoint,
-                    double                          theRadius);
+                    boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint, double theRadius);
 
   /** \brief Creates AIS_ParallelRelation object for two lines
    *  \param[in] theLine1       first parallel line
@@ -67,8 +65,8 @@ public:
    */
   void createParallel(boost::shared_ptr<GeomAPI_Shape> theLine1,
                       boost::shared_ptr<GeomAPI_Shape> theLine2,
-                      boost::shared_ptr<GeomAPI_Pnt>   theFlyoutPoint,
-                      boost::shared_ptr<GeomAPI_Pln>   thePlane);
+                      boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+                      boost::shared_ptr<GeomAPI_Pln> thePlane);
 
   /** \brief Creates AIS_PerpendicularRelation object for two lines
    *  \param[in] theLine1       first parallel line
@@ -77,7 +75,7 @@ public:
    */
   void createPerpendicular(boost::shared_ptr<GeomAPI_Shape> theLine1,
                            boost::shared_ptr<GeomAPI_Shape> theLine2,
-                           boost::shared_ptr<GeomAPI_Pln>   thePlane);
+                           boost::shared_ptr<GeomAPI_Pln> thePlane);
 
   /** \brief Assigns the color for the shape
    *  \param[in] theColor index of the color
index 31dbfab6cd7dcbfc5cebe735f6265d8c2e02fccc..566824e06007ddc6144f6f5127eed047de547f73 100644 (file)
 
 #define MY_CIRC static_cast<gp_Circ*>(myImpl)
 
-static gp_Circ* newCirc(const gp_Pnt& theCenter,
-                        const gp_Dir& theDir,
-                        const double  theRadius)
+static gp_Circ* newCirc(const gp_Pnt& theCenter, const gp_Dir& theDir, const double theRadius)
 {
   return new gp_Circ(gp_Ax2(theCenter, theDir), theRadius);
 }
 
 GeomAPI_Circ::GeomAPI_Circ(const boost::shared_ptr<GeomAPI_Pnt>& theCenter,
-                           const boost::shared_ptr<GeomAPI_Dir>& theDir,
-                           double                                theRadius)
-  : GeomAPI_Interface(newCirc(theCenter->impl<gp_Pnt>(),
-                              theDir->impl<gp_Dir>(), theRadius))
+                           const boost::shared_ptr<GeomAPI_Dir>& theDir, double theRadius)
+    : GeomAPI_Interface(newCirc(theCenter->impl<gp_Pnt>(), theDir->impl<gp_Dir>(), theRadius))
 {
 }
 
-const boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Circ::project(const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const
+const boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Circ::project(
+    const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const
 {
   boost::shared_ptr<GeomAPI_Pnt> aResult;
   if (!MY_CIRC)
-    return aResult;
+  return aResult;
 
   Handle(Geom_Circle) aCircle = new Geom_Circle(*MY_CIRC);
 
@@ -43,18 +40,15 @@ const boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Circ::project(const boost::shared_p
 
   GeomAPI_ProjectPointOnCurve aProj(aPoint, aCircle);
   Standard_Integer aNbPoint = aProj.NbPoints();
-  if (aNbPoint > 0)
-  {
+  if (aNbPoint > 0) {
     double aMinDistance = 0, aDistance;
-    for (Standard_Integer j = 1; j <= aNbPoint; j++)
-    {
+    for (Standard_Integer j = 1; j <= aNbPoint; j++) {
       gp_Pnt aNewPoint = aProj.Point(j);
       aDistance = aNewPoint.Distance(aPoint);
-      if (!aMinDistance || aDistance < aMinDistance)
-      {
+      if (!aMinDistance || aDistance < aMinDistance) {
         aMinDistance = aDistance;
         aResult = boost::shared_ptr<GeomAPI_Pnt>(
-          new GeomAPI_Pnt(aNewPoint.X(), aNewPoint.Y(), aNewPoint.Z()));
+            new GeomAPI_Pnt(aNewPoint.X(), aNewPoint.Y(), aNewPoint.Z()));
       }
     }
   }
index c74e76c014c04fafea01af06333bde7ae8390fef..37f8bfaf2299cd8507b28c4e47d364b2443c96b2 100644 (file)
@@ -16,13 +16,12 @@ class GeomAPI_Dir;
  * \brief Circle in 3D
  */
 
-class GEOMAPI_EXPORT GeomAPI_Circ: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_Circ : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation of circle defined by center point, direction and circle radius
   GeomAPI_Circ(const boost::shared_ptr<GeomAPI_Pnt>& theCenter,
-               const boost::shared_ptr<GeomAPI_Dir>& theDir,
-               double theRadius);
+               const boost::shared_ptr<GeomAPI_Dir>& theDir, double theRadius);
 
   /// Return center of the circle
   const boost::shared_ptr<GeomAPI_Pnt> center() const;
@@ -31,7 +30,8 @@ public:
   double radius() const;
 
   /// Project point on circle
-  const boost::shared_ptr<GeomAPI_Pnt> project(const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const;
+  const boost::shared_ptr<GeomAPI_Pnt> project(
+      const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const;
 };
 
 #endif
index 78c26d69f12049724139dcf49f75b2f26cedbe5d..65ef9b10786b77808f75544a3097b726e9bfdee9 100644 (file)
 
 #define MY_CIRC2D static_cast<gp_Circ2d*>(myImpl)
 
-static gp_Circ2d* newCirc2d(const double theCenterX, const double theCenterY,
-                            const gp_Dir2d theDir, const double theRadius)
+static gp_Circ2d* newCirc2d(const double theCenterX, const double theCenterY, const gp_Dir2d theDir,
+                            const double theRadius)
 {
   gp_Pnt2d aCenter(theCenterX, theCenterY);
   return new gp_Circ2d(gp_Ax2d(aCenter, theDir), theRadius);
 }
 
 static gp_Circ2d* newCirc2d(const double theCenterX, const double theCenterY,
-                            const double thePointX,   const double thePointY)
+                            const double thePointX, const double thePointY)
 {
   gp_Pnt2d aCenter(theCenterX, theCenterY);
   gp_Pnt2d aPoint(thePointX, thePointY);
@@ -34,35 +34,36 @@ static gp_Circ2d* newCirc2d(const double theCenterX, const double theCenterY,
   double aRadius = aCenter.Distance(aPoint);
 
   if (aCenter.IsEqual(aPoint, Precision::Confusion()))
-      return NULL;
+    return NULL;
 
   gp_Dir2d aDir(theCenterX - thePointX, theCenterY - thePointY);
-  
+
   return newCirc2d(theCenterX, theCenterY, aDir, aRadius);
 }
 
 GeomAPI_Circ2d::GeomAPI_Circ2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theCenter,
                                const boost::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint)
-  : GeomAPI_Interface(newCirc2d(theCenter->x(), theCenter->y(),
-                                theCirclePoint->x(),   theCirclePoint->y()))
-{}
+    : GeomAPI_Interface(
+        newCirc2d(theCenter->x(), theCenter->y(), theCirclePoint->x(), theCirclePoint->y()))
+{
+}
 
 GeomAPI_Circ2d::GeomAPI_Circ2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theCenter,
-                               const boost::shared_ptr<GeomAPI_Dir2d>& theDir,
-                               double theRadius)
- : GeomAPI_Interface(newCirc2d(theCenter->x(), theCenter->y(),
-                               theDir->impl<gp_Dir2d>(), theRadius))
+                               const boost::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius)
+    : GeomAPI_Interface(
+        newCirc2d(theCenter->x(), theCenter->y(), theDir->impl<gp_Dir2d>(), theRadius))
 {
 
 }
 
-const boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Circ2d::project(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const
+const boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Circ2d::project(
+    const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const
 {
   boost::shared_ptr<GeomAPI_Pnt2d> aResult;
   if (!MY_CIRC2D)
-    return aResult;
+  return aResult;
 
-  Handle(Geom2d_Circle) aCircle = new Geom2d_Circle(MY_CIRC2D->Axis(), MY_CIRC2D->Radius());//(aCirc);
+  Handle(Geom2d_Circle) aCircle = new Geom2d_Circle(MY_CIRC2D->Axis(), MY_CIRC2D->Radius());  //(aCirc);
 
   const gp_Pnt2d& aPoint = thePoint->impl<gp_Pnt2d>();
 
index d4ec763e48391f3fd6f888f21f589ebbae92d24d..58a292c162dd49fec0ce435562a1f5be72526d52 100644 (file)
@@ -16,17 +16,16 @@ class GeomAPI_Dir2d;
  * \brief Circle in 2D
  */
 
-class GEOMAPI_EXPORT GeomAPI_Circ2d: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_Circ2d : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation of circle defined by center point and circle radius
   GeomAPI_Circ2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theCenter,
                  const boost::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint);
 
   /// Creation of circle defined by center point, direction and circle radius
   GeomAPI_Circ2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theCenter,
-                 const boost::shared_ptr<GeomAPI_Dir2d>& theDir,
-                 double theRadius);
+                 const boost::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius);
 
   /// Return center of the circle
   const boost::shared_ptr<GeomAPI_Pnt2d> center() const;
@@ -35,7 +34,8 @@ public:
   double radius() const;
 
   /// Project point on line
-  const boost::shared_ptr<GeomAPI_Pnt2d> project(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
+  const boost::shared_ptr<GeomAPI_Pnt2d> project(
+      const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
 };
 
 #endif
index e3badb4401b41cdd0fc5a2f7f3bd3712ca172f08..c1b88a78d5e89dbed12f721cf6e84317e8ce5c07 100644 (file)
 #define MY_DIR static_cast<gp_Dir*>(myImpl)
 
 GeomAPI_Dir::GeomAPI_Dir(const double theX, const double theY, const double theZ)
-  : GeomAPI_Interface(new gp_Dir(theX, theY, theZ))
-{}
+    : GeomAPI_Interface(new gp_Dir(theX, theY, theZ))
+{
+}
 
 GeomAPI_Dir::GeomAPI_Dir(const boost::shared_ptr<GeomAPI_XYZ>& theCoords)
-  : GeomAPI_Interface(new gp_Dir(theCoords->x(), theCoords->y(), theCoords->z()))
-{}
+    : GeomAPI_Interface(new gp_Dir(theCoords->x(), theCoords->y(), theCoords->z()))
+{
+}
 
 double GeomAPI_Dir::x() const
 {
@@ -32,7 +34,7 @@ double GeomAPI_Dir::z() const
   return MY_DIR->Z();
 }
 
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::xyz() 
+const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::xyz()
 {
   return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(MY_DIR->X(), MY_DIR->Y(), MY_DIR->Z()));
 }
@@ -42,7 +44,8 @@ double GeomAPI_Dir::dot(const boost::shared_ptr<GeomAPI_Dir>& theArg) const
   return MY_DIR->Dot(theArg->impl<gp_Dir>());
 }
 
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::cross(const boost::shared_ptr<GeomAPI_Dir>& theArg) const
+const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::cross(
+    const boost::shared_ptr<GeomAPI_Dir>& theArg) const
 {
   gp_XYZ aResult = MY_DIR->XYZ().Crossed(theArg->impl<gp_Dir>().XYZ());
   return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
index 223eb745265177d8830209ec510effaa3f5f71f1..3d666af67e09c9ccb2973b51c245dbe5650e05af 100644 (file)
@@ -15,9 +15,9 @@ class GeomAPI_XYZ;
  * \brief 3D direction defined by three normalized coordinates
  */
 
-class GEOMAPI_EXPORT GeomAPI_Dir: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_Dir : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation of direction by coordinates
   GeomAPI_Dir(const double theX, const double theY, const double theZ);
   /// Creation of direction by coordinates
index fd795ab19aa12a9077c8e455da7e19e2270f5589..e3089d8b95afb74937a5d45077f26876c24c1d73 100644 (file)
 #define MY_DIR static_cast<gp_Dir2d*>(myImpl)
 
 GeomAPI_Dir2d::GeomAPI_Dir2d(const double theX, const double theY)
-  : GeomAPI_Interface(new gp_Dir2d(theX, theY))
-{}
+    : GeomAPI_Interface(new gp_Dir2d(theX, theY))
+{
+}
 
 GeomAPI_Dir2d::GeomAPI_Dir2d(const boost::shared_ptr<GeomAPI_XY>& theCoords)
-  : GeomAPI_Interface(new gp_Dir2d(theCoords->x(), theCoords->y()))
-{}
+    : GeomAPI_Interface(new gp_Dir2d(theCoords->x(), theCoords->y()))
+{
+}
 
 double GeomAPI_Dir2d::x() const
 {
@@ -27,7 +29,7 @@ double GeomAPI_Dir2d::y() const
   return MY_DIR->Y();
 }
 
-const boost::shared_ptr<GeomAPI_XY> GeomAPI_Dir2d::xy() 
+const boost::shared_ptr<GeomAPI_XY> GeomAPI_Dir2d::xy()
 {
   return boost::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_DIR->X(), MY_DIR->Y()));
 }
index e31059f44cf904e4d2d990131b8f941fe97a5b62..906e1af0f6a82ce44a22c37e8ba81582ca231780 100644 (file)
@@ -15,9 +15,9 @@ class GeomAPI_XY;
  * \brief 2D direction defined by three normalized coordinates
  */
 
-class GEOMAPI_EXPORT GeomAPI_Dir2d: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_Dir2d : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation of direction by coordinates
   GeomAPI_Dir2d(const double theX, const double theY);
   /// Creation of direction by coordinates
index 8d8bf022a433adb81e3dc4dd44a5abbd02341aa4..4e95756cb6087851fd078462da7ff71daaf53035 100644 (file)
 #include <Geom_Circle.hxx>
 
 GeomAPI_Edge::GeomAPI_Edge()
-  : GeomAPI_Shape()
-{}
+    : GeomAPI_Shape()
+{
+}
 
 bool GeomAPI_Edge::isLine() const
 {
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
   Handle(BRep_TEdge) anEdge = Handle(BRep_TEdge)::DownCast(aShape.TShape());
   if (anEdge->Curves().Extent() != 1)
-    return false; // too many curves in the edge
+    return false;  // too many curves in the edge
   Handle(Geom_Curve) aCurve = anEdge->Curves().First()->Curve3D();
   if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)))
     return true;
@@ -32,7 +33,7 @@ bool GeomAPI_Edge::isCircle() const
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
   Handle(BRep_TEdge) anEdge = Handle(BRep_TEdge)::DownCast(aShape.TShape());
   if (anEdge->Curves().Extent() != 1)
-    return false; // too many curves in the edge
+    return false;  // too many curves in the edge
   Handle(Geom_Curve) aCurve = anEdge->Curves().First()->Curve3D();
   if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle)) && aCurve->IsClosed())
     return true;
@@ -44,7 +45,7 @@ bool GeomAPI_Edge::isArc() const
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
   Handle(BRep_TEdge) anEdge = Handle(BRep_TEdge)::DownCast(aShape.TShape());
   if (anEdge->Curves().Extent() != 1)
-    return false; // too many curves in the edge
+    return false;  // too many curves in the edge
   Handle(Geom_Curve) aCurve = anEdge->Curves().First()->Curve3D();
   if (aCurve->IsKind(STANDARD_TYPE(Geom_Circle)) && !aCurve->IsClosed())
     return true;
index bd186c22b9659cc632cf5884fcd9b8ea19a1fb0e..f1c74c5d55573b1f92310a1d306aa7cc7339611d 100644 (file)
  * \brief Interface to the edge object
  */
 
-class GEOMAPI_EXPORT GeomAPI_Edge: public GeomAPI_Shape
+class GEOMAPI_EXPORT GeomAPI_Edge : public GeomAPI_Shape
 {
-public:
+ public:
   /// Creation of empty (null) shape
   GeomAPI_Edge();
 
   /// Returns whether the shape is a vertex
   virtual bool isVertex() const
-  { return false; }
+  {
+    return false;
+  }
 
   /// Returns whether the shape is an edge
   virtual bool isEdge() const
-  { return true; }
+  {
+    return true;
+  }
 
   /// Verifies that the edge is a line
   bool isLine() const;
index c300c1b421e6594c40a8b5f9f3f139bc8ef4ba07..34868048a92877e79b8617abb5ad85bba607c8c1 100644 (file)
@@ -8,14 +8,14 @@
 #include "GeomAPI_AISObject.h"
 
 /**
-* A class which defines an interface of object which is able to create its own presentation
-*/ 
+ * A class which defines an interface of object which is able to create its own presentation
+ */
 class GeomAPI_IPresentable
 {
-public:
+ public:
   /** Returns the AIS preview
-  *   \param thePrevious - defines a presentation if it was created previously
-  */
+   *   \param thePrevious - defines a presentation if it was created previously
+   */
   virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious) = 0;
 };
 
index 141571688a1da5e993494ac5e448907a30aec29c..3dca3485462d9ef988da49d0b28945e7f450f567 100644 (file)
 
 class GEOMAPI_EXPORT GeomAPI_Interface
 {
-protected:
-  void* myImpl; ///< pointer to the internal impl object
+ protected:
+  void* myImpl;  ///< pointer to the internal impl object
 
-public:
+ public:
   /// None - constructor
   GeomAPI_Interface();
 
   /// Constructor by the impl pointer (used for internal needs)
   GeomAPI_Interface(void* theImpl);
-  
+
   /// Destructor
   virtual ~GeomAPI_Interface();
 
   /// Returns the pointer to the impl
-  template<class T> inline T* implPtr() {return static_cast<T*>(myImpl);}
+  template<class T> inline T* implPtr()
+  {
+    return static_cast<T*>(myImpl);
+  }
   /// Returns the reference object of the impl
-  template<class T> inline const T& impl() {return *(static_cast<T*>(myImpl));}
+  template<class T> inline const T& impl()
+  {
+    return *(static_cast<T*>(myImpl));
+  }
   /// Updates the impl (deletes the old one)
   void setImpl(void* theImpl);
 };
index 9d040702438eb7018cd74c4e77938f55fe3c11a9..58095f0e8f1432d4b10086ad5a48634549da044d 100644 (file)
 #define MY_LIN static_cast<gp_Lin*>(myImpl)
 
 static gp_Lin* newLine(const double theStartX, const double theStartY, const double theStartZ,
-                       const double theEndX,   const double theEndY,   const double theEndZ)
+                       const double theEndX, const double theEndY, const double theEndZ)
 {
   gp_XYZ aDir(theEndX - theStartX, theEndY - theStartY, theEndZ - theStartZ);
   gp_Pnt aStart(theStartX, theStartY, theStartZ);
   return new gp_Lin(aStart, gp_Dir(aDir));
 }
 
-
 GeomAPI_Lin::GeomAPI_Lin(const double theStartX, const double theStartY, const double theStartZ,
-                         const double theEndX,   const double theEndY,   const double theEndZ)
-  : GeomAPI_Interface(newLine(theStartX, theStartY, theStartZ, theEndX, theEndY, theEndZ))
-{}
+                         const double theEndX, const double theEndY, const double theEndZ)
+    : GeomAPI_Interface(newLine(theStartX, theStartY, theStartZ, theEndX, theEndY, theEndZ))
+{
+}
 
 GeomAPI_Lin::GeomAPI_Lin(const boost::shared_ptr<GeomAPI_Pnt>& theStart,
                          const boost::shared_ptr<GeomAPI_Pnt>& theEnd)
-  : GeomAPI_Interface(newLine(theStart->x(), theStart->y(), theStart->z(), 
-                              theEnd->x(),   theEnd->y(),   theEnd->z()))
-{}
+    : GeomAPI_Interface(
+        newLine(theStart->x(), theStart->y(), theStart->z(), theEnd->x(), theEnd->y(), theEnd->z()))
+{
+}
 
 double GeomAPI_Lin::distance(const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const
 {
@@ -45,30 +46,31 @@ double GeomAPI_Lin::distance(const boost::shared_ptr<GeomAPI_Pnt>& thePoint) con
 }
 
 const boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Lin::intersect(
-                const boost::shared_ptr<GeomAPI_Lin>& theLine) const
+    const boost::shared_ptr<GeomAPI_Lin>& theLine) const
 {
   if (MY_LIN->SquareDistance(theLine->impl<gp_Lin>()) > Precision::Confusion())
-    return boost::shared_ptr<GeomAPI_Pnt>();
+  return boost::shared_ptr<GeomAPI_Pnt>();
 
   const gp_Dir& aDir1 = MY_LIN->Direction();
   const gp_Dir& aDir2 = theLine->impl<gp_Lin>().Direction();
   gp_Dir aCross = aDir1.Crossed(aDir2);
-  gp_Pln aPlane(MY_LIN->Location(), aCross); // plane containing both lines
+  gp_Pln aPlane(MY_LIN->Location(), aCross);  // plane containing both lines
 
   gp_Lin2d aPrjLine1 = ProjLib::Project(aPlane, *MY_LIN);
   gp_Lin2d aPrjLine2 = ProjLib::Project(aPlane, theLine->impl<gp_Lin>());
 
   IntAna2d_AnaIntersection anInter(aPrjLine1, aPrjLine1);
   if (!anInter.IsDone() || anInter.IsEmpty())
-    return boost::shared_ptr<GeomAPI_Pnt>();
+  return boost::shared_ptr<GeomAPI_Pnt>();
   const gp_Pnt2d& anIntPnt2d = anInter.Point(0).Value();
   gp_Pnt aResult = ElSLib::Value(anIntPnt2d.X(), anIntPnt2d.Y(), aPlane);
 
   return boost::shared_ptr<GeomAPI_Pnt>(
-    new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z()));
+  new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z()));
 }
 
-const boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Lin::project(const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const
+const boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Lin::project(
+    const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const
 {
   const gp_XYZ& aDir = MY_LIN->Direction().XYZ();
   const gp_XYZ& aLoc = MY_LIN->Location().XYZ();
index b0b3e265f401701289aae249eecab73451f249d3..69d1ba48a1c2a432fbb5395cbd968de87452276f 100644 (file)
@@ -15,12 +15,12 @@ class GeomAPI_Pnt;
  * \brief Line in 3D
  */
 
-class GEOMAPI_EXPORT GeomAPI_Lin: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_Lin : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation of line defined by cordinates of start and end points
   GeomAPI_Lin(const double theStartX, const double theStartY, const double theStartZ,
-              const double theEndX,   const double theEndY,   const double theEndZ);
+              const double theEndX, const double theEndY, const double theEndZ);
   /// Creation of line defined by start and end points
   GeomAPI_Lin(const boost::shared_ptr<GeomAPI_Pnt>& theStart,
               const boost::shared_ptr<GeomAPI_Pnt>& theEnd);
@@ -28,9 +28,11 @@ public:
   /// Distance between two points
   double distance(const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const;
   /// Intersection of two lines
-  const boost::shared_ptr<GeomAPI_Pnt> intersect(const boost::shared_ptr<GeomAPI_Lin>& theLine) const;
+  const boost::shared_ptr<GeomAPI_Pnt> intersect(
+      const boost::shared_ptr<GeomAPI_Lin>& theLine) const;
   /// Project point on line
-  const boost::shared_ptr<GeomAPI_Pnt> project(const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const;
+  const boost::shared_ptr<GeomAPI_Pnt> project(
+      const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const;
 };
 
 #endif
index 5267000f3be66ce32a4042b8148834d4b46780cd..1e902f4b5fd07e31304dda01b852b1028eba7852 100644 (file)
 
 #define MY_LIN2D static_cast<gp_Lin2d*>(myImpl)
 
-static gp_Lin2d* newLine2d(const double theStartX, const double theStartY,
-                           const double theEndX,   const double theEndY)
+static gp_Lin2d* newLine2d(const double theStartX, const double theStartY, const double theEndX,
+                           const double theEndY)
 {
   gp_XY aDir(theEndX - theStartX, theEndY - theStartY);
   gp_Pnt2d aStart(theStartX, theStartY);
   return new gp_Lin2d(aStart, gp_Dir2d(aDir));
 }
 
-
-GeomAPI_Lin2d::GeomAPI_Lin2d(const double theStartX, const double theStartY,
-                             const double theEndX,   const double theEndY)
-  : GeomAPI_Interface(newLine2d(theStartX, theStartY, theEndX, theEndY))
-{}
+GeomAPI_Lin2d::GeomAPI_Lin2d(const double theStartX, const double theStartY, const double theEndX,
+                             const double theEndY)
+    : GeomAPI_Interface(newLine2d(theStartX, theStartY, theEndX, theEndY))
+{
+}
 
 GeomAPI_Lin2d::GeomAPI_Lin2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theStart,
-                         const boost::shared_ptr<GeomAPI_Pnt2d>& theEnd)
-  : GeomAPI_Interface(newLine2d(theStart->x(), theStart->y(),
-                                theEnd->x(),   theEnd->y()))
-{}
+                             const boost::shared_ptr<GeomAPI_Pnt2d>& theEnd)
+    : GeomAPI_Interface(newLine2d(theStart->x(), theStart->y(), theEnd->x(), theEnd->y()))
+{
+}
 
 double GeomAPI_Lin2d::distance(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const
 {
@@ -40,16 +40,17 @@ double GeomAPI_Lin2d::distance(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther)
 }
 
 const boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Lin2d::intersect(
-                const boost::shared_ptr<GeomAPI_Lin2d>& theLine) const
+    const boost::shared_ptr<GeomAPI_Lin2d>& theLine) const
 {
   IntAna2d_AnaIntersection anInter(*MY_LIN2D, theLine->impl<gp_Lin2d>());
   if (!anInter.IsDone() || anInter.IsEmpty())
-    return boost::shared_ptr<GeomAPI_Pnt2d>();
+  return boost::shared_ptr<GeomAPI_Pnt2d>();
   const gp_Pnt2d& aResult = anInter.Point(1).Value();
   return boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aResult.X(), aResult.Y()));
 }
 
-const boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Lin2d::project(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const
+const boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Lin2d::project(
+    const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const
 {
   const gp_XY& aDir = MY_LIN2D->Direction().XY();
   const gp_XY& aLoc = MY_LIN2D->Location().XY();
index b213a0d4dbfcba82f637e5cdce04a653f5dfb3a1..82afee29a65d5be5a13f8a49538e03b32f001f2b 100644 (file)
@@ -15,12 +15,12 @@ class GeomAPI_Pnt2d;
  * \brief Line in 2D
  */
 
-class GEOMAPI_EXPORT GeomAPI_Lin2d: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_Lin2d : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation of line defined by cordinates of start and end points
-  GeomAPI_Lin2d(const double theStartX, const double theStartY,
-                const double theEndX,   const double theEndY);
+  GeomAPI_Lin2d(const double theStartX, const double theStartY, const double theEndX,
+                const double theEndY);
   /// Creation of line defined by start and end points
   GeomAPI_Lin2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theStart,
                 const boost::shared_ptr<GeomAPI_Pnt2d>& theEnd);
@@ -28,9 +28,11 @@ public:
   /// Distance between two points
   double distance(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
   /// Intersection of two lines
-  const boost::shared_ptr<GeomAPI_Pnt2d> intersect(const boost::shared_ptr<GeomAPI_Lin2d>& theLine) const;
+  const boost::shared_ptr<GeomAPI_Pnt2d> intersect(
+      const boost::shared_ptr<GeomAPI_Lin2d>& theLine) const;
   /// Project point on line
-  const boost::shared_ptr<GeomAPI_Pnt2d> project(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
+  const boost::shared_ptr<GeomAPI_Pnt2d> project(
+      const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
   /// Computes the cross product of the line direction and a vector from the line start point to the point
   bool isRight(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
 };
index 5780b3d819df8a23ed80928a37b03453e752cc06..2f4e0cec402d46cdecd2174c765b51f1cc303071 100644 (file)
 using namespace std;
 
 GeomAPI_Pln::GeomAPI_Pln(const boost::shared_ptr<GeomAPI_Pnt>& thePoint,
-            const boost::shared_ptr<GeomAPI_Dir>& theNormal)
-: GeomAPI_Interface(new gp_Pln(thePoint->impl<gp_Pnt>(),
-                               theNormal->impl<gp_Dir>()))
+                         const boost::shared_ptr<GeomAPI_Dir>& theNormal)
+    : GeomAPI_Interface(new gp_Pln(thePoint->impl<gp_Pnt>(), theNormal->impl<gp_Dir>()))
 {
 }
 
-GeomAPI_Pln::GeomAPI_Pln(
-  const double theA, const double theB, const double theC, const double theD)
-: GeomAPI_Interface(new gp_Pln(theA, theB, theC, theD))
+GeomAPI_Pln::GeomAPI_Pln(const double theA, const double theB, const double theC, const double theD)
+    : GeomAPI_Interface(new gp_Pln(theA, theB, theC, theD))
 {
 }
 
index c0d0d69f1335fe0a579e372993a150d2739c1b00..5471a34ad86fd4a50531d33e5ec666522c6921b3 100644 (file)
@@ -16,9 +16,9 @@ class GeomAPI_Dir;
  * \brief 3D point defined by three coordinates
  */
 
-class GEOMAPI_EXPORT GeomAPI_Pln: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_Pln : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation of plane by the point and normal
   GeomAPI_Pln(const boost::shared_ptr<GeomAPI_Pnt>& thePoint,
               const boost::shared_ptr<GeomAPI_Dir>& theNormal);
index abf73f07bad436622fbc36819131fdc4f994cbde..0455c15134d64eff166f37bdff38ccc3498053e2 100644 (file)
 #define MY_PNT static_cast<gp_Pnt*>(myImpl)
 
 GeomAPI_Pnt::GeomAPI_Pnt(const double theX, const double theY, const double theZ)
-  : GeomAPI_Interface(new gp_Pnt(theX, theY, theZ))
-{}
+    : GeomAPI_Interface(new gp_Pnt(theX, theY, theZ))
+{
+}
 
 GeomAPI_Pnt::GeomAPI_Pnt(const boost::shared_ptr<GeomAPI_XYZ>& theCoords)
-  : GeomAPI_Interface(new gp_Pnt(theCoords->x(), theCoords->y(), theCoords->z()))
-{}
+    : GeomAPI_Interface(new gp_Pnt(theCoords->x(), theCoords->y(), theCoords->z()))
+{
+}
 
 double GeomAPI_Pnt::x() const
 {
@@ -47,7 +49,7 @@ void GeomAPI_Pnt::setZ(const double theZ)
   return MY_PNT->SetZ(theZ);
 }
 
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Pnt::xyz() 
+const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Pnt::xyz()
 {
   return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(MY_PNT->X(), MY_PNT->Y(), MY_PNT->Z()));
 }
index 3991b0977ee1515d39efcad8b2007dba80310cef..6e4e527d554ce6795f36f8113899b184e0b3ebc5 100644 (file)
@@ -15,9 +15,9 @@ class GeomAPI_XYZ;
  * \brief 3D point defined by three coordinates
  */
 
-class GEOMAPI_EXPORT GeomAPI_Pnt: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_Pnt : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation of point by coordinates
   GeomAPI_Pnt(const double theX, const double theY, const double theZ);
   /// Creation of point by coordinates
index e1cdf3d283e53b2627bee83afb0681b542f28b1a..70bc646930fab9e98b4bfaf9028ee58030d9dcf3 100644 (file)
 #define MY_PNT2D static_cast<gp_Pnt2d*>(myImpl)
 
 GeomAPI_Pnt2d::GeomAPI_Pnt2d(const double theX, const double theY)
-  : GeomAPI_Interface(new gp_Pnt2d(theX, theY))
-{}
+    : GeomAPI_Interface(new gp_Pnt2d(theX, theY))
+{
+}
 
 GeomAPI_Pnt2d::GeomAPI_Pnt2d(const boost::shared_ptr<GeomAPI_XY>& theCoords)
-  : GeomAPI_Interface(new gp_Pnt2d(theCoords->x(), theCoords->y()))
-{}
+    : GeomAPI_Interface(new gp_Pnt2d(theCoords->x(), theCoords->y()))
+{
+}
 
 double GeomAPI_Pnt2d::x() const
 {
@@ -44,8 +46,8 @@ boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Pnt2d::to3D(const boost::shared_ptr<GeomA
                                                    const boost::shared_ptr<GeomAPI_Dir>& theDirX,
                                                    const boost::shared_ptr<GeomAPI_Dir>& theDirY)
 {
-  boost::shared_ptr<GeomAPI_XYZ> aSum = theOrigin->xyz()->added(
-    theDirX->xyz()->multiplied(x()))->added(theDirY->xyz()->multiplied(y()));
+  boost::shared_ptr<GeomAPI_XYZ> aSum = theOrigin->xyz()->added(theDirX->xyz()->multiplied(x()))
+      ->added(theDirY->xyz()->multiplied(y()));
 
   return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
 }
index eaea875cc2debb9433ac25e3ddd798e98f40ebe3..b7f97890861ba22be7824497a8a8fda31249f7b5 100644 (file)
@@ -17,9 +17,9 @@ class GeomAPI_Dir;
  * \brief 2D point defined by two coordinates
  */
 
-class GEOMAPI_EXPORT GeomAPI_Pnt2d: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_Pnt2d : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation of point by coordinates
   GeomAPI_Pnt2d(const double theX, const double theY);
   /// Creation of point by coordinates
index 10bd21df9d82f6bc9d409b4204c819cbc2664af5..30e2f342522498a2ea66f752eedd880f513b7584 100644 (file)
@@ -9,7 +9,8 @@
 #define MY_PNT static_cast<gp_Pnt*>(myImpl)
 
 GeomAPI_Shape::GeomAPI_Shape()
-    : GeomAPI_Interface(new TopoDS_Shape()) {
+    : GeomAPI_Interface(new TopoDS_Shape())
+{
 }
 
 bool GeomAPI_Shape::isNull()
@@ -17,7 +18,6 @@ bool GeomAPI_Shape::isNull()
   return MY_SHAPE->IsNull();
 }
 
-
 bool GeomAPI_Shape::isVertex() const
 {
   const TopoDS_Shape& aShape = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
index 4b526589f22c85d9c032bfb06fa4e879c19d9b97..64292dee39122146c42b86ed4511a8a825a6ecac 100644 (file)
@@ -15,9 +15,9 @@ class TopoDS_Shape;
 
 #define MY_SHAPE static_cast<TopoDS_Shape*>(myImpl)
 
-class GEOMAPI_EXPORT GeomAPI_Shape: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_Shape : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation of empty (null) shape
   GeomAPI_Shape();
 
index 94341c31e95029759b616798bea65b2040427469..d3c2b86f39239d99893c94dc349320b537198ed2 100644 (file)
@@ -9,8 +9,9 @@
 #define MY_XY static_cast<gp_XY*>(myImpl)
 
 GeomAPI_XY::GeomAPI_XY(const double theX, const double theY)
-  : GeomAPI_Interface(new gp_XY(theX, theY))
-{}
+    : GeomAPI_Interface(new gp_XY(theX, theY))
+{
+}
 
 double GeomAPI_XY::x() const
 {
@@ -32,18 +33,15 @@ void GeomAPI_XY::setY(const double theY)
   return MY_XY->SetY(theY);
 }
 
-const boost::shared_ptr<GeomAPI_XY> GeomAPI_XY::added(
-  const boost::shared_ptr<GeomAPI_XY>& theArg)
+const boost::shared_ptr<GeomAPI_XY> GeomAPI_XY::added(const boost::shared_ptr<GeomAPI_XY>& theArg)
 {
-  boost::shared_ptr<GeomAPI_XY> aResult(
-    new GeomAPI_XY(MY_XY->X() + theArg->x(), MY_XY->Y() + theArg->y()));
+  boost::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() + theArg->x(), MY_XY->Y() + theArg->y()));
   return aResult;
 }
 
 const boost::shared_ptr<GeomAPI_XY> GeomAPI_XY::multiplied(const double theArg)
 {
-  boost::shared_ptr<GeomAPI_XY> aResult(
-    new GeomAPI_XY(MY_XY->X() * theArg, MY_XY->Y() * theArg));
+  boost::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() * theArg, MY_XY->Y() * theArg));
   return aResult;
 }
 
index 1ff89a8f6c13f25e1e7b81a5e38a7b840e7d1a79..5e0fef8c975b60b7dccf29a86289f988f167c842 100644 (file)
@@ -13,9 +13,9 @@
  * \brief 2 coordinates: they may represent vector or point or something else
  */
 
-class GEOMAPI_EXPORT GeomAPI_XY: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_XY : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation by coordinates
   GeomAPI_XY(const double theX, const double theY);
 
index f413005fd0aebc80ab6744fef5787a82920b4a85..37ba3aa9faa60d8d44e7237fcb3881dce33a17a8 100644 (file)
@@ -9,8 +9,9 @@
 #define MY_XYZ static_cast<gp_XYZ*>(myImpl)
 
 GeomAPI_XYZ::GeomAPI_XYZ(const double theX, const double theY, const double theZ)
-  : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ))
-{}
+    : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ))
+{
+}
 
 double GeomAPI_XYZ::x() const
 {
@@ -43,25 +44,25 @@ void GeomAPI_XYZ::setZ(const double theZ)
 }
 
 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::added(
-  const boost::shared_ptr<GeomAPI_XYZ>& theArg)
+    const boost::shared_ptr<GeomAPI_XYZ>& theArg)
 {
   boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(),
-    MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
+  MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
   return aResult;
 }
 
 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::decreased(
-  const boost::shared_ptr<GeomAPI_XYZ>& theArg)
+    const boost::shared_ptr<GeomAPI_XYZ>& theArg)
 {
   boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(),
-    MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z()));
+  MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z()));
   return aResult;
 }
 
 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::multiplied(const double theArg)
 {
   boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg,
-    MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
+  MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
   return aResult;
 }
 
@@ -70,7 +71,8 @@ double GeomAPI_XYZ::dot(const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
   return MY_XYZ->Dot(theArg->impl<gp_XYZ>());
 }
 
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
+const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(
+    const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
 {
   gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl<gp_XYZ>());
   return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
index 84036253585bb70f0e688e65136a34373a5dab5c..eadee91a3e0cb7154d7758e02fc93a86569cb912 100644 (file)
@@ -13,9 +13,9 @@
  * \brief 3 coordinates: they may represent vector or point or something else
  */
 
-class GEOMAPI_EXPORT GeomAPI_XYZ: public GeomAPI_Interface
+class GEOMAPI_EXPORT GeomAPI_XYZ : public GeomAPI_Interface
 {
-public:
+ public:
   /// Creation by coordinates
   GeomAPI_XYZ(const double theX, const double theY, const double theZ);
 
index 2882ee2fae576ef9973cb9b07a9e4de6229af816..934390faa84f286b04a3f95f4d2b941f55ea41ee 100644 (file)
@@ -9,15 +9,15 @@
 #include <BRep_Builder.hxx>
 #include <TopoDS_Compound.hxx>
 
-boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_CompoundBuilder::compound
-                            (std::list<boost::shared_ptr<GeomAPI_Shape> > theShapes)
+boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_CompoundBuilder::compound(
+    std::list<boost::shared_ptr<GeomAPI_Shape> > theShapes)
 {
   BRep_Builder aBuilder;
   TopoDS_Compound aComp;
   aBuilder.MakeCompound(aComp);
 
-  std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = theShapes.begin(),
-                                                               aLast = theShapes.end();
+  std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = theShapes.begin(), aLast =
+      theShapes.end();
   for (; anIt != aLast; anIt++) {
     aBuilder.Add(aComp, (*anIt)->impl<TopoDS_Shape>());
   }
index ea727ef9e48d424aca21ebb27f65b452bea81464..bf9f8374a1d544c6b7a11e0f05c7653ce97a4a97 100644 (file)
 
 class GEOMALGOAPI_EXPORT GeomAlgoAPI_CompoundBuilder
 {
-public:
+ public:
   /// Creates compund of the given shapes
   /// \param theShapes a list of shapes
-  static boost::shared_ptr<GeomAPI_Shape> compound
-                            (std::list<boost::shared_ptr<GeomAPI_Shape> > theShapes);
+  static boost::shared_ptr<GeomAPI_Shape> compound(
+      std::list<boost::shared_ptr<GeomAPI_Shape> > theShapes);
 };
 
 #endif
index 0e622ba36958ba6581158c8babd8b1d65c87ee25..5f3aba03e7ea68dd98e4a1db09a3ab2065826e20 100644 (file)
@@ -14,7 +14,7 @@
 #include <gp_Circ.hxx>
 
 boost::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::line(
-  boost::shared_ptr<GeomAPI_Pnt> theStart, boost::shared_ptr<GeomAPI_Pnt> theEnd)
+    boost::shared_ptr<GeomAPI_Pnt> theStart, boost::shared_ptr<GeomAPI_Pnt> theEnd)
 {
   const gp_Pnt& aStart = theStart->impl<gp_Pnt>();
   const gp_Pnt& anEnd = theEnd->impl<gp_Pnt>();
@@ -31,8 +31,8 @@ boost::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::line(
 }
 
 boost::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::lineCircle(
-    boost::shared_ptr<GeomAPI_Pnt> theCenter,
-    boost::shared_ptr<GeomAPI_Dir> theNormal, double theRadius)
+    boost::shared_ptr<GeomAPI_Pnt> theCenter, boost::shared_ptr<GeomAPI_Dir> theNormal,
+    double theRadius)
 {
   const gp_Pnt& aCenter = theCenter->impl<gp_Pnt>();
   const gp_Dir& aDir = theNormal->impl<gp_Dir>();
@@ -47,10 +47,8 @@ boost::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::lineCircle(
 }
 
 boost::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::lineCircleArc(
-    boost::shared_ptr<GeomAPI_Pnt> theCenter,
-    boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
-    boost::shared_ptr<GeomAPI_Pnt> theEndPoint,
-    boost::shared_ptr<GeomAPI_Dir> theNormal)
+    boost::shared_ptr<GeomAPI_Pnt> theCenter, boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
+    boost::shared_ptr<GeomAPI_Pnt> theEndPoint, boost::shared_ptr<GeomAPI_Dir> theNormal)
 {
   const gp_Pnt& aCenter = theCenter->impl<gp_Pnt>();
   const gp_Dir& aDir = theNormal->impl<gp_Dir>();
@@ -62,8 +60,8 @@ boost::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::lineCircleArc(
   const gp_Pnt& anEnd = theEndPoint->impl<gp_Pnt>();
 
   BRepBuilderAPI_MakeEdge anEdgeBuilder;
-  if (aStart.IsEqual(anEnd, Precision::Confusion()) ||
-      gp_Pnt(0, 0, 0).IsEqual(anEnd, Precision::Confusion()))
+  if (aStart.IsEqual(anEnd, Precision::Confusion())
+      || gp_Pnt(0, 0, 0).IsEqual(anEnd, Precision::Confusion()))
     anEdgeBuilder = BRepBuilderAPI_MakeEdge(aCircle);
   else
     anEdgeBuilder = BRepBuilderAPI_MakeEdge(aCircle, aStart, anEnd);
index 68c239278a088a83d8985babd7a26f0695eb45c2..1db144ed1d2658e6d2caa3daa85cf09986510321 100644 (file)
 
 class GEOMALGOAPI_EXPORT GeomAlgoAPI_EdgeBuilder
 {
-public:
+ public:
   /// Creates linear edge by two points
-  static boost::shared_ptr<GeomAPI_Edge> line(
-    boost::shared_ptr<GeomAPI_Pnt> theStart, boost::shared_ptr<GeomAPI_Pnt> theEnd);
+  static boost::shared_ptr<GeomAPI_Edge> line(boost::shared_ptr<GeomAPI_Pnt> theStart,
+                                              boost::shared_ptr<GeomAPI_Pnt> theEnd);
 
   /// Creates linear edge in a form of a circle by a point and a circle radius
-  static boost::shared_ptr<GeomAPI_Edge> lineCircle(
-    boost::shared_ptr<GeomAPI_Pnt> theCenter,
-    boost::shared_ptr<GeomAPI_Dir> theNormal, double theRadius);
+  static boost::shared_ptr<GeomAPI_Edge> lineCircle(boost::shared_ptr<GeomAPI_Pnt> theCenter,
+                                                    boost::shared_ptr<GeomAPI_Dir> theNormal,
+                                                    double theRadius);
 
   /// Creates linear edge in a form of a circle arc by a three points
-  static boost::shared_ptr<GeomAPI_Edge> lineCircleArc(
-    boost::shared_ptr<GeomAPI_Pnt> theCenter,
-    boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
-    boost::shared_ptr<GeomAPI_Pnt> theEndPoint,
-    boost::shared_ptr<GeomAPI_Dir> theNormal);
+  static boost::shared_ptr<GeomAPI_Edge> lineCircleArc(boost::shared_ptr<GeomAPI_Pnt> theCenter,
+                                                       boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
+                                                       boost::shared_ptr<GeomAPI_Pnt> theEndPoint,
+                                                       boost::shared_ptr<GeomAPI_Dir> theNormal);
 };
 
 #endif
index d5affc09469e1bd75b92c9a6bbb1272f4a94f348..fb58d0c53b125cd1157c161405026ae463a22382 100644 (file)
@@ -15,9 +15,8 @@
 const double tolerance = Precision::Angular();
 
 boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Extrusion::makeExtrusion(
-                        boost::shared_ptr<GeomAPI_Shape> theShape,
-                        boost::shared_ptr<GeomAPI_Dir>   theDir,
-                        double                           theSize)
+    boost::shared_ptr<GeomAPI_Shape> theShape, boost::shared_ptr<GeomAPI_Dir> theDir,
+    double theSize)
 {
   const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
   gp_Vec aDir(theDir->impl<gp_Dir>().XYZ() * theSize);
@@ -32,37 +31,33 @@ boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Extrusion::makeExtrusion(
 }
 
 boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Extrusion::makeExtrusion(
-                        boost::shared_ptr<GeomAPI_Shape> theShape,
-                        double                           theSize)
+    boost::shared_ptr<GeomAPI_Shape> theShape, double theSize)
 {
   bool isFirstNorm = true;
   gp_Dir aShapeNormal;
 
   const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
   TopExp_Explorer aFaceExp(aShape, TopAbs_FACE);
-  for ( ; aFaceExp.More(); aFaceExp.Next())
-  {
-    const TopoDS_Face& aFace = (const TopoDS_Face&)aFaceExp.Current();
+  for (; aFaceExp.More(); aFaceExp.Next()) {
+    const TopoDS_Face& aFace = (const TopoDS_Face&) aFaceExp.Current();
     Handle(BRep_TFace) aBFace = Handle(BRep_TFace)::DownCast(aFace.TShape());
     if (aBFace.IsNull())
       return boost::shared_ptr<GeomAPI_Shape>();
 
     Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aBFace->Surface());
-    if (aPlane.IsNull()) // non-planar shapes is not supported for extrusion yet
+    if (aPlane.IsNull())  // non-planar shapes is not supported for extrusion yet
       continue;
 
     const gp_Dir& aNormal = aPlane->Pln().Axis().Direction();
-    if (isFirstNorm)
-    {
+    if (isFirstNorm) {
       aShapeNormal = aNormal;
       isFirstNorm = false;
-    }
-    else if (!aShapeNormal.IsEqual(aNormal, tolerance)) // non-planar shapes is not supported for extrusion yet
+    } else if (!aShapeNormal.IsEqual(aNormal, tolerance))  // non-planar shapes is not supported for extrusion yet
       return boost::shared_ptr<GeomAPI_Shape>();
   }
 
   boost::shared_ptr<GeomAPI_Dir> aDir(
-    new GeomAPI_Dir(aShapeNormal.X(), aShapeNormal.Y(), aShapeNormal.Z()));
+      new GeomAPI_Dir(aShapeNormal.X(), aShapeNormal.Y(), aShapeNormal.Z()));
 
   return GeomAlgoAPI_Extrusion::makeExtrusion(theShape, aDir, theSize);
 }
index a41ae8db4c3d7f9c9ab2a1b27b59a95d1b79ec33..31b3d4406378d519d1f7b78d4c79c3c83c3c66d9 100644 (file)
 
 class GEOMALGOAPI_EXPORT GeomAlgoAPI_Extrusion
 {
-public:
+ public:
   /* \brief Creates extrusion for the given shape
    * \param[in] theShape face or wire to be extruded
    * \param[in] theDir   direction of extrusion
    * \param[in] theSize  the length of extrusion (if the value is less than 0, the extrusion in opposite direction)
    * \return a solid or a face which is obtained from specified one
    */
-  static boost::shared_ptr<GeomAPI_Shape> makeExtrusion(
-                        boost::shared_ptr<GeomAPI_Shape> theShape,
-                        boost::shared_ptr<GeomAPI_Dir>   theDir,
-                        double                           theSize);
+  static boost::shared_ptr<GeomAPI_Shape> makeExtrusion(boost::shared_ptr<GeomAPI_Shape> theShape,
+                                                        boost::shared_ptr<GeomAPI_Dir> theDir,
+                                                        double theSize);
 
   /* \brief Creates extrusion for the given shape along the normal for this shape
    * \param[in] theShape face or wire to be extruded
    * \param[in] theSize  the length of extrusion (if the value is less than 0, the extrusion in opposite normal)
    * \return a solid or a face which is obtained from specified one
    */
-  static boost::shared_ptr<GeomAPI_Shape> makeExtrusion(
-                        boost::shared_ptr<GeomAPI_Shape> theShape,
-                        double                           theSize);
+  static boost::shared_ptr<GeomAPI_Shape> makeExtrusion(boost::shared_ptr<GeomAPI_Shape> theShape,
+                                                        double theSize);
 };
 
 #endif
index f543c06a669534e26a8d5aa71d42db28ac64e809..3c9a61fda4fdd8a23a07ce7f073ddffb7768bb01 100644 (file)
 #include <Geom_Plane.hxx>
 
 boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
-  boost::shared_ptr<GeomAPI_Pnt> theCenter, boost::shared_ptr<GeomAPI_Dir> theNormal,
-  const double theSize)
+    boost::shared_ptr<GeomAPI_Pnt> theCenter, boost::shared_ptr<GeomAPI_Dir> theNormal,
+    const double theSize)
 {
   const gp_Pnt& aCenter = theCenter->impl<gp_Pnt>();
   const gp_Dir& aDir = theNormal->impl<gp_Dir>();
   gp_Pln aPlane(aCenter, aDir);
   // half of the size in each direction from the center
-  BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, 
-    -theSize / 2., theSize / 2., -theSize / 2., theSize / 2.);
+  BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, -theSize / 2., theSize / 2., -theSize / 2.,
+                                       theSize / 2.);
   boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
   aRes->setImpl(new TopoDS_Shape(aFaceBuilder.Face()));
   return aRes;
 }
 
 boost::shared_ptr<GeomAPI_Pln> GeomAlgoAPI_FaceBuilder::plane(
-  boost::shared_ptr<GeomAPI_Shape> theFace)
+    boost::shared_ptr<GeomAPI_Shape> theFace)
 {
   boost::shared_ptr<GeomAPI_Pln> aResult;
-  if (!theFace) return aResult; // bad shape
+  if (!theFace)
+    return aResult;  // bad shape
   TopoDS_Shape aShape = theFace->impl<TopoDS_Shape>();
-  if (aShape.IsNull()) return aResult; // null shape
+  if (aShape.IsNull())
+    return aResult;  // null shape
   TopoDS_Face aFace = TopoDS::Face(aShape);
-  if (aFace.IsNull()) return aResult; // not face
+  if (aFace.IsNull())
+    return aResult;  // not face
   Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
-  if (aSurf.IsNull()) return aResult; // no surface
+  if (aSurf.IsNull())
+    return aResult;  // no surface
   Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurf);
-  if (aPlane.IsNull()) return aResult; // not planar
+  if (aPlane.IsNull())
+    return aResult;  // not planar
   double aA, aB, aC, aD;
   aPlane->Coefficients(aA, aB, aC, aD);
   aResult = boost::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
index d14357a93d24cb737dd60064ad63bc870b38dc4c..b95fad92bf6619003bea5e570a568b0724415209 100644 (file)
 
 class GEOMALGOAPI_EXPORT GeomAlgoAPI_FaceBuilder
 {
-public:
+ public:
   /// Creates square planar face by given point of the center,
   /// normal to the plane and size of square
   static boost::shared_ptr<GeomAPI_Shape> square(boost::shared_ptr<GeomAPI_Pnt> theCenter,
-    boost::shared_ptr<GeomAPI_Dir> theNormal, const double theSize);
+                                                 boost::shared_ptr<GeomAPI_Dir> theNormal,
+                                                 const double theSize);
 
   /// Returns the plane of the planar face. If it is not planar, returns empty ptr.
   static boost::shared_ptr<GeomAPI_Pln> plane(boost::shared_ptr<GeomAPI_Shape> theFace);
index d12bd6a86c61debae635c578b6efe1eef374f7fd..053504d79e227c08c400bf02a50039129593947e 100644 (file)
@@ -2,8 +2,6 @@
 // Created:     02 Jun 2014
 // Author:      Mikhail PONIKAROV
 
-
-
 #include <GeomAlgoAPI_PointBuilder.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Shape.h>
index 7e24a360a5febebb786281232670e4246ea8dbc8..ec6e417e4c349b445456dcdd5f2c1388546be378 100644 (file)
@@ -18,10 +18,9 @@ class GeomAPI_Pnt;
 
 class GEOMALGOAPI_EXPORT GeomAlgoAPI_PointBuilder
 {
-public:
+ public:
   /// Creates linear edge by two points
-  static boost::shared_ptr<GeomAPI_Shape> point(
-    boost::shared_ptr<GeomAPI_Pnt> thePoint);
+  static boost::shared_ptr<GeomAPI_Shape> point(boost::shared_ptr<GeomAPI_Pnt> thePoint);
 };
 
 #endif
index 334f0da241d6bbac5828b050abef6f10b2ddcc32..528227b61091094f5085a8ac436b569741cf3696 100644 (file)
 #define DBL_MAX 1.7976931348623158e+308 
 #endif
 
-
 const double tolerance = Precision::Confusion();
 // This value helps to find direction on the boundaries of curve.
 // It is not significant for lines, but is used for circles to avoid 
 // wrong directions of movement (when two edges are tangent on the certain vertex)
-const double shift     = acos(1.0 - 3.0 * tolerance);
+const double shift = acos(1.0 - 3.0 * tolerance);
 
 /// \brief Search first vertex - the vertex with lowest x coordinate, which is used in 2 edges at least
-static const TopoDS_Shape& findStartVertex(
-          const BOPCol_IndexedDataMapOfShapeListOfShape& theMapVE,
-          const gp_Dir& theDirX, const gp_Dir& theDirY);
+static const TopoDS_Shape& findStartVertex(const BOPCol_IndexedDataMapOfShapeListOfShape& theMapVE,
+                                           const gp_Dir& theDirX, const gp_Dir& theDirY);
 
 /// \brief Search the vertex on the sketch candidate to be the next one in the loop
-static void findNextVertex(
-          const TopoDS_Shape&                            theStartVertex, 
-          const BOPCol_IndexedDataMapOfShapeListOfShape& theVertexEdgeMap,
-          const gp_Dir&                                  theStartDir,
-          const gp_Dir&                                  theNormal,
-                TopoDS_Shape&                            theNextVertex,
-                TopoDS_Shape&                            theNextEdge,
-                gp_Dir&                                  theNextDir);
+static void findNextVertex(const TopoDS_Shape& theStartVertex,
+                           const BOPCol_IndexedDataMapOfShapeListOfShape& theVertexEdgeMap,
+                           const gp_Dir& theStartDir, const gp_Dir& theNormal,
+                           TopoDS_Shape& theNextVertex, TopoDS_Shape& theNextEdge,
+                           gp_Dir& theNextDir);
 
 /// \brief Create planar face using the edges surrounding it
-static void createFace(const TopoDS_Shape&                      theStartVertex,
+static void createFace(const TopoDS_Shape& theStartVertex,
                        const std::list<TopoDS_Shape>::iterator& theStartEdge,
                        const std::list<TopoDS_Shape>::iterator& theEndOfEdges,
-                       const gp_Pln&                            thePlane,
-                             TopoDS_Face&                       theResFace);
+                       const gp_Pln& thePlane, TopoDS_Face& theResFace);
 
 /// \bief Create planar wire
-static void createWireList(const TopoDS_Shape&                      theStartVertex,
+static void createWireList(const TopoDS_Shape& theStartVertex,
                            const std::list<TopoDS_Shape>::iterator& theStartEdge,
                            const std::list<TopoDS_Shape>::iterator& theEndOfEdges,
-                           const std::set<Handle(TopoDS_TShape)>&   theEdgesInLoops,
-                                 std::list<TopoDS_Wire>&            theResWires);
+                           const std::set<Handle(TopoDS_TShape)>& theEdgesInLoops,
+                           std::list<TopoDS_Wire>& theResWires);
 
 /// \brief Calculate outer tengency on the edge in specified vertex
-static gp_Dir getOuterEdgeDirection(const TopoDS_Shape& theEdge,
-                                    const TopoDS_Shape& theVertex);
+static gp_Dir getOuterEdgeDirection(const TopoDS_Shape& theEdge, const TopoDS_Shape& theVertex);
 
 /// \brief Unnecessary edges will be removed from the map.
 ///        Positions of iterator will be updated
-static void removeWasteEdges(
-                std::list<TopoDS_Shape>::iterator&  theStartVertex,
-                std::list<TopoDS_Shape>::iterator&  theStartEdge,
-          const std::list<TopoDS_Shape>::iterator&  theEndOfVertexes,
-          const std::list<TopoDS_Shape>::iterator&  theEndOfEdges,
-          BOPCol_IndexedDataMapOfShapeListOfShape&  theMapVE);
-
-
-
+static void removeWasteEdges(std::list<TopoDS_Shape>::iterator& theStartVertex,
+                             std::list<TopoDS_Shape>::iterator& theStartEdge,
+                             const std::list<TopoDS_Shape>::iterator& theEndOfVertexes,
+                             const std::list<TopoDS_Shape>::iterator& theEndOfEdges,
+                             BOPCol_IndexedDataMapOfShapeListOfShape& theMapVE);
 
 void GeomAlgoAPI_SketchBuilder::createFaces(
-          const boost::shared_ptr<GeomAPI_Pnt>&                theOrigin,
-          const boost::shared_ptr<GeomAPI_Dir>&                theDirX,
-          const boost::shared_ptr<GeomAPI_Dir>&                theDirY,
-          const boost::shared_ptr<GeomAPI_Dir>&                theNorm,
-          const std::list< boost::shared_ptr<GeomAPI_Shape> >& theFeatures,
-                std::list< boost::shared_ptr<GeomAPI_Shape> >& theResultFaces,
-                std::list< boost::shared_ptr<GeomAPI_Shape> >& theResultWires)
+    const boost::shared_ptr<GeomAPI_Pnt>& theOrigin, const boost::shared_ptr<GeomAPI_Dir>& theDirX,
+    const boost::shared_ptr<GeomAPI_Dir>& theDirY, const boost::shared_ptr<GeomAPI_Dir>& theNorm,
+    const std::list<boost::shared_ptr<GeomAPI_Shape> >& theFeatures,
+    std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultFaces,
+    std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultWires)
 {
   if (theFeatures.empty())
-    return ;
+    return;
 
   // Create the list of edges with shared vertexes
   BOPAlgo_Builder aBuilder;
@@ -107,41 +94,38 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
   TopoDS_Shape aFeaturesCompound;
 
   // Obtain only edges from the features list
-  std::list< boost::shared_ptr<GeomAPI_Shape> > anEdges;
-  std::list< boost::shared_ptr<GeomAPI_Shape> >::const_iterator aFeatIt = theFeatures.begin();
-  for ( ; aFeatIt != theFeatures.end(); aFeatIt++)
-  {
+  std::list<boost::shared_ptr<GeomAPI_Shape> > anEdges;
+  std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator aFeatIt = theFeatures.begin();
+  for (; aFeatIt != theFeatures.end(); aFeatIt++) {
     boost::shared_ptr<GeomAPI_Shape> aShape(*aFeatIt);
     const TopoDS_Edge& anEdge = aShape->impl<TopoDS_Edge>();
     if (anEdge.ShapeType() == TopAbs_EDGE)
       anEdges.push_back(aShape);
   }
 
-  if (anEdges.size() == 1)
-  { // If there is only one feature, BOPAlgo_Builder will decline to work. Need to process it anyway
+  if (anEdges.size() == 1) {  // If there is only one feature, BOPAlgo_Builder will decline to work. Need to process it anyway
     aFeaturesCompound = anEdges.front()->impl<TopoDS_Shape>();
-  }
-  else
-  {
-    std::list< boost::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = anEdges.begin();
-    for (; anIt != anEdges.end(); anIt++)
-    {
+  } else {
+    std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = anEdges.begin();
+    for (; anIt != anEdges.end(); anIt++) {
       boost::shared_ptr<GeomAPI_Shape> aPreview(*anIt);
       aBuilder.AddArgument(aPreview->impl<TopoDS_Edge>());
     }
     aPF.SetArguments(aBuilder.Arguments());
     aPF.Perform();
     int aErr = aPF.ErrorStatus();
-    if (aErr) return ;
+    if (aErr)
+      return;
     aBuilder.PerformWithFiller(aPF);
     aErr = aBuilder.ErrorStatus();
-    if (aErr) return ;
+    if (aErr)
+      return;
     aFeaturesCompound = aBuilder.Shape();
   }
 
-  BOPCol_IndexedDataMapOfShapeListOfShape aMapVE; // map between vertexes and edges
+  BOPCol_IndexedDataMapOfShapeListOfShape aMapVE;  // map between vertexes and edges
   BOPTools::MapShapesAndAncestors(aFeaturesCompound, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
-  if (aMapVE.IsEmpty()) // in case of not-initialized circle
+  if (aMapVE.IsEmpty())  // in case of not-initialized circle
     return;
 
   gp_Dir aDirX = theDirX->impl<gp_Dir>();
@@ -168,18 +152,16 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
   TopoDS_Shape aNextVertex;
   TopoDS_Shape aBindingEdge;
   gp_Dir aNextDir;
-  while (aMapVE.Extent() > 0)
-  {
+  while (aMapVE.Extent() > 0) {
     if (aCurVertex.IsNull())
       return;
     findNextVertex(aCurVertex, aMapVE, aCurDir, aCurNorm, aNextVertex, aBindingEdge, aNextDir);
     aCurNorm = aNorm;
 
     // Try to find next vertex in the list of already processed
-    std::list<TopoDS_Shape>::iterator          aVertIter = aProcVertexes.begin();
-    std::list<TopoDS_Shape>::iterator          anEdgeIter = aProcEdges.begin();
-    for ( ; aVertIter != aProcVertexes.end(); aVertIter++)
-    {
+    std::list<TopoDS_Shape>::iterator aVertIter = aProcVertexes.begin();
+    std::list<TopoDS_Shape>::iterator anEdgeIter = aProcEdges.begin();
+    for (; aVertIter != aProcVertexes.end(); aVertIter++) {
       if (aVertIter->TShape() == aNextVertex.TShape())
         break;
       if (anEdgeIter != aProcEdges.end())
@@ -190,21 +172,18 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
     aProcEdges.push_back(aBindingEdge);
 
     // The loop was found
-    if (aVertIter != aProcVertexes.end())
-    {
+    if (aVertIter != aProcVertexes.end()) {
       // If the binding edge is a full circle, then the list may be empty before addition. Need to update edge iterator
       if (aProcEdges.size() == 1)
         anEdgeIter = aProcEdges.begin();
 
-      if (aVertIter != aProcVertexes.begin())
-      {
+      if (aVertIter != aProcVertexes.begin()) {
         // Check the orientation of the loop
         gp_Dir aCN = getOuterEdgeDirection(*anEdgeIter, *aVertIter);
         gp_Dir aCP = getOuterEdgeDirection(aProcEdges.back(), *aVertIter);
         aCN.Reverse();
         aCP.Reverse();
-        if (aCN.DotCross(aCP, aNorm) < -tolerance)
-        {
+        if (aCN.DotCross(aCP, aNorm) < -tolerance) {
           // The found loop has wrong orientation and may contain sub-loops.
           // Need to check it onle again with another initial direction.
           aCurVertex = *aVertIter;
@@ -222,8 +201,7 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
       // the first element, create new face and remove unnecessary edges.
       TopoDS_Face aPatch;
       createFace(*aVertIter, anEdgeIter, aProcEdges.end(), aPlane, aPatch);
-      if (!aPatch.IsNull())
-      {
+      if (!aPatch.IsNull()) {
         boost::shared_ptr<GeomAPI_Shape> aFace(new GeomAPI_Shape);
         aFace->setImpl(new TopoDS_Face(aPatch));
         theResultFaces.push_back(aFace);
@@ -239,10 +217,10 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
 
       // revert the list of remaining edges
       std::list<TopoDS_Shape> aRemainVertexes;
-      for ( ; aVertIter != aProcVertexes.end(); aVertIter++)
+      for (; aVertIter != aProcVertexes.end(); aVertIter++)
         aRemainVertexes.push_front(*aVertIter);
       std::list<TopoDS_Shape> aRemainEdges;
-      for ( ; anEdgeIter != aProcEdges.end(); anEdgeIter++)
+      for (; anEdgeIter != aProcEdges.end(); anEdgeIter++)
         aRemainEdges.push_front(*anEdgeIter);
       // remove edges and vertexes used in the loop and add remaining ones
       aProcVertexes.erase(aCopyVLoop, aProcVertexes.end());
@@ -251,20 +229,19 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
       aProcEdges.insert(aProcEdges.end(), aRemainEdges.begin(), aRemainEdges.end());
 
       // Recalculate current vertex and current direction
-      if (!aProcVertexes.empty())
-      {
+      if (!aProcVertexes.empty()) {
         aNextVertex = aProcVertexes.back();
         if (!aProcEdges.empty())
           aNextDir = getOuterEdgeDirection(aProcEdges.back(), aNextVertex);
-        else aNextDir = aDirY;
+        else
+          aNextDir = aDirY;
       }
     }
 
     // if next vertex connected only to alone edge, this is a part of wire (not a closed loop),
     // we need to go back through the list of already checked edges to find a branching vertex
-    if (!aMapVE.IsEmpty() && aMapVE.Contains(aNextVertex) && 
-        aMapVE.FindFromKey(aNextVertex).Size() == 1)
-    {
+    if (!aMapVE.IsEmpty() && aMapVE.Contains(aNextVertex)
+        && aMapVE.FindFromKey(aNextVertex).Size() == 1) {
       std::list<TopoDS_Shape>::reverse_iterator aVRIter = aProcVertexes.rbegin();
       std::list<TopoDS_Shape>::reverse_iterator aERIter = aProcEdges.rbegin();
       if (aVRIter != aProcVertexes.rend())
@@ -272,27 +249,23 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
       if (aERIter != aProcEdges.rend())
         aERIter++;
 
-      for ( ; aERIter != aProcEdges.rend(); aERIter++, aVRIter++)
+      for (; aERIter != aProcEdges.rend(); aERIter++, aVRIter++)
         if (aMapVE.FindFromKey(*aVRIter).Size() > 2)
           break;
-      if (aERIter != aProcEdges.rend() || 
-         (aVRIter != aProcVertexes.rend() && aMapVE.FindFromKey(*aVRIter).Size() == 1))
-      { // the branching vertex was found or current list of edges is a wire without branches
+      if (aERIter != aProcEdges.rend()
+          || (aVRIter != aProcVertexes.rend() && aMapVE.FindFromKey(*aVRIter).Size() == 1)) {  // the branching vertex was found or current list of edges is a wire without branches
         std::list<TopoDS_Shape>::iterator aEIter;
         TopoDS_Shape aCurEdge;
-        if (aERIter != aProcEdges.rend())
-        {
+        if (aERIter != aProcEdges.rend()) {
           aEIter = aERIter.base();
           aCurEdge = *aERIter;
-        }
-        else
+        } else
           aEIter = aProcEdges.begin();
         std::list<TopoDS_Wire> aTail;
         createWireList(*aVRIter, aEIter, aProcEdges.end(), anEdgesInLoops, aTail);
         std::list<TopoDS_Wire>::const_iterator aTailIter = aTail.begin();
-        for ( ; aTailIter != aTail.end(); aTailIter++)
-          if (!aTailIter->IsNull())
-          {
+        for (; aTailIter != aTail.end(); aTailIter++)
+          if (!aTailIter->IsNull()) {
             boost::shared_ptr<GeomAPI_Shape> aWire(new GeomAPI_Shape);
             aWire->setImpl(new TopoDS_Shape(*aTailIter));
             theResultWires.push_back(aWire);
@@ -305,28 +278,24 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
         aVIter = aVRIter.base();
         aProcVertexes.erase(aVIter, aProcVertexes.end());
 
-        if (!aProcVertexes.empty())
-        {
+        if (!aProcVertexes.empty()) {
           aNextVertex = aProcVertexes.back();
           if (!aCurEdge.IsNull())
             aNextDir = getOuterEdgeDirection(aCurEdge, aNextVertex);
         }
-      }
-      else
-      { // there is no branching vertex in the list of proceeded,
-        // so we should revert the list and go the opposite way
+      } else {  // there is no branching vertex in the list of proceeded,
+                // so we should revert the list and go the opposite way
         aProcVertexes.reverse();
         aProcEdges.reverse();
         aNextVertex = aProcVertexes.back();
-        aNextDir = aProcEdges.empty() ? aDirY : 
-                   getOuterEdgeDirection(aProcEdges.back(), aNextVertex);
+        aNextDir =
+            aProcEdges.empty() ? aDirY : getOuterEdgeDirection(aProcEdges.back(), aNextVertex);
       }
     }
 
     // When all edges of current component of connectivity are processed,
     // we should repeat procedure for finding initial vertex in the remaining
-    if (!aMapVE.IsEmpty() && !aMapVE.Contains(aNextVertex))
-    {
+    if (!aMapVE.IsEmpty() && !aMapVE.Contains(aNextVertex)) {
       aProcVertexes.clear();
       aProcEdges.clear();
 
@@ -347,63 +316,51 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
 }
 
 void GeomAlgoAPI_SketchBuilder::fixIntersections(
-          std::list< boost::shared_ptr<GeomAPI_Shape> >& theFaces)
+    std::list<boost::shared_ptr<GeomAPI_Shape> >& theFaces)
 {
   BRepClass_FaceClassifier aClassifier;
 
-  std::list< boost::shared_ptr<GeomAPI_Shape> >::iterator anIter1 = theFaces.begin();
-  std::list< boost::shared_ptr<GeomAPI_Shape> >::iterator anIter2;
-  for ( ; anIter1 != theFaces.end(); anIter1++)
-  {
+  std::list<boost::shared_ptr<GeomAPI_Shape> >::iterator anIter1 = theFaces.begin();
+  std::list<boost::shared_ptr<GeomAPI_Shape> >::iterator anIter2;
+  for (; anIter1 != theFaces.end(); anIter1++) {
     anIter2 = anIter1;
-    for (++anIter2; anIter2 != theFaces.end(); anIter2++)
-    {
+    for (++anIter2; anIter2 != theFaces.end(); anIter2++) {
       const TopoDS_Face& aF1 = (*anIter1)->impl<TopoDS_Face>();
-      assert(aF1.ShapeType() == TopAbs_FACE); // all items in result list should be faces
+      assert(aF1.ShapeType() == TopAbs_FACE);  // all items in result list should be faces
       TopExp_Explorer aVert2((*anIter2)->impl<TopoDS_Shape>(), TopAbs_VERTEX);
-      for ( ; aVert2.More(); aVert2.Next())
-      {
+      for (; aVert2.More(); aVert2.Next()) {
         Handle(BRep_TVertex) aV = Handle(BRep_TVertex)::DownCast(aVert2.Current().TShape());
         aClassifier.Perform(aF1, aV->Pnt(), tolerance);
         if (aClassifier.State() != TopAbs_IN)
           break;
       }
-      if (aVert2.More())
-      { // second shape is not inside first, change the shapes order and repeat comparision
+      if (aVert2.More()) {  // second shape is not inside first, change the shapes order and repeat comparision
         const TopoDS_Face& aF2 = (*anIter2)->impl<TopoDS_Face>();
-        assert(aF2.ShapeType() == TopAbs_FACE); // all items in result list should be faces
+        assert(aF2.ShapeType() == TopAbs_FACE);  // all items in result list should be faces
         TopExp_Explorer aVert1((*anIter1)->impl<TopoDS_Shape>(), TopAbs_VERTEX);
-        for ( ; aVert1.More(); aVert1.Next())
-        {
+        for (; aVert1.More(); aVert1.Next()) {
           Handle(BRep_TVertex) aV = Handle(BRep_TVertex)::DownCast(aVert1.Current().TShape());
           aClassifier.Perform(aF2, aV->Pnt(), tolerance);
           if (aClassifier.State() != TopAbs_IN)
             break;
         }
-        if (!aVert1.More())
-        { // first shape should be cut from the second
-          BRepAlgoAPI_Cut aCut((*anIter2)->impl<TopoDS_Shape>(),
-                               (*anIter1)->impl<TopoDS_Shape>());
+        if (!aVert1.More()) {  // first shape should be cut from the second
+          BRepAlgoAPI_Cut aCut((*anIter2)->impl<TopoDS_Shape>(), (*anIter1)->impl<TopoDS_Shape>());
           aCut.Build();
           TopExp_Explorer anExp(aCut.Shape(), TopAbs_FACE);
           (*anIter2)->setImpl(new TopoDS_Shape(anExp.Current()));
-          for (anExp.Next(); anExp.More(); anExp.Next())
-          {
+          for (anExp.Next(); anExp.More(); anExp.Next()) {
             boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
             aShape->setImpl(new TopoDS_Shape(anExp.Current()));
             theFaces.push_back(aShape);
           }
         }
-      }
-      else
-      { // second shape should be cut from the first
-        BRepAlgoAPI_Cut aCut((*anIter1)->impl<TopoDS_Shape>(),
-                             (*anIter2)->impl<TopoDS_Shape>());
+      } else {  // second shape should be cut from the first
+        BRepAlgoAPI_Cut aCut((*anIter1)->impl<TopoDS_Shape>(), (*anIter2)->impl<TopoDS_Shape>());
         aCut.Build();
         TopExp_Explorer anExp(aCut.Shape(), TopAbs_FACE);
         (*anIter1)->setImpl(new TopoDS_Shape(anExp.Current()));
-        for (anExp.Next(); anExp.More(); anExp.Next())
-        {
+        for (anExp.Next(); anExp.More(); anExp.Next()) {
           boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
           aShape->setImpl(new TopoDS_Shape(anExp.Current()));
           theFaces.push_back(aShape);
@@ -413,27 +370,23 @@ void GeomAlgoAPI_SketchBuilder::fixIntersections(
   }
 }
 
-
 // =================== Auxiliary functions ====================================
-const TopoDS_Shape& findStartVertex(
-          const BOPCol_IndexedDataMapOfShapeListOfShape& theMapVE,
-          const gp_Dir& theDirX, const gp_Dir& theDirY)
+const TopoDS_Shape& findStartVertex(const BOPCol_IndexedDataMapOfShapeListOfShape& theMapVE,
+                                    const gp_Dir& theDirX, const gp_Dir& theDirY)
 {
   int aStartVertexInd = 1;
   double aMaxX = -DBL_MAX;
   double aMaxY = -DBL_MAX;
   int aNbVert = theMapVE.Extent();
-  for (int i = 1; i <= aNbVert; i++)
-  {
-    const TopoDS_Vertex& aV = (const TopoDS_Vertex&)theMapVE.FindKey(i);
-    const Handle(BRep_TVertex)& aVert = (const Handle(BRep_TVertex)&)aV.TShape();
+  for (int i = 1; i <= aNbVert; i++) {
+    const TopoDS_Vertex& aV = (const TopoDS_Vertex&) theMapVE.FindKey(i);
+    const Handle(BRep_TVertex)& aVert = (const Handle(BRep_TVertex)&) aV.TShape();
     const gp_Pnt& aVertPnt = aVert->Pnt();
 
     double aX = aVertPnt.XYZ().Dot(theDirX.XYZ());
     double aY = aVertPnt.XYZ().Dot(theDirY.XYZ());
-    if ((aX > aMaxX || (fabs(aX - aMaxX) < tolerance && aY > aMaxY)) && 
-        theMapVE.FindFromIndex(i).Extent() > 1)
-    {
+    if ((aX > aMaxX || (fabs(aX - aMaxX) < tolerance && aY > aMaxY))
+        && theMapVE.FindFromIndex(i).Extent() > 1) {
       aMaxX = aX;
       aMaxY = aY;
       aStartVertexInd = i;
@@ -442,20 +395,15 @@ const TopoDS_Shape& findStartVertex(
   return theMapVE.FindKey(aStartVertexInd);
 }
 
-void findNextVertex(
-          const TopoDS_Shape&                            theStartVertex,
-          const BOPCol_IndexedDataMapOfShapeListOfShape& theVertexEdgeMap,
-          const gp_Dir&                                  theStartDir,
-          const gp_Dir&                                  theNormal,
-                TopoDS_Shape&                            theNextVertex,
-                TopoDS_Shape&                            theNextEdge,
-                gp_Dir&                                  theNextDir)
+void findNextVertex(const TopoDS_Shape& theStartVertex,
+                    const BOPCol_IndexedDataMapOfShapeListOfShape& theVertexEdgeMap,
+                    const gp_Dir& theStartDir, const gp_Dir& theNormal, TopoDS_Shape& theNextVertex,
+                    TopoDS_Shape& theNextEdge, gp_Dir& theNextDir)
 {
   const BOPCol_ListOfShape& anEdgesList = theVertexEdgeMap.FindFromKey(theStartVertex);
   BOPCol_ListOfShape::Iterator aEdIter(anEdgesList);
   double aBestEdgeProj = DBL_MAX;
-  for ( ; aEdIter.More(); aEdIter.Next())
-  {
+  for (; aEdIter.More(); aEdIter.Next()) {
     gp_Dir aTang = getOuterEdgeDirection(aEdIter.Value(), theStartVertex);
     aTang.Reverse();
 
@@ -468,22 +416,19 @@ void findNextVertex(
     if (theStartDir.DotCross(aTang, theNormal) < tolerance)
       aProj *= -1.0;
 
-    if (aProj < aBestEdgeProj)
-    {
+    if (aProj < aBestEdgeProj) {
       aBestEdgeProj = aProj;
       theNextEdge = aEdIter.Value();
       TopExp_Explorer aVertExp(theNextEdge, TopAbs_VERTEX);
-      for ( ; aVertExp.More(); aVertExp.Next())
-        if (aVertExp.Current().TShape() != theStartVertex.TShape())
-        {
+      for (; aVertExp.More(); aVertExp.Next())
+        if (aVertExp.Current().TShape() != theStartVertex.TShape()) {
           theNextVertex = aVertExp.Current();
           theNextDir = getOuterEdgeDirection(aEdIter.Value(), theNextVertex);
           break;
         }
-      if (!aVertExp.More())
-      { // This edge is a full circle
+      if (!aVertExp.More()) {  // This edge is a full circle
         TopoDS_Vertex aV1, aV2;
-        TopExp::Vertices(*(const TopoDS_Edge*)(&theNextEdge), aV1, aV2);
+        TopExp::Vertices(*(const TopoDS_Edge*) (&theNextEdge), aV1, aV2);
         if (aV1.Orientation() == theStartVertex.Orientation())
           theNextVertex = aV2;
         else
@@ -494,27 +439,22 @@ void findNextVertex(
   }
 }
 
-static void addEdgeToWire(const TopoDS_Edge&  theEdge,
-                          const BRep_Builder& theBuilder,
-                                TopoDS_Shape& theSpliceVertex,
-                                TopoDS_Wire&  theWire)
+static void addEdgeToWire(const TopoDS_Edge& theEdge, const BRep_Builder& theBuilder,
+                          TopoDS_Shape& theSpliceVertex, TopoDS_Wire& theWire)
 {
   TopoDS_Edge anEdge = theEdge;
   bool isCurVertChanged = false;
   TopoDS_Shape aCurVertChanged;
 
   TopExp_Explorer aVertExp(theEdge, TopAbs_VERTEX);
-  for ( ; aVertExp.More(); aVertExp.Next())
-  {
+  for (; aVertExp.More(); aVertExp.Next()) {
     const TopoDS_Shape& aVertex = aVertExp.Current();
-    if (aVertex.TShape() == theSpliceVertex.TShape() && 
-        aVertex.Orientation() != theEdge.Orientation())
-    { // Current vertex is the last for the edge, so its orientation is wrong, need to revert the edge
+    if (aVertex.TShape() == theSpliceVertex.TShape()
+        && aVertex.Orientation() != theEdge.Orientation()) {  // Current vertex is the last for the edge, so its orientation is wrong, need to revert the edge
       anEdge.Reverse();
       break;
     }
-    if (aVertex.TShape() != theSpliceVertex.TShape())
-    {
+    if (aVertex.TShape() != theSpliceVertex.TShape()) {
       aCurVertChanged = aVertex;
       isCurVertChanged = true;
     }
@@ -524,11 +464,10 @@ static void addEdgeToWire(const TopoDS_Edge&  theEdge,
   theBuilder.Add(theWire, anEdge);
 }
 
-void createFace(const TopoDS_Shape&                      theStartVertex,
+void createFace(const TopoDS_Shape& theStartVertex,
                 const std::list<TopoDS_Shape>::iterator& theStartEdge,
-                const std::list<TopoDS_Shape>::iterator& theEndOfEdges,
-                const gp_Pln&                            thePlane,
-                      TopoDS_Face&                       theResFace)
+                const std::list<TopoDS_Shape>::iterator& theEndOfEdges, const gp_Pln& thePlane,
+                TopoDS_Face& theResFace)
 {
   TopoDS_Wire aResWire;
   BRep_Builder aBuilder;
@@ -536,9 +475,8 @@ void createFace(const TopoDS_Shape&                      theStartVertex,
 
   TopoDS_Shape aCurVertex = theStartVertex;
   std::list<TopoDS_Shape>::const_iterator anEdgeIter = theStartEdge;
-  for ( ; anEdgeIter != theEndOfEdges; anEdgeIter++)
-  {
-    TopoDS_Edge anEdge = *((TopoDS_Edge*)(&(*anEdgeIter)));
+  for (; anEdgeIter != theEndOfEdges; anEdgeIter++) {
+    TopoDS_Edge anEdge = *((TopoDS_Edge*) (&(*anEdgeIter)));
     if (!anEdge.IsNull())
       addEdgeToWire(anEdge, aBuilder, aCurVertex, aResWire);
   }
@@ -548,26 +486,22 @@ void createFace(const TopoDS_Shape&                      theStartVertex,
     theResFace = aFaceBuilder.Face();
 }
 
-void createWireList(const TopoDS_Shape&                      theStartVertex,
+void createWireList(const TopoDS_Shape& theStartVertex,
                     const std::list<TopoDS_Shape>::iterator& theStartEdge,
                     const std::list<TopoDS_Shape>::iterator& theEndOfEdges,
-                    const std::set<Handle(TopoDS_TShape)>&   theEdgesInLoops,
-                          std::list<TopoDS_Wire>&            theResWires)
+                    const std::set<Handle(TopoDS_TShape)>& theEdgesInLoops,
+                    std::list<TopoDS_Wire>& theResWires)
 {
   BRep_Builder aBuilder;
   bool needNewWire = true;
   TopoDS_Shape aCurVertex = theStartVertex;
 
   std::list<TopoDS_Shape>::iterator anIter = theStartEdge;
-  while (anIter != theEndOfEdges)
-  {
-    while (anIter != theEndOfEdges && needNewWire && 
-           theEdgesInLoops.count(anIter->TShape()) != 0)
-    {
+  while (anIter != theEndOfEdges) {
+    while (anIter != theEndOfEdges && needNewWire && theEdgesInLoops.count(anIter->TShape()) != 0) {
       TopExp_Explorer aVertExp(*anIter, TopAbs_VERTEX);
-      for ( ; aVertExp.More(); aVertExp.Next())
-        if (aVertExp.Current().TShape() != aCurVertex.TShape())
-        {
+      for (; aVertExp.More(); aVertExp.Next())
+        if (aVertExp.Current().TShape() != aCurVertex.TShape()) {
           aCurVertex = aVertExp.Current();
           break;
         }
@@ -576,39 +510,34 @@ void createWireList(const TopoDS_Shape&                      theStartVertex,
     if (anIter == theEndOfEdges)
       break;
 
-    if (needNewWire)
-    { // The new wire should be created
+    if (needNewWire) {  // The new wire should be created
       TopoDS_Wire aWire;
       aBuilder.MakeWire(aWire);
       theResWires.push_back(aWire);
       needNewWire = false;
-    }
-    else if (theEdgesInLoops.count(anIter->TShape()) != 0)
-    { // There was found the edge already used in loop.
-      // Current wire should be released and new one should started
+    } else if (theEdgesInLoops.count(anIter->TShape()) != 0) {  // There was found the edge already used in loop.
+                                                                // Current wire should be released and new one should started
       needNewWire = true;
       continue;
     }
 
-    TopoDS_Edge anEdge = *((TopoDS_Edge*)(&(*anIter)));
+    TopoDS_Edge anEdge = *((TopoDS_Edge*) (&(*anIter)));
     addEdgeToWire(anEdge, aBuilder, aCurVertex, theResWires.back());
     anIter++;
   }
 }
 
-
-gp_Dir getOuterEdgeDirection(const TopoDS_Shape& theEdge,
-                             const TopoDS_Shape& theVertex)
+gp_Dir getOuterEdgeDirection(const TopoDS_Shape& theEdge, const TopoDS_Shape& theVertex)
 {
-  const Handle(BRep_TVertex)& aVertex = (const Handle(BRep_TVertex)&)theVertex.TShape();
+  const Handle(BRep_TVertex)& aVertex = (const Handle(BRep_TVertex)&) theVertex.TShape();
   gp_Pnt aVertexPnt = aVertex->Pnt();
 
-  const Handle(BRep_TEdge)& anEdge = (const Handle(BRep_TEdge)&)theEdge.TShape();
+  const Handle(BRep_TEdge)& anEdge = (const Handle(BRep_TEdge)&) theEdge.TShape();
 
   // Convert the edge to the curve to calculate the tangency.
   // There should be only one curve in the edge.
-  Handle(BRep_Curve3D) aEdCurve = 
-    Handle(BRep_Curve3D)::DownCast(anEdge->Curves().First());
+  Handle(BRep_Curve3D) aEdCurve =
+  Handle(BRep_Curve3D)::DownCast(anEdge->Curves().First());
   double aFirst, aLast;
   aEdCurve->Range(aFirst, aLast);
   Handle(Geom_Curve) aCurve = aEdCurve->Curve3D();
@@ -626,19 +555,17 @@ gp_Dir getOuterEdgeDirection(const TopoDS_Shape& theEdge,
   return gp_Dir(aTang);
 }
 
-void removeWasteEdges(
-                std::list<TopoDS_Shape>::iterator&  theStartVertex,
-                std::list<TopoDS_Shape>::iterator&  theStartEdge,
-          const std::list<TopoDS_Shape>::iterator&  theEndOfVertexes,
-          const std::list<TopoDS_Shape>::iterator&  theEndOfEdges,
-          BOPCol_IndexedDataMapOfShapeListOfShape&  theMapVE)
+void removeWasteEdges(std::list<TopoDS_Shape>::iterator& theStartVertex,
+                      std::list<TopoDS_Shape>::iterator& theStartEdge,
+                      const std::list<TopoDS_Shape>::iterator& theEndOfVertexes,
+                      const std::list<TopoDS_Shape>::iterator& theEndOfEdges,
+                      BOPCol_IndexedDataMapOfShapeListOfShape& theMapVE)
 {
   bool isVertStep = true;
-  while (theStartVertex != theEndOfVertexes && theStartEdge != theEndOfEdges)
-  {
+  while (theStartVertex != theEndOfVertexes && theStartEdge != theEndOfEdges) {
     BOPCol_ListOfShape& aBunch = theMapVE.ChangeFromKey(*theStartVertex);
     BOPCol_ListOfShape::Iterator anApprEdge(aBunch);
-    for ( ; anApprEdge.More(); anApprEdge.Next())
+    for (; anApprEdge.More(); anApprEdge.Next())
       if (anApprEdge.Value() == *theStartEdge)
         break;
     if (anApprEdge.More())
@@ -646,8 +573,7 @@ void removeWasteEdges(
 
     if (isVertStep)
       theStartVertex++;
-    else
-    {
+    else {
       theStartEdge++;
       // check current vertex to be a branching point
       // if so, it will be a new starting point to find a loop
index 1a75da2042591eb8f9539455ca5dc0a51f45b16b..22eafe77ef05252485c8b63d52b0f5d6c8f68cbd 100644 (file)
@@ -20,7 +20,7 @@
  */
 class GEOMALGOAPI_EXPORT GeomAlgoAPI_SketchBuilder
 {
-public:
+ public:
   /** \brief Creates list of faces and unclosed wires on basis of the features of the sketch
    *  \param[in]  theOrigin      origin point of the sketch
    *  \param[in]  theDirX        x-direction of the sketch
@@ -34,19 +34,19 @@ public:
    *  It finds the vertex with minimal coordinates along X axis (theDirX) and then 
    *  goes through the edges passing the surrounding area on the left.
    */
-  static void createFaces(const boost::shared_ptr<GeomAPI_Pnt>&                theOrigin,
-                          const boost::shared_ptr<GeomAPI_Dir>&                theDirX,
-                          const boost::shared_ptr<GeomAPI_Dir>&                theDirY,
-                          const boost::shared_ptr<GeomAPI_Dir>&                theNorm,
-                          const std::list< boost::shared_ptr<GeomAPI_Shape> >& theFeatures,
-                                std::list< boost::shared_ptr<GeomAPI_Shape> >& theResultFaces,
-                                std::list< boost::shared_ptr<GeomAPI_Shape> >& theResultWires);
+  static void createFaces(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
+                          const boost::shared_ptr<GeomAPI_Dir>& theDirX,
+                          const boost::shared_ptr<GeomAPI_Dir>& theDirY,
+                          const boost::shared_ptr<GeomAPI_Dir>& theNorm,
+                          const std::list<boost::shared_ptr<GeomAPI_Shape> >& theFeatures,
+                          std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultFaces,
+                          std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultWires);
 
   /** \brief Searches intersections between the faces in the list 
    *         and make holes in the faces to avoid intersections
    *  \param[in,out] theFaces list of faces to proccess
    */
-  static void fixIntersections(std::list< boost::shared_ptr<GeomAPI_Shape> >& theFaces);
+  static void fixIntersections(std::list<boost::shared_ptr<GeomAPI_Shape> >& theFaces);
 };
 
 #endif
index 3800c938ce04ee810e1bca6d6ff858bd83114f28..b7c2b1c30223a41bfe0a7e81cdee09b76dad6b52 100644 (file)
@@ -12,8 +12,8 @@ using namespace std;
 
 void GeomData_Dir::setValue(const double theX, const double theY, const double theZ)
 {
-  if (!myIsInitialized || myCoords->Value(0) != theX || myCoords->Value(1) != theY || 
-       myCoords->Value(2) != theZ) {
+  if (!myIsInitialized || myCoords->Value(0) != theX || myCoords->Value(1) != theY
+      || myCoords->Value(2) != theZ) {
     myCoords->SetValue(0, theX);
     myCoords->SetValue(1, theY);
     myCoords->SetValue(2, theZ);
@@ -44,8 +44,8 @@ double GeomData_Dir::z() const
 
 boost::shared_ptr<GeomAPI_Dir> GeomData_Dir::dir()
 {
-  return boost::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(
-    myCoords->Value(0), myCoords->Value(1), myCoords->Value(2)));
+  return boost::shared_ptr<GeomAPI_Dir>(
+      new GeomAPI_Dir(myCoords->Value(0), myCoords->Value(1), myCoords->Value(2)));
 }
 
 GeomData_Dir::GeomData_Dir(TDF_Label& theLabel)
index 55688d100f35d2993200b107bde350288203b2f0..b4dea091ac3574f3c34f8fbd7f9d1ca2143730ea 100644 (file)
@@ -19,8 +19,8 @@ class GeomAPI_Dir;
  */
 class GeomData_Dir : public GeomDataAPI_Dir
 {
-  Handle_TDataStd_RealArray myCoords; ///< X, Y and Z doubles as real array attribute [0; 2]
-public:
+  Handle_TDataStd_RealArray myCoords;  ///< X, Y and Z doubles as real array attribute [0; 2]
+ public:
   /// Defines the double value
   GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, const double theZ);
   /// Defines the direction
@@ -35,7 +35,7 @@ public:
   /// Returns the direction of this attribute
   GEOMDATA_EXPORT virtual boost::shared_ptr<GeomAPI_Dir> dir();
 
-protected:
+ protected:
   /// Initializes attributes
   GEOMDATA_EXPORT GeomData_Dir(TDF_Label& theLabel);
 
index db942aff62389b2ff9f268787954b1ff15a3ed51..023b12d9628c4ae466b4ce77ac8c266b77aed051 100644 (file)
@@ -11,8 +11,8 @@ using namespace std;
 
 void GeomData_Point::setValue(const double theX, const double theY, const double theZ)
 {
-  if (!myIsInitialized || myCoords->Value(0) != theX || myCoords->Value(1) != theY || 
-       myCoords->Value(2) != theZ) {
+  if (!myIsInitialized || myCoords->Value(0) != theX || myCoords->Value(1) != theY
+      || myCoords->Value(2) != theZ) {
     myCoords->SetValue(0, theX);
     myCoords->SetValue(1, theY);
     myCoords->SetValue(2, theZ);
@@ -43,8 +43,8 @@ double GeomData_Point::z() const
 
 boost::shared_ptr<GeomAPI_Pnt> GeomData_Point::pnt()
 {
-  boost::shared_ptr<GeomAPI_Pnt> aResult(new GeomAPI_Pnt(
-    myCoords->Value(0), myCoords->Value(1), myCoords->Value(2)));
+  boost::shared_ptr<GeomAPI_Pnt> aResult(
+      new GeomAPI_Pnt(myCoords->Value(0), myCoords->Value(1), myCoords->Value(2)));
   return aResult;
 }
 
index 6a306952705155a407679ef0a92acea528ff15c6..3d1ae7cef77700a8eee97ca08f53c0eaae6f8ce2 100644 (file)
@@ -17,8 +17,8 @@
 
 class GeomData_Point : public GeomDataAPI_Point
 {
-  Handle_TDataStd_RealArray myCoords; ///< X, Y and Z doubles as real array attribute [0; 2]
-public:
+  Handle_TDataStd_RealArray myCoords;  ///< X, Y and Z doubles as real array attribute [0; 2]
+ public:
   /// Defines the double value
   GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, const double theZ);
   /// Defines the point
@@ -33,7 +33,7 @@ public:
   /// Returns the 3D point
   GEOMDATA_EXPORT virtual boost::shared_ptr<GeomAPI_Pnt> pnt();
 
-protected:
+ protected:
   /// Initializes attributes
   GEOMDATA_EXPORT GeomData_Point(TDF_Label& theLabel);
 
index 7e6f889c41fb5698380bed1b4d2a99ee5da12fa5..08913436c7f757ec2261079c299c16abc9c49e55 100644 (file)
@@ -37,7 +37,7 @@ double GeomData_Point2D::y() const
 boost::shared_ptr<GeomAPI_Pnt2d> GeomData_Point2D::pnt()
 {
   boost::shared_ptr<GeomAPI_Pnt2d> aResult(
-    new GeomAPI_Pnt2d(myCoords->Value(0), myCoords->Value(1)));
+      new GeomAPI_Pnt2d(myCoords->Value(0), myCoords->Value(1)));
   return aResult;
 }
 
index 0041f5cfe0656e118e8df8fb73857b8289995cb6..4990948b8f8ed08483526fbea0aa8bc1e379e614 100644 (file)
@@ -17,8 +17,8 @@
 
 class GeomData_Point2D : public GeomDataAPI_Point2D
 {
-  Handle_TDataStd_RealArray myCoords; ///< X and Y doubles as real array attribute [0; 1]
-public:
+  Handle_TDataStd_RealArray myCoords;  ///< X and Y doubles as real array attribute [0; 1]
+ public:
   /// Defines the double value
   GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY);
   /// Defines the point
@@ -31,7 +31,7 @@ public:
   /// Returns the 2D point
   GEOMDATA_EXPORT virtual boost::shared_ptr<GeomAPI_Pnt2d> pnt();
 
-protected:
+ protected:
   /// Initializes attributes
   GEOMDATA_EXPORT GeomData_Point2D(TDF_Label& theLabel);
 
index c2239633f044a4ac5545ac76a8075ecaa979855c..e8c86f46a7bd1f0d8b1589a5fed2bd54d923585e 100644 (file)
@@ -17,7 +17,7 @@ class GeomAPI_Dir;
 
 class GeomDataAPI_Dir : public ModelAPI_Attribute
 {
-public:
+ public:
   /// Defines the double value
   virtual void setValue(const double theX, const double theY, const double theZ) = 0;
   /// Defines the direction
@@ -33,15 +33,22 @@ public:
   virtual boost::shared_ptr<GeomAPI_Dir> dir() = 0;
 
   /// Returns the type of this class of attributes
-  static inline std::string type() {return std::string("Dir");}
+  static inline std::string type()
+  {
+    return std::string("Dir");
+  }
 
   /// Returns the type of this class of attributes, not static method
-  virtual std::string attributeType() {return type();}
+  virtual std::string attributeType()
+  {
+    return type();
+  }
 
-protected:
+ protected:
   /// Objects are created for features automatically
   GeomDataAPI_Dir()
-  {}
+  {
+  }
 };
 
 #endif
index 227a1be5146963e308e3a6cdb6ad0913a5964314..08ee73951847765c0baad42f1d07d06bc54ad379 100644 (file)
@@ -17,7 +17,7 @@ class GeomAPI_Pnt;
 
 class GeomDataAPI_Point : public ModelAPI_Attribute
 {
-public:
+ public:
   /// Defines the double value
   virtual void setValue(const double theX, const double theY, const double theZ) = 0;
   /// Defines the point
@@ -33,15 +33,22 @@ public:
   virtual boost::shared_ptr<GeomAPI_Pnt> pnt() = 0;
 
   /// Returns the type of this class of attributes
-  static inline std::string type() {return std::string("Point");}
+  static inline std::string type()
+  {
+    return std::string("Point");
+  }
 
   /// Returns the type of this class of attributes, not static method
-  virtual std::string attributeType() {return type();}
+  virtual std::string attributeType()
+  {
+    return type();
+  }
 
-protected:
+ protected:
   /// Objects are created for features automatically
   GeomDataAPI_Point()
-  {}
+  {
+  }
 };
 
 #endif
index 02249c24f69edd0e2f484df23dfea1111457dcb8..6189e87d21ab221a2945c6fe792b37064e1f664e 100644 (file)
@@ -17,7 +17,7 @@ class GeomAPI_Pnt2d;
 
 class GeomDataAPI_Point2D : public ModelAPI_Attribute
 {
-public:
+ public:
   /// Defines the double value
   virtual void setValue(const double theX, const double theY) = 0;
   /// Defines the point
@@ -31,15 +31,22 @@ public:
   virtual boost::shared_ptr<GeomAPI_Pnt2d> pnt() = 0;
 
   /// Returns the type of this class of attributes
-  static inline std::string type() {return std::string("Point2D");}
+  static inline std::string type()
+  {
+    return std::string("Point2D");
+  }
 
   /// Returns the type of this class of attributes, not static method
-  virtual std::string attributeType() {return type();}
+  virtual std::string attributeType()
+  {
+    return type();
+  }
 
-protected:
+ protected:
   /// Objects are created for features automatically
   GeomDataAPI_Point2D()
-  {}
+  {
+  }
 };
 
 #endif
index df32ef977d7c599acfbb7dbadc23c99492533fb7..fe51e99a8decfb6694c0fb0dfc412802d66f4017 100644 (file)
@@ -29,7 +29,7 @@ const boost::shared_ptr<Model_Document>& Model_Application::getDocument(string t
   // load it if it must be loaded by demand
   if (myLoadedByDemand.find(theDocID) != myLoadedByDemand.end() && !myPath.empty()) {
     aNew->load(myPath.c_str());
-    myLoadedByDemand.erase(theDocID); // done, don't do it anymore
+    myLoadedByDemand.erase(theDocID);  // done, don't do it anymore
   }
 
   return myDocs[theDocID];
@@ -69,7 +69,7 @@ Model_Application::Model_Application()
 //=======================================================================
 void Model_Application::Formats(TColStd_SequenceOfExtendedString& theFormats)
 {
-  theFormats.Append(TCollection_ExtendedString("BinOcaf")); // standard binary schema
+  theFormats.Append(TCollection_ExtendedString("BinOcaf"));  // standard binary schema
 }
 
 //=======================================================================
index 0d6bef7749ed8b756462430447c0c7dec59e8a31..09a1694c3871b9d8818cee69fd33f5bd0319d0d6 100644 (file)
@@ -19,13 +19,14 @@ DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application)
  * Application supports the formats and document management. It is uses OCAF-lke
  * architecture and just implements specific features of the module.
  */
-class Model_Application: public TDocStd_Application
+class Model_Application : public TDocStd_Application
 {
-public:
+ public:
   // useful methods inside of the module
 
   // CASCADE RTTI
-  DEFINE_STANDARD_RTTI(Model_Application);
+  DEFINE_STANDARD_RTTI(Model_Application)
+  ;
 
   //! Retuns the application: one per process    
   MODEL_EXPORT static Handle_Model_Application getApplication();
@@ -41,7 +42,7 @@ public:
   //! Defines that specified document must be loaded by demand
   void setLoadByDemand(std::string theID);
 
-public:
+ public:
   // Redefined OCAF methods
   //! Return name of resource (i.e. "Standard")
   Standard_CString ResourcesName();
@@ -53,7 +54,7 @@ public:
   //! the static instance of the object (or derive your own application)
   Model_Application();
 
-private:
+ private:
   /// Map from string identifiers to created documents of an application
   std::map<std::string, boost::shared_ptr<Model_Document> > myDocs;
   /// Path for the loaded by demand documents
index 07c482b0741e5aa055866ff295f77a3cde81f79a..74901271ef27ba3dd9ddedc362bcf23e28f9a327 100644 (file)
@@ -19,7 +19,7 @@ void Model_AttributeBoolean::setValue(bool theValue)
 
 bool Model_AttributeBoolean::value()
 {
-  return myBool->Get() == Standard_True;
+  return myBool->Get() == Standard_True ;
 }
 
 Model_AttributeBoolean::Model_AttributeBoolean(TDF_Label& theLabel)
index 8626cdc111417454cba5614d384c65e8bbc1405c..0e4fbdf61302952307d544269cbd0598d9ca40f7 100644 (file)
 
 class Model_AttributeBoolean : public ModelAPI_AttributeBoolean
 {
-  Handle_TDataStd_Integer myBool; ///< double is Real attribute
-public:
+  Handle_TDataStd_Integer myBool;  ///< double is Real attribute
+ public:
   /// Defines the double value
   MODEL_EXPORT virtual void setValue(bool theValue);
 
   /// Returns the double value
   MODEL_EXPORT virtual bool value();
 
-protected:
+ protected:
   /// Initializes attibutes
   Model_AttributeBoolean(TDF_Label& theLabel);
 
index 83615e30ec458bd63417ebc210e95a03b4558ee4..806408d3332b570279e5c0e930cdc44a7a1a3b5a 100644 (file)
@@ -22,7 +22,7 @@ boost::shared_ptr<ModelAPI_Document> Model_AttributeDocRef::value()
 {
   if (myComment->Get().Length())
     return Model_Application::getApplication()->getDocument(
-      TCollection_AsciiString(myComment->Get()).ToCString());
+        TCollection_AsciiString(myComment->Get()).ToCString());
   // not initialized
   return boost::shared_ptr<ModelAPI_Document>();
 }
@@ -33,7 +33,7 @@ Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label& theLabel)
   if (!myIsInitialized) {
     // create attribute: not initialized by value yet, just empty string
     myComment = TDataStd_Comment::Set(theLabel, "");
-  } else { // document was already referenced: try to set it as loaded by demand
+  } else {  // document was already referenced: try to set it as loaded by demand
     Handle(Model_Application) anApp = Model_Application::getApplication();
     string anID(TCollection_AsciiString(myComment->Get()).ToCString());
     if (!anApp->hasDocument(anID)) {
index b17ddf14714133d437c007bc4bd286b3318f7417..dc731701d86451c17889f99d3d7c2a454ace7138 100644 (file)
 
 class Model_AttributeDocRef : public ModelAPI_AttributeDocRef
 {
-  Handle_TDataStd_Comment myComment; ///< reference to document is identified as string-id
-public:
+  Handle_TDataStd_Comment myComment;  ///< reference to document is identified as string-id
+ public:
   /// Defines the document referenced from this attribute
   MODEL_EXPORT virtual void setValue(boost::shared_ptr<ModelAPI_Document> theDoc);
 
   /// Returns document referenced from this attribute
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> value();
 
-protected:
+ protected:
   /// Initializes attibutes
   Model_AttributeDocRef(TDF_Label& theLabel);
 
index 5b206afe2e7db4c2865225ecac300285cb45909c..c9b54b863b3ef344b5fa680dc94fc92ca283d847 100644 (file)
 
 class Model_AttributeDouble : public ModelAPI_AttributeDouble
 {
-  Handle_TDataStd_Real myReal; ///< double is Real attribute
-public:
+  Handle_TDataStd_Real myReal;  ///< double is Real attribute
+ public:
   /// Defines the double value
   MODEL_EXPORT virtual void setValue(const double theValue);
 
   /// Returns the double value
   MODEL_EXPORT virtual double value();
 
-protected:
+ protected:
   /// Initializes attibutes
   Model_AttributeDouble(TDF_Label& theLabel);
 
index 09ea70ef775211f01bb9791b1839982e12bc9248..560a3fd062f3202dd1ee99a1973b12d8bf68711f 100644 (file)
@@ -16,11 +16,11 @@ bool Model_AttributeRefAttr::isObject()
 
 void Model_AttributeRefAttr::setAttr(boost::shared_ptr<ModelAPI_Attribute> theAttr)
 {
-  boost::shared_ptr<Model_Data> aData = 
-    boost::dynamic_pointer_cast<Model_Data>(theAttr->owner()->data());
+  boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(
+      theAttr->owner()->data());
   string anID = aData->id(theAttr);
   if (myIsInitialized && object() == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
-    return; // nothing is changed
+    return;  // nothing is changed
 
   myRef->Set(aData->label().Father());
   myID->Set(aData->id(theAttr).c_str());
@@ -31,8 +31,7 @@ boost::shared_ptr<ModelAPI_Attribute> Model_AttributeRefAttr::attr()
 {
   ObjectPtr anObj = object();
   if (anObj) {
-    boost::shared_ptr<Model_Data> aData = 
-      boost::dynamic_pointer_cast<Model_Data>(anObj->data());
+    boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(anObj->data());
     return aData->attribute(TCollection_AsciiString(myID->Get()).ToCString());
   }
   // not initialized
@@ -42,19 +41,19 @@ boost::shared_ptr<ModelAPI_Attribute> Model_AttributeRefAttr::attr()
 void Model_AttributeRefAttr::setObject(ObjectPtr theObject)
 {
   if (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject) {
-    boost::shared_ptr<Model_Data> aData = 
-      boost::dynamic_pointer_cast<Model_Data>(theObject->data());
+    boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(
+        theObject->data());
     myRef->Set(aData->label().Father());
-    myID->Set(""); // feature is identified by the empty ID
+    myID->Set("");  // feature is identified by the empty ID
     owner()->data()->sendAttributeUpdated(this);
   }
 }
 
 ObjectPtr Model_AttributeRefAttr::object()
 {
-  if (myRef->Get() != myRef->Label()) { // initialized
-    boost::shared_ptr<Model_Document> aDoc = 
-      boost::dynamic_pointer_cast<Model_Document>(owner()->document());
+  if (myRef->Get() != myRef->Label()) {  // initialized
+    boost::shared_ptr<Model_Document> aDoc = boost::dynamic_pointer_cast<Model_Document>(
+        owner()->document());
     if (aDoc) {
       TDF_Label aRefLab = myRef->Get();
       return aDoc->object(aRefLab);
@@ -70,7 +69,7 @@ Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label& theLabel)
   if (!myIsInitialized) {
     // create attribute: not initialized by value yet
     myID = TDataStd_Comment::Set(theLabel, "");
-    myRef = TDF_Reference::Set(theLabel, theLabel); // not initialized: reference to itself
+    myRef = TDF_Reference::Set(theLabel, theLabel);  // not initialized: reference to itself
   } else {
     theLabel.FindAttribute(TDF_Reference::GetID(), myRef);
   }
index efb879c6d5f35a1e833708550221a10296f76ea2..83eaf77f2ff4db4cfba9dcb66677748c41a2726e 100644 (file)
 
 class Model_AttributeRefAttr : public ModelAPI_AttributeRefAttr
 {
-  Handle_TDF_Reference myRef; ///< reference to the feature label
-   ///< ID of the referenced attirbute (empty if this is a reference to a feature)
+  Handle_TDF_Reference myRef;  ///< reference to the feature label
+  ///< ID of the referenced attirbute (empty if this is a reference to a feature)
   Handle_TDataStd_Comment myID;
-public:
+ public:
   /// Returns true if this attribute references to a object (not to the attribute)
   MODEL_EXPORT virtual bool isObject();
 
@@ -38,7 +38,7 @@ public:
   /// Returns object referenced from this attribute
   MODEL_EXPORT virtual ObjectPtr object();
 
-protected:
+ protected:
   /// Objects are created for features automatically
   MODEL_EXPORT Model_AttributeRefAttr(TDF_Label& theLabel);
 
index a341ad2bd2edbfbef69c984f40f4b7107b0a85cb..3d3af3467a634402939bdce3243832fce39e4701 100644 (file)
@@ -12,17 +12,15 @@ using namespace std;
 
 void Model_AttributeRefList::append(ObjectPtr theObject)
 {
-  boost::shared_ptr<Model_Data> aData = 
-    boost::dynamic_pointer_cast<Model_Data>(theObject->data());
-  myRef->Append(aData->label().Father()); // store label of the object
+  boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theObject->data());
+  myRef->Append(aData->label().Father());  // store label of the object
 
   owner()->data()->sendAttributeUpdated(this);
 }
 
 void Model_AttributeRefList::remove(ObjectPtr theObject)
 {
-  boost::shared_ptr<Model_Data> aData = 
-    boost::dynamic_pointer_cast<Model_Data>(theObject->data());
+  boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theObject->data());
   myRef->Remove(aData->label().Father());
 
   owner()->data()->sendAttributeUpdated(this);
@@ -35,12 +33,12 @@ int Model_AttributeRefList::size()
 
 list<ObjectPtr> Model_AttributeRefList::list()
 {
-  std::list< ObjectPtr > aResult;
-  boost::shared_ptr<Model_Document> aDoc = 
-    boost::dynamic_pointer_cast<Model_Document>(owner()->document());
+  std::list<ObjectPtr> aResult;
+  boost::shared_ptr<Model_Document> aDoc = boost::dynamic_pointer_cast<Model_Document>(
+      owner()->document());
   if (aDoc) {
     const TDF_LabelList& aList = myRef->List();
-    for(TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
+    for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
       ObjectPtr anObj = aDoc->object(aLIter.Value());
       aResult.push_back(anObj);
     }
index 87525753e1cab74ef7dba352a2fcdedc1937a280..d784769e6c52b6619e5d9bb9be8bdecd9f4d90cf 100644 (file)
@@ -18,8 +18,8 @@
 
 class Model_AttributeRefList : public ModelAPI_AttributeRefList
 {
-  Handle_TDataStd_ReferenceList myRef; ///< references to the features labels
-public:
+  Handle_TDataStd_ReferenceList myRef;  ///< references to the features labels
+ public:
   /// Appends the feature to the end of a list
   MODEL_EXPORT virtual void append(ObjectPtr theObject);
 
@@ -30,9 +30,9 @@ public:
   MODEL_EXPORT virtual int size();
 
   /// Returns the list of features
-  MODEL_EXPORT virtual std::list<ObjectPtr > list();
+  MODEL_EXPORT virtual std::list<ObjectPtr> list();
 
-protected:
+ protected:
   /// Objects are created for features automatically
   MODEL_EXPORT Model_AttributeRefList(TDF_Label& theLabel);
 
index 3169bd57a484f157c3807228bf9467893d5b245f..dfb54c5f10331298e535624aba6457cb10ee2cf9 100644 (file)
@@ -13,9 +13,9 @@ using namespace std;
 void Model_AttributeReference::setValue(ObjectPtr theObject)
 {
   if (!myIsInitialized || value() != theObject) {
-    boost::shared_ptr<Model_Data> aData = 
-      boost::dynamic_pointer_cast<Model_Data>(theObject->data());
-    myRef->Set(aData->label().Father()); // references to the feature label
+    boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(
+        theObject->data());
+    myRef->Set(aData->label().Father());  // references to the feature label
     owner()->data()->sendAttributeUpdated(this);
   }
 }
@@ -23,8 +23,8 @@ void Model_AttributeReference::setValue(ObjectPtr theObject)
 ObjectPtr Model_AttributeReference::value()
 {
   if (myIsInitialized) {
-    boost::shared_ptr<Model_Document> aDoc = 
-      boost::dynamic_pointer_cast<Model_Document>(owner()->document());
+    boost::shared_ptr<Model_Document> aDoc = boost::dynamic_pointer_cast<Model_Document>(
+        owner()->document());
     if (aDoc) {
       TDF_Label aRefLab = myRef->Get();
       return aDoc->object(aRefLab);
@@ -38,5 +38,5 @@ Model_AttributeReference::Model_AttributeReference(TDF_Label& theLabel)
 {
   myIsInitialized = theLabel.FindAttribute(TDF_Reference::GetID(), myRef) == Standard_True;
   if (!myIsInitialized)
-    myRef = TDF_Reference::Set(theLabel, theLabel); // not initialized references to itself
+    myRef = TDF_Reference::Set(theLabel, theLabel);  // not initialized references to itself
 }
index 356a519b234793ebf14de3fd4133045809bee3f3..da4eb7fbce8f795639bf1ea62514330b510f5b03 100644 (file)
 
 class Model_AttributeReference : public ModelAPI_AttributeReference
 {
-  Handle_TDF_Reference myRef; ///< references to the feature label
-public:
+  Handle_TDF_Reference myRef;  ///< references to the feature label
+ public:
   /// Defines the object referenced from this attribute
   MODEL_EXPORT virtual void setValue(ObjectPtr theObject);
 
   /// Returns object referenced from this attribute
   MODEL_EXPORT virtual ObjectPtr value();
 
-protected:
+ protected:
   /// Objects are created for features automatically
   MODEL_EXPORT Model_AttributeReference(TDF_Label& theLabel);
 
index 2cf5b1b86b66f2c4e30b06e6500e6bd8674637a9..592fc75db9d6479b27c06f869c95ec26246ed269 100644 (file)
@@ -17,7 +17,6 @@
 #include <Events_Loop.h>
 #include <Events_Error.h>
 
-
 using namespace std;
 
 Model_Data::Model_Data()
@@ -34,7 +33,7 @@ string Model_Data::name()
   Handle(TDataStd_Name) aName;
   if (myLab.FindAttribute(TDataStd_Name::GetID(), aName))
     return string(TCollection_AsciiString(aName->Get()).ToCString());
-  return ""; // not defined
+  return "";  // not defined
 }
 
 void Model_Data::setName(const string& theName)
@@ -51,9 +50,9 @@ void Model_Data::setName(const string& theName)
   }
   // to do not cause the update of the result on name change
   /*if (isModified) {
-    static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
-    ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent, false);
-  }*/
+   static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+   ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent, false);
+   }*/
 }
 
 void Model_Data::addAttribute(const string& theID, const string theAttrType)
@@ -82,8 +81,7 @@ void Model_Data::addAttribute(const string& theID, const string theAttrType)
   if (anAttr) {
     myAttrs[theID] = boost::shared_ptr<ModelAPI_Attribute>(anAttr);
     anAttr->setObject(myObject);
-  }
-  else {
+  } else {
     Events_Error::send("Can not create unknown type of attribute " + theAttrType);
   }
 }
@@ -95,8 +93,8 @@ boost::shared_ptr<ModelAPI_AttributeDocRef> Model_Data::docRef(const string& the
     // TODO: generate error on unknown attribute request and/or add mechanism for customization
     return boost::shared_ptr<ModelAPI_AttributeDocRef>();
   }
-  boost::shared_ptr<ModelAPI_AttributeDocRef> aRes = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeDocRef>(aFound->second);
+  boost::shared_ptr<ModelAPI_AttributeDocRef> aRes = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeDocRef>(aFound->second);
   if (!aRes) {
     // TODO: generate error on invalid attribute type request
   }
@@ -110,8 +108,8 @@ boost::shared_ptr<ModelAPI_AttributeDouble> Model_Data::real(const string& theID
     // TODO: generate error on unknown attribute request and/or add mechanism for customization
     return boost::shared_ptr<ModelAPI_AttributeDouble>();
   }
-  boost::shared_ptr<ModelAPI_AttributeDouble> aRes = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aFound->second);
+  boost::shared_ptr<ModelAPI_AttributeDouble> aRes = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeDouble>(aFound->second);
   if (!aRes) {
     // TODO: generate error on invalid attribute type request
   }
@@ -125,8 +123,8 @@ boost::shared_ptr<ModelAPI_AttributeBoolean> Model_Data::boolean(const std::stri
     // TODO: generate error on unknown attribute request and/or add mechanism for customization
     return boost::shared_ptr<ModelAPI_AttributeBoolean>();
   }
-  boost::shared_ptr<ModelAPI_AttributeBoolean> aRes = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(aFound->second);
+  boost::shared_ptr<ModelAPI_AttributeBoolean> aRes = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeBoolean>(aFound->second);
   if (!aRes) {
     // TODO: generate error on invalid attribute type request
   }
@@ -140,8 +138,8 @@ boost::shared_ptr<ModelAPI_AttributeReference> Model_Data::reference(const strin
     // TODO: generate error on unknown attribute request and/or add mechanism for customization
     return boost::shared_ptr<ModelAPI_AttributeReference>();
   }
-  boost::shared_ptr<ModelAPI_AttributeReference> aRes = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aFound->second);
+  boost::shared_ptr<ModelAPI_AttributeReference> aRes = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeReference>(aFound->second);
   if (!aRes) {
     // TODO: generate error on invalid attribute type request
   }
@@ -155,8 +153,8 @@ boost::shared_ptr<ModelAPI_AttributeRefAttr> Model_Data::refattr(const string& t
     // TODO: generate error on unknown attribute request and/or add mechanism for customization
     return boost::shared_ptr<ModelAPI_AttributeRefAttr>();
   }
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRes = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aFound->second);
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRes = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aFound->second);
   if (!aRes) {
     // TODO: generate error on invalid attribute type request
   }
@@ -170,8 +168,8 @@ boost::shared_ptr<ModelAPI_AttributeRefList> Model_Data::reflist(const string& t
     // TODO: generate error on unknown attribute request and/or add mechanism for customization
     return boost::shared_ptr<ModelAPI_AttributeRefList>();
   }
-  boost::shared_ptr<ModelAPI_AttributeRefList> aRes = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aFound->second);
+  boost::shared_ptr<ModelAPI_AttributeRefList> aRes = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefList>(aFound->second);
   if (!aRes) {
     // TODO: generate error on invalid attribute type request
   }
@@ -181,7 +179,7 @@ boost::shared_ptr<ModelAPI_AttributeRefList> Model_Data::reflist(const string& t
 boost::shared_ptr<ModelAPI_Attribute> Model_Data::attribute(const std::string& theID)
 {
   boost::shared_ptr<ModelAPI_Attribute> aResult;
-  if (myAttrs.find(theID) == myAttrs.end()) // no such attribute
+  if (myAttrs.find(theID) == myAttrs.end())  // no such attribute
     return aResult;
   return myAttrs[theID];
 }
@@ -189,8 +187,9 @@ boost::shared_ptr<ModelAPI_Attribute> Model_Data::attribute(const std::string& t
 const string& Model_Data::id(const boost::shared_ptr<ModelAPI_Attribute>& theAttr)
 {
   map<string, boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = myAttrs.begin();
-  for(; anAttr != myAttrs.end(); anAttr++) {
-    if (anAttr->second == theAttr) return anAttr->first;
+  for (; anAttr != myAttrs.end(); anAttr++) {
+    if (anAttr->second == theAttr)
+      return anAttr->first;
   }
   // not found
   static string anEmpty;
@@ -201,7 +200,7 @@ bool Model_Data::isEqual(const boost::shared_ptr<ModelAPI_Data>& theData)
 {
   boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theData);
   if (aData)
-    return myLab.IsEqual(aData->myLab) == Standard_True;
+    return myLab.IsEqual(aData->myLab) == Standard_True ;
   return false;
 }
 
@@ -214,7 +213,7 @@ list<boost::shared_ptr<ModelAPI_Attribute> > Model_Data::attributes(const string
 {
   list<boost::shared_ptr<ModelAPI_Attribute> > aResult;
   map<string, boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttrsIter = myAttrs.begin();
-  for(; anAttrsIter != myAttrs.end(); anAttrsIter++) {
+  for (; anAttrsIter != myAttrs.end(); anAttrsIter++) {
     if (theType.empty() || anAttrsIter->second->attributeType() == theType) {
       aResult.push_back(anAttrsIter->second);
     }
index cf002ad19daaf313c5a45c1358396e57f9bd18fb..ce939de8f721f265678650d9e2cdd678aef28af5 100644 (file)
@@ -20,9 +20,9 @@ class ModelAPI_Attribute;
  * to get/set attributes from the document and compute result of an operation.
  */
 
-class Model_Data: public ModelAPI_Data
+class Model_Data : public ModelAPI_Data
 {
-  TDF_Label myLab; ///< label of the feature in the document
+  TDF_Label myLab;  ///< label of the feature in the document
   /// All attributes of the object identified by the attribute ID
   std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> > myAttrs;
 
@@ -32,14 +32,17 @@ class Model_Data: public ModelAPI_Data
   Model_Data();
 
   /// Returns label of this feature
-  TDF_Label label() {return myLab;}
+  TDF_Label label()
+  {
+    return myLab;
+  }
 
   friend class Model_Document;
   friend class Model_AttributeReference;
   friend class Model_AttributeRefAttr;
   friend class Model_AttributeRefList;
 
-public:
+ public:
   /// Returns the name of the feature visible by the user in the object browser
   MODEL_EXPORT virtual std::string name();
   /// Defines the name of the feature visible by the user in the object browser
@@ -49,24 +52,24 @@ public:
   /// Returns the attribute that contains real value with double precision
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID);
   /// Returns the attribute that contains reference to a feature
-  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeReference> 
-    reference(const std::string& theID);
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeReference>
+  reference(const std::string& theID);
   /// Returns the attribute that contains reference to an attribute of a feature
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeRefAttr>
-    refattr(const std::string& theID);
+  refattr(const std::string& theID);
   /// Returns the attribute that contains list of references to features
-  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeRefList> 
-    reflist(const std::string& theID);
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeRefList>
+  reflist(const std::string& theID);
   /// Returns the attribute that contains boolean value
-  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeBoolean> 
-    boolean(const std::string& theID);
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeBoolean>
+  boolean(const std::string& theID);
   /// Returns the generic attribute by identifier
   /// \param theID identifier of the attribute
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID);
   /// Returns all attributes ofthe feature of the given type
   /// or all attributes if "theType" is empty
   MODEL_EXPORT virtual std::list<boost::shared_ptr<ModelAPI_Attribute> >
-    attributes(const std::string& theType);
+  attributes(const std::string& theType);
 
   /// Identifier by the id (not fast, iteration by map)
   /// \param theAttr attribute already created in this data
@@ -77,7 +80,10 @@ public:
   MODEL_EXPORT virtual bool isValid();
 
   /// Returns the label where the shape must be stored (used in ResultBody)
-  TDF_Label& shapeLab() {return myLab;}
+  TDF_Label& shapeLab()
+  {
+    return myLab;
+  }
 
   /// Initializes object by the attributes: must be called just after the object is created
   /// for each attribute of the object
@@ -94,7 +100,9 @@ public:
 
   /// Sets the object of this data
   MODEL_EXPORT virtual void setObject(ObjectPtr theObject)
-    {myObject = theObject;}
+  {
+    myObject = theObject;
+  }
 };
 
 #endif
index 9d8cb9b8a6ff1f58c0c29a0afcbe47237f224944..e667f2e61aed4f7a2c095d4eec3a0bbe69029f28 100644 (file)
 # define _separator_ '/'
 #endif
 
-static const int UNDO_LIMIT = 10; // number of possible undo operations
+static const int UNDO_LIMIT = 10;  // number of possible undo operations
 
-static const int TAG_GENERAL = 1; // general properties tag
-static const int TAG_OBJECTS = 2; // tag of the objects sub-tree (features, results)
-static const int TAG_HISTORY = 3; // tag of the history sub-tree (python dump)
+static const int TAG_GENERAL = 1;  // general properties tag
+static const int TAG_OBJECTS = 2;  // tag of the objects sub-tree (features, results)
+static const int TAG_HISTORY = 3;  // tag of the history sub-tree (python dump)
 
 // feature sub-labels
-static const int TAG_FEATURE_ARGUMENTS = 1; ///< where the arguments are located
-static const int TAG_FEATURE_RESULTS = 2; ///< where the results are located
-
+static const int TAG_FEATURE_ARGUMENTS = 1;  ///< where the arguments are located
+static const int TAG_FEATURE_RESULTS = 2;  ///< where the results are located
 
 Model_Document::Model_Document(const std::string theID)
-    : myID(theID), myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format
+    : myID(theID),
+      myDoc(new TDocStd_Document("BinOcaf"))  // binary OCAF format
 {
   myDoc->SetUndoLimit(UNDO_LIMIT);
   myTransactionsAfterSave = 0;
@@ -62,10 +62,10 @@ Model_Document::Model_Document(const std::string theID)
 /// Returns the file name of this document by the nameof directory and identifuer of a document
 static TCollection_ExtendedString DocFileName(const char* theFileName, const std::string& theID)
 {
-  TCollection_ExtendedString aPath ((const Standard_CString)theFileName);
+  TCollection_ExtendedString aPath((const Standard_CString) theFileName);
   aPath += _separator_;
   aPath += theID.c_str();
-  aPath += ".cbf"; // standard binary file extension
+  aPath += ".cbf";  // standard binary file extension
   return aPath;
 }
 
@@ -75,59 +75,68 @@ bool Model_Document::load(const char* theFileName)
   if (this == Model_PluginManager::get()->rootDocument().get()) {
     anApp->setLoadPath(theFileName);
   }
-  TCollection_ExtendedString aPath (DocFileName(theFileName, myID));
+  TCollection_ExtendedString aPath(DocFileName(theFileName, myID));
   PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus) -1;
-  try
-  {
+  try {
     aStatus = anApp->Open(aPath, myDoc);
-  }
-  catch (Standard_Failure)
-  {
+  } catch (Standard_Failure) {
     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    Events_Error::send(std::string("Exception in opening of document: ") + aFail->GetMessageString());
+    Events_Error::send(
+        std::string("Exception in opening of document: ") + aFail->GetMessageString());
     return false;
   }
   bool isError = aStatus != PCDM_RS_OK;
-  if (isError)
-  {
-    switch (aStatus)
-    {
-    case PCDM_RS_UnknownDocument: 
-      Events_Error::send(std::string("Can not open document: PCDM_RS_UnknownDocument")); break;
-    case PCDM_RS_AlreadyRetrieved: 
-      Events_Error::send(std::string("Can not open document: PCDM_RS_AlreadyRetrieved")); break;
-    case PCDM_RS_AlreadyRetrievedAndModified:
-      Events_Error::send(
-        std::string("Can not open document: PCDM_RS_AlreadyRetrievedAndModified"));
-      break;
-    case PCDM_RS_NoDriver:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_NoDriver")); break;
-    case PCDM_RS_UnknownFileDriver:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_UnknownFileDriver")); break;
-    case PCDM_RS_OpenError:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_OpenError")); break;
-    case PCDM_RS_NoVersion:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_NoVersion")); break;
-    case PCDM_RS_NoModel:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_NoModel")); break;
-    case PCDM_RS_NoDocument:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_NoDocument")); break;
-    case PCDM_RS_FormatFailure:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_FormatFailure")); break;
-    case PCDM_RS_TypeNotFoundInSchema:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_TypeNotFoundInSchema")); 
-      break;
-    case PCDM_RS_UnrecognizedFileFormat:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_UnrecognizedFileFormat")); 
-      break;
-    case PCDM_RS_MakeFailure:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_MakeFailure")); break;
-    case PCDM_RS_PermissionDenied:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_PermissionDenied")); break;
-    case PCDM_RS_DriverFailure:
-      Events_Error::send(std::string("Can not open document: PCDM_RS_DriverFailure")); break;
-    default:
-      Events_Error::send(std::string("Can not open document: unknown error")); break;
+  if (isError) {
+    switch (aStatus) {
+      case PCDM_RS_UnknownDocument:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_UnknownDocument"));
+        break;
+      case PCDM_RS_AlreadyRetrieved:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_AlreadyRetrieved"));
+        break;
+      case PCDM_RS_AlreadyRetrievedAndModified:
+        Events_Error::send(
+            std::string("Can not open document: PCDM_RS_AlreadyRetrievedAndModified"));
+        break;
+      case PCDM_RS_NoDriver:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_NoDriver"));
+        break;
+      case PCDM_RS_UnknownFileDriver:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_UnknownFileDriver"));
+        break;
+      case PCDM_RS_OpenError:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_OpenError"));
+        break;
+      case PCDM_RS_NoVersion:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_NoVersion"));
+        break;
+      case PCDM_RS_NoModel:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_NoModel"));
+        break;
+      case PCDM_RS_NoDocument:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_NoDocument"));
+        break;
+      case PCDM_RS_FormatFailure:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_FormatFailure"));
+        break;
+      case PCDM_RS_TypeNotFoundInSchema:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_TypeNotFoundInSchema"));
+        break;
+      case PCDM_RS_UnrecognizedFileFormat:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_UnrecognizedFileFormat"));
+        break;
+      case PCDM_RS_MakeFailure:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_MakeFailure"));
+        break;
+      case PCDM_RS_PermissionDenied:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_PermissionDenied"));
+        break;
+      case PCDM_RS_DriverFailure:
+        Events_Error::send(std::string("Can not open document: PCDM_RS_DriverFailure"));
+        break;
+      default:
+        Events_Error::send(std::string("Can not open document: unknown error"));
+        break;
     }
   }
   if (!isError) {
@@ -144,7 +153,7 @@ bool Model_Document::save(const char* theFileName)
 #ifdef WIN32
     CreateDirectory(theFileName, NULL);
 #else
-    mkdir(theFileName, 0x1ff); 
+    mkdir(theFileName, 0x1ff);
 #endif
   }
   // filename in the dir is id of document inside of the given directory
@@ -152,33 +161,31 @@ bool Model_Document::save(const char* theFileName)
   PCDM_StoreStatus aStatus;
   try {
     aStatus = Model_Application::getApplication()->SaveAs(myDoc, aPath);
-  }
-  catch (Standard_Failure) {
+  } catch (Standard_Failure) {
     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    Events_Error::send(std::string("Exception in saving of document: ") + aFail->GetMessageString());
+    Events_Error::send(
+        std::string("Exception in saving of document: ") + aFail->GetMessageString());
     return false;
   }
   bool isDone = aStatus == PCDM_SS_OK || aStatus == PCDM_SS_No_Obj;
-  if (!isDone)
-  {
-    switch (aStatus)
-    {
-    case PCDM_SS_DriverFailure:
-      Events_Error::send(std::string("Can not save document: PCDM_SS_DriverFailure"));
-      break;
-    case PCDM_SS_WriteFailure:
-      Events_Error::send(std::string("Can not save document: PCDM_SS_WriteFailure"));
-      break;
-    case PCDM_SS_Failure:
-    default:
-      Events_Error::send(std::string("Can not save document: PCDM_SS_Failure"));
-      break;
+  if (!isDone) {
+    switch (aStatus) {
+      case PCDM_SS_DriverFailure:
+        Events_Error::send(std::string("Can not save document: PCDM_SS_DriverFailure"));
+        break;
+      case PCDM_SS_WriteFailure:
+        Events_Error::send(std::string("Can not save document: PCDM_SS_WriteFailure"));
+        break;
+      case PCDM_SS_Failure:
+      default:
+        Events_Error::send(std::string("Can not save document: PCDM_SS_Failure"));
+        break;
     }
   }
   myTransactionsAfterSave = 0;
-  if (isDone) { // save also sub-documents if any
+  if (isDone) {  // save also sub-documents if any
     std::set<std::string>::iterator aSubIter = mySubs.begin();
-    for(; aSubIter != mySubs.end() && isDone; aSubIter++)
+    for (; aSubIter != mySubs.end() && isDone; aSubIter++)
       isDone = subDocument(*aSubIter)->save(theFileName);
   }
   return isDone;
@@ -187,26 +194,25 @@ bool Model_Document::save(const char* theFileName)
 void Model_Document::close()
 {
   boost::shared_ptr<ModelAPI_PluginManager> aPM = Model_PluginManager::get();
-  if (this != aPM->rootDocument().get() && 
-      this == aPM->currentDocument().get()) {
+  if (this != aPM->rootDocument().get() && this == aPM->currentDocument().get()) {
     aPM->setCurrentDocument(aPM->rootDocument());
   }
   // close all subs
   std::set<std::string>::iterator aSubIter = mySubs.begin();
-  for(; aSubIter != mySubs.end(); aSubIter++)
+  for (; aSubIter != mySubs.end(); aSubIter++)
     subDocument(*aSubIter)->close();
   mySubs.clear();
   // close this
   /* do not close because it can be undoed
-  if (myDoc->CanClose() == CDM_CCS_OK)
-    myDoc->Close();
-  Model_Application::getApplication()->deleteDocument(myID);
-  */
+   if (myDoc->CanClose() == CDM_CCS_OK)
+   myDoc->Close();
+   Model_Application::getApplication()->deleteDocument(myID);
+   */
 }
 
 void Model_Document::startOperation()
 {
-  if (myDoc->HasOpenCommand()) { // start of nested command
+  if (myDoc->HasOpenCommand()) {  // start of nested command
     if (myNestedNum == -1) {
       myNestedNum = 0;
       myDoc->InitDeltaCompaction();
@@ -214,18 +220,19 @@ void Model_Document::startOperation()
     myIsEmptyTr[myTransactionsAfterSave] = false;
     myTransactionsAfterSave++;
     myDoc->NewCommand();
-  } else { // start the simple command
+  } else {  // start the simple command
     myDoc->NewCommand();
   }
   // new command for all subs
   std::set<std::string>::iterator aSubIter = mySubs.begin();
-  for(; aSubIter != mySubs.end(); aSubIter++)
+  for (; aSubIter != mySubs.end(); aSubIter++)
     subDocument(*aSubIter)->startOperation();
 }
 
-void Model_Document::compactNested() {
+void Model_Document::compactNested()
+{
   bool allWasEmpty = true;
-  while(myNestedNum != -1) {
+  while (myNestedNum != -1) {
     myTransactionsAfterSave--;
     if (!myIsEmptyTr[myTransactionsAfterSave]) {
       allWasEmpty = false;
@@ -241,19 +248,19 @@ void Model_Document::compactNested() {
 void Model_Document::finishOperation()
 {
   // just to be sure that everybody knows that changes were performed
-  
+
   if (!myDoc->HasOpenCommand() && myNestedNum != -1)
-    boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())->
-      setCheckTransactions(false); // for nested transaction commit
+    boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())
+        ->setCheckTransactions(false);  // for nested transaction commit
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
   if (!myDoc->HasOpenCommand() && myNestedNum != -1)
-    boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())->
-      setCheckTransactions(true); // for nested transaction commit
+    boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())
+        ->setCheckTransactions(true);  // for nested transaction commit
 
-  if (myNestedNum != -1) // this nested transaction is owervritten
+  if (myNestedNum != -1)  // this nested transaction is owervritten
     myNestedNum++;
   if (!myDoc->HasOpenCommand()) {
     if (myNestedNum != -1) {
@@ -262,20 +269,20 @@ void Model_Document::finishOperation()
     }
   } else {
     // returns false if delta is empty and no transaction was made
-    myIsEmptyTr[myTransactionsAfterSave] = !myDoc->CommitCommand();// && (myNestedNum == -1);
+    myIsEmptyTr[myTransactionsAfterSave] = !myDoc->CommitCommand();  // && (myNestedNum == -1);
     myTransactionsAfterSave++;
   }
 
   // finish for all subs
   std::set<std::string>::iterator aSubIter = mySubs.begin();
-  for(; aSubIter != mySubs.end(); aSubIter++)
+  for (; aSubIter != mySubs.end(); aSubIter++)
     subDocument(*aSubIter)->finishOperation();
 }
 
 void Model_Document::abortOperation()
 {
-  if (myNestedNum > 0 && !myDoc->HasOpenCommand()) { // abort all what was done in nested
-    // first compact all nested
+  if (myNestedNum > 0 && !myDoc->HasOpenCommand()) {  // abort all what was done in nested
+      // first compact all nested
     compactNested();
     // for nested it is undo and clear redos
     myDoc->Undo();
@@ -283,21 +290,21 @@ void Model_Document::abortOperation()
     myTransactionsAfterSave--;
     myIsEmptyTr.erase(myTransactionsAfterSave);
   } else {
-    if (myNestedNum == 0) // abort only high-level
+    if (myNestedNum == 0)  // abort only high-level
       myNestedNum = -1;
     myDoc->AbortCommand();
   }
   synchronizeFeatures(true);
   // abort for all subs
   std::set<std::string>::iterator aSubIter = mySubs.begin();
-    for(; aSubIter != mySubs.end(); aSubIter++)
+  for (; aSubIter != mySubs.end(); aSubIter++)
     subDocument(*aSubIter)->abortOperation();
 }
 
 bool Model_Document::isOperation()
 {
   // operation is opened for all documents: no need to check subs
-  return myDoc->HasOpenCommand() == Standard_True;
+  return myDoc->HasOpenCommand() == Standard_True ;
 }
 
 bool Model_Document::isModified()
@@ -308,11 +315,12 @@ bool Model_Document::isModified()
 
 bool Model_Document::canUndo()
 {
-  if (myDoc->GetAvailableUndos() > 0 && myNestedNum != 0 && myTransactionsAfterSave != 0 /* for omitting the first useless transaction */)
+  if (myDoc->GetAvailableUndos() > 0 && myNestedNum != 0
+      && myTransactionsAfterSave != 0 /* for omitting the first useless transaction */)
     return true;
   // check other subs contains operation that can be undoed
   std::set<std::string>::iterator aSubIter = mySubs.begin();
-  for(; aSubIter != mySubs.end(); aSubIter++)
+  for (; aSubIter != mySubs.end(); aSubIter++)
     if (subDocument(*aSubIter)->canUndo())
       return true;
   return false;
@@ -321,13 +329,14 @@ bool Model_Document::canUndo()
 void Model_Document::undo()
 {
   myTransactionsAfterSave--;
-  if (myNestedNum > 0) myNestedNum--;
+  if (myNestedNum > 0)
+    myNestedNum--;
   if (!myIsEmptyTr[myTransactionsAfterSave])
     myDoc->Undo();
   synchronizeFeatures(true);
   // undo for all subs
   std::set<std::string>::iterator aSubIter = mySubs.begin();
-  for(; aSubIter != mySubs.end(); aSubIter++)
+  for (; aSubIter != mySubs.end(); aSubIter++)
     subDocument(*aSubIter)->undo();
 }
 
@@ -337,7 +346,7 @@ bool Model_Document::canRedo()
     return true;
   // check other subs contains operation that can be redoed
   std::set<std::string>::iterator aSubIter = mySubs.begin();
-  for(; aSubIter != mySubs.end(); aSubIter++)
+  for (; aSubIter != mySubs.end(); aSubIter++)
     if (subDocument(*aSubIter)->canRedo())
       return true;
   return false;
@@ -345,27 +354,29 @@ bool Model_Document::canRedo()
 
 void Model_Document::redo()
 {
-  if (myNestedNum != -1) myNestedNum++;
+  if (myNestedNum != -1)
+    myNestedNum++;
   if (!myIsEmptyTr[myTransactionsAfterSave])
     myDoc->Redo();
   myTransactionsAfterSave++;
   synchronizeFeatures(true);
   // redo for all subs
   std::set<std::string>::iterator aSubIter = mySubs.begin();
-  for(; aSubIter != mySubs.end(); aSubIter++)
+  for (; aSubIter != mySubs.end(); aSubIter++)
     subDocument(*aSubIter)->redo();
 }
 
 /// Appenad to the array of references a new referenced label
-static void AddToRefArray(TDF_Label& theArrayLab, TDF_Label& theReferenced) {
+static void AddToRefArray(TDF_Label& theArrayLab, TDF_Label& theReferenced)
+{
   Handle(TDataStd_ReferenceArray) aRefs;
   if (!theArrayLab.FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) {
     aRefs = TDataStd_ReferenceArray::Set(theArrayLab, 0, 0);
     aRefs->SetValue(0, theReferenced);
-  } else { // extend array by one more element
-    Handle(TDataStd_HLabelArray1) aNewArray = 
-      new TDataStd_HLabelArray1(aRefs->Lower(), aRefs->Upper() + 1);
-    for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) {
+  } else {  // extend array by one more element
+    Handle(TDataStd_HLabelArray1) aNewArray = new TDataStd_HLabelArray1(aRefs->Lower(),
+                                                                        aRefs->Upper() + 1);
+    for (int a = aRefs->Lower(); a <= aRefs->Upper(); a++) {
       aNewArray->SetValue(a, aRefs->Value(a));
     }
     aNewArray->SetValue(aRefs->Upper() + 1, theReferenced);
@@ -378,11 +389,11 @@ FeaturePtr Model_Document::addFeature(std::string theID)
   TDF_Label anEmptyLab;
   FeaturePtr anEmptyFeature;
   FeaturePtr aFeature = ModelAPI_PluginManager::get()->createFeature(theID);
-  boost::shared_ptr<Model_Document> aDocToAdd = 
-    boost::dynamic_pointer_cast<Model_Document>(aFeature->documentToAdd());
+  boost::shared_ptr<Model_Document> aDocToAdd = boost::dynamic_pointer_cast<Model_Document>(
+      aFeature->documentToAdd());
   if (aFeature) {
     TDF_Label aFeatureLab;
-    if (!aFeature->isAction()) {// do not add action to the data model
+    if (!aFeature->isAction()) {  // do not add action to the data model
       TDF_Label aFeaturesLab = aDocToAdd->featuresLabel();
       aFeatureLab = aFeaturesLab.NewChild();
       aDocToAdd->initData(aFeature, aFeatureLab, TAG_FEATURE_ARGUMENTS);
@@ -394,7 +405,7 @@ FeaturePtr Model_Document::addFeature(std::string theID)
         AddToRefArray(aFeaturesLab, aFeatureLab);
       }
     }
-    if (!aFeature->isAction()) {// do not add action to the data model
+    if (!aFeature->isAction()) {  // do not add action to the data model
       // event: feature is added
       static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
       ModelAPI_EventCreator::get()->sendUpdated(aFeature, anEvent);
@@ -406,21 +417,22 @@ FeaturePtr Model_Document::addFeature(std::string theID)
 /// Appenad to the array of references a new referenced label.
 /// If theIndex is not -1, removes element at thisindex, not theReferenced.
 /// \returns the index of removed element
-static int RemoveFromRefArray(
-  TDF_Label theArrayLab, TDF_Label theReferenced, const int theIndex = -1) {
-  int aResult = -1; // no returned
+static int RemoveFromRefArray(TDF_Label theArrayLab, TDF_Label theReferenced, const int theIndex =
+                                  -1)
+{
+  int aResult = -1;  // no returned
   Handle(TDataStd_ReferenceArray) aRefs;
   if (theArrayLab.FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) {
-    if (aRefs->Length() == 1) { // just erase an array
+    if (aRefs->Length() == 1) {  // just erase an array
       if ((theIndex == -1 && aRefs->Value(0) == theReferenced) || theIndex == 0) {
         theArrayLab.ForgetAttribute(TDataStd_ReferenceArray::GetID());
       }
       aResult = 0;
-    } else { // reduce the array
-      Handle(TDataStd_HLabelArray1) aNewArray = 
-        new TDataStd_HLabelArray1(aRefs->Lower(), aRefs->Upper() - 1);
+    } else {  // reduce the array
+      Handle(TDataStd_HLabelArray1) aNewArray = new TDataStd_HLabelArray1(aRefs->Lower(),
+                                                                          aRefs->Upper() - 1);
       int aCount = aRefs->Lower();
-      for(int a = aCount; a <= aRefs->Upper(); a++, aCount++) {
+      for (int a = aCount; a <= aRefs->Upper(); a++, aCount++) {
         if ((theIndex == -1 && aRefs->Value(a) == theReferenced) || theIndex == a) {
           aCount--;
           aResult = a;
@@ -438,9 +450,10 @@ void Model_Document::removeFeature(FeaturePtr theFeature)
 {
   boost::shared_ptr<Model_Data> aData = boost::static_pointer_cast<Model_Data>(theFeature->data());
   TDF_Label aFeatureLabel = aData->label().Father();
-  if (myObjs.IsBound(aFeatureLabel)) 
+  if (myObjs.IsBound(aFeatureLabel))
     myObjs.UnBind(aFeatureLabel);
-  else return; // not found feature => do not remove
+  else
+    return;  // not found feature => do not remove
 
   // erase all attributes under the label of feature
   aFeatureLabel.ForgetAllAttributes();
@@ -453,9 +466,9 @@ void Model_Document::removeFeature(FeaturePtr theFeature)
   static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
   const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
   std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
-  for(; aRIter != aResults.cend(); aRIter++) {
+  for (; aRIter != aResults.cend(); aRIter++) {
     boost::shared_ptr<ModelAPI_Result> aRes = *aRIter;
-    aRes->setData(boost::shared_ptr<ModelAPI_Data>()); // deleted flag
+    aRes->setData(boost::shared_ptr<ModelAPI_Data>());  // deleted flag
     ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP);
     ModelAPI_EventCreator::get()->sendDeleted(theFeature->document(), aRes->groupName());
   }
@@ -465,7 +478,7 @@ FeaturePtr Model_Document::feature(TDF_Label& theLabel)
 {
   if (myObjs.IsBound(theLabel))
     return myObjs.Find(theLabel);
-  return FeaturePtr(); // not found
+  return FeaturePtr();  // not found
 }
 
 ObjectPtr Model_Document::object(TDF_Label theLabel)
@@ -474,19 +487,19 @@ ObjectPtr Model_Document::object(TDF_Label theLabel)
   FeaturePtr aFeature = feature(theLabel);
   if (aFeature)
     return feature(theLabel);
-  TDF_Label aFeatureLabel = theLabel.Father().Father(); // let's suppose it is result
+  TDF_Label aFeatureLabel = theLabel.Father().Father();  // let's suppose it is result
   aFeature = feature(aFeatureLabel);
   if (aFeature) {
     const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
     std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.cbegin();
-    for(; aRIter != aResults.cend(); aRIter++) {
-      boost::shared_ptr<Model_Data> aResData = 
-        boost::dynamic_pointer_cast<Model_Data>((*aRIter)->data());
+    for (; aRIter != aResults.cend(); aRIter++) {
+      boost::shared_ptr<Model_Data> aResData = boost::dynamic_pointer_cast<Model_Data>(
+          (*aRIter)->data());
       if (aResData->label().Father().IsEqual(theLabel))
         return *aRIter;
     }
   }
-  return FeaturePtr(); // not found
+  return FeaturePtr();  // not found
 }
 
 boost::shared_ptr<ModelAPI_Document> Model_Document::subDocument(std::string theDocID)
@@ -497,14 +510,14 @@ boost::shared_ptr<ModelAPI_Document> Model_Document::subDocument(std::string the
   return Model_Application::getApplication()->getDocument(theDocID);
 }
 
-ObjectPtr Model_Document::object(const std::string& theGroupID, 
-  const int theIndex, const bool theHidden)
+ObjectPtr Model_Document::object(const std::string& theGroupID, const int theIndex,
+                                 const bool theHidden)
 {
   if (theGroupID == ModelAPI_Feature::group()) {
     if (theHidden) {
       int anIndex = 0;
       TDF_ChildIDIterator aLabIter(featuresLabel(), TDataStd_Comment::GetID());
-      for(; aLabIter.More(); aLabIter.Next()) {
+      for (; aLabIter.More(); aLabIter.Next()) {
         if (theIndex == anIndex) {
           TDF_Label aFLabel = aLabIter.Value()->Label();
           return feature(aFLabel);
@@ -524,12 +537,12 @@ ObjectPtr Model_Document::object(const std::string& theGroupID,
     // comment must be in any feature: it is kind
     int anIndex = 0;
     TDF_ChildIDIterator aLabIter(featuresLabel(), TDataStd_Comment::GetID());
-    for(; aLabIter.More(); aLabIter.Next()) {
+    for (; aLabIter.More(); aLabIter.Next()) {
       TDF_Label aFLabel = aLabIter.Value()->Label();
       FeaturePtr aFeature = feature(aFLabel);
       const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
       std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
-      for(; aRIter != aResults.cend(); aRIter++) {
+      for (; aRIter != aResults.cend(); aRIter++) {
         if ((theHidden || (*aRIter)->isInHistory()) && (*aRIter)->groupName() == theGroupID) {
           if (anIndex == theIndex)
             return *aRIter;
@@ -542,7 +555,7 @@ ObjectPtr Model_Document::object(const std::string& theGroupID,
   return ObjectPtr();
 }
 
-int Model_Document::size(const std::string& theGroupID, const bool theHidden) 
+int Model_Document::size(const std::string& theGroupID, const bool theHidden)
 {
   int aResult = 0;
   if (theGroupID == ModelAPI_Feature::group()) {
@@ -556,12 +569,12 @@ int Model_Document::size(const std::string& theGroupID, const bool theHidden)
   } else {
     // comment must be in any feature: it is kind
     TDF_ChildIDIterator aLabIter(featuresLabel(), TDataStd_Comment::GetID());
-    for(; aLabIter.More(); aLabIter.Next()) {
+    for (; aLabIter.More(); aLabIter.Next()) {
       TDF_Label aFLabel = aLabIter.Value()->Label();
       FeaturePtr aFeature = feature(aFLabel);
       const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
       std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
-      for(; aRIter != aResults.cend(); aRIter++) {
+      for (; aRIter != aResults.cend(); aRIter++) {
         if ((theHidden || (*aRIter)->isInHistory()) && (*aRIter)->groupName() == theGroupID) {
           aResult++;
         }
@@ -579,45 +592,48 @@ TDF_Label Model_Document::featuresLabel()
 
 void Model_Document::setUniqueName(FeaturePtr theFeature)
 {
-  if (!theFeature->data()->name().empty()) return; // not needed, name is already defined
-  std::string aName; // result
+  if (!theFeature->data()->name().empty())
+    return;  // not needed, name is already defined
+  std::string aName;  // result
   // first count all objects of such kind to start with index = count + 1
   int aNumObjects = 0;
   NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFIter(myObjs);
-  for(; aFIter.More(); aFIter.Next()) {
+  for (; aFIter.More(); aFIter.Next()) {
     if (aFIter.Value()->getKind() == theFeature->getKind())
       aNumObjects++;
   }
   // generate candidate name
   std::stringstream aNameStream;
-  aNameStream<<theFeature->getKind()<<"_"<<aNumObjects + 1;
+  aNameStream << theFeature->getKind() << "_" << aNumObjects + 1;
   aName = aNameStream.str();
   // check this is unique, if not, increase index by 1
-  for(aFIter.Initialize(myObjs); aFIter.More(); ) {
+  for (aFIter.Initialize(myObjs); aFIter.More();) {
     FeaturePtr aFeature = aFIter.Value();
     bool isSameName = aFeature->isInHistory() && aFeature->data()->name() == aName;
-    if (!isSameName) { // check also results to avoid same results names (actual for Parts)
+    if (!isSameName) {  // check also results to avoid same results names (actual for Parts)
       const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
       std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
-      for(; aRIter != aResults.cend(); aRIter++) {
+      for (; aRIter != aResults.cend(); aRIter++) {
         isSameName = (*aRIter)->isInHistory() && (*aRIter)->data()->name() == aName;
       }
     }
     if (isSameName) {
       aNumObjects++;
       std::stringstream aNameStream;
-      aNameStream<<theFeature->getKind()<<"_"<<aNumObjects + 1;
+      aNameStream << theFeature->getKind() << "_" << aNumObjects + 1;
       aName = aNameStream.str();
       // reinitialize iterator to make sure a new name is unique
       aFIter.Initialize(myObjs);
-    } else aFIter.Next();
+    } else
+      aFIter.Next();
   }
   theFeature->data()->setName(aName);
 }
 
-void Model_Document::initData(ObjectPtr theObj, TDF_Label theLab, const int theTag) {
-  boost::shared_ptr<ModelAPI_Document> aThis = 
-    Model_Application::getApplication()->getDocument(myID);
+void Model_Document::initData(ObjectPtr theObj, TDF_Label theLab, const int theTag)
+{
+  boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(
+      myID);
   boost::shared_ptr<Model_Data> aData(new Model_Data);
   aData->setLabel(theLab.FindChild(theTag));
   aData->setObject(theObj);
@@ -625,26 +641,26 @@ void Model_Document::initData(ObjectPtr theObj, TDF_Label theLab, const int theT
   theObj->setData(aData);
   FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
   if (aFeature) {
-    setUniqueName(aFeature); // must be before "initAttributes" because duplicate part uses name
+    setUniqueName(aFeature);  // must be before "initAttributes" because duplicate part uses name
     aFeature->initAttributes();
   }
 }
 
 void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
 {
-  boost::shared_ptr<ModelAPI_Document> aThis = 
-    Model_Application::getApplication()->getDocument(myID);
+  boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(
+      myID);
   // update all objects by checking are they of labels or not
   std::set<FeaturePtr> aNewFeatures, aKeptFeatures;
   TDF_ChildIDIterator aLabIter(featuresLabel(), TDataStd_Comment::GetID());
-  for(; aLabIter.More(); aLabIter.Next()) {
+  for (; aLabIter.More(); aLabIter.Next()) {
     TDF_Label aFeatureLabel = aLabIter.Value()->Label();
-    if (!myObjs.IsBound(aFeatureLabel)) { // a new feature is inserted
+    if (!myObjs.IsBound(aFeatureLabel)) {  // a new feature is inserted
       // create a feature
       FeaturePtr aNewObj = ModelAPI_PluginManager::get()->createFeature(
-        TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(aLabIter.Value())->Get())
-        .ToCString());
-      if (!aNewObj) { // somethig is wrong, most probably, the opened document has invalid structure
+          TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(aLabIter.Value())->Get())
+              .ToCString());
+      if (!aNewObj) {  // somethig is wrong, most probably, the opened document has invalid structure
         Events_Error::send("Invalid type of object in the document");
         aLabIter.Value()->Label().ForgetAllAttributes();
         continue;
@@ -658,7 +674,7 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
       static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
       ModelAPI_EventCreator::get()->sendUpdated(aNewObj, anEvent);
       // feature for this label is added, so go to the next label
-    } else { // nothing is changed, both iterators are incremented
+    } else {  // nothing is changed, both iterators are incremented
       aKeptFeatures.insert(myObjs.Find(aFeatureLabel));
       if (theMarkUpdated) {
         static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
@@ -668,14 +684,14 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
   }
   // execute new features to restore results: after features creation to make all references valid
   /*std::set<FeaturePtr>::iterator aNewIter = aNewFeatures.begin();
-  for(; aNewIter != aNewFeatures.end(); aNewIter++) {
-      (*aNewIter)->execute();
-  }*/
+   for(; aNewIter != aNewFeatures.end(); aNewIter++) {
+   (*aNewIter)->execute();
+   }*/
   // check all features are checked: if not => it was removed
   NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFIter(myObjs);
-  while(aFIter.More()) {
-    if (aKeptFeatures.find(aFIter.Value()) == aKeptFeatures.end() &&
-        aNewFeatures.find(aFIter.Value()) == aNewFeatures.end()) {
+  while (aFIter.More()) {
+    if (aKeptFeatures.find(aFIter.Value()) == aKeptFeatures.end()
+        && aNewFeatures.find(aFIter.Value()) == aNewFeatures.end()) {
       FeaturePtr aFeature = aFIter.Value();
       TDF_Label aLab = aFIter.Key();
       aFIter.Next();
@@ -688,7 +704,7 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
       static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
       const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
       std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
-      for(; aRIter != aResults.cend(); aRIter++) {
+      for (; aRIter != aResults.cend(); aRIter++) {
         boost::shared_ptr<ModelAPI_Result> aRes = *aRIter;
         //aRes->setData(boost::shared_ptr<ModelAPI_Data>()); // deleted flag
         ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP);
@@ -696,39 +712,45 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
       }
       // redisplay also removed feature (used for sketch and AISObject)
       ModelAPI_EventCreator::get()->sendUpdated(aFeature, EVENT_DISP);
-    } else aFIter.Next();
+    } else
+      aFIter.Next();
   }
 
   // after all updates, sends a message that groups of features were created or updated
-  boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())->
-    setCheckTransactions(false);
+  boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())->setCheckTransactions(
+      false);
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
   if (theMarkUpdated)
     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
-  boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())->
-    setCheckTransactions(true);
+  boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())->setCheckTransactions(
+      true);
 }
 
 void Model_Document::storeResult(boost::shared_ptr<ModelAPI_Data> theFeatureData,
-  boost::shared_ptr<ModelAPI_Result> theResult, const int theResultIndex)
+                                 boost::shared_ptr<ModelAPI_Result> theResult,
+                                 const int theResultIndex)
 {
-  boost::shared_ptr<ModelAPI_Document> aThis = 
-    Model_Application::getApplication()->getDocument(myID);
+  boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(
+      myID);
   theResult->setDoc(aThis);
-  initData(theResult, boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->label().
-    Father().FindChild(TAG_FEATURE_RESULTS).FindChild(theResultIndex + 1), TAG_FEATURE_ARGUMENTS);
-  if (theResult->data()->name().empty()) { // if was not initialized, generate event and set a name
+  initData(
+      theResult,
+      boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->label().Father().FindChild(
+          TAG_FEATURE_RESULTS).FindChild(theResultIndex + 1),
+      TAG_FEATURE_ARGUMENTS);
+  if (theResult->data()->name().empty()) {  // if was not initialized, generate event and set a name
     theResult->data()->setName(theFeatureData->name());
   }
 }
 
 boost::shared_ptr<ModelAPI_ResultConstruction> Model_Document::createConstruction(
-  const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+    const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
 {
-  ObjectPtr anOldObject = object(boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->
-    label().Father().FindChild(TAG_FEATURE_RESULTS).FindChild(theIndex + 1));
+  ObjectPtr anOldObject = object(
+      boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->label().Father().FindChild(
+          TAG_FEATURE_RESULTS).FindChild(theIndex + 1));
   boost::shared_ptr<ModelAPI_ResultConstruction> aResult;
   if (anOldObject) {
     aResult = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anOldObject);
@@ -741,10 +763,11 @@ boost::shared_ptr<ModelAPI_ResultConstruction> Model_Document::createConstructio
 }
 
 boost::shared_ptr<ModelAPI_ResultBody> Model_Document::createBody(
-  const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+    const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
 {
-  ObjectPtr anOldObject = object(boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->
-    label().Father().FindChild(TAG_FEATURE_RESULTS).FindChild(theIndex + 1));
+  ObjectPtr anOldObject = object(
+      boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->label().Father().FindChild(
+          TAG_FEATURE_RESULTS).FindChild(theIndex + 1));
   boost::shared_ptr<ModelAPI_ResultBody> aResult;
   if (anOldObject) {
     aResult = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(anOldObject);
@@ -757,10 +780,11 @@ boost::shared_ptr<ModelAPI_ResultBody> Model_Document::createBody(
 }
 
 boost::shared_ptr<ModelAPI_ResultPart> Model_Document::createPart(
-  const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+    const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
 {
-  ObjectPtr anOldObject = object(boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->
-    label().Father().FindChild(TAG_FEATURE_RESULTS).FindChild(theIndex + 1));
+  ObjectPtr anOldObject = object(
+      boost::dynamic_pointer_cast<Model_Data>(theFeatureData)->label().Father().FindChild(
+          TAG_FEATURE_RESULTS).FindChild(theIndex + 1));
   boost::shared_ptr<ModelAPI_ResultPart> aResult;
   if (anOldObject) {
     aResult = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(anOldObject);
@@ -773,7 +797,7 @@ boost::shared_ptr<ModelAPI_ResultPart> Model_Document::createPart(
 }
 
 boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(
-  const boost::shared_ptr<ModelAPI_Result>& theResult)
+    const boost::shared_ptr<ModelAPI_Result>& theResult)
 {
   boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theResult->data());
   if (aData) {
@@ -783,12 +807,12 @@ boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(
   return FeaturePtr();
 }
 
-Standard_Integer HashCode(const TDF_Label& theLab,const Standard_Integer theUpper)
+Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper)
 {
   return TDF_LabelMapHasher::HashCode(theLab, theUpper);
 
 }
-Standard_Boolean IsEqual(const TDF_Label& theLab1,const TDF_Label& theLab2)
+Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2)
 {
   return TDF_LabelMapHasher::IsEqual(theLab1, theLab2);
 }
index 4e8278ca531502dacf025f598576694e80becad6..240082532a2460065439f76d3436a7079d3d1250 100644 (file)
@@ -19,8 +19,8 @@
 class Handle_Model_Document;
 
 // for TDF_Label map usage
-static  Standard_Integer HashCode(const TDF_Label& theLab,const Standard_Integer theUpper);
-static  Standard_Boolean IsEqual(const TDF_Label& theLab1,const TDF_Label& theLab2);
+static Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper);
+static Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2);
 
 /**\class Model_Document
  * \ingroup DataModel
@@ -28,9 +28,9 @@ static  Standard_Boolean IsEqual(const TDF_Label& theLab1,const TDF_Label& theLa
  * Document contains all data that must be stored/retrived in the file.
  * Also it provides acces to this data: open/save, transactions management etc.
  */
-class Model_Document: public ModelAPI_Document
+class Model_Document : public ModelAPI_Document
 {
-public:
+ public:
 
   //! Loads the OCAF document from the file.
   //! \param theFileName full name of the file to load
@@ -86,7 +86,10 @@ public:
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID);
 
   ///! Returns the id of hte document
-  MODEL_EXPORT virtual const std::string& id() const {return myID;}
+  MODEL_EXPORT virtual const std::string& id() const
+  {
+    return myID;
+  }
 
   //! Returns the feature in the group by the index (started from zero)
   //! \param theGroupID group that contains a feature
@@ -94,7 +97,7 @@ public:
   //! \param isOperation if it is true, returns feature (not Object)
   //! \param theHidden if it is true, it counts also the features that are not in tree
   MODEL_EXPORT virtual ObjectPtr object(const std::string& theGroupID, const int theIndex,
-    const bool theHidden = false);
+                                        const bool theHidden = false);
 
   //! Returns the number of features in the group
   //! If theHidden is true, it counts also the features that are not in tree
@@ -102,20 +105,19 @@ public:
 
   /// Creates a construction cresults
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
-    const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+      const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
   /// Creates a body results
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_ResultBody> createBody(
-    const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+      const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
   /// Creates a part results
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_ResultPart> createPart(
-    const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+      const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
 
   //! Returns a feature by result (owner of result)
-  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> 
-    feature(const boost::shared_ptr<ModelAPI_Result>& theResult);
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature>
+  feature(const boost::shared_ptr<ModelAPI_Result>& theResult);
 
-
-protected:
+ protected:
 
   //! Returns (creates if needed) the features label
   TDF_Label featuresLabel();
@@ -130,7 +132,10 @@ protected:
   //! Creates new document with binary file format
   Model_Document(const std::string theID);
 
-  Handle_TDocStd_Document document() {return myDoc;}
+  Handle_TDocStd_Document document()
+  {
+    return myDoc;
+  }
 
   //! performas compactification of all nested operations into one
   void compactNested();
@@ -140,16 +145,16 @@ protected:
 
   //! Allows to store the result in the data tree of the document (attaches 'data' of result to tree)
   MODEL_EXPORT virtual void storeResult(boost::shared_ptr<ModelAPI_Data> theFeatureData,
-    boost::shared_ptr<ModelAPI_Result> theResult, const int theResultIndex = 0);
-
+                                        boost::shared_ptr<ModelAPI_Result> theResult,
+                                        const int theResultIndex = 0);
 
   friend class Model_Application;
   friend class Model_PluginManager;
   friend class DFBrowser;
 
-private:
-  std::string myID; ///< identifier of the document in the application
-  Handle_TDocStd_Document myDoc; ///< OCAF document
+ private:
+  std::string myID;  ///< identifier of the document in the application
+  Handle_TDocStd_Document myDoc;  ///< OCAF document
   /// number of transactions after the last "save" call, used for "IsModified" method
   int myTransactionsAfterSave;
   /// number of nested transactions performed (or -1 if not nested)
index 4096dd65e3b1ef9a521d494cb1dc5d71f77c17ab..ae785563cf2c9f02c1cbf44f0201fe29d7352033 100644 (file)
@@ -9,15 +9,15 @@
 Model_EventCreator MY_CREATOR;
 
 /////////////////////// CREATOR /////////////////////////////
-void Model_EventCreator::sendUpdated(
-  const ObjectPtr& theObject, const Events_ID& theEvent, const bool isGroupped) const
+void Model_EventCreator::sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent,
+                                     const bool isGroupped) const
 {
   Model_ObjectUpdatedMessage aMsg(theObject, theEvent);
   Events_Loop::loop()->send(aMsg, isGroupped);
 }
 
-void Model_EventCreator::sendDeleted(
-  const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup) const
+void Model_EventCreator::sendDeleted(const boost::shared_ptr<ModelAPI_Document>& theDoc,
+                                     const std::string& theGroup) const
 {
   Model_ObjectDeletedMessage aMsg(theDoc, theGroup);
   Events_Loop::loop()->send(aMsg, true);
@@ -29,43 +29,45 @@ Model_EventCreator::Model_EventCreator()
 }
 
 /////////////////////// UPDATED MESSAGE /////////////////////////////
-Model_ObjectUpdatedMessage::Model_ObjectUpdatedMessage(
-  const ObjectPtr& theObject,
-  const Events_ID& theEvent) : ModelAPI_ObjectUpdatedMessage(theEvent, 0)
+Model_ObjectUpdatedMessage::Model_ObjectUpdatedMessage(const ObjectPtr& theObject,
+                                                       const Events_ID& theEvent)
+    : ModelAPI_ObjectUpdatedMessage(theEvent, 0)
 {
-  if (theObject) myObjects.insert(theObject);
+  if (theObject)
+    myObjects.insert(theObject);
 }
 
-std::set<ObjectPtr> Model_ObjectUpdatedMessage::objects() const 
+std::set<ObjectPtr> Model_ObjectUpdatedMessage::objects() const
 {
   return myObjects;
 }
 
-Events_MessageGroup* Model_ObjectUpdatedMessage::newEmpty() 
+Events_MessageGroup* Model_ObjectUpdatedMessage::newEmpty()
 {
   ObjectPtr anEmptyObject;
   return new Model_ObjectUpdatedMessage(anEmptyObject, eventID());
 }
 
-void Model_ObjectUpdatedMessage::Join(Events_MessageGroup& theJoined) 
+void Model_ObjectUpdatedMessage::Join(Events_MessageGroup& theJoined)
 {
   Model_ObjectUpdatedMessage* aJoined = dynamic_cast<Model_ObjectUpdatedMessage*>(&theJoined);
-  std::set<ObjectPtr >::iterator aFIter = aJoined->myObjects.begin();
-  for(; aFIter != aJoined->myObjects.end(); aFIter++) {
+  std::set<ObjectPtr>::iterator aFIter = aJoined->myObjects.begin();
+  for (; aFIter != aJoined->myObjects.end(); aFIter++) {
     myObjects.insert(*aFIter);
   }
 }
 
 /////////////////////// DELETED MESSAGE /////////////////////////////
 Model_ObjectDeletedMessage::Model_ObjectDeletedMessage(
-  const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
-  : ModelAPI_ObjectDeletedMessage(messageId(), 0), myDoc(theDoc)
+    const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
+    : ModelAPI_ObjectDeletedMessage(messageId(), 0),
+      myDoc(theDoc)
 {
   if (!theGroup.empty())
     myGroups.insert(theGroup);
 }
 
-Events_MessageGroup* Model_ObjectDeletedMessage::newEmpty() 
+Events_MessageGroup* Model_ObjectDeletedMessage::newEmpty()
 {
   return new Model_ObjectDeletedMessage(myDoc, "");
 }
@@ -80,7 +82,7 @@ void Model_ObjectDeletedMessage::Join(Events_MessageGroup& theJoined)
 {
   Model_ObjectDeletedMessage* aJoined = dynamic_cast<Model_ObjectDeletedMessage*>(&theJoined);
   std::set<std::string>::iterator aGIter = aJoined->myGroups.begin();
-  for(; aGIter != aJoined->myGroups.end(); aGIter++) {
+  for (; aGIter != aJoined->myGroups.end(); aGIter++) {
     myGroups.insert(*aGIter);
   }
 }
index f0031e1a8e50d98b3f1e981a8691f1155b92802f..c9b59c3c6ab1e875cf1607defae0212131d26ff8 100644 (file)
@@ -9,31 +9,31 @@
 #include <ModelAPI_Events.h>
 
 /// Allovs to create ModelAPI messages
-class Model_EventCreator : public ModelAPI_EventCreator {
-public:
+class Model_EventCreator : public ModelAPI_EventCreator
+{
+ public:
   /// creates created, updated or moved messages and sends to the loop
-  virtual void sendUpdated(
-    const ObjectPtr& theObject, const Events_ID& theEvent, const bool isGroupped = true) const;
+  virtual void sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent,
+                           const bool isGroupped = true) const;
   /// creates deleted message and sends to the loop
-  virtual void sendDeleted(
-    const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup) const;
+  virtual void sendDeleted(const boost::shared_ptr<ModelAPI_Document>& theDoc,
+                           const std::string& theGroup) const;
 
   /// must be one per application, the constructor for internal usage only
   Model_EventCreator();
 };
 
 /// Message that feature was changed (used for Object Browser update): moved, updated and deleted
-class Model_ObjectUpdatedMessage : public ModelAPI_ObjectUpdatedMessage {
-  std::set<ObjectPtr> myObjects; ///< which feature is changed
+class Model_ObjectUpdatedMessage : public ModelAPI_ObjectUpdatedMessage
+{
+  std::set<ObjectPtr> myObjects;  ///< which feature is changed
 
   /// Sender is not important, all information is located in the feature.
   /// Use ModelAPI for creation of this event. Used for creation, movement and edition events.
-  Model_ObjectUpdatedMessage(
-    const ObjectPtr& theObject,
-    const Events_ID& theEvent);
+  Model_ObjectUpdatedMessage(const ObjectPtr& theObject, const Events_ID& theEvent);
 
   friend class Model_EventCreator;
-public:
+ public:
 
   /// Returns the feature that has been updated
   virtual std::set<ObjectPtr> objects() const;
@@ -46,25 +46,31 @@ public:
 };
 
 /// Message that feature was deleted (used for Object Browser update)
-class Model_ObjectDeletedMessage : public ModelAPI_ObjectDeletedMessage {
-  boost::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
-  std::set<std::string> myGroups; ///< group identifiers that contained the deleted feature
+class Model_ObjectDeletedMessage : public ModelAPI_ObjectDeletedMessage
+{
+  boost::shared_ptr<ModelAPI_Document> myDoc;  ///< document owner of the feature
+  std::set<std::string> myGroups;  ///< group identifiers that contained the deleted feature
 
   /// Use ModelAPI for creation of this event.
-  Model_ObjectDeletedMessage(
-    const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup);
+  Model_ObjectDeletedMessage(const boost::shared_ptr<ModelAPI_Document>& theDoc,
+                             const std::string& theGroup);
 
   friend class Model_EventCreator;
-public:
+ public:
   /// Returns the feature that has been updated
-  virtual boost::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
+  virtual boost::shared_ptr<ModelAPI_Document> document() const
+  {
+    return myDoc;
+  }
 
   /// Returns the group where the feature was deleted
-  virtual const std::set<std::string >& groups() const {return myGroups;}
+  virtual const std::set<std::string>& groups() const
+  {
+    return myGroups;
+  }
 
   virtual Events_MessageGroup* newEmpty();
 
-
   virtual const Events_ID messageId();
 
   virtual void Join(Events_MessageGroup& theJoined);
index 5490a3819ce1cc55a27fcf1dacbdbf3fc09bc482..f311e54db1bab70f748df56728821378217889c7 100644 (file)
 #include <boost/shared_ptr.hpp>
 
 bool Model_FeatureValidator::isValid(const boost::shared_ptr<ModelAPI_Feature>& theFeature
-                                     /*, const std::string theAttr*/
-                                     /*, std::list<std::string> theArguments*/) const
+/*, const std::string theAttr*/
+/*, std::list<std::string> theArguments*/) const
 {
   boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-  if(!aData->isValid())
+  if (!aData->isValid())
     return false;
   const std::string kAllTypes = "";
   std::list<AttributePtr> aLtAttributes = aData->attributes(kAllTypes);
   std::list<AttributePtr>::iterator it = aLtAttributes.begin();
-  for( ; it != aLtAttributes.end(); it++) {
-    if(!(*it)->isInitialized()) return false;
+  for (; it != aLtAttributes.end(); it++) {
+    if (!(*it)->isInitialized())
+      return false;
   }
   return true;
 }
index 6ba52fd249ef956b7ea5971faba6c936b702b64c..042621b284268d3d8b771ca0d09e13b42f415fda 100644 (file)
@@ -11,9 +11,9 @@
 
 #include <boost/shared_ptr.hpp>
 
-class Model_FeatureValidator: public ModelAPI_FeatureValidator
+class Model_FeatureValidator : public ModelAPI_FeatureValidator
 {
-public:
+ public:
   /// Returns true if feature and/or attributes are valid
   /// \param theFeature the validated feature
   MODEL_EXPORT virtual bool isValid(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const;
index cd262dcc7c626f2e62c3a537bb6f635cd04a3592..c41d3922c9a9b5a0958327a9027d2273a210fc44 100644 (file)
 #include <TDF_RelocationTable.hxx>
 #include <TDF_ClosureTool.hxx>
 
-
 using namespace std;
 
 static Model_PluginManager* myImpl = new Model_PluginManager();
 
 FeaturePtr Model_PluginManager::createFeature(string theFeatureID)
 {
-  if (this != myImpl) return myImpl->createFeature(theFeatureID);
+  if (this != myImpl)
+    return myImpl->createFeature(theFeatureID);
 
   LoadPluginsInfo();
   if (myPlugins.find(theFeatureID) != myPlugins.end()) {
@@ -38,27 +38,27 @@ FeaturePtr Model_PluginManager::createFeature(string theFeatureID)
       Config_ModuleReader::loadLibrary(myCurrentPluginName);
     }
     if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) {
-      FeaturePtr aCreated = 
-        myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
+      FeaturePtr aCreated = myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
       if (!aCreated) {
-        Events_Error::send(string("Can not initialize feature '") + theFeatureID +
-          "' in plugin '" + myCurrentPluginName + "'");
+        Events_Error::send(
+            string("Can not initialize feature '") + theFeatureID + "' in plugin '"
+                + myCurrentPluginName + "'");
       }
       return aCreated;
     } else {
       Events_Error::send(string("Can not load plugin '") + myCurrentPluginName + "'");
     }
   } else {
-      Events_Error::send(string("Feature '") + theFeatureID + "' not found in any plugin");
+    Events_Error::send(string("Feature '") + theFeatureID + "' not found in any plugin");
   }
 
-  return FeaturePtr(); // return nothing
+  return FeaturePtr();  // return nothing
 }
 
 boost::shared_ptr<ModelAPI_Document> Model_PluginManager::rootDocument()
 {
   return boost::shared_ptr<ModelAPI_Document>(
-    Model_Application::getApplication()->getDocument("root"));
+      Model_Application::getApplication()->getDocument("root"));
 }
 
 bool Model_PluginManager::hasRootDocument()
@@ -81,14 +81,14 @@ void Model_PluginManager::setCurrentDocument(boost::shared_ptr<ModelAPI_Document
 }
 
 boost::shared_ptr<ModelAPI_Document> Model_PluginManager::copy(
-  boost::shared_ptr<ModelAPI_Document> theSource, std::string theID) 
+    boost::shared_ptr<ModelAPI_Document> theSource, std::string theID)
 {
   // create a new document
   boost::shared_ptr<Model_Document> aNew = boost::dynamic_pointer_cast<Model_Document>(
-    Model_Application::getApplication()->getDocument(theID));
+      Model_Application::getApplication()->getDocument(theID));
   // make a copy of all labels
-  TDF_Label aSourceRoot = 
-    boost::dynamic_pointer_cast<Model_Document>(theSource)->document()->Main().Father();
+  TDF_Label aSourceRoot = boost::dynamic_pointer_cast<Model_Document>(theSource)->document()->Main()
+      .Father();
   TDF_Label aTargetRoot = aNew->document()->Main().Father();
   Handle(TDF_DataSet) aDS = new TDF_DataSet;
   aDS->AddLabel(aSourceRoot);
@@ -121,8 +121,7 @@ void Model_PluginManager::processEvent(const Events_Message* theMessage)
   static const Events_ID kFeatureEvent = Events_Loop::eventByName("FeatureRegisterEvent");
   static const Events_ID kValidatorEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED);
   if (theMessage->eventID() == kFeatureEvent) {
-    const Config_FeatureMessage* aMsg =
-      dynamic_cast<const Config_FeatureMessage*>(theMessage);
+    const Config_FeatureMessage* aMsg = dynamic_cast<const Config_FeatureMessage*>(theMessage);
     if (aMsg) {
       // proccess the plugin info, load plugin
       if (myPlugins.find(aMsg->id()) == myPlugins.end()) {
@@ -134,14 +133,14 @@ void Model_PluginManager::processEvent(const Events_Message* theMessage)
   } else if (theMessage->eventID() == kValidatorEvent) {
     const Config_ValidatorMessage* aMsg = dynamic_cast<const Config_ValidatorMessage*>(theMessage);
     if (aMsg) {
-      if (aMsg->attributeId().empty()) { // feature validator
+      if (aMsg->attributeId().empty()) {  // feature validator
         validators()->assignValidator(aMsg->validatorId(), aMsg->featureId());
-      } else { // attribute validator
-        validators()->assignValidator(aMsg->validatorId(), aMsg->featureId(),
-          aMsg->attributeId(), aMsg->parameters());
+      } else {  // attribute validator
+        validators()->assignValidator(aMsg->validatorId(), aMsg->featureId(), aMsg->attributeId(),
+                                      aMsg->parameters());
       }
     }
-  } else { // create/update/delete
+  } else {  // create/update/delete
     if (myCheckTransactions && !rootDocument()->isOperation())
       Events_Error::send("Modification of data structure outside of the transaction");
   }
@@ -149,7 +148,7 @@ void Model_PluginManager::processEvent(const Events_Message* theMessage)
 
 void Model_PluginManager::LoadPluginsInfo()
 {
-  if (myPluginsInfoLoaded) // nothing to do
+  if (myPluginsInfoLoaded)  // nothing to do
     return;
 
   // Read plugins information from XML files
index 3ae74bfc1c52c5136f158b5038b01fc6462324b0..a1187a10b8a740ada293043f1a114804b6d5b94c 100644 (file)
@@ -22,14 +22,14 @@ class Model_Document;
  */
 class Model_PluginManager : public ModelAPI_PluginManager, public Events_Listener
 {
-  bool myPluginsInfoLoaded; ///< it true if plugins information is loaded
+  bool myPluginsInfoLoaded;  ///< it true if plugins information is loaded
   /// map of feature IDs to plugin name
   std::map<std::string, std::string> myPlugins;
-  std::map<std::string, ModelAPI_Plugin*> myPluginObjs; ///< instances of the already plugins
-  std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently
-  boost::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
-  bool myCheckTransactions; ///< if true, generates error if document is updated outside of transaction
-public:
+  std::map<std::string, ModelAPI_Plugin*> myPluginObjs;  ///< instances of the already plugins
+  std::string myCurrentPluginName;  ///< name of the plugin that must be loaded currently
+  boost::shared_ptr<ModelAPI_Document> myCurrentDoc;  ///< current working document
+  bool myCheckTransactions;  ///< if true, generates error if document is updated outside of transaction
+ public:
   /// Returns the root document of the application (that may contains sub-documents)
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> rootDocument();
 
@@ -52,17 +52,20 @@ public:
 
   /// Copies the document to the new one wit hthe given id
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> copy(
-    boost::shared_ptr<ModelAPI_Document> theSource, std::string theID);
+      boost::shared_ptr<ModelAPI_Document> theSource, std::string theID);
 
   /// Returns the validators factory: the only one instance per application
   MODEL_EXPORT virtual ModelAPI_ValidatorsFactory* validators();
 
-  void setCheckTransactions(const bool theCheck) {myCheckTransactions = theCheck;}
+  void setCheckTransactions(const bool theCheck)
+  {
+    myCheckTransactions = theCheck;
+  }
 
   /// Is called only once, on startup of the application
   Model_PluginManager();
 
-protected:
+ protected:
   /// Loads (if not done yet) the information about the features and plugins
   void LoadPluginsInfo();
 
index fda4b4d8b5affe80cf677bde7bf6559b41f38415..967265f837880942854bc7446676a9b3eac60073 100644 (file)
@@ -15,14 +15,16 @@ Model_ResultBody::Model_ResultBody()
 
 void Model_ResultBody::store(const boost::shared_ptr<GeomAPI_Shape>& theShape)
 {
-  boost::shared_ptr<Model_Data> aData =  boost::dynamic_pointer_cast<Model_Data>(data());
+  boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
   if (aData) {
     TDF_Label& aShapeLab = aData->shapeLab();
     // TODO: to add the naming mechanism for shape storage in the next iteration
     TNaming_Builder aBuilder(aShapeLab);
-    if (!theShape) return; // bad shape
+    if (!theShape)
+      return;  // bad shape
     TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
-    if (aShape.IsNull()) return; // null shape inside
+    if (aShape.IsNull())
+      return;  // null shape inside
 
     aBuilder.Generated(aShape);
   }
@@ -30,7 +32,7 @@ void Model_ResultBody::store(const boost::shared_ptr<GeomAPI_Shape>& theShape)
 
 boost::shared_ptr<GeomAPI_Shape> Model_ResultBody::shape()
 {
-  boost::shared_ptr<Model_Data> aData =  boost::dynamic_pointer_cast<Model_Data>(data());
+  boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
   if (aData) {
     TDF_Label& aShapeLab = aData->shapeLab();
     Handle(TNaming_NamedShape) aName;
index 22a9b561cc0d69dee6b63fb9b285ba9ebd285f34..08ce28ab0cd88aafb8226f1b7cccc4d0a4903671 100644 (file)
@@ -18,8 +18,8 @@
  */
 class Model_ResultBody : public ModelAPI_ResultBody
 {
-  boost::shared_ptr<ModelAPI_Feature> myOwner; ///< owner of this result
-public:
+  boost::shared_ptr<ModelAPI_Feature> myOwner;  ///< owner of this result
+ public:
   /// Stores the shape (called by the execution method).
   MODEL_EXPORT virtual void store(const boost::shared_ptr<GeomAPI_Shape>& theShape);
   /// Returns the shape-result produced by this feature
@@ -27,7 +27,7 @@ public:
   /// Returns the source feature of this result
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> owner();
 
-protected:
+ protected:
   /// Makes a body on the given feature
   Model_ResultBody();
 
index 5c37e9961c05091e57676cc381059e95f6e86c84..5b6e9b472f9008069d0e7c274144c83014406de3 100644 (file)
  */
 class Model_ResultConstruction : public ModelAPI_ResultConstruction
 {
-  boost::shared_ptr<ModelAPI_Feature> myOwner; ///< owner of this result
-  boost::shared_ptr<GeomAPI_Shape> myShape; ///< shape of this result created "on the fly"
+  boost::shared_ptr<ModelAPI_Feature> myOwner;  ///< owner of this result
+  boost::shared_ptr<GeomAPI_Shape> myShape;  ///< shape of this result created "on the fly"
   bool myIsInHistory;
-public:
-    /// By default object is displayed in the object browser.
-  MODEL_EXPORT virtual bool isInHistory() {return myIsInHistory;}
-  
+ public:
+  /// By default object is displayed in the object browser.
+  MODEL_EXPORT virtual bool isInHistory()
+  {
+    return myIsInHistory;
+  }
+
   /// Sets the result
   MODEL_EXPORT virtual void setShape(boost::shared_ptr<GeomAPI_Shape> theShape);
   /// Returns the shape-result produced by this feature
@@ -32,7 +35,7 @@ public:
   /// Sets the flag that it must be displayed in history (default is true)
   MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory);
 
-protected:
+ protected:
   /// Makes a body on the given feature
   Model_ResultConstruction();
 
index 75b2f8b412f732f28e2ad83e8286aabece48e293..aecaac06f6957d58d434df93ed1b501c2b49c34b 100644 (file)
@@ -13,7 +13,7 @@ boost::shared_ptr<ModelAPI_Document> Model_ResultPart::partDoc()
 
 boost::shared_ptr<ModelAPI_Feature> Model_ResultPart::owner()
 {
-  return boost::shared_ptr<ModelAPI_Feature>(); // return empty pointer
+  return boost::shared_ptr<ModelAPI_Feature>();  // return empty pointer
 }
 
 Model_ResultPart::Model_ResultPart()
index 4123d69e37f640b37255510fc55c1bd612cc3f5d..af0f385e8289946c1c90c738e0ad6cd3b3545d6b 100644 (file)
  */
 class Model_ResultPart : public ModelAPI_ResultPart
 {
-public:
+ public:
   /// Returns the part-document of this result
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> partDoc();
   /// Part has no stored feature: this method returns NULL
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> owner();
 
-protected:
+ protected:
   /// makes a result on a temporary feature (an action)
   Model_ResultPart();
 
index 75b603fc7cbd73fb5a70d3f2f9ee736b2614aad5..66840d45021d0a90fadfe9753b7b7c86b43550f3 100644 (file)
@@ -14,7 +14,6 @@
 #include <BRep_Tool.hxx>
 #include <GeomAdaptor_Curve.hxx>
 
-
 ResultPtr result(const ObjectPtr theObject)
 {
   return boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
@@ -28,7 +27,6 @@ TopoDS_Shape shape(ResultPtr theResult)
   return TopoDS_Shape();
 }
 
-
 bool Model_ResultPointValidator::isValid(const ObjectPtr theObject) const
 {
   ResultPtr aResult = result(theObject);
@@ -41,7 +39,6 @@ bool Model_ResultPointValidator::isValid(const ObjectPtr theObject) const
   return aShape.ShapeType() == TopAbs_VERTEX;
 }
 
-
 bool Model_ResultLineValidator::isValid(const ObjectPtr theObject) const
 {
   ResultPtr aResult = result(theObject);
@@ -61,7 +58,6 @@ bool Model_ResultLineValidator::isValid(const ObjectPtr theObject) const
   return false;
 }
 
-
 bool Model_ResultArcValidator::isValid(const ObjectPtr theObject) const
 {
   ResultPtr aResult = result(theObject);
index c76cd3056ca850b4eaa479f9d2c9f1f9f75513f2..dbbf60dd48f350261dc404af96dfc4a957b4e78a 100644 (file)
@@ -9,22 +9,22 @@
 #include <ModelAPI_ResultValidator.h>
 #include <ModelAPI_Object.h>
 
-class Model_ResultPointValidator: public ModelAPI_ResultValidator
+class Model_ResultPointValidator : public ModelAPI_ResultValidator
 {
-public:
+ public:
   MODEL_EXPORT virtual bool isValid(const ObjectPtr theObject) const;
 };
 
-class Model_ResultLineValidator: public ModelAPI_ResultValidator
+class Model_ResultLineValidator : public ModelAPI_ResultValidator
 {
-public:
+ public:
   MODEL_EXPORT virtual bool isValid(const ObjectPtr theObject) const;
 };
 
-class Model_ResultArcValidator: public ModelAPI_ResultValidator
+class Model_ResultArcValidator : public ModelAPI_ResultValidator
 {
-public:
+ public:
   MODEL_EXPORT virtual bool isValid(const ObjectPtr theObject) const;
 };
 
-#endif
\ No newline at end of file
+#endif
index f728bb60e23a9861bbbd65daa9df0e37c6df15aa..7a40503358479fedd12d053b27a3412d02fd827a 100644 (file)
@@ -15,7 +15,7 @@
 
 using namespace std;
 
-Model_Update MY_INSTANCE; /// the only one instance initialized on load of the library
+Model_Update MY_INSTANCE;  /// the only one instance initialized on load of the library
 
 Model_Update::Model_Update()
 {
@@ -25,25 +25,26 @@ Model_Update::Model_Update()
 
 void Model_Update::processEvent(const Events_Message* theMessage)
 {
-  if (isExecuted) return; // nothing to do: it is executed now
+  if (isExecuted)
+    return;  // nothing to do: it is executed now
   //Events_LongOp::start(this);
   isExecuted = true;
-  const ModelAPI_ObjectUpdatedMessage* aMsg = 
-    dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+  const ModelAPI_ObjectUpdatedMessage* aMsg =
+      dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
   myInitial = aMsg->objects();
   // collect all documents involved into the update
   set<boost::shared_ptr<ModelAPI_Document> > aDocs;
   set<boost::shared_ptr<ModelAPI_Object> >::iterator aFIter = myInitial.begin();
-  for(; aFIter != myInitial.end(); aFIter++) {
+  for (; aFIter != myInitial.end(); aFIter++) {
     aDocs.insert((*aFIter)->document());
   }
   // iterate all features of features-documents to update them (including hidden)
   set<boost::shared_ptr<ModelAPI_Document> >::iterator aDIter = aDocs.begin();
-  for(; aDIter != aDocs.end(); aDIter++) {
+  for (; aDIter != aDocs.end(); aDIter++) {
     int aNbFeatures = (*aDIter)->size(ModelAPI_Feature::group(), true);
-    for(int aFIndex = 0; aFIndex < aNbFeatures; aFIndex++) {
-      FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>
-        ((*aDIter)->object(ModelAPI_Feature::group(), aFIndex, true));
+    for (int aFIndex = 0; aFIndex < aNbFeatures; aFIndex++) {
+      FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(
+          (*aDIter)->object(ModelAPI_Feature::group(), aFIndex, true));
       if (aFeature)
         updateFeature(aFeature);
     }
@@ -63,25 +64,25 @@ bool Model_Update::updateFeature(FeaturePtr theFeature)
     return myUpdated[theFeature];
   // check all features this feature depended on (recursive call of updateFeature)
   bool aMustbeUpdated = myInitial.find(theFeature) != myInitial.end();
-  if (theFeature) { // only real feature contains references to other objects
+  if (theFeature) {  // only real feature contains references to other objects
     // references
-    list<boost::shared_ptr<ModelAPI_Attribute> > aRefs = 
-      theFeature->data()->attributes(ModelAPI_AttributeReference::type());
+    list<boost::shared_ptr<ModelAPI_Attribute> > aRefs = theFeature->data()->attributes(
+        ModelAPI_AttributeReference::type());
     list<boost::shared_ptr<ModelAPI_Attribute> >::iterator aRefsIter = aRefs.begin();
-    for(; aRefsIter != aRefs.end(); aRefsIter++) {
-      boost::shared_ptr<ModelAPI_Object> aSub =
-        boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(*aRefsIter)->value();
+    for (; aRefsIter != aRefs.end(); aRefsIter++) {
+      boost::shared_ptr<ModelAPI_Object> aSub = boost::dynamic_pointer_cast<
+          ModelAPI_AttributeReference>(*aRefsIter)->value();
       if (updateObject(aSub)) {
         aMustbeUpdated = true;
       }
     }
     // lists of references
     aRefs = theFeature->data()->attributes(ModelAPI_AttributeRefList::type());
-    for(aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {
-      list<ObjectPtr> aListRef = 
-        boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*aRefsIter)->list();
+    for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {
+      list<ObjectPtr> aListRef = boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*aRefsIter)
+          ->list();
       list<ObjectPtr>::iterator aListIter = aListRef.begin();
-      for(; aListIter != aListRef.end(); aListIter++) {
+      for (; aListIter != aListRef.end(); aListIter++) {
         boost::shared_ptr<ModelAPI_Object> aSub = *aListIter;
         if (updateObject(aSub)) {
           aMustbeUpdated = true;
@@ -95,17 +96,17 @@ bool Model_Update::updateFeature(FeaturePtr theFeature)
       static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
       const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
       std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
-      for(; aRIter != aResults.cend(); aRIter++) {
+      for (; aRIter != aResults.cend(); aRIter++) {
         boost::shared_ptr<ModelAPI_Result> aRes = *aRIter;
         myUpdated[aRes] = true;
         ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP);
       }
       // to redisplay "presentable" feature (for ex. distance constraint)
       ModelAPI_EventCreator::get()->sendUpdated(theFeature, EVENT_DISP);
-    } else { // returns also true is results were updated: for sketch that refers to sub-features but results of sub-features were changed
+    } else {  // returns also true is results were updated: for sketch that refers to sub-features but results of sub-features were changed
       const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
       std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
-      for(; aRIter != aResults.cend(); aRIter++) {
+      for (; aRIter != aResults.cend(); aRIter++) {
         if (myInitial.find(*aRIter) != myInitial.end()) {
           aMustbeUpdated = true;
           break;
@@ -119,15 +120,15 @@ bool Model_Update::updateFeature(FeaturePtr theFeature)
 
 bool Model_Update::updateObject(boost::shared_ptr<ModelAPI_Object> theObject)
 {
-  if (!theObject) 
+  if (!theObject)
     return false;
   FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
-  if (aFeature) { // for feature just call update Feature
+  if (aFeature) {  // for feature just call update Feature
     return updateFeature(aFeature);
   }
   // check general object, possible just a result
   if (myUpdated.find(theObject) != myUpdated.end())
-    return myUpdated[theObject]; // already processed
+    return myUpdated[theObject];  // already processed
   // check the feature of this object must be executed
   ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
   if (aResult) {
@@ -138,5 +139,5 @@ bool Model_Update::updateObject(boost::shared_ptr<ModelAPI_Object> theObject)
   }
   if (myInitial.find(theObject) != myInitial.end())
     return true;
-  return false; // nothing is known
+  return false;  // nothing is known
 }
index 803dd6056f03bcfdd5520c0c7de8d7d4baaf4d00..ee3efc79cd7387122cc2face214637606266d4eb 100644 (file)
@@ -26,14 +26,14 @@ class Model_Update : public Events_Listener
   std::map<boost::shared_ptr<ModelAPI_Object>, bool> myUpdated;
   ///< to know that all next updates are caused by this execution
   bool isExecuted;
-public:
+ public:
   /// Is called only once, on startup of the application
   Model_Update();
 
   /// Processes the feature argument update: executes the results
   MODEL_EXPORT virtual void processEvent(const Events_Message* theMessage);
 
-protected:
+ protected:
   /// Recoursively checks and updates the feature if needed (calls the execute method)
   /// Returns true if feature was updated.
   bool updateFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
index bda76e29cc0695bf4d90acfbd201439bef9bbb71..90a281c865c517afa79d05579ef150dd5a93e2e2 100644 (file)
@@ -8,8 +8,8 @@
 #include <ModelAPI_Feature.h>
 #include <Events_Error.h>
 
-void Model_ValidatorsFactory::registerValidator(
-  const std::string& theID, ModelAPI_Validator* theValidator)
+void Model_ValidatorsFactory::registerValidator(const std::string& theID,
+                                                ModelAPI_Validator* theValidator)
 {
   if (myIDs.find(theID) != myIDs.end()) {
     Events_Error::send(std::string("Validator ") + theID + " is already registered");
@@ -18,8 +18,8 @@ void Model_ValidatorsFactory::registerValidator(
   }
 }
 
-void Model_ValidatorsFactory::assignValidator(
-  const std::string& theID, const std::string& theFeatureID)
+void Model_ValidatorsFactory::assignValidator(const std::string& theID,
+                                              const std::string& theFeatureID)
 {
   if (myFeatures.find(theFeatureID) == myFeatures.end()) {
     myFeatures[theFeatureID] = std::set<std::string>();
@@ -27,13 +27,14 @@ void Model_ValidatorsFactory::assignValidator(
   myFeatures[theFeatureID].insert(theID);
 }
 
-void Model_ValidatorsFactory::assignValidator(const std::string& theID, 
-  const std::string& theFeatureID, const std::string& theAttrID, 
-  const std::list<std::string>& theArguments)
+void Model_ValidatorsFactory::assignValidator(const std::string& theID,
+                                              const std::string& theFeatureID,
+                                              const std::string& theAttrID,
+                                              const std::list<std::string>& theArguments)
 {
   // create feature-structures if not exist
-  std::map<std::string, std::map<std::string, AttrValidators> >::iterator aFeature = 
-    myAttrs.find(theFeatureID);
+  std::map<std::string, std::map<std::string, AttrValidators> >::iterator aFeature = myAttrs.find(
+      theFeatureID);
   if (aFeature == myAttrs.end()) {
     myAttrs[theFeatureID] = std::map<std::string, AttrValidators>();
     aFeature = myAttrs.find(theFeatureID);
@@ -44,17 +45,17 @@ void Model_ValidatorsFactory::assignValidator(const std::string& theID,
     aFeature->second[theAttrID] = AttrValidators();
   }
   aFeature->second[theAttrID].insert(
-    std::pair<std::string, std::list<std::string> >(theID, theArguments));
+      std::pair<std::string, std::list<std::string> >(theID, theArguments));
 }
 
-void Model_ValidatorsFactory::validators(
-  const std::string& theFeatureID, std::list<ModelAPI_Validator*>& theResult ) const
+void Model_ValidatorsFactory::validators(const std::string& theFeatureID,
+                                         std::list<ModelAPI_Validator*>& theResult) const
 {
-  std::map<std::string, std::set<std::string> >::const_iterator aFeature =
-    myFeatures.find(theFeatureID);
+  std::map<std::string, std::set<std::string> >::const_iterator aFeature = myFeatures.find(
+      theFeatureID);
   if (aFeature != myFeatures.cend()) {
     std::set<std::string>::const_iterator aValIter = aFeature->second.cbegin();
-    for(; aValIter != aFeature->second.cend(); aValIter++) {
+    for (; aValIter != aFeature->second.cend(); aValIter++) {
       std::map<std::string, ModelAPI_Validator*>::const_iterator aFound = myIDs.find(*aValIter);
       if (aFound == myIDs.end()) {
         Events_Error::send(std::string("Validator ") + *aValIter + " was not registered");
@@ -65,20 +66,20 @@ void Model_ValidatorsFactory::validators(
   }
 }
 
-void Model_ValidatorsFactory::validators(const std::string& theFeatureID, 
-  const std::string& theAttrID, std::list<ModelAPI_Validator*>& theValidators, 
-  std::list<std::list<std::string> >& theArguments) const
+void Model_ValidatorsFactory::validators(const std::string& theFeatureID,
+                                         const std::string& theAttrID,
+                                         std::list<ModelAPI_Validator*>& theValidators,
+                                         std::list<std::list<std::string> >& theArguments) const
 {
-  std::map<std::string, std::map<std::string, AttrValidators> >::const_iterator aFeature =
-    myAttrs.find(theFeatureID);
+  std::map<std::string, std::map<std::string, AttrValidators> >::const_iterator aFeature = myAttrs
+      .find(theFeatureID);
   if (aFeature != myAttrs.cend()) {
-    std::map<std::string, AttrValidators>::const_iterator anAttr =
-      aFeature->second.find(theAttrID);
+    std::map<std::string, AttrValidators>::const_iterator anAttr = aFeature->second.find(theAttrID);
     if (anAttr != aFeature->second.end()) {
       AttrValidators::const_iterator aValIter = anAttr->second.cbegin();
-      for(; aValIter != anAttr->second.cend(); aValIter++) {
-        std::map<std::string, ModelAPI_Validator*>::const_iterator aFound = 
-          myIDs.find(aValIter->first);
+      for (; aValIter != anAttr->second.cend(); aValIter++) {
+        std::map<std::string, ModelAPI_Validator*>::const_iterator aFound = myIDs.find(
+            aValIter->first);
         if (aFound == myIDs.end()) {
           Events_Error::send(std::string("Validator ") + aValIter->first + " was not registered");
         } else {
@@ -90,7 +91,8 @@ void Model_ValidatorsFactory::validators(const std::string& theFeatureID,
   }
 }
 
-Model_ValidatorsFactory::Model_ValidatorsFactory() : ModelAPI_ValidatorsFactory()
+Model_ValidatorsFactory::Model_ValidatorsFactory()
+    : ModelAPI_ValidatorsFactory()
 {
   registerValidator("Model_ResultPointValidator", new Model_ResultPointValidator);
   registerValidator("Model_ResultLineValidator", new Model_ResultLineValidator);
@@ -98,7 +100,6 @@ Model_ValidatorsFactory::Model_ValidatorsFactory() : ModelAPI_ValidatorsFactory(
   registerValidator("Model_FeatureValidator", new Model_FeatureValidator);
 }
 
-
 const ModelAPI_Validator* Model_ValidatorsFactory::validator(const std::string& theID) const
 {
   std::map<std::string, ModelAPI_Validator*>::const_iterator aIt = myIDs.find(theID);
index f748c42ca7163560919e3899c79cc04b5149b1f0..0be3d21c87b12163468bc68f613e19d781144172 100644 (file)
  * All the needed information is provided to the validator as an argument,
  * this allows to work with them independently from the feature specific object.
  */
-class Model_ValidatorsFactory: public ModelAPI_ValidatorsFactory
+class Model_ValidatorsFactory : public ModelAPI_ValidatorsFactory
 {
-private:
-  std::map<std::string, ModelAPI_Validator*> myIDs; ///< map from ID to registered validator
+ private:
+  std::map<std::string, ModelAPI_Validator*> myIDs;  ///< map from ID to registered validator
   /// validators IDs by feature ID
-  std::map<std::string, std::set<std::string> > myFeatures; 
+  std::map<std::string, std::set<std::string> > myFeatures;
   /// set of pairs: validators IDs, list of arguments
   typedef std::set<std::pair<std::string, std::list<std::string> > > AttrValidators;
   /// validators IDs and arguments by feature and attribute IDs
   std::map<std::string, std::map<std::string, AttrValidators> > myAttrs;
-public:
+ public:
   /// Registers the instance of the validator by the ID
-  MODEL_EXPORT virtual void registerValidator(
-    const std::string& theID, ModelAPI_Validator* theValidator);
+  MODEL_EXPORT virtual void registerValidator(const std::string& theID,
+                                              ModelAPI_Validator* theValidator);
 
   /// Assigns validator to the feature
-  MODEL_EXPORT virtual void assignValidator(
-    const std::string& theID, const std::string& theFeatureID);
+  MODEL_EXPORT virtual void assignValidator(const std::string& theID,
+                                            const std::string& theFeatureID);
 
   /// Assigns validator to the attribute of the feature
-  MODEL_EXPORT virtual void assignValidator(const std::string& theID, 
-    const std::string& theFeatureID, const std::string& theAttrID,
-    const std::list<std::string>& theArguments);
+  MODEL_EXPORT virtual void assignValidator(const std::string& theID,
+                                            const std::string& theFeatureID,
+                                            const std::string& theAttrID,
+                                            const std::list<std::string>& theArguments);
 
   /// Provides a validator for the feature, returns NULL if no validator
-  MODEL_EXPORT virtual void validators(const std::string& theFeatureID, 
-    std::list<ModelAPI_Validator*>& theResult) const;
+  MODEL_EXPORT virtual void validators(const std::string& theFeatureID,
+                                       std::list<ModelAPI_Validator*>& theResult) const;
   /// Provides a validator for the attribute, returns NULL if no validator
-  MODEL_EXPORT virtual void validators(
-    const std::string& theFeatureID, const std::string& theAttrID,
-    std::list<ModelAPI_Validator*>& theValidators, 
-    std::list<std::list<std::string> >& theArguments) const;
+  MODEL_EXPORT virtual void validators(const std::string& theFeatureID,
+                                       const std::string& theAttrID,
+                                       std::list<ModelAPI_Validator*>& theValidators,
+                                       std::list<std::list<std::string> >& theArguments) const;
 
   /// Returns registered validator by its Id
   virtual const ModelAPI_Validator* validator(const std::string& theID) const;
@@ -63,7 +64,7 @@ public:
   //MODEL_EXPORT virtual bool validate(
   //  const boost::shared_ptr<ModelAPI_Feature>& theFeature, const std::string& theAttrID) const;
 
-protected:
+ protected:
   /// Get instance from PluginManager
   Model_ValidatorsFactory();
 
index 580f443dbb1e4138eddef31f5615ade924873271..8e2051ac253773a0b824ffb666e12a9ca6e8a16f 100644 (file)
@@ -19,41 +19,64 @@ class ModelAPI_Attribute
 {
   ///< needed here to emit signal that feature changed on change of the attribute
   boost::shared_ptr<ModelAPI_Object> myObject;
-protected: // accessible from the attributes
+ protected:
+  // accessible from the attributes
   bool myIsInitialized;
   bool myIsArgument;
-public:
-  
+ public:
+
   /// Returns the type of this class of attributes, not static method
   MODELAPI_EXPORT virtual std::string attributeType() = 0;
 
   /// To virtually destroy the fields of successors
-  MODELAPI_EXPORT virtual ~ModelAPI_Attribute() {}
+  MODELAPI_EXPORT virtual ~ModelAPI_Attribute()
+  {
+  }
 
   /// Sets the owner of this attribute
   MODELAPI_EXPORT void setObject(const boost::shared_ptr<ModelAPI_Object>& theObject)
-    {myObject = theObject;}
+  {
+    myObject = theObject;
+  }
 
   /// Returns the owner of this attribute
   MODELAPI_EXPORT const boost::shared_ptr<ModelAPI_Object>& owner()
-  {return myObject;}
+  {
+    return myObject;
+  }
 
   /// Returns true if attribute was  initialized by some value
-  MODELAPI_EXPORT bool isInitialized() {return myIsInitialized;}
+  MODELAPI_EXPORT bool isInitialized()
+  {
+    return myIsInitialized;
+  }
 
   /// Makes attribute initialized
-  MODELAPI_EXPORT void setInitialized() {myIsInitialized = true;}
+  MODELAPI_EXPORT void setInitialized()
+  {
+    myIsInitialized = true;
+  }
 
   /// Set this attribute is argument for result (change of this attribute requires update of result).
   /// By default it is true.
-  MODELAPI_EXPORT void setIsArgument(const bool theFlag) {myIsArgument = theFlag;}
+  MODELAPI_EXPORT void setIsArgument(const bool theFlag)
+  {
+    myIsArgument = theFlag;
+  }
 
   /// Returns true if attribute causes the result change
-  MODELAPI_EXPORT bool isArgument() {return myIsArgument;}
+  MODELAPI_EXPORT bool isArgument()
+  {
+    return myIsArgument;
+  }
 
-protected:
+ protected:
   /// Objects are created for features automatically
-  ModelAPI_Attribute() {myIsInitialized = false; myIsArgument = true;}
+  ModelAPI_Attribute()
+  {
+    myIsInitialized = false;
+    myIsArgument = true;
+  }
 
 };
 
index 8c5a0af8e2f95cd22591ebb880872cd9987918b9..2612e0eed431e900461d31477d3823bb727dfe8b 100644 (file)
@@ -14,7 +14,7 @@
 
 class ModelAPI_AttributeBoolean : public ModelAPI_Attribute
 {
-public:
+ public:
   /// Defines the double value
   MODELAPI_EXPORT virtual void setValue(bool theValue) = 0;
 
@@ -22,17 +22,27 @@ public:
   MODELAPI_EXPORT virtual bool value() = 0;
 
   /// Returns the type of this class of attributes
-  MODELAPI_EXPORT static std::string type() {return "Boolean";}
+  MODELAPI_EXPORT static std::string type()
+  {
+    return "Boolean";
+  }
 
   /// Returns the type of this class of attributes, not static method
-  MODELAPI_EXPORT virtual std::string attributeType() {return type();}
+  MODELAPI_EXPORT virtual std::string attributeType()
+  {
+    return type();
+  }
 
   /// To virtually destroy the fields of successors
-  MODELAPI_EXPORT virtual ~ModelAPI_AttributeBoolean() {}
+  MODELAPI_EXPORT virtual ~ModelAPI_AttributeBoolean()
+  {
+  }
 
-protected:
+ protected:
   /// Objects are created for features automatically
-  MODELAPI_EXPORT ModelAPI_AttributeBoolean() {}
+  MODELAPI_EXPORT ModelAPI_AttributeBoolean()
+  {
+  }
 };
 
 #endif
index b7f312bb1bfb602493818ad0aa1b7b07881ca732..7ee1ff1ca0477a790475474e05c6aea5bd620d54 100644 (file)
@@ -15,7 +15,7 @@
 
 class ModelAPI_AttributeDocRef : public ModelAPI_Attribute
 {
-public:
+ public:
   /// Defines the document referenced from this attribute
   MODELAPI_EXPORT virtual void setValue(boost::shared_ptr<ModelAPI_Document> theDoc) = 0;
 
@@ -23,18 +23,27 @@ public:
   MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Document> value() = 0;
 
   /// Returns the type of this class of attributes
-  MODELAPI_EXPORT static std::string type() {return "DocRef";}
+  MODELAPI_EXPORT static std::string type()
+  {
+    return "DocRef";
+  }
 
   /// Returns the type of this class of attributes, not static method
-  MODELAPI_EXPORT virtual std::string attributeType() {return type();}
+  MODELAPI_EXPORT virtual std::string attributeType()
+  {
+    return type();
+  }
 
   /// To virtually destroy the fields of successors
-  MODELAPI_EXPORT virtual ~ModelAPI_AttributeDocRef() {}
+  MODELAPI_EXPORT virtual ~ModelAPI_AttributeDocRef()
+  {
+  }
 
-protected:
+ protected:
   /// Objects are created for features automatically
   MODELAPI_EXPORT ModelAPI_AttributeDocRef()
-  {}
+  {
+  }
 };
 
 #endif
index 163ebefe96959ba8c95e9800a836a9c008dad668..e61dfa060292bcbb680f32e0d799e0cfc6c83b25 100644 (file)
@@ -14,7 +14,7 @@
 
 class ModelAPI_AttributeDouble : public ModelAPI_Attribute
 {
-public:
+ public:
   /// Defines the double value
   MODELAPI_EXPORT virtual void setValue(const double theValue) = 0;
 
@@ -22,18 +22,27 @@ public:
   MODELAPI_EXPORT virtual double value() = 0;
 
   /// Returns the type of this class of attributes
-  MODELAPI_EXPORT static std::string type() {return "Double";}
+  MODELAPI_EXPORT static std::string type()
+  {
+    return "Double";
+  }
 
   /// Returns the type of this class of attributes, not static method
-  MODELAPI_EXPORT virtual std::string attributeType() {return type();}
+  MODELAPI_EXPORT virtual std::string attributeType()
+  {
+    return type();
+  }
 
   /// To virtually destroy the fields of successors
-  MODELAPI_EXPORT virtual ~ModelAPI_AttributeDouble() {}
+  MODELAPI_EXPORT virtual ~ModelAPI_AttributeDouble()
+  {
+  }
 
-protected:
+ protected:
   /// Objects are created for features automatically
   MODELAPI_EXPORT ModelAPI_AttributeDouble()
-  {}
+  {
+  }
 };
 
 //! Pointer on double attribute
index be0bf6e1ec836a85f45af8df75c904ecf6179488..dc862f3a63d37bda21f87d2fb6fcd6f1ecedfd24 100644 (file)
@@ -16,7 +16,7 @@
 
 class ModelAPI_AttributeRefAttr : public ModelAPI_Attribute
 {
-public:
+ public:
   /// Returns true if this attribute references to a object (not to the attribute)
   MODELAPI_EXPORT virtual bool isObject() = 0;
 
@@ -33,18 +33,27 @@ public:
   MODELAPI_EXPORT virtual ObjectPtr object() = 0;
 
   /// Returns the type of this class of attributes
-  MODELAPI_EXPORT static std::string type() {return "RefAttr";}
+  MODELAPI_EXPORT static std::string type()
+  {
+    return "RefAttr";
+  }
 
   /// Returns the type of this class of attributes, not static method
-  MODELAPI_EXPORT virtual std::string attributeType() {return type();}
+  MODELAPI_EXPORT virtual std::string attributeType()
+  {
+    return type();
+  }
 
   /// To virtually destroy the fields of successors
-  MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefAttr() {}
+  MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefAttr()
+  {
+  }
 
-protected:
+ protected:
   /// Objects are created for features automatically
   MODELAPI_EXPORT ModelAPI_AttributeRefAttr()
-  {}
+  {
+  }
 };
 
 #endif
index d9948dd04d27a15e7d74032de20250fbbfbbe4b5..b8b5c700ba1346b80213fa587d70c68c54692408 100644 (file)
 
 class ModelAPI_AttributeRefList : public ModelAPI_Attribute
 {
-public:
+ public:
   /// Returns the type of this class of attributes
-  MODELAPI_EXPORT static std::string type() {return "RefList";}
+  MODELAPI_EXPORT static std::string type()
+  {
+    return "RefList";
+  }
 
   /// Returns the type of this class of attributes, not static method
-  MODELAPI_EXPORT virtual std::string attributeType() {return type();}
+  MODELAPI_EXPORT virtual std::string attributeType()
+  {
+    return type();
+  }
 
   /// Appends the feature to the end of a list
   MODELAPI_EXPORT virtual void append(ObjectPtr theObject) = 0;
@@ -35,10 +41,11 @@ public:
   /// Returns the list of features
   MODELAPI_EXPORT virtual std::list<ObjectPtr> list() = 0;
 
-protected:
+ protected:
   /// Objects are created for features automatically
   MODELAPI_EXPORT ModelAPI_AttributeRefList()
-  {}
+  {
+  }
 };
 
 #endif
index dd13cad06aa84d4c95a0e4feb16433abb3620c5b..14d63ae32551893516dcd42ab8b0b3df4faf0fc9 100644 (file)
@@ -15,7 +15,7 @@
 
 class ModelAPI_AttributeReference : public ModelAPI_Attribute
 {
-public:
+ public:
   /// Defines the object referenced from this attribute
   MODELAPI_EXPORT virtual void setValue(ObjectPtr theObject) = 0;
 
@@ -23,18 +23,27 @@ public:
   MODELAPI_EXPORT virtual ObjectPtr value() = 0;
 
   /// Returns the type of this class of attributes
-  MODELAPI_EXPORT static std::string type() {return "Reference";}
+  MODELAPI_EXPORT static std::string type()
+  {
+    return "Reference";
+  }
 
   /// Returns the type of this class of attributes, not static method
-  MODELAPI_EXPORT virtual std::string attributeType() {return type();}
+  MODELAPI_EXPORT virtual std::string attributeType()
+  {
+    return type();
+  }
 
   /// To virtually destroy the fields of successors
-  MODELAPI_EXPORT virtual ~ModelAPI_AttributeReference() {}
+  MODELAPI_EXPORT virtual ~ModelAPI_AttributeReference()
+  {
+  }
 
-protected:
+ protected:
   /// Objects are created for features automatically
   MODELAPI_EXPORT ModelAPI_AttributeReference()
-  {}
+  {
+  }
 };
 
 #endif
index b40c145e2b9519dba1b9df5426eaac375da0bad0..15b8514ec9302c3fa6337af06c7fda16eadbe0d1 100644 (file)
@@ -9,12 +9,10 @@
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Validator.h>
 
-
-class ModelAPI_AttributeValidator: public ModelAPI_Validator
+class ModelAPI_AttributeValidator : public ModelAPI_Validator
 {
-public:
-  virtual bool isValid(const FeaturePtr& theFeature, 
-                       const std::list<std::string>& theArguments,
+ public:
+  virtual bool isValid(const FeaturePtr& theFeature, const std::list<std::string>& theArguments,
                        const ObjectPtr& theObject) const = 0;
 };
 
index 0b69acb362b0272f81744bd8b43d49312f71c348..d07d24052e61211215b3452b5e046a1299f04af2 100644 (file)
@@ -28,7 +28,7 @@ class GeomAPI_Shape;
 
 class MODELAPI_EXPORT ModelAPI_Data
 {
-public:
+ public:
 
   /// Returns the name of the feature visible by the user in the object browser
   virtual std::string name() = 0;
@@ -55,7 +55,7 @@ public:
   /// Returns all attributes ofthe feature of the given type
   /// or all attributes if "theType" is empty
   virtual std::list<boost::shared_ptr<ModelAPI_Attribute> >
-    attributes(const std::string& theType) = 0;
+  attributes(const std::string& theType) = 0;
   /// Identifier by the id (not fast, iteration by map)
   /// \param theAttr attribute already created in this data
   virtual const std::string& id(const boost::shared_ptr<ModelAPI_Attribute>& theAttr) = 0;
@@ -75,15 +75,17 @@ public:
   virtual void sendAttributeUpdated(ModelAPI_Attribute* theAttr) = 0;
 
   /// To virtually destroy the fields of successors
-  virtual ~ModelAPI_Data() {}
+  virtual ~ModelAPI_Data()
+  {
+  }
 
-protected:
+ protected:
   /// Objects are created for features automatically
   ModelAPI_Data()
-  {}
+  {
+  }
 };
 
 typedef boost::shared_ptr<ModelAPI_Data> DataPtr;
 
-
 #endif
index 5e0d2809143dbff673a2b34838d2197dcbb7ab5a..5b1cfb0af115f6acf8a36c07a667106188f08b1c 100644 (file)
@@ -26,7 +26,7 @@ class ModelAPI_Data;
  */
 class ModelAPI_Document
 {
-public:
+ public:
   //! Loads the OCAF document from the file.
   //! \param theFileName full name of the file to load
   //! \param theStudyID identifier of the SALOME study to associate with loaded file
@@ -69,8 +69,8 @@ public:
   virtual void removeFeature(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
 
   ///! Adds a new sub-document by the identifier, or returns existing one if it is already exist
-  virtual boost::shared_ptr<ModelAPI_Document> 
-    subDocument(std::string theDocID) = 0;
+  virtual boost::shared_ptr<ModelAPI_Document>
+  subDocument(std::string theDocID) = 0;
 
   ///! Returns the id of the document
   virtual const std::string& id() const = 0;
@@ -79,39 +79,40 @@ public:
   //! \param theGroupID group that contains an object
   //! \param theIndex zero-based index of feature in the group
   //! \param theHidden if it is true, it counts also the features that are not in tree
-  virtual boost::shared_ptr<ModelAPI_Object> 
-    object(const std::string& theGroupID, const int theIndex, const bool theHidden = false) = 0;
+  virtual boost::shared_ptr<ModelAPI_Object>
+  object(const std::string& theGroupID, const int theIndex, const bool theHidden = false) = 0;
 
   //! Returns the number of objects in the group of objects
   //! If theHidden is true, it counts also the features that are not in tree
   virtual int size(const std::string& theGroupID, const bool theHidden = false) = 0;
 
   /// To virtually destroy the fields of successors
-  virtual ~ModelAPI_Document() {}
+  virtual ~ModelAPI_Document()
+  {
+  }
 
   /// Creates a construction cresults
   virtual boost::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
-    const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+      const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
   /// Creates a body results
   virtual boost::shared_ptr<ModelAPI_ResultBody> createBody(
-    const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+      const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
   /// Creates a part results
   virtual boost::shared_ptr<ModelAPI_ResultPart> createPart(
-    const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+      const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
 
   //! Returns a feature by result (owner of result)
   virtual boost::shared_ptr<ModelAPI_Feature> feature(
-    const boost::shared_ptr<ModelAPI_Result>& theResult) = 0;
+      const boost::shared_ptr<ModelAPI_Result>& theResult) = 0;
 
-protected:
+ protected:
   /// Only for SWIG wrapping it is here
   MODELAPI_EXPORT ModelAPI_Document()
-  {}
+  {
+  }
 };
 
-
 //! Pointer on document object
 typedef boost::shared_ptr<ModelAPI_Document> DocumentPtr;
 
-
 #endif
index 965a695afdaa92b17dd99bf8c5fa9c51db26749c..89b1fd5b941773551d7a8e2782771770dc12cf27 100644 (file)
@@ -29,12 +29,15 @@ static const char * EVENT_OBJECT_TO_REDISPLAY = "ObjectsToRedisplay";
 static const char * EVENT_OPERATION_LAUNCHED = "OperationLaunched";
 
 /// Message that feature was changed (used for Object Browser update): moved, updated and deleted
-class ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup {
-protected:
+class ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup
+{
+ protected:
   ModelAPI_ObjectUpdatedMessage(const Events_ID theID, const void* theSender = 0)
-    : Events_MessageGroup(theID, theSender) {}
+      : Events_MessageGroup(theID, theSender)
+  {
+  }
 
-public:
+ public:
   /// Returns the feature that has been updated
   virtual std::set<ObjectPtr> objects() const = 0;
 
@@ -46,17 +49,20 @@ public:
 };
 
 /// Message that feature was deleted (used for Object Browser update)
-class ModelAPI_ObjectDeletedMessage : public Events_MessageGroup {
-protected:
+class ModelAPI_ObjectDeletedMessage : public Events_MessageGroup
+{
+ protected:
   ModelAPI_ObjectDeletedMessage(const Events_ID theID, const void* theSender = 0)
-    : Events_MessageGroup(theID, theSender) {}
+      : Events_MessageGroup(theID, theSender)
+  {
+  }
 
-public:
+ public:
   /// Returns the feature that has been updated
   virtual boost::shared_ptr<ModelAPI_Document> document() const = 0;
 
   /// Returns the group where the feature was deleted
-  virtual const std::set<std::string >& groups() const = 0;
+  virtual const std::set<std::string>& groups() const = 0;
 
   virtual Events_MessageGroup* newEmpty() = 0;
 
@@ -66,18 +72,19 @@ public:
 };
 
 /// Allows to create ModelAPI messages
-class MODELAPI_EXPORT ModelAPI_EventCreator {
-public:
+class MODELAPI_EXPORT ModelAPI_EventCreator
+{
+ public:
   /// creates created, updated or moved messages and sends to the loop
   virtual void sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent,
                            const bool isGroupped = true) const = 0;
   /// creates deleted message and sends to the loop
-  virtual void sendDeleted(
-    const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup) const = 0;
+  virtual void sendDeleted(const boost::shared_ptr<ModelAPI_Document>& theDoc,
+                           const std::string& theGroup) const = 0;
 
   /// returns the creator instance
   static const ModelAPI_EventCreator* get();
-  
+
   /// sets the creator instance
   static void set(const ModelAPI_EventCreator* theCreator);
 };
index 028f17385affbd04b928466274a9ee08cb5d904b..07079fe14f6d3011766bdcd506abd83045cf9d78 100644 (file)
@@ -8,25 +8,25 @@
 #include <ModelAPI_Document.h>
 #include <Events_Loop.h>
 
-const std::list<boost::shared_ptr<ModelAPI_Result> >& ModelAPI_Feature::results() 
+const std::list<boost::shared_ptr<ModelAPI_Result> >& ModelAPI_Feature::results()
 {
   return myResults;
 }
 
-boost::shared_ptr<ModelAPI_Result> ModelAPI_Feature::firstResult() 
+boost::shared_ptr<ModelAPI_Result> ModelAPI_Feature::firstResult()
 {
   return myResults.empty() ? boost::shared_ptr<ModelAPI_Result>() : *(myResults.begin());
 }
 
-void ModelAPI_Feature::setResult(const boost::shared_ptr<ModelAPI_Result>& theResult) 
+void ModelAPI_Feature::setResult(const boost::shared_ptr<ModelAPI_Result>& theResult)
 {
-  if (firstResult() == theResult) { // just updated
+  if (firstResult() == theResult) {  // just updated
     static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
     ModelAPI_EventCreator::get()->sendUpdated(theResult, anEvent);
     return;
   }
   // created
-  while(!myResults.empty()) { // remove one by one with messages
+  while (!myResults.empty()) {  // remove one by one with messages
     boost::shared_ptr<ModelAPI_Result> aRes = *(myResults.begin());
     myResults.erase(myResults.begin());
     ModelAPI_EventCreator::get()->sendDeleted(aRes->document(), aRes->groupName());
@@ -38,20 +38,20 @@ void ModelAPI_Feature::setResult(const boost::shared_ptr<ModelAPI_Result>& theRe
   Events_Loop::loop()->flush(anEvent);
 }
 
-void ModelAPI_Feature::setResult(
-  const boost::shared_ptr<ModelAPI_Result>& theResult, const int theIndex) 
+void ModelAPI_Feature::setResult(const boost::shared_ptr<ModelAPI_Result>& theResult,
+                                 const int theIndex)
 {
   std::list<boost::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
-  for(int anIndex = 0; anIndex < theIndex; anIndex++) {
+  for (int anIndex = 0; anIndex < theIndex; anIndex++) {
     aResIter++;
   }
-  if (aResIter == myResults.end()) { // append
+  if (aResIter == myResults.end()) {  // append
     myResults.push_back(theResult);
     static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
     ModelAPI_EventCreator::get()->sendUpdated(theResult, anEvent);
     // Create event for first Feature, send it to make "created" earlier than "updated"
     Events_Loop::loop()->flush(anEvent);
-  } else { // update
+  } else {  // update
     *aResIter = theResult;
     static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
     ModelAPI_EventCreator::get()->sendUpdated(theResult, anEvent);
@@ -65,7 +65,7 @@ boost::shared_ptr<ModelAPI_Document> ModelAPI_Feature::documentToAdd()
 
 ModelAPI_Feature::~ModelAPI_Feature()
 {
-  while(!myResults.empty()) { // remove one by one with messages
+  while (!myResults.empty()) {  // remove one by one with messages
     boost::shared_ptr<ModelAPI_Result> aRes = *(myResults.begin());
     myResults.erase(myResults.begin());
     ModelAPI_EventCreator::get()->sendDeleted(aRes->document(), aRes->groupName());
index 9f989074b57cccc560b49814218b7ef6d51ee945..5b35b7e508b86c93325bfaa459c1952afcb455de 100644 (file)
@@ -25,16 +25,22 @@ class ModelAPI_Feature : public ModelAPI_Object
 {
   ///< list of current results of this feature
   std::list<boost::shared_ptr<ModelAPI_Result> > myResults;
-public:
+ public:
   /// Returns the unique kind of a feature (like "Point")
   virtual const std::string& getKind() = 0;
 
   /// Returns the group identifier of all features
   static std::string group()
-    {static std::string MY_GROUP = "Features"; return MY_GROUP;}
+  {
+    static std::string MY_GROUP = "Features";
+    return MY_GROUP;
+  }
 
   /// Returns the group identifier of this result
-  virtual std::string groupName() { return group(); }
+  virtual std::string groupName()
+  {
+    return group();
+  }
 
   /// Request for initialization of data model of the feature: adding all attributes
   virtual void initAttributes() = 0;
@@ -49,12 +55,15 @@ public:
   /// sets the alone result
   MODELAPI_EXPORT void setResult(const boost::shared_ptr<ModelAPI_Result>& theResult);
   /// sets the result by index (zero based), results before this must be set before
-  MODELAPI_EXPORT void setResult(
-    const boost::shared_ptr<ModelAPI_Result>& theResult, const int theIndex);
+  MODELAPI_EXPORT void setResult(const boost::shared_ptr<ModelAPI_Result>& theResult,
+                                 const int theIndex);
 
   /// Returns true if this feature must not be created: this is just an action
   /// that is not stored in the features history and data model (like "delete part").
-  virtual bool isAction() {return false;}
+  virtual bool isAction()
+  {
+    return false;
+  }
 
   /// Must return document where the new feature must be added to
   /// By default it is current document
index d2378a0dea994f19820a40caa7be441f374aebc3..7508c7ad3d30eaf9405f6375e5546e0378267c4c 100644 (file)
@@ -8,9 +8,9 @@
 #include "ModelAPI.h"
 #include "ModelAPI_Validator.h"
 
-class ModelAPI_FeatureValidator: public ModelAPI_Validator
+class ModelAPI_FeatureValidator : public ModelAPI_Validator
 {
-public:
+ public:
   /// Returns true if feature and/or attributes are valid
   /// \param theFeature the validated feature
   /// \param theAttr the validated attribute ID, empty string of feature is validated
index d46fb76237c76ba2ca7a5b2c554a54b550e33509..91167b871b71331c26b305d006d64570a62f1ae7 100644 (file)
@@ -23,33 +23,48 @@ class ModelAPI_Document;
  */
 class ModelAPI_Object
 {
-  boost::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
-  boost::shared_ptr<ModelAPI_Document> myDoc; ///< document this feature belongs to
-public:
+  boost::shared_ptr<ModelAPI_Data> myData;  ///< manager of the data model of a feature
+  boost::shared_ptr<ModelAPI_Document> myDoc;  ///< document this feature belongs to
+ public:
   /// By default object is displayed in the object browser.
-  virtual bool isInHistory() {return true;}
+  virtual bool isInHistory()
+  {
+    return true;
+  }
 
   /// Returns the data manager of this object: attributes
-  virtual boost::shared_ptr<ModelAPI_Data> data() {return myData;}
+  virtual boost::shared_ptr<ModelAPI_Data> data()
+  {
+    return myData;
+  }
 
   /// Returns true if object refers to the same data model instance
   virtual bool isSame(const boost::shared_ptr<ModelAPI_Object>& theObject)
-    {return theObject.get() == this;}
+  {
+    return theObject.get() == this;
+  }
 
   /// Returns document this feature belongs to
   virtual boost::shared_ptr<ModelAPI_Document> document()
-    {return myDoc;}
+  {
+    return myDoc;
+  }
 
   /// Returns the group identifier of this object
   virtual std::string groupName() = 0;
 
-protected:
+ protected:
   /// Sets the data manager of an object (document does)
-  virtual void setData(boost::shared_ptr<ModelAPI_Data> theData) 
-    {myData = theData;}
+  virtual void setData(boost::shared_ptr<ModelAPI_Data> theData)
+  {
+    myData = theData;
+  }
 
   /// Sets the data manager of an object (document does)
-  virtual void setDoc(boost::shared_ptr<ModelAPI_Document> theDoc) {myDoc = theDoc;}
+  virtual void setDoc(boost::shared_ptr<ModelAPI_Document> theDoc)
+  {
+    myDoc = theDoc;
+  }
 
   friend class Model_Document;
 };
index 31795c3f15c57590308904dd3a950129bfe5c741..5222b4c7b5edcd23582cdffbd6933428784cb4a7 100644 (file)
@@ -18,16 +18,21 @@ class ModelAPI_Feature;
 
 class MODELAPI_EXPORT ModelAPI_Plugin
 {
-public:
+ public:
   /// Creates the feature object of this plugin by the feature string ID
   virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
 
   /// To virtually destroy the fields of successors
-  virtual ~ModelAPI_Plugin() {}
+  virtual ~ModelAPI_Plugin()
+  {
+  }
 
-protected:
+ protected:
   /// Is needed for python wrapping by swig
-  ModelAPI_Plugin() {};
+  ModelAPI_Plugin()
+  {
+  }
+  ;
 };
 
 #endif
index 72deaba2c695a78614a197126d513a1762cfbb12..2b83d0aedd99c6fb19ead5b0732b222441553099 100644 (file)
@@ -43,30 +43,29 @@ ModelAPI_PluginManager::ModelAPI_PluginManager()
 {
 }
 
-void ModelAPI_PluginManager::setPluginManager(
-  boost::shared_ptr<ModelAPI_PluginManager> theManager)
+void ModelAPI_PluginManager::setPluginManager(boost::shared_ptr<ModelAPI_PluginManager> theManager)
 {
   MY_MANAGER = theManager;
 }
 
 boost::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
 {
-  if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI
+  if (!MY_MANAGER) {  // import Model library that implements this interface of ModelAPI
     Config_ModuleReader::loadLibrary("Model");
   }
   return MY_MANAGER;
 }
 
-const ModelAPI_EventCreator* MY_CREATOR = 0; ///< instance of the events creator, one pre application
+const ModelAPI_EventCreator* MY_CREATOR = 0;  ///< instance of the events creator, one pre application
 
 const ModelAPI_EventCreator* ModelAPI_EventCreator::get()
 {
-  if (!MY_CREATOR) { // import Model library that implements this interface of ModelAPI
+  if (!MY_CREATOR) {  // import Model library that implements this interface of ModelAPI
     Config_ModuleReader::loadLibrary("Model");
   }
   return MY_CREATOR;
 }
-  
+
 void ModelAPI_EventCreator::set(const ModelAPI_EventCreator* theCreator)
 {
   MY_CREATOR = theCreator;
index 355e9814f3fcfec38c28ebae6dd017193990cea3..90a59a9efec0ddee46f688e1bc4da1294211a94c 100644 (file)
@@ -23,7 +23,7 @@ class ModelAPI_ValidatorsFactory;
 
 class MODELAPI_EXPORT ModelAPI_PluginManager
 {
-public:
+ public:
   /// Returns the real implementation (the alone instance per application) of the plugin manager
   static boost::shared_ptr<ModelAPI_PluginManager> get();
 
@@ -45,8 +45,8 @@ public:
   virtual void setCurrentDocument(boost::shared_ptr<ModelAPI_Document> theDoc) = 0;
 
   /// Copies the document to the new one wit hthe given id
-  virtual boost::shared_ptr<ModelAPI_Document> copy(
-    boost::shared_ptr<ModelAPI_Document> theSource, std::string theID) = 0;
+  virtual boost::shared_ptr<ModelAPI_Document> copy(boost::shared_ptr<ModelAPI_Document> theSource,
+                                                    std::string theID) = 0;
 
   /// Returns the validators factory: the only one instance per application
   virtual ModelAPI_ValidatorsFactory* validators() = 0;
@@ -55,9 +55,11 @@ public:
   ModelAPI_PluginManager();
 
   /// To virtually destroy the fields of successors
-  virtual ~ModelAPI_PluginManager() {}
+  virtual ~ModelAPI_PluginManager()
+  {
+  }
 
-protected:
+ protected:
   /// Creates the feature object using plugins functionality
   virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
 
index 4a3adbd763b87dc23f123761af6cc1bdb587c459..af9e7ce87edba6ae1b672dc98f7c7cffe056d77b 100644 (file)
@@ -17,7 +17,7 @@ class ModelAPI_Feature;
  */
 class ModelAPI_Result : public ModelAPI_Object
 {
-public:
+ public:
   /// Returns the source feature of this result
   //virtual boost::shared_ptr<ModelAPI_Feature> owner() = 0;
 
index cd484031a96601ec8b65e6c728787879582000f7..c2eff7efcfa22b68d049d9b235045d75860b7a4f 100644 (file)
  */
 class ModelAPI_ResultBody : public ModelAPI_Result
 {
-public:
+ public:
   /// Returns the group identifier of this result
-  virtual std::string groupName() {
+  virtual std::string groupName()
+  {
     return group();
   }
 
   /// Returns the group identifier of this result
   static std::string group()
-  {static std::string MY_GROUP = "Bodies"; return MY_GROUP;}
+  {
+    static std::string MY_GROUP = "Bodies";
+    return MY_GROUP;
+  }
 
   /// Stores the shape (called by the execution method).
   virtual void store(const boost::shared_ptr<GeomAPI_Shape>& theShape) = 0;
@@ -36,13 +40,16 @@ public:
   virtual boost::shared_ptr<GeomAPI_Shape> shape() = 0;
 
   /// To virtually destroy the fields of successors
-  virtual ~ModelAPI_ResultBody() {}
+  virtual ~ModelAPI_ResultBody()
+  {
+  }
 
-protected:
+ protected:
   /// Use plugin manager for features creation: this method is 
   /// defined here only for SWIG-wrapping
   ModelAPI_ResultBody()
-  {}
+  {
+  }
 };
 
 //! Pointer on feature object
index 0a7cf17b6ed39458ce88df92e8b2502e590e5b2d..972b3a96512a53c358fbafbf5c9e1d42c207a7a4 100644 (file)
  */
 class ModelAPI_ResultConstruction : public ModelAPI_Result
 {
-public:
+ public:
   /// Returns the group identifier of this result
   virtual std::string groupName()
-    { return group(); }
+  {
+    return group();
+  }
 
   /// Returns the group identifier of this result
   static std::string group()
-    {static std::string MY_GROUP = "Construction"; return MY_GROUP;}
-
+  {
+    static std::string MY_GROUP = "Construction";
+    return MY_GROUP;
+  }
 
   /// Returns the shape-result produced by this feature
   virtual boost::shared_ptr<GeomAPI_Shape>& shape() = 0;
index 509e064ea1158da0dc74a74219b0e515e8d34e8e..5c67cbcc05e220663e25fd2c121cc95bb24f8229 100644 (file)
  */
 class ModelAPI_ResultParameters : public ModelAPI_Result
 {
-public:
+ public:
   /// Returns the group identifier of this result
   virtual std::string groupName()
-    { return group(); }
+  {
+    return group();
+  }
 
   /// Returns the group identifier of this result
   static std::string group()
-    {static std::string MY_GROUP = "Parameters"; return MY_GROUP;}
+  {
+    static std::string MY_GROUP = "Parameters";
+    return MY_GROUP;
+  }
 };
 
 //! Pointer on feature object
index 73bfd1ca3d4a135da43c755212b264e467f7082f..ca52304cc36c2e0712fdf82e3a7d88696d17291a 100644 (file)
  */
 class ModelAPI_ResultPart : public ModelAPI_Result
 {
-public:
+ public:
   /// Returns the group identifier of this result
   virtual std::string groupName()
-    { return group(); }
+  {
+    return group();
+  }
 
   /// Returns the group identifier of this result
   static std::string group()
-    {static std::string MY_GROUP = "Parts"; return MY_GROUP;}
+  {
+    static std::string MY_GROUP = "Parts";
+    return MY_GROUP;
+  }
 
   /// part document reference attribute
   inline static const std::string& DOC_REF()
index 7484246d1227ca0388d645b2ab3aed495d7391ff..b18709a144a7a5e0e7195c586e43c8cf2269fad3 100644 (file)
@@ -8,11 +8,10 @@
 #include "ModelAPI_Validator.h"
 #include "ModelAPI_Object.h"
 
-class ModelAPI_ResultValidator: public ModelAPI_Validator
+class ModelAPI_ResultValidator : public ModelAPI_Validator
 {
-public:
+ public:
   virtual bool isValid(const ObjectPtr theObject) const = 0;
 };
 
-
-#endif
\ No newline at end of file
+#endif
index 1c49c67799d045d685966049f14e095b5bdc1f65..52b88b5b05aa4200a5d298039ed8bf6bbf34503a 100644 (file)
@@ -6,16 +6,18 @@
 #include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultConstruction.h>
 
-
 namespace ModelAPI_Tools {
 
 boost::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult)
 {
   ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
-  if (aBody) return aBody->shape();
-  ResultConstructionPtr aConstruct = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theResult);
-  if (aConstruct) return aConstruct->shape();
+  if (aBody)
+    return aBody->shape();
+  ResultConstructionPtr aConstruct = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
+      theResult);
+  if (aConstruct)
+    return aConstruct->shape();
   return boost::shared_ptr<GeomAPI_Shape>();
 }
 
-}
\ No newline at end of file
+}
index f4fc0ebf0152579ea1da16e08680a2ce4f6f3518..bec1b9da1019db0f6d24606ac546cdcd9a1c61a5 100644 (file)
@@ -9,10 +9,10 @@
 #include <ModelAPI_Result.h>
 #include <GeomAPI_Shape.h>
 
-namespace ModelAPI_Tools 
-{
-  /// Returns shape from the given Result object
-  MODELAPI_EXPORT boost::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult);
-};
+namespace ModelAPI_Tools {
+/// Returns shape from the given Result object
+MODELAPI_EXPORT boost::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult);
+}
+;
 
-#endif
\ No newline at end of file
+#endif
index bd53ecc24a349811a09755317f6d3821002fa115..c1c5f37fbcc03cc44add704d8f26d3e263d42e80 100644 (file)
@@ -24,9 +24,12 @@ class ModelAPI_Feature;
  */
 class MODELAPI_EXPORT ModelAPI_Validator
 {
-public:
+ public:
   // Make virtual destructor in order to make the class polymorphic
-  virtual ~ModelAPI_Validator() {};
+  virtual ~ModelAPI_Validator()
+  {
+  }
+  ;
 
   /// Returns true if feature and/or attributes are valid
   /// \param theFeature the validated feature
@@ -52,7 +55,7 @@ typedef boost::shared_ptr<ModelAPI_Validator> ValidatorPtr;
  */
 class MODELAPI_EXPORT ModelAPI_ValidatorsFactory
 {
-public:
+ public:
   /// Registers the instance of the validator by the ID
   virtual void registerValidator(const std::string& theID, ModelAPI_Validator* theValidator) = 0;
 
@@ -60,18 +63,17 @@ public:
   virtual void assignValidator(const std::string& theID, const std::string& theFeatureID) = 0;
 
   /// Assigns validator to the attribute of the feature
-  virtual void assignValidator(const std::string& theID, 
-    const std::string& theFeatureID, const std::string& theAttrID,
-    const std::list<std::string>& theArguments) = 0;
+  virtual void assignValidator(const std::string& theID, const std::string& theFeatureID,
+                               const std::string& theAttrID,
+                               const std::list<std::string>& theArguments) = 0;
 
   /// Provides a validator for the feature, returns NULL if no validator
-  virtual void validators(const std::string& theFeatureID, 
-    std::list<ModelAPI_Validator*>& theResult) const = 0;
+  virtual void validators(const std::string& theFeatureID,
+                          std::list<ModelAPI_Validator*>& theResult) const = 0;
   /// Provides a validator for the attribute, returns NULL if no validator
-  virtual void validators(
-    const std::string& theFeatureID, const std::string& theAttrID,
-    std::list<ModelAPI_Validator*>& theValidators, 
-    std::list<std::list<std::string> >& theArguments) const = 0;
+  virtual void validators(const std::string& theFeatureID, const std::string& theAttrID,
+                          std::list<ModelAPI_Validator*>& theValidators,
+                          std::list<std::list<std::string> >& theArguments) const = 0;
 
   /// Returns registered validator by its Id
   virtual const ModelAPI_Validator* validator(const std::string& theID) const = 0;
@@ -81,9 +83,11 @@ public:
   //virtual bool validate(
   //  const boost::shared_ptr<ModelAPI_Feature>& theFeature, const std::string& theAttrID) const = 0;
 
-protected:
+ protected:
   /// Get instance from PluginManager
-  ModelAPI_ValidatorsFactory() {}
+  ModelAPI_ValidatorsFactory()
+  {
+  }
 };
 
 #endif
index e4a58e3d750409a5d9dc6b00e89d56c33b2be9a7..54ee504270c93a9df3a8195b617b4dfb5c10ac94 100644 (file)
@@ -1,18 +1,18 @@
-#ifndef MODULEBASE_H
-#define MODULEBASE_H
-
-#if defined MODULEBASE_EXPORTS
-#if defined WIN32
-#define MODULEBASE_EXPORT              __declspec( dllexport )
-#else
-#define MODULEBASE_EXPORT
-#endif
-#else
-#if defined WIN32
-#define MODULEBASE_EXPORT              __declspec( dllimport )
-#else
-#define MODULEBASE_EXPORT
-#endif
-#endif
-
-#endif //MODULEBASE_H
+#ifndef MODULEBASE_H\r
+#define MODULEBASE_H\r
+\r
+#if defined MODULEBASE_EXPORTS\r
+#if defined WIN32\r
+#define MODULEBASE_EXPORT              __declspec( dllexport )\r
+#else\r
+#define MODULEBASE_EXPORT\r
+#endif\r
+#else\r
+#if defined WIN32\r
+#define MODULEBASE_EXPORT              __declspec( dllimport )\r
+#else\r
+#define MODULEBASE_EXPORT\r
+#endif\r
+#endif\r
+\r
+#endif //MODULEBASE_H\r
\ No newline at end of file
index 9e4bfbc025c236ac5ffe9468b8e96e983f6372da..56049acec437d3ace6a27f5c9922e9c4edcf9629 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifndef ModuleBase_Definitions_H
 #define ModuleBase_Definitions_H
 
@@ -9,8 +8,7 @@
 typedef QList<int> QIntList;       //!< list of int values
 typedef QList<short> QShortList;     //!< list of short int values
 typedef QList<double> QDoubleList;    //!< list of double values
-typedef QList<FeaturePtr> QFeatureList; //!< List of features
-typedef QList<ResultPtr> QResultList; //!< List of results
-
+typedef QList<FeaturePtr> QFeatureList;  //!< List of features
+typedef QList<ResultPtr> QResultList;  //!< List of results
 
-#endif
\ No newline at end of file
+#endif
index ae652617e9f8a4f5ae7d39576d6fc0bd3f37f1ea..6404849276d5534225e3a22a4b5572708913cf2e 100644 (file)
@@ -1,49 +1,52 @@
-#ifndef ModuleBase_IModule_H
-#define ModuleBase_IModule_H
-
-#include <QString>
-#include <QObject>
-
-class QAction;
-class XGUI_Workshop;
-class Config_WidgetAPI;
-class ModuleBase_ModelWidget;
-
-/**
-* Interface to a module
-*/
-class ModuleBase_IModule: public QObject
-{
-public:
-  /// Reads description of features from XML file 
-  virtual void createFeatures() = 0;
-
-  /// Called on creation of menu item in desktop
-  virtual void featureCreated(QAction*) = 0;
-
-  /// Creates an operation and send it to loop
-  /// \param theCmdId the operation name
-  virtual void launchOperation(const QString& theCmdId) = 0;
-
-  /// Called when it is necessary to update a command state (enable or disable it)
-  //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;
-
-  /// Creates custom widgets for property panel
-  virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent, 
-    Config_WidgetAPI* theWidgetApi, QList<ModuleBase_ModelWidget*>& theModelWidgets)
-  {
-    return 0;
-  }
-
-  virtual ~ModuleBase_IModule() {};
-};
-
-//! This function must return a new module instance.
-extern "C"
-{
-typedef ModuleBase_IModule* (*CREATE_FUNC)(XGUI_Workshop*);
-}
-
-#define CREATE_MODULE "createModule"
-
-#endif //ModuleBase_IModule
+#ifndef ModuleBase_IModule_H\r
+#define ModuleBase_IModule_H\r
+\r
+#include <QString>\r
+#include <QObject>\r
+\r
+class QAction;\r
+class XGUI_Workshop;\r
+class Config_WidgetAPI;\r
+class ModuleBase_ModelWidget;\r
+\r
+/**\r
+ * Interface to a module\r
+ */\r
+class ModuleBase_IModule : public QObject\r
+{\r
+ public:\r
+  /// Reads description of features from XML file \r
+  virtual void createFeatures() = 0;\r
+\r
+  /// Called on creation of menu item in desktop\r
+  virtual void featureCreated(QAction*) = 0;\r
+\r
+  /// Creates an operation and send it to loop\r
+  /// \param theCmdId the operation name\r
+  virtual void launchOperation(const QString& theCmdId) = 0;\r
+\r
+  /// Called when it is necessary to update a command state (enable or disable it)\r
+  //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;\r
+\r
+  /// Creates custom widgets for property panel\r
+  virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,\r
+                                      Config_WidgetAPI* theWidgetApi,\r
+                                      QList<ModuleBase_ModelWidget*>& theModelWidgets)\r
+  {\r
+    return 0;\r
+  }\r
+\r
+  virtual ~ModuleBase_IModule()\r
+  {\r
+  }\r
+  ;\r
+};\r
+\r
+//! This function must return a new module instance.\r
+extern "C" {\r
+typedef ModuleBase_IModule* (*CREATE_FUNC)(XGUI_Workshop*);\r
+}\r
+\r
+#define CREATE_MODULE "createModule"\r
+\r
+#endif //ModuleBase_IModule\r
\ No newline at end of file
index cee8fbc2b1d531cc41fa5c3bab5d656d7f1481d2..f8aacb9c18e37adf10b8aef650a1741f13b4eca7 100644 (file)
@@ -17,7 +17,9 @@
 #endif
 
 ModuleBase_IOperation::ModuleBase_IOperation(const QString& theId, QObject* theParent)
- : QObject(theParent), myIsEditing(false), myIsModified(false)
+    : QObject(theParent),
+      myIsEditing(false),
+      myIsModified(false)
 {
   myDescription = new ModuleBase_OperationDescription(theId);
 }
@@ -43,14 +45,14 @@ bool ModuleBase_IOperation::isGranted(ModuleBase_IOperation* /*theOperation*/) c
 }
 
 /*void ModuleBase_IOperation::setModelWidgets(const std::string& theXmlRepresentation,
                                           QList<ModuleBase_ModelWidget*> theWidgets)
-{
 QList<ModuleBase_ModelWidget*>::const_iterator anIt = theWidgets.begin(), aLast = theWidgets.end();
 for (; anIt != aLast; anIt++) {
   QObject::connect(*anIt, SIGNAL(valuesChanged()),  this, SLOT(storeCustomValue()));
 }
 getDescription()->setModelWidgets(theXmlRepresentation, theWidgets);
-}*/
+ QList<ModuleBase_ModelWidget*> theWidgets)
+ {
+ QList<ModuleBase_ModelWidget*>::const_iterator anIt = theWidgets.begin(), aLast = theWidgets.end();
+ for (; anIt != aLast; anIt++) {
+ QObject::connect(*anIt, SIGNAL(valuesChanged()),  this, SLOT(storeCustomValue()));
+ }
+ getDescription()->setModelWidgets(theXmlRepresentation, theWidgets);
+ }*/
 
 boost::shared_ptr<ModelAPI_Document> ModuleBase_IOperation::document() const
 {
@@ -91,7 +93,7 @@ bool ModuleBase_IOperation::commit()
 
     document()->finishOperation();
     emit stopped();
-  
+
     afterCommitOperation();
     return true;
   }
index c9510192f683b1e6cbfd719259ca28f6b0418669..8d738763e0ae598d39e412c9ea1f779462232112 100644 (file)
@@ -5,7 +5,6 @@
  *      Author: nds
  */
 
-
 #ifndef ModuleBase_IOperation_H
 #define ModuleBase_IOperation_H
 
@@ -37,11 +36,11 @@ class ModuleBase_OperationDescription;
  *  - virtual void      commitOperation();
  */
 
-class MODULEBASE_EXPORT ModuleBase_IOperation: public QObject
+class MODULEBASE_EXPORT ModuleBase_IOperation : public QObject
 {
 Q_OBJECT
 
-public:
+ public:
   /// Constructor
   /// Constructs an empty operation. Constructor should work very fast because many
   /// operators may be created after starting workshop but only several from them
@@ -73,19 +72,25 @@ public:
   //                     QList<ModuleBase_ModelWidget*> theWidgets);
 
   /// Returns True if data of its feature was modified during operation
-  virtual bool isModified() const { return myIsModified; }
+  virtual bool isModified() const
+  {
+    return myIsModified;
+  }
 
   /// Returns True id the current operation is launched in editing mode
-  bool isEditOperation() const { return myIsEditing; }
+  bool isEditOperation() const
+  {
+    return myIsEditing;
+  }
 
 signals:
-  void started(); /// the operation is started
-  void aborted(); /// the operation is aborted
-  void committed(); /// the operation is committed
-  void stopped(); /// the operation is aborted or committed
-  void resumed(); /// the operation is resumed
+  void started();  /// the operation is started
+  void aborted();  /// the operation is aborted
+  void committed();  /// the operation is committed
+  void stopped();  /// the operation is aborted or committed
+  void resumed();  /// the operation is resumed
 
-public slots:
+ public slots:
   /// Starts operation
   /// Public slot. Verifies whether operation can be started and starts operation.
   /// This slot is not virtual and cannot be redefined. Redefine startOperation method
@@ -119,7 +124,7 @@ public slots:
   /// Stores a custom value in model.
   virtual void storeCustomValue() = 0;
 
-protected:
+ protected:
   /// Virtual method called when operation started (see start() method for more description)
   /// Default impl calls corresponding slot and commits immediately.
   virtual void startOperation() = 0;
@@ -150,8 +155,8 @@ protected:
   /// Modified feature flag
   bool myIsModified;
 
-private:
-  ModuleBase_OperationDescription* myDescription; /// the container to have the operation description
+ private:
+  ModuleBase_OperationDescription* myDescription;  /// the container to have the operation description
 };
 
 #endif
index 33d617de990a71485a8fcab18071c2e6ef7b3d6d..43bd0ea86650863887c248c69ac603b3059a73ff 100644 (file)
@@ -18,7 +18,7 @@
 
 class ModuleBase_ISelection
 {
-public:
+ public:
 
   /// Returns a list of viewer selected presentations
   /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
@@ -31,15 +31,15 @@ public:
   virtual std::list<ModuleBase_ViewerPrs> getHighlighted(int theShapeTypeToSkip = -1) const = 0;
 
   /**
-  * Returns list of features currently selected in 3d viewer
-  */
+   * Returns list of features currently selected in 3d viewer
+   */
   virtual QList<ObjectPtr> selectedObjects() const = 0;
 
   /**
-  * Returns list of currently selected results
-  */
+   * Returns list of currently selected results
+   */
   virtual QList<ObjectPtr> selectedPresentations() const = 0;
-  
+
   //! Returns list of currently selected QModelIndexes
   virtual QModelIndexList selectedIndexes() const = 0;
 
@@ -51,4 +51,4 @@ public:
 
 };
 
-#endif
\ No newline at end of file
+#endif
index 134274398bd876d9c10fbdda9433c539c2b21004..b05e2d62976875af9a6eddeec709a7eefcb5a89a 100644 (file)
 class ModuleBase_IModule;
 
 /**
-* Class which provides access to Workshop object serveces
-*/
-class MODULEBASE_EXPORT ModuleBase_IWorkshop: public QObject
+ * Class which provides access to Workshop object serveces
+ */
+class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject
 {
 Q_OBJECT
-public:
-  ModuleBase_IWorkshop(QObject* theParent):QObject(theParent) {}
+ public:
+  ModuleBase_IWorkshop(QObject* theParent)
+      : QObject(theParent)
+  {
+  }
 
-  virtual ~ModuleBase_IWorkshop() {};
+  virtual ~ModuleBase_IWorkshop()
+  {
+  }
+  ;
 
   //! Returns AIS_InteractiveContext from current OCCViewer
   virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
 
   //! Returns list of currently selected data objects
-  virtual QList<ObjectPtr> selectedObjects() const = 0; 
+  virtual QList<ObjectPtr> selectedObjects() const = 0;
 
   //! Returns instance of loaded module
   virtual ModuleBase_IModule* module() const = 0;
@@ -39,4 +45,4 @@ signals:
   void selectionChanged();
 };
 
-#endif
\ No newline at end of file
+#endif
index 86a8a8e0f1eb4a36b796a2889457c7763e224cf4..80c4cb856c00509eb93bc34b766d0f2c0668775b 100644 (file)
 
 #include <QWidget>
 
-ModuleBase_ModelWidget::ModuleBase_ModelWidget(QObject* theParent, 
-  const Config_WidgetAPI* theData, 
-  const std::string& theParentId)
- : QObject(theParent), myHasDefaultValue(false), myParentId(theParentId)
+ModuleBase_ModelWidget::ModuleBase_ModelWidget(QObject* theParent, const Config_WidgetAPI* theData,
+                                               const std::string& theParentId)
+    : QObject(theParent),
+      myHasDefaultValue(false),
+      myParentId(theParentId)
 {
   myAttributeID = theData ? theData->widgetId() : "";
 }
@@ -41,7 +42,6 @@ bool ModuleBase_ModelWidget::focusTo()
   return true;
 }
 
-
 void ModuleBase_ModelWidget::updateObject(ObjectPtr theObj) const
 {
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
index c150d01b3c0fdb1c4dac49e21fcf510bf65724d7..d11c21d0f6fa559c56371dd9685b151553f0ef38 100644 (file)
@@ -27,19 +27,27 @@ class QKeyEvent;
  */
 class MODULEBASE_EXPORT ModuleBase_ModelWidget : public QObject
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Constructor
   /// \theParent the parent object
   /// \theData the widget configuation. The attribute of the model widget is obtained from
-  ModuleBase_ModelWidget(QObject* theParent, const Config_WidgetAPI* theData, const std::string& theParentId);
+  ModuleBase_ModelWidget(QObject* theParent, const Config_WidgetAPI* theData,
+                         const std::string& theParentId);
   /// Destructor
-  virtual ~ModuleBase_ModelWidget() {};
+  virtual ~ModuleBase_ModelWidget()
+  {
+  }
+  ;
 
   /// Set the given wrapped value to the current widget
   /// This value should be processed in the widget according to the needs
   /// \param theValue the wrapped widget value
-  virtual bool setValue(ModuleBase_WidgetValue* theValue) { return false; };
+  virtual bool setValue(ModuleBase_WidgetValue* theValue)
+  {
+    return false;
+  }
+  ;
 
   /// Returns the state whether the attribute of the feature is initialized
   /// \param theObject a model feature to be checked
@@ -63,18 +71,33 @@ public:
 
   /// Returns whether the control has a default value
   /// \return a boolean value
-  bool hasDefaultValue() const { return myHasDefaultValue; }
+  bool hasDefaultValue() const
+  {
+    return myHasDefaultValue;
+  }
 
   /// Returns the attribute name
   /// \returns the string value
-  std::string attributeID() const { return myAttributeID; }
+  std::string attributeID() const
+  {
+    return myAttributeID;
+  }
 
   /// Returns the parent of the attribute
   /// \returns the string value
-  std::string parentID() const { return myParentId; }
-
-  FeaturePtr feature() const { return myFeature;}
-  void setFeature(const FeaturePtr& theFeature) { myFeature = theFeature; }
+  std::string parentID() const
+  {
+    return myParentId;
+  }
+
+  FeaturePtr feature() const
+  {
+    return myFeature;
+  }
+  void setFeature(const FeaturePtr& theFeature)
+  {
+    myFeature = theFeature;
+  }
 
 signals:
   /// The signal about widget values changed
@@ -87,17 +110,19 @@ signals:
   /// \param theWidget the model base widget
   void focusOutWidget(ModuleBase_ModelWidget* theWidget);
 
-protected:
+ protected:
   /// Returns the attribute name
   /// \returns the string value
-  void setAttributeID(const std::string& theAttribute) { myAttributeID = theAttribute; }
+  void setAttributeID(const std::string& theAttribute)
+  {
+    myAttributeID = theAttribute;
+  }
 
   void updateObject(ObjectPtr theObj) const;
 
-  bool myHasDefaultValue; /// the boolean state whether the control has a default value
-
+  bool myHasDefaultValue;  /// the boolean state whether the control has a default value
 
-  std::string myAttributeID; /// the attribute name of the model feature
+  std::string myAttributeID;  /// the attribute name of the model feature
   std::string myParentId;    /// name of parent
   FeaturePtr myFeature;
 };
index 4a980a1dc2b8b0dc534ca40968f0b57ca247bc57..305b810c6b008193818b51e20ffe364e99fbee37 100644 (file)
@@ -26,7 +26,7 @@
 #endif
 
 ModuleBase_Operation::ModuleBase_Operation(const QString& theId, QObject* theParent)
-: ModuleBase_IOperation(theId, theParent)
+    : ModuleBase_IOperation(theId, theParent)
 {
 }
 
@@ -51,11 +51,11 @@ bool ModuleBase_Operation::isNestedOperationsEnabled() const
 
 void ModuleBase_Operation::storeCustomValue()
 {
-  if(!myFeature){
-    #ifdef _DEBUG
+  if (!myFeature) {
+#ifdef _DEBUG
     qDebug() << "ModuleBase_Operation::storeCustom: " <<
-        "trying to store value without opening a transaction.";
-    #endif
+    "trying to store value without opening a transaction.";
+#endif
     return;
   }
 
@@ -86,7 +86,8 @@ void ModuleBase_Operation::abortOperation()
 
 void ModuleBase_Operation::commitOperation()
 {
-  if (myFeature) myFeature->execute();
+  if (myFeature)
+    myFeature->execute();
 }
 
 void ModuleBase_Operation::afterCommitOperation()
@@ -96,22 +97,22 @@ void ModuleBase_Operation::afterCommitOperation()
 bool ModuleBase_Operation::canBeCommitted() const
 {
   if (ModuleBase_IOperation::canBeCommitted()) {
-/*    FeaturePtr aFeature = feature();
-    std::string aId = aFeature->getKind();
-
-    PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
-    ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
-    std::list<ModelAPI_Validator*> aValidators;
-    aFactory->validators(aId, aValidators);
-    std::list<ModelAPI_Validator*>::const_iterator aIt;
-    for (aIt = aValidators.cbegin(); aIt != aValidators.cend(); ++aIt) {
-      const ModuleBase_FeatureValidator* aFValidator = 
-        dynamic_cast<const ModuleBase_FeatureValidator*>(*aIt);
-      if (aFValidator) {
-        if (!aFValidator->isValid(aFeature))
-          return false;
-      }
-    }*/
+    /*    FeaturePtr aFeature = feature();
+     std::string aId = aFeature->getKind();
+
+     PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
+     ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
+     std::list<ModelAPI_Validator*> aValidators;
+     aFactory->validators(aId, aValidators);
+     std::list<ModelAPI_Validator*>::const_iterator aIt;
+     for (aIt = aValidators.cbegin(); aIt != aValidators.cend(); ++aIt) {
+     const ModuleBase_FeatureValidator* aFValidator = 
+     dynamic_cast<const ModuleBase_FeatureValidator*>(*aIt);
+     if (aFValidator) {
+     if (!aFValidator->isValid(aFeature))
+     return false;
+     }
+     }*/
     return true;
   }
   return false;
@@ -131,15 +132,15 @@ FeaturePtr ModuleBase_Operation::createFeature(const bool theFlushMessage)
 {
   boost::shared_ptr<ModelAPI_Document> aDoc = document();
   myFeature = aDoc->addFeature(getDescription()->operationId().toStdString());
-  if (myFeature) { // TODO: generate an error if feature was not created
+  if (myFeature) {  // TODO: generate an error if feature was not created
     myIsModified = true;
     myFeature->execute();
     // Init default values
     /*QList<ModuleBase_ModelWidget*> aWidgets = getDescription()->modelWidgets();
-    QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
-    for (; anIt != aLast; anIt++) {
-      (*anIt)->storeValue(aFeature);
-    }*/
+     QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
+     for (; anIt != aLast; anIt++) {
+     (*anIt)->storeValue(aFeature);
+     }*/
   }
 
   if (theFlushMessage)
@@ -172,4 +173,4 @@ bool ModuleBase_Operation::hasObject(ObjectPtr theObj) const
     }
   }
   return false;
-}
\ No newline at end of file
+}
index c9693d3f60f120414451d29994dece2f69df4932..15e157baeb079045410a2cea29d54820ee77a8c9 100644 (file)
@@ -5,7 +5,6 @@
  *      Author: sbh
  */
 
-
 #ifndef ModuleBase_Operation_H
 #define ModuleBase_Operation_H
 
@@ -40,11 +39,11 @@ class QKeyEvent;
  *  - virtual void      commitOperation();
  */
 
-class MODULEBASE_EXPORT ModuleBase_Operation: public ModuleBase_IOperation
+class MODULEBASE_EXPORT ModuleBase_Operation : public ModuleBase_IOperation
 {
 Q_OBJECT
 
-public:
+ public:
   /// Constructor
   /// \param theId the operation identifier
   /// \param theParent the QObject parent
@@ -67,7 +66,10 @@ public:
   /// Stores a custom value in model.
   void storeCustomValue();
 
-  virtual void keyReleased(std::string theName, QKeyEvent* theEvent) {};
+  virtual void keyReleased(std::string theName, QKeyEvent* theEvent)
+  {
+  }
+  ;
 
   /// Sets the operation feature
   void setEditingFeature(FeaturePtr theFeature);
@@ -75,7 +77,7 @@ public:
   /// Returns True if the current operation works with the given object (feature or result)
   virtual bool hasObject(ObjectPtr theObj) const;
 
-public slots:
+ public slots:
   /// Slots which listen the mode widget activation
   /// \param theWidget the model widget
   virtual void onWidgetActivated(ModuleBase_ModelWidget* theWidget);
@@ -85,7 +87,7 @@ signals:
   /// \param theWidget the previous active widget
   void activateNextWidget(ModuleBase_ModelWidget* theWidget);
 
-protected:
+ protected:
   /// Virtual method called when operation started (see start() method for more description)
   /// Default impl calls corresponding slot and commits immediately.
   virtual void startOperation();
@@ -108,7 +110,7 @@ protected:
   /// \returns the created feature
   virtual FeaturePtr createFeature(const bool theFlushMessage = true);
 
-protected:
+ protected:
   /// Sets the operation feature
   void setFeature(FeaturePtr theFeature);
 
@@ -116,8 +118,8 @@ protected:
   /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled
   virtual bool canBeCommitted() const;
 
-protected:
-  FeaturePtr myFeature; /// the operation feature to be handled
+ protected:
+  FeaturePtr myFeature;  /// the operation feature to be handled
 };
 
 #endif
index ffffe6922f00a1db053f1977304e176cdd7fec70..e69e39218ca6646321f7341752ada5fae9912778 100644 (file)
@@ -9,7 +9,7 @@
 #include <QString>
 
 ModuleBase_OperationDescription::ModuleBase_OperationDescription(const QString& theId)
-: myOperationId(theId)
+    : myOperationId(theId)
 {
 }
 
@@ -33,19 +33,19 @@ void ModuleBase_OperationDescription::setDescription(const QString& theDescripti
 }
 
 /*void ModuleBase_OperationDescription::setModelWidgets(const std::string& theXmlRepresentation,
                                                     const QList<ModuleBase_ModelWidget*>& theWidgets)
-{
 myWidgets.clear();
 QList<ModuleBase_ModelWidget*>::const_iterator anIt = theWidgets.begin(), aLast = theWidgets.end();
 for (; anIt != aLast; anIt++)
   myWidgets.push_back(*anIt);
 myXmlRepresentation = theXmlRepresentation;
-}*/
+ const QList<ModuleBase_ModelWidget*>& theWidgets)
+ {
+ myWidgets.clear();
+ QList<ModuleBase_ModelWidget*>::const_iterator anIt = theWidgets.begin(), aLast = theWidgets.end();
+ for (; anIt != aLast; anIt++)
+ myWidgets.push_back(*anIt);
+ myXmlRepresentation = theXmlRepresentation;
+ }*/
 
 /*const QList<ModuleBase_ModelWidget*>& ModuleBase_OperationDescription::modelWidgets() const
-{
 return myWidgets;
-}*/
+ {
+ return myWidgets;
+ }*/
 
 const QString& ModuleBase_OperationDescription::xmlRepresentation() const
 {
index 79a7301109a410d96fe4b4833591e3091bcc0584..fdcd0b3fb57c239d65348f7a54542408ac20452a 100644 (file)
@@ -1,80 +1,80 @@
-/*
- * ModuleBase_OperationDescription.h
- *
- *  Created on: Apr 2, 2014
- *      Author: sbh
- */
-
-#ifndef MODULEBASE_OPERATIONDESCRIPTION_H
-#define MODULEBASE_OPERATIONDESCRIPTION_H
-
-#include <ModuleBase.h>
-#include <ModuleBase_Operation.h>
-
-#include <QObject>
-#include <QString>
-#include <QList>
-
-#include <memory>
-
-//class ModuleBase_ModelWidget;
-
-/*!
- * \class ModuleBase_OperationDescription
- *
- */
-class MODULEBASE_EXPORT ModuleBase_OperationDescription
-{
-public:
-  /// Constructor
-  /// \param theId - the operation identifier
-  ModuleBase_OperationDescription(const QString& theId = "");
-  /// Destructor
-  virtual ~ModuleBase_OperationDescription();
-
-  /// Unique name of the operation
-  /// \return string name of the operation.
-  const QString& operationId() const;
-
-  /// Returns XML representation of the operation's widget.
-  /// \return XML QString
-  //const QString& xmlRepresentation() const;
-
-  /// Returns a short description of operation (will be
-  /// inserted in title of property panel)
-  const QString& description() const;
-
-  /// Sets a short description of operation (will be
-  /// inserted in title of property panel)
-  void setDescription(const QString& theDescription);
-
-  /// Sets a list of model widgets, according to the operation feature xml definition
-  /// \param theWidgets a list of widgets
-  //void setModelWidgets(const std::string& theXmlRepresentation,
-  //                     const QList<ModuleBase_ModelWidget*>& theWidgets);
-
-  /// Sets a list of model widgets, according to the operation feature xml definition
-  /// \param theWidgets a list of widgets
-  //const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
-
-   /// Returns XML representation of the operation's widget.
-   /// \return XML QString
-  const QString& xmlRepresentation() const;
-
-  /// Sets XML representation of the operation's widget.
-  /// \param theXMLRepresentation - XML QString
-  void setXmlRepresentation(const QString& theXMLRepresentation);
-
-  /// Returns true if there are no model widgets
-  /// \return the boolean value
-  bool hasXmlRepresentation() const;
-
-private:
-  //!< Next fields could be extracted into a subclass;
-  QString myOperationId; /// the operation identifier
-  QString myDescription; /// the short description of the opertaion
-  QString myXmlRepresentation; /// the xml definition
-  //QList<ModuleBase_ModelWidget*> myWidgets; /// the list of operation widgets
-};
-
-#endif //ModuleBase_OperationDescription_H
+/*\r
+ * ModuleBase_OperationDescription.h\r
+ *\r
+ *  Created on: Apr 2, 2014\r
+ *      Author: sbh\r
+ */\r
+\r
+#ifndef MODULEBASE_OPERATIONDESCRIPTION_H\r
+#define MODULEBASE_OPERATIONDESCRIPTION_H\r
+\r
+#include <ModuleBase.h>\r
+#include <ModuleBase_Operation.h>\r
+\r
+#include <QObject>\r
+#include <QString>\r
+#include <QList>\r
+\r
+#include <memory>\r
+\r
+//class ModuleBase_ModelWidget;\r
+\r
+/*!\r
+ * \class ModuleBase_OperationDescription\r
+ *\r
+ */\r
+class MODULEBASE_EXPORT ModuleBase_OperationDescription\r
+{\r
+ public:\r
+  /// Constructor\r
+  /// \param theId - the operation identifier\r
+  ModuleBase_OperationDescription(const QString& theId = "");\r
+  /// Destructor\r
+  virtual ~ModuleBase_OperationDescription();\r
+\r
+  /// Unique name of the operation\r
+  /// \return string name of the operation.\r
+  const QString& operationId() const;\r
+\r
+  /// Returns XML representation of the operation's widget.\r
+  /// \return XML QString\r
+  //const QString& xmlRepresentation() const;\r
+\r
+  /// Returns a short description of operation (will be\r
+  /// inserted in title of property panel)\r
+  const QString& description() const;\r
+\r
+  /// Sets a short description of operation (will be\r
+  /// inserted in title of property panel)\r
+  void setDescription(const QString& theDescription);\r
+\r
+  /// Sets a list of model widgets, according to the operation feature xml definition\r
+  /// \param theWidgets a list of widgets\r
+  //void setModelWidgets(const std::string& theXmlRepresentation,\r
+  //                     const QList<ModuleBase_ModelWidget*>& theWidgets);\r
+\r
+  /// Sets a list of model widgets, according to the operation feature xml definition\r
+  /// \param theWidgets a list of widgets\r
+  //const QList<ModuleBase_ModelWidget*>& modelWidgets() const;\r
+\r
+  /// Returns XML representation of the operation's widget.\r
+  /// \return XML QString\r
+  const QString& xmlRepresentation() const;\r
+\r
+  /// Sets XML representation of the operation's widget.\r
+  /// \param theXMLRepresentation - XML QString\r
+  void setXmlRepresentation(const QString& theXMLRepresentation);\r
+\r
+  /// Returns true if there are no model widgets\r
+  /// \return the boolean value\r
+  bool hasXmlRepresentation() const;\r
+\r
+ private:\r
+  //!< Next fields could be extracted into a subclass;\r
+  QString myOperationId;  /// the operation identifier\r
+  QString myDescription;  /// the short description of the opertaion\r
+  QString myXmlRepresentation;  /// the xml definition\r
+  //QList<ModuleBase_ModelWidget*> myWidgets; /// the list of operation widgets\r
+};\r
+\r
+#endif //ModuleBase_OperationDescription_H\r
\ No newline at end of file
index 67a9ca5a992a8784ac82e673008449f34a388dab..4fde0437bf97f70d996e12b5942cb7fd7cb04cf4 100644 (file)
@@ -14,7 +14,6 @@
 #include <BRep_Tool.hxx>
 #include <GeomAdaptor_Curve.hxx>
 
-
 ResultPtr result(const ObjectPtr theObject)
 {
   return boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
@@ -28,7 +27,6 @@ TopoDS_Shape shape(ResultPtr theResult)
   return TopoDS_Shape();
 }
 
-
 bool ModuleBase_ResultPointValidator::isValid(const ObjectPtr theObject) const
 {
   ResultPtr aResult = result(theObject);
@@ -41,7 +39,6 @@ bool ModuleBase_ResultPointValidator::isValid(const ObjectPtr theObject) const
   return aShape.ShapeType() == TopAbs_VERTEX;
 }
 
-
 bool ModuleBase_ResultLineValidator::isValid(const ObjectPtr theObject) const
 {
   ResultPtr aResult = result(theObject);
@@ -61,7 +58,6 @@ bool ModuleBase_ResultLineValidator::isValid(const ObjectPtr theObject) const
   return false;
 }
 
-
 bool ModuleBase_ResultArcValidator::isValid(const ObjectPtr theObject) const
 {
   ResultPtr aResult = result(theObject);
index 1b55460e0e7e6925484dfe70834754ceca449b39..ee4b23deddd729c8e645255839e4e36d0943af5a 100644 (file)
@@ -9,28 +9,28 @@
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Object.h>
 
-class ModuleBase_ResultValidator: public ModelAPI_Validator
+class ModuleBase_ResultValidator : public ModelAPI_Validator
 {
-public:
+ public:
   virtual bool isValid(const ObjectPtr theObject) const = 0;
 };
 
-class ModuleBase_ResultPointValidator: public ModuleBase_ResultValidator
+class ModuleBase_ResultPointValidator : public ModuleBase_ResultValidator
 {
-public:
+ public:
   MODULEBASE_EXPORT virtual bool isValid(const ObjectPtr theObject) const;
 };
 
-class ModuleBase_ResultLineValidator: public ModuleBase_ResultValidator
+class ModuleBase_ResultLineValidator : public ModuleBase_ResultValidator
 {
-public:
+ public:
   MODULEBASE_EXPORT virtual bool isValid(const ObjectPtr theObject) const;
 };
 
-class ModuleBase_ResultArcValidator: public ModuleBase_ResultValidator
+class ModuleBase_ResultArcValidator : public ModuleBase_ResultValidator
 {
-public:
+ public:
   MODULEBASE_EXPORT virtual bool isValid(const ObjectPtr theObject) const;
 };
 
-#endif
\ No newline at end of file
+#endif
index 1dd38013969915e35045a4c2caa5412651f7f1e8..f4bf04e7ec07da20de980180e3a984ac35da718b 100644 (file)
 
 #include <ModelAPI_Validator.h>
 
-
-class ModuleBase_SelectionValidator: public ModelAPI_Validator
+class ModuleBase_SelectionValidator : public ModelAPI_Validator
 {
-public:
+ public:
   virtual bool isValid(const ModuleBase_ISelection* theSelection) const = 0;
 };
 
index 87f636360229b6e5d2d68ee3fa910042cb5d957d..f68de8da5cba818502ee05c88496a59d239488e9 100644 (file)
@@ -7,8 +7,7 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_Document.h>
 
-namespace ModuleBase_Tools
-{
+namespace ModuleBase_Tools {
 
 //******************************************************************
 
index 3a2dbacfffacbc88b11387e7bffbb6d3183d5ff9..e2a09c54624833ac3bd0d9f17aa25e7aa0fc2222 100644 (file)
@@ -2,7 +2,6 @@
 // Created:     11 July 2014
 // Author:      Vitaly Smetannikov
 
-
 #ifndef ModuleBase_Tools_H
 #define ModuleBase_Tools_H
 
 
 class GeomAPI_Shape;
 
-namespace ModuleBase_Tools 
-{
+namespace ModuleBase_Tools {
 
-  /**
 * Returns returns a shape if the result has a shape method. Otherwise returns NULL pointer
 */
-  MODULEBASE_EXPORT boost::shared_ptr<GeomAPI_Shape> shape(ResultPtr theResult);
+/**
+ * Returns returns a shape if the result has a shape method. Otherwise returns NULL pointer
+ */
+MODULEBASE_EXPORT boost::shared_ptr<GeomAPI_Shape> shape(ResultPtr theResult);
 
-  MODULEBASE_EXPORT FeaturePtr feature(ObjectPtr theObject);
+MODULEBASE_EXPORT FeaturePtr feature(ObjectPtr theObject);
 
-};
+}
+;
 
-#endif
\ No newline at end of file
+#endif
index 40ec6661358cb598b55783415fc589de7e72211e..c67c2312bd7f05a9ad06b378f55be6919e6fb644 100644 (file)
  */
 class ModuleBase_ViewerPrs
 {
-public:
+ public:
   /// Constructor
-  ModuleBase_ViewerPrs() {}
-  
+  ModuleBase_ViewerPrs()
+  {
+  }
+
   /// Constructor
   /// \param theFeature a model feature
   /// \param theShape a viewer shape
   /// \param theOwner a selection owner
-  ModuleBase_ViewerPrs(ObjectPtr theResult,
-                 const TopoDS_Shape& theShape,
-                 Handle_SelectMgr_EntityOwner theOwner)
-  : myResult(theResult), myShape(theShape), myOwner(theOwner) {}
-  
+  ModuleBase_ViewerPrs(ObjectPtr theResult, const TopoDS_Shape& theShape,
+                       Handle_SelectMgr_EntityOwner theOwner)
+      : myResult(theResult),
+        myShape(theShape),
+        myOwner(theOwner)
+  {
+  }
+
   /// Destructor
-  virtual ~ModuleBase_ViewerPrs() {}
+  virtual ~ModuleBase_ViewerPrs()
+  {
+  }
 
   /// Sets the feature.
   /// \param theFeature a feature instance
-  void setFeature(ObjectPtr theResult) { myResult = theResult; }
+  void setFeature(ObjectPtr theResult)
+  {
+    myResult = theResult;
+  }
 
   /// Returns the feature.
   /// \return a feature instance
-  ObjectPtr object() const { return myResult; }
+  ObjectPtr object() const
+  {
+    return myResult;
+  }
 
   /// Returns the presentation owner
   /// \param the owner
-  void setOwner(Handle_SelectMgr_EntityOwner theOwner) { myOwner = theOwner; }
+  void setOwner(Handle_SelectMgr_EntityOwner theOwner)
+  {
+    myOwner = theOwner;
+  }
 
   /// Returns the presentation owner
   /// \return an owner
-  Handle_SelectMgr_EntityOwner owner() const { return myOwner; }
+  Handle_SelectMgr_EntityOwner owner() const
+  {
+    return myOwner;
+  }
 
   /// Sets the shape
   /// \param theShape a shape instance
-  void setShape(const TopoDS_Shape& theShape) { myShape = theShape; }
+  void setShape(const TopoDS_Shape& theShape)
+  {
+    myShape = theShape;
+  }
 
   /// Returns the shape
   /// \return a shape instance
-  const TopoDS_Shape& shape() const { return myShape; }
+  const TopoDS_Shape& shape() const
+  {
+    return myShape;
+  }
 
-  void setInteractive(const Handle(AIS_InteractiveObject)& theIO) { myInteractive = theIO; }
+  void setInteractive(const Handle(AIS_InteractiveObject)& theIO)
+  {
+    myInteractive = theIO;
+  }
 
-  Handle(AIS_InteractiveObject) interactive() const { return myInteractive; }
+  Handle(AIS_InteractiveObject) interactive() const
+  {
+    return myInteractive;
+  }
 
   bool operator==(const ModuleBase_ViewerPrs& thePrs)
   {
@@ -73,10 +104,10 @@ public:
     return aResult && aOwner && aShape && aIO;
   }
 
-private:
-  ObjectPtr myResult; /// the feature
-  Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
-  TopoDS_Shape myShape; /// the shape
+ private:
+  ObjectPtr myResult;  /// the feature
+  Handle(SelectMgr_EntityOwner) myOwner;  /// the selection owner
+  TopoDS_Shape myShape;  /// the shape
   Handle(AIS_InteractiveObject) myInteractive;
 };
 
index 07a8eb000a427539c9211f89b706e448da4e4f7d..e6bbdad250ee58087af360c81475676116dddd3f 100644 (file)
 #include <QLayout>
 #include <QCheckBox>
 
-ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue(QWidget* theParent, 
-  const Config_WidgetAPI* theData, 
-  const std::string& theParentId)
-  : ModuleBase_ModelWidget(theParent, theData, theParentId)
+ModuleBase_WidgetBoolValue::ModuleBase_WidgetBoolValue(QWidget* theParent,
+                                                       const Config_WidgetAPI* theData,
+                                                       const std::string& theParentId)
+    : ModuleBase_ModelWidget(theParent, theData, theParentId)
 {
   QString aText = QString::fromStdString(theData->widgetLabel());
   QString aToolTip = QString::fromStdString(theData->widgetTooltip());
@@ -37,9 +37,9 @@ ModuleBase_WidgetBoolValue::~ModuleBase_WidgetBoolValue()
 {
 }
 
-QWidget* ModuleBase_WidgetBoolValue::getControl() const 
-{ 
-  return myCheckBox; 
+QWidget* ModuleBase_WidgetBoolValue::getControl() const
+{
+  return myCheckBox;
 }
 
 bool ModuleBase_WidgetBoolValue::storeValue() const
index 7f6c822a87d3e1d943e0e178cd615130d3920597..9d0246c1156fa3b3043c85001e6706ca6b9d8ad2 100644 (file)
@@ -12,14 +12,15 @@ class Config_WidgetAPI;
 class QWidget;
 class QCheckBox;
 
-class MODULEBASE_EXPORT ModuleBase_WidgetBoolValue: public ModuleBase_ModelWidget
+class MODULEBASE_EXPORT ModuleBase_WidgetBoolValue : public ModuleBase_ModelWidget
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Constructor
   /// \theParent the parent object
   /// \theData the widget configuation. The attribute of the model widget is obtained from
-  ModuleBase_WidgetBoolValue(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId);
+  ModuleBase_WidgetBoolValue(QWidget* theParent, const Config_WidgetAPI* theData,
+                             const std::string& theParentId);
 
   virtual ~ModuleBase_WidgetBoolValue();
 
@@ -37,8 +38,8 @@ public:
   /// \returns the widget
   QWidget* getControl() const;
 
-private:
+ private:
   QCheckBox* myCheckBox;
 };
 
-#endif
\ No newline at end of file
+#endif
index beb384bcdfa5b7b21f8e45445a307c88a1cae49a..361c07cfc8da1153c14d45fa38f51deac4f99113 100644 (file)
 #define DBL_MAX 1.7976931348623158e+308 
 #endif
 
-
-ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, 
-  const Config_WidgetAPI* theData, 
-  const std::string& theParentId)
-  : ModuleBase_ModelWidget(theParent, theData, theParentId)
+ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
+                                                           const Config_WidgetAPI* theData,
+                                                           const std::string& theParentId)
+    : ModuleBase_ModelWidget(theParent, theData, theParentId)
 {
   myContainer = new QWidget(theParent);
   QHBoxLayout* aControlLay = new QHBoxLayout(myContainer);
@@ -125,7 +124,7 @@ bool ModuleBase_WidgetDoubleValue::eventFilter(QObject *theObject, QEvent *theEv
 {
   if (theObject == mySpinBox) {
     if (theEvent->type() == QEvent::KeyRelease) {
-      QKeyEvent* aKeyEvent = (QKeyEvent*)theEvent;
+      QKeyEvent* aKeyEvent = (QKeyEvent*) theEvent;
       if (aKeyEvent && aKeyEvent->key() == Qt::Key_Return) {
         emit focusOutWidget(this);
       }
index 15b9063b3552acb4dd135c44f61d93fa6dbf6268..6c819866e8575bd6f2bbc6164c4293deca7f53d2 100644 (file)
@@ -13,14 +13,15 @@ class QWidget;
 class QLabel;
 class QDoubleSpinBox;
 
-class MODULEBASE_EXPORT ModuleBase_WidgetDoubleValue: public ModuleBase_ModelWidget
+class MODULEBASE_EXPORT ModuleBase_WidgetDoubleValue : public ModuleBase_ModelWidget
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Constructor
   /// \theParent the parent object
   /// \theData the widget configuation. The attribute of the model widget is obtained from
-  ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId);
+  ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData,
+                               const std::string& theParentId);
 
   virtual ~ModuleBase_WidgetDoubleValue();
 
@@ -36,17 +37,20 @@ public:
 
   /// Returns the internal parent wiget control, that can be shown anywhere
   /// \returns the widget
-  QWidget* getControl() const { return myContainer; }
+  QWidget* getControl() const
+  {
+    return myContainer;
+  }
 
   /// Process key release envent on the widget spin box controls
   /// \param theObject the object where the event happens
   /// \param theEvent the processed event
   virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
 
-protected:
-  QWidget*     myContainer;
-  QLabel*      myLabel;
+ protected:
+  QWidget* myContainer;
+  QLabel* myLabel;
   QDoubleSpinBox* mySpinBox;
 };
 
-#endif
\ No newline at end of file
+#endif
index 9774a52bbb86c664001846b2e9cf190a42ad1fe3..b42e8401797c260b8450242e57db5a550f19b9a7 100644 (file)
 #include <QDoubleSpinBox>
 
 ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent,
-                                                 const Config_WidgetAPI* theData, 
+                                                 const Config_WidgetAPI* theData,
                                                  const std::string& theParentId)
-: ModuleBase_WidgetDoubleValue(theParent, theData, theParentId)
+    : ModuleBase_WidgetDoubleValue(theParent, theData, theParentId)
 {
 }
 
-ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent, const std::string& theAttribute)
-: ModuleBase_WidgetDoubleValue(theParent, 0, "")
+ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(QWidget* theParent,
+                                                 const std::string& theAttribute)
+    : ModuleBase_WidgetDoubleValue(theParent, 0, "")
 {
   setAttributeID(theAttribute);
 }
@@ -46,7 +47,7 @@ double editedValue(double theValue, bool& isDone)
   QDialog aDlg;
   aDlg.setWindowFlags(Qt::FramelessWindowHint);
   QHBoxLayout* aLay = new QHBoxLayout(&aDlg);
-  aLay->setContentsMargins(0,0,0,0);
+  aLay->setContentsMargins(0, 0, 0, 0);
 
   QLineEdit* aEditor = new QLineEdit(QString::number(theValue), &aDlg);
   aEditor->setValidator(new QDoubleValidator(aEditor));
@@ -80,7 +81,8 @@ bool ModuleBase_WidgetEditor::focusTo()
   return false;
 }
 
-void ModuleBase_WidgetEditor::editFeatureValue(FeaturePtr theFeature, const std::string theAttribute)
+void ModuleBase_WidgetEditor::editFeatureValue(FeaturePtr theFeature,
+                                               const std::string theAttribute)
 {
   DataPtr aData = theFeature->data();
   AttributeDoublePtr aRef = aData->real(theAttribute);
index 9c567bfcc7f65d4f5e57fee6ef1664353f4863cc..508e5ee53871ca5d9b1144deffe3dbd73e62c779 100644 (file)
@@ -20,13 +20,14 @@ class QLineEdit;
  */
 class MODULEBASE_EXPORT ModuleBase_WidgetEditor : public ModuleBase_WidgetDoubleValue
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Constructor
   /// \theParent the parent object
   /// \theParent the parent object
   /// \theData the widget configuation. The attribute of the model widget is obtained from
-  ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId);
+  ModuleBase_WidgetEditor(QWidget* theParent, const Config_WidgetAPI* theData,
+                          const std::string& theParentId);
   /// Constructor
   /// \theParent the parent object
   /// \theParent the parent object
@@ -46,9 +47,9 @@ public:
   /// \param theAttribute the feature attribute
   static void editFeatureValue(FeaturePtr theFeature, const std::string theAttribute);
 
-private:
-  FeaturePtr myFeature; ///< the current widget feature
-  QStringList myFeatureKinds; ///< the kinds of possible features
+ private:
+  FeaturePtr myFeature;  ///< the current widget feature
+  QStringList myFeatureKinds;  ///< the kinds of possible features
 };
 
 #endif
index 6f292f3a602060e9d110284f681ab6ca20781b4f..d75479e746739fa580263ce4a12656d3d75e2cac 100644 (file)
@@ -43,7 +43,7 @@
 
 ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(const std::string& theXmlRepresentation,
                                                    ModuleBase_IWorkshop* theWorkshop)
- : myWorkshop(theWorkshop)
   : myWorkshop(theWorkshop)
 {
   myWidgetApi = new Config_WidgetAPI(theXmlRepresentation);
 }
@@ -60,15 +60,14 @@ void ModuleBase_WidgetFactory::createWidget(QWidget* theParent)
 
   QVBoxLayout* aWidgetLay = new QVBoxLayout(theParent);
   aWidgetLay->setContentsMargins(2, 2, 2, 2);
-  do { //Iterate over each node
+  do {  //Iterate over each node
     std::string aWdgType = myWidgetApi->widgetType();
     //Create a widget (doublevalue, groupbox, toolbox, etc.
     QWidget* aWidget = createWidgetByType(aWdgType, theParent);
     if (aWidget) {
       if (!isInternalWidget(aWdgType)) {
         aWidgetLay->addWidget(aWidget);
-      }
-      else {
+      } else {
         aWidget->setVisible(false);
       }
     }
@@ -90,13 +89,13 @@ void ModuleBase_WidgetFactory::createWidget(QWidget* theParent)
         if (aWdgType == WDG_SWITCH) {
           ModuleBase_WidgetSwitch* aSwitch = qobject_cast<ModuleBase_WidgetSwitch*>(aWidget);
           aSwitch->addPage(aPage, aPageName);
-        } else if (aWdgType == WDG_TOOLBOX){
+        } else if (aWdgType == WDG_TOOLBOX) {
           QToolBox* aToolbox = qobject_cast<QToolBox*>(aWidget);
           aToolbox->addItem(aPage, aPageName);
         }
-      } while(myWidgetApi->toNextWidget());
+      } while (myWidgetApi->toNextWidget());
     }
-  } while(myWidgetApi->toNextWidget());
+  } while (myWidgetApi->toNextWidget());
   theParent->setLayout(aWidgetLay);
 }
 
@@ -114,7 +113,8 @@ QWidget* ModuleBase_WidgetFactory::labelControl(QWidget* theParent)
   return result;
 }
 
-QWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType, QWidget* theParent)
+QWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType,
+                                                      QWidget* theParent)
 {
   QWidget* result = NULL;
   if (theType == WDG_DOUBLEVALUE) {
@@ -140,17 +140,17 @@ QWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType
 
   } else if (theType == WDG_DOUBLEVALUE_EDITOR) {
     result = doubleValueEditor(theParent);
-  
+
   } else if (theType == WDG_POINT2D_DISTANCE) {
     result = point2dDistanceControl(theParent);
 
-  }
-  else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) {
+  } else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) {
     result = createContainer(theType, theParent);
   } else {
-    result = myWorkshop->module()->createWidgetByType(theType, theParent, myWidgetApi, myModelWidgets);
+    result = myWorkshop->module()->createWidgetByType(theType, theParent, myWidgetApi,
+                                                      myModelWidgets);
 #ifdef _DEBUG
-    if (!result) { qDebug("ModuleBase_WidgetFactory::fillWidget: find bad widget type"); }
+    if (!result) {qDebug("ModuleBase_WidgetFactory::fillWidget: find bad widget type");}
 #endif
   }
   return result;
@@ -171,15 +171,15 @@ QWidget* ModuleBase_WidgetFactory::createContainer(const std::string& theType, Q
     result = NULL;
   }
 #ifdef _DEBUG
-  else { qDebug() << "ModuleBase_WidgetFactory::fillWidget: find bad container type"; }
+  else {qDebug() << "ModuleBase_WidgetFactory::fillWidget: find bad container type";}
 #endif
   return result;
 }
 
 QWidget* ModuleBase_WidgetFactory::doubleSpinBoxControl(QWidget* theParent)
 {
-  ModuleBase_WidgetDoubleValue* aDblWgt = 
-    new ModuleBase_WidgetDoubleValue(theParent, myWidgetApi, myParentId);
+  ModuleBase_WidgetDoubleValue* aDblWgt = new ModuleBase_WidgetDoubleValue(theParent, myWidgetApi,
+                                                                           myParentId);
   myModelWidgets.append(aDblWgt);
 
   return aDblWgt->getControl();
@@ -187,32 +187,32 @@ QWidget* ModuleBase_WidgetFactory::doubleSpinBoxControl(QWidget* theParent)
 
 QWidget* ModuleBase_WidgetFactory::pointSelectorControl(QWidget* theParent)
 {
-  ModuleBase_WidgetPoint2D* aWidget = 
-    new ModuleBase_WidgetPoint2D(theParent, myWidgetApi, myParentId);
+  ModuleBase_WidgetPoint2D* aWidget = new ModuleBase_WidgetPoint2D(theParent, myWidgetApi,
+                                                                   myParentId);
   myModelWidgets.append(aWidget);
   return aWidget->getControl();
 }
 
 QWidget* ModuleBase_WidgetFactory::featureSelectorControl(QWidget* theParent)
 {
-  ModuleBase_WidgetFeature* aWidget = 
-    new ModuleBase_WidgetFeature(theParent, myWidgetApi, myParentId);
+  ModuleBase_WidgetFeature* aWidget = new ModuleBase_WidgetFeature(theParent, myWidgetApi,
+                                                                   myParentId);
   myModelWidgets.append(aWidget);
   return aWidget->getControl();
 }
 
 QWidget* ModuleBase_WidgetFactory::featureOrAttributeSelectorControl(QWidget* theParent)
 {
-  ModuleBase_WidgetFeatureOrAttribute* aWidget = 
-    new ModuleBase_WidgetFeatureOrAttribute(theParent, myWidgetApi, myParentId);
+  ModuleBase_WidgetFeatureOrAttribute* aWidget = new ModuleBase_WidgetFeatureOrAttribute(
+      theParent, myWidgetApi, myParentId);
   myModelWidgets.append(aWidget);
   return aWidget->getControl();
 }
 
 QWidget* ModuleBase_WidgetFactory::doubleValueEditor(QWidget* theParent)
 {
-  ModuleBase_WidgetEditor* aWidget = 
-    new ModuleBase_WidgetEditor(theParent, myWidgetApi, myParentId);
+  ModuleBase_WidgetEditor* aWidget = new ModuleBase_WidgetEditor(theParent, myWidgetApi,
+                                                                 myParentId);
   myModelWidgets.append(aWidget);
   return aWidget->getControl();
 }
@@ -227,36 +227,35 @@ bool ModuleBase_WidgetFactory::isInternalWidget(const std::string& theType)
   std::string prop = myWidgetApi->getProperty(FEATURE_INTERNAL);
 
   std::transform(prop.begin(), prop.end(), prop.begin(), ::tolower);
-  if(prop.empty() || prop == "false" || prop == "0") {
+  if (prop.empty() || prop == "false" || prop == "0") {
     return false;
   }
-  return true; 
+  return true;
 }
 
 QWidget* ModuleBase_WidgetFactory::selectorControl(QWidget* theParent)
 {
-  ModuleBase_WidgetSelector* aSelector = 
-    new ModuleBase_WidgetSelector(theParent, myWorkshop, myWidgetApi, myParentId);
+  ModuleBase_WidgetSelector* aSelector = new ModuleBase_WidgetSelector(theParent, myWorkshop,
+                                                                       myWidgetApi, myParentId);
   myModelWidgets.append(aSelector);
   return aSelector->getControl();
 }
 
-
 QWidget* ModuleBase_WidgetFactory::booleanControl(QWidget* theParent)
 {
-  ModuleBase_WidgetBoolValue* aBoolWgt = 
-    new ModuleBase_WidgetBoolValue(theParent, myWidgetApi, myParentId);
+  ModuleBase_WidgetBoolValue* aBoolWgt = new ModuleBase_WidgetBoolValue(theParent, myWidgetApi,
+                                                                        myParentId);
   myModelWidgets.append(aBoolWgt);
 
   return aBoolWgt->getControl();
 }
 
-
 QWidget* ModuleBase_WidgetFactory::point2dDistanceControl(QWidget* theParent)
 {
-  ModuleBase_WidgetPoint2dDistance* aDistWgt = 
-    new ModuleBase_WidgetPoint2dDistance(theParent, myWidgetApi, myParentId);
+  ModuleBase_WidgetPoint2dDistance* aDistWgt = new ModuleBase_WidgetPoint2dDistance(theParent,
+                                                                                    myWidgetApi,
+                                                                                    myParentId);
   myModelWidgets.append(aDistWgt);
 
   return aDistWgt->getControl();
-}
\ No newline at end of file
+}
index 5360f35dbba39a443ee05b2e460c5a06f4fe2b54..81be16e7147393948d10d37798436a0342d03f50 100644 (file)
@@ -21,8 +21,9 @@ class ModuleBase_IWorkshop;
 
 class MODULEBASE_EXPORT ModuleBase_WidgetFactory
 {
-public:
-  ModuleBase_WidgetFactory(const std::string& theXmlRepresentation, ModuleBase_IWorkshop* theWorkshop);
+ public:
+  ModuleBase_WidgetFactory(const std::string& theXmlRepresentation,
+                           ModuleBase_IWorkshop* theWorkshop);
   virtual ~ModuleBase_WidgetFactory();
 
   void createWidget(QWidget* theParent);
@@ -32,7 +33,7 @@ public:
     return myModelWidgets;
   }
 
-protected:
+ protected:
   //Widgets
   QWidget* createWidgetByType(const std::string& theType, QWidget* theParent = NULL);
   QWidget* labelControl(QWidget* theParent);
@@ -53,9 +54,9 @@ protected:
 
   QString qs(const std::string& theStdString) const;
 
-private:
+ private:
   Config_WidgetAPI* myWidgetApi;
-  ModuleBase_IWorkshop*   myWorkshop;
+  ModuleBase_IWorkshop* myWorkshop;
 
   QList<ModuleBase_ModelWidget*> myModelWidgets;
   std::string myParentId;
index 983329b53ddf61b42dae50d72e1ad5bc23e0e2a2..dd8fb94939dd3f49750f586aafa3c0858f6ca224 100644 (file)
@@ -27,9 +27,9 @@
 #include <QLabel>
 
 ModuleBase_WidgetFeature::ModuleBase_WidgetFeature(QWidget* theParent,
-                                                   const Config_WidgetAPI* theData, 
+                                                   const Config_WidgetAPI* theData,
                                                    const std::string& theParentId)
-: ModuleBase_ModelWidget(theParent, theData, theParentId)
+    : ModuleBase_ModelWidget(theParent, theData, theParentId)
 {
   myContainer = new QWidget(theParent);
   QHBoxLayout* aControlLay = new QHBoxLayout(myContainer);
@@ -61,8 +61,8 @@ bool ModuleBase_WidgetFeature::setValue(ModuleBase_WidgetValue* theValue)
   bool isDone = false;
 
   if (theValue) {
-    ModuleBase_WidgetValueFeature* aFeatureValue = 
-                         dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
+    ModuleBase_WidgetValueFeature* aFeatureValue =
+        dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
     if (aFeatureValue)
       isDone = setObject(aFeatureValue->object());
   }
@@ -80,9 +80,9 @@ bool ModuleBase_WidgetFeature::setObject(const ObjectPtr& theObject, bool theSen
   // Check the type of selected object
   std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
   bool isValid = true;
-  for(; aValidator != aValidators.end(); aValidator++) {
-    const ModelAPI_ResultValidator* aResValidator = 
-      dynamic_cast<const ModelAPI_ResultValidator*>(*aValidator);
+  for (; aValidator != aValidators.end(); aValidator++) {
+    const ModelAPI_ResultValidator* aResValidator =
+        dynamic_cast<const ModelAPI_ResultValidator*>(*aValidator);
     if (aResValidator) {
       isValid = false;
       if (aResValidator->isValid(theObject)) {
@@ -97,9 +97,9 @@ bool ModuleBase_WidgetFeature::setObject(const ObjectPtr& theObject, bool theSen
   // Check the acceptability of the object as attribute
   aValidator = aValidators.begin();
   std::list<std::list<std::string> >::iterator aArgs = anArguments.begin();
-  for(; aValidator != aValidators.end(); aValidator++, aArgs++) {
-    const ModelAPI_AttributeValidator* aAttrValidator = 
-      dynamic_cast<const ModelAPI_AttributeValidator*>(*aValidator);
+  for (; aValidator != aValidators.end(); aValidator++, aArgs++) {
+    const ModelAPI_AttributeValidator* aAttrValidator =
+        dynamic_cast<const ModelAPI_AttributeValidator*>(*aValidator);
     if (aAttrValidator) {
       if (!aAttrValidator->isValid(myFeature, *aArgs, theObject)) {
         return false;
@@ -120,8 +120,8 @@ bool ModuleBase_WidgetFeature::storeValue() const
   //if (!aFeature)
   //  return false;
   boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-          boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
 
   ModuleBase_WidgetFeature* that = (ModuleBase_WidgetFeature*) this;
   aRef->setObject(myObject);
@@ -133,8 +133,8 @@ bool ModuleBase_WidgetFeature::storeValue() const
 bool ModuleBase_WidgetFeature::restoreValue()
 {
   boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-          boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
 
   ObjectPtr aObj = aRef->object();
   FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aRef->object());
index fee570d64f78553c08cbda9ab64b91ddc0150cf3..9320fb6965e2f3fb8adc6ec2f8174bbae352c271 100644 (file)
@@ -23,13 +23,14 @@ class QLineEdit;
  */
 class MODULEBASE_EXPORT ModuleBase_WidgetFeature : public ModuleBase_ModelWidget
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Constructor
   /// \theParent the parent object
   /// \theParent the parent object
   /// \theData the widget configuation. The attribute of the model widget is obtained from
-  ModuleBase_WidgetFeature(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId);
+  ModuleBase_WidgetFeature(QWidget* theParent, const Config_WidgetAPI* theData,
+                           const std::string& theParentId);
   /// Destructor
   virtual ~ModuleBase_WidgetFeature();
 
@@ -52,7 +53,7 @@ public:
   /// \return a control list
   virtual QList<QWidget*> getControls() const;
 
-protected:
+ protected:
   /// Fill the widget values by given point
   /// \param thePoint the point
   /// \return the boolean result of the feature set
@@ -60,22 +61,31 @@ protected:
 
   /// Returns current widget feature
   /// \return the feature
-  const ObjectPtr object() const { return myObject; }
+  const ObjectPtr object() const
+  {
+    return myObject;
+  }
 
   /// Returns the widget editor
   /// \return the editor
-  QLineEdit* editor() const { return myEditor; }
+  QLineEdit* editor() const
+  {
+    return myEditor;
+  }
 
   /// Returns the possible feature kinds
   /// \return the list of kinds
-  const QStringList& featureKinds() const { return myObjectKinds; }
+  const QStringList& featureKinds() const
+  {
+    return myObjectKinds;
+  }
 
-  ObjectPtr myObject; ///< the current widget feature
-  QStringList myObjectKinds; ///< the kinds of possible features
+  ObjectPtr myObject;  ///< the current widget feature
+  QStringList myObjectKinds;  ///< the kinds of possible features
 
-  QWidget*   myContainer; /// the parent top control
-  QLabel*    myLabel; /// the editor information label
-  QLineEdit* myEditor; ///< the feature editor to visualize the feature name
+  QWidget* myContainer;  /// the parent top control
+  QLabel* myLabel;  /// the editor information label
+  QLineEdit* myEditor;  ///< the feature editor to visualize the feature name
 };
 
 #endif
index 40fb3a52f7bae73bd9c2ce01e3de5dcbb4b2ed85..4481c2034654e25aea8f69e42204e45bfe288eb0 100644 (file)
 #include <QHBoxLayout>
 #include <QLabel>
 
-ModuleBase_WidgetFeatureOrAttribute::ModuleBase_WidgetFeatureOrAttribute(QWidget* theParent,
-                                                   const Config_WidgetAPI* theData, 
-                                                   const std::string& theParentId)
-: ModuleBase_WidgetFeature(theParent, theData, theParentId)
+ModuleBase_WidgetFeatureOrAttribute::ModuleBase_WidgetFeatureOrAttribute(
+    QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId)
+    : ModuleBase_WidgetFeature(theParent, theData, theParentId)
 {
 }
 
@@ -46,8 +45,8 @@ bool ModuleBase_WidgetFeatureOrAttribute::setValue(ModuleBase_WidgetValue* theVa
   bool isDone = false;
 
   if (theValue) {
-    ModuleBase_WidgetValueFeature* aFeatureValue = 
-                         dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
+    ModuleBase_WidgetValueFeature* aFeatureValue =
+        dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
     if (aFeatureValue) {
       boost::shared_ptr<GeomAPI_Pnt2d> aValuePoint = aFeatureValue->point();
       ObjectPtr aObject = aFeatureValue->object();
@@ -58,14 +57,14 @@ bool ModuleBase_WidgetFeatureOrAttribute::setValue(ModuleBase_WidgetValue* theVa
         FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
         if (aFeature) {
           // find the given point in the feature attributes
-          std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes =
-                                        aFeature->data()->attributes(GeomDataAPI_Point2D::type());
-          std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
-                                                                            aLast = anAttiributes.end();
+          std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes = aFeature->data()
+              ->attributes(GeomDataAPI_Point2D::type());
+          std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes
+              .begin(), aLast = anAttiributes.end();
           boost::shared_ptr<GeomDataAPI_Point2D> aFPoint;
-          for (;anIt!=aLast && !aFPoint; anIt++) {
-            boost::shared_ptr<GeomDataAPI_Point2D> aCurPoint =
-                                                boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
+          for (; anIt != aLast && !aFPoint; anIt++) {
+            boost::shared_ptr<GeomDataAPI_Point2D> aCurPoint = boost::dynamic_pointer_cast<
+                GeomDataAPI_Point2D>(*anIt);
             if (aCurPoint && aCurPoint->pnt()->distance(aValuePoint) < Precision::Confusion())
               aFPoint = aCurPoint;
           }
@@ -87,8 +86,8 @@ bool ModuleBase_WidgetFeatureOrAttribute::storeValue() const
   //  return false;
 
   boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-          boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
 
   if (myObject)
     aRef->setObject(myObject);
@@ -104,8 +103,8 @@ bool ModuleBase_WidgetFeatureOrAttribute::storeValue() const
 bool ModuleBase_WidgetFeatureOrAttribute::restoreValue()
 {
   boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-          boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
 
   ObjectPtr aObj = aRef->object();
   FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
@@ -126,10 +125,9 @@ bool ModuleBase_WidgetFeatureOrAttribute::restoreValue()
 }
 
 bool ModuleBase_WidgetFeatureOrAttribute::setAttribute(
-                                    const boost::shared_ptr<ModelAPI_Attribute>& theAttribute,
-                                    bool theSendEvent)
+    const boost::shared_ptr<ModelAPI_Attribute>& theAttribute, bool theSendEvent)
 {
-  if (!theAttribute)// || !featureKinds().contains(theAttribute->attributeType().c_str()))
+  if (!theAttribute)  // || !featureKinds().contains(theAttribute->attributeType().c_str()))
     return false;
 
   myAttribute = theAttribute;
index 0518409bd1198d69545d8adedcdf0a27fe33d01a..8ba8d352ce320dad5781d47b2ce3d46ce918539a 100644 (file)
@@ -19,13 +19,14 @@ class ModelAPI_Attribute;
  */
 class MODULEBASE_EXPORT ModuleBase_WidgetFeatureOrAttribute : public ModuleBase_WidgetFeature
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Constructor
   /// \theParent the parent object
   /// \theParent the parent object
   /// \theData the widget configuation. The attribute of the model widget is obtained from
-  ModuleBase_WidgetFeatureOrAttribute(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId);
+  ModuleBase_WidgetFeatureOrAttribute(QWidget* theParent, const Config_WidgetAPI* theData,
+                                      const std::string& theParentId);
   /// Destructor
   virtual ~ModuleBase_WidgetFeatureOrAttribute();
 
@@ -40,15 +41,15 @@ public:
 
   virtual bool restoreValue();
 
-protected:
+ protected:
   /// Set the attribute
   /// \param theAttribute value
   /// \return the boolean result of the attribute set
-  bool setAttribute(const boost::shared_ptr<ModelAPI_Attribute>& theAttribute, 
-                    bool theSendEvent = true);
+  bool setAttribute(const boost::shared_ptr<ModelAPI_Attribute>& theAttribute, bool theSendEvent =
+                        true);
 
-protected:
-  boost::shared_ptr<ModelAPI_Attribute> myAttribute; /// < the attribute
+ protected:
+  boost::shared_ptr<ModelAPI_Attribute> myAttribute;  /// < the attribute
 };
 
 #endif
index cd88c57b7d188e7f1ff5514b2437681db93b62f1..5e447ef1deeeaa74f9fd8cc17ccc4dba815d6e4a 100644 (file)
@@ -28,9 +28,9 @@
 #include <climits>
 
 ModuleBase_WidgetPoint2D::ModuleBase_WidgetPoint2D(QWidget* theParent,
-                                                   const Config_WidgetAPI* theData, 
+                                                   const Config_WidgetAPI* theData,
                                                    const std::string& theParentId)
-: ModuleBase_ModelWidget(theParent, theData, theParentId)
+    : ModuleBase_ModelWidget(theParent, theData, theParentId)
 {
   myOptionParam = theData->getProperty(PREVIOUS_FEATURE_PARAM);
   myGroupBox = new QGroupBox(QString::fromStdString(theData->getProperty(CONTAINER_PAGE_NAME)),
@@ -49,7 +49,7 @@ ModuleBase_WidgetPoint2D::ModuleBase_WidgetPoint2D(QWidget* theParent,
     myXSpin->setMaximum(DBL_MAX);
     myXSpin->setToolTip("X");
     aGroupLay->addWidget(myXSpin, 0, 1);
-    
+
     connect(myXSpin, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged()));
   }
   {
@@ -78,8 +78,8 @@ bool ModuleBase_WidgetPoint2D::setValue(ModuleBase_WidgetValue* theValue)
 {
   bool isDone = false;
   if (theValue) {
-    ModuleBase_WidgetValueFeature* aFeatureValue = 
-                         dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
+    ModuleBase_WidgetValueFeature* aFeatureValue =
+        dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
     if (aFeatureValue) {
       boost::shared_ptr<GeomAPI_Pnt2d> aPoint = aFeatureValue->point();
       if (aPoint) {
@@ -105,8 +105,8 @@ void ModuleBase_WidgetPoint2D::setPoint(const boost::shared_ptr<GeomAPI_Pnt2d>&
 bool ModuleBase_WidgetPoint2D::storeValue() const
 {
   boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(attributeID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(attributeID()));
 
   ModuleBase_WidgetPoint2D* that = (ModuleBase_WidgetPoint2D*) this;
   bool isBlocked = that->blockSignals(true);
@@ -120,8 +120,8 @@ bool ModuleBase_WidgetPoint2D::storeValue() const
 bool ModuleBase_WidgetPoint2D::restoreValue()
 {
   boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(attributeID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(attributeID()));
 
   bool isBlocked = this->blockSignals(true);
   myXSpin->setValue(aPoint->x());
@@ -148,7 +148,7 @@ bool ModuleBase_WidgetPoint2D::eventFilter(QObject *theObject, QEvent *theEvent)
 {
   if (theObject == myXSpin || theObject == myYSpin) {
     if (theEvent->type() == QEvent::KeyRelease) {
-      QKeyEvent* aKeyEvent = (QKeyEvent*)theEvent;
+      QKeyEvent* aKeyEvent = (QKeyEvent*) theEvent;
       if (aKeyEvent && aKeyEvent->key() == Qt::Key_Return) {
         emit focusOutWidget(this);
       }
@@ -164,8 +164,8 @@ bool ModuleBase_WidgetPoint2D::initFromPrevious(ObjectPtr theObject)
   if (myOptionParam.length() == 0)
     return false;
   boost::shared_ptr<ModelAPI_Data> aData = theObject->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(myOptionParam));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(myOptionParam));
   if (aPoint) {
     bool isBlocked = this->blockSignals(true);
     myXSpin->setValue(aPoint->x());
index 77fbd74eee380035412274465eab65596b922668..e5d324a83e4519719c68fa53817a5e79ef4891d2 100644 (file)
@@ -23,13 +23,14 @@ class QDoubleSpinBox;
  */
 class MODULEBASE_EXPORT ModuleBase_WidgetPoint2D : public ModuleBase_ModelWidget
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Constructor
   /// \theParent the parent object
   /// \theParent the parent object
   /// \theData the widget configuation. The attribute of the model widget is obtained from
-  ModuleBase_WidgetPoint2D(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId);
+  ModuleBase_WidgetPoint2D(QWidget* theParent, const Config_WidgetAPI* theData,
+                           const std::string& theParentId);
   /// Destructor
   virtual ~ModuleBase_WidgetPoint2D();
 
@@ -65,17 +66,17 @@ signals:
   /// \param the attribute of the feature
   void storedPoint2D(ObjectPtr theObject, const std::string& theAttribute);
 
-protected:
+ protected:
   /// Fill the widget values by given point
   /// \param thePoint the point
   void setPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
 
-private:
-  QGroupBox* myGroupBox; ///< the parent group box for all intenal widgets
-  QDoubleSpinBox* myXSpin; ///< the spin box for the X coordinate
-  QDoubleSpinBox* myYSpin; ///< the spin box for the Y coordinate
+ private:
+  QGroupBox* myGroupBox;  ///< the parent group box for all intenal widgets
+  QDoubleSpinBox* myXSpin;  ///< the spin box for the X coordinate
+  QDoubleSpinBox* myYSpin;  ///< the spin box for the Y coordinate
 
-  std::string myOptionParam; /// Parameter name which has to be taken from previous feature
+  std::string myOptionParam;  /// Parameter name which has to be taken from previous feature
 };
 
 #endif
index ef5cf3207b1a193cf12632dc0906fa350499277d..1a100c57bdf806eba251facd01c351b07a82e917 100644 (file)
 
 #include <QDoubleSpinBox>
 
-ModuleBase_WidgetPoint2dDistance::ModuleBase_WidgetPoint2dDistance(QWidget* theParent, 
-  const Config_WidgetAPI* theData, const std::string& theParentId)
-  : ModuleBase_WidgetDoubleValue(theParent, theData, theParentId)
+ModuleBase_WidgetPoint2dDistance::ModuleBase_WidgetPoint2dDistance(QWidget* theParent,
+                                                                   const Config_WidgetAPI* theData,
+                                                                   const std::string& theParentId)
+    : ModuleBase_WidgetDoubleValue(theParent, theData, theParentId)
 {
   myFirstPntName = theData->getProperty("first_point");
 }
@@ -30,8 +31,8 @@ bool ModuleBase_WidgetPoint2dDistance::setValue(ModuleBase_WidgetValue* theValue
   bool isDone = false;
 
   if (theValue) {
-    ModuleBase_WidgetValueFeature* aFeatureValue = 
-                         dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
+    ModuleBase_WidgetValueFeature* aFeatureValue =
+        dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
     if (aFeatureValue) {
       boost::shared_ptr<GeomAPI_Pnt2d> aPnt = aFeatureValue->point();
       ObjectPtr aObject = aFeatureValue->object();
@@ -45,12 +46,14 @@ bool ModuleBase_WidgetPoint2dDistance::setValue(ModuleBase_WidgetValue* theValue
   return isDone;
 }
 
-void ModuleBase_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature, const boost::shared_ptr<GeomAPI_Pnt2d>& thePnt)
+void ModuleBase_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature,
+                                                const boost::shared_ptr<GeomAPI_Pnt2d>& thePnt)
 {
   boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                                              (aData->attribute(myFirstPntName));
-  if (!aPoint) return;
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(myFirstPntName));
+  if (!aPoint)
+    return;
 
   double aRadius = thePnt->distance(aPoint->pnt());
   AttributeDoublePtr aReal = aData->real(attributeID());
@@ -58,4 +61,4 @@ void ModuleBase_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature, const boo
     aReal->setValue(aRadius);
     mySpinBox->setValue(aRadius);
   }
-}
\ No newline at end of file
+}
index 3ab47c62c85e74e71c52f00799f72163c60919b5..164e78bac87f7d8ecc7010f7c1562642b52b48b5 100644 (file)
@@ -2,7 +2,6 @@
 // Created:     23 June 2014
 // Author:      Vitaly Smetannikov
 
-
 #ifndef ModuleBase_WidgetPoint2dDistance_H
 #define ModuleBase_WidgetPoint2dDistance_H
 
 class ModuleBase_WidgetValue;
 class GeomAPI_Pnt2d;
 
-class MODULEBASE_EXPORT ModuleBase_WidgetPoint2dDistance: public ModuleBase_WidgetDoubleValue
+class MODULEBASE_EXPORT ModuleBase_WidgetPoint2dDistance : public ModuleBase_WidgetDoubleValue
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Constructor
   /// \theParent the parent object
   /// \theData the widget configuation. The attribute of the model widget is obtained from
-  ModuleBase_WidgetPoint2dDistance(QWidget* theParent, const Config_WidgetAPI* theData, const std::string& theParentId);
+  ModuleBase_WidgetPoint2dDistance(QWidget* theParent, const Config_WidgetAPI* theData,
+                                   const std::string& theParentId);
 
   virtual ~ModuleBase_WidgetPoint2dDistance();
 
@@ -28,13 +28,12 @@ public:
   /// \param theValue the wrapped widget value
   virtual bool setValue(ModuleBase_WidgetValue* theValue);
 
-protected:
+ protected:
   /// Set the second point which defines a value in the widget as a distance with a first point defined by feature
   void setPoint(FeaturePtr theFeature, const boost::shared_ptr<GeomAPI_Pnt2d>& thePnt);
 
-private:
+ private:
   std::string myFirstPntName;
 };
 
-
-#endif
\ No newline at end of file
+#endif
index c0933f566f361fd97bf3dd3ab1fdf277da4b0be1..ff187372cba1b6fe19dc775ae560d1380d20e665 100644 (file)
@@ -2,7 +2,6 @@
 // Created:     2 June 2014
 // Author:      Vitaly Smetannikov
 
-
 #include "ModuleBase_WidgetSelector.h"
 #include "ModuleBase_IWorkshop.h"
 
@@ -32,7 +31,6 @@
 
 #include <stdexcept>
 
-
 typedef QMap<QString, TopAbs_ShapeEnum> ShapeTypes;
 static ShapeTypes MyShapeTypes;
 
@@ -46,19 +44,18 @@ TopAbs_ShapeEnum ModuleBase_WidgetSelector::shapeType(const QString& theType)
     MyShapeTypes["shell"] = TopAbs_SHELL;
     MyShapeTypes["solid"] = TopAbs_SOLID;
   }
-  if (MyShapeTypes.contains(theType)) 
+  if (MyShapeTypes.contains(theType))
     return MyShapeTypes[theType];
   throw std::invalid_argument("Shape type defined in XML is not implemented!");
 }
 
-
-
-
-ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent, 
-                                                     ModuleBase_IWorkshop* theWorkshop, 
+ModuleBase_WidgetSelector::ModuleBase_WidgetSelector(QWidget* theParent,
+                                                     ModuleBase_IWorkshop* theWorkshop,
                                                      const Config_WidgetAPI* theData,
                                                      const std::string& theParentId)
-: ModuleBase_ModelWidget(theParent, theData, theParentId), myWorkshop(theWorkshop), myActivateOnStart(false)
+    : ModuleBase_ModelWidget(theParent, theData, theParentId),
+      myWorkshop(theWorkshop),
+      myActivateOnStart(false)
 {
   myContainer = new QWidget(theParent);
   QHBoxLayout* aLayout = new QHBoxLayout(myContainer);
@@ -105,12 +102,12 @@ ModuleBase_WidgetSelector::~ModuleBase_WidgetSelector()
 bool ModuleBase_WidgetSelector::storeValue() const
 {
   FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(mySelectedObject);
-  if (aSelectedFeature == myFeature) // In order to avoid selection of the same object
+  if (aSelectedFeature == myFeature)  // In order to avoid selection of the same object
     return false;
 
   DataPtr aData = myFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeReference> aRef = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(attributeID()));
+  boost::shared_ptr<ModelAPI_AttributeReference> aRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeReference>(aData->attribute(attributeID()));
 
   ObjectPtr aObject = aRef->value();
   if (!(aObject && aObject->isSame(mySelectedObject))) {
@@ -128,7 +125,7 @@ bool ModuleBase_WidgetSelector::restoreValue()
 
   bool isBlocked = this->blockSignals(true);
   mySelectedObject = aRef->value();
-  updateSelectionName(); 
+  updateSelectionName();
 
   this->blockSignals(isBlocked);
   return true;
@@ -156,7 +153,8 @@ void ModuleBase_WidgetSelector::onSelectionChanged()
       return;
 
     // Check that the selection corresponds to selection type
-    if (!isAccepted(aObject)) return;
+    if (!isAccepted(aObject))
+      return;
 
     mySelectedObject = aObject;
     if (mySelectedObject) {
@@ -175,19 +173,23 @@ bool ModuleBase_WidgetSelector::isAccepted(const ObjectPtr theResult) const
 {
   ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theResult);
   boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
-  if (!aShapePtr) return false;
+  if (!aShapePtr)
+    return false;
   TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
-  if (aShape.IsNull()) return false;
+  if (aShape.IsNull())
+    return false;
 
   TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
   if (aShapeType == TopAbs_COMPOUND) {
-    foreach (QString aType, myShapeTypes) {
+    foreach (QString aType, myShapeTypes)
+    {
       TopExp_Explorer aEx(aShape, shapeType(aType));
       if (aEx.More())
         return true;
     }
   } else {
-    foreach (QString aType, myShapeTypes) {
+    foreach (QString aType, myShapeTypes)
+    {
       if (shapeType(aType) == aShapeType)
         return true;
     }
@@ -200,9 +202,9 @@ void ModuleBase_WidgetSelector::updateSelectionName()
 {
   if (mySelectedObject) {
     std::string aName = mySelectedObject->data()->name();
+
     myTextLine->setText(QString::fromStdString(aName));
-  } else 
+  } else
     myTextLine->setText("");
 }
 
@@ -223,8 +225,10 @@ void ModuleBase_WidgetSelector::enableOthersControls(bool toEnable) const
 {
   QWidget* aParent = myContainer->parentWidget();
   QList<QWidget*> aChldList = aParent->findChildren<QWidget*>();
-  foreach(QWidget* aWgt, aChldList) {
-    if ((aWgt != myLabel) && (aWgt != myActivateBtn) && (aWgt != myTextLine) && (aWgt != myContainer))
+  foreach(QWidget* aWgt, aChldList)
+  {
+    if ((aWgt != myLabel) && (aWgt != myActivateBtn) && (aWgt != myTextLine)
+        && (aWgt != myContainer))
       aWgt->setEnabled(toEnable);
   }
 }
@@ -251,7 +255,8 @@ void ModuleBase_WidgetSelector::raisePanel() const
   while (!aParent->inherits("QDockWidget")) {
     aLastPanel = aParent;
     aParent = aParent->parentWidget();
-    if (!aParent) return;
+    if (!aParent)
+      return;
   }
   if (aParent->inherits("QDockWidget")) {
     QDockWidget* aTabWgt = (QDockWidget*) aParent;
index 9d71808489b8c119c753dddea333381ba0c3cda5..574ae0e8b5112c96598dd1a39e8ebe0e62415291 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <QStringList>
 
-
 class Config_WidgetAPI;
 class QWidget;
 class QLabel;
@@ -22,12 +21,11 @@ class QLineEdit;
 class QToolButton;
 class ModuleBase_IWorkshop;
 
-class MODULEBASE_EXPORT ModuleBase_WidgetSelector: public ModuleBase_ModelWidget
+class MODULEBASE_EXPORT ModuleBase_WidgetSelector : public ModuleBase_ModelWidget
 {
-  Q_OBJECT
-public:
-  ModuleBase_WidgetSelector(QWidget* theParent, 
-                            ModuleBase_IWorkshop* theWorkshop, 
+Q_OBJECT
+ public:
+  ModuleBase_WidgetSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
                             const Config_WidgetAPI* theData, const std::string& theParentId);
 
   virtual ~ModuleBase_WidgetSelector();
@@ -40,29 +38,41 @@ public:
 
   /// Returns the internal parent wiget control, that can be shown anywhere
   /// \returns the widget
-  QWidget* getControl() const { return myContainer; }
+  QWidget* getControl() const
+  {
+    return myContainer;
+  }
 
   /// Returns list of widget controls
   /// \return a control list
   virtual QList<QWidget*> getControls() const;
 
-  void setActivationOnStart(bool toActivate) { myActivateOnStart = toActivate; }
-  bool activateOnStart() const { return myActivateOnStart; }
+  void setActivationOnStart(bool toActivate)
+  {
+    myActivateOnStart = toActivate;
+  }
+  bool activateOnStart() const
+  {
+    return myActivateOnStart;
+  }
 
-  ObjectPtr selectedFeature() const { return mySelectedObject; }
+  ObjectPtr selectedFeature() const
+  {
+    return mySelectedObject;
+  }
 
-public slots:
+ public slots:
 
   /// Activate or deactivate selection
   void activateSelection(bool toActivate);
 
-protected:
+ protected:
   bool eventFilter(QObject* theObj, QEvent* theEvent);
 
-private slots:
+ private slots:
   void onSelectionChanged();
 
-private:
+ private:
   void enableOthersControls(bool toEnable) const;
   void updateSelectionName();
   void raisePanel() const;
@@ -70,9 +80,9 @@ private:
 
   static TopAbs_ShapeEnum shapeType(const QString& theType);
 
-  QWidget*     myContainer;
-  QLabel*      myLabel;
-  QLineEdit*   myTextLine;
+  QWidget* myContainer;
+  QLabel* myLabel;
+  QLineEdit* myTextLine;
   QToolButton* myActivateBtn;
 
   ModuleBase_IWorkshop* myWorkshop;
@@ -83,4 +93,4 @@ private:
   QStringList myShapeTypes;
 };
 
-#endif
\ No newline at end of file
+#endif
index 3024f116616dc303d4c14d46d7b73fe19e18c7fc..a6e20a8cfffc2f8a253c53c9cf8d6f6aede60278 100644 (file)
@@ -12,7 +12,7 @@
 #include <QSpacerItem>
 
 ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch(QWidget* parent)
-: QFrame(parent)
+    : QFrame(parent)
 {
   myMainLay = new QVBoxLayout(this);
   myMainLay->setContentsMargins(2, 4, 2, 2);
@@ -20,10 +20,8 @@ ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch(QWidget* parent)
   myCombo->hide();
   myMainLay->addWidget(myCombo);
   this->setFrameShape(QFrame::StyledPanel);
-  connect(myCombo, SIGNAL(currentIndexChanged(int)),
-          this, SLOT(setCurrentIndex(int)));
-  connect(myCombo, SIGNAL(currentIndexChanged(int)),
-          this, SIGNAL(currentPageChanged(int)));
+  connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setCurrentIndex(int)));
+  connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(currentPageChanged(int)));
 
 }
 
@@ -60,7 +58,7 @@ int ModuleBase_WidgetSwitch::indexOf(QWidget* theWidget) const
 int ModuleBase_WidgetSwitch::insertPage(int theIndex, QWidget* theWidget, const QString& theName)
 {
   int index = theIndex < count() ? theIndex : count();
-  if(count() == 0)
+  if (count() == 0)
     myCombo->show();
   myCombo->insertItem(index, theName);
   myCases.insert(index, theWidget);
@@ -116,10 +114,11 @@ void ModuleBase_WidgetSwitch::setCurrentIndex(int index)
 
 void ModuleBase_WidgetSwitch::refresh()
 {
-  foreach(QWidget* eachWidget, myCases) {
+  foreach(QWidget* eachWidget, myCases)
+  {
     eachWidget->setVisible(false);
   }
-  if(currentIndex() >= myCases.count())
+  if (currentIndex() >= myCases.count())
     return;
   myCases[currentIndex()]->setVisible(true);
 }
index 08ce3bc711721e9fd37f55681b1f99066b5f2780..f7a442e41ad12b9cf8528b3dd80909b14f204a3f 100644 (file)
 class QComboBox;
 class QVBoxLayout;
 
-class MODULEBASE_EXPORT ModuleBase_WidgetSwitch: public QFrame
+class MODULEBASE_EXPORT ModuleBase_WidgetSwitch : public QFrame
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   ModuleBase_WidgetSwitch(QWidget* parent = NULL);
   virtual ~ModuleBase_WidgetSwitch();
 
@@ -35,16 +35,16 @@ public:
   void setPageName(int index, const QString & text);
   void setPageToolTip(int index, const QString & toolTip);
 
-public slots:
+ public slots:
   void setCurrentIndex(int index);
 
 signals:
   void currentPageChanged(int);
 
-protected:
+ protected:
   void refresh();
 
-private:
+ private:
   QVBoxLayout* myMainLay;
   QComboBox* myCombo;
   QWidgetList myCases;
index 983d39d7633d13f89f2b42e4507abf7c3a2a051a..38b8e51b32c180bd841aaee26e68d36cfa834da0 100644 (file)
@@ -13,7 +13,7 @@
  */
 class MODULEBASE_EXPORT ModuleBase_WidgetValue
 {
-public:
+ public:
   /// Constructor
   ModuleBase_WidgetValue();
   /// Destructor
index 1a1f10164d96777536fc5dd93e5842df3b28309c..a40cbd06df2e58c8c47f6a87ced01969c6eedc3b 100644 (file)
@@ -20,7 +20,7 @@ class GeomAPI_Pnt2d;
  */
 class MODULEBASE_EXPORT ModuleBase_WidgetValueFeature : public ModuleBase_WidgetValue
 {
-public:
+ public:
   /// Constructor
   ModuleBase_WidgetValueFeature();
   /// Destructor
@@ -42,7 +42,7 @@ public:
   /// \return the current point
   const boost::shared_ptr<GeomAPI_Pnt2d>& point() const;
 
-private:
+ private:
   ObjectPtr myResult;
   boost::shared_ptr<GeomAPI_Pnt2d> myPoint;
 };
index 78f0f99305a64f5182a5db4f5ebc61ddd31dccf0..4490c442b461961206ff1266f2160e0c5bd70a87 100644 (file)
@@ -17,5 +17,3 @@
 
 #endif
 
-
-
index 371fe7a4bc854fa2fb27589d9356269057f04a0d..99327c50c4fef35da0a2e4b9e6168fcf9afe4693 100644 (file)
@@ -1,30 +1,28 @@
-
 #include "NewGeom_DataModel.h"
 
-
-NewGeom_DataModel::NewGeom_DataModel( CAM_Module* theModule )
-  : LightApp_DataModel(theModule)
+NewGeom_DataModel::NewGeom_DataModel(CAM_Module* theModule)
+    : LightApp_DataModel(theModule)
 {
 }
-  
+
 NewGeom_DataModel::~NewGeom_DataModel()
 {
 }
 
-bool NewGeom_DataModel::open( const QString& thePath, CAM_Study* theStudy, QStringList theFiles )
+bool NewGeom_DataModel::open(const QString& thePath, CAM_Study* theStudy, QStringList theFiles)
 {
   return true;
 }
 
-bool NewGeom_DataModel::save( QStringList& theFiles )
+bool NewGeom_DataModel::save(QStringList& theFiles)
 {
   return true;
 }
 
-bool NewGeom_DataModel::saveAs( const QString& thePath, CAM_Study* theStudy, QStringList& theFiles )
+bool NewGeom_DataModel::saveAs(const QString& thePath, CAM_Study* theStudy, QStringList& theFiles)
 {
   myStudyPath = thePath;
-  return save( theFiles );
+  return save(theFiles);
 }
 
 bool NewGeom_DataModel::close()
@@ -32,7 +30,7 @@ bool NewGeom_DataModel::close()
   return LightApp_DataModel::close();
 }
 
-bool NewGeom_DataModel::create( CAM_Study* theStudy )
+bool NewGeom_DataModel::create(CAM_Study* theStudy)
 {
   return true;
 }
@@ -47,6 +45,6 @@ bool NewGeom_DataModel::isSaved() const
   return true;
 }
 
-void NewGeom_DataModel::update( LightApp_DataObject* theObj, LightApp_Study* theStudy )
+void NewGeom_DataModel::update(LightApp_DataObject* theObj, LightApp_Study* theStudy)
 {
 }
index 66c6bf84d0f93578bc1bff4aa975bd18ff5b7db8..7beaf392fcf16fad598ccfe10f49f446214c2878 100644 (file)
@@ -1,5 +1,4 @@
 
-
 #ifndef NEWGEOM_DATAMODEL_H
 #define NEWGEOM_DATAMODEL_H
 
@@ -9,24 +8,24 @@
 class NewGeom_EXPORT NewGeom_DataModel : public LightApp_DataModel
 {
   Q_OBJECT
-public:
-  NewGeom_DataModel( CAM_Module* theModule );
+ public:
+  NewGeom_DataModel(CAM_Module* theModule);
   virtual ~NewGeom_DataModel();
 
-  virtual bool open( const QString& thePath, CAM_Study* theStudy, QStringList theFiles );
-  virtual bool save( QStringList& theFiles );
-  virtual bool saveAs( const QString& thePath, CAM_Study* theStudy, QStringList& theFiles );
+  virtual bool open(const QString& thePath, CAM_Study* theStudy, QStringList theFiles);
+  virtual bool save(QStringList& theFiles);
+  virtual bool saveAs(const QString& thePath, CAM_Study* theStudy, QStringList& theFiles);
   virtual bool close();
-  virtual bool create( CAM_Study* theStudy );
+  virtual bool create(CAM_Study* theStudy);
 
   virtual bool isModified() const;
   virtual bool isSaved() const;
 
-  virtual void update( LightApp_DataObject* theObj = 0, LightApp_Study* theStudy = 0 );
+  virtual void update(LightApp_DataObject* theObj = 0, LightApp_Study* theStudy = 0);
 
-private:
+ private:
   QString myStudyPath;
 
 };
 
-#endif
\ No newline at end of file
+#endif
index fc07f5d55bf7f280db540e4aed232fa1fc4e5585..a4caf653cb0924c3dc0ebfff2e4c2802ca0f393d 100644 (file)
@@ -1,5 +1,4 @@
 
-
 #include "NewGeom_Module.h"
 #include "NewGeom_DataModel.h"
 #include "NewGeom_OCCSelector.h"
 #include <QAction>
 
 extern "C" {
-  NewGeom_EXPORT CAM_Module* createModule() {
-    return new NewGeom_Module();
-  }
-    
-  NewGeom_EXPORT char* getModuleVersion() {
-    return "0.0";
-  }
+NewGeom_EXPORT CAM_Module* createModule()
+{
+  return new NewGeom_Module();
 }
 
+NewGeom_EXPORT char* getModuleVersion()
+{
+  return "0.0";
+}
+}
 
 //******************************************************
 NewGeom_Module::NewGeom_Module()
-: LightApp_Module( "NewGeom" ), mySelector(0)
+    : LightApp_Module("NewGeom"),
+      mySelector(0)
 {
   myWorkshop = new XGUI_Workshop(this);
   myProxyViewer = new NewGeom_SalomeViewer(this);
@@ -51,20 +52,20 @@ NewGeom_Module::~NewGeom_Module()
 void NewGeom_Module::initialize(CAM_Application* theApp)
 {
   LightApp_Module::initialize(theApp);
-  
+
   myWorkshop->startApplication();
 }
 
 //******************************************************
 void NewGeom_Module::windows(QMap<int, int>& theWndMap) const
 {
-  theWndMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
+  theWndMap.insert(LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea);
 }
 
 //******************************************************
 void NewGeom_Module::viewManagers(QStringList& theList) const
 {
-  theList.append( OCCViewer_Viewer::Type() );
+  theList.append(OCCViewer_Viewer::Type());
 }
 
 //******************************************************
@@ -72,8 +73,8 @@ bool NewGeom_Module::activateModule(SUIT_Study* theStudy)
 {
   bool isDone = LightApp_Module::activateModule(theStudy);
   if (isDone) {
-    setMenuShown( true );
-    setToolShown( true );
+    setMenuShown(true);
+    setToolShown(true);
 
     if (!mySelector) {
       ViewManagerList OCCViewManagers;
@@ -83,7 +84,7 @@ bool NewGeom_Module::activateModule(SUIT_Study* theStudy)
       }
     }
     myWorkshop->propertyPanel()->hide();
-    QtxPopupMgr* aMgr = popupMgr(); // Create popup manager
+    QtxPopupMgr* aMgr = popupMgr();  // Create popup manager
     action(myEraseAll)->setEnabled(false);
   }
   return isDone;
@@ -92,14 +93,14 @@ bool NewGeom_Module::activateModule(SUIT_Study* theStudy)
 //******************************************************
 bool NewGeom_Module::deactivateModule(SUIT_Study* theStudy)
 {
-  setMenuShown( false );
-  setToolShown( false );
+  setMenuShown(false);
+  setToolShown(false);
   //myWorkshop->contextMenuMgr()->disconnectViewer();
   return LightApp_Module::deactivateModule(theStudy);
 }
 
 //******************************************************
-void NewGeom_Module::onViewManagerAdded( SUIT_ViewManager* theMgr )
+void NewGeom_Module::onViewManagerAdded(SUIT_ViewManager* theMgr)
 {
   if ((!mySelector)) {
     mySelector = createSelector(theMgr);
@@ -111,12 +112,12 @@ NewGeom_OCCSelector* NewGeom_Module::createSelector(SUIT_ViewManager* theMgr)
 {
   if (theMgr->getType() == OCCViewer_Viewer::Type()) {
     OCCViewer_Viewer* aViewer = static_cast<OCCViewer_Viewer*>(theMgr->getViewModel());
-    NewGeom_OCCSelector* aSelector = new NewGeom_OCCSelector(aViewer, 
-                                                             getApp()->selectionMgr());
+    NewGeom_OCCSelector* aSelector = new NewGeom_OCCSelector(aViewer, getApp()->selectionMgr());
     LightApp_SelectionMgr* aMgr = getApp()->selectionMgr();
     QList<SUIT_Selector*> aList;
     aMgr->selectors(aList);
-    foreach(SUIT_Selector* aSel, aList) {
+    foreach(SUIT_Selector* aSel, aList)
+    {
       aSel->setEnabled(aSel == aSelector);
     }
     myProxyViewer->setSelector(aSelector);
@@ -128,16 +129,13 @@ NewGeom_OCCSelector* NewGeom_Module::createSelector(SUIT_ViewManager* theMgr)
 //******************************************************
 CAM_DataModel* NewGeom_Module::createDataModel()
 {
-  return new NewGeom_DataModel( this );
+  return new NewGeom_DataModel(this);
 }
 
 //******************************************************
-QAction* NewGeom_Module::addFeature(const QString& theWBName,
-                                    const QString& theId, 
-                                    const QString& theTitle, 
-                                    const QString& theTip,
-                                    const QIcon& theIcon, 
-                                    const QKeySequence& theKeys,
+QAction* NewGeom_Module::addFeature(const QString& theWBName, const QString& theId,
+                                    const QString& theTitle, const QString& theTip,
+                                    const QIcon& theIcon, const QKeySequence& theKeys,
                                     bool isCheckable)
 {
   int aMenu = createMenu(theWBName, -1, -1, 50);
@@ -147,44 +145,41 @@ QAction* NewGeom_Module::addFeature(const QString& theWBName,
   myActionsList.append(theId);
   SUIT_Desktop* aDesk = application()->desktop();
   int aKeys = 0;
-  for (int i = 0; i < theKeys.count(); i++) 
+  for (int i = 0; i < theKeys.count(); i++)
     aKeys += theKeys[i];
-  QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk, 
+  QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
                                   isCheckable);
   aAction->setData(theId);
-  int aItemId = createMenu( aId,  aMenu, -1, 10 );
-  int aToolId = createTool( aId, aTool );
+  int aItemId = createMenu(aId, aMenu, -1, 10);
+  int aToolId = createTool(aId, aTool);
   return aAction;
 }
 
 //******************************************************
-QAction* NewGeom_Module::addEditCommand(const QString& theId,
-                                        const QString& theTitle,
-                                        const QString& theTip,
-                                        const QIcon& theIcon, 
-                                        const QKeySequence& theKeys,
-                                        bool isCheckable)
+QAction* NewGeom_Module::addEditCommand(const QString& theId, const QString& theTitle,
+                                        const QString& theTip, const QIcon& theIcon,
+                                        const QKeySequence& theKeys, bool isCheckable)
 {
-  int aMenu = createMenu(tr( "MEN_DESK_EDIT" ), -1, -1);
+  int aMenu = createMenu(tr("MEN_DESK_EDIT"), -1, -1);
 
   int aId = myActionsList.size();
   myActionsList.append(theId);
   SUIT_Desktop* aDesk = application()->desktop();
   int aKeys = 0;
-  for (int i = 0; i < theKeys.count(); i++) 
+  for (int i = 0; i < theKeys.count(); i++)
     aKeys += theKeys[i];
-  QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk, 
+  QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
                                   isCheckable);
   aAction->setData(theId);
-  createMenu( aId, aMenu, 10 );
+  createMenu(aId, aMenu, 10);
   return aAction;
 }
 
 //******************************************************
 void NewGeom_Module::addEditMenuSeparator()
 {
-  int aMenu = createMenu(tr( "MEN_DESK_EDIT" ), -1, -1);
-  createMenu( separator(), aMenu, -1, 10 );
+  int aMenu = createMenu(tr("MEN_DESK_EDIT"), -1, -1);
+  createMenu(separator(), aMenu, -1, 10);
 }
 
 //******************************************************
@@ -253,4 +248,4 @@ void NewGeom_Module::contextMenuPopup(const QString& theClient, QMenu* theMenu,
 {
   myWorkshop->contextMenuMgr()->addViewerItems(theMenu);
   LightApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
-}
\ No newline at end of file
+}
index 78cc95fba730ed4993f1587facaf8743d325ecad..d300655a3c87aca98897a54e11433530ecde9eb7 100644 (file)
@@ -1,5 +1,4 @@
 
-
 #ifndef NewGeom_Module_H
 #define NewGeom_Module_H
 
 #include <QStringList>
 #include <QMap>
 
-class XGUI_Workshop; 
+class XGUI_Workshop;
 class NewGeom_OCCSelector;
 class OCCViewer_Viewer;
 
 /** 
-* An implementation of SALOME connector class for implementation of
-* XGUI functionality as a module of SALOME
-*/
-class NewGeom_EXPORT NewGeom_Module: public LightApp_Module, public XGUI_SalomeConnector
+ * An implementation of SALOME connector class for implementation of
+ * XGUI functionality as a module of SALOME
+ */
+class NewGeom_EXPORT NewGeom_Module : public LightApp_Module, public XGUI_SalomeConnector
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   NewGeom_Module();
   virtual ~NewGeom_Module();
 
   //----- LightAPP_Module interface ---------------
-  virtual void initialize( CAM_Application* theApp);
-  virtual void windows( QMap<int, int>& theWndMap) const;
-  virtual void viewManagers( QStringList& theList) const;
+  virtual void initialize(CAM_Application* theApp);
+  virtual void windows(QMap<int, int>& theWndMap) const;
+  virtual void viewManagers(QStringList& theList) const;
   virtual void selectionChanged();
 
   //--- XGUI connector interface -----
-  virtual QAction* addFeature(const QString& theWBName,
-                              const QString& theId, 
-                              const QString& theTitle, 
-                              const QString& theTip,
-                              const QIcon& theIcon, 
+  virtual QAction* addFeature(const QString& theWBName, const QString& theId,
+                              const QString& theTitle, const QString& theTip, const QIcon& theIcon,
                               const QKeySequence& theKeys = QKeySequence(),
                               bool isCheckable = false);
 
-  virtual QAction* addEditCommand(const QString& theId,
-                                  const QString& theTitle,
-                                  const QString& theTip,
-                                  const QIcon& theIcon, 
-                                  const QKeySequence& theKeys,
-                                  bool isCheckable);
+  virtual QAction* addEditCommand(const QString& theId, const QString& theTitle,
+                                  const QString& theTip, const QIcon& theIcon,
+                                  const QKeySequence& theKeys, bool isCheckable);
 
   virtual void addEditMenuSeparator();
 
@@ -66,7 +59,10 @@ public:
   virtual QStringList nestedActions(const QString& theId) const;
 
   //! Returns interface to Salome viewer
-  virtual XGUI_SalomeViewer* viewer() const { return myProxyViewer; }
+  virtual XGUI_SalomeViewer* viewer() const
+  {
+    return myProxyViewer;
+  }
 
   //! Returns list of defined actions (just by NewGeom module)
   virtual QList<QAction*> commandList() const;
@@ -76,18 +72,17 @@ public:
 
   virtual void contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle);
 
-public slots:
-  virtual bool activateModule( SUIT_Study* theStudy);
-  virtual bool deactivateModule( SUIT_Study* theStudy);
+ public slots:
+  virtual bool activateModule(SUIT_Study* theStudy);
+  virtual bool deactivateModule(SUIT_Study* theStudy);
 
-protected slots:
-  virtual void onViewManagerAdded( SUIT_ViewManager* theMgr );
+ protected slots:
+  virtual void onViewManagerAdded(SUIT_ViewManager* theMgr);
 
-protected:
+ protected:
   CAM_DataModel* createDataModel();
 
-
-private:
+ private:
   NewGeom_OCCSelector* createSelector(SUIT_ViewManager* theMgr);
 
   QStringList myActionsList;
index b7442acb4db0313022038861612b2e417f9d2b64..a5c39b12bba14dc112158d967b1601afb5544587 100644 (file)
@@ -1,8 +1,7 @@
 #include "NewGeom_OCCSelector.h"
 
-NewGeom_OCCSelector::NewGeom_OCCSelector( OCCViewer_Viewer* theViewer, 
-                                         SUIT_SelectionMgr* theMgr)
-: LightApp_OCCSelector(theViewer, theMgr)
+NewGeom_OCCSelector::NewGeom_OCCSelector(OCCViewer_Viewer* theViewer, SUIT_SelectionMgr* theMgr)
+    : LightApp_OCCSelector(theViewer, theMgr)
 {
 }
 
@@ -10,14 +9,14 @@ NewGeom_OCCSelector::~NewGeom_OCCSelector()
 {
 }
 
-void NewGeom_OCCSelector::getSelection( SUIT_DataOwnerPtrList& thePtrList ) const
+void NewGeom_OCCSelector::getSelection(SUIT_DataOwnerPtrList& thePtrList) const
 {
   OCCViewer_Viewer* vw = viewer();
   if (!vw)
     return;
 }
 
-void NewGeom_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& thePtrList )
+void NewGeom_OCCSelector::setSelection(const SUIT_DataOwnerPtrList& thePtrList)
 {
   OCCViewer_Viewer* vw = viewer();
   if (!vw)
index ae6b1cbea85f04427d555c24f45def878c4f624d..ce9a84615ed7868e85b1fed9b83bbd7721930852 100644 (file)
@@ -7,13 +7,13 @@
 
 class NewGeom_EXPORT NewGeom_OCCSelector : public LightApp_OCCSelector
 {
-public:
-  NewGeom_OCCSelector( OCCViewer_Viewer* theViewer, SUIT_SelectionMgr* theMgr );
+ public:
+  NewGeom_OCCSelector(OCCViewer_Viewer* theViewer, SUIT_SelectionMgr* theMgr);
   virtual ~NewGeom_OCCSelector();
 
-protected:
-  virtual void getSelection( SUIT_DataOwnerPtrList& theList ) const;
-  virtual void setSelection( const SUIT_DataOwnerPtrList& theList );
+ protected:
+  virtual void getSelection(SUIT_DataOwnerPtrList& theList) const;
+  virtual void setSelection(const SUIT_DataOwnerPtrList& theList);
 };
 
-#endif
\ No newline at end of file
+#endif
index 99a99d328f23807bfbf2283e41a6640dd2982f58..f63b3d77c17961b0f92a879d55782c74a471f7cb 100644 (file)
@@ -1,4 +1,3 @@
-
 #include "NewGeom_SalomeViewer.h"
 #include "NewGeom_OCCSelector.h"
 
@@ -11,9 +10,9 @@
 #include <QMouseEvent>
 #include <QContextMenuEvent>
 
-
 NewGeom_SalomeViewer::NewGeom_SalomeViewer(QObject* theParent)
-: XGUI_SalomeViewer(theParent), mySelector(0)
+    : XGUI_SalomeViewer(theParent),
+      mySelector(0)
 {
 }
 
@@ -52,32 +51,26 @@ void NewGeom_SalomeViewer::setSelector(NewGeom_OCCSelector* theSel)
   OCCViewer_Viewer* aViewer = mySelector->viewer();
   SUIT_ViewManager* aMgr = aViewer->getViewManager();
 
-  connect(aMgr, SIGNAL(lastViewClosed(SUIT_ViewManager*)),
-          this, SIGNAL(lastViewClosed()));
-  connect(aMgr, SIGNAL(tryCloseView(SUIT_ViewManager*)),
-          this, SIGNAL(tryCloseView()));
-  connect(aMgr, SIGNAL(deleteView(SUIT_ViewManager*)),
-          this, SIGNAL(deleteView()));
-  connect(aMgr, SIGNAL(viewCreated(SUIT_ViewManager*)),
-          this, SIGNAL(viewCreated()));
-  connect(aMgr, SIGNAL(activated(SUIT_ViewManager*)),
-          this, SIGNAL(activated()));
-
-  connect(aMgr, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
-          this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
-  connect(aMgr, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)),
-          this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
-  connect(aMgr, SIGNAL(mouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*)),
-          this, SLOT(onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*)));
-  connect(aMgr, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)),
-          this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
-  connect(aMgr, SIGNAL(keyPress(SUIT_ViewWindow*, QKeyEvent*)),
-          this, SLOT(onKeyPress(SUIT_ViewWindow*, QKeyEvent*)));
-  connect(aMgr, SIGNAL(keyRelease(SUIT_ViewWindow*, QKeyEvent*)),
-          this, SLOT(onKeyRelease(SUIT_ViewWindow*, QKeyEvent*)));
-
-  connect(aViewer, SIGNAL(selectionChanged()),
-          this, SIGNAL(selectionChanged()));
+  connect(aMgr, SIGNAL(lastViewClosed(SUIT_ViewManager*)), this, SIGNAL(lastViewClosed()));
+  connect(aMgr, SIGNAL(tryCloseView(SUIT_ViewManager*)), this, SIGNAL(tryCloseView()));
+  connect(aMgr, SIGNAL(deleteView(SUIT_ViewManager*)), this, SIGNAL(deleteView()));
+  connect(aMgr, SIGNAL(viewCreated(SUIT_ViewManager*)), this, SIGNAL(viewCreated()));
+  connect(aMgr, SIGNAL(activated(SUIT_ViewManager*)), this, SIGNAL(activated()));
+
+  connect(aMgr, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), this,
+          SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
+  connect(aMgr, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), this,
+          SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
+  connect(aMgr, SIGNAL(mouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*)), this,
+          SLOT(onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*)));
+  connect(aMgr, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), this,
+          SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
+  connect(aMgr, SIGNAL(keyPress(SUIT_ViewWindow*, QKeyEvent*)), this,
+          SLOT(onKeyPress(SUIT_ViewWindow*, QKeyEvent*)));
+  connect(aMgr, SIGNAL(keyRelease(SUIT_ViewWindow*, QKeyEvent*)), this,
+          SLOT(onKeyRelease(SUIT_ViewWindow*, QKeyEvent*)));
+
+  connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
 }
 
 //**********************************************
@@ -153,4 +146,4 @@ void NewGeom_SalomeViewer::fitAll()
   if (aVFrame) {
     aVFrame->onFitAll();
   }
-}
\ No newline at end of file
+}
index 8217e0146fb647b63b27f12a0ad024adefd2504f..7f638ac86cd3a6eb79d4924336525dda83bb7ad0 100644 (file)
@@ -1,5 +1,4 @@
 
-
 #ifndef NewGeom_SalomeViewer_H
 #define NewGeom_SalomeViewer_H
 
@@ -13,10 +12,10 @@ class QKeyEvent;
 
 class NewGeom_OCCSelector;
 
-class NewGeom_SalomeViewer: public XGUI_SalomeViewer
+class NewGeom_SalomeViewer : public XGUI_SalomeViewer
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   NewGeom_SalomeViewer(QObject* theParent);
 
   //! Returns AIS_InteractiveContext from current OCCViewer
@@ -45,9 +44,12 @@ public:
 
   void setSelector(NewGeom_OCCSelector* theSel);
 
-  NewGeom_OCCSelector* selector() const { return mySelector; }
+  NewGeom_OCCSelector* selector() const
+  {
+    return mySelector;
+  }
 
-private slots:
+ private slots:
   void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
   void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
   void onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*);
@@ -55,8 +57,7 @@ private slots:
   void onKeyPress(SUIT_ViewWindow*, QKeyEvent*);
   void onKeyRelease(SUIT_ViewWindow*, QKeyEvent*);
 
-
-private:
+ private:
   NewGeom_OCCSelector* mySelector;
 
 };
index 6579536fe25b7e6573b3c9307a4217e1d29cf3cc..4e9f59f46fcbc09b825cfe6576b5f69a767a8810 100644 (file)
@@ -1,18 +1,18 @@
-#ifndef PARTSET_H
-#define PARTSET_H
-
-#if defined PARTSET_EXPORTS
-#if defined WIN32
-#define PARTSET_EXPORT              __declspec( dllexport )
-#else
-#define PARTSET_EXPORT
-#endif
-#else
-#if defined WIN32
-#define PARTSET_EXPORT              __declspec( dllimport )
-#else
-#define PARTSET_EXPORT
-#endif
-#endif
-
-#endif //PARTSET_H
+#ifndef PARTSET_H\r
+#define PARTSET_H\r
+\r
+#if defined PARTSET_EXPORTS\r
+#if defined WIN32\r
+#define PARTSET_EXPORT              __declspec( dllexport )\r
+#else\r
+#define PARTSET_EXPORT\r
+#endif\r
+#else\r
+#if defined WIN32\r
+#define PARTSET_EXPORT              __declspec( dllimport )\r
+#else\r
+#define PARTSET_EXPORT\r
+#endif\r
+#endif\r
+\r
+#endif //PARTSET_H\r
\ No newline at end of file
index a8bccebafe4bd6e280e558c17c86dd37f9030ff2..a7b2ecccb9b1ebfc5f5cf5cff91604c4c3068d5d 100644 (file)
@@ -7,7 +7,7 @@
 #include <QLineEdit>
 
 PartSet_EditLine::PartSet_EditLine(QWidget* theParent)
-: QObject(theParent)
+    : QObject(theParent)
 {
   myEditor = new QLineEdit(theParent);
   myEditor->setWindowFlags(Qt::ToolTip);
index f389a45f9ec5509aa1ea0b4cf3886f74d1313143..c043dc08a5008567c4ef67fba2f2f5b3b344a60c 100644 (file)
@@ -16,15 +16,18 @@ class QWidget;
 /*!
  \class PartSet_EditLine
  * \brief The class to give an editor to modify a real value
-*/
+ */
 class PARTSET_EXPORT PartSet_EditLine : public QObject
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Constructor
   PartSet_EditLine(QWidget* theParent);
   /// Destructor
-  virtual ~PartSet_EditLine() {};
+  virtual ~PartSet_EditLine()
+  {
+  }
+  ;
 
   /// Show the editor in the given global position
   /// \param thePoint a position
@@ -43,17 +46,17 @@ signals:
   /// \param theValue the editor value
   void stopped(double theValue);
 
-protected:
+ protected:
   /// Returns the editor value
   /// \return the real value
   double getValue() const;
 
-protected slots:
+ protected slots:
   /// Slot to check the editing stop
   void onStopEditing();
 
-protected:
-  QLineEdit* myEditor; /// the value editor
+ protected:
+  QLineEdit* myEditor;  /// the value editor
 };
 
 #endif
index de53456660b728d22b1c3f213e8d4803aec1971b..d6a1edca830b842bd27d47c46fa6fdb0578294f6 100644 (file)
@@ -25,7 +25,7 @@
 using namespace std;
 
 PartSet_Listener::PartSet_Listener(PartSet_Module* theModule)
-: myModule(theModule)
+    : myModule(theModule)
 {
   Events_Loop* aLoop = Events_Loop::loop();
   //aLoop->registerListener(this, aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY));
@@ -42,16 +42,16 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
 {
   ModuleBase_Operation* anOperation = myModule->workshop()->operationMgr()->currentOperation();
   PartSet_OperationSketchBase* aSketchOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
-  if (!aSketchOp) 
+  if (!aSketchOp)
     return;
 
   XGUI_Displayer* aDisplayer = myModule->workshop()->displayer();
   QString aType = QString(theMessage->eventID().eventText());
   if (aType == EVENT_OBJECT_CREATED) {
-    const ModelAPI_ObjectUpdatedMessage* aUpdMsg = 
-      dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
-    std::set<ObjectPtr > aFeatures = aUpdMsg->objects();
-    std::set<ObjectPtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+    const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
+        dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+    std::set<ObjectPtr> aFeatures = aUpdMsg->objects();
+    std::set<ObjectPtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
     for (; anIt != aLast; anIt++) {
       aDisplayer->deactivate(*anIt);
       FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
@@ -60,15 +60,15 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
     }
 
   } else if (aType == EVENT_OBJECT_DELETED) {
-    const ModelAPI_ObjectDeletedMessage* aDelMsg = 
-      dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
+    const ModelAPI_ObjectDeletedMessage* aDelMsg =
+        dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
     boost::shared_ptr<ModelAPI_Document> aDoc = aDelMsg->document();
 
     std::set<std::string> aGroups = aDelMsg->groups();
     std::set<std::string>::const_iterator anIt = aGroups.begin(), aLast = aGroups.end();
     for (; anIt != aLast; anIt++) {
       std::string aGroup = *anIt;
-      if (aGroup.compare(SketchPlugin_Sketch::ID()) == 0) { // Update only Sketch group
+      if (aGroup.compare(SketchPlugin_Sketch::ID()) == 0) {  // Update only Sketch group
         myModule->workshop()->displayer()->eraseDeletedResults();
         myModule->updateCurrentPreview(aGroup);
       }
index 0512245540bfb6889e43f798c9e3e657ad33ddb8..a0ae4d7420efa1813c2ab1a1cc2754445e6d4991 100644 (file)
@@ -14,10 +14,10 @@ class PartSet_Module;
 /*!
  \class PartSet_Listener
  * \brief The operation for the sketch feature creation
-*/
+ */
 class PARTSET_EXPORT PartSet_Listener : public Events_Listener
 {
-public:
+ public:
   /// Constructor
   /// \param theId the feature identifier
   /// \param theParent the operation parent
@@ -28,8 +28,8 @@ public:
   /// This method is called by loop when the event is started to process.
   virtual void processEvent(const Events_Message* theMessage);
 
-private:
-  PartSet_Module* myModule; ///< the current module
+ private:
+  PartSet_Module* myModule;  ///< the current module
 };
 
 #endif
index ecace8c289d143877dfa5ecdb727440f69afaa8d..ec21e026619bcc21858f88d50e4c5a3254956d19 100644 (file)
@@ -60,7 +60,6 @@
 #include <QDebug>
 #endif
 
-
 /*!Create and return new instance of XGUI_Module*/
 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(XGUI_Workshop* theWshop)
 {
@@ -74,26 +73,25 @@ PartSet_Module::PartSet_Module(XGUI_Workshop* theWshop)
 
   XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
 
-  connect(anOperationMgr, SIGNAL(operationStarted()),
-          this, SLOT(onOperationStarted()));
+  connect(anOperationMgr, SIGNAL(operationStarted()), this, SLOT(onOperationStarted()));
 
-  connect(anOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
-          this, SLOT(onOperationStopped(ModuleBase_Operation*)));
+  connect(anOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), this,
+          SLOT(onOperationStopped(ModuleBase_Operation*)));
 
   XGUI_ContextMenuMgr* aContextMenuMgr = myWorkshop->contextMenuMgr();
-  connect(aContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), 
-          this, SLOT(onContextMenuCommand(const QString&, bool)));
+  connect(aContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this,
+          SLOT(onContextMenuCommand(const QString&, bool)));
 
-  connect(myWorkshop->viewer(), SIGNAL(mousePress(QMouseEvent*)),
-          this, SLOT(onMousePressed(QMouseEvent*)));
-  connect(myWorkshop->viewer(), SIGNAL(mouseRelease(QMouseEvent*)),
-          this, SLOT(onMouseReleased(QMouseEvent*)));
-  connect(myWorkshop->viewer(), SIGNAL(mouseMove(QMouseEvent*)),
-          this, SLOT(onMouseMoved(QMouseEvent*)));
-  connect(myWorkshop->viewer(), SIGNAL(keyRelease(QKeyEvent*)),
-          this, SLOT(onKeyRelease(QKeyEvent*)));
-  connect(myWorkshop->viewer(), SIGNAL(mouseDoubleClick(QMouseEvent*)),
-          this, SLOT(onMouseDoubleClick(QMouseEvent*)));
+  connect(myWorkshop->viewer(), SIGNAL(mousePress(QMouseEvent*)), this,
+          SLOT(onMousePressed(QMouseEvent*)));
+  connect(myWorkshop->viewer(), SIGNAL(mouseRelease(QMouseEvent*)), this,
+          SLOT(onMouseReleased(QMouseEvent*)));
+  connect(myWorkshop->viewer(), SIGNAL(mouseMove(QMouseEvent*)), this,
+          SLOT(onMouseMoved(QMouseEvent*)));
+  connect(myWorkshop->viewer(), SIGNAL(keyRelease(QKeyEvent*)), this,
+          SLOT(onKeyRelease(QKeyEvent*)));
+  connect(myWorkshop->viewer(), SIGNAL(mouseDoubleClick(QMouseEvent*)), this,
+          SLOT(onMouseDoubleClick(QMouseEvent*)));
 }
 
 PartSet_Module::~PartSet_Module()
@@ -148,11 +146,11 @@ void PartSet_Module::onFeatureTriggered()
   //                                       myWorkshop->viewer()->activeView());
   QAction* aCmd = dynamic_cast<QAction*>(sender());
   //Do nothing on uncheck
-  if(aCmd->isCheckable() && !aCmd->isChecked())
+  if (aCmd->isCheckable() && !aCmd->isChecked())
     return;
   launchOperation(aCmd->data().toString());
 }
-  
+
 void PartSet_Module::launchOperation(const QString& theCmdId)
 {
   ModuleBase_Operation* anOperation = createOperation(theCmdId.toStdString());
@@ -163,18 +161,18 @@ void PartSet_Module::launchOperation(const QString& theCmdId)
     std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
     std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
     aPreviewOp->initSelection(aSelected, aHighlighted);
-  } 
+  }
   sendOperation(anOperation);
 }
 
 void PartSet_Module::onOperationStarted()
 {
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
-                                       myWorkshop->operationMgr()->currentOperation());
+  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
+      ->operationMgr()->currentOperation());
   if (aPreviewOp) {
     XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
-    connect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)),
-      this, SLOT(onStorePoint2D(ObjectPtr, const std::string&)), Qt::UniqueConnection);
+    connect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)), this,
+            SLOT(onStorePoint2D(ObjectPtr, const std::string&)), Qt::UniqueConnection);
   }
 }
 
@@ -211,8 +209,8 @@ void PartSet_Module::onContextMenuCommand(const QString& theId, bool isChecked)
 
 void PartSet_Module::onMousePressed(QMouseEvent* theEvent)
 {
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
-                                       myWorkshop->operationMgr()->currentOperation());
+  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
+      ->operationMgr()->currentOperation());
   Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
   if (aPreviewOp && (!aView.IsNull())) {
     XGUI_Selection* aSelection = myWorkshop->selector()->selection();
@@ -226,8 +224,8 @@ void PartSet_Module::onMousePressed(QMouseEvent* theEvent)
 
 void PartSet_Module::onMouseReleased(QMouseEvent* theEvent)
 {
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
-                                       myWorkshop->operationMgr()->currentOperation());
+  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
+      ->operationMgr()->currentOperation());
   Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
   if (aPreviewOp && (!aView.IsNull())) {
     XGUI_Selection* aSelection = myWorkshop->selector()->selection();
@@ -241,8 +239,8 @@ void PartSet_Module::onMouseReleased(QMouseEvent* theEvent)
 
 void PartSet_Module::onMouseMoved(QMouseEvent* theEvent)
 {
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
-                                       myWorkshop->operationMgr()->currentOperation());
+  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
+      ->operationMgr()->currentOperation());
   Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
   if (aPreviewOp && (!aView.IsNull()))
     aPreviewOp->mouseMoved(theEvent, aView);
@@ -259,8 +257,8 @@ void PartSet_Module::onKeyRelease(QKeyEvent* theEvent)
 
 void PartSet_Module::onMouseDoubleClick(QMouseEvent* theEvent)
 {
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
-                                       myWorkshop->operationMgr()->currentOperation());
+  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
+      ->operationMgr()->currentOperation());
   Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
   if (aPreviewOp && (!aView.IsNull())) {
     XGUI_Selection* aSelection = myWorkshop->selector()->selection();
@@ -326,7 +324,8 @@ void PartSet_Module::onStopSelection(const QList<ObjectPtr>& theFeatures, const
 {
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
   if (!isStop) {
-    foreach(ObjectPtr aObject, theFeatures) {
+    foreach(ObjectPtr aObject, theFeatures)
+    {
       activateFeature(aObject, false);
     }
   }
@@ -360,7 +359,7 @@ void PartSet_Module::onFeatureConstructed(ObjectPtr theFeature, int theMode)
     std::list<FeaturePtr> aList = aPrevOp->subFeatures();
     XGUI_Displayer* aDisplayer = myWorkshop->displayer();
     std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
-    std::list<FeaturePtr>::iterator aSFIt; 
+    std::list<FeaturePtr>::iterator aSFIt;
     for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) {
       std::list<ResultPtr> aResults = (*aSFIt)->results();
       std::list<ResultPtr>::iterator aIt;
@@ -375,30 +374,30 @@ void PartSet_Module::onFeatureConstructed(ObjectPtr theFeature, int theMode)
     }
   }
   if (isDisplay)
-    ModelAPI_EventCreator::get()->sendUpdated(theFeature, 
-        Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
-/*  bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
-  // TODO visualizePreview(theFeature, isDisplay, false);
-  if (!isDisplay) {
-    ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
-    FeaturePtr aSketch;
-    PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
-    if (aPrevOp) {
-      std::list<FeaturePtr> aList = aPrevOp->subFeatures();
-      XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-      std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
-
-      std::list<FeaturePtr>::const_iterator anIt = aList.begin(),
-                                            aLast = aList.end();
-      //TODO for (; anIt != aLast; anIt++)
-      //  visualizePreview((*anIt), false, false);
-      //aDisplayer->updateViewer();
-    }
-  }
-
-  if (theMode == PartSet_OperationSketchBase::FM_Activation ||
-      theMode == PartSet_OperationSketchBase::FM_Deactivation)
-    activateFeature(theFeature, true);*/
+    ModelAPI_EventCreator::get()->sendUpdated(
+        theFeature, Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+  /*  bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
+   // TODO visualizePreview(theFeature, isDisplay, false);
+   if (!isDisplay) {
+   ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
+   FeaturePtr aSketch;
+   PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
+   if (aPrevOp) {
+   std::list<FeaturePtr> aList = aPrevOp->subFeatures();
+   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+   std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
+
+   std::list<FeaturePtr>::const_iterator anIt = aList.begin(),
+   aLast = aList.end();
+   //TODO for (; anIt != aLast; anIt++)
+   //  visualizePreview((*anIt), false, false);
+   //aDisplayer->updateViewer();
+   }
+   }
+
+   if (theMode == PartSet_OperationSketchBase::FM_Activation ||
+   theMode == PartSet_OperationSketchBase::FM_Deactivation)
+   activateFeature(theFeature, true);*/
 }
 
 ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdId,
@@ -408,8 +407,7 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
   ModuleBase_Operation* anOperation = 0;
   if (theCmdId == PartSet_OperationSketch::Type()) {
     anOperation = new PartSet_OperationSketch(theCmdId.c_str(), this);
-  }
-  else {
+  } else {
     ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
     FeaturePtr aSketch;
     PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
@@ -418,7 +416,7 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
     if (PartSet_OperationFeatureCreate::canProcessKind(theCmdId))
       anOperation = new PartSet_OperationFeatureCreate(theCmdId.c_str(), this, aSketch);
     else if (theCmdId == PartSet_OperationFeatureEditMulti::Type())
-               anOperation = new PartSet_OperationFeatureEditMulti(theCmdId.c_str(), this, aSketch);
+      anOperation = new PartSet_OperationFeatureEditMulti(theCmdId.c_str(), this, aSketch);
     else if (theCmdId == PartSet_OperationFeatureEdit::Type())
       anOperation = new PartSet_OperationFeatureEdit(theCmdId.c_str(), this, aSketch);
   }
@@ -451,27 +449,25 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
   // connect the operation
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (aPreviewOp) {
-    connect(aPreviewOp, SIGNAL(featureConstructed(ObjectPtr, int)),
-            this, SLOT(onFeatureConstructed(ObjectPtr, int)));
-    connect(aPreviewOp, SIGNAL(launchOperation(std::string, ObjectPtr)),
-            this, SLOT(onLaunchOperation(std::string, ObjectPtr)));
-    connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)),
-            this, SLOT(onMultiSelectionEnabled(bool)));
+    connect(aPreviewOp, SIGNAL(featureConstructed(ObjectPtr, int)), this,
+            SLOT(onFeatureConstructed(ObjectPtr, int)));
+    connect(aPreviewOp, SIGNAL(launchOperation(std::string, ObjectPtr)), this,
+            SLOT(onLaunchOperation(std::string, ObjectPtr)));
+    connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)), this,
+            SLOT(onMultiSelectionEnabled(bool)));
 
-    connect(aPreviewOp, SIGNAL(stopSelection(const QList<ObjectPtr>&, const bool)),
-            this, SLOT(onStopSelection(const QList<ObjectPtr>&, const bool)));
-    connect(aPreviewOp, SIGNAL(setSelection(const QList<ObjectPtr>&)),
-            this, SLOT(onSetSelection(const QList<ObjectPtr>&)));
+    connect(aPreviewOp, SIGNAL(stopSelection(const QList<ObjectPtr>&, const bool)), this,
+            SLOT(onStopSelection(const QList<ObjectPtr>&, const bool)));
+    connect(aPreviewOp, SIGNAL(setSelection(const QList<ObjectPtr>&)), this,
+            SLOT(onSetSelection(const QList<ObjectPtr>&)));
 
-     connect(aPreviewOp, SIGNAL(closeLocalContext()),
-             this, SLOT(onCloseLocalContext()));
+    connect(aPreviewOp, SIGNAL(closeLocalContext()), this, SLOT(onCloseLocalContext()));
 
     PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
     if (aSketchOp) {
-      connect(aSketchOp, SIGNAL(planeSelected(double, double, double)),
-              this, SLOT(onPlaneSelected(double, double, double)));
-      connect(aSketchOp, SIGNAL(fitAllView()),
-              this, SLOT(onFitAllView()));
+      connect(aSketchOp, SIGNAL(planeSelected(double, double, double)), this,
+              SLOT(onPlaneSelected(double, double, double)));
+      connect(aSketchOp, SIGNAL(fitAllView()), this, SLOT(onFitAllView()));
     }
   }
 
@@ -486,35 +482,34 @@ void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
   Events_Loop::loop()->send(aMessage);
 }
 
-
 /*void PartSet_Module::visualizePreview(FeaturePtr theFeature, bool isDisplay,
                                     const bool isUpdateViewer)
-{
 ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
 if (!anOperation)
   return;
-
 PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
 if (!aPreviewOp)
   return;
-
 ResultPtr aResult = theFeature->firstResult();
 XGUI_Displayer* aDisplayer = myWorkshop->displayer();
 if (isDisplay) {
   boost::shared_ptr<SketchPlugin_Feature> aSPFeature = 
     boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
   if (aSPFeature) {
     PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
     if (aSketchOp && !aSketchOp->hasSketchPlane())
       showPlanes();
   }
 }
 else
   aDisplayer->erase(aResult, false);
-
 if (isUpdateViewer)
   aDisplayer->updateViewer();
-}*/
+ const bool isUpdateViewer)
+ {
+ ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
+ if (!anOperation)
+ return;
+
+ PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+ if (!aPreviewOp)
+ return;
+
+ ResultPtr aResult = theFeature->firstResult();
+ XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ if (isDisplay) {
+ boost::shared_ptr<SketchPlugin_Feature> aSPFeature = 
+ boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
+ if (aSPFeature) {
+ PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
+ if (aSketchOp && !aSketchOp->hasSketchPlane())
+ showPlanes();
+ }
+ }
+ else
+ aDisplayer->erase(aResult, false);
+
+ if (isUpdateViewer)
+ aDisplayer->updateViewer();
+ }*/
 
 void PartSet_Module::activateFeature(ObjectPtr theFeature, const bool isUpdateViewer)
 {
@@ -551,11 +546,10 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId)
   std::list<FeaturePtr> aList = aPreviewOp->subFeatures();
   std::list<int> aModes = aPreviewOp->getSelectionModes(aPreviewOp->feature());
 
-  std::list<FeaturePtr>::const_iterator anIt = aList.begin(), 
-                                        aLast = aList.end();
+  std::list<FeaturePtr>::const_iterator anIt = aList.begin(), aLast = aList.end();
   for (; anIt != aLast; anIt++) {
-    boost::shared_ptr<SketchPlugin_Feature> aSPFeature = 
-      boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
+    boost::shared_ptr<SketchPlugin_Feature> aSPFeature = boost::dynamic_pointer_cast<
+        SketchPlugin_Feature>(*anIt);
     if (!aSPFeature)
       continue;
     std::list<ResultPtr> aResults = aSPFeature->results();
@@ -576,16 +570,16 @@ void PartSet_Module::editFeature(FeaturePtr theFeature)
     return;
 
 //  if (theFeature->getKind() == SKETCH_KIND) {
-    //FeaturePtr aFeature = theFeature;
-    //if (XGUI_Tools::isModelObject(aFeature)) {
-    //  ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
-    //  aFeature = aObject->featureRef();
-    //}
-
-    //if (aFeature) {
-      onLaunchOperation(theFeature->getKind(), theFeature);
-      updateCurrentPreview(theFeature->getKind());
-    //}
+  //FeaturePtr aFeature = theFeature;
+  //if (XGUI_Tools::isModelObject(aFeature)) {
+  //  ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
+  //  aFeature = aObject->featureRef();
+  //}
+
+  //if (aFeature) {
+  onLaunchOperation(theFeature->getKind(), theFeature);
+  updateCurrentPreview(theFeature->getKind());
+  //}
 //  }
 }
 
@@ -593,40 +587,41 @@ void PartSet_Module::onStorePoint2D(ObjectPtr theFeature, const std::string& the
 {
   FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
 
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
-                                       myWorkshop->operationMgr()->currentOperation());
+  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop
+      ->operationMgr()->currentOperation());
   if (!aPreviewOp)
     return;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFeature->data()->attribute(theAttribute));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aFeature->data()->attribute(theAttribute));
 
-  PartSet_Tools::setConstraints(aPreviewOp->sketch(), aFeature, theAttribute,
-                                aPoint->x(), aPoint->y());
+  PartSet_Tools::setConstraints(aPreviewOp->sketch(), aFeature, theAttribute, aPoint->x(),
+                                aPoint->y());
 }
 
 /*bool PartSet_Module::isFeatureEnabled(const QString& theCmdId) const
-{
-  XGUI_OperationMgr* aOpMgr = myWorkshop->operationMgr();
-  XGUI_ActionsMgr* aActMgr = myWorkshop->actionsMgr();
-
-  ModuleBase_Operation* aOperation = aOpMgr->currentOperation();
-  if (!aOperation)
-    return !aActMgr->isNested(theCmdId);
-
-  PartSet_OperationFeatureEdit* aSketchEdtOp = dynamic_cast<PartSet_OperationFeatureEdit*>(aOperation);
-  if (aSketchEdtOp) {
-    QStringList aConstraintList;
-    aConstraintList<<"SketchConstraintDistance"<<"SketchConstraintLength"
-      <<"SketchConstraintRadius"<<"SketchConstraintParallel"<<"SketchConstraintPerpendicular";
-    return aConstraintList.contains(theCmdId);
-  }
-  QStringList aList = aActMgr->nestedCommands(aOperation->id());
-  return aList.contains(theCmdId);
-}*/
-
-QWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent, 
-                         Config_WidgetAPI* theWidgetApi, QList<ModuleBase_ModelWidget*>& theModelWidgets)
+ {
+ XGUI_OperationMgr* aOpMgr = myWorkshop->operationMgr();
+ XGUI_ActionsMgr* aActMgr = myWorkshop->actionsMgr();
+
+ ModuleBase_Operation* aOperation = aOpMgr->currentOperation();
+ if (!aOperation)
+ return !aActMgr->isNested(theCmdId);
+
+ PartSet_OperationFeatureEdit* aSketchEdtOp = dynamic_cast<PartSet_OperationFeatureEdit*>(aOperation);
+ if (aSketchEdtOp) {
+ QStringList aConstraintList;
+ aConstraintList<<"SketchConstraintDistance"<<"SketchConstraintLength"
+ <<"SketchConstraintRadius"<<"SketchConstraintParallel"<<"SketchConstraintPerpendicular";
+ return aConstraintList.contains(theCmdId);
+ }
+ QStringList aList = aActMgr->nestedCommands(aOperation->id());
+ return aList.contains(theCmdId);
+ }*/
+
+QWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent,
+                                            Config_WidgetAPI* theWidgetApi,
+                                            QList<ModuleBase_ModelWidget*>& theModelWidgets)
 {
   if (theType == "sketch-start-label") {
     PartSet_WidgetSketchLabel* aWgt = new PartSet_WidgetSketchLabel(theParent, theWidgetApi, "");
index 58e0995798c4a7cf5b4d5ab7a63542aade1da237..797e55c74b01432a3ea254783684144351ebd1e9 100644 (file)
@@ -23,11 +23,11 @@ class XGUI_ViewerPrs;
 class ModuleBase_Operation;
 class GeomAPI_AISObject;
 
-class PARTSET_EXPORT PartSet_Module: public ModuleBase_IModule
+class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule
 {
 Q_OBJECT
 
-public:
+ public:
   PartSet_Module(XGUI_Workshop* theWshop);
   virtual ~PartSet_Module();
 
@@ -62,19 +62,18 @@ public:
   /// Activates the feature in the displayer
   /// \param theFeature the feature instance to be displayed
   /// \param isUpdateViewer the flag whether the viewer should be updated
-  void activateFeature(ObjectPtr theFeature,
-                       const bool isUpdateViewer);
+  void activateFeature(ObjectPtr theFeature, const bool isUpdateViewer);
 
   /// Updates current operation preview, if it has it.
   /// \param theCmdId the operation name
   void updateCurrentPreview(const std::string& theCmdId);
 
   /// Creates custom widgets for property panel
-  virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent, 
-    Config_WidgetAPI* theWidgetApi, QList<ModuleBase_ModelWidget*>& theModelWidgets);
+  virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
+                                      Config_WidgetAPI* theWidgetApi,
+                                      QList<ModuleBase_ModelWidget*>& theModelWidgets);
 
-
-public slots:
+ public slots:
   void onFeatureTriggered();
   /// SLOT, that is called after the operation is started. Connect on the focus activated signal
   void onOperationStarted();
@@ -141,7 +140,7 @@ public slots:
   /// \param the attribute of the feature
   void onStorePoint2D(ObjectPtr theFeature, const std::string& theAttribute);
 
-protected:
+ protected:
   /// Creates a new operation
   /// \param theCmdId the operation name
   /// \param theFeatureKind a kind of feature to get the feature xml description
@@ -152,11 +151,11 @@ protected:
   /// \param theOperation the operation
   void sendOperation(ModuleBase_Operation* theOperation);
 
-protected:
+ protected:
   //! Edits the feature
   void editFeature(FeaturePtr theFeature);
 
-private:
+ private:
   XGUI_Workshop* myWorkshop;
   PartSet_Listener* myListener;
 
index f8b2dddf12af432060c9eb262d62d0e52654ee36..a673476898429619f4a57143cfcf2f10287415ad 100644 (file)
@@ -43,8 +43,10 @@ using namespace std;
 
 PartSet_OperationFeatureCreate::PartSet_OperationFeatureCreate(const QString& theId,
                                                                QObject* theParent,
-                                                                 FeaturePtr theFeature)
-: PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature), myActiveWidget(0)
+                                                               FeaturePtr theFeature)
+    : PartSet_OperationSketchBase(theId, theParent),
+      mySketch(theFeature),
+      myActiveWidget(0)
 {
 }
 
@@ -54,15 +56,14 @@ PartSet_OperationFeatureCreate::~PartSet_OperationFeatureCreate()
 
 bool PartSet_OperationFeatureCreate::canProcessKind(const std::string& theId)
 {
-  return theId == SketchPlugin_Line::ID() || theId == SketchPlugin_Point::ID() ||
-         theId == SketchPlugin_Circle::ID() ||
-         theId == SketchPlugin_Arc::ID() ||
-         theId == SketchPlugin_ConstraintDistance::ID() ||
-         theId == SketchPlugin_ConstraintLength::ID() ||
-         theId == SketchPlugin_ConstraintRadius::ID() ||
-         theId == SketchPlugin_ConstraintParallel::ID() ||
-         theId == SketchPlugin_ConstraintPerpendicular::ID() ||
-         theId == SketchPlugin_ConstraintCoincidence::ID();
+  return theId == SketchPlugin_Line::ID() || theId == SketchPlugin_Point::ID()
+      || theId == SketchPlugin_Circle::ID() || theId == SketchPlugin_Arc::ID()
+      || theId == SketchPlugin_ConstraintDistance::ID()
+      || theId == SketchPlugin_ConstraintLength::ID()
+      || theId == SketchPlugin_ConstraintRadius::ID()
+      || theId == SketchPlugin_ConstraintParallel::ID()
+      || theId == SketchPlugin_ConstraintPerpendicular::ID()
+      || theId == SketchPlugin_ConstraintCoincidence::ID();
 }
 
 bool PartSet_OperationFeatureCreate::canBeCommitted() const
@@ -74,7 +75,8 @@ bool PartSet_OperationFeatureCreate::canBeCommitted() const
 
 bool PartSet_OperationFeatureCreate::isGranted(ModuleBase_IOperation* theOperation) const
 {
-  return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
+  return theOperation->getDescription()->operationId().toStdString()
+      == PartSet_OperationSketch::Type();
 }
 
 std::list<int> PartSet_OperationFeatureCreate::getSelectionModes(ObjectPtr theFeature) const
@@ -85,8 +87,9 @@ std::list<int> PartSet_OperationFeatureCreate::getSelectionModes(ObjectPtr theFe
   return aModes;
 }
 
-void PartSet_OperationFeatureCreate::initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                                   const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+void PartSet_OperationFeatureCreate::initSelection(
+    const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
   myPreSelection = theSelected;
 }
@@ -96,15 +99,15 @@ void PartSet_OperationFeatureCreate::initFeature(FeaturePtr theFeature)
   myInitFeature = theFeature;
 }
 
-
 FeaturePtr PartSet_OperationFeatureCreate::sketch() const
 {
   return mySketch;
 }
 
-void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                                const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                                const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+void PartSet_OperationFeatureCreate::mouseReleased(
+    QMouseEvent* theEvent, Handle(V3d_View) theView,
+    const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
   if (commit()) {
     // if the point creation is finished, the next mouse release should commit the modification
@@ -118,11 +121,10 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
 
   if (theSelected.empty()) {
     PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
-  }
-  else {
+  } else {
     ModuleBase_ViewerPrs aPrs = theSelected.front();
     const TopoDS_Shape& aShape = aPrs.shape();
-    if (!aShape.IsNull()) // the point is selected
+    if (!aShape.IsNull())  // the point is selected
     {
       if (aShape.ShapeType() == TopAbs_VERTEX) {
         const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape);
@@ -130,12 +132,11 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
           aPoint = BRep_Tool::Pnt(aVertex);
           PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
 
-          PartSet_Tools::setConstraints(sketch(), feature(), myActiveWidget->attributeID(),
-                                        aX, anY);
+          PartSet_Tools::setConstraints(sketch(), feature(), myActiveWidget->attributeID(), aX,
+                                        anY);
         }
-      }
-      else if (aShape.ShapeType() == TopAbs_EDGE) // the line is selected
-      {
+      } else if (aShape.ShapeType() == TopAbs_EDGE)  // the line is selected
+          {
         PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
         // move to selected line
         if (feature()->getKind() == SketchPlugin_Line::ID()) {
@@ -150,7 +151,7 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
     ModuleBase_ViewerPrs aPrs = theSelected.front();
     aFeature = aPrs.object();
   } else
-    aFeature = feature(); // for the widget distance only
+    aFeature = feature();  // for the widget distance only
 
   bool isApplyed = setWidgetValue(aFeature, aX, anY);
   if (isApplyed) {
@@ -163,8 +164,7 @@ void PartSet_OperationFeatureCreate::mouseMoved(QMouseEvent* theEvent, Handle(V3
 {
   if (commit()) {
     restartOperation(feature()->getKind(), feature());
-  }
-  else {
+  } else {
     double aX, anY;
     gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
     PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
@@ -177,8 +177,7 @@ void PartSet_OperationFeatureCreate::keyReleased(std::string theName, QKeyEvent*
 {
   int aKeyType = theEvent->key();
   // the second point should be activated by any modification in the property panel
-  if (!theName.empty())
-  {
+  if (!theName.empty()) {
     //setPointSelectionMode(myFeaturePrs->getNextMode(theName), false);
   }
   keyReleased(theEvent->key());
@@ -195,10 +194,10 @@ void PartSet_OperationFeatureCreate::onWidgetActivated(ModuleBase_ModelWidget* t
       myPreSelection.remove(aPrs);
       emit activateNextWidget(myActiveWidget);
     }
-  } 
+  }
   if (myInitFeature && myActiveWidget) {
     ModuleBase_WidgetPoint2D* aWgt = dynamic_cast<ModuleBase_WidgetPoint2D*>(myActiveWidget);
-    if (aWgt && aWgt->initFromPrevious(myInitFeature)) { 
+    if (aWgt && aWgt->initFromPrevious(myInitFeature)) {
       myInitFeature = FeaturePtr();
       emit activateNextWidget(myActiveWidget);
     }
@@ -214,14 +213,14 @@ void PartSet_OperationFeatureCreate::keyReleased(const int theKey)
         restartOperation(feature()->getKind(), FeaturePtr());
       }
     }
-    break;
+      break;
     case Qt::Key_Escape: {
       if (!commit()) {
         abort();
       }
     }
     default:
-    break;
+      break;
   }
 }
 
@@ -247,7 +246,7 @@ void PartSet_OperationFeatureCreate::stopOperation()
 
 void PartSet_OperationFeatureCreate::afterCommitOperation()
 {
-  PartSet_OperationSketchBase::afterCommitOperation();  
+  PartSet_OperationSketchBase::afterCommitOperation();
   emit featureConstructed(feature(), FM_Deactivation);
 }
 
@@ -255,8 +254,8 @@ FeaturePtr PartSet_OperationFeatureCreate::createFeature(const bool theFlushMess
 {
   FeaturePtr aNewFeature = ModuleBase_Operation::createFeature(false);
   if (sketch()) {
-    boost::shared_ptr<SketchPlugin_Feature> aFeature = 
-                           boost::dynamic_pointer_cast<SketchPlugin_Feature>(sketch());
+    boost::shared_ptr<SketchPlugin_Feature> aFeature = boost::dynamic_pointer_cast<
+        SketchPlugin_Feature>(sketch());
 
     aFeature->addSub(aNewFeature);
   }
index 5ba2e7428ee1d632159471e0a30db14a5d29a2f2..cedf301a76eb51b4aa8b1b8ed9abc058e95d57e9 100644 (file)
@@ -19,29 +19,28 @@ class QKeyEvent;
 /*!
  \class PartSet_OperationFeatureCreate
  * \brief The operation for the sketch feature creation
-*/
+ */
 class PARTSET_EXPORT PartSet_OperationFeatureCreate : public PartSet_OperationSketchBase
 {
-  Q_OBJECT
+Q_OBJECT
 
-public:
+ public:
   /// Returns true if the feature with the given kind can be created by this operation
   /// \param theId the feature kind
   /// \return the boolean result
   static bool canProcessKind(const std::string& theId);
 
-public:
+ public:
   /// Constructor
   /// \param theId the feature identifier
   /// \param theParent the operation parent
   /// \param theSketch the parent feature
-  PartSet_OperationFeatureCreate(const QString& theId, QObject* theParent,
-                                 FeaturePtr theSketch);
+  PartSet_OperationFeatureCreate(const QString& theId, QObject* theParent, FeaturePtr theSketch);
   /// Destructor
   virtual ~PartSet_OperationFeatureCreate();
 
   /// Returns that this operator can be started above already running one.
-   /// The runned operation should be the sketch feature modified operation
+  /// The runned operation should be the sketch feature modified operation
   /// \param theOperation the previous running operation
   virtual bool isGranted(ModuleBase_IOperation* theOperation) const;
 
@@ -57,7 +56,7 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Returns the operation sketch feature
   /// \returns the sketch instance
@@ -68,9 +67,9 @@ public:
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
- virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<ModuleBase_ViewerPrs>& theSelected,
-                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
+                             const std::list<ModuleBase_ViewerPrs>& theSelected,
+                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
   /// Gives the current mouse point in the viewer
   /// \param thePoint a point clicked in the viewer
   /// \param theEvent the mouse event
@@ -81,12 +80,12 @@ public:
 
   virtual void keyReleased(std::string theName, QKeyEvent* theEvent);
 
-public slots:
+ public slots:
   /// Slots which listen the mode widget activation
   /// \param theWidget the model widget
   virtual void onWidgetActivated(ModuleBase_ModelWidget* theWidget);
 
-protected:
+ protected:
   /// \brief Virtual method called when operation is started
   /// Virtual method called when operation started (see start() method for more description)
   /// After the parent operation body perform, set sketch feature to the created line feature
@@ -114,7 +113,7 @@ protected:
   /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled
   virtual bool canBeCommitted() const;
 
-protected:
+ protected:
   /// Set value to the active widget
   /// \param theFeature the feature
   /// \param theX the horizontal coordinate
@@ -122,11 +121,11 @@ protected:
   /// \return true if the point is set
   bool setWidgetValue(ObjectPtr theFeature, double theX, double theY);
 
-private:
-  FeaturePtr myInitFeature; ///< the initial feature
-  FeaturePtr mySketch; ///< the sketch of the feature
+ private:
+  FeaturePtr myInitFeature;  ///< the initial feature
+  FeaturePtr mySketch;  ///< the sketch of the feature
 
-  ModuleBase_ModelWidget* myActiveWidget; ///< the active widget
+  ModuleBase_ModelWidget* myActiveWidget;  ///< the active widget
 
   std::list<ModuleBase_ViewerPrs> myPreSelection;
 };
index 887ec4f9ce8cf51a6afa43e3dfa1a214a9db16ab..b1752472582bc3851b56da996d92d26bb0a99fce 100644 (file)
 
 using namespace std;
 
-PartSet_OperationFeatureEdit::PartSet_OperationFeatureEdit(const QString& theId,
-                                                 QObject* theParent,
-                                              FeaturePtr theFeature)
-: PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature), myIsBlockedSelection(false)
+PartSet_OperationFeatureEdit::PartSet_OperationFeatureEdit(const QString& theId, QObject* theParent,
+                                                           FeaturePtr theFeature)
+    : PartSet_OperationSketchBase(theId, theParent),
+      mySketch(theFeature),
+      myIsBlockedSelection(false)
 {
 }
 
@@ -50,7 +51,8 @@ PartSet_OperationFeatureEdit::~PartSet_OperationFeatureEdit()
 
 bool PartSet_OperationFeatureEdit::isGranted(ModuleBase_IOperation* theOperation) const
 {
-  return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
+  return theOperation->getDescription()->operationId().toStdString()
+      == PartSet_OperationSketch::Type();
 }
 
 std::list<int> PartSet_OperationFeatureEdit::getSelectionModes(ObjectPtr theFeature) const
@@ -63,20 +65,20 @@ void PartSet_OperationFeatureEdit::initFeature(FeaturePtr theFeature)
   setEditingFeature(theFeature);
 }
 
-
 FeaturePtr PartSet_OperationFeatureEdit::sketch() const
 {
   return mySketch;
 }
 
-void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                             const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                             const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationFeatureEdit::mousePressed(
+    QMouseEvent* theEvent, Handle(V3d_View) theView,
+    const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
   ObjectPtr aObject;
   if (!theHighlighted.empty())
     aObject = theHighlighted.front().object();
-  if (!aObject && !theSelected.empty()) // changed for a constrain
+  if (!aObject && !theSelected.empty())  // changed for a constrain
     aObject = theSelected.front().object();
 
   FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
@@ -85,20 +87,19 @@ void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, Handle(V3
       emit featureConstructed(feature(), FM_Deactivation);
 
       bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
-      if(aHasShift && !theHighlighted.empty()) {
+      if (aHasShift && !theHighlighted.empty()) {
         QList<ObjectPtr> aSelected;
         std::list<ModuleBase_ViewerPrs>::const_iterator aIt;
         for (aIt = theSelected.cbegin(); aIt != theSelected.cend(); ++aIt)
           aSelected.append((*aIt).object());
         /*for (aIt = theHighlighted.cbegin(); aIt != theHighlighted.cend(); ++aIt) {
-          if (!aSelected.contains((*aIt).object()))
-            aSelected.append((*aIt).object());
-        }*/
+         if (!aSelected.contains((*aIt).object()))
+         aSelected.append((*aIt).object());
+         }*/
         //aSelected.push_back(feature());
         //aSelected.push_back(theHighlighted.front().object());
         emit setSelection(aSelected);
-      }
-      else if (aFeature) {
+      } else if (aFeature) {
         restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
       }
     }
@@ -107,7 +108,7 @@ void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, Handle(V3
 
 void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
 {
-  if (!(theEvent->buttons() &  Qt::LeftButton))
+  if (!(theEvent->buttons() & Qt::LeftButton))
     return;
 
   gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
@@ -123,8 +124,8 @@ void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_
     double aDeltaX = aX - aCurX;
     double aDeltaY = anY - aCurY;
 
-    boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = 
-                           boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
+    boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = boost::dynamic_pointer_cast<
+        SketchPlugin_Feature>(feature());
     aSketchFeature->move(aDeltaX, aDeltaY);
     static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
     ModelAPI_EventCreator::get()->sendUpdated(feature(), anEvent);
@@ -134,25 +135,29 @@ void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_
   myCurPoint.setPoint(aPoint);
 }
 
-void PartSet_OperationFeatureEdit::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                              const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
-                                              const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+void PartSet_OperationFeatureEdit::mouseReleased(
+    QMouseEvent* theEvent, Handle(V3d_View) theView,
+    const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
+    const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
   blockSelection(false);
 }
 
-void PartSet_OperationFeatureEdit::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                                    const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                                    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationFeatureEdit::mouseDoubleClick(
+    QMouseEvent* theEvent, Handle_V3d_View theView,
+    const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
   // TODO the functionality is important only for constraint feature. Should be moved in another place
   if (!theSelected.empty()) {
     ModuleBase_ViewerPrs aFeaturePrs = theSelected.front();
     if (!aFeaturePrs.owner().IsNull()) {
-      Handle(AIS_DimensionOwner) anOwner = Handle(AIS_DimensionOwner)::DownCast(aFeaturePrs.owner());
+      Handle(AIS_DimensionOwner) anOwner = Handle(AIS_DimensionOwner)::DownCast(
+          aFeaturePrs.owner());
       if (!anOwner.IsNull() && anOwner->SelectionMode() == AIS_DSM_Text) {
         bool isValid;
-        double aValue = PartSet_Tools::featureValue(feature(), SketchPlugin_Constraint::VALUE(), isValid);
+        double aValue = PartSet_Tools::featureValue(feature(), SketchPlugin_Constraint::VALUE(),
+                                                    isValid);
         if (isValid) {
           ModuleBase_WidgetEditor::editFeatureValue(feature(), SketchPlugin_Constraint::VALUE());
           flushUpdated();
@@ -162,12 +167,11 @@ void PartSet_OperationFeatureEdit::mouseDoubleClick(QMouseEvent* theEvent, Handl
   }
 }
 
-
 void PartSet_OperationFeatureEdit::keyReleased(const int theKey)
 {
   if (theKey == Qt::Key_Return) {
     commit();
-  } else 
+  } else
     PartSet_OperationSketchBase::keyReleased(theKey);
 }
 
@@ -198,8 +202,7 @@ void PartSet_OperationFeatureEdit::blockSelection(bool isBlocked, const bool isR
   if (isBlocked) {
     emit setSelection(QList<ObjectPtr>());
     emit stopSelection(aFeatureList, true);
-  }
-  else {
+  } else {
     emit stopSelection(aFeatureList, false);
     if (isRestoreSelection)
       emit setSelection(aFeatureList);
index ac607e47f873c310a72ebf1e4f963841ed13c504..eadd73f10f9802aa3260ae61b7863bbcd9441815 100644 (file)
@@ -15,25 +15,32 @@ class QMouseEvent;
 /*!
  \class PartSet_OperationFeatureEdit
  * \brief The operation for the sketch feature creation
-*/
-class PARTSET_EXPORT PartSet_OperationFeatureEdit : public PartSet_OperationSketchBase                                                 
+ */
+class PARTSET_EXPORT PartSet_OperationFeatureEdit : public PartSet_OperationSketchBase
 {
-  Q_OBJECT
+Q_OBJECT
   /// Struct to define gp point, with the state is the point is initialized
   struct Point
   {
     /// Constructor
-    Point() {}
+    Point()
+    {
+    }
     /// Constructor
     /// \param thePoint the point
     Point(gp_Pnt thePoint)
     {
       setPoint(thePoint);
     }
-    ~Point() {}
+    ~Point()
+    {
+    }
 
     /// clear the initialized flag.
-    void clear() { myIsInitialized = false; }
+    void clear()
+    {
+      myIsInitialized = false;
+    }
     /// set the point and switch on the initialized flag
     /// \param thePoint the point
     void setPoint(const gp_Pnt& thePoint)
@@ -42,21 +49,23 @@ class PARTSET_EXPORT PartSet_OperationFeatureEdit : public PartSet_OperationSket
       myPoint = thePoint;
     }
 
-    bool myIsInitialized; /// the state whether the point is set
-    gp_Pnt myPoint; /// the point
+    bool myIsInitialized;  /// the state whether the point is set
+    gp_Pnt myPoint;  /// the point
   };
 
-public:
+ public:
   /// Returns the operation type key
-  static std::string Type() { return "EditLine"; }
+  static std::string Type()
+  {
+    return "EditLine";
+  }
 
-public:
+ public:
   /// Constructor
   /// \param theId the feature identifier
   /// \param theParent the operation parent
   /// \param theFeature the parent feature
-  PartSet_OperationFeatureEdit(const QString& theId, QObject* theParent,
-                            FeaturePtr theFeature);
+  PartSet_OperationFeatureEdit(const QString& theId, QObject* theParent, FeaturePtr theFeature);
   /// Destructor
   virtual ~PartSet_OperationFeatureEdit();
 
@@ -94,9 +103,9 @@ public:
   /// \param theEvent the mouse event
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
- virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<ModuleBase_ViewerPrs>& theSelected,
-                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
+                             const std::list<ModuleBase_ViewerPrs>& theSelected,
+                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Processes the mouse double click in the point
   /// \param theEvent the mouse event
@@ -111,7 +120,7 @@ public:
   /// \param theKey a key value
   virtual void keyReleased(const int theKey);
 
-protected:
+ protected:
   /// \brief Virtual method called when operation is started
   /// Virtual method called when operation started (see start() method for more description)
   /// Switch off the multi selection state
@@ -127,7 +136,7 @@ protected:
   /// \returns the created feature
   virtual FeaturePtr createFeature(const bool theFlushMessage = true);
 
-protected:
+ protected:
   /// Emits a signal about the selection blocking. Emits a signal to change the selection.
   /// If the block is true, the signal clear selection, otherwise if restore selection flag allows,
   /// the internal operation features are to be selected
@@ -138,10 +147,10 @@ protected:
   /// Sends the features
   void sendFeatures();
 
-private:
-  FeaturePtr mySketch; ///< the sketch feature
-  Point myCurPoint; ///< the current 3D point clicked or moved
-  bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal
+ private:
+  FeaturePtr mySketch;  ///< the sketch feature
+  Point myCurPoint;  ///< the current 3D point clicked or moved
+  bool myIsBlockedSelection;  ///< the state of the last state of selection blocked signal
 };
 
 #endif
index 83d2a04b5f6dc4d705b0956bc5423d9347fb1a43..0c4a71697d6aca7e5234d1a919a76a8d563e668f 100644 (file)
 using namespace std;
 
 PartSet_OperationFeatureEditMulti::PartSet_OperationFeatureEditMulti(const QString& theId,
-                                                 QObject* theParent,
-                                              FeaturePtr theFeature)
-: PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature), myIsBlockedSelection(false)
+                                                                     QObject* theParent,
+                                                                     FeaturePtr theFeature)
+    : PartSet_OperationSketchBase(theId, theParent),
+      mySketch(theFeature),
+      myIsBlockedSelection(false)
 {
 }
 
@@ -45,11 +47,13 @@ PartSet_OperationFeatureEditMulti::~PartSet_OperationFeatureEditMulti()
 
 bool PartSet_OperationFeatureEditMulti::isGranted(ModuleBase_IOperation* theOperation) const
 {
-  return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
+  return theOperation->getDescription()->operationId().toStdString()
+      == PartSet_OperationSketch::Type();
 }
 
-void PartSet_OperationFeatureEditMulti::initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                                      const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationFeatureEditMulti::initSelection(
+    const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
   if (!theHighlighted.empty()) {
     // if there is highlighted object, we check whether it is in the list of selected objects
@@ -57,7 +61,8 @@ void PartSet_OperationFeatureEditMulti::initSelection(const std::list<ModuleBase
     // the hightlighted object should moved and the selection is skipped. The skipped selection will be
     // deselected in the viewer by blockSelection signal in the startOperation method.
     bool isSelected = false;
-    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theSelected.begin(), aLast = theSelected.end();
+    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theSelected.begin(), aLast = theSelected
+        .end();
     for (; anIt != aLast && !isSelected; anIt++) {
       isSelected = ModelAPI_Feature::feature((*anIt).object()) == feature();
     }
@@ -65,8 +70,7 @@ void PartSet_OperationFeatureEditMulti::initSelection(const std::list<ModuleBase
       myFeatures = theHighlighted;
     else
       myFeatures = theSelected;
-  }
-  else
+  } else
     myFeatures = theSelected;
 }
 
@@ -80,15 +84,16 @@ FeaturePtr PartSet_OperationFeatureEditMulti::sketch() const
   return mySketch;
 }
 
-void PartSet_OperationFeatureEditMulti::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                             const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
-                                             const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationFeatureEditMulti::mousePressed(
+    QMouseEvent* theEvent, Handle(V3d_View) theView,
+    const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
 }
 
 void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
 {
-  if (!(theEvent->buttons() &  Qt::LeftButton))
+  if (!(theEvent->buttons() & Qt::LeftButton))
     return;
 
   gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
@@ -104,11 +109,12 @@ void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle
     double aDeltaX = aX - aCurX;
     double aDeltaY = anY - aCurY;
 
-    boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = 
-                           boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
+    boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = boost::dynamic_pointer_cast<
+        SketchPlugin_Feature>(feature());
     aSketchFeature->move(aDeltaX, aDeltaY);
 
-    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
+    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures
+        .end();
     for (; anIt != aLast; anIt++) {
       ObjectPtr aObject = (*anIt).object();
       if (!aObject || aObject == feature())
@@ -126,18 +132,20 @@ void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle
   myCurPoint.setPoint(aPoint);
 }
 
-void PartSet_OperationFeatureEditMulti::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                              const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
-                                              const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+void PartSet_OperationFeatureEditMulti::mouseReleased(
+    QMouseEvent* theEvent, Handle(V3d_View) theView,
+    const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
+    const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
   if (commit()) {
     std::list<ModuleBase_ViewerPrs> aFeatures = myFeatures;
-    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast =
+        aFeatures.end();
     for (; anIt != aLast; anIt++) {
       ObjectPtr aFeature = (*anIt).object();
       if (aFeature) {
         emit featureConstructed(aFeature, FM_Deactivation);
-           }
+      }
     }
   }
 }
@@ -161,22 +169,22 @@ void PartSet_OperationFeatureEditMulti::stopOperation()
   myFeatures.clear();
 }
 
-void PartSet_OperationFeatureEditMulti::blockSelection(bool isBlocked, const bool isRestoreSelection)
+void PartSet_OperationFeatureEditMulti::blockSelection(bool isBlocked,
+                                                       const bool isRestoreSelection)
 {
   if (myIsBlockedSelection == isBlocked)
     return;
 
   myIsBlockedSelection = isBlocked;
   QList<ObjectPtr> aFeatureList;
-  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(),
-                                            aLast = myFeatures.end();
+  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast =
+      myFeatures.end();
   /*for(; anIt != aLast; anIt++)
-    aFeatureList.append((*anIt).feature());*/
+   aFeatureList.append((*anIt).feature());*/
   if (isBlocked) {
     emit setSelection(QList<ObjectPtr>());
     emit stopSelection(aFeatureList, true);
-  }
-  else {
+  } else {
     emit stopSelection(aFeatureList, false);
     if (isRestoreSelection) {
       emit setSelection(aFeatureList);
@@ -188,8 +196,9 @@ void PartSet_OperationFeatureEditMulti::sendFeatures()
 {
   static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_MOVED);
 
-  std::list<FeaturePtr > aFeatures;
-  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
+  std::list<FeaturePtr> aFeatures;
+  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast =
+      myFeatures.end();
   for (; anIt != aLast; anIt++) {
     ObjectPtr aFeature = (*anIt).object();
     if (!aFeature)
index 7f018618b215499bb6280d266212cfdb985133f8..f49d0480bcbcb2763f060373759526ca4db50c5e 100644 (file)
@@ -15,25 +15,32 @@ class QMouseEvent;
 /*!
  \class PartSet_OperationFeatureEditMulti
  * \brief The operation for the sketch feature creation
-*/
-class PARTSET_EXPORT PartSet_OperationFeatureEditMulti : public PartSet_OperationSketchBase                                                 
+ */
+class PARTSET_EXPORT PartSet_OperationFeatureEditMulti : public PartSet_OperationSketchBase
 {
-  Q_OBJECT
+Q_OBJECT
   /// Struct to define gp point, with the state is the point is initialized
   struct Point
   {
     /// Constructor
-    Point() {}
+    Point()
+    {
+    }
     /// Constructor
     /// \param thePoint the point
     Point(gp_Pnt thePoint)
     {
       setPoint(thePoint);
     }
-    ~Point() {}
+    ~Point()
+    {
+    }
 
     /// clear the initialized flag.
-    void clear() { myIsInitialized = false; }
+    void clear()
+    {
+      myIsInitialized = false;
+    }
     /// set the point and switch on the initialized flag
     /// \param thePoint the point
     void setPoint(const gp_Pnt& thePoint)
@@ -42,21 +49,24 @@ class PARTSET_EXPORT PartSet_OperationFeatureEditMulti : public PartSet_Operatio
       myPoint = thePoint;
     }
 
-    bool myIsInitialized; /// the state whether the point is set
-    gp_Pnt myPoint; /// the point
+    bool myIsInitialized;  /// the state whether the point is set
+    gp_Pnt myPoint;  /// the point
   };
 
-public:
+ public:
   /// Returns the operation type key
-  static std::string Type() { return "EditMulti"; }
+  static std::string Type()
+  {
+    return "EditMulti";
+  }
 
-public:
+ public:
   /// Constructor
   /// \param theId the feature identifier
   /// \param theParent the operation parent
   /// \param theFeature the parent feature
   PartSet_OperationFeatureEditMulti(const QString& theId, QObject* theParent,
-                            FeaturePtr theFeature);
+                                    FeaturePtr theFeature);
   /// Destructor
   virtual ~PartSet_OperationFeatureEditMulti();
 
@@ -72,7 +82,7 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Returns the operation sketch feature
   /// \returns the sketch instance
@@ -95,10 +105,10 @@ public:
   /// \param theEvent the mouse event
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
- virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<ModuleBase_ViewerPrs>& theSelected,
-                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
-protected:
 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
+                             const std::list<ModuleBase_ViewerPrs>& theSelected,
+                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+ protected:
   /// \brief Virtual method called when operation is started
   /// Virtual method called when operation started (see start() method for more description)
   /// Switch off the multi selection state
@@ -108,7 +118,7 @@ protected:
   /// Restore the multi selection state
   virtual void stopOperation();
 
-protected:
+ protected:
   /// Emits a signal about the selection blocking. Emits a signal to change the selection.
   /// If the block is true, the signal clear selection, otherwise if restore selection flag allows,
   /// the internal operation features are to be selected
@@ -119,11 +129,11 @@ protected:
   /// Sends the features
   void sendFeatures();
 
-private:
-  FeaturePtr mySketch; ///< the sketch feature
-  std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation
-  Point myCurPoint; ///< the current 3D point clicked or moved
-  bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal
+ private:
+  FeaturePtr mySketch;  ///< the sketch feature
+  std::list<ModuleBase_ViewerPrs> myFeatures;  ///< the features to apply the edit operation
+  Point myCurPoint;  ///< the current 3D point clicked or moved
+  bool myIsBlockedSelection;  ///< the state of the last state of selection blocked signal
 };
 
 #endif
index 81ba69a079ed80f19ec060c3fe2421f137378751..4ff87cae1414d760c31a3e2f7bcddacf5b8df636 100644 (file)
 
 using namespace std;
 
-
-PartSet_OperationSketch::PartSet_OperationSketch(const QString& theId,
-                                                    QObject* theParent)
-: PartSet_OperationSketchBase(theId, theParent)
+PartSet_OperationSketch::PartSet_OperationSketch(const QString& theId, QObject* theParent)
+    : PartSet_OperationSketchBase(theId, theParent)
 {
 }
 
@@ -61,7 +59,6 @@ std::list<int> PartSet_OperationSketch::getSelectionModes(ObjectPtr theFeature)
   return aModes;
 }
 
-
 /// Initializes the operation with previously created feature. It is used in sequental operations
 void PartSet_OperationSketch::initFeature(FeaturePtr theFeature)
 {
@@ -78,7 +75,7 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, Handle_V3d_Vie
                                            const std::list<ModuleBase_ViewerPrs>& theSelected,
                                            const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
-  if (hasSketchPlane()){
+  if (hasSketchPlane()) {
     // if shift button is pressed and there are some already selected objects, the operation should
     // not be started. We just want to combine some selected objects.
     bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
@@ -88,13 +85,12 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, Handle_V3d_Vie
     if (theHighlighted.size() == 1) {
       ObjectPtr aFeature = theHighlighted.front().object();
       if (aFeature) {
-        std::string anOperationType = (theSelected.size() > 1)?
-          PartSet_OperationFeatureEditMulti::Type() :
-          PartSet_OperationFeatureEdit::Type();
+        std::string anOperationType =
+            (theSelected.size() > 1) ?
+                PartSet_OperationFeatureEditMulti::Type() : PartSet_OperationFeatureEdit::Type();
         restartOperation(anOperationType, aFeature);
       }
-    }
-    else
+    } else
       myFeatures = theHighlighted;
 
   } else {
@@ -126,14 +122,14 @@ void PartSet_OperationSketch::mouseReleased(QMouseEvent* theEvent, Handle_V3d_Vi
 
 void PartSet_OperationSketch::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
 {
-  if (!hasSketchPlane() || !(theEvent->buttons() &  Qt::LeftButton) || myFeatures.empty())
+  if (!hasSketchPlane() || !(theEvent->buttons() & Qt::LeftButton) || myFeatures.empty())
     return;
 
   if (myFeatures.size() != 1) {
     FeaturePtr aFeature = PartSet_Tools::nearestFeature(theEvent->pos(), theView, feature(),
                                                         myFeatures);
     if (aFeature)
-               restartOperation(PartSet_OperationFeatureEditMulti::Type(), aFeature);
+      restartOperation(PartSet_OperationFeatureEditMulti::Type(), aFeature);
   }
 }
 
@@ -147,8 +143,8 @@ std::list<FeaturePtr> PartSet_OperationSketch::subFeatures() const
   boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
   if (!aData->isValid())
     return std::list<FeaturePtr>();
-  boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
-        boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID()));
+  boost::shared_ptr<ModelAPI_AttributeRefList> aRefList = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID()));
 
   std::list<ObjectPtr> aList = aRefList->list();
   std::list<ObjectPtr>::iterator aIt;
@@ -170,8 +166,8 @@ void PartSet_OperationSketch::stopOperation()
   std::list<ResultPtr> aResults = aFeature->results();
   std::list<ResultPtr>::const_iterator aIt;
   for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
-    ModelAPI_EventCreator::get()->sendUpdated(*aIt, 
-      Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+    ModelAPI_EventCreator::get()->sendUpdated(
+        *aIt, Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
   }
   //ModelAPI_EventCreator::get()->sendUpdated(aFeature, 
   //  Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
@@ -182,7 +178,6 @@ bool PartSet_OperationSketch::isNestedOperationsEnabled() const
   return hasSketchPlane();
 }
 
-
 void PartSet_OperationSketch::startOperation()
 {
   PartSet_OperationSketchBase::startOperation();
@@ -197,8 +192,8 @@ bool PartSet_OperationSketch::hasSketchPlane() const
   if (feature()) {
     boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
     AttributeDoublePtr anAttr;
-    boost::shared_ptr<GeomDataAPI_Dir> aNormal = 
-      boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SketchPlugin_Sketch::NORM_ID()));
+    boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+        aData->attribute(SketchPlugin_Sketch::NORM_ID()));
     aHasPlane = aNormal && !(aNormal->x() == 0 && aNormal->y() == 0 && aNormal->z() == 0);
   }
   return aHasPlane;
@@ -230,26 +225,27 @@ void PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape)
   // X axis is preferable to be dirX on the sketch
   const double tol = Precision::Confusion();
   bool isX = fabs(anA - 1.0) < tol && fabs(aB) < tol && fabs(aC) < tol;
-  boost::shared_ptr<GeomAPI_Dir> aTempDir(isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
+  boost::shared_ptr<GeomAPI_Dir> aTempDir(
+      isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
   boost::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
   boost::shared_ptr<GeomAPI_Dir> aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir)));
 
-  boost::shared_ptr<GeomDataAPI_Point> anOrigin = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point>(aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+  boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+      aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
   anOrigin->setValue(anOrigPnt);
-  boost::shared_ptr<GeomDataAPI_Dir> aNormal = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SketchPlugin_Sketch::NORM_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      aData->attribute(SketchPlugin_Sketch::NORM_ID()));
   aNormal->setValue(aNormDir);
-  boost::shared_ptr<GeomDataAPI_Dir> aDirX = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aDirX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
   aDirX->setValue(aXDir);
-  boost::shared_ptr<GeomDataAPI_Dir> aDirY = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SketchPlugin_Sketch::DIRY_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aDirY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      aData->attribute(SketchPlugin_Sketch::DIRY_ID()));
   aDirY->setValue(aYDir);
   boost::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
 
   flushUpdated();
-  
+
   emit featureConstructed(feature(), FM_Hide);
   emit closeLocalContext();
   emit planeSelected(aDir->x(), aDir->y(), aDir->z());
index 1cd920158bfa099b852c12d1ecfbbc40ccc6d99f..04604ef0cce20d7856488eb80e51c3df5617b2cf 100644 (file)
@@ -18,15 +18,18 @@ class Handle_AIS_InteractiveObject;
 /*!
  \class PartSet_OperationSketch
  * \brief The operation for the sketch feature creation
-*/
+ */
 class PARTSET_EXPORT PartSet_OperationSketch : public PartSet_OperationSketchBase
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Returns the operation type key
-  static std::string Type() { return SketchPlugin_Sketch::ID(); }
+  static std::string Type()
+  {
+    return SketchPlugin_Sketch::ID();
+  }
 
-public:
+ public:
   /// Constructor
   /// \param theId the feature identifier
   /// \param theParent the operation parent
@@ -99,13 +102,13 @@ signals:
   // signal about the viewer fit all perform
   void fitAllView();
 
-protected:
+ protected:
   /// Virtual method called when operation started (see start() method for more description)
   /// Default impl calls corresponding slot and commits immediately.
   virtual void startOperation();
 
-private:
-  std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation
+ private:
+  std::list<ModuleBase_ViewerPrs> myFeatures;  ///< the features to apply the edit operation
 };
 
 #endif
index c606e919d67cbf3b92d0ef39246d7e6f49c15b11..d90de1d2902bfa87aa78305a1f297c36cb329ab7 100644 (file)
@@ -21,9 +21,8 @@
 
 using namespace std;
 
-PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId,
-                                                            QObject* theParent)
-: ModuleBase_Operation(theId, theParent)
+PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId, QObject* theParent)
+    : ModuleBase_Operation(theId, theParent)
 {
 }
 
@@ -31,11 +30,10 @@ PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
 {
 }
 
-boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
-                                      FeaturePtr theFeature)
+boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(FeaturePtr theFeature)
 {
-  boost::shared_ptr<SketchPlugin_Feature> aFeature = 
-                              boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
+  boost::shared_ptr<SketchPlugin_Feature> aFeature = boost::dynamic_pointer_cast<
+      SketchPlugin_Feature>(theFeature);
   if (aFeature) {
     ResultPtr aRes = aFeature->firstResult();
     ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
@@ -62,8 +60,8 @@ std::list<int> PartSet_OperationSketchBase::getSelectionModes(ObjectPtr theFeatu
   //      return aModes;
   //  }
   //}
-  aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)TopAbs_VERTEX));
-  aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)TopAbs_EDGE));
+  aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX));
+  aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE));
   aModes.push_back(AIS_DSM_Text);
   aModes.push_back(AIS_DSM_Line);
   return aModes;
@@ -76,23 +74,25 @@ FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage
   return myFeature;
 }
 
-
-void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                               const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                               const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationSketchBase::mousePressed(
+    QMouseEvent* theEvent, Handle_V3d_View theView,
+    const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
 }
-void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                                const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                                const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationSketchBase::mouseReleased(
+    QMouseEvent* theEvent, Handle_V3d_View theView,
+    const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
 }
 void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
 {
 }
-void PartSet_OperationSketchBase::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                                   const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                                   const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationSketchBase::mouseDoubleClick(
+    QMouseEvent* theEvent, Handle_V3d_View theView,
+    const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
 }
 
@@ -102,17 +102,18 @@ void PartSet_OperationSketchBase::keyReleased(const int theKey)
     case Qt::Key_Escape: {
       bool toAbort = true;
       if (isModified()) {
-        int anAnswer = QMessageBox::question(qApp->activeWindow(), tr("Cancel operation"),
-                                  tr("Operation %1 will be cancelled. Continue?").arg(id()),
-                                  QMessageBox::Yes, QMessageBox::No);
+        int anAnswer = QMessageBox::question(
+            qApp->activeWindow(), tr("Cancel operation"),
+            tr("Operation %1 will be cancelled. Continue?").arg(id()), QMessageBox::Yes,
+            QMessageBox::No);
         toAbort = (anAnswer == QMessageBox::Yes);
       }
       if (toAbort)
         abort();
     }
-    break;
+      break;
     default:
-    break;
+      break;
   }
 }
 
@@ -121,8 +122,7 @@ void PartSet_OperationSketchBase::keyReleased(std::string theName, QKeyEvent* th
   keyReleased(theEvent->key());
 }
 
-void PartSet_OperationSketchBase::restartOperation(const std::string& theType,
-                                                   ObjectPtr theFeature)
+void PartSet_OperationSketchBase::restartOperation(const std::string& theType, ObjectPtr theFeature)
 {
   emit launchOperation(theType, theFeature);
 }
index caae337a73894df0e2f689083d37450c390ce773..66e3cd0047fed1a9d9c7e956689c5f69c6f826d0 100644 (file)
@@ -29,17 +29,22 @@ class GeomAPI_Shape;
 class ModuleBase_ViewerPrs;
 
 /*!
 \class PartSet_OperationSketchBase
 * \brief The base operation for the sketch features.
 *  Base class for all sketch operations. It provides an access to the feature preview
-*/
+ \class PartSet_OperationSketchBase
+ * \brief The base operation for the sketch features.
+ *  Base class for all sketch operations. It provides an access to the feature preview
+ */
 class PARTSET_EXPORT PartSet_OperationSketchBase : public ModuleBase_Operation
 {
-  Q_OBJECT
-public:
-  enum FeatureActionMode { FM_Activation, FM_Deactivation, FM_Hide };
-
-public:
+Q_OBJECT
+ public:
+  enum FeatureActionMode
+  {
+    FM_Activation,
+    FM_Deactivation,
+    FM_Hide
+  };
+
+ public:
   /// Constructor
   /// \param theId an feature index
   /// \param theParent the object parent
@@ -61,13 +66,17 @@ public:
   virtual std::list<int> getSelectionModes(ObjectPtr theFeature) const;
 
   /// Initializes the operation with previously created feature. It is used in sequental operations
-  virtual void initFeature(FeaturePtr theFeature) {}
+  virtual void initFeature(FeaturePtr theFeature)
+  {
+  }
 
   /// Initialisation of operation with preliminary selection
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted) {}
+                             const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+  {
+  }
 
   /// Returns the operation sketch feature
   /// \returns the sketch instance
@@ -102,8 +111,8 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<ModuleBase_ViewerPrs>& theSelected,
-                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+                                const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Processes the key pressed in the view
   /// \param theKey a key value
@@ -115,15 +124,14 @@ public:
   /// If the provided feature is empty, the current operation feature is used.
   /// \param theType a type of an operation started
   /// theFeature the operation argument
-  void restartOperation(const std::string& theType,
-         ObjectPtr theFeature = ObjectPtr());
+  void restartOperation(const std::string& theType, ObjectPtr theFeature = ObjectPtr());
 
 signals:
   /// signal about the request to launch operation
   /// theName the operation name
   /// theFeature the operation argument
   void launchOperation(std::string theName, ObjectPtr theFeature);
-  
+
   /// Signal about the feature construing is finished
   /// \param theFeature the result feature
   /// \param theMode the mode of the feature modification
@@ -132,7 +140,7 @@ signals:
   /// Signal about the features should be selected
   /// \param theSelected the list of selected presentations
   void featureSelected(const std::list<ModuleBase_ViewerPrs>& theSelected);
-  
+
   /// signal to enable/disable multi selection in the viewer
   /// \param theEnabled the boolean state
   void multiSelectionEnabled(bool theEnabled);
@@ -141,7 +149,7 @@ signals:
   /// \param theFeatures a list of features to be disabled
   /// \param theToStop the boolean state whether it it stopped or non stopped
   void stopSelection(const QList<ObjectPtr>& theFeatures, const bool theToStop);
-  
+
   /// signal to set selection in the viewer
   /// \param theFeatures a list of features to be disabled
   void setSelection(const QList<ObjectPtr>& theFeatures);
@@ -149,7 +157,7 @@ signals:
   /// signal to close the operation local context if it is opened
   void closeLocalContext();
 
-protected:
+ protected:
   /// Creates an operation new feature
   /// In addition to the default realization it appends the created line feature to
   /// the sketch feature
index fbf819b15a1a7f53f32d641a81807a1b611aeb00..727a97915e6b791b5c7c6a7a6b6d136d83657f6c 100644 (file)
@@ -40,7 +40,8 @@ void PartSet_TestOCC::testSelection(XGUI_Workshop* theWorkshop)
   boost::shared_ptr<GeomAPI_AISObject> anIO = theWorkshop->displayer()->getAISObject(myTestObject);
   if (!anIO->empty()) {
     theWorkshop->viewer()->AISContext()->MoveTo(0, 0, theWorkshop->viewer()->activeView());
-    theWorkshop->viewer()->AISContext()->Select(0, 0, 2500, 2500, theWorkshop->viewer()->activeView());
+    theWorkshop->viewer()->AISContext()->Select(0, 0, 2500, 2500,
+                                                theWorkshop->viewer()->activeView());
   }
 }
 
@@ -96,7 +97,7 @@ void PartSet_TestOCC::local_selection_change_shape(Handle_AIS_InteractiveContext
 }
 
 void PartSet_TestOCC::local_selection_erase(Handle_AIS_InteractiveContext theContext,
-                                    Handle_V3d_View theView)
+                                            Handle_V3d_View theView)
 {
   // 1. Create shape
   gp_Pnt aPnt1(100, 100, 0);
@@ -127,17 +128,17 @@ void PartSet_TestOCC::createTestLine(XGUI_Workshop* theWorkshop)
 
   ModuleBase_Operation* anOperation = theWorkshop->operationMgr()->currentOperation();
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
-    FeaturePtr aSketch;
+  FeaturePtr aSketch;
 
   if (aPreviewOp) {
     // create a line
     boost::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_PluginManager::get()->rootDocument();
     FeaturePtr aFeature = aDoc->addFeature(SketchPlugin_Line::ID());
-    if (aFeature) // TODO: generate an error if feature was not created
+    if (aFeature)  // TODO: generate an error if feature was not created
       aFeature->execute();
 
-    boost::shared_ptr<SketchPlugin_Feature> aSketch = 
-                        boost::dynamic_pointer_cast<SketchPlugin_Feature>(aPreviewOp->sketch());
+    boost::shared_ptr<SketchPlugin_Feature> aSketch = boost::dynamic_pointer_cast<
+        SketchPlugin_Feature>(aPreviewOp->sketch());
     aSketch->addSub(aFeature);
 
     PartSet_Tools::setFeaturePoint(aFeature, 100, 100, SketchPlugin_Line::START_ID());
@@ -148,12 +149,12 @@ void PartSet_TestOCC::createTestLine(XGUI_Workshop* theWorkshop)
     XGUI_Displayer* aDisplayer = theWorkshop->displayer();
 
     boost::shared_ptr<GeomAPI_AISObject> aPrevAIS;
-    boost::shared_ptr<SketchPlugin_Feature> aSPFeature = 
-      boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+    boost::shared_ptr<SketchPlugin_Feature> aSPFeature = boost::dynamic_pointer_cast<
+        SketchPlugin_Feature>(aFeature);
     //boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
     //if (!anAIS->empty())
     aDisplayer->display(aFeature, false);
-      //aDisplayer->redisplay(aFeature->firstResult(), anAIS, false);
+    //aDisplayer->redisplay(aFeature->firstResult(), anAIS, false);
 
     std::list<int> aModes;
     aModes.push_back(TopAbs_VERTEX);
@@ -162,22 +163,22 @@ void PartSet_TestOCC::createTestLine(XGUI_Workshop* theWorkshop)
 
     // change the line
     /*double aDelta = -200;
-    for (int i = 0; i < 20; i++) {
-      aDelta = aDelta - i*2;
-      PartSet_Tools::setFeaturePoint(aFeature, 100+aDelta, 200+aDelta, SketchPlugin_Line::START_ID());
-      PartSet_Tools::setFeaturePoint(aFeature, 300+aDelta, 500+aDelta, SketchPlugin_Line::END_ID());
-
-      boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
-      Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation(
-                             aFeature, aSketch,
-                             aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(), NULL);
-      if (!anAIS.IsNull())
-        aDisplayer->redisplay(aFeature, anAIS, true);
-
-      int aVal = 90;
-      for (int j = 0; j < 10000000; j++)
-        aVal = aVal/aVal+aVal*2;
-    }*/
+     for (int i = 0; i < 20; i++) {
+     aDelta = aDelta - i*2;
+     PartSet_Tools::setFeaturePoint(aFeature, 100+aDelta, 200+aDelta, SketchPlugin_Line::START_ID());
+     PartSet_Tools::setFeaturePoint(aFeature, 300+aDelta, 500+aDelta, SketchPlugin_Line::END_ID());
+
+     boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
+     Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation(
+     aFeature, aSketch,
+     aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(), NULL);
+     if (!anAIS.IsNull())
+     aDisplayer->redisplay(aFeature, anAIS, true);
+
+     int aVal = 90;
+     for (int j = 0; j < 10000000; j++)
+     aVal = aVal/aVal+aVal*2;
+     }*/
     //std::list<int> aModes;
     //aModes.clear();
     //aModes.push_back(TopAbs_VERTEX);
@@ -206,8 +207,8 @@ void PartSet_TestOCC::changeTestLine(XGUI_Workshop* theWorkshop)
   //boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
 
   boost::shared_ptr<GeomAPI_AISObject> aPrevAIS;
-  boost::shared_ptr<SketchPlugin_Feature> aSPFeature = 
-    boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+  boost::shared_ptr<SketchPlugin_Feature> aSPFeature = boost::dynamic_pointer_cast<
+      SketchPlugin_Feature>(aFeature);
   //boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
   //if (!anAIS->empty())
   theWorkshop->displayer()->display(aFeature, true);
@@ -219,8 +220,8 @@ void PartSet_TestOCC::changeTestLine(XGUI_Workshop* theWorkshop)
   //aDisplayer->activateInLocalContext(aFeature, aModes, true);
 
   /*QFeatureList aFeatureList;
-  aFeatureList.append(myTestObject);
-  theWorkshop->displayer()->setSelected(aFeatureList, true);*/
+   aFeatureList.append(myTestObject);
+   theWorkshop->displayer()->setSelected(aFeatureList, true);*/
 
   theWorkshop->displayer()->updateViewer();
 }
index e4b8dd005417a9c2eddd74fba7dbb5c4d7a9f428..757b344cd39435a25b33965569ffd913dfa7e13a 100644 (file)
@@ -14,11 +14,14 @@ class Handle_V3d_View;
 /*!
  \class PartSet_TestOCC
  * \brief The operation to test OCC viewer work
-*/
+ */
 class PARTSET_EXPORT PartSet_TestOCC
 {
-public:
-  PartSet_TestOCC() {};
+ public:
+  PartSet_TestOCC()
+  {
+  }
+  ;
 
   /// Creates a line feature, select it, modify the line. Check whether the highlight is correct.
   /// \param the workshop to provide an access to the application information
@@ -38,7 +41,7 @@ public:
   static void local_selection_erase(Handle_AIS_InteractiveContext theContext,
                                     Handle_V3d_View theView);
 
-private:
+ private:
 
   /// Creates a temporary line
   /// \param the workshop to get the operation manager and the displayer
index 08c362a43594b86fe7323de9554cfb7555a512e8..92c66ffbe9f87ad8cebd72ebd89ae07460a1f367 100644 (file)
@@ -63,12 +63,14 @@ gp_Pnt PartSet_Tools::convertClickToPoint(QPoint thePoint, Handle(V3d_View) theV
   gp_Pnt ConvertedPoint(X, Y, Z);
 
   gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView, ConvertedPoint);
-  gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(), PlaneOfTheView);
+  gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(),
+                                     PlaneOfTheView);
   return ResultPoint;
 }
 
 void PartSet_Tools::convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch,
-                                Handle(V3d_View) theView, double& theX, double& theY)
+Handle(V3d_View) theView,
+                                double& theX, double& theY)
 {
   if (!theSketch)
     return;
@@ -76,19 +78,18 @@ void PartSet_Tools::convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch,
   AttributeDoublePtr anAttr;
   boost::shared_ptr<ModelAPI_Data> aData = theSketch->data();
 
-  boost::shared_ptr<GeomDataAPI_Point> anOrigin = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point>(aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+  boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+      aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
 
-  boost::shared_ptr<GeomDataAPI_Dir> aX = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> anY = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SketchPlugin_Sketch::DIRY_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> anY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      aData->attribute(SketchPlugin_Sketch::DIRY_ID()));
 
   gp_Pnt anOriginPnt(anOrigin->x(), anOrigin->y(), anOrigin->z());
   gp_Vec aVec(anOriginPnt, thePoint);
 
-  if (!theView.IsNull())
-  {
+  if (!theView.IsNull()) {
     V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt;
     theView->Eye(XEye, YEye, ZEye);
 
@@ -99,22 +100,21 @@ void PartSet_Tools::convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch,
     gp_Vec anEyeVec(EyePoint, AtPoint);
     anEyeVec.Normalize();
 
-    boost::shared_ptr<GeomDataAPI_Dir> aNormal = 
-                  boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SketchPlugin_Sketch::NORM_ID()));
+    boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+        aData->attribute(SketchPlugin_Sketch::NORM_ID()));
     gp_Vec aNormalVec(aNormal->x(), aNormal->y(), aNormal->z());
 
     double aDen = anEyeVec * aNormalVec;
     double aLVec = aDen != 0 ? aVec * aNormalVec / aDen : DBL_MAX;
 
-    gp_Vec aDeltaVec = anEyeVec*aLVec;
+    gp_Vec aDeltaVec = anEyeVec * aLVec;
     aVec = aVec - aDeltaVec;
   }
   theX = aVec.X() * aX->x() + aVec.Y() * aX->y() + aVec.Z() * aX->z();
   theY = aVec.X() * anY->x() + aVec.Y() * anY->y() + aVec.Z() * anY->z();
 }
 
-void PartSet_Tools::convertTo3D(const double theX, const double theY,
-                                FeaturePtr theSketch,
+void PartSet_Tools::convertTo3D(const double theX, const double theY, FeaturePtr theSketch,
                                 gp_Pnt& thePoint)
 {
   if (!theSketch)
@@ -122,15 +122,15 @@ void PartSet_Tools::convertTo3D(const double theX, const double theY,
 
   boost::shared_ptr<ModelAPI_Data> aData = theSketch->data();
 
-  boost::shared_ptr<GeomDataAPI_Point> aC = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point>(aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aX = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aY = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SketchPlugin_Sketch::DIRY_ID()));
+  boost::shared_ptr<GeomDataAPI_Point> aC = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+      aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      aData->attribute(SketchPlugin_Sketch::DIRY_ID()));
 
-  boost::shared_ptr<GeomAPI_XYZ> aSum = aC->pnt()->xyz()->added(
-    aX->dir()->xyz()->multiplied(theX))->added(aY->dir()->xyz()->multiplied(theY));
+  boost::shared_ptr<GeomAPI_XYZ> aSum = aC->pnt()->xyz()->added(aX->dir()->xyz()->multiplied(theX))
+      ->added(aY->dir()->xyz()->multiplied(theY));
 
   boost::shared_ptr<GeomAPI_Pnt> aPoint = boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
   thePoint = gp_Pnt(aPoint->x(), aPoint->y(), aPoint->z());
@@ -145,21 +145,22 @@ FeaturePtr PartSet_Tools::nearestFeature(QPoint thePoint, Handle_V3d_View theVie
   PartSet_Tools::convertTo2D(aPoint, theSketch, theView, aX, anY);
 
   FeaturePtr aFeature;
-  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end();
+  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures
+      .end();
 
-  FeaturePtr aDeltaFeature;   
+  FeaturePtr aDeltaFeature;
   double aMinDelta = -1;
   ModuleBase_ViewerPrs aPrs;
   for (; anIt != aLast; anIt++) {
     aPrs = *anIt;
     if (!aPrs.object())
       continue;
-    boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = 
-                           boost::dynamic_pointer_cast<SketchPlugin_Feature>(aPrs.object());
+    boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = boost::dynamic_pointer_cast<
+        SketchPlugin_Feature>(aPrs.object());
     if (!aSketchFeature)
       continue;
     double aDelta = aSketchFeature->distanceToPoint(
-                               boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, anY)));
+        boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, anY)));
     if (aMinDelta < 0 || aMinDelta > aDelta) {
       aMinDelta = aDelta;
       // TODO aDeltaFeature = aPrs.result();
@@ -179,8 +180,8 @@ void PartSet_Tools::setFeaturePoint(FeaturePtr theFeature, double theX, double t
   if (!theFeature)
     return;
   boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(theAttribute));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(theAttribute));
   if (aPoint)
     aPoint->setValue(theX, theY);
 }
@@ -191,8 +192,8 @@ void PartSet_Tools::setFeatureValue(FeaturePtr theFeature, double theValue,
   if (!theFeature)
     return;
   boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-  AttributeDoublePtr anAttribute =
-        boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aData->attribute(theAttribute));
+  AttributeDoublePtr anAttribute = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+      aData->attribute(theAttribute));
   if (anAttribute)
     anAttribute->setValue(theValue);
 }
@@ -204,8 +205,8 @@ double PartSet_Tools::featureValue(FeaturePtr theFeature, const std::string& the
   double aValue;
   if (theFeature) {
     boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-    AttributeDoublePtr anAttribute =
-          boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aData->attribute(theAttribute));
+    AttributeDoublePtr anAttribute = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+        aData->attribute(theAttribute));
     if (anAttribute) {
       aValue = anAttribute->value();
       isValid = true;
@@ -222,8 +223,8 @@ FeaturePtr PartSet_Tools::feature(FeaturePtr theFeature, const std::string& theA
     return aFeature;
 
   boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
-          boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(theAttribute));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(theAttribute));
   if (anAttr) {
     aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->object());
     if (!theKind.empty() && aFeature && aFeature->getKind() != theKind) {
@@ -241,58 +242,57 @@ void PartSet_Tools::createConstraint(FeaturePtr theSketch,
   FeaturePtr aFeature = aDoc->addFeature(SketchPlugin_ConstraintCoincidence::ID());
 
   if (theSketch) {
-    boost::shared_ptr<SketchPlugin_Feature> aSketch = 
-                           boost::dynamic_pointer_cast<SketchPlugin_Feature>(theSketch);
+    boost::shared_ptr<SketchPlugin_Feature> aSketch = boost::dynamic_pointer_cast<
+        SketchPlugin_Feature>(theSketch);
     aSketch->addSub(aFeature);
   }
 
   boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
 
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef1 =
-        boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef1 = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
   aRef1->setAttr(thePoint1);
 
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef2 =
-        boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef2 = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
   aRef2->setAttr(thePoint2);
 
-  if (aFeature) // TODO: generate an error if feature was not created
+  if (aFeature)  // TODO: generate an error if feature was not created
     aFeature->execute();
 }
 
 void PartSet_Tools::setConstraints(FeaturePtr theSketch, FeaturePtr theFeature,
-                                   const std::string& theAttribute,
-                                   double theClickedX, double theClickedY)
+                                   const std::string& theAttribute, double theClickedX,
+                                   double theClickedY)
 {
   // find a feature point by the selection mode
   //boost::shared_ptr<GeomDataAPI_Point2D> aPoint = featurePoint(theMode);
-  boost::shared_ptr<GeomDataAPI_Point2D> aFeaturePoint =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(theFeature->data()->attribute(theAttribute));
+  boost::shared_ptr<GeomDataAPI_Point2D> aFeaturePoint = boost::dynamic_pointer_cast<
+      GeomDataAPI_Point2D>(theFeature->data()->attribute(theAttribute));
   if (!aFeaturePoint)
     return;
 
   // get all sketch features. If the point with the given coordinates belong to any sketch feature,
   // the constraint is created between the feature point and the found sketch point
   boost::shared_ptr<ModelAPI_Data> aData = theSketch->data();
-  boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
-        boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID()));
+  boost::shared_ptr<ModelAPI_AttributeRefList> aRefList = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID()));
 
-  std::list<ObjectPtr > aFeatures = aRefList->list();
-  std::list<ObjectPtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+  std::list<ObjectPtr> aFeatures = aRefList->list();
+  std::list<ObjectPtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
   std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes;
-  boost::shared_ptr<GeomAPI_Pnt2d> aClickedPoint = boost::shared_ptr<GeomAPI_Pnt2d>
-                                                     (new GeomAPI_Pnt2d(theClickedX, theClickedY));
-  for (; anIt != aLast; anIt++)
-  {
+  boost::shared_ptr<GeomAPI_Pnt2d> aClickedPoint = boost::shared_ptr<GeomAPI_Pnt2d>(
+      new GeomAPI_Pnt2d(theClickedX, theClickedY));
+  for (; anIt != aLast; anIt++) {
     FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
     // find the given point in the feature attributes
     anAttiributes = aFeature->data()->attributes(GeomDataAPI_Point2D::type());
     std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
-                                                                      aLast = anAttiributes.end();
+        aLast = anAttiributes.end();
     boost::shared_ptr<GeomDataAPI_Point2D> aFPoint;
-    for (;anIt!=aLast && !aFPoint; anIt++) {
-      boost::shared_ptr<GeomDataAPI_Point2D> aCurPoint =
-                                          boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
+    for (; anIt != aLast && !aFPoint; anIt++) {
+      boost::shared_ptr<GeomDataAPI_Point2D> aCurPoint = boost::dynamic_pointer_cast<
+          GeomDataAPI_Point2D>(*anIt);
       if (aCurPoint && aCurPoint->pnt()->distance(aClickedPoint) < Precision::Confusion())
         aFPoint = aCurPoint;
     }
@@ -307,10 +307,10 @@ boost::shared_ptr<GeomAPI_Pln> PartSet_Tools::sketchPlane(FeaturePtr theSketch)
   double aA, aB, aC, aD;
 
   boost::shared_ptr<ModelAPI_Data> aData = theSketch->data();
-  boost::shared_ptr<GeomDataAPI_Point> anOrigin = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point>(aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aNormal = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aData->attribute(SketchPlugin_Sketch::NORM_ID()));
+  boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+      aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      aData->attribute(SketchPlugin_Sketch::NORM_ID()));
   aA = aNormal->x();
   aB = aNormal->y();
   aC = aNormal->z();
@@ -320,27 +320,26 @@ boost::shared_ptr<GeomAPI_Pln> PartSet_Tools::sketchPlane(FeaturePtr theSketch)
   return aPlane;
 }
 
-boost::shared_ptr<GeomAPI_Pnt> PartSet_Tools::point3D(
-                                                boost::shared_ptr<GeomAPI_Pnt2d> thePoint2D,
-                                                FeaturePtr theSketch)
+boost::shared_ptr<GeomAPI_Pnt> PartSet_Tools::point3D(boost::shared_ptr<GeomAPI_Pnt2d> thePoint2D,
+                                                      FeaturePtr theSketch)
 {
   boost::shared_ptr<GeomAPI_Pnt> aPoint;
   if (!theSketch || !thePoint2D)
     return aPoint;
 
-  boost::shared_ptr<GeomDataAPI_Point> aC = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point>(theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aX = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(theSketch->data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aY = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(theSketch->data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
+  boost::shared_ptr<GeomDataAPI_Point> aC = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+      theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      theSketch->data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      theSketch->data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
 
   return thePoint2D->to3D(aC->pnt(), aX->dir(), aY->dir());
 }
 
 bool PartSet_Tools::isConstraintFeature(const std::string& theKind)
 {
-  return theKind == SketchPlugin_ConstraintDistance::ID() ||
-         theKind == SketchPlugin_ConstraintLength::ID() ||
-         theKind == SketchPlugin_ConstraintRadius::ID();
+  return theKind == SketchPlugin_ConstraintDistance::ID()
+      || theKind == SketchPlugin_ConstraintLength::ID()
+      || theKind == SketchPlugin_ConstraintRadius::ID();
 }
index 1cd763ca0e9af86623bf246e7b675d7dfd61afc1..d1b5b4d5cd9f4646495b0613cb4319a67da3ec59 100644 (file)
@@ -27,10 +27,10 @@ class GeomAPI_Pnt;
 /*!
  \class PartSet_Tools
  * \brief The operation for the sketch feature creation
-*/
+ */
 class PARTSET_EXPORT PartSet_Tools
 {
-public:
+ public:
   /// Converts the 2D screen point to the 3D point on the view according to the point of view
   /// \param thePoint a screen point
   /// \param theView a 3D view
@@ -42,7 +42,8 @@ public:
   /// \param theX the X coordinate
   /// \param theY the Y coordinate
   static void convertTo2D(const gp_Pnt& thePoint, FeaturePtr theSketch,
-                          Handle(V3d_View) theView, double& theX, double& theY);
+  Handle(V3d_View) theView,
+                          double& theX, double& theY);
 
   /// \brief Converts the 2D projected coodinates on the sketch plane to the 3D point.
   /// \param theX the X coordinate
@@ -82,8 +83,7 @@ public:
   /// \param theAttribute the feature attribute
   /// \param isValid an output parameter whether the value is valid
   /// \returns the feature value
-  static double featureValue(FeaturePtr theFeature, const std::string& theAttribute,
-                             bool& isValid);
+  static double featureValue(FeaturePtr theFeature, const std::string& theAttribute, bool& isValid);
 
   /// Find a feature in the attribute of the given feature. If the kind is not empty,
   /// the return feature should be this type. Otherwise it is null
@@ -92,7 +92,7 @@ public:
   /// \param theKind an output feature kind
   /// \return the feature
   static FeaturePtr feature(FeaturePtr theFeature, const std::string& theAttribute,
-                             const std::string& theKind);
+                            const std::string& theKind);
 
   /// Creates a constraint on two points
   /// \param thePoint1 the first point
@@ -108,7 +108,8 @@ public:
   /// \param theClickedX the horizontal coordnate of the point
   /// \param theClickedY the vertical coordnate of the point
   static void setConstraints(FeaturePtr theSketch, FeaturePtr theFeature,
-                             const std::string& theAttribute, double theClickedX, double theClickedY);
+                             const std::string& theAttribute, double theClickedX,
+                             double theClickedY);
 
   /// Create a sketch plane instance
   /// \param theSketch a sketch feature
index 7a3d43fe7f17274dfd84289076a41a4f10802552..d464e85ab1534fec6c88e9e2434f31ecb3e1990c 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <list>
 
-
 int shapesNbPoints(const ModuleBase_ISelection* theSelection)
 {
   std::list<ModuleBase_ViewerPrs> aList = theSelection->getSelected();
index 94bab7756d5a7dc1b50a99dbb3fff9fbbde95a36..02f7d21e6c53b1f8c7e8cd88385dc044a62c63dd 100644 (file)
 #include <ModuleBase_ISelection.h>
 
 /*
-* Selector validators
-*/
+ * Selector validators
+ */
 
 //! A class to validate a selection for Distance constraint operation
-class PartSet_DistanceValidator: public ModuleBase_SelectionValidator
+class PartSet_DistanceValidator : public ModuleBase_SelectionValidator
 {
-public:
+ public:
   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
 };
 
 //! A class to validate a selection for Length constraint operation
-class PartSet_LengthValidator: public ModuleBase_SelectionValidator
+class PartSet_LengthValidator : public ModuleBase_SelectionValidator
 {
-public:
+ public:
   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
 };
 
 //! A class to validate a selection for Perpendicular constraint operation
-class PartSet_PerpendicularValidator: public ModuleBase_SelectionValidator
+class PartSet_PerpendicularValidator : public ModuleBase_SelectionValidator
 {
-public:
+ public:
   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
 };
 
 //! A class to validate a selection for Perpendicular constraint operation
-class PartSet_ParallelValidator: public ModuleBase_SelectionValidator
+class PartSet_ParallelValidator : public ModuleBase_SelectionValidator
 {
-public:
+ public:
   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
 };
 
 //! A class to validate a selection for Perpendicular constraint operation
-class PartSet_RadiusValidator: public ModuleBase_SelectionValidator
+class PartSet_RadiusValidator : public ModuleBase_SelectionValidator
 {
-public:
+ public:
   PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection) const;
 };
 
-
 #endif
index 6089ab850600ee24b185e137f962df8899399831..bbcd7c177a1f5b8b154502fe6f73ee1c784cda6f 100644 (file)
 
 #include <QLabel>
 
-PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel(QWidget* theParent, 
-  const Config_WidgetAPI* theData, 
-  const std::string& theParentId)
-: ModuleBase_ModelWidget(theParent, theData, theParentId)
+PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel(QWidget* theParent,
+                                                     const Config_WidgetAPI* theData,
+                                                     const std::string& theParentId)
+    : ModuleBase_ModelWidget(theParent, theData, theParentId)
 {
   myText = QString::fromStdString(theData->getProperty("title"));
   myLabel = new QLabel(myText, theParent);
@@ -27,7 +27,7 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel(QWidget* theParent,
 QList<QWidget*> PartSet_WidgetSketchLabel::getControls() const
 {
   QList<QWidget*> aLst;
-  aLst<<myLabel;
+  aLst << myLabel;
   return aLst;
 }
 
@@ -36,16 +36,14 @@ QWidget* PartSet_WidgetSketchLabel::getControl() const
   return myLabel;
 }
 
-
-
 void PartSet_WidgetSketchLabel::setOperationsMgr(XGUI_OperationMgr* theMgr)
 {
   ModuleBase_Operation* aOperation = theMgr->currentOperation();
   if (aOperation->inherits("PartSet_OperationSketch")) {
     PartSet_OperationSketch* aSketchOpe = static_cast<PartSet_OperationSketch*>(aOperation);
     updateLabel(aSketchOpe);
-    connect(aSketchOpe, SIGNAL(planeSelected(double, double, double)), 
-            this, SLOT(onPlaneSelected()));
+    connect(aSketchOpe, SIGNAL(planeSelected(double, double, double)), this,
+            SLOT(onPlaneSelected()));
   }
 }
 
@@ -64,4 +62,4 @@ void PartSet_WidgetSketchLabel::updateLabel(PartSet_OperationSketch* theSketchOp
     myLabel->setText(myText);
     myLabel->setToolTip(myTooltip);
   }
-}
\ No newline at end of file
+}
index 98cae8a48fe9d50ec7a38244e88e6c00d3d2e272..442f319074c52a5a8f34982b4a0a888897936bfb 100644 (file)
 #include <ModuleBase_ModelWidget.h>
 
 class QLabel;
-class XGUI_OperationMgr; 
+class XGUI_OperationMgr;
 class PartSet_OperationSketch;
 
 class PARTSET_EXPORT PartSet_WidgetSketchLabel : public ModuleBase_ModelWidget
 {
-  Q_OBJECT
-public:
-  PartSet_WidgetSketchLabel(QWidget* theParent, 
-    const Config_WidgetAPI* theData, 
-    const std::string& theParentId);
+Q_OBJECT
+ public:
+  PartSet_WidgetSketchLabel(QWidget* theParent, const Config_WidgetAPI* theData,
+                            const std::string& theParentId);
 
-  virtual ~PartSet_WidgetSketchLabel() {};
+  virtual ~PartSet_WidgetSketchLabel()
+  {
+  }
+  ;
 
   /// Saves the internal parameters to the given feature
   /// \param theFeature a model feature to be changed
-  virtual bool storeValue() const { return true;}
+  virtual bool storeValue() const
+  {
+    return true;
+  }
 
-  virtual bool restoreValue() { return true;}
+  virtual bool restoreValue()
+  {
+    return true;
+  }
 
   /// Returns list of widget controls
   /// \return a control list
@@ -37,10 +45,10 @@ public:
 
   void setOperationsMgr(XGUI_OperationMgr* theMgr);
 
-private slots:
+ private slots:
   void onPlaneSelected();
 
-private:
+ private:
   void updateLabel(PartSet_OperationSketch* theSketchOpe);
 
   QLabel* myLabel;
@@ -48,4 +56,4 @@ private:
   QString myTooltip;
 };
 
-#endif
\ No newline at end of file
+#endif
index 28c8ce3defba9d875f50bba959f1f6502ce5edab..7f94e6943b48dc7f47c925de3681f0d343c6ec70 100644 (file)
@@ -22,19 +22,18 @@ void PartSetPlugin_Duplicate::initAttributes()
 
   boost::shared_ptr<ModelAPI_PluginManager> aPManager = ModelAPI_PluginManager::get();
   boost::shared_ptr<ModelAPI_Document> aRoot = aPManager->rootDocument();
-  boost::shared_ptr<ModelAPI_ResultPart> aSource; // searching for source document attribute
-  for(int a = aRoot->size(getGroup()) - 1; a >= 0; a--) {
+  boost::shared_ptr<ModelAPI_ResultPart> aSource;  // searching for source document attribute
+  for (int a = aRoot->size(getGroup()) - 1; a >= 0; a--) {
     aSource = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aRoot->object(getGroup(), a));
-    if (aSource && aSource->data() && 
-        aSource->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value() == 
-        aPManager->currentDocument())
+    if (aSource && aSource->data()
+        && aSource->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value()
+            == aPManager->currentDocument())
       break;
     aSource.reset();
   }
   if (aSource) {
     boost::shared_ptr<ModelAPI_Document> aCopy = aPManager->copy(
-      aSource->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value(),
-      data()->name());
+        aSource->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value(), data()->name());
     data()->refattr(ORIGIN_REF())->setObject(aSource);
   }
 }
index 446b6f32556ba48dc01381f0e53df8cdd65e82bd..b5e48183f54196eb8989e053d5839d45f2f7dacd 100644 (file)
@@ -11,9 +11,9 @@
  * \ingroup DataModel
  * \brief Duplicates the active part (not root). Creates a new "part" feature.
  */
-class PartSetPlugin_Duplicate: public PartSetPlugin_Part
+class PartSetPlugin_Duplicate : public PartSetPlugin_Part
 {
-public:
+ public:
   /// the reference to copy: reference to the attribute
   inline static const std::string& ORIGIN_REF()
   {
index e2b47f4ce9b3f35c8982dbf7788a8549f75120b4..edb6ddac3f0c0de9f9c2828c877b975b0f31f9b3 100644 (file)
@@ -16,26 +16,27 @@ PartSetPlugin_Part::PartSetPlugin_Part()
 }
 
 void PartSetPlugin_Part::initAttributes()
-{// all is in part result
+{  // all is in part result
 }
 
-void PartSetPlugin_Part::execute() 
+void PartSetPlugin_Part::execute()
 {
   ResultPartPtr aResult = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(firstResult());
   if (!aResult) {
     aResult = document()->createPart(data());
     setResult(aResult);
   }
-  boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef =
-    aResult->data()->docRef(ModelAPI_ResultPart::DOC_REF());
+  boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aResult->data()->docRef(
+      ModelAPI_ResultPart::DOC_REF());
 
-  if (!aDocRef->value()) { // create a document if not yet created
-    boost::shared_ptr<ModelAPI_Document> aPartSetDoc = 
-      ModelAPI_PluginManager::get()->rootDocument();
+  if (!aDocRef->value()) {  // create a document if not yet created
+    boost::shared_ptr<ModelAPI_Document> aPartSetDoc =
+        ModelAPI_PluginManager::get()->rootDocument();
     aDocRef->setValue(aPartSetDoc->subDocument(data()->name()));
   }
 }
 
-boost::shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd() {
+boost::shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd()
+{
   return ModelAPI_PluginManager::get()->rootDocument();
 }
index 10cdebb856677bd48dd490f6f747f1e11c5f60a9..ef1dd528c15f90bb646799c430dacfbb7c7fcdf4 100644 (file)
@@ -12,9 +12,9 @@
  * \ingroup DataModel
  * \brief Feature for creation of the new part in PartSet.
  */
-class PartSetPlugin_Part: public ModelAPI_Feature
+class PartSetPlugin_Part : public ModelAPI_Feature
 {
-public:
+ public:
   /// Part kind
   inline static const std::string& ID()
   {
@@ -22,12 +22,18 @@ public:
     return MY_PART_KIND;
   }
   /// Returns the kind of a feature
-  PARTSETPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = PartSetPlugin_Part::ID(); return MY_KIND;}
+  PARTSETPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = PartSetPlugin_Part::ID();
+    return MY_KIND;
+  }
 
   /// Returns to which group in the document must be added feature
-  PARTSETPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Parts"; return MY_GROUP;}
+  PARTSETPLUGIN_EXPORT virtual const std::string& getGroup()
+  {
+    static std::string MY_GROUP = "Parts";
+    return MY_GROUP;
+  }
 
   /// Creates a new part document if needed
   PARTSETPLUGIN_EXPORT virtual void execute();
@@ -38,7 +44,10 @@ public:
   PARTSETPLUGIN_EXPORT virtual boost::shared_ptr<ModelAPI_Document> documentToAdd();
 
   /// Returns true if this feature must be displayed in the history (top level of Part tree)
-  PARTSETPLUGIN_EXPORT virtual bool isInHistory() {return false;}
+  PARTSETPLUGIN_EXPORT virtual bool isInHistory()
+  {
+    return false;
+  }
 
   /// Use plugin manager for features creation
   PartSetPlugin_Part();
index dc384608e6552ca7701115cbfd68d0c1889cd376..6dfc437041f02573fc5eefe2a4d73f4be8c77b52 100644 (file)
@@ -10,7 +10,7 @@ using namespace std;
 // the only created instance of this plugin
 static PartSetPlugin_Plugin* MY_INSTANCE = new PartSetPlugin_Plugin();
 
-PartSetPlugin_Plugin::PartSetPlugin_Plugin() 
+PartSetPlugin_Plugin::PartSetPlugin_Plugin()
 {
   // register this plugin
   ModelAPI_PluginManager::get()->registerPlugin(this);
@@ -27,6 +27,6 @@ FeaturePtr PartSetPlugin_Plugin::createFeature(string theFeatureID)
   if (theFeatureID == "remove") {
     return FeaturePtr(new PartSetPlugin_Remove);
   }
-    // feature of such kind is not found
+  // feature of such kind is not found
   return FeaturePtr();
 }
index 1ffda8a7255ad7fc35aeb826ff8a856980a407ab..e8e9e702b405575131d7604756660c5b2052972e 100644 (file)
@@ -5,18 +5,17 @@
 #ifndef PartSetPlugin_Plugin_H_
 #define PartSetPlugin_Plugin_H_
 
-
 #include "PartSetPlugin.h"
 #include "ModelAPI_Plugin.h"
 #include "ModelAPI_Feature.h"
 
-class PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin: public ModelAPI_Plugin
+class PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin : public ModelAPI_Plugin
 {
-public:
+ public:
   /// Creates the feature object of this plugin by the feature string ID
   virtual FeaturePtr createFeature(std::string theFeatureID);
 
-public:
+ public:
   /// Is needed for python wrapping by swig
   PartSetPlugin_Plugin();
 };
index d7dbf434cb51cb7dacee46447622e3b3d67fa572..28ee6b7978b7766dc2597ca6bc093d3917a4e975 100644 (file)
@@ -15,12 +15,12 @@ void PartSetPlugin_Remove::execute()
   boost::shared_ptr<ModelAPI_Document> aRoot = aPManager->rootDocument();
   boost::shared_ptr<ModelAPI_Document> aCurrent;
   boost::shared_ptr<PartSetPlugin_Part> a;
-  for(int a = aRoot->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) {
+  for (int a = aRoot->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) {
     ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(
-      aRoot->object(ModelAPI_ResultPart::group(), a));
-    if (aPart && aPart->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value() == 
-        aPManager->currentDocument()) 
-    {
+        aRoot->object(ModelAPI_ResultPart::group(), a));
+    if (aPart
+        && aPart->data()->docRef(ModelAPI_ResultPart::DOC_REF())->value()
+            == aPManager->currentDocument()) {
       FeaturePtr aFeature = aRoot->feature(aPart);
       if (aFeature) {
         // do remove
index 20ccef4a03219dcf242a858067da0a23132571f9..bbb23be03f0779399a4493648af12c9a1c0bbdbe 100644 (file)
@@ -12,9 +12,9 @@
  * \ingroup DataModel
  * \brief Feature for creation of the new part in PartSet.
  */
-class PartSetPlugin_Remove: public ModelAPI_Feature
+class PartSetPlugin_Remove : public ModelAPI_Feature
 {
-public:
+ public:
   /// Remove kind
   inline static const std::string& ID()
   {
@@ -22,24 +22,37 @@ public:
     return MY_REMOVE_KIND;
   }
   /// Returns the kind of a feature
-  PARTSETPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = PartSetPlugin_Remove::ID(); return MY_KIND;}
+  PARTSETPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = PartSetPlugin_Remove::ID();
+    return MY_KIND;
+  }
 
   /// Returns to which group in the document must be added feature
-  PARTSETPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Parts"; return MY_GROUP;}
+  PARTSETPLUGIN_EXPORT virtual const std::string& getGroup()
+  {
+    static std::string MY_GROUP = "Parts";
+    return MY_GROUP;
+  }
 
   /// Request for initialization of data model of the feature: adding all attributes
-  PARTSETPLUGIN_EXPORT virtual void initAttributes() {}
+  PARTSETPLUGIN_EXPORT virtual void initAttributes()
+  {
+  }
 
   /// Not normal feature that stored in the tree
-  PARTSETPLUGIN_EXPORT virtual bool isAction() {return true;}
+  PARTSETPLUGIN_EXPORT virtual bool isAction()
+  {
+    return true;
+  }
 
   /// Performs the "remove"
   PARTSETPLUGIN_EXPORT virtual void execute();
 
   /// Use plugin manager for features creation
-  PartSetPlugin_Remove() {}
+  PartSetPlugin_Remove()
+  {
+  }
 };
 
 #endif
index 542ed47c506275a83c5ed6d7062d9ebd5810e93a..21e616aef9b61b0e7fc846ede607cab03787eac6 100644 (file)
 const double tolerance = 1e-7;
 
 SketchPlugin_Arc::SketchPlugin_Arc()
-  : SketchPlugin_Feature()
+    : SketchPlugin_Feature()
 {
 }
 
 void SketchPlugin_Arc::initAttributes()
 {
   data()->addAttribute(SketchPlugin_Arc::CENTER_ID(), GeomDataAPI_Point2D::type());
-  data()->addAttribute(SketchPlugin_Arc::START_ID(),  GeomDataAPI_Point2D::type());
-  data()->addAttribute(SketchPlugin_Arc::END_ID(),    GeomDataAPI_Point2D::type());
+  data()->addAttribute(SketchPlugin_Arc::START_ID(), GeomDataAPI_Point2D::type());
+  data()->addAttribute(SketchPlugin_Arc::END_ID(), GeomDataAPI_Point2D::type());
 }
 
-void SketchPlugin_Arc::execute() 
+void SketchPlugin_Arc::execute()
 {
   SketchPlugin_Sketch* aSketch = sketch();
   if (aSketch) {
     std::list<boost::shared_ptr<GeomAPI_Shape> > aShapes;
 
     // compute a circle point in 3D view
-    boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = 
-      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      data()->attribute(SketchPlugin_Arc::CENTER_ID()));
-      // compute the arc start point
-      boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = 
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        data()->attribute(SketchPlugin_Arc::START_ID()));
-      if (aCenterAttr->isInitialized() && aStartAttr->isInitialized()) {
-      boost::shared_ptr<GeomAPI_Pnt> aCenter(
-        aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
+    boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+        GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::CENTER_ID()));
+    // compute the arc start point
+    boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+        GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::START_ID()));
+    if (aCenterAttr->isInitialized() && aStartAttr->isInitialized()) {
+      boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
       // make a visible point
       boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
       //aShapes.push_back(aCenterPointShape);
-      boost::shared_ptr<ModelAPI_ResultConstruction> aConstr1 = 
-        document()->createConstruction(data(), 0);
+      boost::shared_ptr<ModelAPI_ResultConstruction> aConstr1 = document()->createConstruction(
+          data(), 0);
       aConstr1->setShape(aCenterPointShape);
       aConstr1->setIsInHistory(false);
       setResult(aConstr1, 0);
 
-
       // make a visible circle
-      boost::shared_ptr<GeomDataAPI_Dir> aNDir = 
-        boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
-        aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+      boost::shared_ptr<GeomDataAPI_Dir> aNDir = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+          aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
       bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
       if (aHasPlane) {
         boost::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
         boost::shared_ptr<GeomAPI_Pnt> aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
 
         // compute and change the arc end point
-        boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr = 
-          boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(
-          SketchPlugin_Arc::END_ID()));
-        if (anEndAttr->isInitialized())
-        {
+        boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr = boost::dynamic_pointer_cast<
+            GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::END_ID()));
+        if (anEndAttr->isInitialized()) {
           boost::shared_ptr<GeomAPI_Circ2d> aCircleForArc(
-            new GeomAPI_Circ2d(aCenterAttr->pnt(), aStartAttr->pnt()));
+              new GeomAPI_Circ2d(aCenterAttr->pnt(), aStartAttr->pnt()));
           boost::shared_ptr<GeomAPI_Pnt2d> aProjection = aCircleForArc->project(anEndAttr->pnt());
           if (aProjection && anEndAttr->pnt()->distance(aProjection) > tolerance)
             anEndAttr->setValue(aProjection);
         }
         boost::shared_ptr<GeomAPI_Pnt> aEndPoint(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
 
-        boost::shared_ptr<GeomAPI_Shape> aCircleShape = 
-                   GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal);
+        boost::shared_ptr<GeomAPI_Shape> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircleArc(
+            aCenter, aStartPoint, aEndPoint, aNormal);
         if (aCircleShape) {
-          boost::shared_ptr<ModelAPI_ResultConstruction> aConstr2 = 
-            document()->createConstruction(data(), 1);
+          boost::shared_ptr<ModelAPI_ResultConstruction> aConstr2 = document()->createConstruction(
+              data(), 1);
           aConstr2->setShape(aCircleShape);
           aConstr2->setIsInHistory(false);
           setResult(aConstr2, 1);
@@ -91,14 +84,14 @@ void SketchPlugin_Arc::execute()
         }
       }
       /*
-      boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
-      // store the result
-      boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = 
-        document()->createConstruction(data());
-      aConstr->setShape(aCompound);
-      aConstr->setIsInHistory(false);
-      setResult(aConstr);
-      */
+       boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
+       // store the result
+       boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = 
+       document()->createConstruction(data());
+       aConstr->setShape(aCompound);
+       aConstr->setIsInHistory(false);
+       setResult(aConstr);
+       */
     }
   }
 }
@@ -109,19 +102,16 @@ void SketchPlugin_Arc::move(double theDeltaX, double theDeltaY)
   if (!aData->isValid())
     return;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Arc::CENTER_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Arc::CENTER_ID()));
   aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Arc::START_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Arc::START_ID()));
   aPoint2->setValue(aPoint2->x() + theDeltaX, aPoint2->y() + theDeltaY);
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint3 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Arc::END_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint3 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Arc::END_ID()));
   aPoint3->setValue(aPoint3->x() + theDeltaX, aPoint3->y() + theDeltaY);
 }
 
@@ -130,21 +120,18 @@ double SketchPlugin_Arc::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>&
   double aDelta = 0;
   boost::shared_ptr<ModelAPI_Data> aData = data();
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Arc::CENTER_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Arc::CENTER_ID()));
   aDelta = aPoint1->pnt()->distance(thePoint);
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Arc::START_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Arc::START_ID()));
   double aDistance = aPoint2->pnt()->distance(thePoint);
   if (aDelta < aDistance)
     aDelta = aDistance;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint3 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Arc::END_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint3 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Arc::END_ID()));
   aDistance = aPoint3->pnt()->distance(thePoint);
   if (aDelta < aDistance)
     aDelta = aDistance;
index 26815bc9ec1586bb04b05da1ae7ac2f8d6c61b79..00ada99b0c1f797dd497c6834a99521af2bf460d 100644 (file)
@@ -14,9 +14,9 @@
  * \ingroup DataModel
  * \brief Feature for creation of the new arc of circle in PartSet.
  */
-class SketchPlugin_Arc: public SketchPlugin_Feature//, public GeomAPI_IPresentable
+class SketchPlugin_Arc : public SketchPlugin_Feature  //, public GeomAPI_IPresentable
 {
-public:
+ public:
   /// Arc feature kind
   inline static const std::string& ID()
   {
@@ -45,7 +45,10 @@ public:
 
   /// Returns the kind of a feature
   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
-  {static std::string MY_KIND = SketchPlugin_Arc::ID(); return MY_KIND;}
+  {
+    static std::string MY_KIND = SketchPlugin_Arc::ID();
+    return MY_KIND;
+  }
 
   /// Creates an arc-shape
   SKETCHPLUGIN_EXPORT virtual void execute();
@@ -55,7 +58,9 @@ public:
 
   /// Returns the AIS preview
   virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
-  {return simpleAISObject(firstResult(), thePrevious);}
+  {
+    return simpleAISObject(firstResult(), thePrevious);
+  }
 
   /// Moves the feature
   /// \param theDeltaX the delta for X coordinate is moved
index 7dd1d3f601866970c806db4a9ca6435a53e42bbe..635214f42fa39c3b70a7b92fcc0ce11aee90397e 100644 (file)
@@ -16,7 +16,7 @@
 #include <ModelAPI_AttributeDouble.h>
 
 SketchPlugin_Circle::SketchPlugin_Circle()
-  : SketchPlugin_Feature()
+    : SketchPlugin_Feature()
 {
 }
 
@@ -33,52 +33,49 @@ void SketchPlugin_Circle::execute()
     std::list<boost::shared_ptr<GeomAPI_Shape> > aShapes;
 
     // compute a circle point in 3D view
-    boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = 
-      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      data()->attribute(SketchPlugin_Circle::CENTER_ID()));
-    AttributeDoublePtr aRadiusAttr = 
-      boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
-      data()->attribute(SketchPlugin_Circle::RADIUS_ID()));
+    boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+        GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Circle::CENTER_ID()));
+    AttributeDoublePtr aRadiusAttr = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+        data()->attribute(SketchPlugin_Circle::RADIUS_ID()));
     if (aCenterAttr->isInitialized() && aRadiusAttr->isInitialized()) {
       boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
       // make a visible point
       boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
       //aShapes.push_back(aCenterPointShape);
-      boost::shared_ptr<ModelAPI_ResultConstruction> aConstr1 = 
-        document()->createConstruction(data(), 0);
+      boost::shared_ptr<ModelAPI_ResultConstruction> aConstr1 = document()->createConstruction(
+          data(), 0);
       aConstr1->setShape(aCenterPointShape);
       aConstr1->setIsInHistory(false);
       setResult(aConstr1, 0);
 
       // make a visible circle
-      boost::shared_ptr<GeomDataAPI_Dir> aNDir = 
-        boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aSketch->data()->attribute(
-        SketchPlugin_Sketch::NORM_ID()));
+      boost::shared_ptr<GeomDataAPI_Dir> aNDir = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+          aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
       bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
       if (aHasPlane) {
         boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
         // compute the circle radius
         double aRadius = aRadiusAttr->value();
 
-        boost::shared_ptr<GeomAPI_Shape> aCircleShape = 
-                                GeomAlgoAPI_EdgeBuilder::lineCircle(aCenter, aNormal, aRadius);
+        boost::shared_ptr<GeomAPI_Shape> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(
+            aCenter, aNormal, aRadius);
         aShapes.push_back(aCircleShape);
-        boost::shared_ptr<ModelAPI_ResultConstruction> aConstr2 = 
-          document()->createConstruction(data(), 1);
+        boost::shared_ptr<ModelAPI_ResultConstruction> aConstr2 = document()->createConstruction(
+            data(), 1);
         aConstr2->setShape(aCircleShape);
         aConstr2->setIsInHistory(false);
         setResult(aConstr2, 1);
       }
     }
     /*
-    boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
-      // store the result
-      boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = 
-        document()->createConstruction(data());
-      aConstr->setShape(aCompound);
-      aConstr->setIsInHistory(false);
-      setResult(aConstr);
-      */
+     boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
+     // store the result
+     boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = 
+     document()->createConstruction(data());
+     aConstr->setShape(aCompound);
+     aConstr->setIsInHistory(false);
+     setResult(aConstr);
+     */
   }
 }
 
@@ -88,18 +85,16 @@ void SketchPlugin_Circle::move(double theDeltaX, double theDeltaY)
   if (!aData->isValid())
     return;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Circle::CENTER_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Circle::CENTER_ID()));
   aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
 }
 
 double SketchPlugin_Circle::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
 {
   boost::shared_ptr<ModelAPI_Data> aData = data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Circle::CENTER_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Circle::CENTER_ID()));
 
   return aPoint->pnt()->distance(thePoint);
 }
index 5c7cc7aa7ff31c950067a974c371cdf9fc615c3e..c489f1014c45c8c6c5ad7320881a717240c6ba51 100644 (file)
@@ -14,9 +14,9 @@
  * \ingroup DataModel
  * \brief Feature for creation of the new circle in PartSet.
  */
-class SketchPlugin_Circle: public SketchPlugin_Feature//, public GeomAPI_IPresentable
+class SketchPlugin_Circle : public SketchPlugin_Feature  //, public GeomAPI_IPresentable
 {
-public:
+ public:
   /// Circle feature kind
   inline static const std::string& ID()
   {
@@ -39,8 +39,11 @@ public:
   }
 
   /// Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = SketchPlugin_Circle::ID(); return MY_KIND;}
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_Circle::ID();
+    return MY_KIND;
+  }
 
   /// Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
@@ -50,12 +53,16 @@ public:
 
   /// Returns the AIS preview
   virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
-  {return simpleAISObject(firstResult(), thePrevious);}
+  {
+    return simpleAISObject(firstResult(), thePrevious);
+  }
 
   /// Adds sub-feature of the higher level feature (sub-element of the sketch)
   /// \param theFeature sub-feature
-  SKETCHPLUGIN_EXPORT virtual const void addSub(
-    const FeaturePtr& theFeature) {};
+  SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature)
+  {
+  }
+  ;
 
   /// Moves the feature
   /// \param theDeltaX the delta for X coordinate is moved
index 01fbe230fbcdec6951020ed800177b9399367443..c621c58f562539c7bf06f93233ec821e3ea4330d 100644 (file)
@@ -16,9 +16,9 @@ const unsigned int CONSTRAINT_ATTR_SIZE = 4;
  *  \brief Abstract interface to the SketchPlugin_ConstraintBase
  *         For more info see: SketchPlugin_ConstraintBase.h
  */
-class SketchPlugin_Constraint: public SketchPlugin_Feature
+class SketchPlugin_Constraint : public SketchPlugin_Feature
 {
-public:
+ public:
   /// The value parameter for the constraint
   inline static const std::string& VALUE()
   {
@@ -57,21 +57,29 @@ public:
   }
 
   /// List of constraint attributes
-  inline static const std::string& ATTRIBUTE(const int theNumber) {
+  inline static const std::string& ATTRIBUTE(const int theNumber)
+  {
     switch (theNumber) {
-      case 0: return ENTITY_A();
-      case 1: return ENTITY_B();
-      case 2: return ENTITY_C();
-      case 3: return ENTITY_D();
-      default: break;
+      case 0:
+        return ENTITY_A();
+      case 1:
+        return ENTITY_B();
+      case 2:
+        return ENTITY_C();
+      case 3:
+        return ENTITY_D();
+      default:
+        break;
     }
     static const std::string EMPTY_STRING("");
     return EMPTY_STRING;
   }
 
-protected:
+ protected:
   /// \brief Use plugin manager for features creation
-  SketchPlugin_Constraint() {}
+  SketchPlugin_Constraint()
+  {
+  }
 };
 
 #endif
index b743c0be340eed7339a860ce486d04d33ca79c51..f8ecab3651bc86b653991a2a36cf39d8d55a4a82 100644 (file)
@@ -5,7 +5,7 @@
 #include "SketchPlugin_ConstraintBase.h"
 
 AISObjectPtr SketchPlugin_ConstraintBase::getAISObject(AISObjectPtr thePrevious)
-{ 
+{
   return thePrevious;
 }
 
@@ -19,7 +19,8 @@ void SketchPlugin_ConstraintBase::move(const double theDeltaX, const double theD
 
 }
 
-double SketchPlugin_ConstraintBase::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+double SketchPlugin_ConstraintBase::distanceToPoint(
+    const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
 {
   return 0;
 }
index e08bf7682be26adcfe323dddce57640cabcab29e..b027076cc5ce6e8ba1e990050fa8dccc8d4c8872 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <list>
 
-
 /*  Description: 
  *    Each constraint uses a set of parameters. In the SolveSpace library 
  *    these parameters are named "valA", "ptA", "ptB", "entityA", "entityB". 
  *         Some feature's methods implemented here as dummy to
  *         Base class for all constraints.
  */
-class SketchPlugin_ConstraintBase: public SketchPlugin_Constraint,
-                                   public GeomAPI_IPresentable
+class SketchPlugin_ConstraintBase : public SketchPlugin_Constraint, public GeomAPI_IPresentable
 {
-public:
+ public:
   /// Returns the AIS preview
   SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
 
@@ -55,9 +53,11 @@ public:
   /// \param thePoint the point
   virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
 
-protected:
+ protected:
   /// \brief Use plugin manager for features creation
-  SketchPlugin_ConstraintBase() {}
+  SketchPlugin_ConstraintBase()
+  {
+  }
 };
 
 #endif
index e6595af3050d83abe25d6946b2df370826d980f1..78c580426a95c0db16fc7b301f30e6b2e86e4859 100644 (file)
@@ -17,9 +17,9 @@
  *  These constraint has two attributes:
  *  SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
  */
-class SketchPlugin_ConstraintCoincidence: public SketchPlugin_ConstraintBase
+class SketchPlugin_ConstraintCoincidence : public SketchPlugin_ConstraintBase
 {
-public:
+ public:
   /// Parallel constraint kind
   inline static const std::string& ID()
   {
@@ -27,8 +27,11 @@ public:
     return MY_CONSTRAINT_COINCIDENCE_ID;
   }
   /// \brief Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = SketchPlugin_ConstraintCoincidence::ID(); return MY_KIND;}
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_ConstraintCoincidence::ID();
+    return MY_KIND;
+  }
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index ab8bba03646e1e80c09640c3a7bbd73c8d6b4390..e8ea4bfbed0c10497c1a1b40e82b36023e3b74cf 100644 (file)
@@ -23,7 +23,7 @@ SketchPlugin_ConstraintDistance::SketchPlugin_ConstraintDistance()
 //*************************************************************************************
 void SketchPlugin_ConstraintDistance::initAttributes()
 {
-  data()->addAttribute(SketchPlugin_Constraint::VALUE(),    ModelAPI_AttributeDouble::type());
+  data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::type());
   data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::type());
   data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::type());
   data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::type());
@@ -33,28 +33,27 @@ void SketchPlugin_ConstraintDistance::initAttributes()
 void SketchPlugin_ConstraintDistance::execute()
 {
   boost::shared_ptr<ModelAPI_Data> aData = data();
-  AttributeDoublePtr anAttr_Value =
-    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+  AttributeDoublePtr anAttr_Value = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
       aData->attribute(SketchPlugin_Constraint::VALUE()));
 
   if (!anAttr_Value->isInitialized()) {
-    boost::shared_ptr<GeomDataAPI_Point2D> aPoint_A = 
-      getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A());
-    boost::shared_ptr<GeomDataAPI_Point2D> aPoint_B = 
-      getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B());
-  
-    if (aPoint_A && aPoint_B) { // both points
-        anAttr_Value->setValue(aPoint_A->pnt()->distance(aPoint_B->pnt()));
+    boost::shared_ptr<GeomDataAPI_Point2D> aPoint_A = getFeaturePoint(
+        aData, SketchPlugin_Constraint::ENTITY_A());
+    boost::shared_ptr<GeomDataAPI_Point2D> aPoint_B = getFeaturePoint(
+        aData, SketchPlugin_Constraint::ENTITY_B());
+
+    if (aPoint_A && aPoint_B) {  // both points
+      anAttr_Value->setValue(aPoint_A->pnt()->distance(aPoint_B->pnt()));
     } else {
-      if (!aPoint_A && aPoint_B) { //Line and point
-        boost::shared_ptr<SketchPlugin_Line> aLine = 
-          getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A());
+      if (!aPoint_A && aPoint_B) {  //Line and point
+        boost::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
+            aData, SketchPlugin_Constraint::ENTITY_A());
         if (aLine)
           anAttr_Value->setValue(aLine->distanceToPoint(aPoint_B->pnt()));
-      } else if (aPoint_A && !aPoint_B) { // Point and line
-        boost::shared_ptr<SketchPlugin_Line> aLine = 
-          getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B());
-        if(aLine)
+      } else if (aPoint_A && !aPoint_B) {  // Point and line
+        boost::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
+            aData, SketchPlugin_Constraint::ENTITY_B());
+        if (aLine)
           anAttr_Value->setValue(aLine->distanceToPoint(aPoint_A->pnt()));
       }
     }
@@ -70,8 +69,10 @@ AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevi
   boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
 
   DataPtr aData = data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint_A = getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A());
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint_B = getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B());
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint_A = getFeaturePoint(
+      aData, SketchPlugin_Constraint::ENTITY_A());
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint_B = getFeaturePoint(
+      aData, SketchPlugin_Constraint::ENTITY_B());
 
   boost::shared_ptr<GeomAPI_Pnt2d> aPnt_A;
   boost::shared_ptr<GeomAPI_Pnt2d> aPnt_B;
@@ -80,15 +81,15 @@ AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevi
     aPnt_A = aPoint_A->pnt();
     aPnt_B = aPoint_B->pnt();
   } else if (!aPoint_A && aPoint_B) {
-    boost::shared_ptr<SketchPlugin_Line> aLine = 
-      getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A());
+    boost::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
+        aData, SketchPlugin_Constraint::ENTITY_A());
     if (aLine) {
       aPnt_B = aPoint_B->pnt();
       aPnt_A = getProjectionPoint(aLine, aPnt_B);
     }
   } else if (aPoint_A && !aPoint_B) {
-    boost::shared_ptr<SketchPlugin_Line> aLine = 
-      getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B());
+    boost::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
+        aData, SketchPlugin_Constraint::ENTITY_B());
     if (aLine) {
       aPnt_A = aPoint_A->pnt();
       aPnt_B = getProjectionPoint(aLine, aPnt_A);
@@ -97,18 +98,18 @@ AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevi
   if (!aPnt_A || !aPnt_B)
     return thePrevious;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = boost::dynamic_pointer_cast<
+      GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
 
   boost::shared_ptr<GeomAPI_Pnt> aPoint1 = sketch()->to3D(aPnt_A->x(), aPnt_A->y());
   boost::shared_ptr<GeomAPI_Pnt> aPoint2 = sketch()->to3D(aPnt_B->x(), aPnt_B->y());
-  boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = aFlyOutAttr->isInitialized() ? 
-                                              sketch()->to3D(aFlyOutAttr->x(), aFlyOutAttr->y()) : 
-                                              boost::shared_ptr<GeomAPI_Pnt>();
+  boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt =
+      aFlyOutAttr->isInitialized() ?
+          sketch()->to3D(aFlyOutAttr->x(), aFlyOutAttr->y()) : boost::shared_ptr<GeomAPI_Pnt>();
 
   // value calculation
-  boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
+  boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
   double aValue = aValueAttr->value();
 
   AISObjectPtr anAIS = thePrevious;
@@ -117,7 +118,8 @@ AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevi
   anAIS->createDistance(aPoint1, aPoint2, aFlyoutPnt, aPlane, aValue);
 
   // Set color from preferences
-  std::vector<int> aRGB = Config_PropManager::color("Visualization", "distance_color", DISTANCE_COLOR);
+  std::vector<int> aRGB = Config_PropManager::color("Visualization", "distance_color",
+                                                    DISTANCE_COLOR);
   anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
   return anAIS;
 }
@@ -129,8 +131,8 @@ void SketchPlugin_ConstraintDistance::move(double theDeltaX, double theDeltaY)
   if (!aData->isValid())
     return;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
   aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
 }
 
@@ -144,32 +146,33 @@ boost::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
     return aPointAttr;
 
   FeaturePtr aFeature;
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
   if (anAttr)
     aFeature = ModelAPI_Feature::feature(anAttr->object());
 
   if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID())
-    aPointAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                           (aFeature->data()->attribute(SketchPlugin_Point::COORD_ID()));
+    aPointAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aFeature->data()->attribute(SketchPlugin_Point::COORD_ID()));
   else if (aFeature && aFeature->getKind() == SketchPlugin_Circle::ID())
-    aPointAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
-                                          (aFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
+    aPointAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
   else if (anAttr->attr()) {
-      aPointAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
+    aPointAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
   }
   return aPointAttr;
 }
 
 //*************************************************************************************
-boost::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData, const std::string& theAttribute)
+boost::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
+                                                    const std::string& theAttribute)
 {
   boost::shared_ptr<SketchPlugin_Line> aLine;
   if (!theData)
     return aLine;
 
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
   if (anAttr) {
     FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object());
     if (aFeature && aFeature->getKind() == SketchPlugin_Line::ID()) {
@@ -180,16 +183,15 @@ boost::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData, const std::
 }
 
 //*************************************************************************************
-boost::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(const boost::shared_ptr<SketchPlugin_Line>& theLine, 
-                                                          const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+boost::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
+    const boost::shared_ptr<SketchPlugin_Line>& theLine,
+    const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
 {
   boost::shared_ptr<ModelAPI_Data> aData = theLine->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Line::START_ID()));
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Line::END_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Line::START_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Line::END_ID()));
 
   GeomAPI_Lin2d aLin2d(aPoint1->x(), aPoint1->y(), aPoint2->x(), aPoint2->y());
   return aLin2d.project(thePoint);
index 17d795a898f4c49454962620d3c1676262c9870b..69ff19762c8b16f380234c60c0f83f3ccd1fa93d 100644 (file)
@@ -25,9 +25,9 @@ class GeomDataAPI_Point2D;
  *  These constraint has three attributes:
  *  SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
  */
-class SketchPlugin_ConstraintDistance: public SketchPlugin_ConstraintBase
+class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase
 {
-public:
+ public:
   /// Distance constraint kind
   inline static const std::string& ID()
   {
@@ -36,8 +36,11 @@ public:
   }
 
   /// \brief Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = SketchPlugin_ConstraintDistance::ID(); return MY_KIND;}
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_ConstraintDistance::ID();
+    return MY_KIND;
+  }
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
@@ -57,15 +60,15 @@ public:
   SketchPlugin_ConstraintDistance();
 };
 
-
 /// Obtain the point object from specified constraint parameter
 boost::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
-                                                       const std::string&  theAttribute);
-
-boost::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData, const std::string& theAttribute);
+                                                       const std::string& theAttribute);
 
-boost::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(const boost::shared_ptr<SketchPlugin_Line>& theLine, 
-                                                    const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+boost::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
+                                                    const std::string& theAttribute);
 
+boost::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
+    const boost::shared_ptr<SketchPlugin_Line>& theLine,
+    const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
 
 #endif
index 248a9d2c0c4a2e316cfdcebcd1096ebb39904af4..94f23ae872d71596462cfc77dc844f7ee91c4cbf 100644 (file)
 
 #include <Config_PropManager.h>
 
-
 SketchPlugin_ConstraintLength::SketchPlugin_ConstraintLength()
 {
 }
 
 void SketchPlugin_ConstraintLength::initAttributes()
 {
-  data()->addAttribute(SketchPlugin_Constraint::VALUE(),    ModelAPI_AttributeDouble::type());
+  data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::type());
   data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::type());
   data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::type());
 }
 
 void SketchPlugin_ConstraintLength::execute()
 {
-  if (data()->attribute(SketchPlugin_Constraint::ENTITY_A())->isInitialized() &&
-      !data()->attribute(SketchPlugin_Constraint::VALUE())->isInitialized()) {
+  if (data()->attribute(SketchPlugin_Constraint::ENTITY_A())->isInitialized()
+      && !data()->attribute(SketchPlugin_Constraint::VALUE())->isInitialized()) {
 
-    boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-      boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
+    boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+        ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
     FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
     if (aFeature) {
       // set length value
-      boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::START_ID()));
-      boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::END_ID()));
+      boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<
+          GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::START_ID()));
+      boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<
+          GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::END_ID()));
 
       double aLenght = aPoint1->pnt()->distance(aPoint2->pnt());
 
-      boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = 
-        boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
+      boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+          ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
       aValueAttr->setValue(aLenght);
     }
   }
@@ -61,32 +60,32 @@ AISObjectPtr SketchPlugin_ConstraintLength::getAISObject(AISObjectPtr thePreviou
 
   boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
 
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
   if (!anAttr)
     return thePrevious;
   FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object());
   if (!aFeature || aFeature->getKind() != SketchPlugin_Line::ID())
     return thePrevious;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = boost::dynamic_pointer_cast<
+      GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
 
   DataPtr aData = aFeature->data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aStartPoint =
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::START_ID()));
-  boost::shared_ptr<GeomDataAPI_Point2D> anEndPoint =
-      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aStartPoint = boost::dynamic_pointer_cast<
+      GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::START_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> anEndPoint = boost::dynamic_pointer_cast<
+      GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
 
   boost::shared_ptr<GeomAPI_Pnt> aPoint1 = sketch()->to3D(aStartPoint->x(), aStartPoint->y());
-  boost::shared_ptr<GeomAPI_Pnt> aPoint2 = sketch()->to3D(anEndPoint->x(),  anEndPoint->y());
-  boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = aFlyOutAttr->isInitialized() ? 
-                                              sketch()->to3D(aFlyOutAttr->x(), aFlyOutAttr->y()) : 
-                                              boost::shared_ptr<GeomAPI_Pnt>();
+  boost::shared_ptr<GeomAPI_Pnt> aPoint2 = sketch()->to3D(anEndPoint->x(), anEndPoint->y());
+  boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt =
+      aFlyOutAttr->isInitialized() ?
+          sketch()->to3D(aFlyOutAttr->x(), aFlyOutAttr->y()) : boost::shared_ptr<GeomAPI_Pnt>();
 
   // value calculation
-  boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
+  boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
   double aValue = aValueAttr->value();
 
   AISObjectPtr anAIS = thePrevious;
@@ -106,8 +105,8 @@ void SketchPlugin_ConstraintLength::move(double theDeltaX, double theDeltaY)
   if (!aData->isValid())
     return;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
   aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
 }
 
index 33afa88147be3086ae504b9b143077b109652be3..456c0c27c15efc694225e514a52dfbfc79bd3b9c 100644 (file)
@@ -20,9 +20,9 @@
  *  SketchPlugin_Constraint::VALUE() (length) and SketchPlugin_Constraint::ENTITY_A() (segment),
  *  SketchPlugin_Constraint::FLYOUT_VALUE_PNT() (distance of a constraints handle)
  */
-class SketchPlugin_ConstraintLength: public SketchPlugin_ConstraintBase
+class SketchPlugin_ConstraintLength : public SketchPlugin_ConstraintBase
 {
-public:
+ public:
   /// Length constraint kind
   inline static const std::string& ID()
   {
@@ -30,8 +30,11 @@ public:
     return MY_CONSTRAINT_LENGTH_ID;
   }
   /// \brief Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = SketchPlugin_ConstraintLength::ID(); return MY_KIND;}
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_ConstraintLength::ID();
+    return MY_KIND;
+  }
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index c39b4b3dbfb65a9155b542d1f35c899bcf87871c..3503ff45d5e076f440990e409015182f7a88a1bf 100644 (file)
@@ -38,40 +38,41 @@ AISObjectPtr SketchPlugin_ConstraintParallel::getAISObject(AISObjectPtr thePrevi
     return thePrevious;
 
   boost::shared_ptr<ModelAPI_Data> aData = data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr1 = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr2 = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
-  if (!anAttr1 || !anAttr1->isObject() || 
-      !anAttr2 || !anAttr2->isObject())
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr1 = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr2 = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
+  if (!anAttr1 || !anAttr1->isObject() || !anAttr2 || !anAttr2->isObject())
     return thePrevious;
 
   FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr1->object());
   if (!aFeature)
     return thePrevious;
-  boost::shared_ptr<SketchPlugin_Line> aLine1Feature = 
-    boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
+  boost::shared_ptr<SketchPlugin_Line> aLine1Feature =
+      boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
 
   aFeature = ModelAPI_Feature::feature(anAttr2->object());
   if (!aFeature)
     return thePrevious;
-  boost::shared_ptr<SketchPlugin_Line> aLine2Feature = 
-    boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
+  boost::shared_ptr<SketchPlugin_Line> aLine2Feature =
+      boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
 
   if (!aLine1Feature || !aLine2Feature)
     return thePrevious;
 
   boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
   boost::shared_ptr<GeomAPI_Shape> aLine1, aLine2;
-  boost::shared_ptr<ModelAPI_ResultConstruction> aConst1 = 
-    boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anAttr1->object());
-  if (aConst1) aLine1 = aConst1->shape();
-  boost::shared_ptr<ModelAPI_ResultConstruction> aConst2 = 
-    boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anAttr2->object());
-  if (aConst2) aLine2 = aConst2->shape();
-
-  boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+  boost::shared_ptr<ModelAPI_ResultConstruction> aConst1 = boost::dynamic_pointer_cast<
+      ModelAPI_ResultConstruction>(anAttr1->object());
+  if (aConst1)
+    aLine1 = aConst1->shape();
+  boost::shared_ptr<ModelAPI_ResultConstruction> aConst2 = boost::dynamic_pointer_cast<
+      ModelAPI_ResultConstruction>(anAttr2->object());
+  if (aConst2)
+    aLine2 = aConst2->shape();
+
+  boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = boost::dynamic_pointer_cast<
+      GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
   boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y());
 
   AISObjectPtr anAIS = thePrevious;
@@ -80,7 +81,8 @@ AISObjectPtr SketchPlugin_ConstraintParallel::getAISObject(AISObjectPtr thePrevi
   anAIS->createParallel(aLine1, aLine2, aFlyoutPnt, aPlane);
 
   // Set color from preferences
-  std::vector<int> aRGB = Config_PropManager::color("Visualization", "parallel_color", PARALLEL_COLOR);
+  std::vector<int> aRGB = Config_PropManager::color("Visualization", "parallel_color",
+                                                    PARALLEL_COLOR);
   anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
   return anAIS;
 }
@@ -91,8 +93,8 @@ void SketchPlugin_ConstraintParallel::move(double theDeltaX, double theDeltaY)
   if (!aData->isValid())
     return;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
   aPoint->setValue(aPoint->x() + theDeltaX, aPoint->y() + theDeltaY);
 }
 
index 9a77a7a7bb6b0e0a76c6dfb8712785eb7ade5426..053fe5f36568d74d52bb78178e255de5b02f1a97 100644 (file)
@@ -9,7 +9,6 @@
 #include <SketchPlugin_Sketch.h>
 #include "SketchPlugin_ConstraintBase.h"
 
-
 #define PARALLEL_COLOR "#ffff00"
 
 /** \class SketchPlugin_ConstraintParallel
@@ -19,9 +18,9 @@
  *  These constraint has two attributes:
  *  SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
  */
-class SketchPlugin_ConstraintParallel: public SketchPlugin_ConstraintBase
+class SketchPlugin_ConstraintParallel : public SketchPlugin_ConstraintBase
 {
-public:
+ public:
   /// Parallel constraint kind
   inline static const std::string& ID()
   {
@@ -29,8 +28,11 @@ public:
     return MY_CONSTRAINT_PARALLEL_ID;
   }
   /// \brief Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = SketchPlugin_ConstraintParallel::ID(); return MY_KIND;}
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_ConstraintParallel::ID();
+    return MY_KIND;
+  }
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 826fc50b8fec7bb938f4bc1f1441d02acd851e8c..c21920928e44752b58b7bf0933be159ae3c11835 100644 (file)
@@ -38,37 +38,38 @@ AISObjectPtr SketchPlugin_ConstraintPerpendicular::getAISObject(AISObjectPtr the
     return thePrevious;
 
   boost::shared_ptr<ModelAPI_Data> aData = data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr1 = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr2 = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
-  if (!anAttr1 || !anAttr1->isObject() || 
-      !anAttr2 || !anAttr2->isObject())
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr1 = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr2 = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
+  if (!anAttr1 || !anAttr1->isObject() || !anAttr2 || !anAttr2->isObject())
     return thePrevious;
 
   FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr1->object());
   if (!aFeature)
     return thePrevious;
-  boost::shared_ptr<SketchPlugin_Line> aLine1Feature = 
-    boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
+  boost::shared_ptr<SketchPlugin_Line> aLine1Feature =
+      boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
 
   aFeature = ModelAPI_Feature::feature(anAttr2->object());
   if (!aFeature)
     return thePrevious;
-  boost::shared_ptr<SketchPlugin_Line> aLine2Feature = 
-    boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
+  boost::shared_ptr<SketchPlugin_Line> aLine2Feature =
+      boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
 
   if (!aLine1Feature || !aLine2Feature)
     return thePrevious;
 
   boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
   boost::shared_ptr<GeomAPI_Shape> aLine1, aLine2;
-  boost::shared_ptr<ModelAPI_ResultConstruction> aConst1 = 
-    boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anAttr1->object());
-  if (aConst1) aLine1 = aConst1->shape();
-  boost::shared_ptr<ModelAPI_ResultConstruction> aConst2 = 
-    boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anAttr2->object());
-  if (aConst2) aLine2 = aConst2->shape();
+  boost::shared_ptr<ModelAPI_ResultConstruction> aConst1 = boost::dynamic_pointer_cast<
+      ModelAPI_ResultConstruction>(anAttr1->object());
+  if (aConst1)
+    aLine1 = aConst1->shape();
+  boost::shared_ptr<ModelAPI_ResultConstruction> aConst2 = boost::dynamic_pointer_cast<
+      ModelAPI_ResultConstruction>(anAttr2->object());
+  if (aConst2)
+    aLine2 = aConst2->shape();
 
   AISObjectPtr anAIS = thePrevious;
   if (!anAIS)
@@ -76,7 +77,8 @@ AISObjectPtr SketchPlugin_ConstraintPerpendicular::getAISObject(AISObjectPtr the
   anAIS->createPerpendicular(aLine1, aLine2, aPlane);
 
   // Set color from preferences
-  std::vector<int> aRGB = Config_PropManager::color("Visualization", "perpendicular_color", PERPENDICULAR_COLOR);
+  std::vector<int> aRGB = Config_PropManager::color("Visualization", "perpendicular_color",
+                                                    PERPENDICULAR_COLOR);
   anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
   return anAIS;
 }
@@ -87,8 +89,8 @@ void SketchPlugin_ConstraintPerpendicular::move(double theDeltaX, double theDelt
   if (!aData->isValid())
     return;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
   aPoint->setValue(aPoint->x() + theDeltaX, aPoint->y() + theDeltaY);
 }
 
index b0bc7ff9e59b6547abe420ed4f5e419e97c76266..9b304c8d4ab813c75ac39122f92eb34e6db51402 100644 (file)
@@ -18,9 +18,9 @@
  *  These constraint has two attributes:
  *  SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
  */
-class SketchPlugin_ConstraintPerpendicular: public SketchPlugin_ConstraintBase
+class SketchPlugin_ConstraintPerpendicular : public SketchPlugin_ConstraintBase
 {
-public:
+ public:
   /// Perpendicular constraint kind
   inline static const std::string& ID()
   {
@@ -28,8 +28,11 @@ public:
     return MY_CONSTRAINT_PERPENDICULAR_ID;
   }
   /// \brief Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = SketchPlugin_ConstraintPerpendicular::ID(); return MY_KIND;}
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_ConstraintPerpendicular::ID();
+    return MY_KIND;
+  }
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index c4ab146e212eb7128813e85db05217cda32abf5c..dcbd7c9ae7fdd9b092edfcf10bf0526cf2b516a4 100644 (file)
@@ -27,38 +27,37 @@ SketchPlugin_ConstraintRadius::SketchPlugin_ConstraintRadius()
 
 void SketchPlugin_ConstraintRadius::initAttributes()
 {
-  data()->addAttribute(SketchPlugin_Constraint::VALUE(),    ModelAPI_AttributeDouble::type());
+  data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::type());
   data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::type());
   data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::type());
 }
 
 void SketchPlugin_ConstraintRadius::execute()
 {
-  if (data()->attribute(SketchPlugin_Constraint::ENTITY_A())->isInitialized() &&
-      !data()->attribute(SketchPlugin_Constraint::VALUE())->isInitialized()) {
+  if (data()->attribute(SketchPlugin_Constraint::ENTITY_A())->isInitialized()
+      && !data()->attribute(SketchPlugin_Constraint::VALUE())->isInitialized()) {
 
-    boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-      boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
+    boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+        ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
     FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
     if (aFeature) {
       double aRadius = 0;
       boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
       if (aFeature->getKind() == SketchPlugin_Circle::ID()) {
-        AttributeDoublePtr anAttribute = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>
-                                            (aData->attribute(SketchPlugin_Circle::RADIUS_ID()));
+        AttributeDoublePtr anAttribute = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+            aData->attribute(SketchPlugin_Circle::RADIUS_ID()));
         if (anAttribute)
           aRadius = anAttribute->value();
-      }
-      else if (aFeature->getKind() == SketchPlugin_Arc::ID()) {
-        boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = 
-          boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::CENTER_ID()));
-        boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = 
-          boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID()));
+      } else if (aFeature->getKind() == SketchPlugin_Arc::ID()) {
+        boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+            GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::CENTER_ID()));
+        boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+            GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID()));
         if (aCenterAttr && aStartAttr)
           aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt());
       }
-      boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = 
-        boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
+      boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+          ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
       aValueAttr->setValue(aRadius);
     }
   }
@@ -70,8 +69,8 @@ AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePreviou
     return thePrevious;
 
   boost::shared_ptr<ModelAPI_Data> aData = data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
   if (!anAttr)
     return thePrevious;
   FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object());
@@ -80,8 +79,8 @@ AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePreviou
     return thePrevious;
 
   // Flyout point
-  boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = boost::dynamic_pointer_cast<
+      GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
   if (!aFlyoutAttr->isInitialized())
     return thePrevious;
   boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y());
@@ -91,30 +90,31 @@ AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePreviou
   boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr;
   double aRadius;
   if (aKind == SketchPlugin_Circle::ID()) {
-    aCenterAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Circle::CENTER_ID()));
-    AttributeDoublePtr aCircRadius = 
-      boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Circle::RADIUS_ID()));
+    aCenterAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aData->attribute(SketchPlugin_Circle::CENTER_ID()));
+    AttributeDoublePtr aCircRadius = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+        aData->attribute(SketchPlugin_Circle::RADIUS_ID()));
     aRadius = aCircRadius->value();
-  }
-  else if (aKind == SketchPlugin_Arc::ID()) {
-    aCenterAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::CENTER_ID()));
-    boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = 
-      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID()));
+  } else if (aKind == SketchPlugin_Arc::ID()) {
+    aCenterAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aData->attribute(SketchPlugin_Arc::CENTER_ID()));
+    boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+        GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID()));
     aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt());
   }
 
   boost::shared_ptr<GeomAPI_Pnt> aCenter = sketch()->to3D(aCenterAttr->x(), aCenterAttr->y());
-  boost::shared_ptr<GeomDataAPI_Dir> aNDir = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(sketch()->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aNDir = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      sketch()->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
   boost::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
   boost::shared_ptr<GeomAPI_Circ> aCircle(new GeomAPI_Circ(aCenter, aNormal, aRadius));
 
   // Value
-  boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
+  boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
   double aValue = aRadius;
   if (aValueAttr && aValueAttr->isInitialized())
-   aValue = aValueAttr->value();
+    aValue = aValueAttr->value();
 
   AISObjectPtr anAIS = thePrevious;
   if (!anAIS)
@@ -133,8 +133,8 @@ void SketchPlugin_ConstraintRadius::move(double theDeltaX, double theDeltaY)
   if (!aData->isValid())
     return;
 
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
   FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
   if (!aFeature)
     return;
@@ -143,18 +143,18 @@ void SketchPlugin_ConstraintRadius::move(double theDeltaX, double theDeltaY)
     aCenterAttrName = SketchPlugin_Circle::CENTER_ID();
   else if (aFeature->getKind() == SketchPlugin_Arc::ID())
     aCenterAttrName = SketchPlugin_Arc::CENTER_ID();
-  boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFeature->data()->attribute(aCenterAttrName));
+  boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+      GeomDataAPI_Point2D>(aFeature->data()->attribute(aCenterAttrName));
   boost::shared_ptr<GeomAPI_Pnt2d> aCenter = aCenterAttr->pnt();
 
   // The specified delta applied on the circle curve, 
   // so it will be scaled due to distance between flyout and center points
-  boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr =
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = boost::dynamic_pointer_cast<
+      GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
   boost::shared_ptr<GeomAPI_Pnt2d> aFlyout = aFlyoutAttr->pnt();
 
-  boost::shared_ptr<ModelAPI_AttributeDouble> aRadius =
-    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
+  boost::shared_ptr<ModelAPI_AttributeDouble> aRadius = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
   double aScale = aFlyout->distance(aCenter) / aRadius->value();
 
   boost::shared_ptr<GeomAPI_Circ2d> aCircle(new GeomAPI_Circ2d(aCenter, aFlyout));
index f330a31ece851d68fd568389b4de86e3a4c20767..eb96ef93d3eb485cb9f890f482e730c2eb9ee7d9 100644 (file)
  *  These constraint has two attributes:
  *  SketchPlugin_Constraint::VALUE() (radius), SketchPlugin_Constraint::ENTITY_A() (a circle)
  */
-class SketchPlugin_ConstraintRadius: public SketchPlugin_ConstraintBase
+class SketchPlugin_ConstraintRadius : public SketchPlugin_ConstraintBase
 {
-public:
+ public:
   /// Radius constraint kind
-  inline static const std::string& ID() {
+  inline static const std::string& ID()
+  {
     static const std::string MY_CONSTRAINT_RADIUS_ID("SketchConstraintRadius");
     return MY_CONSTRAINT_RADIUS_ID;
   }
   /// \brief Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = SketchPlugin_ConstraintRadius::ID(); return MY_KIND;}
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_ConstraintRadius::ID();
+    return MY_KIND;
+  }
 
   /// \brief Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
index 4edfeb8f90f2f82850d1d48cad118691ecb6158c..c3c800bd992ca865bfe4ec7ba0637964c8ac6cfb 100644 (file)
@@ -16,14 +16,14 @@ SketchPlugin_Sketch* SketchPlugin_Feature::sketch()
   if (!mySketch) {
     // find sketch that references to this feature
     int aSketches = document()->size(ModelAPI_Feature::group());
-    for(int a = 0; a < aSketches && !mySketch; a++) {
-      boost::shared_ptr<SketchPlugin_Sketch> aSketch = boost::
-        dynamic_pointer_cast<SketchPlugin_Sketch>(document()->object(ModelAPI_Feature::group(), a));
+    for (int a = 0; a < aSketches && !mySketch; a++) {
+      boost::shared_ptr<SketchPlugin_Sketch> aSketch = boost::dynamic_pointer_cast<
+          SketchPlugin_Sketch>(document()->object(ModelAPI_Feature::group(), a));
       if (aSketch) {
-        std::list<ObjectPtr> aList =
-          aSketch->data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->list();
+        std::list<ObjectPtr> aList = aSketch->data()->reflist(SketchPlugin_Sketch::FEATURES_ID())
+            ->list();
         std::list<ObjectPtr>::iterator aSub = aList.begin();
-        for(; aSub != aList.end(); aSub++) {
+        for (; aSub != aList.end(); aSub++) {
           if ((*aSub)->data()->isEqual(data())) {
             mySketch = aSketch.get();
             break;
@@ -35,14 +35,15 @@ SketchPlugin_Sketch* SketchPlugin_Feature::sketch()
   return mySketch;
 }
 
-AISObjectPtr SketchPlugin_Feature::simpleAISObject(
-    boost::shared_ptr<ModelAPI_Result> theRes, AISObjectPtr thePrevious)
+AISObjectPtr SketchPlugin_Feature::simpleAISObject(boost::shared_ptr<ModelAPI_Result> theRes,
+                                                   AISObjectPtr thePrevious)
 {
-  boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = 
-    boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theRes);
+  boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = boost::dynamic_pointer_cast<
+      ModelAPI_ResultConstruction>(theRes);
 
   boost::shared_ptr<GeomAPI_Shape> aPreview;
-  if (aConstr) aPreview = aConstr->shape();
+  if (aConstr)
+    aPreview = aConstr->shape();
 
   AISObjectPtr aResult = thePrevious;
   if (!aResult)
index 439f1b4f0492bfca90f4024b63aab348b726c503..9deef3f093f2756bd85c7b23a6ad2db8949384c2 100644 (file)
@@ -20,20 +20,25 @@ class Handle_AIS_InteractiveObject;
  * \brief Feature for creation of the new feature in PartSet. This is an abstract class to give
  * an interface to create the sketch feature preview.
  */
-class SketchPlugin_Feature: public ModelAPI_Feature
+class SketchPlugin_Feature : public ModelAPI_Feature
 {
-public:
+ public:
   /// Simple creation of interactive object by the result of the object
-  static AISObjectPtr simpleAISObject(
-    boost::shared_ptr<ModelAPI_Result> theRes, AISObjectPtr thePrevious);
+  static AISObjectPtr simpleAISObject(boost::shared_ptr<ModelAPI_Result> theRes,
+                                      AISObjectPtr thePrevious);
 
   /// Adds sub-feature of the higher level feature (sub-element of the sketch)
   /// \param theFeature sub-feature
-  SKETCHPLUGIN_EXPORT virtual const void addSub(
-    const FeaturePtr& theFeature) {};
+  SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature)
+  {
+  }
+  ;
 
   /// Returns true if this feature must be displayed in the history (top level of Part tree)
-  SKETCHPLUGIN_EXPORT virtual bool isInHistory() {return false;}
+  SKETCHPLUGIN_EXPORT virtual bool isInHistory()
+  {
+    return false;
+  }
 
   /// Moves the feature
   /// \param theDeltaX the delta for X coordinate is moved
@@ -44,9 +49,12 @@ public:
   /// \param thePoint the point
   virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) = 0;
 
-protected:
+ protected:
   /// Sets the higher-level feature for the sub-feature (sketch for line)
-  void setSketch(SketchPlugin_Sketch* theSketch) {mySketch = theSketch;}
+  void setSketch(SketchPlugin_Sketch* theSketch)
+  {
+    mySketch = theSketch;
+  }
   /// Returns the sketch of this feature
   SketchPlugin_Sketch* sketch();
   /// initializes mySketch
@@ -54,9 +62,9 @@ protected:
 
   friend class SketchPlugin_Sketch;
 
-private:
-  boost::shared_ptr<GeomAPI_Shape> myPreview; ///< the preview shape
-  SketchPlugin_Sketch* mySketch; /// sketch that contains this feature
+ private:
+  boost::shared_ptr<GeomAPI_Shape> myPreview;  ///< the preview shape
+  SketchPlugin_Sketch* mySketch;  /// sketch that contains this feature
 };
 
 #endif
index 8f98701349e636a84b92ba8d11783f1d01aa796f..8ae5384bb42cbf8bf057472fe2e64534a6502ce1 100644 (file)
@@ -16,9 +16,8 @@
 
 using namespace std;
 
-
 SketchPlugin_Line::SketchPlugin_Line()
-  : SketchPlugin_Feature()
+    : SketchPlugin_Feature()
 {
 }
 
@@ -28,26 +27,24 @@ void SketchPlugin_Line::initAttributes()
   data()->addAttribute(SketchPlugin_Line::END_ID(), GeomDataAPI_Point2D::type());
 }
 
-void SketchPlugin_Line::execute() 
+void SketchPlugin_Line::execute()
 {
   SketchPlugin_Sketch* aSketch = sketch();
   if (aSketch) {
     // compute a start point in 3D view
-    boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = 
-      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      data()->attribute(SketchPlugin_Line::START_ID()));
+    boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+        GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Line::START_ID()));
     // compute an end point in 3D view
-    boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr = 
-      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      data()->attribute(SketchPlugin_Line::END_ID()));
+    boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr = boost::dynamic_pointer_cast<
+        GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Line::END_ID()));
     if (aStartAttr->isInitialized() && anEndAttr->isInitialized()) {
       boost::shared_ptr<GeomAPI_Pnt> aStart(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
       boost::shared_ptr<GeomAPI_Pnt> anEnd(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
       // make linear edge
       boost::shared_ptr<GeomAPI_Shape> anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd);
       // store the result
-      boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = 
-        document()->createConstruction(data());
+      boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(
+          data());
       aConstr->setShape(anEdge);
       aConstr->setIsInHistory(false);
       setResult(aConstr);
@@ -61,14 +58,12 @@ void SketchPlugin_Line::move(double theDeltaX, double theDeltaY)
   if (!aData->isValid())
     return;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Line::START_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Line::START_ID()));
   aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Line::END_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Line::END_ID()));
   aPoint2->setValue(aPoint2->x() + theDeltaX, aPoint2->y() + theDeltaY);
 }
 
@@ -77,20 +72,17 @@ double SketchPlugin_Line::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>
   double aDelta = 0;
 
   boost::shared_ptr<ModelAPI_Data> aData = data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Line::START_ID()));
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Line::END_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Line::START_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Line::END_ID()));
 
   GeomAPI_Lin2d aLin2d(aPoint1->x(), aPoint1->y(), aPoint2->x(), aPoint2->y());
 
-  if (false/*projection*/) { // TODO: if it has not been necessary, remove this block
+  if (false/*projection*/) {  // TODO: if it has not been necessary, remove this block
     boost::shared_ptr<GeomAPI_Pnt2d> aResult = aLin2d.project(thePoint);
     aDelta = aResult->distance(thePoint);
-  }
-  else { // distance
+  } else {  // distance
     aDelta = aLin2d.distance(thePoint);
   }
 
index 636b7337d00813dc916871cea974c4ce4ad13948..d2656e5d83ec89dfaa0360aa6a2b618947a3b8c7 100644 (file)
@@ -14,9 +14,9 @@
  * \ingroup DataModel
  * \brief Feature for creation of the new part in PartSet.
  */
-class SketchPlugin_Line: public SketchPlugin_Feature
+class SketchPlugin_Line : public SketchPlugin_Feature
 {
-public:
+ public:
   /// Arc feature kind
   inline static const std::string& ID()
   {
@@ -29,7 +29,7 @@ public:
     static const std::string MY_START_ID("StartPoint");
     return MY_START_ID;
   }
-    /// End 2D point of the line
+  /// End 2D point of the line
   inline static const std::string& END_ID()
   {
     static const std::string MY_END_ID("EndPoint");
@@ -37,8 +37,11 @@ public:
   }
 
   /// Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = SketchPlugin_Line::ID(); return MY_KIND;}
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_Line::ID();
+    return MY_KIND;
+  }
 
   /// Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
@@ -48,7 +51,9 @@ public:
 
   /// Returns the AIS preview
   SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
-  {return simpleAISObject(firstResult(), thePrevious);}
+  {
+    return simpleAISObject(firstResult(), thePrevious);
+  }
 
   /// Moves the feature
   /// \param theDeltaX the delta for X coordinate is moved
index eb0b16c3f7bb697ef7796cc62c67efb8aab8fe37..0ac34f1f2c93a605f4a179e91ede927b1ca121af 100644 (file)
@@ -22,40 +22,34 @@ using namespace std;
 // the only created instance of this plugin
 static SketchPlugin_Plugin* MY_INSTANCE = new SketchPlugin_Plugin();
 
-SketchPlugin_Plugin::SketchPlugin_Plugin() 
+SketchPlugin_Plugin::SketchPlugin_Plugin()
 {
   PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
-  aFactory->registerValidator("SketchPlugin_DistanceAttrValidator", new SketchPlugin_DistanceAttrValidator);
+  aFactory->registerValidator("SketchPlugin_DistanceAttrValidator",
+                              new SketchPlugin_DistanceAttrValidator);
 
   // register this plugin
   ModelAPI_PluginManager::get()->registerPlugin(this);
 
   // register sketcher properties
-  Config_PropManager::registerProp("Sketch planes", 
-                                   "planes_color", "Color",
-                                   Config_Prop::Color, SKETCH_PLANE_COLOR);
-  Config_PropManager::registerProp("Sketch planes", 
-                                   "planes_size", "Size",
-                                   Config_Prop::Double, PLANE_SIZE);
-  Config_PropManager::registerProp("Sketch planes", 
-                                   "planes_thikness", "Thickness",
+  Config_PropManager::registerProp("Sketch planes", "planes_color", "Color", Config_Prop::Color,
+                                   SKETCH_PLANE_COLOR);
+  Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double,
+                                   PLANE_SIZE);
+  Config_PropManager::registerProp("Sketch planes", "planes_thikness", "Thickness",
                                    Config_Prop::Integer, SKETCH_WIDTH);
 
-  Config_PropManager::registerProp("Visualization", 
-                                   "parallel_color", "Parallel constraint color",
+  Config_PropManager::registerProp("Visualization", "parallel_color", "Parallel constraint color",
                                    Config_Prop::Color, PARALLEL_COLOR);
-  Config_PropManager::registerProp("Visualization", 
-                                   "perpendicular_color", "Perpendicular constraint color",
-                                   Config_Prop::Color, PERPENDICULAR_COLOR);
-  Config_PropManager::registerProp("Visualization", 
-                                   "distance_color", "Distance color",
+  Config_PropManager::registerProp("Visualization", "perpendicular_color",
+                                   "Perpendicular constraint color", Config_Prop::Color,
+                                   PERPENDICULAR_COLOR);
+  Config_PropManager::registerProp("Visualization", "distance_color", "Distance color",
                                    Config_Prop::Color, DISTANCE_COLOR);
-  Config_PropManager::registerProp("Visualization", 
-                                   "length_color", "Length color",
+  Config_PropManager::registerProp("Visualization", "length_color", "Length color",
                                    Config_Prop::Color, LENGTH_COLOR);
-  Config_PropManager::registerProp("Visualization", 
-                                   "radius_color", "Radius color",
+  Config_PropManager::registerProp("Visualization", "radius_color", "Radius color",
                                    Config_Prop::Color, RADIUS_COLOR);
 }
 
@@ -63,35 +57,25 @@ FeaturePtr SketchPlugin_Plugin::createFeature(string theFeatureID)
 {
   if (theFeatureID == SketchPlugin_Sketch::ID()) {
     return FeaturePtr(new SketchPlugin_Sketch);
-  }
-  else if (theFeatureID == SketchPlugin_Point::ID()) {
+  } else if (theFeatureID == SketchPlugin_Point::ID()) {
     return FeaturePtr(new SketchPlugin_Point);
-  }
-  else if (theFeatureID == SketchPlugin_Line::ID()) {
+  } else if (theFeatureID == SketchPlugin_Line::ID()) {
     return FeaturePtr(new SketchPlugin_Line);
-  }
-  else if (theFeatureID == SketchPlugin_Circle::ID()) {
+  } else if (theFeatureID == SketchPlugin_Circle::ID()) {
     return FeaturePtr(new SketchPlugin_Circle);
-  }
-  else if (theFeatureID == SketchPlugin_Arc::ID()) {
+  } else if (theFeatureID == SketchPlugin_Arc::ID()) {
     return FeaturePtr(new SketchPlugin_Arc);
-  }
-  else if (theFeatureID == SketchPlugin_ConstraintCoincidence::ID()) {
+  } else if (theFeatureID == SketchPlugin_ConstraintCoincidence::ID()) {
     return FeaturePtr(new SketchPlugin_ConstraintCoincidence);
-  }
-  else if (theFeatureID == SketchPlugin_ConstraintDistance::ID()) {
+  } else if (theFeatureID == SketchPlugin_ConstraintDistance::ID()) {
     return FeaturePtr(new SketchPlugin_ConstraintDistance);
-  }
-  else if (theFeatureID == SketchPlugin_ConstraintLength::ID()) {
+  } else if (theFeatureID == SketchPlugin_ConstraintLength::ID()) {
     return FeaturePtr(new SketchPlugin_ConstraintLength);
-  }
-  else if (theFeatureID == SketchPlugin_ConstraintParallel::ID()) {
+  } else if (theFeatureID == SketchPlugin_ConstraintParallel::ID()) {
     return FeaturePtr(new SketchPlugin_ConstraintParallel);
-  }
-  else if (theFeatureID == SketchPlugin_ConstraintPerpendicular::ID()) {
+  } else if (theFeatureID == SketchPlugin_ConstraintPerpendicular::ID()) {
     return FeaturePtr(new SketchPlugin_ConstraintPerpendicular);
-  }
-  else if (theFeatureID == SketchPlugin_ConstraintRadius::ID()) {
+  } else if (theFeatureID == SketchPlugin_ConstraintRadius::ID()) {
     return FeaturePtr(new SketchPlugin_ConstraintRadius);
   }
   // feature of such kind is not found
index 63f488ca531708b83dc9e659ae38e14424192852..bb81ba781212d882e113cd32646eda725832af99 100644 (file)
@@ -5,18 +5,17 @@
 #ifndef SketchPlugin_Plugin_H_
 #define SketchPlugin_Plugin_H_
 
-
 #include "SketchPlugin.h"
 #include "ModelAPI_Plugin.h"
 #include "ModelAPI_Feature.h"
 
-class SKETCHPLUGIN_EXPORT SketchPlugin_Plugin: public ModelAPI_Plugin
+class SKETCHPLUGIN_EXPORT SketchPlugin_Plugin : public ModelAPI_Plugin
 {
-public:
+ public:
   /// Creates the feature object of this plugin by the feature string ID
   virtual FeaturePtr createFeature(std::string theFeatureID);
 
-public:
+ public:
   /// Is needed for python wrapping by swig
   SketchPlugin_Plugin();
 };
index 14efc4f6a3e5608c7f6ceb9cea72ab293600ee13..5e8f2a65ebd45761393ef070c5b0e8d4ef9c9410 100644 (file)
@@ -24,14 +24,14 @@ void SketchPlugin_Point::initAttributes()
   data()->addAttribute(SketchPlugin_Point::COORD_ID(), GeomDataAPI_Point2D::type());
 }
 
-void SketchPlugin_Point::execute() 
+void SketchPlugin_Point::execute()
 {
   SketchPlugin_Sketch* aSketch = sketch();
   if (aSketch) {
     // compute a point in 3D view
-    boost::shared_ptr<GeomDataAPI_Point2D> aPoint = 
-      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      data()->attribute(SketchPlugin_Point::COORD_ID()));
+    boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
+        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+            data()->attribute(SketchPlugin_Point::COORD_ID()));
     boost::shared_ptr<GeomAPI_Pnt> aPoint3D(aSketch->to3D(aPoint->x(), aPoint->y()));
     // make a visible point
     boost::shared_ptr<GeomAPI_Shape> aPointShape = GeomAlgoAPI_PointBuilder::point(aPoint3D);
@@ -48,18 +48,16 @@ void SketchPlugin_Point::move(double theDeltaX, double theDeltaY)
   if (!aData->isValid())
     return;
 
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Point::COORD_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Point::COORD_ID()));
   aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
 }
 
 double SketchPlugin_Point::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
 {
   boost::shared_ptr<ModelAPI_Data> aData = data();
-  boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aData->attribute(SketchPlugin_Point::COORD_ID()));
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Point::COORD_ID()));
 
   return aPoint->pnt()->distance(thePoint);
 }
index fddf2ef5a3750984e376576e1f7598357a50c1ed..14f58740248eed1215cf5c980e688d4fa48483d8 100644 (file)
@@ -14,9 +14,9 @@
  * \ingroup DataModel
  * \brief Feature for creation of a new point.
  */
-class SketchPlugin_Point: public SketchPlugin_Feature
+class SketchPlugin_Point : public SketchPlugin_Feature
 {
-public:
+ public:
   /// Point feature kind
   inline static const std::string& ID()
   {
@@ -30,8 +30,11 @@ public:
     return MY_COORD_ID;
   }
   /// Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = SketchPlugin_Point::ID(); return MY_KIND;}
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_Point::ID();
+    return MY_KIND;
+  }
 
   /// Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
@@ -41,7 +44,9 @@ public:
 
   /// Returns the AIS preview
   virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
-  {return simpleAISObject(firstResult(), thePrevious);}
+  {
+    return simpleAISObject(firstResult(), thePrevious);
+  }
 
   /// Moves the feature
   /// \param theDeltaX the delta for X coordinate is moved
index 9236aa008ae5959a34ba9841cacde849b2d2dc44..5342bf832b68bdecfff05747602d976b0cee614a 100644 (file)
@@ -18,7 +18,6 @@
 
 using namespace std;
 
-
 SketchPlugin_Sketch::SketchPlugin_Sketch()
 {
 }
@@ -32,39 +31,38 @@ void SketchPlugin_Sketch::initAttributes()
   data()->addAttribute(SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList::type());
 }
 
-void SketchPlugin_Sketch::execute() 
+void SketchPlugin_Sketch::execute()
 {
   if (!data()->isValid())
-    return ;
-  boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
-    data()->attribute(SketchPlugin_Sketch::FEATURES_ID()));
-
-  boost::shared_ptr<GeomDataAPI_Point> anOrigin = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point>(data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aDirX = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aDirY = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aNorm = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+    return;
+  boost::shared_ptr<ModelAPI_AttributeRefList> aRefList = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefList>(data()->attribute(SketchPlugin_Sketch::FEATURES_ID()));
+
+  boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+      data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aDirX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aDirY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aNorm = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      data()->attribute(SketchPlugin_Sketch::NORM_ID()));
 
   std::list<ObjectPtr> aFeatures = aRefList->list();
   if (aFeatures.empty())
-    return ;
+    return;
 
   std::list<ObjectPtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
   boost::shared_ptr<SketchPlugin_Feature> aFeature;
-  std::list< boost::shared_ptr<GeomAPI_Shape> > aFeaturesPreview;
+  std::list<boost::shared_ptr<GeomAPI_Shape> > aFeaturesPreview;
   for (; anIt != aLast; anIt++) {
     aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
     if (aFeature) {
 
       const std::list<boost::shared_ptr<ModelAPI_Result> >& aRes = aFeature->results();
       std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aResIter = aRes.cbegin();
-      for(; aResIter != aRes.cend(); aResIter++) {
-        boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = 
-          boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
+      for (; aResIter != aRes.cend(); aResIter++) {
+        boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = boost::dynamic_pointer_cast<
+            ModelAPI_ResultConstruction>(*aResIter);
         if (aConstr) {
           boost::shared_ptr<GeomAPI_Shape> aShape = aConstr->shape();
           if (aShape)
@@ -75,9 +73,9 @@ void SketchPlugin_Sketch::execute()
   }
 
   if (aFeaturesPreview.empty())
-    return ;
-  std::list< boost::shared_ptr<GeomAPI_Shape> > aLoops;
-  std::list< boost::shared_ptr<GeomAPI_Shape> > aWires;
+    return;
+  std::list<boost::shared_ptr<GeomAPI_Shape> > aLoops;
+  std::list<boost::shared_ptr<GeomAPI_Shape> > aWires;
   GeomAlgoAPI_SketchBuilder::createFaces(anOrigin->pnt(), aDirX->dir(), aDirY->dir(), aNorm->dir(),
                                          aFeaturesPreview, aLoops, aWires);
 
@@ -96,33 +94,33 @@ const void SketchPlugin_Sketch::addSub(const FeaturePtr& theFeature)
 
 boost::shared_ptr<GeomAPI_Pnt> SketchPlugin_Sketch::to3D(const double theX, const double theY)
 {
-  boost::shared_ptr<GeomDataAPI_Point> aC = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point>(data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aX = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aY = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
+  boost::shared_ptr<GeomDataAPI_Point> aC = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+      data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
 
-  boost::shared_ptr<GeomAPI_XYZ> aSum = aC->pnt()->xyz()->added(
-    aX->dir()->xyz()->multiplied(theX))->added(aY->dir()->xyz()->multiplied(theY));
+  boost::shared_ptr<GeomAPI_XYZ> aSum = aC->pnt()->xyz()->added(aX->dir()->xyz()->multiplied(theX))
+      ->added(aY->dir()->xyz()->multiplied(theY));
 
   return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
 }
 
 bool SketchPlugin_Sketch::isPlaneSet()
 {
-  boost::shared_ptr<GeomDataAPI_Dir> aNormal = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      data()->attribute(SketchPlugin_Sketch::NORM_ID()));
 
   return aNormal && !(aNormal->x() == 0 && aNormal->y() == 0 && aNormal->z() == 0);
 }
 
 boost::shared_ptr<GeomAPI_Pln> SketchPlugin_Sketch::plane()
 {
-  boost::shared_ptr<GeomDataAPI_Point> anOrigin = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Point>(data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
-  boost::shared_ptr<GeomDataAPI_Dir> aNorm = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+  boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+      data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aNorm = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      data()->attribute(SketchPlugin_Sketch::NORM_ID()));
 
   if (!anOrigin || !aNorm)
     return boost::shared_ptr<GeomAPI_Pln>();
@@ -130,41 +128,40 @@ boost::shared_ptr<GeomAPI_Pln> SketchPlugin_Sketch::plane()
   return boost::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(anOrigin->pnt(), aNorm->dir()));
 }
 
-void addPlane(double theX, double theY, double theZ, std::list<boost::shared_ptr<GeomAPI_Shape> >& theShapes)
+void addPlane(double theX, double theY, double theZ,
+              std::list<boost::shared_ptr<GeomAPI_Shape> >& theShapes)
 {
   boost::shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
   boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(theX, theY, theZ));
   double aSize = Config_PropManager::integer("Sketch definition", "Size of planes", PLANE_SIZE);
-  boost::shared_ptr<GeomAPI_Shape> aFace = 
-    GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal, aSize);
+  boost::shared_ptr<GeomAPI_Shape> aFace = GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal,
+                                                                           aSize);
   theShapes.push_back(aFace);
 }
 
 AISObjectPtr SketchPlugin_Sketch::getAISObject(AISObjectPtr thePrevious)
 {
-  boost::shared_ptr<GeomDataAPI_Dir> aNorm = 
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+  boost::shared_ptr<GeomDataAPI_Dir> aNorm = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+      data()->attribute(SketchPlugin_Sketch::NORM_ID()));
 
   if (!aNorm || (aNorm->x() == 0 && aNorm->y() == 0 && aNorm->z() == 0)) {
     AISObjectPtr aAIS = thePrevious;
     if (!aAIS) {
       std::list<boost::shared_ptr<GeomAPI_Shape> > aFaces;
 
-      addPlane(1, 0, 0, aFaces); // YZ plane
-      addPlane(0, 1, 0, aFaces); // XZ plane
-      addPlane(0, 0, 1, aFaces); // XY plane
+      addPlane(1, 0, 0, aFaces);  // YZ plane
+      addPlane(0, 1, 0, aFaces);  // XZ plane
+      addPlane(0, 0, 1, aFaces);  // XY plane
       boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces);
       aAIS = AISObjectPtr(new GeomAPI_AISObject());
       aAIS->createShape(aCompound);
 
-      std::vector<int> aRGB = Config_PropManager::color("Sketch definition", 
-                                                        "planes_color", 
-                                                        SKETCH_PLANE_COLOR);
+      std::vector<int> aRGB = Config_PropManager::color("Sketch definition", "planes_color",
+      SKETCH_PLANE_COLOR);
       aAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
 
-      aAIS->setWidth(Config_PropManager::integer("Sketch definition", 
-                                                 "planes_thikness",
-                                                 SKETCH_WIDTH));
+      aAIS->setWidth(Config_PropManager::integer("Sketch definition", "planes_thikness",
+      SKETCH_WIDTH));
     }
     return aAIS;
   }
index 0d5d6ea0aebc75d13616fdf83c94b0c479b29b49..806025dd7c608c0465096cb55238141be762c9bb 100644 (file)
@@ -25,9 +25,9 @@
  * \ingroup DataModel
  * \brief Feature for creation of the new part in PartSet.
  */
-class SketchPlugin_Sketch: public SketchPlugin_Feature, public GeomAPI_IPresentable
+class SketchPlugin_Sketch : public SketchPlugin_Feature, public GeomAPI_IPresentable
 {
-public:
+ public:
   /// Sketch feature kind
   inline static const std::string& ID()
   {
@@ -66,8 +66,11 @@ public:
   }
 
   /// Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = SketchPlugin_Sketch::ID(); return MY_KIND;}
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = SketchPlugin_Sketch::ID();
+    return MY_KIND;
+  }
 
   /// Creates a new part document if needed
   SKETCHPLUGIN_EXPORT virtual void execute();
@@ -77,24 +80,32 @@ public:
 
   /// Adds sub-feature of the higher level feature (sub-element of the sketch)
   /// \param theFeature sub-feature
-  SKETCHPLUGIN_EXPORT virtual const void addSub(
-    const FeaturePtr& theFeature);
+  SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature);
 
   /// Moves the feature
   /// \param theDeltaX the delta for X coordinate is moved
   /// \param theDeltaY the delta for Y coordinate is moved
-  SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY) {};
+  SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY)
+  {
+  }
+  ;
 
   /// Return the distance between the feature and the point
   /// \param thePoint the point
-  virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) { return 0; };
+  virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+  {
+    return 0;
+  }
+  ;
 
   /// Converts a 2D sketch space point into point in 3D space
-  SKETCHPLUGIN_EXPORT boost::shared_ptr<GeomAPI_Pnt> to3D(
-    const double theX, const double theY);
+  SKETCHPLUGIN_EXPORT boost::shared_ptr<GeomAPI_Pnt> to3D(const double theX, const double theY);
 
   /// Returns true if this feature must be displayed in the history (top level of Part tree)
-  SKETCHPLUGIN_EXPORT virtual bool isInHistory() {return true;}
+  SKETCHPLUGIN_EXPORT virtual bool isInHistory()
+  {
+    return true;
+  }
 
   /// Use plugin manager for features creation
   SketchPlugin_Sketch();
@@ -104,7 +115,7 @@ public:
 
   virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
 
-protected:
+ protected:
   /// Creates a plane and append it to the list
   /// \param theX the X normal value
   /// \param theY the Y normal value
index 862a30344b9dc328c1d9a5c7084ad282dfde7098..50af2be895a9e3c0880f63fc44e56ab56af7bb17 100644 (file)
@@ -9,8 +9,7 @@
 #include <ModelAPI_ResultValidator.h>
 #include <GeomDataAPI_Point2D.h>
 
-
-bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature, 
+bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature,
                                                  const std::list<std::string>& theArguments,
                                                  const ObjectPtr& theObject) const
 {
@@ -19,8 +18,8 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature,
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
 
   // If the object is not a line then it is accepted
-  const ModelAPI_ResultValidator* aLineValidator = dynamic_cast<const ModelAPI_ResultValidator*>(
-                                              aFactory->validator("Model_ResultLineValidator"));
+  const ModelAPI_ResultValidator* aLineValidator =
+      dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("Model_ResultLineValidator"));
   if (!aLineValidator->isValid(theObject))
     return true;
 
@@ -31,5 +30,3 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature,
   return false;
 }
 
-
-
index 74357d1eb24e5a10e4564f83b563727d61b3039a..38ba0291698ce31d9ca27e8251f5a2c6e6a55018 100644 (file)
@@ -9,14 +9,12 @@
 //#include <ModuleBase_FeatureValidator.h>
 #include <ModelAPI_AttributeValidator.h>
 
-
-class SketchPlugin_DistanceAttrValidator: public ModelAPI_AttributeValidator
+class SketchPlugin_DistanceAttrValidator : public ModelAPI_AttributeValidator
 {
-public:
-  virtual bool isValid(const FeaturePtr& theFeature, 
-                       const std::list<std::string>& theArguments,
+ public:
+  virtual bool isValid(const FeaturePtr& theFeature, const std::list<std::string>& theArguments,
                        const ObjectPtr& theObject) const;
 
 };
 
-#endif
\ No newline at end of file
+#endif
index e44e1390b8b17e078077cd03cf0297fc827c3d23..d5f1e6810f95dda81de2d48ff4b0a4ef31ec9c1a 100644 (file)
@@ -30,7 +30,7 @@
 /// Possible types of attributes (used to determine constraint type)
 enum AttrType
 {
-  UNKNOWN, // Something wrong during type determination
+  UNKNOWN,  // Something wrong during type determination
   POINT2D,
   POINT3D,
   LINE,
@@ -41,24 +41,23 @@ enum AttrType
 /// Calculate type of the attribute
 static AttrType typeOfAttribute(boost::shared_ptr<ModelAPI_Attribute> theAttribute);
 
-
-
 SketchSolver_Constraint::SketchSolver_Constraint()
-  : myConstraint(boost::shared_ptr<SketchPlugin_Constraint>()),
-    myType(SLVS_C_UNKNOWN),
-    myAttributesList()
+    : myConstraint(boost::shared_ptr<SketchPlugin_Constraint>()),
+      myType(SLVS_C_UNKNOWN),
+      myAttributesList()
 {
 }
 
 SketchSolver_Constraint::SketchSolver_Constraint(
-                boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
-  : myConstraint(theConstraint),
-    myAttributesList()
+    boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
+    : myConstraint(theConstraint),
+      myAttributesList()
 {
   myType = getType(myConstraint);
 }
 
-const int& SketchSolver_Constraint::getType(boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
+const int& SketchSolver_Constraint::getType(
+    boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
 {
   myType = SLVS_C_UNKNOWN;
   if (!theConstraint)
@@ -71,30 +70,28 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptr<SketchPlugin_Const
 
   const std::string& aConstraintKind = theConstraint->getKind();
   // Constraint for coincidence of two points
-  if (aConstraintKind.compare(SketchPlugin_ConstraintCoincidence::ID()) == 0)
-  {
+  if (aConstraintKind.compare(SketchPlugin_ConstraintCoincidence::ID()) == 0) {
     int anAttrPos = 0;
     // Verify the constraint has only two attributes and they are points
-    int aPt2d = 0; // bit-mapped field, each bit indicates whether the attribute is 2D point
-    int aPt3d = 0; // bit-mapped field, the same information for 3D points
-    for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++)
-    {
-      boost::shared_ptr<ModelAPI_Attribute> anAttr =
-        theConstraint->data()->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
-      if (!anAttr) continue;
-      switch (typeOfAttribute(anAttr))
-      {
-      case POINT2D: // the attribute is a 2D point
-        aPt2d |= (1 << indAttr);
-        myAttributesList[anAttrPos++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
-        break;
-      case POINT3D: // the attribute is a 3D point
-        aPt3d |= (1 << indAttr);
-        myAttributesList[anAttrPos++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
-        break;
-      default:
-        // Attribute neither 2D nor 3D point is not supported by this type of constraint
-        return getType();
+    int aPt2d = 0;  // bit-mapped field, each bit indicates whether the attribute is 2D point
+    int aPt3d = 0;  // bit-mapped field, the same information for 3D points
+    for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
+      boost::shared_ptr<ModelAPI_Attribute> anAttr = theConstraint->data()->attribute(
+          SketchPlugin_Constraint::ATTRIBUTE(indAttr));
+      if (!anAttr)
+        continue;
+      switch (typeOfAttribute(anAttr)) {
+        case POINT2D:  // the attribute is a 2D point
+          aPt2d |= (1 << indAttr);
+          myAttributesList[anAttrPos++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
+          break;
+        case POINT3D:  // the attribute is a 3D point
+          aPt3d |= (1 << indAttr);
+          myAttributesList[anAttrPos++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
+          break;
+        default:
+          // Attribute neither 2D nor 3D point is not supported by this type of constraint
+          return getType();
       }
     }
     // The constrained points should be in first and second positions,
@@ -106,21 +103,18 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptr<SketchPlugin_Const
   }
 
   // Constraint for distance between point and another entity
-  if (aConstraintKind.compare(SketchPlugin_ConstraintDistance::ID()) == 0)
-  {
+  if (aConstraintKind.compare(SketchPlugin_ConstraintDistance::ID()) == 0) {
     int aNbPoints = 0;
     int aNbEntities = 0;
-    for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++)
-    {
-      boost::shared_ptr<ModelAPI_Attribute> anAttr =
-        theConstraint->data()->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
-      switch (typeOfAttribute(anAttr))
-      {
-      case POINT2D:
-      case POINT3D:
+    for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
+      boost::shared_ptr<ModelAPI_Attribute> anAttr = theConstraint->data()->attribute(
+          SketchPlugin_Constraint::ATTRIBUTE(indAttr));
+      switch (typeOfAttribute(anAttr)) {
+        case POINT2D:
+        case POINT3D:
           myAttributesList[aNbPoints++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
           break;
-      case LINE:
+        case LINE:
           // entities are placed starting from SketchPlugin_Constraint::ENTITY_C() attribute
           myAttributesList[2 + aNbEntities++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
           myType = SLVS_C_PT_LINE_DISTANCE;
@@ -128,7 +122,7 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptr<SketchPlugin_Const
       }
     }
     // Verify the correctness of constraint arguments
-    if (aNbPoints == 2 && aNbEntities ==0)
+    if (aNbPoints == 2 && aNbEntities == 0)
       myType = SLVS_C_PT_PT_DISTANCE;
     else if (aNbPoints != 1 || aNbEntities != 1)
       myType = SLVS_C_UNKNOWN;
@@ -136,13 +130,11 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptr<SketchPlugin_Const
   }
 
   // Constraint for the given length of a line
-  if (aConstraintKind.compare(SketchPlugin_ConstraintLength::ID()) == 0)
-  {
+  if (aConstraintKind.compare(SketchPlugin_ConstraintLength::ID()) == 0) {
     int aNbLines = 0;
-    for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++)
-    {
-      boost::shared_ptr<ModelAPI_Attribute> anAttr =
-        theConstraint->data()->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
+    for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
+      boost::shared_ptr<ModelAPI_Attribute> anAttr = theConstraint->data()->attribute(
+          SketchPlugin_Constraint::ATTRIBUTE(indAttr));
       if (typeOfAttribute(anAttr) == LINE)
         myAttributesList[aNbLines++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
     }
@@ -154,13 +146,11 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptr<SketchPlugin_Const
   // Constraint for two parallel/perpendicular lines
   bool isParallel = (aConstraintKind.compare(SketchPlugin_ConstraintParallel::ID()) == 0);
   bool isPerpendicular = (aConstraintKind.compare(SketchPlugin_ConstraintPerpendicular::ID()) == 0);
-  if (isParallel || isPerpendicular)
-  {
-    int aNbEntities = 2; // lines in SolveSpace constraints should start from SketchPlugin_Constraint::ENTITY_C() attribute
-    for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++)
-    {
-      boost::shared_ptr<ModelAPI_Attribute> anAttr =
-        theConstraint->data()->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
+  if (isParallel || isPerpendicular) {
+    int aNbEntities = 2;  // lines in SolveSpace constraints should start from SketchPlugin_Constraint::ENTITY_C() attribute
+    for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
+      boost::shared_ptr<ModelAPI_Attribute> anAttr = theConstraint->data()->attribute(
+          SketchPlugin_Constraint::ATTRIBUTE(indAttr));
       if (typeOfAttribute(anAttr) == LINE)
         myAttributesList[aNbEntities++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
     }
@@ -170,13 +160,11 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptr<SketchPlugin_Const
   }
 
   // Constraint for radius of a circle or an arc of circle
-  if (aConstraintKind.compare(SketchPlugin_ConstraintRadius::ID()) == 0)
-  {
-    int aNbEntities = 2; // lines in SolveSpace constraints should started from SketchPlugin_Constraint::ENTITY_C() attribute
-    for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++)
-    {
-      boost::shared_ptr<ModelAPI_Attribute> anAttr =
-        theConstraint->data()->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
+  if (aConstraintKind.compare(SketchPlugin_ConstraintRadius::ID()) == 0) {
+    int aNbEntities = 2;  // lines in SolveSpace constraints should started from SketchPlugin_Constraint::ENTITY_C() attribute
+    for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
+      boost::shared_ptr<ModelAPI_Attribute> anAttr = theConstraint->data()->attribute(
+          SketchPlugin_Constraint::ATTRIBUTE(indAttr));
       AttrType aType = typeOfAttribute(anAttr);
       if (aType == CIRCLE || aType == ARC)
         myAttributesList[aNbEntities++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
@@ -191,26 +179,25 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptr<SketchPlugin_Const
   return getType();
 }
 
-
 // ================= Auxiliary functions ==============================
 AttrType typeOfAttribute(boost::shared_ptr<ModelAPI_Attribute> theAttribute)
 {
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttrRef =
-    boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
-  if (!anAttrRef) return UNKNOWN;
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttrRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(theAttribute);
+  if (!anAttrRef)
+    return UNKNOWN;
 
-  if (anAttrRef->isObject())
-  {
-    ResultConstructionPtr aRC = 
-      boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anAttrRef->object());
-    if (!aRC) return UNKNOWN;
+  if (anAttrRef->isObject()) {
+    ResultConstructionPtr aRC = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
+        anAttrRef->object());
+    if (!aRC)
+      return UNKNOWN;
 
     if (aRC->shape()->isVertex())
       return POINT3D;
-    else if (aRC->shape()->isEdge())
-    {
-      boost::shared_ptr<GeomAPI_Edge> anEdge = 
-        boost::dynamic_pointer_cast<GeomAPI_Edge>(aRC->shape());
+    else if (aRC->shape()->isEdge()) {
+      boost::shared_ptr<GeomAPI_Edge> anEdge = boost::dynamic_pointer_cast<GeomAPI_Edge>(
+          aRC->shape());
       if (anEdge->isLine())
         return LINE;
       else if (anEdge->isCircle())
@@ -218,9 +205,7 @@ AttrType typeOfAttribute(boost::shared_ptr<ModelAPI_Attribute> theAttribute)
       else if (anEdge->isArc())
         return ARC;
     }
-  }
-  else
-  {
+  } else {
     const std::string aType = anAttrRef->attr()->attributeType();
     if (aType == GeomDataAPI_Point2D::type())
       return POINT2D;
index 3f547d8d8a8a2ccd294f80bd8b1e74f65085d060..0d20edd38b121b3805f0ac5cb0950d16a8935fdb 100644 (file)
@@ -18,7 +18,7 @@
  */
 class SketchSolver_Constraint
 {
-public:
+ public:
   SketchSolver_Constraint();
   SketchSolver_Constraint(boost::shared_ptr<SketchPlugin_Constraint> theConstraint);
 
@@ -30,16 +30,20 @@ public:
   const int& getType(boost::shared_ptr<SketchPlugin_Constraint> theConstraint);
   /// \brief Returns the type of myConstraint member
   inline const int& getType() const
-  { return myType; }
+  {
+    return myType;
+  }
 
   /// \brief Returns list of attributes names in the correct order required by SolveSpace
   inline const std::vector<std::string>& getAttributes() const
-  { return myAttributesList; }
+  {
+    return myAttributesList;
+  }
 
-private:
+ private:
   boost::shared_ptr<SketchPlugin_Constraint> myConstraint;
-  int                                        myType;
-  std::vector<std::string>                   myAttributesList;
+  int myType;
+  std::vector<std::string> myAttributesList;
 };
 
 #endif
index 0e5878091c721ed6fa5511c9586526e2a1bc30c8..0e1ad7790eb5f6235af9bc7ef57148a576b6590c 100644 (file)
@@ -39,8 +39,9 @@ const double tolerance = 1.e-10;
  * as inline static functions
  * TODO: Move this class into a separate file
  */
-class SketchSolver_Error {
-public:
+class SketchSolver_Error
+{
+ public:
   /// The value parameter for the constraint
   inline static const std::string& CONSTRAINTS()
   {
@@ -57,28 +58,27 @@ static Slvs_hGroup myGroupIndexer = 0;
  *  \param[in] theEntities list of elements
  *  \return position of the found element or -1 if the element is not found
  */
-template <typename T>
+template<typename T>
 static int Search(const uint32_t& theEntityID, const std::vector<T>& theEntities);
 
-
 // ========================================================
 // =========  SketchSolver_ConstraintGroup  ===============
 // ========================================================
 
-SketchSolver_ConstraintGroup::
-  SketchSolver_ConstraintGroup(boost::shared_ptr<SketchPlugin_Feature> theWorkplane)
-  : myID(++myGroupIndexer),
-    myParamMaxID(0),
-    myEntityMaxID(0),
-    myConstrMaxID(0),
-    myConstraintMap(),
-    myNeedToSolve(false),
-    myConstrSolver()
+SketchSolver_ConstraintGroup::SketchSolver_ConstraintGroup(
+    boost::shared_ptr<SketchPlugin_Feature> theWorkplane)
+    : myID(++myGroupIndexer),
+      myParamMaxID(0),
+      myEntityMaxID(0),
+      myConstrMaxID(0),
+      myConstraintMap(),
+      myNeedToSolve(false),
+      myConstrSolver()
 {
   myParams.clear();
   myEntities.clear();
   myConstraints.clear();
-  
+
   myTempConstraints.clear();
   myTempPointWhereDragged.clear();
   myTempPointWDrgdID = 0;
@@ -112,7 +112,7 @@ SketchSolver_ConstraintGroup::~SketchSolver_ConstraintGroup()
 //  Purpose:  verify the group is based on the given workplane
 // ============================================================================
 bool SketchSolver_ConstraintGroup::isBaseWorkplane(
-                boost::shared_ptr<SketchPlugin_Feature> theWorkplane) const
+    boost::shared_ptr<SketchPlugin_Feature> theWorkplane) const
 {
   return theWorkplane == mySketch;
 }
@@ -123,38 +123,36 @@ bool SketchSolver_ConstraintGroup::isBaseWorkplane(
 //  Purpose:  verify are there any entities in the group used by given constraint
 // ============================================================================
 bool SketchSolver_ConstraintGroup::isInteract(
-                boost::shared_ptr<SketchPlugin_Constraint> theConstraint) const
+    boost::shared_ptr<SketchPlugin_Constraint> theConstraint) const
 {
   // Check the group is empty
   if (myWorkplane.h != SLVS_E_UNKNOWN && myConstraints.empty())
     return true;
 
   // Go through constraint entities and verify if some of them already in the group
-  for (int i = 0; i < CONSTRAINT_ATTR_SIZE; i++)
-  {
-    boost::shared_ptr<ModelAPI_AttributeRefAttr> aCAttrRef =
-      boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        theConstraint->data()->attribute(SketchPlugin_Constraint::ATTRIBUTE(i))
-      );
-    if (!aCAttrRef) continue;
-    if (!aCAttrRef->isObject() && 
-        myEntityAttrMap.find(aCAttrRef->attr()) != myEntityAttrMap.end())
+  for (int i = 0; i < CONSTRAINT_ATTR_SIZE; i++) {
+    boost::shared_ptr<ModelAPI_AttributeRefAttr> aCAttrRef = boost::dynamic_pointer_cast<
+        ModelAPI_AttributeRefAttr>(
+        theConstraint->data()->attribute(SketchPlugin_Constraint::ATTRIBUTE(i)));
+    if (!aCAttrRef)
+      continue;
+    if (!aCAttrRef->isObject() && myEntityAttrMap.find(aCAttrRef->attr()) != myEntityAttrMap.end())
       return true;
-    if (aCAttrRef->isObject())
-    { // Obtain a base feature for the object
-      ResultConstructionPtr aRC = 
-        boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aCAttrRef->object());
-      if (!aRC) continue;
+    if (aCAttrRef->isObject()) {  // Obtain a base feature for the object
+      ResultConstructionPtr aRC = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
+          aCAttrRef->object());
+      if (!aRC)
+        continue;
       boost::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
       FeaturePtr aFeature = aDoc->feature(aRC);
       if (myEntityFeatMap.find(aFeature) != myEntityFeatMap.end())
         return true;
       // search attributes of a feature to be parameters of constraint
-      std::list< boost::shared_ptr<ModelAPI_Attribute> >
-        aFeatAttrList = aFeature->data()->attributes(std::string());
-      std::list< boost::shared_ptr<ModelAPI_Attribute> >::const_iterator
-        aFAIter = aFeatAttrList.begin();
-      for ( ; aFAIter != aFeatAttrList.end(); aFAIter++)
+      std::list<boost::shared_ptr<ModelAPI_Attribute> > aFeatAttrList =
+          aFeature->data()->attributes(std::string());
+      std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator aFAIter = aFeatAttrList
+          .begin();
+      for (; aFAIter != aFeatAttrList.end(); aFAIter++)
         if (myEntityAttrMap.find(*aFAIter) != myEntityAttrMap.end())
           return true;
     }
@@ -171,26 +169,25 @@ bool SketchSolver_ConstraintGroup::isInteract(
 // ============================================================================
 void SketchSolver_ConstraintGroup::checkConstraintConsistence(Slvs_Constraint& theConstraint)
 {
-  if (theConstraint.type == SLVS_C_PT_LINE_DISTANCE)
-  {
+  if (theConstraint.type == SLVS_C_PT_LINE_DISTANCE) {
     // Get constraint parameters and check the sign of constraint value
-    
+
     // point coordinates
     int aPtPos = Search(theConstraint.ptA, myEntities);
     int aPtParamPos = Search(myEntities[aPtPos].param[0], myParams);
     boost::shared_ptr<GeomAPI_XY> aPoint(
-      new GeomAPI_XY(myParams[aPtParamPos].val, myParams[aPtParamPos+1].val));
+        new GeomAPI_XY(myParams[aPtParamPos].val, myParams[aPtParamPos + 1].val));
 
     // line coordinates
     int aLnPos = Search(theConstraint.entityA, myEntities);
     aPtPos = Search(myEntities[aLnPos].point[0], myEntities);
     aPtParamPos = Search(myEntities[aPtPos].param[0], myParams);
     boost::shared_ptr<GeomAPI_XY> aStart(
-      new GeomAPI_XY(-myParams[aPtParamPos].val, -myParams[aPtParamPos+1].val));
+        new GeomAPI_XY(-myParams[aPtParamPos].val, -myParams[aPtParamPos + 1].val));
     aPtPos = Search(myEntities[aLnPos].point[1], myEntities);
     aPtParamPos = Search(myEntities[aPtPos].param[0], myParams);
     boost::shared_ptr<GeomAPI_XY> aEnd(
-      new GeomAPI_XY(myParams[aPtParamPos].val, myParams[aPtParamPos+1].val));
+        new GeomAPI_XY(myParams[aPtParamPos].val, myParams[aPtParamPos + 1].val));
 
     aEnd = aEnd->added(aStart);
     aPoint = aPoint->added(aStart);
@@ -205,18 +202,17 @@ void SketchSolver_ConstraintGroup::checkConstraintConsistence(Slvs_Constraint& t
 //  Purpose:  create/update the constraint in the group
 // ============================================================================
 bool SketchSolver_ConstraintGroup::changeConstraint(
-                boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
+    boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
 {
   // There is no workplane yet, something wrong
   if (myWorkplane.h == SLVS_E_UNKNOWN)
     return false;
 
   // Search this constraint in the current group to update it
-  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::const_iterator
-    aConstrMapIter = myConstraintMap.find(theConstraint);
+  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::const_iterator aConstrMapIter =
+      myConstraintMap.find(theConstraint);
   std::vector<Slvs_Constraint>::iterator aConstrIter;
-  if (aConstrMapIter != myConstraintMap.end())
-  {
+  if (aConstrMapIter != myConstraintMap.end()) {
     int aConstrPos = Search(aConstrMapIter->second, myConstraints);
     aConstrIter = myConstraints.begin() + aConstrPos;
   }
@@ -224,84 +220,78 @@ bool SketchSolver_ConstraintGroup::changeConstraint(
   // Get constraint type and verify the constraint parameters are correct
   SketchSolver_Constraint aConstraint(theConstraint);
   int aConstrType = aConstraint.getType();
-  if (aConstrType == SLVS_C_UNKNOWN ||
-     (aConstrMapIter != myConstraintMap.end() && aConstrIter->type != aConstrType))
+  if (aConstrType == SLVS_C_UNKNOWN
+      || (aConstrMapIter != myConstraintMap.end() && aConstrIter->type != aConstrType))
     return false;
   const std::vector<std::string>& aConstraintAttributes = aConstraint.getAttributes();
 
   // Create constraint parameters
-  double aDistance = 0.0; // scalar value of the constraint
-  AttributeDoublePtr aDistAttr =
-    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theConstraint->data()->attribute(SketchPlugin_Constraint::VALUE()));
-  if (aDistAttr)
-  {
+  double aDistance = 0.0;  // scalar value of the constraint
+  AttributeDoublePtr aDistAttr = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+      theConstraint->data()->attribute(SketchPlugin_Constraint::VALUE()));
+  if (aDistAttr) {
     aDistance = aDistAttr->value();
     // SketchPlugin circle defined by its radius, but SolveSpace uses constraint for diameter
     if (aConstrType == SLVS_C_DIAMETER)
       aDistance *= 2.0;
-    if (aConstrMapIter != myConstraintMap.end() && fabs(aConstrIter->valA - aDistance) > tolerance)
-    {
+    if (aConstrMapIter != myConstraintMap.end()
+        && fabs(aConstrIter->valA - aDistance) > tolerance) {
       myNeedToSolve = true;
       aConstrIter->valA = aDistance;
     }
   }
 
-  Slvs_hEntity aConstrEnt[CONSTRAINT_ATTR_SIZE]; // parameters of the constraint
-  for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++)
-  {
+  Slvs_hEntity aConstrEnt[CONSTRAINT_ATTR_SIZE];  // parameters of the constraint
+  for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
     aConstrEnt[indAttr] = SLVS_E_UNKNOWN;
-    boost::shared_ptr<ModelAPI_AttributeRefAttr> aConstrAttr =
-      boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-        theConstraint->data()->attribute(aConstraintAttributes[indAttr])
-      );
-    if (!aConstrAttr) continue;
+    boost::shared_ptr<ModelAPI_AttributeRefAttr> aConstrAttr = boost::dynamic_pointer_cast<
+        ModelAPI_AttributeRefAttr>(
+        theConstraint->data()->attribute(aConstraintAttributes[indAttr]));
+    if (!aConstrAttr)
+      continue;
 
     // Convert the object of the attribute to the feature
     FeaturePtr aFeature;
-    if (aConstrAttr->isObject() && aConstrAttr->object())
-    {
-      ResultConstructionPtr aRC = 
-        boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aConstrAttr->object());
-      if (!aRC) continue;
+    if (aConstrAttr->isObject() && aConstrAttr->object()) {
+      ResultConstructionPtr aRC = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
+          aConstrAttr->object());
+      if (!aRC)
+        continue;
       boost::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
       aFeature = aDoc->feature(aRC);
     }
 
     // For the length constraint the start and end points of the line should be added to the entities list instead of line
-    if (aConstrType == SLVS_C_PT_PT_DISTANCE && theConstraint->getKind().compare(SketchPlugin_ConstraintLength::ID()) == 0)
-    {
+    if (aConstrType == SLVS_C_PT_PT_DISTANCE
+        && theConstraint->getKind().compare(SketchPlugin_ConstraintLength::ID()) == 0) {
       boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
-      aConstrEnt[indAttr]   = changeEntity(aData->attribute(SketchPlugin_Line::START_ID()));
-      aConstrEnt[indAttr+1] = changeEntity(aData->attribute(SketchPlugin_Line::END_ID()));
+      aConstrEnt[indAttr] = changeEntity(aData->attribute(SketchPlugin_Line::START_ID()));
+      aConstrEnt[indAttr + 1] = changeEntity(aData->attribute(SketchPlugin_Line::END_ID()));
       // measured object is added into the map of objects to avoid problems with interaction between constraint and group
       myEntityFeatMap[aFeature] = 0;
-      break; // there should be no other entities
-    }
-    else if (aConstrAttr->isObject())
+      break;  // there should be no other entities
+    } else if (aConstrAttr->isObject())
       aConstrEnt[indAttr] = changeEntity(aFeature);
     else
       aConstrEnt[indAttr] = changeEntity(aConstrAttr->attr());
   }
 
-  if (aConstrMapIter == myConstraintMap.end())
-  {
+  if (aConstrMapIter == myConstraintMap.end()) {
     // Several points may be coincident, it is not necessary to store all constraints between them.
     // Try to find sequence of coincident points which connects the points of new constraint
-    if (aConstrType == SLVS_C_POINTS_COINCIDENT)
-    {
-      if (aConstrEnt[0] == aConstrEnt[1]) // no need to add self coincidence
+    if (aConstrType == SLVS_C_POINTS_COINCIDENT) {
+      if (aConstrEnt[0] == aConstrEnt[1])  // no need to add self coincidence
         return false;
-      if (!addCoincidentPoints(aConstrEnt[0], aConstrEnt[1]))
-      {
-        myExtraCoincidence.insert(theConstraint); // the constraint is stored for further purposes
+      if (!addCoincidentPoints(aConstrEnt[0], aConstrEnt[1])) {
+        myExtraCoincidence.insert(theConstraint);  // the constraint is stored for further purposes
         return false;
       }
     }
 
     // Create SolveSpace constraint structure
-    Slvs_Constraint aConstraint =
-      Slvs_MakeConstraint(++myConstrMaxID, myID, aConstrType, myWorkplane.h,
-                          aDistance, aConstrEnt[0], aConstrEnt[1], aConstrEnt[2], aConstrEnt[3]);
+    Slvs_Constraint aConstraint = Slvs_MakeConstraint(++myConstrMaxID, myID, aConstrType,
+                                                      myWorkplane.h, aDistance, aConstrEnt[0],
+                                                      aConstrEnt[1], aConstrEnt[2], aConstrEnt[3]);
     myConstraints.push_back(aConstraint);
     myConstraintMap[theConstraint] = aConstraint.h;
     int aConstrPos = Search(aConstraint.h, myConstraints);
@@ -318,29 +308,27 @@ bool SketchSolver_ConstraintGroup::changeConstraint(
 //  Purpose:  create/update the element affected by any constraint
 // ============================================================================
 Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
-                boost::shared_ptr<ModelAPI_Attribute> theEntity)
+    boost::shared_ptr<ModelAPI_Attribute> theEntity)
 {
   // If the entity is already in the group, try to find it
-  std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator
-    aEntIter = myEntityAttrMap.find(theEntity);
-  std::vector<Slvs_Param>::const_iterator aParamIter; // looks at first parameter of already existent entity or at the end of vector otherwise
-  if (aEntIter == myEntityAttrMap.end()) // no such entity => should be created
+  std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator aEntIter =
+      myEntityAttrMap.find(theEntity);
+  std::vector<Slvs_Param>::const_iterator aParamIter;  // looks at first parameter of already existent entity or at the end of vector otherwise
+  if (aEntIter == myEntityAttrMap.end())  // no such entity => should be created
     aParamIter = myParams.end();
-  else
-  { // the entity already exists
+  else {  // the entity already exists
     int aEntPos = Search(aEntIter->second, myEntities);
     int aParamPos = Search(myEntities[aEntPos].param[0], myParams);
     aParamIter = myParams.begin() + aParamPos;
   }
-  const bool isEntExists = (aEntIter != myEntityAttrMap.end()); // defines that the entity already exists
+  const bool isEntExists = (aEntIter != myEntityAttrMap.end());  // defines that the entity already exists
 
   // Look over supported types of entities
 
   // Point in 3D
-  boost::shared_ptr<GeomDataAPI_Point> aPoint =
-    boost::dynamic_pointer_cast<GeomDataAPI_Point>(theEntity);
-  if (aPoint)
-  {
+  boost::shared_ptr<GeomDataAPI_Point> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+      theEntity);
+  if (aPoint) {
     Slvs_hParam aX = changeParameter(aPoint->x(), aParamIter);
     Slvs_hParam aY = changeParameter(aPoint->y(), aParamIter);
     Slvs_hParam aZ = changeParameter(aPoint->z(), aParamIter);
@@ -361,9 +349,8 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
 
   // Point in 2D
   boost::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(theEntity);
-  if (aPoint2D)
-  {
+      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(theEntity);
+  if (aPoint2D) {
     Slvs_hParam aU = changeParameter(aPoint2D->x(), aParamIter);
     Slvs_hParam aV = changeParameter(aPoint2D->y(), aParamIter);
 
@@ -378,10 +365,8 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
   }
 
   // Scalar value (used for the distance entities)
-  AttributeDoublePtr aScalar = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theEntity);
-  if (aScalar)
-  {
+  AttributeDoublePtr aScalar = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theEntity);
+  if (aScalar) {
     Slvs_hParam aValue = changeParameter(aScalar->value(), aParamIter);
 
     if (isEntExists)
@@ -400,79 +385,77 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
   return SLVS_E_UNKNOWN;
 }
 
-
 // ============================================================================
 //  Function: changeEntity
 //  Class:    SketchSolver_ConstraintGroup
 //  Purpose:  create/update the element defined by the feature affected by any constraint
 // ============================================================================
-Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
-                FeaturePtr theEntity)
+Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(FeaturePtr theEntity)
 {
   // If the entity is already in the group, try to find it
-  std::map<FeaturePtr, Slvs_hEntity>::const_iterator
-    aEntIter = myEntityFeatMap.find(theEntity);
+  std::map<FeaturePtr, Slvs_hEntity>::const_iterator aEntIter = myEntityFeatMap.find(theEntity);
   // defines that the entity already exists
   const bool isEntExists = (myEntityFeatMap.find(theEntity) != myEntityFeatMap.end());
 
   // SketchPlugin features
-  boost::shared_ptr<SketchPlugin_Feature> aFeature =
-    boost::dynamic_pointer_cast<SketchPlugin_Feature>(theEntity);
-  if (aFeature)
-  { // Verify the feature by its kind
+  boost::shared_ptr<SketchPlugin_Feature> aFeature = boost::dynamic_pointer_cast<
+      SketchPlugin_Feature>(theEntity);
+  if (aFeature) {  // Verify the feature by its kind
     const std::string& aFeatureKind = aFeature->getKind();
 
     // Line
-    if (aFeatureKind.compare(SketchPlugin_Line::ID()) == 0)
-    {
-      Slvs_hEntity aStart = changeEntity(aFeature->data()->attribute(SketchPlugin_Line::START_ID()));
-      Slvs_hEntity aEnd   = changeEntity(aFeature->data()->attribute(SketchPlugin_Line::END_ID()));
+    if (aFeatureKind.compare(SketchPlugin_Line::ID()) == 0) {
+      Slvs_hEntity aStart = changeEntity(
+          aFeature->data()->attribute(SketchPlugin_Line::START_ID()));
+      Slvs_hEntity aEnd = changeEntity(aFeature->data()->attribute(SketchPlugin_Line::END_ID()));
 
       if (isEntExists)
         return aEntIter->second;
 
       // New entity
-      Slvs_Entity aLineEntity = Slvs_MakeLineSegment(++myEntityMaxID, myID, myWorkplane.h, aStart, aEnd);
+      Slvs_Entity aLineEntity = Slvs_MakeLineSegment(++myEntityMaxID, myID, myWorkplane.h, aStart,
+                                                     aEnd);
       myEntities.push_back(aLineEntity);
       myEntityFeatMap[theEntity] = aLineEntity.h;
       return aLineEntity.h;
     }
     // Circle
-    else if (aFeatureKind.compare(SketchPlugin_Circle::ID()) == 0)
-    {
-      Slvs_hEntity aCenter = changeEntity(aFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
-      Slvs_hEntity aRadius = changeEntity(aFeature->data()->attribute(SketchPlugin_Circle::RADIUS_ID()));
+    else if (aFeatureKind.compare(SketchPlugin_Circle::ID()) == 0) {
+      Slvs_hEntity aCenter = changeEntity(
+          aFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
+      Slvs_hEntity aRadius = changeEntity(
+          aFeature->data()->attribute(SketchPlugin_Circle::RADIUS_ID()));
 
       if (isEntExists)
         return aEntIter->second;
 
       // New entity
-      Slvs_Entity aCircleEntity = 
-        Slvs_MakeCircle(++myEntityMaxID, myID, myWorkplane.h, aCenter, myWorkplane.normal, aRadius);
+      Slvs_Entity aCircleEntity = Slvs_MakeCircle(++myEntityMaxID, myID, myWorkplane.h, aCenter,
+                                                  myWorkplane.normal, aRadius);
       myEntities.push_back(aCircleEntity);
       myEntityFeatMap[theEntity] = aCircleEntity.h;
       return aCircleEntity.h;
     }
     // Arc
-    else if (aFeatureKind.compare(SketchPlugin_Arc::ID()) == 0)
-    {
-      Slvs_hEntity aCenter = changeEntity(aFeature->data()->attribute(SketchPlugin_Arc::CENTER_ID()));
-      Slvs_hEntity aStart  = changeEntity(aFeature->data()->attribute(SketchPlugin_Arc::START_ID()));
-      Slvs_hEntity aEnd    = changeEntity(aFeature->data()->attribute(SketchPlugin_Arc::END_ID()));
+    else if (aFeatureKind.compare(SketchPlugin_Arc::ID()) == 0) {
+      Slvs_hEntity aCenter = changeEntity(
+          aFeature->data()->attribute(SketchPlugin_Arc::CENTER_ID()));
+      Slvs_hEntity aStart = changeEntity(aFeature->data()->attribute(SketchPlugin_Arc::START_ID()));
+      Slvs_hEntity aEnd = changeEntity(aFeature->data()->attribute(SketchPlugin_Arc::END_ID()));
 
       if (isEntExists)
         return aEntIter->second;
 
-      Slvs_Entity anArcEntity = Slvs_MakeArcOfCircle(++myEntityMaxID, myID, 
-                                  myWorkplane.h, myWorkplane.normal, aCenter, aStart, aEnd);
+      Slvs_Entity anArcEntity = Slvs_MakeArcOfCircle(++myEntityMaxID, myID, myWorkplane.h,
+                                                     myWorkplane.normal, aCenter, aStart, aEnd);
       myEntities.push_back(anArcEntity);
       myEntityFeatMap[theEntity] = anArcEntity.h;
       return anArcEntity.h;
     }
     // Point (it has low probability to be an attribute of constraint, so it is checked at the end)
-    else if (aFeatureKind.compare(SketchPlugin_Point::ID()) == 0)
-    {
-      Slvs_hEntity aPoint = changeEntity(aFeature->data()->attribute(SketchPlugin_Point::COORD_ID()));
+    else if (aFeatureKind.compare(SketchPlugin_Point::ID()) == 0) {
+      Slvs_hEntity aPoint = changeEntity(
+          aFeature->data()->attribute(SketchPlugin_Point::COORD_ID()));
 
       if (isEntExists)
         return aEntIter->second;
@@ -495,34 +478,28 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
 //  Purpose:  create/update the normal of workplane
 // ============================================================================
 Slvs_hEntity SketchSolver_ConstraintGroup::changeNormal(
-                boost::shared_ptr<ModelAPI_Attribute> theDirX,
-                boost::shared_ptr<ModelAPI_Attribute> theDirY,
-                boost::shared_ptr<ModelAPI_Attribute> theNorm)
+    boost::shared_ptr<ModelAPI_Attribute> theDirX, boost::shared_ptr<ModelAPI_Attribute> theDirY,
+    boost::shared_ptr<ModelAPI_Attribute> theNorm)
 {
-  boost::shared_ptr<GeomDataAPI_Dir> aDirX =
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(theDirX);
-  boost::shared_ptr<GeomDataAPI_Dir> aDirY =
-    boost::dynamic_pointer_cast<GeomDataAPI_Dir>(theDirY);
-  if (!aDirX || !aDirY ||
-     (fabs(aDirX->x()) + fabs(aDirX->y()) + fabs(aDirX->z()) < tolerance) ||
-     (fabs(aDirY->x()) + fabs(aDirY->y()) + fabs(aDirY->z()) < tolerance))
+  boost::shared_ptr<GeomDataAPI_Dir> aDirX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(theDirX);
+  boost::shared_ptr<GeomDataAPI_Dir> aDirY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(theDirY);
+  if (!aDirX || !aDirY || (fabs(aDirX->x()) + fabs(aDirX->y()) + fabs(aDirX->z()) < tolerance)
+      || (fabs(aDirY->x()) + fabs(aDirY->y()) + fabs(aDirY->z()) < tolerance))
     return SLVS_E_UNKNOWN;
 
   // quaternion parameters of normal vector
   double qw, qx, qy, qz;
-  Slvs_MakeQuaternion(aDirX->x(), aDirX->y(), aDirX->z(),
-                      aDirY->x(), aDirY->y(), aDirY->z(),
-                      &qw, &qx, &qy, &qz);
-  double aNormCoord[4] = {qw, qx, qy, qz};
+  Slvs_MakeQuaternion(aDirX->x(), aDirX->y(), aDirX->z(), aDirY->x(), aDirY->y(), aDirY->z(), &qw,
+                      &qx, &qy, &qz);
+  double aNormCoord[4] = { qw, qx, qy, qz };
 
   // Try to find existent normal
-  std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator
-    aEntIter = myEntityAttrMap.find(theNorm);
-  std::vector<Slvs_Param>::const_iterator aParamIter; // looks to the first parameter of already existent entity or to the end of vector otherwise
-  if (aEntIter == myEntityAttrMap.end()) // no such entity => should be created
+  std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator aEntIter =
+      myEntityAttrMap.find(theNorm);
+  std::vector<Slvs_Param>::const_iterator aParamIter;  // looks to the first parameter of already existent entity or to the end of vector otherwise
+  if (aEntIter == myEntityAttrMap.end())  // no such entity => should be created
     aParamIter = myParams.end();
-  else
-  { // the entity already exists, update it
+  else {  // the entity already exists, update it
     int aEntPos = Search(aEntIter->second, myEntities);
     int aParamPos = Search(myEntities[aEntPos].param[0], myParams);
     aParamIter = myParams.begin() + aParamPos;
@@ -533,28 +510,26 @@ Slvs_hEntity SketchSolver_ConstraintGroup::changeNormal(
   for (int i = 0; i < 4; i++)
     aNormParams[i] = changeParameter(aNormCoord[i], aParamIter);
 
-  if (aEntIter != myEntityAttrMap.end()) // the entity already exists
+  if (aEntIter != myEntityAttrMap.end())  // the entity already exists
     return aEntIter->second;
 
   // Create a normal
-  Slvs_Entity aNormal = Slvs_MakeNormal3d(++myEntityMaxID, myID,
-                aNormParams[0], aNormParams[1], aNormParams[2], aNormParams[3]);
+  Slvs_Entity aNormal = Slvs_MakeNormal3d(++myEntityMaxID, myID, aNormParams[0], aNormParams[1],
+                                          aNormParams[2], aNormParams[3]);
   myEntities.push_back(aNormal);
   myEntityAttrMap[theNorm] = aNormal.h;
   return aNormal.h;
 }
 
-
 // ============================================================================
 //  Function: addWorkplane
 //  Class:    SketchSolver_ConstraintGroup
 //  Purpose:  create workplane for the group
 // ============================================================================
-bool SketchSolver_ConstraintGroup::addWorkplane(
-                boost::shared_ptr<SketchPlugin_Feature> theSketch)
+bool SketchSolver_ConstraintGroup::addWorkplane(boost::shared_ptr<SketchPlugin_Feature> theSketch)
 {
   if (myWorkplane.h || theSketch->getKind().compare(SketchPlugin_Sketch::ID()) != 0)
-    return false; // the workplane already exists or the function parameter is not Sketch
+    return false;  // the workplane already exists or the function parameter is not Sketch
 
   mySketch = theSketch;
   updateWorkplane();
@@ -569,18 +544,23 @@ bool SketchSolver_ConstraintGroup::addWorkplane(
 bool SketchSolver_ConstraintGroup::updateWorkplane()
 {
   // Get parameters of workplane
-  boost::shared_ptr<ModelAPI_Attribute> aDirX    = mySketch->data()->attribute(SketchPlugin_Sketch::DIRX_ID());
-  boost::shared_ptr<ModelAPI_Attribute> aDirY    = mySketch->data()->attribute(SketchPlugin_Sketch::DIRY_ID());
-  boost::shared_ptr<ModelAPI_Attribute> aNorm    = mySketch->data()->attribute(SketchPlugin_Sketch::NORM_ID());
-  boost::shared_ptr<ModelAPI_Attribute> anOrigin = mySketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID());
+  boost::shared_ptr<ModelAPI_Attribute> aDirX = mySketch->data()->attribute(
+      SketchPlugin_Sketch::DIRX_ID());
+  boost::shared_ptr<ModelAPI_Attribute> aDirY = mySketch->data()->attribute(
+      SketchPlugin_Sketch::DIRY_ID());
+  boost::shared_ptr<ModelAPI_Attribute> aNorm = mySketch->data()->attribute(
+      SketchPlugin_Sketch::NORM_ID());
+  boost::shared_ptr<ModelAPI_Attribute> anOrigin = mySketch->data()->attribute(
+      SketchPlugin_Sketch::ORIGIN_ID());
   // Transform them into SolveSpace format
   Slvs_hEntity aNormalWP = changeNormal(aDirX, aDirY, aNorm);
-  if (!aNormalWP) return false;
+  if (!aNormalWP)
+    return false;
   Slvs_hEntity anOriginWP = changeEntity(anOrigin);
-  if (!anOriginWP) return false;
+  if (!anOriginWP)
+    return false;
 
-  if (!myWorkplane.h)
-  {
+  if (!myWorkplane.h) {
     // Create workplane
     myWorkplane = Slvs_MakeWorkplane(++myEntityMaxID, myID, anOriginWP, aNormalWP);
     // Workplane should be added to the list of entities
@@ -595,15 +575,12 @@ bool SketchSolver_ConstraintGroup::updateWorkplane()
 //  Purpose:  create/update value of parameter
 // ============================================================================
 Slvs_hParam SketchSolver_ConstraintGroup::changeParameter(
-                const double&                            theParam,
-                std::vector<Slvs_Param>::const_iterator& thePrmIter)
+    const double& theParam, std::vector<Slvs_Param>::const_iterator& thePrmIter)
 {
-  if (thePrmIter != myParams.end())
-  { // Parameter should be updated
+  if (thePrmIter != myParams.end()) {  // Parameter should be updated
     int aParamPos = thePrmIter - myParams.begin();
-    if (fabs(thePrmIter->val - theParam) > tolerance)
-    {
-      myNeedToSolve = true; // parameter is changed, need to resolve constraints
+    if (fabs(thePrmIter->val - theParam) > tolerance) {
+      myNeedToSolve = true;  // parameter is changed, need to resolve constraints
       myParams[aParamPos].val = theParam;
     }
     thePrmIter++;
@@ -636,20 +613,18 @@ void SketchSolver_ConstraintGroup::resolveConstraints()
   myConstrSolver.setDraggedParameters(myTempPointWhereDragged);
 
   int aResult = myConstrSolver.solve();
-  if (aResult == SLVS_RESULT_OKAY)
-  { // solution succeeded, store results into correspondent attributes
-    // Obtain result into the same list of parameters
+  if (aResult == SLVS_RESULT_OKAY) {  // solution succeeded, store results into correspondent attributes
+                                      // Obtain result into the same list of parameters
     if (!myConstrSolver.getResult(myParams))
       return;
 
     // We should go through the attributes map, because only attributes have valued parameters
-    std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator
-      anEntIter = myEntityAttrMap.begin();
-    for ( ; anEntIter != myEntityAttrMap.end(); anEntIter++)
+    std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator anEntIter =
+        myEntityAttrMap.begin();
+    for (; anEntIter != myEntityAttrMap.end(); anEntIter++)
       if (updateAttribute(anEntIter->first, anEntIter->second))
         updateRelatedConstraints(anEntIter->first);
-  }
-  else if (!myConstraints.empty())
+  } else if (!myConstraints.empty())
     Events_Error::send(SketchSolver_Error::CONSTRAINTS(), this);
 
   removeTemporaryConstraints();
@@ -661,41 +636,38 @@ void SketchSolver_ConstraintGroup::resolveConstraints()
 //  Class:    SketchSolver_ConstraintGroup
 //  Purpose:  append specified group to the current group
 // ============================================================================
-void SketchSolver_ConstraintGroup::mergeGroups(
-                const SketchSolver_ConstraintGroup& theGroup)
+void SketchSolver_ConstraintGroup::mergeGroups(const SketchSolver_ConstraintGroup& theGroup)
 {
   // If specified group is empty, no need to merge
   if (theGroup.myConstraintMap.empty())
-    return ;
+    return;
 
   // Map between old and new indexes of SolveSpace constraints
   std::map<Slvs_hConstraint, Slvs_hConstraint> aConstrMap;
 
   // Add all constraints from theGroup to the current group
-  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::const_iterator
-    aConstrIter = theGroup.myConstraintMap.begin();
-  for ( ; aConstrIter != theGroup.myConstraintMap.end(); aConstrIter++)
+  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::const_iterator aConstrIter =
+      theGroup.myConstraintMap.begin();
+  for (; aConstrIter != theGroup.myConstraintMap.end(); aConstrIter++)
     if (changeConstraint(aConstrIter->first))
-      aConstrMap[aConstrIter->second] = myConstrMaxID; // the constraint was added => store its ID
+      aConstrMap[aConstrIter->second] = myConstrMaxID;  // the constraint was added => store its ID
 
   // Add temporary constraints from theGroup
   std::list<Slvs_hConstraint>::const_iterator aTempConstrIter = theGroup.myTempConstraints.begin();
-  for ( ; aTempConstrIter != theGroup.myTempConstraints.end(); aTempConstrIter++)
-  {
-    std::map<Slvs_hConstraint, Slvs_hConstraint>::iterator aFind = aConstrMap.find(*aTempConstrIter);
+  for (; aTempConstrIter != theGroup.myTempConstraints.end(); aTempConstrIter++) {
+    std::map<Slvs_hConstraint, Slvs_hConstraint>::iterator aFind = aConstrMap.find(
+        *aTempConstrIter);
     if (aFind != aConstrMap.end())
       myTempConstraints.push_back(aFind->second);
   }
 
   if (myTempPointWhereDragged.empty())
     myTempPointWhereDragged = theGroup.myTempPointWhereDragged;
-  else if (!theGroup.myTempPointWhereDragged.empty())
-  { // Need to create additional transient constraint
-    std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator
-      aFeatureIter = theGroup.myEntityAttrMap.begin();
+  else if (!theGroup.myTempPointWhereDragged.empty()) {  // Need to create additional transient constraint
+    std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator aFeatureIter =
+        theGroup.myEntityAttrMap.begin();
     for (; aFeatureIter != theGroup.myEntityAttrMap.end(); aFeatureIter++)
-      if (aFeatureIter->second == myTempPointWDrgdID)
-      {
+      if (aFeatureIter->second == myTempPointWDrgdID) {
         addTemporaryConstraintWhereDragged(aFeatureIter->first);
         break;
       }
@@ -712,20 +684,17 @@ void SketchSolver_ConstraintGroup::mergeGroups(
 void SketchSolver_ConstraintGroup::splitGroup(std::vector<SketchSolver_ConstraintGroup*>& theCuts)
 {
   // Divide constraints and entities into several groups
-  std::vector< std::set<Slvs_hEntity> >     aGroupsEntities;
-  std::vector< std::set<Slvs_hConstraint> > aGroupsConstr;
-  int aMaxNbEntities = 0; // index of the group with maximal nuber of elements (this group will be left in the current)
+  std::vector<std::set<Slvs_hEntity> > aGroupsEntities;
+  std::vector<std::set<Slvs_hConstraint> > aGroupsConstr;
+  int aMaxNbEntities = 0;  // index of the group with maximal nuber of elements (this group will be left in the current)
   std::vector<Slvs_Constraint>::const_iterator aConstrIter = myConstraints.begin();
-  for ( ; aConstrIter != myConstraints.end(); aConstrIter++)
-  {
-    Slvs_hEntity aConstrEnt[] = {
-      aConstrIter->ptA,     aConstrIter->ptB,
-      aConstrIter->entityA, aConstrIter->entityB};
+  for (; aConstrIter != myConstraints.end(); aConstrIter++) {
+    Slvs_hEntity aConstrEnt[] = { aConstrIter->ptA, aConstrIter->ptB, aConstrIter->entityA,
+        aConstrIter->entityB };
     std::vector<int> anIndexes;
     // Go through the groupped entities and find even one of entities of current constraint
-    std::vector< std::set<Slvs_hEntity> >::iterator aGrEntIter;
-    for (aGrEntIter = aGroupsEntities.begin(); aGrEntIter != aGroupsEntities.end(); aGrEntIter++)
-    {
+    std::vector<std::set<Slvs_hEntity> >::iterator aGrEntIter;
+    for (aGrEntIter = aGroupsEntities.begin(); aGrEntIter != aGroupsEntities.end(); aGrEntIter++) {
       bool isFound = false;
       for (int i = 0; i < 4 && !isFound; i++)
         if (aConstrEnt[i] != 0)
@@ -734,8 +703,7 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vector<SketchSolver_Constrain
         anIndexes.push_back(aGrEntIter - aGroupsEntities.begin());
     }
     // Add new group if no one is found
-    if (anIndexes.empty())
-    {
+    if (anIndexes.empty()) {
       std::set<Slvs_hEntity> aNewGrEnt;
       for (int i = 0; i < 4; i++)
         if (aConstrEnt[i] != 0)
@@ -747,9 +715,7 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vector<SketchSolver_Constrain
       aGroupsConstr.push_back(aNewGrConstr);
       if (aNewGrEnt.size() > aGroupsEntities[aMaxNbEntities].size())
         aMaxNbEntities = aGroupsEntities.size() - 1;
-    }
-    else if (anIndexes.size() == 1)
-    { // Add entities indexes into the found group
+    } else if (anIndexes.size() == 1) {  // Add entities indexes into the found group
       aGrEntIter = aGroupsEntities.begin() + anIndexes.front();
       for (int i = 0; i < 4; i++)
         if (aConstrEnt[i] != 0)
@@ -757,24 +723,20 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vector<SketchSolver_Constrain
       aGroupsConstr[anIndexes.front()].insert(aConstrIter->h);
       if (aGrEntIter->size() > aGroupsEntities[aMaxNbEntities].size())
         aMaxNbEntities = aGrEntIter - aGroupsEntities.begin();
-    }
-    else 
-    { // There are found several connected groups, merge them
-      std::vector< std::set<Slvs_hEntity> >::iterator aFirstGroup = 
-        aGroupsEntities.begin() + anIndexes.front();
-      std::vector< std::set<Slvs_hConstraint> >::iterator aFirstConstr = 
-        aGroupsConstr.begin() + anIndexes.front();
+    } else {  // There are found several connected groups, merge them
+      std::vector<std::set<Slvs_hEntity> >::iterator aFirstGroup = aGroupsEntities.begin()
+          + anIndexes.front();
+      std::vector<std::set<Slvs_hConstraint> >::iterator aFirstConstr = aGroupsConstr.begin()
+          + anIndexes.front();
       std::vector<int>::iterator anInd = anIndexes.begin();
-      for (++anInd; anInd != anIndexes.end(); anInd++)
-      {
+      for (++anInd; anInd != anIndexes.end(); anInd++) {
         aFirstGroup->insert(aGroupsEntities[*anInd].begin(), aGroupsEntities[*anInd].end());
         aFirstConstr->insert(aGroupsConstr[*anInd].begin(), aGroupsConstr[*anInd].end());
       }
       if (aFirstGroup->size() > aGroupsEntities[aMaxNbEntities].size())
         aMaxNbEntities = anIndexes.front();
       // Remove merged groups
-      for (anInd = anIndexes.end() - 1; anInd != anIndexes.begin(); anInd--)
-      {
+      for (anInd = anIndexes.end() - 1; anInd != anIndexes.begin(); anInd--) {
         aGroupsEntities.erase(aGroupsEntities.begin() + (*anInd));
         aGroupsConstr.erase(aGroupsConstr.begin() + (*anInd));
       }
@@ -782,7 +744,7 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vector<SketchSolver_Constrain
   }
 
   if (aGroupsEntities.size() <= 1)
-    return ;
+    return;
 
   // Remove the group with maximum elements as it will be left in the current group
   aGroupsEntities.erase(aGroupsEntities.begin() + aMaxNbEntities);
@@ -790,21 +752,18 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vector<SketchSolver_Constrain
 
   // Add new groups of constraints and divide current group
   std::vector<SketchSolver_ConstraintGroup*> aNewGroups;
-  for (int i = aGroupsEntities.size(); i > 0; i--)
-  {
+  for (int i = aGroupsEntities.size(); i > 0; i--) {
     SketchSolver_ConstraintGroup* aG = new SketchSolver_ConstraintGroup(mySketch);
     aNewGroups.push_back(aG);
   }
-  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::const_iterator
-    aConstrMapIter = myConstraintMap.begin();
-  int aConstrMapPos = 0; // position of iterator in the map (used to restore iterator after removing constraint)
-  while (aConstrMapIter != myConstraintMap.end())
-  {
-    std::vector< std::set<Slvs_hConstraint> >::const_iterator aGIter = aGroupsConstr.begin();
+  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::const_iterator aConstrMapIter =
+      myConstraintMap.begin();
+  int aConstrMapPos = 0;  // position of iterator in the map (used to restore iterator after removing constraint)
+  while (aConstrMapIter != myConstraintMap.end()) {
+    std::vector<std::set<Slvs_hConstraint> >::const_iterator aGIter = aGroupsConstr.begin();
     std::vector<SketchSolver_ConstraintGroup*>::iterator aGroup = aNewGroups.begin();
-    for ( ; aGIter != aGroupsConstr.end(); aGIter++, aGroup++)
-      if (aGIter->find(aConstrMapIter->second) != aGIter->end())
-      {
+    for (; aGIter != aGroupsConstr.end(); aGIter++, aGroup++)
+      if (aGIter->find(aConstrMapIter->second) != aGIter->end()) {
         (*aGroup)->changeConstraint(aConstrMapIter->first);
         removeConstraint(aConstrMapIter->first);
         // restore iterator
@@ -813,8 +772,7 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vector<SketchSolver_Constrain
           aConstrMapIter++;
         break;
       }
-    if (aGIter == aGroupsConstr.end())
-    {
+    if (aGIter == aGroupsConstr.end()) {
       aConstrMapIter++;
       aConstrMapPos++;
     }
@@ -830,34 +788,30 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vector<SketchSolver_Constrain
 // ============================================================================
 bool SketchSolver_ConstraintGroup::updateGroup()
 {
-  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::reverse_iterator
-    aConstrIter = myConstraintMap.rbegin();
+  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::reverse_iterator aConstrIter =
+      myConstraintMap.rbegin();
   bool isAllValid = true;
-  bool isCCRemoved = false; // indicates that at least one of coincidence constraints was removed
-  while (isAllValid && aConstrIter != myConstraintMap.rend())
-  {
-    if (!aConstrIter->first->data()->isValid())
-    {
+  bool isCCRemoved = false;  // indicates that at least one of coincidence constraints was removed
+  while (isAllValid && aConstrIter != myConstraintMap.rend()) {
+    if (!aConstrIter->first->data()->isValid()) {
       if (aConstrIter->first->getKind().compare(SketchPlugin_ConstraintCoincidence::ID()) == 0)
         isCCRemoved = true;
-      std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::reverse_iterator
-        aCopyIter = aConstrIter++;
+      std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::reverse_iterator aCopyIter =
+          aConstrIter++;
       removeConstraint(aCopyIter->first);
       isAllValid = false;
-    }
-    else aConstrIter++;
+    } else
+      aConstrIter++;
   }
 
   // Probably, need to update coincidence constraints
-  if (isCCRemoved && !myExtraCoincidence.empty())
-  {
+  if (isCCRemoved && !myExtraCoincidence.empty()) {
     // Make a copy, because the new list of unused constrtaints will be generated
-    std::set< boost::shared_ptr<SketchPlugin_Constraint> > anExtraCopy = myExtraCoincidence;
+    std::set<boost::shared_ptr<SketchPlugin_Constraint> > anExtraCopy = myExtraCoincidence;
     myExtraCoincidence.clear();
 
-    std::set< boost::shared_ptr<SketchPlugin_Constraint> >::iterator
-      aCIter = anExtraCopy.begin();
-    for ( ; aCIter != anExtraCopy.end(); aCIter++)
+    std::set<boost::shared_ptr<SketchPlugin_Constraint> >::iterator aCIter = anExtraCopy.begin();
+    for (; aCIter != anExtraCopy.end(); aCIter++)
       if ((*aCIter)->data()->isValid())
         changeConstraint(*aCIter);
   }
@@ -871,8 +825,7 @@ bool SketchSolver_ConstraintGroup::updateGroup()
 //  Purpose:  update features of sketch after resolving constraints
 // ============================================================================
 bool SketchSolver_ConstraintGroup::updateAttribute(
-                boost::shared_ptr<ModelAPI_Attribute> theAttribute,
-                const Slvs_hEntity&                   theEntityID)
+    boost::shared_ptr<ModelAPI_Attribute> theAttribute, const Slvs_hEntity& theEntityID)
 {
   // Search the position of the first parameter of the entity
   int anEntPos = Search(theEntityID, myEntities);
@@ -881,17 +834,14 @@ bool SketchSolver_ConstraintGroup::updateAttribute(
   // Look over supported types of entities
 
   // Point in 3D
-  boost::shared_ptr<GeomDataAPI_Point> aPoint =
-    boost::dynamic_pointer_cast<GeomDataAPI_Point>(theAttribute);
-  if (aPoint)
-  {
-    if (fabs(aPoint->x() - myParams[aFirstParamPos].val) > tolerance ||
-        fabs(aPoint->y() - myParams[aFirstParamPos+1].val) > tolerance ||
-        fabs(aPoint->z() - myParams[aFirstParamPos+2].val) > tolerance)
-    {
-      aPoint->setValue(myParams[aFirstParamPos].val,
-                       myParams[aFirstParamPos+1].val,
-                       myParams[aFirstParamPos+2].val);
+  boost::shared_ptr<GeomDataAPI_Point> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+      theAttribute);
+  if (aPoint) {
+    if (fabs(aPoint->x() - myParams[aFirstParamPos].val) > tolerance
+        || fabs(aPoint->y() - myParams[aFirstParamPos + 1].val) > tolerance
+        || fabs(aPoint->z() - myParams[aFirstParamPos + 2].val) > tolerance) {
+      aPoint->setValue(myParams[aFirstParamPos].val, myParams[aFirstParamPos + 1].val,
+                       myParams[aFirstParamPos + 2].val);
       return true;
     }
     return false;
@@ -899,26 +849,20 @@ bool SketchSolver_ConstraintGroup::updateAttribute(
 
   // Point in 2D
   boost::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
-    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
-  if (aPoint2D)
-  {
-    if (fabs(aPoint2D->x() - myParams[aFirstParamPos].val) > tolerance ||
-        fabs(aPoint2D->y() - myParams[aFirstParamPos+1].val) > tolerance)
-    {
-      aPoint2D->setValue(myParams[aFirstParamPos].val,
-                         myParams[aFirstParamPos+1].val);
+      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
+  if (aPoint2D) {
+    if (fabs(aPoint2D->x() - myParams[aFirstParamPos].val) > tolerance
+        || fabs(aPoint2D->y() - myParams[aFirstParamPos + 1].val) > tolerance) {
+      aPoint2D->setValue(myParams[aFirstParamPos].val, myParams[aFirstParamPos + 1].val);
       return true;
     }
     return false;
   }
 
   // Scalar value
-  AttributeDoublePtr aScalar = 
-    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
-  if (aScalar)
-  {
-    if (fabs(aScalar->value() - myParams[aFirstParamPos].val) > tolerance)
-    {
+  AttributeDoublePtr aScalar = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
+  if (aScalar) {
+    if (fabs(aScalar->value() - myParams[aFirstParamPos].val) > tolerance) {
       aScalar->setValue(myParams[aFirstParamPos].val);
       return true;
     }
@@ -935,10 +879,9 @@ bool SketchSolver_ConstraintGroup::updateAttribute(
 //  Purpose:  search the entity in this group and update it
 // ============================================================================
 void SketchSolver_ConstraintGroup::updateEntityIfPossible(
-                boost::shared_ptr<ModelAPI_Attribute> theEntity)
+    boost::shared_ptr<ModelAPI_Attribute> theEntity)
 {
-  if (myEntityAttrMap.find(theEntity) != myEntityAttrMap.end())
-  {
+  if (myEntityAttrMap.find(theEntity) != myEntityAttrMap.end()) {
     // If the attribute is a point and it is changed (the group needs to rebuild),
     // probably user has dragged this point into this position,
     // so it is necessary to add constraint which will guarantee the point will not change
@@ -949,13 +892,13 @@ void SketchSolver_ConstraintGroup::updateEntityIfPossible(
 
     changeEntity(theEntity);
 
-    if (myNeedToSolve) // the entity is changed
+    if (myNeedToSolve)  // the entity is changed
     {
       // Verify the entity is a point and add temporary constraint of permanency
-      boost::shared_ptr<GeomDataAPI_Point> aPoint =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point>(theEntity);
-      boost::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
-        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(theEntity);
+      boost::shared_ptr<GeomDataAPI_Point> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+          theEntity);
+      boost::shared_ptr<GeomDataAPI_Point2D> aPoint2D = boost::dynamic_pointer_cast<
+          GeomDataAPI_Point2D>(theEntity);
       if (aPoint || aPoint2D)
         addTemporaryConstraintWhereDragged(theEntity);
     }
@@ -975,49 +918,46 @@ void SketchSolver_ConstraintGroup::updateEntityIfPossible(
 //            which was moved by user
 // ============================================================================
 void SketchSolver_ConstraintGroup::addTemporaryConstraintWhereDragged(
-                boost::shared_ptr<ModelAPI_Attribute> theEntity)
+    boost::shared_ptr<ModelAPI_Attribute> theEntity)
 {
   // Find identifier of the entity
-  std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator
-    anEntIter = myEntityAttrMap.find(theEntity);
+  std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator anEntIter =
+      myEntityAttrMap.find(theEntity);
   if (anEntIter == myEntityAttrMap.end())
-    return ;
+    return;
 
   // If this is a first dragged point, its parameters should be placed 
   // into Slvs_System::dragged field to avoid system inconsistense
-  if (myTempPointWhereDragged.empty())
-  {
+  if (myTempPointWhereDragged.empty()) {
     int anEntPos = Search(anEntIter->second, myEntities);
     Slvs_hParam* aDraggedParam = myEntities[anEntPos].param;
     for (int i = 0; i < 4; i++, aDraggedParam++)
       if (*aDraggedParam != 0)
         myTempPointWhereDragged.push_back(*aDraggedParam);
     myTempPointWDrgdID = myEntities[anEntPos].h;
-    return ;
+    return;
   }
 
   // Get identifiers of all dragged points
   std::set<Slvs_hEntity> aDraggedPntID;
   aDraggedPntID.insert(myTempPointWDrgdID);
   std::list<Slvs_hConstraint>::iterator aTmpCoIter = myTempConstraints.begin();
-  for ( ; aTmpCoIter != myTempConstraints.end(); aTmpCoIter++)
-  {
+  for (; aTmpCoIter != myTempConstraints.end(); aTmpCoIter++) {
     unsigned int aConstrPos = Search(*aTmpCoIter, myConstraints);
     if (aConstrPos < myConstraints.size())
       aDraggedPntID.insert(myConstraints[aConstrPos].ptA);
   }
   // Find whether there is a point coincident with theEntity, which already has SLVS_C_WHERE_DRAGGED
-  std::vector< std::set<Slvs_hEntity> >::iterator aCoPtIter = myCoincidentPoints.begin();
-  for ( ; aCoPtIter != myCoincidentPoints.end(); aCoPtIter++)
-  {
+  std::vector<std::set<Slvs_hEntity> >::iterator aCoPtIter = myCoincidentPoints.begin();
+  for (; aCoPtIter != myCoincidentPoints.end(); aCoPtIter++) {
     if (aCoPtIter->find(anEntIter->second) == aCoPtIter->end())
-      continue; // the entity was not found in current set
+      continue;  // the entity was not found in current set
 
     // Find one of already created SLVS_C_WHERE_DRAGGED constraints in current set of coincident points
     std::set<Slvs_hEntity>::const_iterator aDrgIter = aDraggedPntID.begin();
-    for ( ; aDrgIter != aDraggedPntID.end(); aDrgIter++)
+    for (; aDrgIter != aDraggedPntID.end(); aDrgIter++)
       if (aCoPtIter->find(*aDrgIter) != aCoPtIter->end())
-        return ; // the SLVS_C_WHERE_DRAGGED constraint already exists
+        return // the SLVS_C_WHERE_DRAGGED constraint already exists
   }
 
   // Create additional SLVS_C_WHERE_DRAGGED constraint if myTempPointWhereDragged field is not empty
@@ -1036,8 +976,8 @@ void SketchSolver_ConstraintGroup::addTemporaryConstraintWhereDragged(
 void SketchSolver_ConstraintGroup::removeTemporaryConstraints()
 {
   std::list<Slvs_hConstraint>::reverse_iterator aTmpConstrIter;
-  for (aTmpConstrIter = myTempConstraints.rbegin(); aTmpConstrIter != myTempConstraints.rend(); aTmpConstrIter++)
-  {
+  for (aTmpConstrIter = myTempConstraints.rbegin(); aTmpConstrIter != myTempConstraints.rend();
+      aTmpConstrIter++) {
     unsigned int aConstrPos = Search(*aTmpConstrIter, myConstraints);
     if (aConstrPos >= myConstraints.size())
       continue;
@@ -1058,12 +998,13 @@ void SketchSolver_ConstraintGroup::removeTemporaryConstraints()
 //  Class:    SketchSolver_ConstraintGroup
 //  Purpose:  remove constraint and all unused entities
 // ============================================================================
-void SketchSolver_ConstraintGroup::removeConstraint(boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
+void SketchSolver_ConstraintGroup::removeConstraint(
+    boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
 {
-  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::iterator
-    anIterToRemove = myConstraintMap.find(theConstraint);
+  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::iterator anIterToRemove =
+      myConstraintMap.find(theConstraint);
   if (anIterToRemove == myConstraintMap.end())
-     return ;
+    return;
 
   Slvs_hConstraint aCnstrToRemove = anIterToRemove->second;
   // Remove constraint from the map
@@ -1072,8 +1013,8 @@ void SketchSolver_ConstraintGroup::removeConstraint(boost::shared_ptr<SketchPlug
   // Find unused entities
   int aConstrPos = Search(aCnstrToRemove, myConstraints);
   std::set<Slvs_hEntity> anEntToRemove;
-  Slvs_hEntity aCnstEnt[] = {myConstraints[aConstrPos].ptA,     myConstraints[aConstrPos].ptB, 
-                             myConstraints[aConstrPos].entityA, myConstraints[aConstrPos].entityB};
+  Slvs_hEntity aCnstEnt[] = { myConstraints[aConstrPos].ptA, myConstraints[aConstrPos].ptB,
+      myConstraints[aConstrPos].entityA, myConstraints[aConstrPos].entityB };
   for (int i = 0; i < 4; i++)
     if (aCnstEnt[i] != 0)
       anEntToRemove.insert(aCnstEnt[i]);
@@ -1081,48 +1022,40 @@ void SketchSolver_ConstraintGroup::removeConstraint(boost::shared_ptr<SketchPlug
   if (aCnstrToRemove == myConstrMaxID)
     myConstrMaxID--;
   std::vector<Slvs_Constraint>::const_iterator aConstrIter = myConstraints.begin();
-  for ( ; aConstrIter != myConstraints.end(); aConstrIter++)
-  {
-    Slvs_hEntity aEnts[] = {aConstrIter->ptA,     aConstrIter->ptB, 
-                            aConstrIter->entityA, aConstrIter->entityB};
+  for (; aConstrIter != myConstraints.end(); aConstrIter++) {
+    Slvs_hEntity aEnts[] = { aConstrIter->ptA, aConstrIter->ptB, aConstrIter->entityA, aConstrIter
+        ->entityB };
     for (int i = 0; i < 4; i++)
       if (aEnts[i] != 0 && anEntToRemove.find(aEnts[i]) != anEntToRemove.end())
         anEntToRemove.erase(aEnts[i]);
   }
 
   if (anEntToRemove.empty())
-    return ;
+    return;
 
   // Remove unused entities
-  std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator
-    anEntAttrIter = myEntityAttrMap.begin();
-  while (anEntAttrIter != myEntityAttrMap.end())
-  {
-    if (anEntToRemove.find(anEntAttrIter->second) != anEntToRemove.end())
-    {
-      std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator
-        aRemovedIter = anEntAttrIter;
+  std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator anEntAttrIter =
+      myEntityAttrMap.begin();
+  while (anEntAttrIter != myEntityAttrMap.end()) {
+    if (anEntToRemove.find(anEntAttrIter->second) != anEntToRemove.end()) {
+      std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator aRemovedIter =
+          anEntAttrIter;
       anEntAttrIter++;
       myEntityAttrMap.erase(aRemovedIter);
-    }
-    else anEntAttrIter++;
+    } else
+      anEntAttrIter++;
   }
-  std::map<FeaturePtr, Slvs_hEntity>::iterator
-    anEntFeatIter = myEntityFeatMap.begin();
-  while (anEntFeatIter != myEntityFeatMap.end())
-  {
-    if (anEntToRemove.find(anEntFeatIter->second) != anEntToRemove.end())
-    {
-      std::map<FeaturePtr, Slvs_hEntity>::iterator
-        aRemovedIter = anEntFeatIter;
+  std::map<FeaturePtr, Slvs_hEntity>::iterator anEntFeatIter = myEntityFeatMap.begin();
+  while (anEntFeatIter != myEntityFeatMap.end()) {
+    if (anEntToRemove.find(anEntFeatIter->second) != anEntToRemove.end()) {
+      std::map<FeaturePtr, Slvs_hEntity>::iterator aRemovedIter = anEntFeatIter;
       anEntFeatIter++;
       myEntityFeatMap.erase(aRemovedIter);
-    }
-    else anEntFeatIter++;
+    } else
+      anEntFeatIter++;
   }
   std::set<Slvs_hEntity>::const_reverse_iterator aRemIter = anEntToRemove.rbegin();
-  for ( ; aRemIter != anEntToRemove.rend(); aRemIter++)
-  {
+  for (; aRemIter != anEntToRemove.rend(); aRemIter++) {
     unsigned int anEntPos = Search(*aRemIter, myEntities);
     if (anEntPos >= myEntities.size())
       continue;
@@ -1130,9 +1063,9 @@ void SketchSolver_ConstraintGroup::removeConstraint(boost::shared_ptr<SketchPlug
     if (aParamPos >= myParams.size())
       continue;
     int aNbParams = 0;
-    while (myEntities[anEntPos].param[aNbParams] != 0) 
+    while (myEntities[anEntPos].param[aNbParams] != 0)
       aNbParams++;
-    if (myEntities[anEntPos].param[aNbParams-1] == myParamMaxID)
+    if (myEntities[anEntPos].param[aNbParams - 1] == myParamMaxID)
       myParamMaxID -= aNbParams;
     myParams.erase(myParams.begin() + aParamPos, myParams.begin() + aParamPos + aNbParams);
     if (*aRemIter == myEntityMaxID)
@@ -1140,37 +1073,32 @@ void SketchSolver_ConstraintGroup::removeConstraint(boost::shared_ptr<SketchPlug
     myEntities.erase(myEntities.begin() + anEntPos);
 
     // Remove entity's ID from the lists of conincident points
-    std::vector< std::set<Slvs_hEntity> >::iterator aCoPtIter = myCoincidentPoints.begin();
-    for ( ; aCoPtIter != myCoincidentPoints.end(); aCoPtIter++)
+    std::vector<std::set<Slvs_hEntity> >::iterator aCoPtIter = myCoincidentPoints.begin();
+    for (; aCoPtIter != myCoincidentPoints.end(); aCoPtIter++)
       aCoPtIter->erase(*aRemIter);
   }
   if (myCoincidentPoints.size() == 1 && myCoincidentPoints.front().empty())
     myCoincidentPoints.clear();
 }
 
-
 // ============================================================================
 //  Function: addCoincidentPoints
 //  Class:    SketchSolver_ConstraintGroup
 //  Purpose:  add coincident point the appropriate list of such points
 // ============================================================================
-bool SketchSolver_ConstraintGroup::addCoincidentPoints(
-                const Slvs_hEntity& thePoint1, const Slvs_hEntity& thePoint2)
+bool SketchSolver_ConstraintGroup::addCoincidentPoints(const Slvs_hEntity& thePoint1,
+                                                       const Slvs_hEntity& thePoint2)
 {
-  std::vector< std::set<Slvs_hEntity> >::iterator aCoPtIter = myCoincidentPoints.begin();
-  std::vector< std::set<Slvs_hEntity> >::iterator aFirstFound = myCoincidentPoints.end();
-  while (aCoPtIter != myCoincidentPoints.end())
-  {
-    bool isFound[2] = { // indicate which point ID was already in coincidence constraint
-      aCoPtIter->find(thePoint1) != aCoPtIter->end(),
-      aCoPtIter->find(thePoint2) != aCoPtIter->end(),
-    };
-    if (isFound[0] && isFound[1]) // points are already connected by coincidence constraints => no need additional one
+  std::vector<std::set<Slvs_hEntity> >::iterator aCoPtIter = myCoincidentPoints.begin();
+  std::vector<std::set<Slvs_hEntity> >::iterator aFirstFound = myCoincidentPoints.end();
+  while (aCoPtIter != myCoincidentPoints.end()) {
+    bool isFound[2] = {  // indicate which point ID was already in coincidence constraint
+        aCoPtIter->find(thePoint1) != aCoPtIter->end(), aCoPtIter->find(thePoint2)
+            != aCoPtIter->end(), };
+    if (isFound[0] && isFound[1])  // points are already connected by coincidence constraints => no need additional one
       return false;
-    if ((isFound[0] && !isFound[1]) || (!isFound[0] && isFound[1]))
-    {
-      if (aFirstFound != myCoincidentPoints.end())
-      { // there are two groups of coincident points connected by created constraint => merge them
+    if ((isFound[0] && !isFound[1]) || (!isFound[0] && isFound[1])) {
+      if (aFirstFound != myCoincidentPoints.end()) {  // there are two groups of coincident points connected by created constraint => merge them
         int aFirstFoundShift = aFirstFound - myCoincidentPoints.begin();
         int aCurrentShift = aCoPtIter - myCoincidentPoints.begin();
         aFirstFound->insert(aCoPtIter->begin(), aCoPtIter->end());
@@ -1178,9 +1106,7 @@ bool SketchSolver_ConstraintGroup::addCoincidentPoints(
         aFirstFound = myCoincidentPoints.begin() + aFirstFoundShift;
         aCoPtIter = myCoincidentPoints.begin() + aCurrentShift;
         continue;
-      }
-      else
-      {
+      } else {
         aCoPtIter->insert(isFound[0] ? thePoint2 : thePoint1);
         aFirstFound = aCoPtIter;
       }
@@ -1188,8 +1114,7 @@ bool SketchSolver_ConstraintGroup::addCoincidentPoints(
     aCoPtIter++;
   }
   // No points were found, need to create new set
-  if (aFirstFound == myCoincidentPoints.end())
-  {
+  if (aFirstFound == myCoincidentPoints.end()) {
     std::set<Slvs_hEntity> aNewSet;
     aNewSet.insert(thePoint1);
     aNewSet.insert(thePoint2);
@@ -1199,34 +1124,29 @@ bool SketchSolver_ConstraintGroup::addCoincidentPoints(
   return true;
 }
 
-
 // ============================================================================
 //  Function: updateRelatedConstraints
 //  Class:    SketchSolver_ConstraintGroup
 //  Purpose:  emit the signal to update constraints
 // ============================================================================
 void SketchSolver_ConstraintGroup::updateRelatedConstraints(
-                    boost::shared_ptr<ModelAPI_Attribute> theEntity) const
+    boost::shared_ptr<ModelAPI_Attribute> theEntity) const
 {
-  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::const_iterator
-    aConstrIter = myConstraintMap.begin();
-  for ( ; aConstrIter != myConstraintMap.end(); aConstrIter++)
-  {
-    std::list< boost::shared_ptr<ModelAPI_Attribute> > anAttributes = 
-      aConstrIter->first->data()->attributes(std::string());
-
-    std::list< boost::shared_ptr<ModelAPI_Attribute> >::iterator
-      anAttrIter = anAttributes.begin();
-    for ( ; anAttrIter != anAttributes.end(); anAttrIter++)
-    {
+  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::const_iterator aConstrIter =
+      myConstraintMap.begin();
+  for (; aConstrIter != myConstraintMap.end(); aConstrIter++) {
+    std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttributes = aConstrIter->first->data()
+        ->attributes(std::string());
+
+    std::list<boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttrIter = anAttributes.begin();
+    for (; anAttrIter != anAttributes.end(); anAttrIter++) {
       bool isUpd = (*anAttrIter == theEntity);
-      boost::shared_ptr<ModelAPI_AttributeRefAttr> aRefAttr = 
-        boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIter);
+      boost::shared_ptr<ModelAPI_AttributeRefAttr> aRefAttr = boost::dynamic_pointer_cast<
+          ModelAPI_AttributeRefAttr>(*anAttrIter);
       if (aRefAttr && !aRefAttr->isObject() && aRefAttr->attr() == theEntity)
         isUpd = true;
 
-      if (isUpd)
-      {
+      if (isUpd) {
         static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
         ModelAPI_EventCreator::get()->sendUpdated(aConstrIter->first, anEvent);
         break;
@@ -1236,23 +1156,19 @@ void SketchSolver_ConstraintGroup::updateRelatedConstraints(
 }
 
 void SketchSolver_ConstraintGroup::updateRelatedConstraints(
-                    boost::shared_ptr<ModelAPI_Feature> theFeature) const
+    boost::shared_ptr<ModelAPI_Feature> theFeature) const
 {
-  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::const_iterator
-    aConstrIter = myConstraintMap.begin();
-  for ( ; aConstrIter != myConstraintMap.end(); aConstrIter++)
-  {
-    std::list< boost::shared_ptr<ModelAPI_Attribute> > anAttributes = 
-      aConstrIter->first->data()->attributes(std::string());
-
-    std::list< boost::shared_ptr<ModelAPI_Attribute> >::iterator
-      anAttrIter = anAttributes.begin();
-    for ( ; anAttrIter != anAttributes.end(); anAttrIter++)
-    {
-      boost::shared_ptr<ModelAPI_AttributeRefAttr> aRefAttr = 
-        boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIter);
-      if (aRefAttr && aRefAttr->isObject() && aRefAttr->object() == theFeature)
-      {
+  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>::const_iterator aConstrIter =
+      myConstraintMap.begin();
+  for (; aConstrIter != myConstraintMap.end(); aConstrIter++) {
+    std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttributes = aConstrIter->first->data()
+        ->attributes(std::string());
+
+    std::list<boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttrIter = anAttributes.begin();
+    for (; anAttrIter != anAttributes.end(); anAttrIter++) {
+      boost::shared_ptr<ModelAPI_AttributeRefAttr> aRefAttr = boost::dynamic_pointer_cast<
+          ModelAPI_AttributeRefAttr>(*anAttrIter);
+      if (aRefAttr && aRefAttr->isObject() && aRefAttr->object() == theFeature) {
         static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
         ModelAPI_EventCreator::get()->sendUpdated(aConstrIter->first, anEvent);
         break;
@@ -1261,13 +1177,11 @@ void SketchSolver_ConstraintGroup::updateRelatedConstraints(
   }
 }
 
-
-
 // ========================================================
 // =========      Auxiliary functions       ===============
 // ========================================================
 
-template <typename T>
+template<typename T>
 int Search(const uint32_t& theEntityID, const std::vector<T>& theEntities)
 {
   int aResIndex = theEntityID <= theEntities.size() ? theEntityID - 1 : 0;
index 1ec22362731145288a1e2734ecba21065eadda46..26b577201d40140aa6e68280cff0e162e49c4997 100644 (file)
 #include <vector>
 #include <set>
 
-
 /** \class   SketchSolver_ConstraintGroup
  *  \ingroup DataModel
  *  \brief   Keeps the group of constraints which based on the same entities
  */
 class SketchSolver_ConstraintGroup
 {
-public:
+ public:
   /** \brief New group based on specified workplane.
    *         Throws an exception if theWorkplane is not an object of SketchPlugin_Sketch type
    *  \remark Type of theSketch is not verified inside
@@ -34,15 +33,21 @@ public:
 
   /// \brief Returns group's unique identifier
   inline const Slvs_hGroup& getId() const
-  {return myID;}
+  {
+    return myID;
+  }
 
   /// \brief Returns true if the group has no constraints yet
   inline bool isEmpty() const
-  {return myConstraints.empty();}
+  {
+    return myConstraints.empty();
+  }
 
   /// \brief Check for valid sketch data
   inline bool isWorkplaneValid() const
-  {return mySketch->data()->isValid();}
+  {
+    return mySketch->data()->isValid();
+  }
 
   /** \brief Adds or updates a constraint in the group
    *  \param[in] theConstraint constraint to be changed
@@ -63,7 +68,9 @@ public:
   bool isBaseWorkplane(boost::shared_ptr<SketchPlugin_Feature> theWorkplane) const;
 
   boost::shared_ptr<SketchPlugin_Feature> getWorkplane() const
-  { return mySketch; }
+  {
+    return mySketch;
+  }
 
   /** \brief Update parameters of workplane. Should be called when Update event is coming.
    *  \return \c true if workplane updated successfully, \c false if workplane parameters are not consistent
@@ -97,10 +104,10 @@ public:
   /** \brief Searches the constraints built on the entity and emit the signal to update them
    *  \param[in] theEntity attribute of the constraint
    */
-  void updateRelatedConstraints(boost::shared_ptr<ModelAPI_Attribute> theEntity)  const;
-  void updateRelatedConstraints(boost::shared_ptr<ModelAPI_Feature>   theFeature) const;
+  void updateRelatedConstraints(boost::shared_ptr<ModelAPI_Attribute> theEntity) const;
+  void updateRelatedConstraints(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
 
-protected:
+ protected:
   /** \brief Adds or updates an entity in the group
    *
    *  The parameters of entity will be parsed and added to the list of SolveSpace parameters.
@@ -110,7 +117,7 @@ protected:
    *  \return identifier of changed entity or 0 if entity could not be changed
    */
   Slvs_hEntity changeEntity(boost::shared_ptr<ModelAPI_Attribute> theEntity);
-  Slvs_hEntity changeEntity(FeaturePtr   theEntity);
+  Slvs_hEntity changeEntity(FeaturePtr theEntity);
 
   /** \brief Adds or updates a normal in the group
    *
@@ -148,7 +155,8 @@ protected:
    *  \param[in]     theEntityID  identifier of SolveSpace entity, which contains updated data
    *  \return \c true if the attribute's value has changed
    */
-  bool updateAttribute(boost::shared_ptr<ModelAPI_Attribute> theAttribute, const Slvs_hEntity& theEntityID);
+  bool updateAttribute(boost::shared_ptr<ModelAPI_Attribute> theAttribute,
+                       const Slvs_hEntity& theEntityID);
 
   /** \brief Adds a constraint for a point which should not be changed during computations
    *  \param[in] theEntity the base for the constraint
@@ -159,7 +167,7 @@ protected:
    */
   void removeTemporaryConstraints();
 
-private:
+ private:
   /** \brief Creates a workplane from the sketch parameters
    *  \param[in] theSketch parameters of workplane are the attributes of this sketch
    *  \return \c true if success, \c false if workplane parameters are not consistent
@@ -180,40 +188,34 @@ private:
    */
   void checkConstraintConsistence(Slvs_Constraint& theConstraint);
 
-private:
+ private:
   // SolveSpace entities
-  Slvs_hGroup                  myID;            ///< the index of the group
-  Slvs_Entity                  myWorkplane;     ///< Workplane for the current group
-  std::vector<Slvs_Param>      myParams;        ///< List of parameters of the constraints
-  Slvs_hParam                  myParamMaxID;    ///< Actual maximal ID of parameters (not equal to myParams size)
-  std::vector<Slvs_Entity>     myEntities;      ///< List of entities of the constaints
-  Slvs_hEntity                 myEntityMaxID;   ///< Actual maximal ID of entities (not equal to myEntities size)
+  Slvs_hGroup myID;            ///< the index of the group
+  Slvs_Entity myWorkplane;     ///< Workplane for the current group
+  std::vector<Slvs_Param> myParams;        ///< List of parameters of the constraints
+  Slvs_hParam myParamMaxID;    ///< Actual maximal ID of parameters (not equal to myParams size)
+  std::vector<Slvs_Entity> myEntities;      ///< List of entities of the constaints
+  Slvs_hEntity myEntityMaxID;   ///< Actual maximal ID of entities (not equal to myEntities size)
   std::vector<Slvs_Constraint> myConstraints;   ///< List of constraints in SolveSpace format
-  Slvs_hConstraint             myConstrMaxID;   ///< Actual maximal ID of constraints (not equal to myConstraints size)
-  bool                         myNeedToSolve;   ///< Indicator that something changed in the group and constraint system need to be rebuilt
+  Slvs_hConstraint myConstrMaxID;  ///< Actual maximal ID of constraints (not equal to myConstraints size)
+  bool myNeedToSolve;  ///< Indicator that something changed in the group and constraint system need to be rebuilt
 
-  SketchSolver_Solver          myConstrSolver;  ///< Solver for set of equations obtained by constraints
+  SketchSolver_Solver myConstrSolver;  ///< Solver for set of equations obtained by constraints
 
-  std::vector<Slvs_hParam>     myTempPointWhereDragged; ///< Parameters of one of the points which is moved by user
-  Slvs_hEntity                 myTempPointWDrgdID;      ///< Identifier of such point
-  std::list<Slvs_hConstraint>  myTempConstraints;       ///< The list of identifiers of temporary constraints (SLVS_C_WHERE_DRAGGED) applied for all other points moved by user
+  std::vector<Slvs_hParam> myTempPointWhereDragged;  ///< Parameters of one of the points which is moved by user
+  Slvs_hEntity myTempPointWDrgdID;      ///< Identifier of such point
+  std::list<Slvs_hConstraint> myTempConstraints;  ///< The list of identifiers of temporary constraints (SLVS_C_WHERE_DRAGGED) applied for all other points moved by user
 
   // SketchPlugin entities
-  boost::shared_ptr<SketchPlugin_Feature>
-                               mySketch;        ///< Equivalent to workplane
-  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>
-                               myConstraintMap; ///< The map between SketchPlugin and SolveSpace constraints
-  std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>
-                               myEntityAttrMap;     ///< The map between "attribute" parameters of constraints and their equivalent SolveSpace entities
-  std::map<FeaturePtr, Slvs_hEntity>
-                               myEntityFeatMap;     ///< The map between "feature" parameters of constraints and their equivalent SolveSpace entities
+  boost::shared_ptr<SketchPlugin_Feature> mySketch;        ///< Equivalent to workplane
+  std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint> myConstraintMap;  ///< The map between SketchPlugin and SolveSpace constraints
+  std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity> myEntityAttrMap;  ///< The map between "attribute" parameters of constraints and their equivalent SolveSpace entities
+  std::map<FeaturePtr, Slvs_hEntity> myEntityFeatMap;  ///< The map between "feature" parameters of constraints and their equivalent SolveSpace entities
 
   // Conincident items
-  std::vector< std::set<Slvs_hEntity> >
-                               myCoincidentPoints; ///< Stores the lists of identifiers of coincident points (to avoid unnecessary coincidence constraints)
-  std::set< boost::shared_ptr<SketchPlugin_Constraint> >
-                               myExtraCoincidence; ///< Additional coincidence constraints which are not necessary (coincidence between points already done
-                                                   ///< by other constraints) but created by GUI tools. Useful when some coincidence constraints were removed
+  std::vector<std::set<Slvs_hEntity> > myCoincidentPoints;  ///< Stores the lists of identifiers of coincident points (to avoid unnecessary coincidence constraints)
+  std::set<boost::shared_ptr<SketchPlugin_Constraint> > myExtraCoincidence;  ///< Additional coincidence constraints which are not necessary (coincidence between points already done
+                                                                             ///< by other constraints) but created by GUI tools. Useful when some coincidence constraints were removed
 };
 
 #endif
index a87f3e69b0ce019e07e6619ba852cf098a60a2a8..4a2cf08eee22be617261246917b57b5b0daf55fc 100644 (file)
 
 #include <list>
 
-
 // Initialization of constraint manager self pointer
 SketchSolver_ConstraintManager* SketchSolver_ConstraintManager::_self = 0;
 
 /// Global constraint manager object
 SketchSolver_ConstraintManager* myManager = SketchSolver_ConstraintManager::Instance();
 
-
 // ========================================================
 // ========= SketchSolver_ConstraintManager ===============
 // ========================================================
@@ -63,42 +61,38 @@ SketchSolver_ConstraintManager::~SketchSolver_ConstraintManager()
 // ============================================================================
 void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessage)
 {
-  if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED) ||
-      theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED) || 
-      theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED))
-  {
-    const ModelAPI_ObjectUpdatedMessage* anUpdateMsg = 
-      dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
-    std::set< ObjectPtr > aFeatures = anUpdateMsg->objects();
-
-    bool isModifiedEvt = 
-      theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED);
-    if (!isModifiedEvt)
-    {
-      std::set< ObjectPtr >::iterator aFeatIter;
-      for (aFeatIter = aFeatures.begin(); aFeatIter != aFeatures.end(); aFeatIter++)
-      {
+  if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)
+      || theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)
+      || theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED)) {
+    const ModelAPI_ObjectUpdatedMessage* anUpdateMsg =
+        dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+    std::set<ObjectPtr> aFeatures = anUpdateMsg->objects();
+
+    bool isModifiedEvt = theMessage->eventID()
+        == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED);
+    if (!isModifiedEvt) {
+      std::set<ObjectPtr>::iterator aFeatIter;
+      for (aFeatIter = aFeatures.begin(); aFeatIter != aFeatures.end(); aFeatIter++) {
         FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*aFeatIter);
-        if (!aFeature) continue;
+        if (!aFeature)
+          continue;
         // Only sketches and constraints can be added by Create event
         const std::string& aFeatureKind = aFeature->getKind();
-        if (aFeatureKind.compare(SketchPlugin_Sketch::ID()) == 0)
-        {
-          boost::shared_ptr<SketchPlugin_Feature> aSketch =
-            boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+        if (aFeatureKind.compare(SketchPlugin_Sketch::ID()) == 0) {
+          boost::shared_ptr<SketchPlugin_Feature> aSketch = boost::dynamic_pointer_cast<
+              SketchPlugin_Feature>(aFeature);
           if (aSketch)
             changeWorkplane(aSketch);
           continue;
         }
-        boost::shared_ptr<SketchPlugin_Constraint> aConstraint =
-          boost::dynamic_pointer_cast<SketchPlugin_Constraint>(aFeature);
+        boost::shared_ptr<SketchPlugin_Constraint> aConstraint = boost::dynamic_pointer_cast<
+            SketchPlugin_Constraint>(aFeature);
         if (aConstraint)
           changeConstraint(aConstraint);
-        else
-        {
+        else {
           // Sketch plugin features can be only updated
-          boost::shared_ptr<SketchPlugin_Feature> aSFeature =
-            boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+          boost::shared_ptr<SketchPlugin_Feature> aSFeature = boost::dynamic_pointer_cast<
+              SketchPlugin_Feature>(aFeature);
           if (aSFeature)
             updateEntity(aSFeature);
         }
@@ -107,11 +101,9 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa
 
     // Solve the set of constraints
     resolveConstraints();
-  }
-  else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED))
-  {
-    const ModelAPI_ObjectDeletedMessage* aDeleteMsg = 
-      dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
+  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
+    const ModelAPI_ObjectDeletedMessage* aDeleteMsg =
+        dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
     const std::set<std::string>& aFeatureGroups = aDeleteMsg->groups();
 
     // Find SketchPlugin_Sketch::ID() in groups. The constraint groups should be updated when an object removed from Sketch
@@ -119,23 +111,19 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa
     for (aFGrIter = aFeatureGroups.begin(); aFGrIter != aFeatureGroups.end(); aFGrIter++)
       if (aFGrIter->compare(ModelAPI_ResultConstruction::group()) == 0)
         break;
-    
-    if (aFGrIter != aFeatureGroups.end())
-    {
+
+    if (aFGrIter != aFeatureGroups.end()) {
       std::vector<SketchSolver_ConstraintGroup*>::iterator aGroupIter = myGroups.begin();
       std::vector<SketchSolver_ConstraintGroup*> aSeparatedGroups;
-      while (aGroupIter != myGroups.end())
-      {
-        if (!(*aGroupIter)->isWorkplaneValid())
-        { // the group should be removed
+      while (aGroupIter != myGroups.end()) {
+        if (!(*aGroupIter)->isWorkplaneValid()) {  // the group should be removed
           delete *aGroupIter;
           int aShift = aGroupIter - myGroups.begin();
           myGroups.erase(aGroupIter);
           aGroupIter = myGroups.begin() + aShift;
           continue;
         }
-        if ((*aGroupIter)->updateGroup())
-        { // some constraints were removed, try to split the group
+        if ((*aGroupIter)->updateGroup()) {  // some constraints were removed, try to split the group
           (*aGroupIter)->splitGroup(aSeparatedGroups);
         }
         aGroupIter++;
@@ -151,26 +139,24 @@ void SketchSolver_ConstraintManager::processEvent(const Events_Message* theMessa
 //  Class:    SketchSolver_PluginManager
 //  Purpose:  update workplane by given parameters of the sketch
 // ============================================================================
-bool SketchSolver_ConstraintManager::changeWorkplane(boost::shared_ptr<SketchPlugin_Feature> theSketch)
+bool SketchSolver_ConstraintManager::changeWorkplane(
+    boost::shared_ptr<SketchPlugin_Feature> theSketch)
 {
-  bool aResult = true; // changed when a workplane wrongly updated
+  bool aResult = true;  // changed when a workplane wrongly updated
   bool isUpdated = false;
   // Try to update specified workplane in all groups
   std::vector<SketchSolver_ConstraintGroup*>::iterator aGroupIter;
   for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++)
-    if ((*aGroupIter)->isBaseWorkplane(theSketch))
-    {
+    if ((*aGroupIter)->isBaseWorkplane(theSketch)) {
       isUpdated = true;
       if (!(*aGroupIter)->updateWorkplane())
         aResult = false;
     }
   // If the workplane is not updated, so this is a new workplane
-  if (!isUpdated)
-  {
+  if (!isUpdated) {
     SketchSolver_ConstraintGroup* aNewGroup = new SketchSolver_ConstraintGroup(theSketch);
     // Verify that the group is created successfully
-    if (!aNewGroup->isBaseWorkplane(theSketch))
-    {
+    if (!aNewGroup->isBaseWorkplane(theSketch)) {
       delete aNewGroup;
       return false;
     }
@@ -185,36 +171,31 @@ bool SketchSolver_ConstraintManager::changeWorkplane(boost::shared_ptr<SketchPlu
 //  Purpose:  create/update the constraint and place it into appropriate group
 // ============================================================================
 bool SketchSolver_ConstraintManager::changeConstraint(
-              boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
+    boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
 {
   // Search the groups which this constraint touches
   std::set<Slvs_hGroup> aGroups;
   findGroups(theConstraint, aGroups);
 
   // Process the groups list
-  if (aGroups.size() == 0)
-  { // There are no groups applicable for this constraint => create new one
+  if (aGroups.size() == 0) {  // There are no groups applicable for this constraint => create new one
     boost::shared_ptr<SketchPlugin_Feature> aWP = findWorkplaneForConstraint(theConstraint);
-    if (!aWP) return false;
+    if (!aWP)
+      return false;
     SketchSolver_ConstraintGroup* aGroup = new SketchSolver_ConstraintGroup(aWP);
-    if (!aGroup->changeConstraint(theConstraint))
-    {
+    if (!aGroup->changeConstraint(theConstraint)) {
       delete aGroup;
       return false;
     }
     myGroups.push_back(aGroup);
     return true;
-  }
-  else if (aGroups.size() == 1)
-  { // Only one group => add constraint into it
+  } else if (aGroups.size() == 1) {  // Only one group => add constraint into it
     Slvs_hGroup aGroupId = *(aGroups.begin());
     std::vector<SketchSolver_ConstraintGroup*>::iterator aGroupIter;
     for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++)
       if ((*aGroupIter)->getId() == aGroupId)
         return (*aGroupIter)->changeConstraint(theConstraint);
-  }
-  else if (aGroups.size() > 1)
-  { // Several groups applicable for this constraint => need to merge them
+  } else if (aGroups.size() > 1) {  // Several groups applicable for this constraint => need to merge them
     std::set<Slvs_hGroup>::const_iterator aGroupsIter = aGroups.begin();
 
     // Search first group
@@ -227,13 +208,11 @@ bool SketchSolver_ConstraintManager::changeConstraint(
 
     // Append other groups to the first one
     std::vector<SketchSolver_ConstraintGroup*>::iterator anOtherGroupIter = aFirstGroupIter + 1;
-    for (aGroupsIter++; aGroupsIter != aGroups.end(); aGroupsIter++)
-    {
-      for ( ; anOtherGroupIter != myGroups.end(); anOtherGroupIter++)
+    for (aGroupsIter++; aGroupsIter != aGroups.end(); aGroupsIter++) {
+      for (; anOtherGroupIter != myGroups.end(); anOtherGroupIter++)
         if ((*anOtherGroupIter)->getId() == *aGroupsIter)
           break;
-      if (anOtherGroupIter == myGroups.end())
-      { // Group disappears
+      if (anOtherGroupIter == myGroups.end()) {  // Group disappears
         anOtherGroupIter = aFirstGroupIter + 1;
         continue;
       }
@@ -243,7 +222,7 @@ bool SketchSolver_ConstraintManager::changeConstraint(
       int aShiftOther = anOtherGroupIter - myGroups.begin();
       delete *anOtherGroupIter;
       myGroups.erase(anOtherGroupIter);
-      aFirstGroupIter  = myGroups.begin() + aShiftFirst;
+      aFirstGroupIter = myGroups.begin() + aShiftFirst;
       anOtherGroupIter = myGroups.begin() + aShiftOther;
     }
 
@@ -259,7 +238,8 @@ bool SketchSolver_ConstraintManager::changeConstraint(
 //  Class:    SketchSolver_PluginManager
 //  Purpose:  update any element on the sketch, which is used by constraints
 // ============================================================================
-void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr<SketchPlugin_Feature> theFeature)
+void SketchSolver_ConstraintManager::updateEntity(
+    boost::shared_ptr<SketchPlugin_Feature> theFeature)
 {
   // Create list of attributes depending on type of the feature
   std::vector<std::string> anAttrList;
@@ -268,20 +248,17 @@ void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr<SketchPlugin
   if (aFeatureKind.compare(SketchPlugin_Point::ID()) == 0)
     anAttrList.push_back(SketchPlugin_Point::COORD_ID());
   // Line
-  else if (aFeatureKind.compare(SketchPlugin_Line::ID()) == 0)
-  {
+  else if (aFeatureKind.compare(SketchPlugin_Line::ID()) == 0) {
     anAttrList.push_back(SketchPlugin_Line::START_ID());
     anAttrList.push_back(SketchPlugin_Line::END_ID());
   }
   // Circle
-  else if (aFeatureKind.compare(SketchPlugin_Circle::ID()) == 0)
-  {
+  else if (aFeatureKind.compare(SketchPlugin_Circle::ID()) == 0) {
     anAttrList.push_back(SketchPlugin_Circle::CENTER_ID());
     anAttrList.push_back(SketchPlugin_Circle::RADIUS_ID());
   }
   // Arc
-  else if (aFeatureKind.compare(SketchPlugin_Arc::ID()) == 0)
-  {
+  else if (aFeatureKind.compare(SketchPlugin_Arc::ID()) == 0) {
     anAttrList.push_back(SketchPlugin_Arc::CENTER_ID());
     anAttrList.push_back(SketchPlugin_Arc::START_ID());
     anAttrList.push_back(SketchPlugin_Arc::END_ID());
@@ -290,15 +267,13 @@ void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr<SketchPlugin
 
   // Check changing of feature's attributes (go through the groups and search usage of the attributes)
   std::vector<std::string>::const_iterator anAttrIter;
-  for (anAttrIter = anAttrList.begin(); anAttrIter != anAttrList.end(); anAttrIter++)
-  {
+  for (anAttrIter = anAttrList.begin(); anAttrIter != anAttrList.end(); anAttrIter++) {
     std::vector<SketchSolver_ConstraintGroup*>::iterator aGroupIter;
-    for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++)
-    {
-      if ((*aGroupIter)->isEmpty()) 
+    for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++) {
+      if ((*aGroupIter)->isEmpty())
         continue;
-      boost::shared_ptr<ModelAPI_Attribute> anAttribute =
-        boost::dynamic_pointer_cast<ModelAPI_Attribute>(theFeature->data()->attribute(*anAttrIter));
+      boost::shared_ptr<ModelAPI_Attribute> anAttribute = boost::dynamic_pointer_cast<
+          ModelAPI_Attribute>(theFeature->data()->attribute(*anAttrIter));
       (*aGroupIter)->updateEntityIfPossible(anAttribute);
     }
   }
@@ -309,23 +284,21 @@ void SketchSolver_ConstraintManager::updateEntity(boost::shared_ptr<SketchPlugin
       (*aGroupIter)->updateRelatedConstraints(theFeature);
 }
 
-
 // ============================================================================
 //  Function: findGroups
 //  Class:    SketchSolver_PluginManager
 //  Purpose:  search groups of entities interacting with given constraint
 // ============================================================================
 void SketchSolver_ConstraintManager::findGroups(
-              boost::shared_ptr<SketchPlugin_Constraint> theConstraint,
-              std::set<Slvs_hGroup>&                     theGroupIDs) const
+    boost::shared_ptr<SketchPlugin_Constraint> theConstraint,
+    std::set<Slvs_hGroup>& theGroupIDs) const
 {
   boost::shared_ptr<SketchPlugin_Feature> aWP = findWorkplaneForConstraint(theConstraint);
 
-  SketchSolver_ConstraintGroup* anEmptyGroup = 0; // appropriate empty group for specified constraint
+  SketchSolver_ConstraintGroup* anEmptyGroup = 0;  // appropriate empty group for specified constraint
   std::vector<SketchSolver_ConstraintGroup*>::const_iterator aGroupIter;
   for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++)
-    if (aWP == (*aGroupIter)->getWorkplane() && (*aGroupIter)->isInteract(theConstraint))
-    {
+    if (aWP == (*aGroupIter)->getWorkplane() && (*aGroupIter)->isInteract(theConstraint)) {
       if (!(*aGroupIter)->isEmpty())
         theGroupIDs.insert((*aGroupIter)->getId());
       else if (!anEmptyGroup)
@@ -343,25 +316,24 @@ void SketchSolver_ConstraintManager::findGroups(
 //  Purpose:  search workplane containing given constraint
 // ============================================================================
 boost::shared_ptr<SketchPlugin_Feature> SketchSolver_ConstraintManager::findWorkplaneForConstraint(
-              boost::shared_ptr<SketchPlugin_Constraint> theConstraint) const
+    boost::shared_ptr<SketchPlugin_Constraint> theConstraint) const
 {
   // Already verified workplanes
-  std::set< boost::shared_ptr<SketchPlugin_Feature> > aVerified;
+  std::set<boost::shared_ptr<SketchPlugin_Feature> > aVerified;
 
   std::vector<SketchSolver_ConstraintGroup*>::const_iterator aGroupIter;
-  for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++)
-  {
+  for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++) {
     boost::shared_ptr<SketchPlugin_Feature> aWP = (*aGroupIter)->getWorkplane();
     if (aVerified.find(aWP) != aVerified.end())
       continue;
 
-    boost::shared_ptr<ModelAPI_AttributeRefList> aWPFeatures =
-      boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aWP->data()->attribute(SketchPlugin_Sketch::FEATURES_ID()));
+    boost::shared_ptr<ModelAPI_AttributeRefList> aWPFeatures = boost::dynamic_pointer_cast<
+        ModelAPI_AttributeRefList>(aWP->data()->attribute(SketchPlugin_Sketch::FEATURES_ID()));
     std::list<ObjectPtr> aFeaturesList = aWPFeatures->list();
     std::list<ObjectPtr>::const_iterator anIter;
     for (anIter = aFeaturesList.begin(); anIter != aFeaturesList.end(); anIter++)
       if (*anIter == theConstraint)
-        return aWP; // workplane is found
+        return aWP;  // workplane is found
     aVerified.insert(aWP);
   }
 
index 1f5f7f884ee7cc96b1eebc75f4e6e79b051ac39d..4101906ab743d4b869d87615c83c3899bdcb024c 100644 (file)
@@ -20,7 +20,6 @@
 #include <vector>
 #include <set>
 
-
 /** \class   SketchSolver_ConstraintManager
  *  \ingroup DataModel
  *  \brief   Listens the changes of SketchPlugin features and transforms the Constraint
@@ -34,7 +33,7 @@
  */
 class SketchSolver_ConstraintManager : public Events_Listener
 {
-public:
+ public:
   /** \brief Main method to create constraint manager
    *  \return pointer to the singleton
    */
@@ -45,7 +44,7 @@ public:
    */
   virtual void processEvent(const Events_Message* theMessage);
 
-protected:
+ protected:
   SketchSolver_ConstraintManager();
   ~SketchSolver_ConstraintManager();
 
@@ -84,24 +83,24 @@ protected:
    */
   void resolveConstraints();
 
-private:
+ private:
   /** \brief Searches list of groups which interact with specified constraint
    *  \param[in]  theConstraint constraint to be found
    *  \param[out] theGroups     list of group indexes interacted with constraint
    */
   void findGroups(boost::shared_ptr<SketchPlugin_Constraint> theConstraint,
-                  std::set<Slvs_hGroup>&                     theGroupIDs) const;
+                  std::set<Slvs_hGroup>& theGroupIDs) const;
 
   /** \brief Searches in the list of groups the workplane which constains specified constraint
    *  \param[in] theConstraint constraint to be found
    *  \return workplane containing the constraint
    */
   boost::shared_ptr<SketchPlugin_Feature> findWorkplaneForConstraint(
-                  boost::shared_ptr<SketchPlugin_Constraint> theConstraint) const;
+      boost::shared_ptr<SketchPlugin_Constraint> theConstraint) const;
 
-private:
-  static SketchSolver_ConstraintManager*    _self;    ///< Self pointer to implement singleton functionality
-  std::vector<SketchSolver_ConstraintGroup*> myGroups; ///< Groups of constraints
+ private:
+  static SketchSolver_ConstraintManager* _self;  ///< Self pointer to implement singleton functionality
+  std::vector<SketchSolver_ConstraintGroup*> myGroups;  ///< Groups of constraints
 };
 
 #endif
index b91d267f61b4625b1402b314787a0253a0850d66..975588bbb18084947a2bbcdeb457c1f68864f614 100644 (file)
@@ -30,21 +30,21 @@ SketchSolver_Solver::SketchSolver_Solver()
 SketchSolver_Solver::~SketchSolver_Solver()
 {
   if (myEquationsSystem.param)
-    delete [] myEquationsSystem.param;
+    delete[] myEquationsSystem.param;
   if (myEquationsSystem.entity)
-    delete [] myEquationsSystem.entity;
+    delete[] myEquationsSystem.entity;
   if (myEquationsSystem.constraint)
-    delete [] myEquationsSystem.constraint;
+    delete[] myEquationsSystem.constraint;
   if (myEquationsSystem.failed)
-    delete [] myEquationsSystem.failed;
+    delete[] myEquationsSystem.failed;
 }
 
 void SketchSolver_Solver::setParameters(const std::vector<Slvs_Param>& theParameters)
 {
-  if (theParameters.size() != myEquationsSystem.params) // number of parameters was changed => reallocate the memory
-  {
+  if (theParameters.size() != myEquationsSystem.params)  // number of parameters was changed => reallocate the memory
+      {
     if (myEquationsSystem.param)
-      delete [] myEquationsSystem.param;
+      delete[] myEquationsSystem.param;
     myEquationsSystem.params = theParameters.size();
     myEquationsSystem.param = new Slvs_Param[theParameters.size()];
   }
@@ -57,8 +57,7 @@ void SketchSolver_Solver::setParameters(const std::vector<Slvs_Param>& theParame
 
 void SketchSolver_Solver::setDraggedParameters(const std::vector<Slvs_hParam>& theDragged)
 {
-  if (theDragged.size() == 0)
-  {
+  if (theDragged.size() == 0) {
     myEquationsSystem.dragged[0] = 0;
     myEquationsSystem.dragged[1] = 0;
     myEquationsSystem.dragged[2] = 0;
@@ -71,10 +70,10 @@ void SketchSolver_Solver::setDraggedParameters(const std::vector<Slvs_hParam>& t
 
 void SketchSolver_Solver::setEntities(const std::vector<Slvs_Entity>& theEntities)
 {
-  if (theEntities.size() != myEquationsSystem.entities) // number of entities was changed => reallocate the memory
-  {
+  if (theEntities.size() != myEquationsSystem.entities)  // number of entities was changed => reallocate the memory
+      {
     if (myEquationsSystem.entity)
-      delete [] myEquationsSystem.entity;
+      delete[] myEquationsSystem.entity;
     myEquationsSystem.entities = theEntities.size();
     myEquationsSystem.entity = new Slvs_Entity[theEntities.size()];
   }
@@ -87,16 +86,16 @@ void SketchSolver_Solver::setEntities(const std::vector<Slvs_Entity>& theEntitie
 
 void SketchSolver_Solver::setConstraints(const std::vector<Slvs_Constraint>& theConstraints)
 {
-  if (theConstraints.size() != myEquationsSystem.constraints) // number of constraints was changed => reallocate the memory
-  {
+  if (theConstraints.size() != myEquationsSystem.constraints)  // number of constraints was changed => reallocate the memory
+      {
     if (myEquationsSystem.constraint)
-      delete [] myEquationsSystem.constraint;
+      delete[] myEquationsSystem.constraint;
     myEquationsSystem.constraints = theConstraints.size();
     myEquationsSystem.constraint = new Slvs_Constraint[theConstraints.size()];
 
     // Assign the memory for the failed constraints
     if (myEquationsSystem.failed)
-      delete [] myEquationsSystem.failed;
+      delete[] myEquationsSystem.failed;
     myEquationsSystem.failed = new Slvs_hConstraint[theConstraints.size()];
     myEquationsSystem.faileds = theConstraints.size();
   }
@@ -125,13 +124,12 @@ bool SketchSolver_Solver::getResult(std::vector<Slvs_Param>& theParameters)
     return false;
 
   if (theParameters.size() != myEquationsSystem.params)
-    return false; // number of parameters is not the same
+    return false;  // number of parameters is not the same
 
   std::vector<Slvs_Param>::iterator aParamIter = theParameters.begin();
-  for (int i = 0; i < myEquationsSystem.params; i++, aParamIter++)
-  {
+  for (int i = 0; i < myEquationsSystem.params; i++, aParamIter++) {
     if (myEquationsSystem.param[i].h != aParamIter->h)
-      return false; // sequence of parameters was changed
+      return false;  // sequence of parameters was changed
     aParamIter->val = myEquationsSystem.param[i].val;
   }
 
index 412b0e1809cce674757c5a6c54b987c2aa2c1b8e..8bdc566f0c733691d69e24d1ee3b30ae22961ffc 100644 (file)
@@ -18,7 +18,6 @@ typedef unsigned int UINT32;
 
 #include <vector>
 
-
 #define SLVS_RESULT_EMPTY_SET -1
 
 // Unknown constraint (for error reporting)
@@ -26,17 +25,18 @@ typedef unsigned int UINT32;
 // Unknown entity
 #define SLVS_E_UNKNOWN 0
 
-
 class SketchSolver_Solver
 {
-public:
+ public:
   SketchSolver_Solver();
   ~SketchSolver_Solver();
 
   /** \brief Initialize the ID of the group
    */
   inline void setGroupID(Slvs_hGroup theGroupID)
-  { myGroupID = theGroupID; }
+  {
+    myGroupID = theGroupID;
+  }
 
   /** \brief Change array of parameters
    *  \param[in] theParameters vector of parameters
@@ -70,9 +70,9 @@ public:
    */
   bool getResult(std::vector<Slvs_Param>& theParameters);
 
-private:
+ private:
   Slvs_hGroup myGroupID;         ///< identifier of the group to be solved
-  Slvs_System myEquationsSystem; ///< set of equations for solving in SolveSpace
+  Slvs_System myEquationsSystem;  ///< set of equations for solving in SolveSpace
 };
 
 #endif
index 4bfb31b9d6e31eb7807415815e4a04f815149c66..294faab4b38f988fedeb4c52bd4618e9fadb2999 100644 (file)
 #include <QDebug>
 #endif
 
-
 XGUI_ActionsMgr::XGUI_ActionsMgr(XGUI_Workshop* theParent)
- : QObject(theParent),
-   myWorkshop(theParent),
-   myOperationMgr(theParent->operationMgr())
   : QObject(theParent),
+      myWorkshop(theParent),
+      myOperationMgr(theParent->operationMgr())
 {
   // Default shortcuts
   myShortcuts << QKeySequence::Save;
@@ -36,11 +35,10 @@ XGUI_ActionsMgr::~XGUI_ActionsMgr()
 {
 }
 
-
 void XGUI_ActionsMgr::addCommand(QAction* theCmd)
 {
   QString aId = theCmd->data().toString();
-  if(aId.isEmpty()) {
+  if (aId.isEmpty()) {
     return;
   }
   myActions.insert(aId, theCmd);
@@ -60,7 +58,7 @@ void XGUI_ActionsMgr::addNestedCommands(const QString& theId, const QStringList&
 
 void XGUI_ActionsMgr::update()
 {
-  if(myOperationMgr->hasOperation()) {
+  if (myOperationMgr->hasOperation()) {
     setAllEnabled(false);
     ModuleBase_Operation* anOperation = myOperationMgr->currentOperation();
     QString anOperationId = anOperation->id();
@@ -76,7 +74,8 @@ void XGUI_ActionsMgr::update()
 
 void XGUI_ActionsMgr::setAllEnabled(bool isEnabled)
 {
-  foreach(QString eachAction, myActions.keys()) {
+  foreach(QString eachAction, myActions.keys())
+  {
     setActionEnabled(eachAction, isEnabled);
   }
 }
@@ -85,14 +84,16 @@ void XGUI_ActionsMgr::setAllEnabled(bool isEnabled)
 void XGUI_ActionsMgr::setNestedCommandsEnabled(bool theEnabled, const QString& theParent)
 {
   QStringList ltNestedActions;
-  if(theParent.isEmpty()) { //Disable ALL nested
-    foreach(QString eachParent, myNestedActions.keys()) {
+  if (theParent.isEmpty()) {  //Disable ALL nested
+    foreach(QString eachParent, myNestedActions.keys())
+    {
       ltNestedActions << myNestedActions[eachParent];
     }
   } else {
     ltNestedActions << myNestedActions[theParent];
   }
-  foreach(QString eachNested, ltNestedActions) {
+  foreach(QString eachNested, ltNestedActions)
+  {
     setActionEnabled(eachNested, theEnabled);
   }
 }
@@ -100,16 +101,15 @@ void XGUI_ActionsMgr::setNestedCommandsEnabled(bool theEnabled, const QString& t
 void XGUI_ActionsMgr::setActionChecked(const QString& theId, const bool theChecked)
 {
   QAction* anAction = myActions[theId];
-  if(anAction && anAction->isCheckable()) {
+  if (anAction && anAction->isCheckable()) {
     anAction->setChecked(theChecked);
   }
 }
 
-
 void XGUI_ActionsMgr::setActionEnabled(const QString& theId, const bool theEnabled)
 {
   QAction* anAction = myActions[theId];
-  if(anAction) {
+  if (anAction) {
     anAction->setEnabled(theEnabled);
   }
 }
@@ -117,11 +117,13 @@ void XGUI_ActionsMgr::setActionEnabled(const QString& theId, const bool theEnabl
 void XGUI_ActionsMgr::updateCheckState()
 {
   QString eachCommand = QString();
-  foreach(eachCommand, myActions.keys()) {
+  foreach(eachCommand, myActions.keys())
+  {
     setActionChecked(eachCommand, false);
   }
   QStringList ltActiveCommands = myOperationMgr->operationList();
-  foreach(eachCommand, ltActiveCommands) {
+  foreach(eachCommand, ltActiveCommands)
+  {
     setActionChecked(eachCommand, true);
   }
 }
@@ -135,7 +137,8 @@ QStringList XGUI_ActionsMgr::nestedCommands(const QString& theId) const
 
 bool XGUI_ActionsMgr::isNested(const QString& theId) const
 {
-  foreach(QString aId, myNestedActions.keys()) {
+  foreach(QString aId, myNestedActions.keys())
+  {
     QStringList aList = myNestedActions[aId];
     if (aList.contains(theId))
       return true;
@@ -145,11 +148,11 @@ bool XGUI_ActionsMgr::isNested(const QString& theId) const
 
 QKeySequence XGUI_ActionsMgr::registerShortcut(const QString& theKeySequence)
 {
-  if(theKeySequence.isEmpty()) {
+  if (theKeySequence.isEmpty()) {
     return QKeySequence();
   }
   QKeySequence aResult(theKeySequence);
-  if(myShortcuts.contains(aResult)) {
+  if (myShortcuts.contains(aResult)) {
     QString aMessage = tr("Shortcut %1 is already defined. Ignore.").arg(theKeySequence);
     Events_Error::send(aMessage.toStdString());
     return QKeySequence();
index 5f8c4ab93a6131fc5249cc7a7479a06359706669..753330a22cff11be5467958619c4a18ade087c1c 100644 (file)
@@ -18,11 +18,11 @@ class XGUI_Workshop;
 class XGUI_OperationMgr;
 class QAction;
 
-class XGUI_EXPORT XGUI_ActionsMgr: public QObject
+class XGUI_EXPORT XGUI_ActionsMgr : public QObject
 {
-  Q_OBJECT
+Q_OBJECT
 
-public:
+ public:
   XGUI_ActionsMgr(XGUI_Workshop* theWorkshop);
   virtual ~XGUI_ActionsMgr();
 
@@ -39,7 +39,7 @@ public:
 
   QKeySequence registerShortcut(const QString& theKeySequence);
 
-public slots:
+ public slots:
   //! Update workbench actions according to OperationMgr state:
   //! No active operations: all actions but nested are available
   //! There is active operation: current operation + it's nested
@@ -48,7 +48,7 @@ public slots:
   //! Sets all commands checked if it's operation is active.
   void updateCheckState();
 
-protected:
+ protected:
   //! Sets all actions to isEnabled state.
   void setAllEnabled(bool isEnabled);
   //! Sets all nested actions to isEnabled state for the command with given ID.
@@ -59,7 +59,7 @@ protected:
   //! Sets the action with theId to theEnabled state.
   void setActionEnabled(const QString& theId, const bool theEnabled);
 
-private:
+ private:
   QMap<QString, QAction*> myActions;
   QMap<QString, QStringList> myNestedActions;
   QList<QKeySequence> myShortcuts;
index 01b3bf83595f4d8a4dd6d420da4e021285dc1d80..59df312b1e3338caf61be7232afe89797af4c5da 100644 (file)
@@ -3,14 +3,16 @@
 #include <QToolButton>
 
 XGUI_Command::XGUI_Command(const QString& theId, QObject * parent, bool isCheckable)
-    : QWidgetAction(parent), myCheckable(isCheckable)
+    : QWidgetAction(parent),
+      myCheckable(isCheckable)
 {
   setData(theId);
 }
 
 XGUI_Command::XGUI_Command(const QString& theId, const QIcon& icon, const QString& text,
                            QObject* parent, bool isCheckable)
-    : QWidgetAction(parent), myCheckable(isCheckable)
+    : QWidgetAction(parent),
+      myCheckable(isCheckable)
 {
   setIcon(icon);
   setText(text);
@@ -52,7 +54,7 @@ QWidget* XGUI_Command::createWidget(QWidget* theParent)
 
 void XGUI_Command::connectTo(const QObject* theResiver, const char* theSlot)
 {
-    connect(this, SIGNAL(triggered(bool)), theResiver, theSlot);
+  connect(this, SIGNAL(triggered(bool)), theResiver, theSlot);
 }
 
 const QStringList& XGUI_Command::nestedCommands() const
index 9367e83756404b43ca11b836642be6166de01249..696518789e5016eb85d83661af23a32e5c7599e2 100644 (file)
@@ -4,7 +4,6 @@
 #include "XGUI.h"
 #include <QWidgetAction>
 
-
 #define MIN_BUTTON_HEIGHT 25
 #define MIN_BUTTON_WIDTH 60
 
  * \ingroup GUI
  * \brief Represents a command item in the application menu (Workbench)
  */
-class XGUI_EXPORT XGUI_Command: public QWidgetAction
+class XGUI_EXPORT XGUI_Command : public QWidgetAction
 {
 Q_OBJECT
-public:
+ public:
   XGUI_Command(const QString& theId, QObject * parent, bool isCheckable = false);
-  XGUI_Command(const QString& theId, const QIcon& icon, const QString& text, QObject* parent, bool isCheckable = false);
+  XGUI_Command(const QString& theId, const QIcon& icon, const QString& text, QObject* parent,
+               bool isCheckable = false);
   ~XGUI_Command();
 
   //VSV: Don't use this method for compatibility with SALOME. Use the construction below
   /*virtual QString id() const
-  {
-    return data().toString();
-  }*/
+   {
+   return data().toString();
+   }*/
 
   const QStringList& nestedCommands() const;
   void setNestedCommands(const QStringList& myUnblockableCommands);
@@ -32,11 +32,11 @@ public:
   //! Connect the command to a slot
   virtual void connectTo(const QObject* theResiver, const char* theSlot);
 
-protected:
+ protected:
   //! Creates a command representation widget dependently on parent widget type
   virtual QWidget* createWidget(QWidget* theParent);
 
-private:
+ private:
   bool myCheckable;
   //! List of Ids of commands which WILL NOT be blocked when the command is on.
   QStringList myNestedCommands;
index 5cd0f25238dabfdf7b9c8df2cf1ee99c580bc73b..5abd457b9a27db208e8538d011c85cc0d1e3a07b 100644 (file)
@@ -1,8 +1,7 @@
 #ifndef XGUI_Constants_H
 #define XGUI_Constants_H
 
-namespace XGUI
-{
+namespace XGUI {
 
 //! Types of gradient type used in background of Viewer 3d
 enum GradientType
@@ -22,32 +21,41 @@ enum GradientType
 //! Type of rotation point in viewer 3d
 enum RotationPointType
 {
-  GRAVITY, SELECTED
+  GRAVITY,
+  SELECTED
 };
 
 //! Type of ribbon rect in Viewer 3d
 enum SketchingType
 {
-  NoSketching, Rect, Polygon
+  NoSketching,
+  Rect,
+  Polygon
 };
 
-
 //! View window operations accessible by hot keys
 enum HotOperation
 {
-  PAN, ZOOM, ROTATE, FIT_AREA
+  PAN,
+  ZOOM,
+  ROTATE,
+  FIT_AREA
 };
 
 //! Types of view window interactions
 enum InteractionStyle
 {
-  STANDARD, KEY_FREE
+  STANDARD,
+  KEY_FREE
 };
 
 //! Types of 2d mode in viewer 3d
 enum Mode2dType
 {
-  No2dMode, XYPlane, XZPlane, YZPlane
+  No2dMode,
+  XYPlane,
+  XZPlane,
+  YZPlane
 };
 
 //! Types of background in view window
@@ -71,6 +79,7 @@ const static char* PROP_PANEL = "property_panel_dock";
 const static char* PROP_PANEL_OK = "property_panel_ok";
 const static char* PROP_PANEL_CANCEL = "property_panel_cancel";
 
-};
+}
+;
 
 #endif
index e699b4a2aca094101a7c11485f88c4a3b1f745a6..914cce3217c605a514e13a57b1ea4b27ce35734a 100644 (file)
@@ -1,4 +1,3 @@
-
 #include "XGUI_ContextMenuMgr.h"
 #include "XGUI_Workshop.h"
 #include "XGUI_ObjectsBrowser.h"
@@ -20,8 +19,9 @@
 #include <QMenu>
 #include <QMdiArea>
 
-XGUI_ContextMenuMgr::XGUI_ContextMenuMgr(XGUI_Workshop* theParent) :
-QObject(theParent), myWorkshop(theParent)
+XGUI_ContextMenuMgr::XGUI_ContextMenuMgr(XGUI_Workshop* theParent)
+    : QObject(theParent),
+      myWorkshop(theParent)
 {
 }
 
@@ -89,7 +89,7 @@ void XGUI_ContextMenuMgr::onContextMenuRequest(QContextMenuEvent* theEvent)
   else if (sender() == myWorkshop->viewer()) {
     aMenu = viewerMenu();
   }
-  
+
   if (aMenu && (aMenu->actions().size() > 0)) {
     aMenu->exec(theEvent->globalPos());
     delete aMenu;
@@ -114,7 +114,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
         if (aPart) {
           if (aMgr->currentDocument() == aPart->partDoc())
             aMenu->addAction(action("DEACTIVATE_PART_CMD"));
-          else 
+          else
             aMenu->addAction(action("ACTIVATE_PART_CMD"));
         } else if (aFeature) {
           aMenu->addAction(action("EDIT_CMD"));
@@ -124,18 +124,21 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
           else
             aMenu->addAction(action("SHOW_CMD"));
         }
-      } else { // If feature is 0 the it means that selected root object (document)
-        if (aMgr->currentDocument() != aMgr->rootDocument()) 
+      } else {  // If feature is 0 the it means that selected root object (document)
+        if (aMgr->currentDocument() != aMgr->rootDocument())
           aMenu->addAction(action("ACTIVATE_PART_CMD"));
       }
     } else if (aSelected >= 1) {
       bool hasResult = false;
       bool hasFeature = false;
-      foreach(ObjectPtr aObj, aObjects) {
+      foreach(ObjectPtr aObj, aObjects)
+      {
         FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
         ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
-        if (aResult) hasResult = true;
-        if (aFeature) hasFeature = true;
+        if (aResult)
+          hasResult = true;
+        if (aFeature)
+          hasFeature = true;
         if (hasFeature && hasResult)
           break;
       }
@@ -174,7 +177,8 @@ void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const
     //if (aObjects.size() == 1)
     //  theMenu->addAction(action("EDIT_CMD"));
     bool isVisible = false;
-    foreach(ObjectPtr aObject, aObjects) {
+    foreach(ObjectPtr aObject, aObjects)
+    {
       ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObject);
       if (aRes && myWorkshop->displayer()->isVisible(aRes)) {
         isVisible = true;
@@ -183,7 +187,7 @@ void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const
     }
     if (isVisible)
       theMenu->addAction(action("HIDE_CMD"));
-    else 
+    else
       theMenu->addAction(action("SHOW_CMD"));
     //theMenu->addAction(action("DELETE_CMD"));
   }
@@ -198,13 +202,13 @@ void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const
 
 void XGUI_ContextMenuMgr::connectObjectBrowser() const
 {
-  connect(myWorkshop->objectBrowser(), SIGNAL(contextMenuRequested(QContextMenuEvent*)), 
-    this, SLOT(onContextMenuRequest(QContextMenuEvent*)));
+  connect(myWorkshop->objectBrowser(), SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
+          SLOT(onContextMenuRequest(QContextMenuEvent*)));
 }
 
 void XGUI_ContextMenuMgr::connectViewer() const
 {
-  connect(myWorkshop->viewer(), SIGNAL(contextMenuRequested(QContextMenuEvent*)), 
-    this, SLOT(onContextMenuRequest(QContextMenuEvent*)));
+  connect(myWorkshop->viewer(), SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
+          SLOT(onContextMenuRequest(QContextMenuEvent*)));
 }
 
index a48bd79c770d442bab75cf086aa5a2d108f73b44..64c846b18e2bd1aababd9f6da27b7438b613d69a 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifndef XGUI_ContextMenuMgr_H
 #define XGUI_ContextMenuMgr_H
 
@@ -13,12 +12,12 @@ class QContextMenuEvent;
 class QMenu;
 
 /**
-* A claas wihich provides manement of context menu
-*/
-class XGUI_EXPORT XGUI_ContextMenuMgr: public QObject
+ * A claas wihich provides manement of context menu
+ */
+class XGUI_EXPORT XGUI_ContextMenuMgr : public QObject
 {
 Q_OBJECT
-public:
+ public:
   XGUI_ContextMenuMgr(XGUI_Workshop* theParent);
   virtual ~XGUI_ContextMenuMgr();
 
@@ -46,20 +45,19 @@ public:
 signals:
   void actionTriggered(const QString& theId, bool isChecked);
 
-private slots:
+ private slots:
   void onAction(bool isChecked);
 
   void onContextMenuRequest(QContextMenuEvent* theEvent);
 
-private:
+ private:
   /** 
-  * Add action
-  * \param theId - string ID of the item
-  * \param theAction - action to add
-  */
+   * Add action
+   * \param theId - string ID of the item
+   * \param theAction - action to add
+   */
   void addAction(const QString& theId, QAction* theAction);
 
-
   QMenu* objectBrowserMenu() const;
   QMenu* viewerMenu() const;
 
@@ -68,4 +66,4 @@ private:
   XGUI_Workshop* myWorkshop;
 };
 
-#endif
\ No newline at end of file
+#endif
index 0b8844e2f494414f3874424e701b3c5ccadd1fe7..075c1e1621ea41928eb8873e23ec8177e6d2d60d 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifndef XGUI_DataTreeModel_H
 #define XGUI_DataTreeModel_H
 
  */
 class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel
 {
-public:
-  XGUI_FeaturesModel(QObject* theParent):
-      QAbstractItemModel(theParent), myItemsColor(Qt::black) {}
+ public:
+  XGUI_FeaturesModel(QObject* theParent)
+      : QAbstractItemModel(theParent),
+        myItemsColor(Qt::black)
+  {
+  }
 
   //! Returns Feature object by the given Model index.
   //! Returns 0 if the given index is not index of a feature
@@ -36,26 +38,36 @@ public:
   //! Returns index corresponded to the group
   virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
 
-  void setItemsColor(const QColor& theColor) { myItemsColor = theColor; }
+  void setItemsColor(const QColor& theColor)
+  {
+    myItemsColor = theColor;
+  }
 
-  QColor itemsColor() const { return myItemsColor; }
+  QColor itemsColor() const
+  {
+    return myItemsColor;
+  }
 
-protected:
+ protected:
   QColor myItemsColor;
 };
 
-
 /**\class XGUI_PartModel
  * \ingroup GUI
  * \brief Abstaract class of model object which operates with parts data.
  */
 class XGUI_PartModel : public XGUI_FeaturesModel
 {
-public:
-  XGUI_PartModel(QObject* theParent):
-      XGUI_FeaturesModel(theParent) {}
+ public:
+  XGUI_PartModel(QObject* theParent)
+      : XGUI_FeaturesModel(theParent)
+  {
+  }
 
-  void setPartId(int theId) { myId = theId; }
+  void setPartId(int theId)
+  {
+    myId = theId;
+  }
 
   //! Returns true if the given document is a sub-document of this tree
   virtual bool hasDocument(const DocumentPtr& theDoc) const = 0;
@@ -63,10 +75,9 @@ public:
   //! Return a Part object
   virtual ResultPartPtr part() const = 0;
 
-protected:
+ protected:
   //! Id of the current part object in the document
   int myId;
 };
 
-
-#endif
\ No newline at end of file
+#endif
index 62c735ce71e89d1e546a6d5802831bd602a071c3..57befeb24cb8958c3aac8acd0b1f935a1452cf8d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <set>
 
-const int MOUSE_SENSITIVITY_IN_PIXEL = 10; ///< defines the local context mouse selection sensitivity
+const int MOUSE_SENSITIVITY_IN_PIXEL = 10;  ///< defines the local context mouse selection sensitivity
 
 XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
 {
@@ -66,8 +66,8 @@ void XGUI_Displayer::display(ObjectPtr theObject, bool isUpdateViewer)
   }
 }
 
-void XGUI_Displayer::display(ObjectPtr theObject,
-                             boost::shared_ptr<GeomAPI_AISObject> theAIS, bool isUpdateViewer)
+void XGUI_Displayer::display(ObjectPtr theObject, boost::shared_ptr<GeomAPI_AISObject> theAIS,
+                             bool isUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
 
@@ -78,15 +78,14 @@ void XGUI_Displayer::display(ObjectPtr theObject,
   }
 }
 
-
-
 void XGUI_Displayer::erase(ObjectPtr theObject, const bool isUpdateViewer)
 {
-  if (!isVisible(theObject)) return;
+  if (!isVisible(theObject))
+    return;
 
   Handle(AIS_InteractiveContext) aContext = AISContext();
   boost::shared_ptr<GeomAPI_AISObject> anObject = myResult2AISObjectMap[theObject];
-  if (anObject)  {
+  if (anObject) {
     Handle(AIS_InteractiveObject) anAIS = anObject->impl<Handle(AIS_InteractiveObject)>();
     if (!anAIS.IsNull()) {
       aContext->Remove(anAIS, isUpdateViewer);
@@ -95,36 +94,35 @@ void XGUI_Displayer::erase(ObjectPtr theObject, const bool isUpdateViewer)
   myResult2AISObjectMap.erase(theObject);
 }
 
-
 /*bool XGUI_Displayer::redisplay(ObjectPtr theObject,
                              boost::shared_ptr<GeomAPI_AISObject> theAIS,
                              const bool isUpdateViewer)
-{
 bool isCreated = false;
 Handle(AIS_InteractiveObject) anAIS = 
   theAIS ? theAIS->impl<Handle(AIS_InteractiveObject)>() : Handle(AIS_InteractiveObject)();
 Handle(AIS_InteractiveContext) aContext = AISContext();
 // Open local context if there is no one
 if (!aContext->HasOpenedContext()) {
   aContext->ClearCurrents(false);
   aContext->OpenLocalContext(false /use displayed objects/, true /allow shape decomposition/);
   // set mouse sensitivity
   //aContext->SetSensitivityMode(StdSelect_SM_WINDOW);
   //aContext->SetPixelTolerance(MOUSE_SENSITIVITY_IN_PIXEL);
 }
 // display or redisplay presentation
 boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theObject];
 if (isVisible(theObject) && anObj && !anObj->empty()) {
   aContext->Redisplay(anAIS, isUpdateViewer);
   //aContext->RecomputeSelectionOnly(anAIS);
 }
 else {
   myResult2AISObjectMap[theObject] = theAIS;
   aContext->Display(anAIS, isUpdateViewer);
   isCreated = true;
 }
 return isCreated;
-}*/
+ boost::shared_ptr<GeomAPI_AISObject> theAIS,
+ const bool isUpdateViewer)
+ {
+ bool isCreated = false;
+ Handle(AIS_InteractiveObject) anAIS = 
+ theAIS ? theAIS->impl<Handle(AIS_InteractiveObject)>() : Handle(AIS_InteractiveObject)();
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+ // Open local context if there is no one
+ if (!aContext->HasOpenedContext()) {
+ aContext->ClearCurrents(false);
+ aContext->OpenLocalContext(false /use displayed objects/, true /allow shape decomposition/);
+ // set mouse sensitivity
+ //aContext->SetSensitivityMode(StdSelect_SM_WINDOW);
+ //aContext->SetPixelTolerance(MOUSE_SENSITIVITY_IN_PIXEL);
+ }
+ // display or redisplay presentation
+ boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theObject];
+ if (isVisible(theObject) && anObj && !anObj->empty()) {
+ aContext->Redisplay(anAIS, isUpdateViewer);
+ //aContext->RecomputeSelectionOnly(anAIS);
+ }
+ else {
+ myResult2AISObjectMap[theObject] = theAIS;
+ aContext->Display(anAIS, isUpdateViewer);
+ isCreated = true;
+ }
+ return isCreated;
+ }*/
 
 void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
 {
@@ -146,7 +144,8 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
     if (aResult) {
       boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
       if (aShapePtr) {
-        Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(aAISObj->impl<Handle(AIS_InteractiveObject)>());
+        Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(
+            aAISObj->impl<Handle(AIS_InteractiveObject)>());
         if (!aAISShape.IsNull()) {
           aAISShape->Set(aShapePtr->impl<TopoDS_Shape>());
           aAISIO = aAISShape;
@@ -163,8 +162,8 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
   }
 }
 
-void XGUI_Displayer::activateInLocalContext(ObjectPtr theResult,
-                                         const std::list<int>& theModes, const bool isUpdateViewer)
+void XGUI_Displayer::activateInLocalContext(ObjectPtr theResult, const std::list<int>& theModes,
+                                            const bool isUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
   // Open local context if there is no one
@@ -182,7 +181,7 @@ void XGUI_Displayer::activateInLocalContext(ObjectPtr theResult,
 
   // Activate selection of objects from prs
   if (!anAIS.IsNull()) {
-    aContext->ClearSelected(false); // ToCheck
+    aContext->ClearSelected(false);  // ToCheck
     //aContext->upClearSelected(false); // ToCheck
     aContext->Load(anAIS, -1, true/*allow decomposition*/);
     aContext->Deactivate(anAIS);
@@ -202,9 +201,9 @@ void XGUI_Displayer::deactivate(ObjectPtr theObject)
   if (isVisible(theObject)) {
     Handle(AIS_InteractiveContext) aContext = AISContext();
 
-     boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theObject];
-     Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
-     aContext->Deactivate(anAIS);
+    boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theObject];
+    Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
+    aContext->Deactivate(anAIS);
   }
 }
 
@@ -213,9 +212,9 @@ void XGUI_Displayer::activate(ObjectPtr theObject)
   if (isVisible(theObject)) {
     Handle(AIS_InteractiveContext) aContext = AISContext();
 
-     boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theObject];
-     Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
-     aContext->Activate(anAIS);
+    boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theObject];
+    Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
+    aContext->Activate(anAIS);
   }
 }
 
@@ -230,18 +229,22 @@ void XGUI_Displayer::stopSelection(const QList<ObjectPtr>& theResults, const boo
   for (; anIt != aLast; anIt++) {
     aFeature = *anIt;
     if (isVisible(aFeature))
-      anAIS = Handle(AIS_Shape)::DownCast(myResult2AISObjectMap[aFeature]->impl<Handle(AIS_InteractiveObject)>());
+      anAIS = Handle(AIS_Shape)::DownCast(
+          myResult2AISObjectMap[aFeature]->impl<Handle(AIS_InteractiveObject)>());
     if (anAIS.IsNull())
       continue;
 
     if (isStop) {
       QColor aColor(Qt::white);
-      anAIS->SetColor(Quantity_Color(aColor.red()/255., aColor.green()/255., aColor.blue()/255., Quantity_TOC_RGB));
+      anAIS->SetColor(
+          Quantity_Color(aColor.red() / 255., aColor.green() / 255., aColor.blue() / 255.,
+                         Quantity_TOC_RGB));
       anAIS->Redisplay();
-    }
-    else {
+    } else {
       QColor aColor(Qt::red);
-      anAIS->SetColor(Quantity_Color(aColor.red()/255., aColor.green()/255., aColor.blue()/255., Quantity_TOC_RGB));
+      anAIS->SetColor(
+          Quantity_Color(aColor.red() / 255., aColor.green() / 255., aColor.blue() / 255.,
+                         Quantity_TOC_RGB));
       anAIS->Redisplay();
     }
   }
@@ -259,8 +262,9 @@ void XGUI_Displayer::setSelected(const QList<ObjectPtr>& theResults, const bool
     aLocalContext->UnhilightLastDetected(myWorkshop->viewer()->activeView());
 
   aContext->ClearSelected();
-  foreach(ObjectPtr aResult, theResults) {
-    if (myResult2AISObjectMap.find(aResult) == myResult2AISObjectMap.end()) 
+  foreach(ObjectPtr aResult, theResults)
+  {
+    if (myResult2AISObjectMap.find(aResult) == myResult2AISObjectMap.end())
       continue;
 
     boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[aResult];
@@ -274,40 +278,39 @@ void XGUI_Displayer::setSelected(const QList<ObjectPtr>& theResults, const bool
     updateViewer();
 }
 
-
 /*void XGUI_Displayer::EraseAll(const bool isUpdateViewer)
-{
 Handle(AIS_InteractiveContext) ic = AISContext();
-
 AIS_ListOfInteractive aList;
 ic->DisplayedObjects(aList);
 AIS_ListIteratorOfListOfInteractive anIter(aList);
 for (; anIter.More(); anIter.Next()) {
   if ((anIter.Value()->DynamicType() == STANDARD_TYPE(AIS_Trihedron)))
     continue;
-
   // erase an object
   Handle(AIS_InteractiveObject) anIO = anIter.Value();
   ic->Erase(anIO, false);
 }
 myResult2AISObjectMap.clear();
 if (isUpdateViewer)
   updateViewer();
-}*/
+ {
+ Handle(AIS_InteractiveContext) ic = AISContext();
+
+ AIS_ListOfInteractive aList;
+ ic->DisplayedObjects(aList);
+ AIS_ListIteratorOfListOfInteractive anIter(aList);
+ for (; anIter.More(); anIter.Next()) {
+ if ((anIter.Value()->DynamicType() == STANDARD_TYPE(AIS_Trihedron)))
+ continue;
+
+ // erase an object
+ Handle(AIS_InteractiveObject) anIO = anIter.Value();
+ ic->Erase(anIO, false);
+ }
+ myResult2AISObjectMap.clear();
+ if (isUpdateViewer)
+ updateViewer();
+ }*/
 
 void XGUI_Displayer::eraseDeletedResults(const bool isUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
 
-  ResultToAISMap::const_iterator aFIt = myResult2AISObjectMap.begin(),
-                                 aFLast = myResult2AISObjectMap.end();
+  ResultToAISMap::const_iterator aFIt = myResult2AISObjectMap.begin(), aFLast =
+      myResult2AISObjectMap.end();
   std::list<ObjectPtr> aRemoved;
-  for (; aFIt != aFLast; aFIt++)
-  {
+  for (; aFIt != aFLast; aFIt++) {
     ObjectPtr aFeature = (*aFIt).first;
     if (!aFeature || !aFeature->data() || !aFeature->data()->isValid()) {
       boost::shared_ptr<GeomAPI_AISObject> anObj = (*aFIt).second;
-      if (!anObj) continue;
+      if (!anObj)
+        continue;
       Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
       if (!anAIS.IsNull()) {
         aContext->Remove(anAIS, false);
@@ -315,8 +318,7 @@ void XGUI_Displayer::eraseDeletedResults(const bool isUpdateViewer)
       }
     }
   }
-  std::list<ObjectPtr>::const_iterator anIt = aRemoved.begin(),
-                                                                 aLast = aRemoved.end();
+  std::list<ObjectPtr>::const_iterator anIt = aRemoved.begin(), aLast = aRemoved.end();
   for (; anIt != aLast; anIt++) {
     myResult2AISObjectMap.erase(myResult2AISObjectMap.find(*anIt));
   }
@@ -341,11 +343,12 @@ boost::shared_ptr<GeomAPI_AISObject> XGUI_Displayer::getAISObject(ObjectPtr theO
 ObjectPtr XGUI_Displayer::getObject(Handle(AIS_InteractiveObject) theIO) const
 {
   ObjectPtr aFeature;
-  ResultToAISMap::const_iterator aFIt = myResult2AISObjectMap.begin(),
-                                 aFLast = myResult2AISObjectMap.end();
+  ResultToAISMap::const_iterator aFIt = myResult2AISObjectMap.begin(), aFLast =
+      myResult2AISObjectMap.end();
   for (; aFIt != aFLast && !aFeature; aFIt++) {
     boost::shared_ptr<GeomAPI_AISObject> anObj = (*aFIt).second;
-    if (!anObj) continue;
+    if (!anObj)
+      continue;
     Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
     if (anAIS != theIO)
       continue;
@@ -371,12 +374,11 @@ void XGUI_Displayer::updateViewer()
     ic->UpdateCurrentViewer();
 }
 
-Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const 
-{ 
-  return myWorkshop->viewer()->AISContext(); 
+Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const
+{
+  return myWorkshop->viewer()->AISContext();
 }
 
-
 void XGUI_Displayer::display(boost::shared_ptr<GeomAPI_AISObject> theAIS, bool isUpdate)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
index ebbfad740e3d8af48abea97a51b512ed638236f8..ef3a3308db2a6c046469782c7d27c50e25a80595 100644 (file)
@@ -36,7 +36,7 @@ class XGUI_Workshop;
  */
 class XGUI_EXPORT XGUI_Displayer
 {
-public:
+ public:
   /// Constructor
   /// \param theViewer the viewer
   XGUI_Displayer(XGUI_Workshop* theWorkshop);
@@ -70,8 +70,8 @@ public:
   /// \param theShape a shape
   /// \param theMode a list of local selection modes
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
-  void activateInLocalContext(ObjectPtr theFeature,
-                              const std::list<int>& theModes, const bool isUpdateViewer = true);
+  void activateInLocalContext(ObjectPtr theFeature, const std::list<int>& theModes,
+                              const bool isUpdateViewer = true);
 
   /// Stop the current selection and color the given features to the selection color
   /// \param theFeatures a list of features to be disabled
@@ -81,10 +81,10 @@ public:
                      const bool isUpdateViewer);
 
   /**
-  * Add presentations which corresponds to the given features to current selection
-  * \param theFeatures a list of features to be selected
-  * isUpdateViewer the parameter whether the viewer should be update immediatelly
-  */
+   * Add presentations which corresponds to the given features to current selection
+   * \param theFeatures a list of features to be selected
+   * isUpdateViewer the parameter whether the viewer should be update immediatelly
+   */
   void setSelected(const QList<ObjectPtr>& theFeatures, bool isUpdateViewer = true);
 
   /// Erase the feature and a shape.
@@ -124,7 +124,7 @@ public:
 
   void activate(ObjectPtr theFeature);
 
-protected:
+ protected:
   /// Deactivate local selection
   /// \param isUpdateViewer the state wether the viewer should be updated immediatelly
   void closeAllContexts(const bool isUpdateViewer);
@@ -137,8 +137,9 @@ protected:
   /// \param theAIS AIS presentation
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
   /// Returns true if the Feature succesfully displayed
-  void display(ObjectPtr theObject, boost::shared_ptr<GeomAPI_AISObject> theAIS, bool isUpdateViewer = true);
-  
+  void display(ObjectPtr theObject, boost::shared_ptr<GeomAPI_AISObject> theAIS,
+               bool isUpdateViewer = true);
+
   /// Display the shape and activate selection of sub-shapes
   /// \param theFeature a feature instance
   /// \param theAIS an AIS object
@@ -149,17 +150,16 @@ protected:
   //               const bool isUpdateViewer = true);
 
   /** Redisplay the shape if it was displayed
-  * \param theFeature a feature instance
-  * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
-  */
+   * \param theFeature a feature instance
+   * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+   */
   void redisplay(ObjectPtr theObject, bool isUpdateViewer = true);
 
-protected:
+ protected:
   XGUI_Workshop* myWorkshop;
 
   typedef std::map<ObjectPtr, boost::shared_ptr<GeomAPI_AISObject> > ResultToAISMap;
   ResultToAISMap myResult2AISObjectMap;
 };
 
-
 #endif
index 6082e445bb56df332252a752caa11c14477e13dd..17dfe99b9a58375909ba875c4f7162583c0f4657 100644 (file)
@@ -25,7 +25,8 @@
 #define PASSIVE_COLOR Qt::black
 
 XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent)
-  : QAbstractItemModel(theParent), myActivePart(0)
+    : QAbstractItemModel(theParent),
+      myActivePart(0)
 {
   // Register in event loop
   Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
@@ -37,20 +38,19 @@ XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent)
   myModel->setItemsColor(ACTIVE_COLOR);
 }
 
-
 XGUI_DocumentDataModel::~XGUI_DocumentDataModel()
 {
   clearModelIndexes();
 }
 
-
 void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage)
 {
   DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
 
   // Created object event *******************
   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
-    const ModelAPI_ObjectUpdatedMessage* aUpdMsg = dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+    const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
+        dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
     std::set<ObjectPtr> aObjects = aUpdMsg->objects();
 
     std::set<ObjectPtr>::const_iterator aIt;
@@ -62,21 +62,22 @@ void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage)
 
       DocumentPtr aDoc = aObject->document();
       if (aDoc == aRootDoc) {  // If root objects
-        if (aObject->groupName() == ModelAPI_ResultPart::group()) { // Update only Parts group
-          // Add a new part
+        if (aObject->groupName() == ModelAPI_ResultPart::group()) {  // Update only Parts group
+            // Add a new part
           int aStart = myPartModels.size();
           XGUI_PartDataModel* aModel = new XGUI_PartDataModel(this);
           aModel->setPartId(myPartModels.count());
           myPartModels.append(aModel);
           insertRow(aStart, partFolderNode());
-        } else { // Update top groups (other except parts
+        } else {  // Update top groups (other except parts
           QModelIndex aIndex = myModel->findParent(aObject);
           int aStart = myModel->rowCount(aIndex) - 1;
-          if (aStart < 0) aStart = 0;
-          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
+          if (aStart < 0)
+            aStart = 0;
+          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
           insertRow(aStart, aIndex);
         }
-      } else { // if sub-objects of first level nodes
+      } else {  // if sub-objects of first level nodes
         XGUI_PartModel* aPartModel = 0;
         QList<XGUI_PartModel*>::const_iterator aIt;
         for (aIt = myPartModels.constBegin(); aIt != myPartModels.constEnd(); ++aIt) {
@@ -87,15 +88,16 @@ void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage)
         }
         if (aPartModel) {
           QModelIndex aIndex = aPartModel->findParent(aObject);
-          int aStart = aPartModel->rowCount(aIndex); // check this index
-          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
+          int aStart = aPartModel->rowCount(aIndex);  // check this index
+          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
           insertRow(aStart, aIndex);
         }
       }
     }
-  // Deleted object event ***********************
+    // Deleted object event ***********************
   } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
-    const ModelAPI_ObjectDeletedMessage* aUpdMsg = dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
+    const ModelAPI_ObjectDeletedMessage* aUpdMsg =
+        dynamic_cast<const ModelAPI_ObjectDeletedMessage*>(theMessage);
     DocumentPtr aDoc = aUpdMsg->document();
     std::set<std::string> aGroups = aUpdMsg->groups();
 
@@ -103,7 +105,7 @@ void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage)
     for (aIt = aGroups.begin(); aIt != aGroups.end(); ++aIt) {
       std::string aGroup = (*aIt);
       if (aDoc == aRootDoc) {  // If root objects
-        if (aGroup == ModelAPI_ResultPart::group()) { // Update only Parts group
+        if (aGroup == ModelAPI_ResultPart::group()) {  // Update only Parts group
           int aStart = myPartModels.size() - 1;
           removeSubModel(aStart);
           removeRow(aStart, partFolderNode());
@@ -112,10 +114,10 @@ void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage)
             myActivePartIndex = QModelIndex();
             myModel->setItemsColor(ACTIVE_COLOR);
           }
-        } else { // Update top groups (other except parts
+        } else {  // Update top groups (other except parts
           QModelIndex aIndex = myModel->findGroup(aGroup);
           int aStart = myModel->rowCount(aIndex);
-          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
+          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
           removeRow(aStart, aIndex);
         }
       } else {
@@ -130,23 +132,23 @@ void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage)
         if (aPartModel) {
           QModelIndex aIndex = aPartModel->findGroup(aGroup);
           int aStart = aPartModel->rowCount(aIndex);
-          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
+          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
           removeRow(aStart, aIndex);
         }
       }
     }
-  // Deleted object event ***********************
+    // Deleted object event ***********************
   } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
     //const ModelAPI_ObjectUpdatedMessage* aUpdMsg = dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
     //ObjectPtr aFeature = aUpdMsg->feature();
     //DocumentPtr aDoc = aFeature->document();
-    
+
     // TODO: Identify the necessary index by the modified feature
     QModelIndex aIndex;
     emit dataChanged(aIndex, aIndex);
 
-  // Reset whole tree **************************
-  } else {  
+    // Reset whole tree **************************
+  } else {
     rebuildDataTree();
   }
 }
@@ -159,7 +161,7 @@ void XGUI_DocumentDataModel::rebuildDataTree()
   clearModelIndexes();
 
   int aNbParts = aRootDoc->size(ModelAPI_ResultPart::group());
-  if (myPartModels.size() != aNbParts) { // resize internal models
+  if (myPartModels.size() != aNbParts) {  // resize internal models
     while (myPartModels.size() > aNbParts) {
       delete myPartModels.last();
       myPartModels.removeLast();
@@ -178,52 +180,52 @@ QVariant XGUI_DocumentDataModel::data(const QModelIndex& theIndex, int theRole)
   if (!theIndex.isValid())
     return QVariant();
   switch (theIndex.internalId()) {
-  case PartsFolder:
-    switch (theRole) {
-    case Qt::DisplayRole:
-      return tr("Parts") + QString(" (%1)").arg(rowCount(theIndex));
-    case Qt::DecorationRole:
-      return QIcon(":pictures/constr_folder.png");
-    case Qt::ToolTipRole:
-      return tr("Parts folder");
-    case Qt::ForegroundRole:
-      if (myActivePart)
-        return QBrush(PASSIVE_COLOR);
-      else
-        return QBrush(ACTIVE_COLOR);
-    default:
-      return QVariant();
-    }
-    break;
-  case HistoryNode:
-    {
-      int aOffset = historyOffset();
-      DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-      ObjectPtr aObj = aRootDoc->object(ModelAPI_Feature::group(), theIndex.row() - aOffset);
-      FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
-      if (!aFeature)
-        return QVariant();
+    case PartsFolder:
       switch (theRole) {
-      case Qt::DisplayRole:
-        if (aFeature)
-          return aFeature->data()->name().c_str();
-        else 
-          return QVariant();
-      case Qt::DecorationRole:
-        return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
-      case Qt::ToolTipRole:
-        return tr("Feature object");
-      case Qt::ForegroundRole:
-        if (myActivePart)
-          return QBrush(PASSIVE_COLOR);
-        else
-          return QBrush(ACTIVE_COLOR);
-      default:
-        return QVariant();
-      }
-    }
-    break;
-  }
+        case Qt::DisplayRole:
+          return tr("Parts") + QString(" (%1)").arg(rowCount(theIndex));
+        case Qt::DecorationRole:
+          return QIcon(":pictures/constr_folder.png");
+        case Qt::ToolTipRole:
+          return tr("Parts folder");
+        case Qt::ForegroundRole:
+          if (myActivePart)
+            return QBrush(PASSIVE_COLOR);
+            else
+            return QBrush(ACTIVE_COLOR);
+            default:
+            return QVariant();
+          }
+          break;
+          case HistoryNode:
+          {
+            int aOffset = historyOffset();
+            DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
+            ObjectPtr aObj = aRootDoc->object(ModelAPI_Feature::group(), theIndex.row() - aOffset);
+            FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+            if (!aFeature)
+            return QVariant();
+            switch (theRole) {
+              case Qt::DisplayRole:
+              if (aFeature)
+              return aFeature->data()->name().c_str();
+              else
+              return QVariant();
+              case Qt::DecorationRole:
+              return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
+              case Qt::ToolTipRole:
+              return tr("Feature object");
+              case Qt::ForegroundRole:
+              if (myActivePart)
+              return QBrush(PASSIVE_COLOR);
+              else
+              return QBrush(ACTIVE_COLOR);
+              default:
+              return QVariant();
+            }
+          }
+          break;
+        }
   QModelIndex aParent = theIndex.parent();
   if (aParent.isValid() && (aParent.internalId() == PartsFolder)) {
     return myPartModels.at(theIndex.row())->data(QModelIndex(), theRole);
@@ -231,8 +233,8 @@ QVariant XGUI_DocumentDataModel::data(const QModelIndex& theIndex, int theRole)
   return toSourceModelIndex(theIndex)->data(theRole);
 }
 
-
-QVariant XGUI_DocumentDataModel::headerData(int theSection, Qt::Orientation theOrient, int theRole) const
+QVariant XGUI_DocumentDataModel::headerData(int theSection, Qt::Orientation theOrient,
+                                            int theRole) const
 {
   return QVariant();
 }
@@ -256,13 +258,13 @@ int XGUI_DocumentDataModel::rowCount(const QModelIndex& theParent) const
   }
   QModelIndex* aParent = toSourceModelIndex(theParent);
   const QAbstractItemModel* aModel = aParent->model();
-  if (!isSubModel(aModel)) 
+  if (!isSubModel(aModel))
     return 0;
 
   /*if (isPartSubModel(aModel)) {
-    if (aModel != myActivePart)
-      return 0;
-  }*/
+   if (aModel != myActivePart)
+   return 0;
+   }*/
   return aModel->rowCount(*aParent);
 }
 
@@ -271,33 +273,34 @@ int XGUI_DocumentDataModel::columnCount(const QModelIndex& theParent) const
   return 1;
 }
 
-QModelIndex XGUI_DocumentDataModel::index(int theRow, int theColumn, const QModelIndex& theParent) const
+QModelIndex XGUI_DocumentDataModel::index(int theRow, int theColumn,
+                                          const QModelIndex& theParent) const
 {
   QModelIndex aIndex;
   if (!theParent.isValid()) {
     int aOffs = myModel->rowCount();
     if (theRow < aOffs) {
       aIndex = myModel->index(theRow, theColumn, theParent);
-      aIndex = createIndex(theRow, theColumn, (void*)getModelIndex(aIndex));
+      aIndex = createIndex(theRow, theColumn, (void*) getModelIndex(aIndex));
     } else {
       if (theRow == aOffs)  // Create Parts node
         aIndex = partFolderNode();
-      else // create history node
+      else
+        // create history node
         aIndex = createIndex(theRow, theColumn, HistoryNode);
     }
   } else {
     if (theParent.internalId() == PartsFolder) {
       aIndex = myPartModels.at(theRow)->index(0, theColumn, QModelIndex());
     } else {
-      QModelIndex* aParent = (QModelIndex*)theParent.internalPointer();
+      QModelIndex* aParent = (QModelIndex*) theParent.internalPointer();
       aIndex = aParent->model()->index(theRow, theColumn, (*aParent));
     }
-    aIndex = createIndex(theRow, theColumn, (void*)getModelIndex(aIndex));
+    aIndex = createIndex(theRow, theColumn, (void*) getModelIndex(aIndex));
   }
   return aIndex;
 }
 
-
 QModelIndex XGUI_DocumentDataModel::parent(const QModelIndex& theIndex) const
 {
   if ((theIndex.internalId() == PartsFolder) || (theIndex.internalId() == HistoryNode))
@@ -305,7 +308,7 @@ QModelIndex XGUI_DocumentDataModel::parent(const QModelIndex& theIndex) const
 
   QModelIndex* aIndex = toSourceModelIndex(theIndex);
   const QAbstractItemModel* aModel = aIndex->model();
-  if (!isSubModel(aModel)) 
+  if (!isSubModel(aModel))
     return QModelIndex();
 
   if (isPartSubModel(aModel)) {
@@ -316,11 +319,10 @@ QModelIndex XGUI_DocumentDataModel::parent(const QModelIndex& theIndex) const
 
   QModelIndex aIndex1 = aModel->parent(*aIndex);
   if (aIndex1.isValid())
-    return createIndex(aIndex1.row(), aIndex1.column(), (void*)getModelIndex(aIndex1));
+    return createIndex(aIndex1.row(), aIndex1.column(), (void*) getModelIndex(aIndex1));
   return aIndex1;
 }
 
-
 bool XGUI_DocumentDataModel::hasChildren(const QModelIndex& theParent) const
 {
   if (!theParent.isValid())
@@ -328,14 +330,12 @@ bool XGUI_DocumentDataModel::hasChildren(const QModelIndex& theParent) const
   return rowCount(theParent) > 0;
 }
 
-
 QModelIndex* XGUI_DocumentDataModel::toSourceModelIndex(const QModelIndex& theProxy) const
 {
   QModelIndex* aIndexPtr = static_cast<QModelIndex*>(theProxy.internalPointer());
   return aIndexPtr;
 }
 
-
 QModelIndex* XGUI_DocumentDataModel::findModelIndex(const QModelIndex& theIndex) const
 {
   QList<QModelIndex*>::const_iterator aIt;
@@ -361,7 +361,7 @@ QModelIndex* XGUI_DocumentDataModel::getModelIndex(const QModelIndex& theIndex)
 void XGUI_DocumentDataModel::clearModelIndexes()
 {
   QList<QModelIndex*>::const_iterator aIt;
-  for (aIt = myIndexes.constBegin(); aIt != myIndexes.constEnd(); ++aIt) 
+  for (aIt = myIndexes.constBegin(); aIt != myIndexes.constEnd(); ++aIt)
     delete (*aIt);
   myIndexes.clear();
 }
@@ -376,7 +376,7 @@ ObjectPtr XGUI_DocumentDataModel::object(const QModelIndex& theIndex) const
     return aRootDoc->object(ModelAPI_Feature::group(), theIndex.row() - aOffset);
   }
   QModelIndex* aIndex = toSourceModelIndex(theIndex);
-  if (!isSubModel(aIndex->model())) 
+  if (!isSubModel(aIndex->model()))
     return ObjectPtr();
 
   const XGUI_FeaturesModel* aModel = dynamic_cast<const XGUI_FeaturesModel*>(aIndex->model());
@@ -404,7 +404,6 @@ bool XGUI_DocumentDataModel::removeRows(int theRow, int theCount, const QModelIn
   return true;
 }
 
-
 void XGUI_DocumentDataModel::removeSubModel(int theModelId)
 {
   XGUI_PartModel* aModel = myPartModels.at(theModelId);
@@ -414,7 +413,7 @@ void XGUI_DocumentDataModel::removeSubModel(int theModelId)
       aToRemove.append(i);
   }
   int aId;
-  while(aToRemove.size() > 0) {
+  while (aToRemove.size() > 0) {
     aId = aToRemove.last();
     delete myIndexes.at(aId);
     myIndexes.removeAt(aId);
@@ -433,7 +432,7 @@ bool XGUI_DocumentDataModel::isSubModel(const QAbstractItemModel* theModel) cons
 
 bool XGUI_DocumentDataModel::isPartSubModel(const QAbstractItemModel* theModel) const
 {
-  return myPartModels.contains((XGUI_PartModel*)theModel);
+  return myPartModels.contains((XGUI_PartModel*) theModel);
 }
 
 QModelIndex XGUI_DocumentDataModel::partFolderNode() const
@@ -462,43 +461,44 @@ bool XGUI_DocumentDataModel::activatedIndex(const QModelIndex& theIndex)
   if (isPartSubModel(aModel)) {
     // if this is root node (Part item index)
     if (!aIndex->parent().isValid()) {
-      if (myActivePart) myActivePart->setItemsColor(PASSIVE_COLOR);
+      if (myActivePart)
+        myActivePart->setItemsColor(PASSIVE_COLOR);
+
+        if (myActivePart == aModel) {
+          myActivePart = 0;
+          myActivePartIndex = QModelIndex();
+        } else {
+          myActivePart = (XGUI_PartModel*)aModel;
+          myActivePartIndex = theIndex;
+        }
 
-      if (myActivePart == aModel) {
-        myActivePart = 0;
-        myActivePartIndex = QModelIndex();
-      } else {
-        myActivePart = (XGUI_PartModel*)aModel;
-        myActivePartIndex = theIndex;
+        if (myActivePart) {
+          myActivePart->setItemsColor(ACTIVE_COLOR);
+          myModel->setItemsColor(PASSIVE_COLOR);
+        } else
+        myModel->setItemsColor(ACTIVE_COLOR);
+        return true;
       }
-
-      if (myActivePart) {
-        myActivePart->setItemsColor(ACTIVE_COLOR);
-        myModel->setItemsColor(PASSIVE_COLOR);
-      } else 
-         myModel->setItemsColor(ACTIVE_COLOR);
-     return true;
     }
-  }
   return false;
 }
 
 ResultPartPtr XGUI_DocumentDataModel::activePart() const
 {
-  if (myActivePart) 
+  if (myActivePart)
     return myActivePart->part();
   return ResultPartPtr();
 }
 
-void XGUI_DocumentDataModel::deactivatePart() 
-{ 
-  if (myActivePart) 
+void XGUI_DocumentDataModel::deactivatePart()
+{
+  if (myActivePart)
     myActivePart->setItemsColor(PASSIVE_COLOR);
-  myActivePart = 0;
-  myActivePartIndex = QModelIndex();
-  myModel->setItemsColor(ACTIVE_COLOR);
-}
+    myActivePart = 0;
+    myActivePartIndex = QModelIndex();
+    myModel->setItemsColor(ACTIVE_COLOR);
+  }
+
 Qt::ItemFlags XGUI_DocumentDataModel::flags(const QModelIndex& theIndex) const
 {
   Qt::ItemFlags aFlags = QAbstractItemModel::flags(theIndex);
@@ -508,11 +508,12 @@ Qt::ItemFlags XGUI_DocumentDataModel::flags(const QModelIndex& theIndex) const
   return aFlags;
 }
 
-QModelIndex XGUI_DocumentDataModel::partIndex(const ResultPartPtr& theObject) const 
+QModelIndex XGUI_DocumentDataModel::partIndex(const ResultPartPtr& theObject) const
 {
   int aRow = -1;
   XGUI_PartModel* aModel = 0;
-  foreach (XGUI_PartModel* aPartModel, myPartModels) {
+  foreach (XGUI_PartModel* aPartModel, myPartModels)
+  {
     aRow++;
     if (aPartModel->part() == theObject) {
       aModel = aPartModel;
@@ -520,7 +521,7 @@ QModelIndex XGUI_DocumentDataModel::partIndex(const ResultPartPtr& theObject) co
     }
   }
   if (aModel) {
-    return createIndex(aRow, 0, (void*)getModelIndex(aModel->index(0, 0, QModelIndex())));
+    return createIndex(aRow, 0, (void*) getModelIndex(aModel->index(0, 0, QModelIndex())));
   }
   return QModelIndex();
 }
@@ -544,13 +545,15 @@ QModelIndex XGUI_DocumentDataModel::objectIndex(const ObjectPtr theObject) const
         return index(aId + historyOffset(), 0, QModelIndex());
     } else {
       QModelIndex aIndex = myModel->objectIndex(theObject);
-      return aIndex.isValid()? 
-        createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex)) :
-        QModelIndex();
+      return
+          aIndex.isValid() ?
+              createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex)) :
+              QModelIndex();
     }
   } else {
     XGUI_PartModel* aPartModel = 0;
-    foreach(XGUI_PartModel* aModel, myPartModels) {
+    foreach(XGUI_PartModel* aModel, myPartModels)
+    {
       if (aModel->hasDocument(aDoc)) {
         aPartModel = aModel;
         break;
@@ -558,9 +561,10 @@ QModelIndex XGUI_DocumentDataModel::objectIndex(const ObjectPtr theObject) const
     }
     if (aPartModel) {
       QModelIndex aIndex = aPartModel->objectIndex(theObject);
-      return aIndex.isValid()? 
-        createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex)) :
-        QModelIndex();
+      return
+          aIndex.isValid() ?
+              createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex)) :
+              QModelIndex();
     }
   }
   return QModelIndex();
index c49c6696535871e683459407e8214527a01de0a4..393ce6bbe3626a9d3c02baaf572b528c35c9a661 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifndef XGUI_DocumentDataModel_H
 #define XGUI_DocumentDataModel_H
 
@@ -22,9 +21,8 @@ class XGUI_TopDataModel;
  */
 class XGUI_EXPORT XGUI_DocumentDataModel : public QAbstractItemModel, public Events_Listener
 {
-  Q_OBJECT
-public:
-
+Q_OBJECT
+ public:
 
   XGUI_DocumentDataModel(QObject* theParent);
   virtual ~XGUI_DocumentDataModel();
@@ -32,16 +30,15 @@ public:
   // Event Listener method
   virtual void processEvent(const Events_Message* theMessage);
 
-
   virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
-  virtual QVariant headerData(int theSection, Qt::Orientation theOrient,
-                              int theRole = Qt::DisplayRole) const;
+  virtual QVariant headerData(int theSection, Qt::Orientation theOrient, int theRole =
+                                  Qt::DisplayRole) const;
 
   virtual int rowCount(const QModelIndex& theParent = QModelIndex()) const;
   virtual int columnCount(const QModelIndex& theParent = QModelIndex()) const;
 
-  virtual QModelIndex index(int theRow, int theColumn, 
-                            const QModelIndex &parent = QModelIndex()) const;
+  virtual QModelIndex index(int theRow, int theColumn, const QModelIndex &parent =
+                                QModelIndex()) const;
 
   virtual QModelIndex parent(const QModelIndex& theIndex) const;
 
@@ -71,17 +68,23 @@ public:
   ResultPartPtr activePart() const;
 
   //! Retrurns QModelIndex of active part
-  QModelIndex activePartIndex() const { return myActivePartIndex; }
+  QModelIndex activePartIndex() const
+  {
+    return myActivePartIndex;
+  }
 
   //! Deactivates a Part
   void deactivatePart();
 
   void rebuildDataTree();
 
-private:
-
-  enum {PartsFolder, HistoryNode};
+ private:
 
+  enum
+  {
+    PartsFolder,
+    HistoryNode
+  };
 
   //! Converts QModelIndex of this model to QModelIndex of a one of sub-models.
   QModelIndex* toSourceModelIndex(const QModelIndex& theProxy) const;
@@ -109,7 +112,6 @@ private:
 
   int historyOffset() const;
 
-
   //! Data model of top part of data tree (not parts object)
   XGUI_TopDataModel* myModel;
 
@@ -126,4 +128,4 @@ private:
 
 };
 
-#endif
\ No newline at end of file
+#endif
index c3608f606bc060cb83bb0b2c011264d871dd7d18..c6d2e90d6cce61add21db7e2263fe80c9fa1d2ed 100644 (file)
@@ -20,10 +20,10 @@ XGUI_ErrorDialog::XGUI_ErrorDialog(QWidget* parent)
   myErrorLog = new QTextEdit(this);
   myErrorLog->setReadOnly(true);
   aDlgLay->addWidget(myErrorLog);
-  QDialogButtonBox* aButtonBox =
-      new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this);
+  QDialogButtonBox* aButtonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal,
+                                                      this);
   aDlgLay->addWidget(aButtonBox);
-  aDlgLay->setContentsMargins(2,2,2,2);
+  aDlgLay->setContentsMargins(2, 2, 2, 2);
   aDlgLay->setSpacing(2);
   setLayout(aDlgLay);
   resize(420, 240);
@@ -56,7 +56,7 @@ void XGUI_ErrorDialog::addError(const QString& theError)
 {
   myErrors.append(theError);
   refresh();
-  if(!isVisible()) {
+  if (!isVisible()) {
     show();
     raise();
     activateWindow();
index 59de5059a20250adf750a256b7e99166d89a5467..20af808bb66a937466c26318dd7ae53daab89e0e 100644 (file)
 
 class QTextEdit;
 
-class XGUI_ErrorDialog: public QDialog
+class XGUI_ErrorDialog : public QDialog
 {
-  Q_OBJECT
-public:
-  XGUI_EXPORT XGUI_ErrorDialog(QWidget* parent);
-  XGUI_EXPORT virtual ~XGUI_ErrorDialog();
+Q_OBJECT
+ public:
+  XGUI_EXPORT XGUI_ErrorDialog(QWidget* parent);XGUI_EXPORT virtual ~XGUI_ErrorDialog();
 
-public slots:
-  XGUI_EXPORT void refresh();
-  XGUI_EXPORT void clear();
-  XGUI_EXPORT void addError(const QString&);
-  XGUI_EXPORT void removeError(const QString&);
+ public slots:
+  XGUI_EXPORT void refresh();XGUI_EXPORT void clear();XGUI_EXPORT void addError(const QString&);XGUI_EXPORT void removeError(
+      const QString&);
 
-private:
+ private:
   QTextEdit* myErrorLog;
   QStringList myErrors;
 };
index fb5fbce21c70dbad01c672d60799167ddc22b1cb..3002194871042bc4dd8fe5457e81b89c1d4d0940 100644 (file)
@@ -16,7 +16,8 @@
 #include <QTabBar>
 
 XGUI_MainMenu::XGUI_MainMenu(XGUI_MainWindow *parent)
-    : QWidget(parent), myDesktop(parent)
+    : QWidget(parent),
+      myDesktop(parent)
 {
   myGeneralPage = new XGUI_MenuGroupPanel(this);
   myGeneralPage->setObjectName("Default");
@@ -60,7 +61,6 @@ XGUI_Workbench* XGUI_MainMenu::findWorkbench(const QString& theObjName) const
   return myDesktop->findChild<XGUI_Workbench*>(theObjName);
 }
 
-
 bool XGUI_MainMenu::eventFilter(QObject *theWatched, QEvent *theEvent)
 {
   if (theWatched == myGeneralPage) {
@@ -81,12 +81,9 @@ void XGUI_MainMenu::insertConsole(QWidget* theConsole)
   aCloseTabButton->setFixedSize(16, 16);
   aCloseTabButton->setIcon(QIcon(":pictures/wnd_close.png"));
   aCloseTabButton->setFlat(true);
-  aTabBar->setTabButton(aConsoleTabId,
-                        QTabBar::RightSide,
-                        aCloseTabButton);
+  aTabBar->setTabButton(aConsoleTabId, QTabBar::RightSide, aCloseTabButton);
 
-  connect(aCloseTabButton, SIGNAL(clicked()),
-          myDesktop, SLOT(dockPythonConsole()));
+  connect(aCloseTabButton, SIGNAL(clicked()), myDesktop, SLOT(dockPythonConsole()));
 }
 
 void XGUI_MainMenu::removeConsole()
@@ -101,9 +98,11 @@ XGUI_Command* XGUI_MainMenu::feature(const QString& theId) const
   result = myGeneralPage->feature(theId);
   if (!result) {
     XGUI_Workbench* aWbn;
-    foreach (aWbn, myWorkbenches) {
+    foreach (aWbn, myWorkbenches)
+    {
       result = aWbn->feature(theId);
-      if (result) break;
+      if (result)
+        break;
     }
   }
   return result;
@@ -113,7 +112,8 @@ QList<XGUI_Command*> XGUI_MainMenu::features() const
 {
   QList<XGUI_Command*> aList = myGeneralPage->features();
   XGUI_Workbench* aWbn;
-  foreach (aWbn, myWorkbenches) {
+  foreach (aWbn, myWorkbenches)
+  {
     aList.append(aWbn->features());
   }
   return aList;
@@ -136,8 +136,8 @@ int XGUI_MainMenu::menuHeight() const
 int XGUI_MainMenu::menuItemRowsCount() const
 {
   const int kDefaultRowsCount = 3;
-  int aRowsCount = XGUI_Preferences::resourceMgr()->integerValue(
-    XGUI_Preferences::MENU_SECTION, "rows_number", kDefaultRowsCount);
+  int aRowsCount = XGUI_Preferences::resourceMgr()->integerValue(XGUI_Preferences::MENU_SECTION,
+                                                                 "rows_number", kDefaultRowsCount);
   return aRowsCount;
 }
 
index 4c3f0ec675cc2821cd6730120a0cef534cd7fd9a..50c19c8a985e6c2b6ccc54f0f16dbe6d407044b0 100644 (file)
@@ -22,11 +22,11 @@ class QEvent;
  * \ingroup GUI
  * \brief Class for creation of main menu (set of workbenches)
  */
-class XGUI_EXPORT XGUI_MainMenu: public QWidget
+class XGUI_EXPORT XGUI_MainMenu : public QWidget
 {
-  Q_OBJECT
+Q_OBJECT
 
-public:
+ public:
   XGUI_MainMenu(XGUI_MainWindow *parent);
   virtual ~XGUI_MainMenu();
 
@@ -34,10 +34,13 @@ public:
   XGUI_Workbench* addWorkbench(const QString& theId, const QString& theText = "");
 
   //! Returns workbench (menu group) by the given name.
-  XGUI_Workbench* findWorkbench(const QString& theId)  const;
+  XGUI_Workbench* findWorkbench(const QString& theId) const;
 
   //! Returns General page (predefined workbench)
-  XGUI_MenuGroupPanel* generalPage() const { return myGeneralPage; }
+  XGUI_MenuGroupPanel* generalPage() const
+  {
+    return myGeneralPage;
+  }
 
   //! Rerturns last created workbench in dock widget container
   //QDockWidget* getLastDockWindow() const;
@@ -66,7 +69,7 @@ public:
 
   void updateFromResources();
 
-private:
+ private:
   XGUI_MainWindow* myDesktop;
   QTabWidget* myMenuTabs;
   XGUI_MenuGroupPanel* myGeneralPage;
index 189f1cd35eabd4d9d0237bdca59133eebaf251dd..b1171dc64e1c02076b9f6984c2d87ffd62f725ff 100644 (file)
 #include <QCloseEvent>
 
 XGUI_MainWindow::XGUI_MainWindow(QWidget* parent)
-    : QMainWindow(parent), 
-    myPythonConsole(0)
+    : QMainWindow(parent),
+      myPythonConsole(0)
 {
   setWindowTitle(tr("New Geom"));
   createMainMenu();
   QMdiArea* aMdiArea = new QMdiArea(this);
   aMdiArea->setContextMenuPolicy(Qt::ActionsContextMenu);
   setCentralWidget(aMdiArea);
-  connect(aMdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), 
-          this, SLOT(onViewActivated(QMdiSubWindow*)));
+  connect(aMdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this,
+          SLOT(onViewActivated(QMdiSubWindow*)));
 
   // Create actions of MDI area
   QAction* aAction = new QAction(QIcon(":pictures/new_view.png"), tr("Create Window"), aMdiArea);
   aMdiArea->addAction(aAction);
   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(createSubWindow()));
-  
+
   aAction = new QAction(QIcon(":pictures/tile_views.png"), tr("Tile"), aMdiArea);
   aMdiArea->addAction(aAction);
   connect(aAction, SIGNAL(triggered(bool)), aMdiArea, SLOT(tileSubWindows()));
-  
+
   aAction = new QAction(QIcon(":pictures/cascade_views.png"), tr("Cascade"), aMdiArea);
   aMdiArea->addAction(aAction);
   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(cascadeWindows()));
@@ -46,10 +46,10 @@ XGUI_MainWindow::XGUI_MainWindow(QWidget* parent)
   aMdiArea->addAction(aAction);
 
   myViewer = new XGUI_Viewer(this);
-  connect(myViewer, SIGNAL(viewCreated(XGUI_ViewWindow*)), 
-          this, SLOT(onViewCreated(XGUI_ViewWindow*)));
-  connect(myViewer, SIGNAL(deleteView(XGUI_ViewWindow*)), 
-          this, SLOT(onDeleteView(XGUI_ViewWindow*)));
+  connect(myViewer, SIGNAL(viewCreated(XGUI_ViewWindow*)), this,
+          SLOT(onViewCreated(XGUI_ViewWindow*)));
+  connect(myViewer, SIGNAL(deleteView(XGUI_ViewWindow*)), this,
+          SLOT(onDeleteView(XGUI_ViewWindow*)));
 }
 
 XGUI_MainWindow::~XGUI_MainWindow(void)
@@ -88,19 +88,16 @@ void XGUI_MainWindow::dockPythonConsole()
     return;
   myMenuBar->removeConsole();
   QDockWidget* aDock = new QDockWidget(this);
-  aDock->setFeatures(QDockWidget::AllDockWidgetFeatures |
-                     QDockWidget::DockWidgetVerticalTitleBar);
-  aDock->setAllowedAreas(Qt::LeftDockWidgetArea  |
-                         Qt::RightDockWidgetArea |
-                         Qt::BottomDockWidgetArea);
+  aDock->setFeatures(QDockWidget::AllDockWidgetFeatures | QDockWidget::DockWidgetVerticalTitleBar);
+  aDock->setAllowedAreas(
+      Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
   aDock->setMinimumHeight(0);
   aDock->setWindowTitle("Console");
   aDock->setWidget(myPythonConsole);
   addDockWidget(Qt::BottomDockWidgetArea, aDock);
   // Undock python console if widget is closed...
-  CloseEventWatcher* aWatcher =  new CloseEventWatcher(aDock);
-  connect(aWatcher, SIGNAL(widgetClosed()),
-          this,     SLOT(undockPythonConsole()));
+  CloseEventWatcher* aWatcher = new CloseEventWatcher(aDock);
+  connect(aWatcher, SIGNAL(widgetClosed()), this, SLOT(undockPythonConsole()));
   aDock->installEventFilter(aWatcher);
 }
 
@@ -111,7 +108,7 @@ void XGUI_MainWindow::undockPythonConsole()
   QDockWidget* aDock = qobject_cast<QDockWidget*>(myPythonConsole->parentWidget());
   //When the application starts console will be displayed as
   //a wokbench tab, so there is no dock yet
-  if(aDock) {
+  if (aDock) {
     aDock->hide();
     aDock->setWidget(NULL);
     aDock->deleteLater();
@@ -130,7 +127,7 @@ void XGUI_MainWindow::cascadeWindows()
 {
   QMdiArea* aMdiArea = static_cast<QMdiArea*>(centralWidget());
   QList<QMdiSubWindow*> aWindows = aMdiArea->subWindowList();
-  
+
   QSize aSize = aMdiArea->size();
   QRect aRect = aMdiArea->geometry();
   const int aOffset = 30;
@@ -139,7 +136,8 @@ void XGUI_MainWindow::cascadeWindows()
   int w = aSize.width() / 2;
   int h = aSize.height() / 2;
   QMdiSubWindow* aLastWnd;
-  foreach(QMdiSubWindow* aWnd, aWindows) {
+  foreach(QMdiSubWindow* aWnd, aWindows)
+  {
     aWnd->showNormal();
     aWnd->raise();
     x = aOffset * i;
@@ -152,8 +150,7 @@ void XGUI_MainWindow::cascadeWindows()
       y = 0;
       j = 0;
     }
-    aWnd->setGeometry(QStyle::visualRect(aWnd->layoutDirection(), aRect, 
-      QRect(x, y, w, h)));
+    aWnd->setGeometry(QStyle::visualRect(aWnd->layoutDirection(), aRect, QRect(x, y, w, h)));
     i++;
     j++;
     viewer()->onWindowActivated(aWnd);
@@ -174,7 +171,8 @@ void XGUI_MainWindow::onViewCreated(XGUI_ViewWindow* theWindow)
   aMDIWidget->addAction(aAction);
 
   QList<QAction*> aActions = aMDIWidget->actions();
-  foreach(QAction* aAct, aActions) {
+  foreach(QAction* aAct, aActions)
+  {
     if (aAct->isCheckable())
       aAct->setChecked(false);
   }
@@ -189,7 +187,8 @@ void XGUI_MainWindow::onDeleteView(XGUI_ViewWindow* theWindow)
   QList<QAction*> aActions = aMDIWidget->actions();
 
   QAction* aDelAct = 0;
-  foreach(QAction* aAct, aActions) {
+  foreach(QAction* aAct, aActions)
+  {
     if (aAct->text() == aTitle) {
       aDelAct = aAct;
       break;
@@ -206,7 +205,8 @@ void XGUI_MainWindow::activateView()
 
   QList<QMdiSubWindow*> aWndList = aMdiArea->subWindowList();
   QMdiSubWindow* aTargetView = 0;
-  foreach(QMdiSubWindow* aWnd, aWndList) {
+  foreach(QMdiSubWindow* aWnd, aWndList)
+  {
     if (aWnd->windowTitle() == aWndTitle) {
       aWnd->raise();
       aWnd->activateWindow();
@@ -226,7 +226,8 @@ void XGUI_MainWindow::onViewActivated(QMdiSubWindow* theSubWnd)
   QMdiArea* aMdiArea = static_cast<QMdiArea*>(centralWidget());
   QString aWndTitle = theSubWnd->windowTitle();
   QList<QAction*> aActionList = aMdiArea->actions();
-  foreach(QAction* aAct, aActionList) {
+  foreach(QAction* aAct, aActionList)
+  {
     if (aAct->isCheckable())
       aAct->setChecked(aAct->text() == aWndTitle);
   }
@@ -251,9 +252,11 @@ void XGUI_MainWindow::createMainMenu()
 
 CloseEventWatcher::CloseEventWatcher(QObject* theParent)
     : QObject(theParent)
-{}
+{
+}
 
-bool CloseEventWatcher::eventFilter(QObject *obj, QEvent *event) {
+bool CloseEventWatcher::eventFilter(QObject *obj, QEvent *event)
+{
   if (event->type() == QEvent::Close) {
     emit widgetClosed();
     event->ignore();
index 293163d4a5ca5285d2aeedb3161e817343903943..a8a067cf6b17930e057a47bb0e1431cec987a00c 100644 (file)
@@ -18,11 +18,11 @@ class QCloseEvent;
  * \brief Main window of the application (Desktop).
  * It contains: Object Browser, 3d Viewer, Python console, property panel, main menu
  */
-class XGUI_EXPORT XGUI_MainWindow: public QMainWindow
+class XGUI_EXPORT XGUI_MainWindow : public QMainWindow
 {
 Q_OBJECT
 
-public:
+ public:
   XGUI_MainWindow(QWidget* parent = 0);
   virtual ~XGUI_MainWindow();
 
@@ -41,7 +41,7 @@ public:
     return myViewer;
   }
 
-public slots:
+ public slots:
   void showPythonConsole();
   void hidePythonConsole();
   //! Python console can be a dock widget 
@@ -50,8 +50,8 @@ public slots:
   void undockPythonConsole();
 
   void createSubWindow();
-  
-private slots:
+
+ private slots:
   void cascadeWindows();
   void onViewCreated(XGUI_ViewWindow* theWindow);
   void onDeleteView(XGUI_ViewWindow* theWindow);
@@ -61,24 +61,25 @@ private slots:
 signals:
   void exitKeySequence();
 
-protected:
+ protected:
   void closeEvent(QCloseEvent* event);
   void createMainMenu();
 
-private:
+ private:
   XGUI_MainMenu* myMenuBar;
   XGUI_Viewer* myViewer;
 
   PyConsole_EnhConsole* myPythonConsole;
 };
 
-class XGUI_EXPORT CloseEventWatcher: public QObject {
-  Q_OBJECT
+class XGUI_EXPORT CloseEventWatcher : public QObject
+{
+Q_OBJECT
 
  public:
   CloseEventWatcher(QObject* theParent);
 
- signals:
+signals:
   void widgetClosed();
 
  protected:
index f268c369122f0d70094eb6546747a7b1d506d71c..30c459466e9eaa44c303d1c28ce09bc40501270c 100644 (file)
 #include <iostream>
 
 XGUI_MenuGroupPanel::XGUI_MenuGroupPanel(QWidget *parent)
-    : QFrame(parent), myNewRow(0), myNewCol(0), myMaxRow(1)
+    : QFrame(parent),
+      myNewRow(0),
+      myNewCol(0),
+      myMaxRow(1)
 {
   myLayout = new QGridLayout(this);
   myLayout->setSpacing(0);
@@ -19,8 +22,6 @@ XGUI_MenuGroupPanel::XGUI_MenuGroupPanel(QWidget *parent)
   setFrameShape(QFrame::NoFrame);
 }
 
-
-
 void XGUI_MenuGroupPanel::addCommand(XGUI_Command* theAction)
 {
   myActions.append(theAction);
@@ -59,10 +60,11 @@ void XGUI_MenuGroupPanel::resizeEvent(QResizeEvent* theEvent)
   myMaxRow = aMaxRow;
   myNewRow = 0;
   myNewCol = 0;
-  foreach(QWidget* eachWidget, myActionWidget) {
+  foreach(QWidget* eachWidget, myActionWidget)
+  {
     placeWidget(eachWidget);
   }
-  myLayout->setRowStretch(myMaxRow + 1,  1);
+  myLayout->setRowStretch(myMaxRow + 1, 1);
 }
 
 XGUI_Command* XGUI_MenuGroupPanel::addFeature(const QString& theId, const QString& theTitle,
@@ -78,10 +80,10 @@ XGUI_Command* XGUI_MenuGroupPanel::addFeature(const QString& theId, const QStrin
   return aCommand;
 }
 
-
 XGUI_Command* XGUI_MenuGroupPanel::feature(const QString& theId) const
 {
-  foreach (XGUI_Command* aCmd, myActions) {
+  foreach (XGUI_Command* aCmd, myActions)
+  {
     if (aCmd->data().toString() == theId)
       return aCmd;
   }
index 07f51ed1eac140a981fbe492772bdea59233f3d0..7cf1f1d4164e5a76246034ddfc98d6e3b5e3e305 100644 (file)
@@ -8,14 +8,13 @@
 class XGUI_Command;
 class QGridLayout;
 
-
 /**\class XGUI_MenuGroupPanel
  * \ingroup GUI
  * \brief Represents a one group in a page of main menu (workbench)
  */
-class XGUI_EXPORT XGUI_MenuGroupPanel: public QFrame
+class XGUI_EXPORT XGUI_MenuGroupPanel : public QFrame
 {
-  Q_OBJECT
+Q_OBJECT
 
  public:
   explicit XGUI_MenuGroupPanel(QWidget *parent = 0);
@@ -29,18 +28,21 @@ class XGUI_EXPORT XGUI_MenuGroupPanel: public QFrame
   XGUI_Command* feature(const QString& theId) const;
 
   //! Returns list of created commands
-  QList<XGUI_Command*> features() const { return myActions; }
+  QList<XGUI_Command*> features() const
+  {
+    return myActions;
+  }
 
-protected:
+ protected:
   virtual void resizeEvent(QResizeEvent *theEvent);
 
-private:
+ private:
   void addWidget(QWidget* theWgt);
   void placeWidget(QWidget* theWgt);
   void addCommand(XGUI_Command* theAction);
 
   QList<XGUI_Command*> myActions;
-  QWidgetList          myActionWidget;
+  QWidgetList myActionWidget;
 
   QGridLayout* myLayout;
   int myNewRow;
index e0a73617035736ea89f879d93330433aaa97f683..7e9694ebbbf1e74df9747fb2d0649abd067afe15 100644 (file)
@@ -2,17 +2,15 @@
 // Created:     3 June 2014
 // Author:      Vitaly Smetannikov
 
-
 #include "XGUI_ModuleConnector.h"
 #include "XGUI_Workshop.h"
 #include "XGUI_ViewerProxy.h"
 #include "XGUI_SelectionMgr.h"
 #include "XGUI_Selection.h"
 
-
-
-XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop* theWorkshop) 
-: ModuleBase_IWorkshop(theWorkshop), myWorkshop(theWorkshop)
+XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop* theWorkshop)
+    : ModuleBase_IWorkshop(theWorkshop),
+      myWorkshop(theWorkshop)
 {
   XGUI_SelectionMgr* aSelector = myWorkshop->selector();
   connect(aSelector, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
@@ -27,7 +25,6 @@ Handle(AIS_InteractiveContext) XGUI_ModuleConnector::AISContext() const
   return myWorkshop->viewer()->AISContext();
 }
 
-
 QList<ObjectPtr> XGUI_ModuleConnector::selectedObjects() const
 {
   return myWorkshop->selector()->selection()->selectedObjects();
@@ -36,4 +33,4 @@ QList<ObjectPtr> XGUI_ModuleConnector::selectedObjects() const
 ModuleBase_IModule* XGUI_ModuleConnector::module() const
 {
   return myWorkshop->module();
-}
\ No newline at end of file
+}
index c7119b79ee7494de674dc2fbd690048e269ce184..3423a55f0cf733c1779a075b64e44a4e03b59c87 100644 (file)
@@ -5,7 +5,6 @@
 #ifndef XGUI_ModuleConnector_H
 #define XGUI_ModuleConnector_H
 
-
 #include "XGUI.h"
 #include <ModuleBase_Definitions.h>
 #include <ModuleBase_IWorkshop.h>
@@ -15,12 +14,12 @@ class XGUI_Workshop;
 class XGUI_Displayer;
 
 /**
-* Implementation of IWorkshop interface which provides access to Workshop sevices at module level
-*/
-class XGUI_EXPORT XGUI_ModuleConnector: public ModuleBase_IWorkshop
+ * Implementation of IWorkshop interface which provides access to Workshop sevices at module level
+ */
+class XGUI_EXPORT XGUI_ModuleConnector : public ModuleBase_IWorkshop
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_ModuleConnector(XGUI_Workshop* theWorkshop);
 
   virtual ~XGUI_ModuleConnector();
@@ -29,13 +28,13 @@ public:
   virtual Handle(AIS_InteractiveContext) AISContext() const;
 
   //! Returns list of currently selected data objects
-  virtual QList<ObjectPtr> selectedObjects() const; 
+  virtual QList<ObjectPtr> selectedObjects() const;
 
   //! Returns instance of loaded module
   virtual ModuleBase_IModule* module() const;
 
-private:
+ private:
   XGUI_Workshop* myWorkshop;
 };
 
-#endif
\ No newline at end of file
+#endif
index 45d287465f3e87b761670c99239021ce63ea29ae..12d0dd6a74a9bf279823c0871914e8eff4249517 100644 (file)
 #include <QMouseEvent>
 #include <QAction>
 
-
-
 XGUI_DataTree::XGUI_DataTree(QWidget* theParent)
-  : QTreeView(theParent)
+    : QTreeView(theParent)
 {
   setHeaderHidden(true);
   setModel(new XGUI_DocumentDataModel(this));
@@ -26,7 +24,7 @@ XGUI_DataTree::XGUI_DataTree(QWidget* theParent)
   setSelectionBehavior(QAbstractItemView::SelectRows);
   setSelectionMode(QAbstractItemView::ExtendedSelection);
 
-  connect(selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), 
+  connect(selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
           this, SLOT(onSelectionChanged(const QItemSelection&, const QItemSelection&)));
 }
 
@@ -34,14 +32,13 @@ XGUI_DataTree::~XGUI_DataTree()
 {
 }
 
-XGUI_DocumentDataModel* XGUI_DataTree::dataModel() const 
-{ 
-  return static_cast<XGUI_DocumentDataModel*>(model()); 
+XGUI_DocumentDataModel* XGUI_DataTree::dataModel() const
+{
+  return static_cast<XGUI_DocumentDataModel*>(model());
 }
 
-
-void XGUI_DataTree::onSelectionChanged(const QItemSelection& theSelected, 
-                                             const QItemSelection& theDeselected)
+void XGUI_DataTree::onSelectionChanged(const QItemSelection& theSelected,
+                                       const QItemSelection& theDeselected)
 {
   mySelectedData.clear();
   QModelIndexList aIndexes = selectionModel()->selectedIndexes();
@@ -71,7 +68,7 @@ void XGUI_DataTree::mouseDoubleClickEvent(QMouseEvent* theEvent)
         setExpanded(aIndex, true);
       emit activePartChanged(aModel->activePart());
     }
-  } else 
+  } else
     QTreeView::mouseDoubleClickEvent(theEvent);
 }
 
@@ -97,7 +94,7 @@ void XGUI_DataTree::commitData(QWidget* theEditor)
 //********************************************************************
 //********************************************************************
 XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
-  : QWidget(theParent)
+    : QWidget(theParent)
 {
   QVBoxLayout* aLayout = new QVBoxLayout(this);
   aLayout->setContentsMargins(0, 0, 0, 0);
@@ -135,7 +132,7 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
   myActiveDocLbl->installEventFilter(this);
 
   aLabelLay->addWidget(myActiveDocLbl);
-  aLabelLay->setStretch(1,1);
+  aLabelLay->setStretch(1, 1);
 
   myTreeView = new XGUI_DataTree(this);
   aLayout->addWidget(myTreeView);
@@ -146,14 +143,16 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
   aLabelWgt->setFrameShadow(myTreeView->frameShadow());
 
   connect(myTreeView, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
-  connect(myTreeView, SIGNAL(activePartChanged(ObjectPtr)), this, SLOT(onActivePartChanged(ObjectPtr)));
-  connect(myTreeView, SIGNAL(activePartChanged(ObjectPtr)), this, SIGNAL(activePartChanged(ObjectPtr)));
-
-  connect(myActiveDocLbl, SIGNAL(customContextMenuRequested(const QPoint&)), 
-          this, SLOT(onLabelContextMenuRequested(const QPoint&)));
-  connect(myTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent*)), 
-          this, SLOT(onContextMenuRequested(QContextMenuEvent*)));
-  
+  connect(myTreeView, SIGNAL(activePartChanged(ObjectPtr)), this,
+          SLOT(onActivePartChanged(ObjectPtr)));
+  connect(myTreeView, SIGNAL(activePartChanged(ObjectPtr)), this,
+          SIGNAL(activePartChanged(ObjectPtr)));
+
+  connect(myActiveDocLbl, SIGNAL(customContextMenuRequested(const QPoint&)), this,
+          SLOT(onLabelContextMenuRequested(const QPoint&)));
+  connect(myTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
+          SLOT(onContextMenuRequested(QContextMenuEvent*)));
+
   onActivePartChanged(ObjectPtr());
 
   // Create internal actions
@@ -174,7 +173,7 @@ void XGUI_ObjectsBrowser::onActivePartChanged(ObjectPtr thePart)
   QPalette aPalet = myActiveDocLbl->palette();
   if (thePart) {
     aPalet.setColor(QPalette::Text, Qt::black);
-  }  else {
+  } else {
     aPalet.setColor(QPalette::Text, QColor(0, 72, 140));
   }
   myActiveDocLbl->setPalette(aPalet);
@@ -204,13 +203,13 @@ bool XGUI_ObjectsBrowser::eventFilter(QObject* obj, QEvent* theEvent)
       } else if (theEvent->type() == QEvent::KeyRelease) {
         QKeyEvent* aEvent = (QKeyEvent*) theEvent;
         switch (aEvent->key()) {
-        case Qt::Key_Return: // Accept current input
-          closeDocNameEditing(true);
-          break;
-        case Qt::Key_Escape: // Cancel the input
-          closeDocNameEditing(false);
-          break;
-        } 
+          case Qt::Key_Return:  // Accept current input
+            closeDocNameEditing(true);
+            break;
+          case Qt::Key_Escape:  // Cancel the input
+            closeDocNameEditing(false);
+            break;
+        }
       }
     }
   }
@@ -263,11 +262,12 @@ void XGUI_ObjectsBrowser::activatePart(const ResultPartPtr& thePart)
 }
 
 //***************************************************
-void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent) 
+void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent)
 {
   myObjectsList = myTreeView->selectedObjects();
   bool toEnable = myObjectsList.size() > 0;
-  foreach(QAction* aCmd, actions()) {
+  foreach(QAction* aCmd, actions())
+  {
     aCmd->setEnabled(toEnable);
   }
   emit contextMenuRequested(theEvent);
@@ -278,12 +278,13 @@ void XGUI_ObjectsBrowser::onLabelContextMenuRequested(const QPoint& thePnt)
 {
   myObjectsList.clear();
   //Empty feature pointer means that selected root document
-  myObjectsList.append(ObjectPtr()); 
+  myObjectsList.append(ObjectPtr());
 
-  foreach(QAction* aCmd, actions()) {
+  foreach(QAction* aCmd, actions())
+  {
     aCmd->setEnabled(true);
   }
-  QContextMenuEvent aEvent( QContextMenuEvent::Mouse, thePnt, myActiveDocLbl->mapToGlobal(thePnt) );
+  QContextMenuEvent aEvent(QContextMenuEvent::Mouse, thePnt, myActiveDocLbl->mapToGlobal(thePnt));
   emit contextMenuRequested(&aEvent);
 }
 
@@ -292,10 +293,11 @@ void XGUI_ObjectsBrowser::onEditItem()
 {
   if (myObjectsList.size() > 0) {
     ObjectPtr aFeature = myObjectsList.first();
-    if (aFeature) { // Selection happens in TreeView
+    if (aFeature) {  // Selection happens in TreeView
       // Find index which corresponds the feature
       QModelIndex aIndex;
-      foreach(QModelIndex aIdx, selectedIndexes()) {
+      foreach(QModelIndex aIdx, selectedIndexes())
+      {
         ObjectPtr aFea = dataModel()->object(aIdx);
         if (dataModel()->object(aIdx)->isSame(aFeature)) {
           aIndex = aIdx;
@@ -306,7 +308,7 @@ void XGUI_ObjectsBrowser::onEditItem()
         myTreeView->setCurrentIndex(aIndex);
         myTreeView->edit(aIndex);
       }
-    } else { //Selection happens in Upper label
+    } else {  //Selection happens in Upper label
       myActiveDocLbl->setReadOnly(false);
       myActiveDocLbl->setFocus();
       myActiveDocLbl->selectAll();
@@ -337,7 +339,8 @@ void XGUI_ObjectsBrowser::setObjectsSelected(const QList<ObjectPtr>& theObjects)
   QItemSelectionModel* aSelectModel = myTreeView->selectionModel();
   aSelectModel->clear();
 
-  foreach(ObjectPtr aFeature, theObjects) {
+  foreach(ObjectPtr aFeature, theObjects)
+  {
     QModelIndex aIndex = myDocModel->objectIndex(aFeature);
     if (aIndex.isValid()) {
       aSelectModel->select(aIndex, QItemSelectionModel::Select);
index 05a539566d5a8bdd438314ae52c8a61a8f94b4bc..c5149fdd909435768d6f6954604590ac63ffd49a 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifndef XGUI_ObjectsBrowser_H
 #define XGUI_ObjectsBrowser_H
 
 class XGUI_DocumentDataModel;
 class QLineEdit;
 
-
-class XGUI_DataTree: public QTreeView
+class XGUI_DataTree : public QTreeView
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_DataTree(QWidget* theParent);
   virtual ~XGUI_DataTree();
 
   //! Returns list of currently selected objects
-  QList<ObjectPtr> selectedObjects() const { return mySelectedData; }
+  QList<ObjectPtr> selectedObjects() const
+  {
+    return mySelectedData;
+  }
 
   XGUI_DocumentDataModel* dataModel() const;
 
 signals:
   //! Emited when selection is changed
   void selectionChanged();
-  void activePartChanged(ObjectPtr thePart); 
+  void activePartChanged(ObjectPtr thePart);
+
   //! Emited on context menu request
   void contextMenuRequested(QContextMenuEvent* theEvent);
 
-protected slots:
+ protected slots:
   virtual void commitData(QWidget* theEditor);
 
-protected:
+ protected:
   virtual void mouseDoubleClickEvent(QMouseEvent* theEvent);
   virtual void contextMenuEvent(QContextMenuEvent* theEvent);
 
-private slots:
+ private slots:
   //! Called when selection in Data Tree is changed
   void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);
 
-private:
+ private:
   //! List of currently selected data
   QList<ObjectPtr> mySelectedData;
 };
 
-
 /**\class XGUI_ObjectsBrowser
  * \ingroup GUI
  * \brief Object browser window object. Represents data tree of current data structure
  */
- class XGUI_EXPORT XGUI_ObjectsBrowser : public QWidget
+class XGUI_EXPORT XGUI_ObjectsBrowser : public QWidget
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_ObjectsBrowser(QWidget* theParent);
   virtual ~XGUI_ObjectsBrowser();
 
   //! Returns Model which provides access to data objects
-  XGUI_DocumentDataModel* dataModel() const { return myDocModel; }
+  XGUI_DocumentDataModel* dataModel() const
+  {
+    return myDocModel;
+  }
 
   //! Returns list of currently selected objects
-  QList<ObjectPtr> selectedObjects() const { return myObjectsList; }
+  QList<ObjectPtr> selectedObjects() const
+  {
+    return myObjectsList;
+  }
 
   void setObjectsSelected(const QList<ObjectPtr>& theObjects);
 
   //! Returns currently selected indexes
-  QModelIndexList selectedIndexes() const { return myTreeView->selectionModel()->selectedIndexes(); }
+  QModelIndexList selectedIndexes() const
+  {
+    return myTreeView->selectionModel()->selectedIndexes();
+  }
 
   //! Returns TreeView widget
-  XGUI_DataTree* treeView() const { return myTreeView; }
+  XGUI_DataTree* treeView() const
+  {
+    return myTreeView;
+  }
 
   //! Activates currently selected part. Signal activePartChanged will not be sent
   void activatePart(const ResultPartPtr& thePart);
@@ -86,15 +98,15 @@ signals:
   void selectionChanged();
 
   //! Emited when current active document is changed
-  void activePartChanged(ObjectPtr thePart); 
+  void activePartChanged(ObjectPtr thePart);
+
   //! Emited on context menu request
   void contextMenuRequested(QContextMenuEvent* theEvent);
 
-protected:
+ protected:
   virtual bool eventFilter(QObject* obj, QEvent* theEvent);
 
-private slots:
+ private slots:
   void onActivePartChanged(ObjectPtr thePart);
   void onContextMenuRequested(QContextMenuEvent* theEvent);
   void onLabelContextMenuRequested(const QPoint& thePnt);
@@ -104,7 +116,7 @@ private slots:
 
   void onSelectionChanged();
 
-private:
+ private:
   void closeDocNameEditing(bool toSave);
 
   //! Internal model
@@ -116,4 +128,4 @@ private:
   QList<ObjectPtr> myObjectsList;
 };
 
-#endif
\ No newline at end of file
+#endif
index 236747a7df2a885bd30d908bb5a1833bcfc32208..4a93b9d47c770272bb5eb4a3c35c3e06e9369460 100644 (file)
@@ -13,7 +13,7 @@
 #include <QKeyEvent>
 
 XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent)
-: QObject(theParent)
+    : QObject(theParent)
 {
   // listen to Escape signal to stop the current operation
   qApp->installEventFilter(this);
@@ -48,8 +48,8 @@ bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation)
   connect(theOperation, SIGNAL(stopped()), this, SLOT(onOperationStopped()));
   connect(theOperation, SIGNAL(started()), this, SIGNAL(operationStarted()));
   connect(theOperation, SIGNAL(resumed()), this, SIGNAL(operationResumed()));
-  connect(theOperation, SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)),
-          this, SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)));
+  connect(theOperation, SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)), this,
+          SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)));
 
   theOperation->start();
   validateCurrentOperation();
@@ -60,7 +60,7 @@ bool XGUI_OperationMgr::abortOperation()
 {
   ModuleBase_Operation* aCurrentOp = currentOperation();
   if (!aCurrentOp || !canStopOperation())
-    return false; 
+    return false;
 
   aCurrentOp->abort();
   return true;
@@ -69,7 +69,8 @@ bool XGUI_OperationMgr::abortOperation()
 QStringList XGUI_OperationMgr::operationList()
 {
   QStringList result;
-  foreach(ModuleBase_Operation* eachOperation, myOperations) {
+  foreach(ModuleBase_Operation* eachOperation, myOperations)
+  {
     result << eachOperation->id();
   }
   return result;
@@ -88,10 +89,11 @@ void XGUI_OperationMgr::validateOperation(ModuleBase_Operation* theOperation)
   //
   std::list<ModelAPI_Validator*>::iterator it = aValidators.begin();
   bool isValid = true;
-  for(; it != aValidators.end(); it++) {
+  for (; it != aValidators.end(); it++) {
     const ModelAPI_FeatureValidator* aFeatureValidator =
         dynamic_cast<const ModelAPI_FeatureValidator*>(*it);
-    if (!aFeatureValidator) continue;
+    if (!aFeatureValidator)
+      continue;
     if (!aFeatureValidator->isValid(aFeature)) {
       isValid = false;
       break;
@@ -102,7 +104,7 @@ void XGUI_OperationMgr::validateOperation(ModuleBase_Operation* theOperation)
 
 void XGUI_OperationMgr::validateCurrentOperation()
 {
-  if(!hasOperation())
+  if (!hasOperation())
     return;
   ModuleBase_Operation* anOperation = currentOperation();
   validateOperation(currentOperation());
@@ -111,7 +113,7 @@ void XGUI_OperationMgr::validateCurrentOperation()
 bool XGUI_OperationMgr::eventFilter(QObject *theObject, QEvent *theEvent)
 {
   if (theEvent->type() == QEvent::KeyRelease) {
-    QKeyEvent* aKeyEvent = (QKeyEvent*)theEvent;
+    QKeyEvent* aKeyEvent = (QKeyEvent*) theEvent;
     if (aKeyEvent && aKeyEvent->key() == Qt::Key_Escape) {
       // TODO: this is Escape button processing when the property panel has empty content,
       // but the operation should be stopped by the Enter has been clicked
@@ -131,8 +133,7 @@ bool XGUI_OperationMgr::canStartOperation(ModuleBase_Operation* theOperation)
 {
   bool aCanStart = true;
   ModuleBase_Operation* aCurrentOp = currentOperation();
-  if (aCurrentOp && !theOperation->isGranted(aCurrentOp))
-  {
+  if (aCurrentOp && !theOperation->isGranted(aCurrentOp)) {
     if (canStopOperation()) {
       aCurrentOp->abort();
     } else {
@@ -147,9 +148,10 @@ bool XGUI_OperationMgr::canStopOperation()
   ModuleBase_Operation* anOperation = currentOperation();
   if (anOperation) {
     if (anOperation->isModified()) {
-      int anAnswer = QMessageBox::question(qApp->activeWindow(), tr("Operation launch"),
-                                  tr("Previous operation is not finished and will be aborted"),
-                                  QMessageBox::Ok, QMessageBox::Cancel);
+      int anAnswer = QMessageBox::question(
+          qApp->activeWindow(), tr("Operation launch"),
+          tr("Previous operation is not finished and will be aborted"), QMessageBox::Ok,
+          QMessageBox::Cancel);
       return anAnswer == QMessageBox::Ok;
     }
   }
@@ -174,10 +176,11 @@ bool XGUI_OperationMgr::canAbortOperation()
 {
   ModuleBase_Operation* anOperation = currentOperation();
   if (anOperation && anOperation->isModified()) {
-      int anAnswer = QMessageBox::question(qApp->activeWindow(), tr("Cancel operation"),
-                                  tr("Operation %1 will be cancelled. Continue?").arg(anOperation->id()),
-                                  QMessageBox::Yes, QMessageBox::No);
-      return anAnswer == QMessageBox::Yes;
+    int anAnswer = QMessageBox::question(
+        qApp->activeWindow(), tr("Cancel operation"),
+        tr("Operation %1 will be cancelled. Continue?").arg(anOperation->id()), QMessageBox::Yes,
+        QMessageBox::No);
+    return anAnswer == QMessageBox::Yes;
   }
   return true;
 }
@@ -186,7 +189,7 @@ void XGUI_OperationMgr::onOperationStopped()
 {
   ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
   ModuleBase_Operation* anOperation = currentOperation();
-  if (!aSenderOperation || !anOperation || aSenderOperation != anOperation )
+  if (!aSenderOperation || !anOperation || aSenderOperation != anOperation)
     return;
 
   myOperations.removeAll(anOperation);
@@ -198,8 +201,7 @@ void XGUI_OperationMgr::onOperationStopped()
   ModuleBase_Operation* aResultOp = 0;
   QListIterator<ModuleBase_Operation*> anIt(myOperations);
   anIt.toBack();
-  while(anIt.hasPrevious())
-  {
+  while (anIt.hasPrevious()) {
     ModuleBase_Operation* anOp = anIt.previous();
     if (anOp) {
       aResultOp = anOp;
index 11a670088d0b7397b0404c89929ff132cba8027d..6e55108e33192a07163142b8508a02825b0cd6bc 100644 (file)
@@ -26,8 +26,8 @@ class QKeyEvent;
  */
 class XGUI_EXPORT XGUI_OperationMgr : public QObject
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   /// Constructor
   /// \param theParent the parent
   XGUI_OperationMgr(QObject* theParent);
@@ -54,7 +54,7 @@ public:
 
   virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
 
-public slots:
+ public slots:
   void validateCurrentOperation();
 
 signals:
@@ -71,7 +71,7 @@ signals:
   /// \param theWidget the model widget
   void activateNextWidget(ModuleBase_ModelWidget* theWidget);
 
-protected:
+ protected:
   /// Sets the current operation or NULL
   /// \param theOperation the started operation
   /// \param isCheckBeforeStart the flag whether to check whether the operation can be started
@@ -91,7 +91,7 @@ protected:
 
   void validateOperation(ModuleBase_Operation* theOperation);
 
-protected slots:
+ protected slots:
   /// Slot that commits the current operation.
   void onCommitOperation();
   /// Slot that aborts the current operation.
@@ -110,10 +110,10 @@ protected slots:
   /// \param theWidget an activated widget
   void onWidgetActivated(ModuleBase_ModelWidget* theWidget);
 
-private:
-  typedef QList<ModuleBase_Operation*> Operations; ///< definition for a list of operations
-  Operations myOperations; ///< a stack of started operations. The active operation is on top,
-                           // others are suspended and started by the active is finished
+ private:
+  typedef QList<ModuleBase_Operation*> Operations;  ///< definition for a list of operations
+  Operations myOperations;  ///< a stack of started operations. The active operation is on top,
+                            // others are suspended and started by the active is finished
 };
 
 #endif
index d67c2ec4fc27861b06324b3a0489dfec000ee27f..16adcadf747f9e3fbfcf66828a8913dae2443fa9 100644 (file)
@@ -16,7 +16,6 @@
 #include <QIcon>
 #include <QBrush>
 
-
 //ObjectPtr featureObj(const ObjectPtr& theFeature)
 //{
 //  ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
 //  return theFeature;
 //}
 
-
 XGUI_TopDataModel::XGUI_TopDataModel(QObject* theParent)
-  : XGUI_FeaturesModel(theParent)
+    : XGUI_FeaturesModel(theParent)
 {
 }
-  
+
 XGUI_TopDataModel::~XGUI_TopDataModel()
 {
 }
 
-
 QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const
 {
   switch (theRole) {
-  case Qt::DisplayRole:
-    // return a name
-    switch (theIndex.internalId()) {
-    case ParamsFolder:
-      return tr("Parameters") + QString(" (%1)").arg(rowCount(theIndex));
-    case ParamObject:
-      {
-        DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-        ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultParameters::group(), theIndex.row());
-        if (aObject)
-          return aObject->data()->name().c_str();
-      } 
-      break;
-    case ConstructFolder:
-        return tr("Constructions") + QString(" (%1)").arg(rowCount(theIndex));
-    case ConstructObject:
-      {
-        DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-        ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultConstruction::group(), theIndex.row());
-        if (aObject)
-          return aObject->data()->name().c_str();
+    case Qt::DisplayRole:
+      // return a name
+      switch (theIndex.internalId()) {
+        case ParamsFolder:
+          return tr("Parameters") + QString(" (%1)").arg(rowCount(theIndex));
+        case ParamObject: {
+          DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
+          ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultParameters::group(), theIndex.row());
+          if (aObject)
+            return aObject->data()->name().c_str();
+        }
+          break;
+        case ConstructFolder:
+          return tr("Constructions") + QString(" (%1)").arg(rowCount(theIndex));
+        case ConstructObject: {
+          DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
+          ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultConstruction::group(),
+                                               theIndex.row());
+          if (aObject)
+            return aObject->data()->name().c_str();
+        }
+          break;
+        case BodiesFolder:
+          return tr("Bodies") + QString(" (%1)").arg(rowCount(theIndex));
+        case BodiesObject: {
+          DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
+          ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultBody::group(), theIndex.row());
+          if (aObject)
+            return aObject->data()->name().c_str();
+        }
       }
       break;
-    case BodiesFolder:
-        return tr("Bodies") + QString(" (%1)").arg(rowCount(theIndex));
-    case BodiesObject:
-      {
-        DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-        ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultBody::group(), theIndex.row());
-        if (aObject)
-          return aObject->data()->name().c_str();
+
+    case Qt::DecorationRole:
+      // return an Icon
+      switch (theIndex.internalId()) {
+        case ParamsFolder:
+          return QIcon(":pictures/params_folder.png");
+        case BodiesFolder:
+        case ConstructFolder:
+          return QIcon(":pictures/constr_folder.png");
+        case ConstructObject:
+        case BodiesObject:
+          return QIcon(":pictures/constr_object.png");
       }
-    }
-    break;
+      break;
 
-  case Qt::DecorationRole:
-    // return an Icon
-    switch (theIndex.internalId()) {
-    case ParamsFolder:
-      return QIcon(":pictures/params_folder.png");
-    case BodiesFolder:
-    case ConstructFolder:
-      return QIcon(":pictures/constr_folder.png");
-    case ConstructObject:
-    case BodiesObject:
-      return QIcon(":pictures/constr_object.png");
-    }
-    break;
-
-  case Qt::ToolTipRole:
-    // return Tooltip
-    break;
-  case Qt::ForegroundRole:
-    return QBrush(myItemsColor);
-    break;
+    case Qt::ToolTipRole:
+      // return Tooltip
+      break;
+    case Qt::ForegroundRole:
+      return QBrush(myItemsColor);
+      break;
   }
   return QVariant();
 }
@@ -105,7 +100,7 @@ QVariant XGUI_TopDataModel::headerData(int section, Qt::Orientation orientation,
 
 int XGUI_TopDataModel::rowCount(const QModelIndex& theParent) const
 {
-  if (!theParent.isValid()) 
+  if (!theParent.isValid())
     return 3;
 
   DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
@@ -129,12 +124,12 @@ QModelIndex XGUI_TopDataModel::index(int theRow, int theColumn, const QModelInde
 {
   if (!theParent.isValid()) {
     switch (theRow) {
-    case 0:
-      return createIndex(theRow, theColumn, (qint32) ParamsFolder);
-    case 1:
-      return createIndex(theRow, theColumn, (qint32) ConstructFolder);
-    case 2:
-      return createIndex(theRow, theColumn, (qint32) BodiesFolder);
+      case 0:
+        return createIndex(theRow, theColumn, (qint32) ParamsFolder);
+      case 1:
+        return createIndex(theRow, theColumn, (qint32) ConstructFolder);
+      case 2:
+        return createIndex(theRow, theColumn, (qint32) BodiesFolder);
     }
   } else {
     if (theParent.internalId() == ParamsFolder)
@@ -151,18 +146,18 @@ QModelIndex XGUI_TopDataModel::index(int theRow, int theColumn, const QModelInde
 
 QModelIndex XGUI_TopDataModel::parent(const QModelIndex& theIndex) const
 {
-  int aId = (int)theIndex.internalId();
+  int aId = (int) theIndex.internalId();
   switch (aId) {
-  case ParamsFolder:
-  case ConstructFolder:
-  case BodiesFolder:
-    return QModelIndex();
-  case ParamObject:
-    return createIndex(0, 0, (qint32) ParamsFolder);
-  case ConstructObject:
-    return createIndex(1, 0, (qint32) ConstructFolder);
-  case BodiesObject:
-    return createIndex(2, 0, (qint32) BodiesFolder);
+    case ParamsFolder:
+    case ConstructFolder:
+    case BodiesFolder:
+      return QModelIndex();
+    case ParamObject:
+      return createIndex(0, 0, (qint32) ParamsFolder);
+    case ConstructObject:
+      return createIndex(1, 0, (qint32) ConstructFolder);
+    case BodiesObject:
+      return createIndex(2, 0, (qint32) BodiesFolder);
   }
   return QModelIndex();
 }
@@ -175,22 +170,19 @@ bool XGUI_TopDataModel::hasChildren(const QModelIndex& theParent) const
 ObjectPtr XGUI_TopDataModel::object(const QModelIndex& theIndex) const
 {
   switch (theIndex.internalId()) {
-  case ParamsFolder:
-  case ConstructFolder:
-  case BodiesFolder:
-    return ObjectPtr();
-  case ParamObject:
-    {
+    case ParamsFolder:
+    case ConstructFolder:
+    case BodiesFolder:
+      return ObjectPtr();
+    case ParamObject: {
       DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
       return aRootDoc->object(ModelAPI_ResultParameters::group(), theIndex.row());
     }
-  case ConstructObject:
-    {
+    case ConstructObject: {
       DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
       return aRootDoc->object(ModelAPI_ResultConstruction::group(), theIndex.row());
     }
-  case BodiesObject:
-    {
+    case BodiesObject: {
       DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
       return aRootDoc->object(ModelAPI_ResultBody::group(), theIndex.row());
     }
@@ -198,7 +190,6 @@ ObjectPtr XGUI_TopDataModel::object(const QModelIndex& theIndex) const
   return ObjectPtr();
 }
 
-
 QModelIndex XGUI_TopDataModel::findParent(const ObjectPtr& theObject) const
 {
   return findGroup(theObject->groupName().c_str());
@@ -241,17 +232,14 @@ QModelIndex XGUI_TopDataModel::objectIndex(const ObjectPtr& theObject) const
   return aIndex;
 }
 
-
-
 //******************************************************************
 //******************************************************************
 //******************************************************************
 XGUI_PartDataModel::XGUI_PartDataModel(QObject* theParent)
-  : XGUI_PartModel(theParent)
+    : XGUI_PartModel(theParent)
 {
 }
 
-
 XGUI_PartDataModel::~XGUI_PartDataModel()
 {
 }
@@ -259,76 +247,72 @@ XGUI_PartDataModel::~XGUI_PartDataModel()
 QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) const
 {
   switch (theRole) {
-  case Qt::DisplayRole:
-    // return a name
-    switch (theIndex.internalId()) {
-    case MyRoot:
-      {
-        DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
-        ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
-        if (aObject)
-          return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
+    case Qt::DisplayRole:
+      // return a name
+      switch (theIndex.internalId()) {
+        case MyRoot: {
+          DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
+          ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
+          if (aObject)
+            return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
+        }
+        case ParamsFolder:
+          return tr("Parameters") + QString(" (%1)").arg(rowCount(theIndex));
+        case ConstructFolder:
+          return tr("Constructions") + QString(" (%1)").arg(rowCount(theIndex));
+        case BodiesFolder:
+          return tr("Bodies") + QString(" (%1)").arg(rowCount(theIndex));
+        case ParamObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultParameters::group(),
+                                                     theIndex.row());
+          if (aObject)
+            return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
+        }
+        case ConstructObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultConstruction::group(),
+                                                     theIndex.row());
+          if (aObject)
+            return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
+        }
+        case BodiesObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultBody::group(), theIndex.row());
+          if (aObject)
+            return aObject->data()->name().c_str();
+        }
+        case HistoryObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 3);
+          if (aObject)
+            return aObject->data()->name().c_str();
+        }
       }
-    case ParamsFolder:
-      return tr("Parameters") + QString(" (%1)").arg(rowCount(theIndex));
-    case ConstructFolder:
-      return tr("Constructions") + QString(" (%1)").arg(rowCount(theIndex));
-    case BodiesFolder:
-      return tr("Bodies") + QString(" (%1)").arg(rowCount(theIndex));
-    case ParamObject:
-      {
-        ObjectPtr aObject = partDocument()->object(ModelAPI_ResultParameters::group(), theIndex.row());
-        if (aObject)
-          return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
-      }
-    case ConstructObject:
-      {
-        ObjectPtr aObject = partDocument()->object(ModelAPI_ResultConstruction::group(), theIndex.row());
-        if (aObject)
-          return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
-      }
-    case BodiesObject:
-      {
-        ObjectPtr aObject = partDocument()->object(ModelAPI_ResultBody::group(), theIndex.row());
-        if (aObject)
-          return aObject->data()->name().c_str();
-      }
-    case HistoryObject:
-      {
-        ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 3);
-        if (aObject)
-          return aObject->data()->name().c_str();
-      }
-    }
-    break;
-  case Qt::DecorationRole:
-    // return an Icon
-    switch (theIndex.internalId()) {
-    case MyRoot:
-      return QIcon(":pictures/part_ico.png");
-    case ParamsFolder:
-      return QIcon(":pictures/params_folder.png");
-    case ConstructFolder:
-    case BodiesFolder:
-      return QIcon(":pictures/constr_folder.png");
-    case ConstructObject:
-    case BodiesObject:
-      return QIcon(":pictures/constr_object.png");
-    case HistoryObject:
-      {
-        ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 3);
-        FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
-        if (aFeature)
-          return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
+      break;
+    case Qt::DecorationRole:
+      // return an Icon
+      switch (theIndex.internalId()) {
+        case MyRoot:
+          return QIcon(":pictures/part_ico.png");
+        case ParamsFolder:
+          return QIcon(":pictures/params_folder.png");
+        case ConstructFolder:
+        case BodiesFolder:
+          return QIcon(":pictures/constr_folder.png");
+        case ConstructObject:
+        case BodiesObject:
+          return QIcon(":pictures/constr_object.png");
+        case HistoryObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 3);
+          FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+          if (aFeature)
+            return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
+        }
       }
-    }
-   break;
-  case Qt::ToolTipRole:
-    // return Tooltip
-    break;
-  case Qt::ForegroundRole:
-    return QBrush(myItemsColor);
-    break;
+      break;
+    case Qt::ToolTipRole:
+      // return Tooltip
+      break;
+    case Qt::ForegroundRole:
+      return QBrush(myItemsColor);
+      break;
   }
   return QVariant();
 }
@@ -344,18 +328,18 @@ int XGUI_PartDataModel::rowCount(const QModelIndex& parent) const
     DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
     if (aRootDoc->object(ModelAPI_ResultPart::group(), myId))
       return 1;
-    else 
+    else
       return 0;
   }
   switch (parent.internalId()) {
-  case MyRoot:
-    return 3 + partDocument()->size(ModelAPI_Feature::group());
-  case ParamsFolder:
-    return partDocument()->size(ModelAPI_ResultParameters::group());
-  case ConstructFolder:
-    return partDocument()->size(ModelAPI_ResultConstruction::group());
-  case BodiesFolder:
-    return partDocument()->size(ModelAPI_ResultBody::group());
+    case MyRoot:
+      return 3 + partDocument()->size(ModelAPI_Feature::group());
+    case ParamsFolder:
+      return partDocument()->size(ModelAPI_ResultParameters::group());
+    case ConstructFolder:
+      return partDocument()->size(ModelAPI_ResultConstruction::group());
+    case BodiesFolder:
+      return partDocument()->size(ModelAPI_ResultBody::group());
   }
   return 0;
 }
@@ -370,25 +354,25 @@ QModelIndex XGUI_PartDataModel::index(int theRow, int theColumn, const QModelInd
   if (!theParent.isValid())
     return createIndex(theRow, 0, (qint32) MyRoot);
 
-  int aId = (int)theParent.internalId();
+  int aId = (int) theParent.internalId();
   switch (aId) {
-  case MyRoot:
-    switch (theRow) {
-    case 0:
-      return createIndex(0, 0, (qint32) ParamsFolder);
-    case 1:
-      return createIndex(1, 0, (qint32) ConstructFolder);
-    case 2:
-      return createIndex(2, 0, (qint32) BodiesFolder);
-    default:
-      return createIndex(theRow, theColumn, (qint32) HistoryObject);
-    }
-  case ParamsFolder:
-    return createIndex(theRow, 0, (qint32) ParamObject);
-  case ConstructFolder:
-    return createIndex(theRow, 0, (qint32) ConstructObject);
-  case BodiesFolder:
-    return createIndex(theRow, 0, (qint32) BodiesObject);
+    case MyRoot:
+      switch (theRow) {
+        case 0:
+          return createIndex(0, 0, (qint32) ParamsFolder);
+        case 1:
+          return createIndex(1, 0, (qint32) ConstructFolder);
+        case 2:
+          return createIndex(2, 0, (qint32) BodiesFolder);
+        default:
+          return createIndex(theRow, theColumn, (qint32) HistoryObject);
+      }
+    case ParamsFolder:
+      return createIndex(theRow, 0, (qint32) ParamObject);
+    case ConstructFolder:
+      return createIndex(theRow, 0, (qint32) ConstructObject);
+    case BodiesFolder:
+      return createIndex(theRow, 0, (qint32) BodiesObject);
   }
   return QModelIndex();
 }
@@ -396,19 +380,19 @@ QModelIndex XGUI_PartDataModel::index(int theRow, int theColumn, const QModelInd
 QModelIndex XGUI_PartDataModel::parent(const QModelIndex& theIndex) const
 {
   switch (theIndex.internalId()) {
-  case MyRoot:
-    return QModelIndex();
-  case ParamsFolder:
-  case ConstructFolder:
-  case BodiesFolder:
-  case HistoryObject:
-    return createIndex(0, 0, (qint32) MyRoot);
-  case ParamObject:
-    return createIndex(0, 0, (qint32) ParamsFolder);
-  case ConstructObject:
-    return createIndex(1, 0, (qint32) ConstructFolder);
-  case BodiesObject:
-    return createIndex(2, 0, (qint32) BodiesFolder);
+    case MyRoot:
+      return QModelIndex();
+    case ParamsFolder:
+    case ConstructFolder:
+    case BodiesFolder:
+    case HistoryObject:
+      return createIndex(0, 0, (qint32) MyRoot);
+    case ParamObject:
+      return createIndex(0, 0, (qint32) ParamsFolder);
+    case ConstructObject:
+      return createIndex(1, 0, (qint32) ConstructFolder);
+    case BodiesObject:
+      return createIndex(2, 0, (qint32) BodiesFolder);
   }
   return QModelIndex();
 }
@@ -418,7 +402,6 @@ bool XGUI_PartDataModel::hasChildren(const QModelIndex& theParent) const
   return rowCount(theParent) > 0;
 }
 
-
 DocumentPtr XGUI_PartDataModel::partDocument() const
 {
   DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
@@ -426,27 +409,26 @@ DocumentPtr XGUI_PartDataModel::partDocument() const
   ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
   return aPart->partDoc();
 }
+
 ObjectPtr XGUI_PartDataModel::object(const QModelIndex& theIndex) const
 {
   switch (theIndex.internalId()) {
-  case MyRoot:
-    {
+    case MyRoot: {
       DocumentPtr aRootDoc = ModelAPI_PluginManager::get()->rootDocument();
       return aRootDoc->object(ModelAPI_ResultPart::group(), myId);
     }
-  case ParamsFolder:
-  case ConstructFolder:
-  case BodiesFolder:
-    return ObjectPtr();
-  case ParamObject:
-    return partDocument()->object(ModelAPI_ResultParameters::group(), theIndex.row());
-  case ConstructObject:
-    return partDocument()->object(ModelAPI_ResultConstruction::group(), theIndex.row());
-  case BodiesObject:
-    return partDocument()->object(ModelAPI_ResultBody::group(), theIndex.row());
-  case HistoryObject:
-    return partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 3); 
+    case ParamsFolder:
+    case ConstructFolder:
+    case BodiesFolder:
+      return ObjectPtr();
+    case ParamObject:
+      return partDocument()->object(ModelAPI_ResultParameters::group(), theIndex.row());
+    case ConstructObject:
+      return partDocument()->object(ModelAPI_ResultConstruction::group(), theIndex.row());
+    case BodiesObject:
+      return partDocument()->object(ModelAPI_ResultBody::group(), theIndex.row());
+    case HistoryObject:
+      return partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 3);
   }
   return ObjectPtr();
 }
@@ -456,7 +438,6 @@ bool XGUI_PartDataModel::hasDocument(const DocumentPtr& theDoc) const
   return (partDocument() == theDoc);
 }
 
-
 QModelIndex XGUI_PartDataModel::findParent(const ObjectPtr& theObject) const
 {
   return findGroup(theObject->groupName().c_str());
@@ -484,7 +465,7 @@ QModelIndex XGUI_PartDataModel::objectIndex(const ObjectPtr& theObject) const
 {
   QModelIndex aIndex;
   if (theObject) {
-    if (part() == theObject) 
+    if (part() == theObject)
       return aIndex;
 
     std::string aGroup = theObject->groupName();
@@ -500,11 +481,11 @@ QModelIndex XGUI_PartDataModel::objectIndex(const ObjectPtr& theObject) const
     if (aRow == -1)
       return aIndex;
     if (aGroup == ModelAPI_ResultParameters::group())
-        return createIndex(aRow, 0, (qint32) ParamObject);
+      return createIndex(aRow, 0, (qint32) ParamObject);
     else if (aGroup == ModelAPI_ResultConstruction::group())
-        return createIndex(aRow, 0, (qint32) ConstructObject);
+      return createIndex(aRow, 0, (qint32) ConstructObject);
     else if (aGroup == ModelAPI_ResultBody::group())
-        return createIndex(aRow, 0, (qint32) BodiesObject);
+      return createIndex(aRow, 0, (qint32) BodiesObject);
     else
       return createIndex(aRow + 3, 0, (qint32) HistoryObject);
   }
index 87e5d7f42be66cff36b017d7144180553794df5d..2dd977c10d7603f6a53846f94fbacfb3ee81c560 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifndef XGUI_PartDataModel_H
 #define XGUI_PartDataModel_H
 
@@ -12,8 +11,8 @@
  */
 class XGUI_EXPORT XGUI_TopDataModel : public XGUI_FeaturesModel
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_TopDataModel(QObject* theParent);
   virtual ~XGUI_TopDataModel();
 
@@ -25,8 +24,8 @@ public:
   virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
   virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
 
-  virtual QModelIndex index(int theRow, int theColumn, 
-                            const QModelIndex& theParent = QModelIndex()) const;
+  virtual QModelIndex index(int theRow, int theColumn, const QModelIndex& theParent =
+                                QModelIndex()) const;
 
   virtual QModelIndex parent(const QModelIndex& theIndex) const;
 
@@ -46,9 +45,10 @@ public:
   //! Returns index corresponded to the group
   virtual QModelIndex findGroup(const std::string& theGroup) const;
 
-private:
+ private:
   //! Types of QModelIndexes
-  enum DataIds {
+  enum DataIds
+  {
     ParamsFolder,
     ParamObject,
     ConstructFolder,
@@ -59,7 +59,6 @@ private:
 
 };
 
-
 /**\class XGUI_PartDataModel
  * \ingroup GUI
  * \brief This is a data model for Object Browser (QTreeView).
@@ -67,8 +66,8 @@ private:
  */
 class XGUI_PartDataModel : public XGUI_PartModel
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_PartDataModel(QObject* theParent);
   virtual ~XGUI_PartDataModel();
 
@@ -80,8 +79,8 @@ public:
   virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
   virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
 
-  virtual QModelIndex index(int theRow, int theColumn, 
-                            const QModelIndex& theParent = QModelIndex()) const;
+  virtual QModelIndex index(int theRow, int theColumn, const QModelIndex& theParent =
+                                QModelIndex()) const;
 
   virtual QModelIndex parent(const QModelIndex& theIndex) const;
 
@@ -107,13 +106,14 @@ public:
   //! Return a Part object
   virtual ResultPartPtr part() const;
 
-private: 
+ private:
 
   //! Returns document of the current part
   DocumentPtr partDocument() const;
 
   //! Types of QModelIndexes
-  enum DataIds {
+  enum DataIds
+  {
     MyRoot,
     ParamsFolder,
     ParamObject,
@@ -126,4 +126,4 @@ private:
 
 };
 
-#endif
\ No newline at end of file
+#endif
index 4df3d129632ee143a644a377f7ff0bbb5bad019c..0d3f69a12def9f15d90ccd91c1be6d92b3905995 100644 (file)
 #include <QApplication>
 #include <QDialogButtonBox>
 
-
 const QString XGUI_Preferences::VIEWER_SECTION = "Viewer";
 const QString XGUI_Preferences::MENU_SECTION = "Menu";
 
-
 SUIT_ResourceMgr* XGUI_Preferences::myResourceMgr = 0;
 
-
 SUIT_ResourceMgr* XGUI_Preferences::resourceMgr()
 {
   if (!myResourceMgr) {
@@ -41,60 +38,58 @@ bool XGUI_Preferences::editPreferences(XGUI_Prefs& theModified)
   return false;
 }
 
-
 void XGUI_Preferences::updateCustomProps()
 {
   Config_Properties aProps = Config_PropManager::getProperties();
   Config_Properties::iterator aIt;
-  for (aIt = aProps.begin(); aIt != aProps.end(); ++ aIt) {
+  for (aIt = aProps.begin(); aIt != aProps.end(); ++aIt) {
     Config_Prop* aProp = (*aIt);
-    QString aVal = myResourceMgr->stringValue(QString(aProp->section().c_str()), 
+    QString aVal = myResourceMgr->stringValue(QString(aProp->section().c_str()),
                                               QString(aProp->name().c_str()));
     if (!aVal.isNull())
       aProp->setValue(qPrintable(aVal));
   }
 }
 
-
 void XGUI_Preferences::loadCustomProps()
 {
   QStringList aSections = myResourceMgr->sections();
-  foreach (QString aSection, aSections) {
+  foreach (QString aSection, aSections)
+  {
     QStringList aParams = myResourceMgr->parameters(aSection);
-    foreach (QString aParam, aParams) {
-      Config_PropManager::registerProp(qPrintable(aSection),
-                                       qPrintable(aParam),
-                                       "", Config_Prop::Disabled, 
+    foreach (QString aParam, aParams)
+    {
+      Config_PropManager::registerProp(qPrintable(aSection), qPrintable(aParam), "",
+                                       Config_Prop::Disabled,
                                        qPrintable(myResourceMgr->stringValue(aSection, aParam)));
     }
   }
 }
 
-
-
 //**********************************************************
 //**********************************************************
 //**********************************************************
 XGUI_PreferencesDlg::XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent)
-  : QDialog(theParent), myIsChanged(false)
+    : QDialog(theParent),
+      myIsChanged(false)
 {
-  setWindowTitle( tr("Edit preferences") );
+  setWindowTitle(tr("Edit preferences"));
 
   QVBoxLayout* main = new QVBoxLayout(this);
-  main->setMargin( 5 );
-  main->setSpacing( 5 );
+  main->setMargin(5);
+  main->setSpacing(5);
 
   myPreferences = new XGUI_PreferencesMgr(theResurces, this);
-  main->addWidget( myPreferences );
+  main->addWidget(myPreferences);
 
-  setFocusProxy( myPreferences );
-  myPreferences->setFrameStyle( QFrame::Box | QFrame::Sunken );
+  setFocusProxy(myPreferences);
+  myPreferences->setFrameStyle(QFrame::Box | QFrame::Sunken);
 
-  QDialogButtonBox* aBtnBox = new QDialogButtonBox(
-    QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
+  QDialogButtonBox* aBtnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
+                                                   Qt::Horizontal, this);
   main->addWidget(aBtnBox);
   connect(aBtnBox, SIGNAL(accepted()), this, SLOT(accept()));
-  connect(aBtnBox, SIGNAL(rejected()), this, SLOT(reject()));  
+  connect(aBtnBox, SIGNAL(rejected()), this, SLOT(reject()));
   createEditors();
 
   myPreferences->retrieve();
@@ -120,51 +115,47 @@ void XGUI_PreferencesDlg::createEditors()
 
 void XGUI_PreferencesDlg::createViewerPage(int thePageId)
 {
-  int viewTab = myPreferences->addItem( tr("Viewer"), thePageId );
+  int viewTab = myPreferences->addItem(tr("Viewer"), thePageId);
 
   QStringList gradList;
-  gradList << tr("Horizontal gradient")     << tr("Vertical gradient")        <<
-              tr("First diagonal gradient") << tr("Second diagonal gradient") <<
-              tr("First corner gradient")   << tr("Second corner gradient")   <<
-              tr("Third corner gradient")   << tr("Fourth corner gradient");
-  
+  gradList << tr("Horizontal gradient") << tr("Vertical gradient") << tr("First diagonal gradient")
+           << tr("Second diagonal gradient") << tr("First corner gradient")
+           << tr("Second corner gradient") << tr("Third corner gradient")
+           << tr("Fourth corner gradient");
+
   QList<QVariant> idList;
   for (int i = 0; i < gradList.size(); i++)
     idList << i;
 
-  int bgGroup = myPreferences->addItem( tr( "Background" ), viewTab );
+  int bgGroup = myPreferences->addItem(tr("Background"), viewTab);
 
   QString aImgFiles("Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)");
 
-  int bgId = myPreferences->addItem( tr("Viewer 3d" ), bgGroup,
-                                  SUIT_PreferenceMgr::Background, 
-                                  XGUI_Preferences::VIEWER_SECTION, "background" );
-  myPreferences->setItemProperty( "gradient_names", gradList, bgId );
-  myPreferences->setItemProperty( "gradient_ids", idList, bgId );
-  myPreferences->setItemProperty( "texture_enabled", true, bgId );
-  myPreferences->setItemProperty( "texture_center_enabled", true, bgId );
-  myPreferences->setItemProperty( "texture_tile_enabled", true, bgId );
-  myPreferences->setItemProperty( "texture_stretch_enabled", true, bgId );
-  myPreferences->setItemProperty( "custom_enabled", false, bgId );
-  myPreferences->setItemProperty( "image_formats", aImgFiles, bgId );
+  int bgId = myPreferences->addItem(tr("Viewer 3d"), bgGroup, SUIT_PreferenceMgr::Background,
+                                    XGUI_Preferences::VIEWER_SECTION, "background");
+  myPreferences->setItemProperty("gradient_names", gradList, bgId);
+  myPreferences->setItemProperty("gradient_ids", idList, bgId);
+  myPreferences->setItemProperty("texture_enabled", true, bgId);
+  myPreferences->setItemProperty("texture_center_enabled", true, bgId);
+  myPreferences->setItemProperty("texture_tile_enabled", true, bgId);
+  myPreferences->setItemProperty("texture_stretch_enabled", true, bgId);
+  myPreferences->setItemProperty("custom_enabled", false, bgId);
+  myPreferences->setItemProperty("image_formats", aImgFiles, bgId);
 }
 
 void XGUI_PreferencesDlg::createMenuPage(int thePageId)
 {
-  int aMenuTab = myPreferences->addItem(tr("Main menu"), thePageId );
-
-  int aSizeGroup = myPreferences->addItem(tr("Size"), aMenuTab );
-  myPreferences->setItemProperty( "columns", 1, aSizeGroup );
-
-  int aRowsNb = myPreferences->addItem( tr( "Number of rows" ), 
-                                        aSizeGroup,
-                                        SUIT_PreferenceMgr::IntSpin, 
-                                        XGUI_Preferences::MENU_SECTION, 
-                                        "rows_number" );
-  myPreferences->setItemProperty( "min", 1, aRowsNb );
-  myPreferences->setItemProperty( "max", 6, aRowsNb );
-}
+  int aMenuTab = myPreferences->addItem(tr("Main menu"), thePageId);
+
+  int aSizeGroup = myPreferences->addItem(tr("Size"), aMenuTab);
+  myPreferences->setItemProperty("columns", 1, aSizeGroup);
 
+  int aRowsNb = myPreferences->addItem(tr("Number of rows"), aSizeGroup,
+                                       SUIT_PreferenceMgr::IntSpin, XGUI_Preferences::MENU_SECTION,
+                                       "rows_number");
+  myPreferences->setItemProperty("min", 1, aRowsNb);
+  myPreferences->setItemProperty("max", 6, aRowsNb);
+}
 
 void XGUI_PreferencesDlg::createCustomPage(int thePageId)
 {
@@ -176,8 +167,8 @@ void XGUI_PreferencesDlg::createCustomPage(int thePageId)
   std::list<std::string>::const_iterator it;
   for (it = aSections.cbegin(); it != aSections.cend(); ++it) {
     Config_Properties aProps = Config_PropManager::getProperties(*it);
-    int aTab = myPreferences->addItem(QString((*it).c_str()), thePageId );
-    myPreferences->setItemProperty( "columns", 2, aTab );
+    int aTab = myPreferences->addItem(QString((*it).c_str()), thePageId);
+    myPreferences->setItemProperty("columns", 2, aTab);
 
     Config_Properties::const_iterator aIt;
     for (aIt = aProps.cbegin(); aIt != aProps.cend(); ++aIt) {
@@ -191,15 +182,13 @@ void XGUI_PreferencesDlg::createCustomPage(int thePageId)
       }
       // Add item
       if (aProp->type() != Config_Prop::Disabled)
-        myPreferences->addItem( tr(aProp->title().c_str()), aTab,
-                                (SUIT_PreferenceMgr::PrefItemType)aProp->type(), 
-                                QString(aProp->section().c_str()), 
-                                QString(aProp->name().c_str()) );
+        myPreferences->addItem(tr(aProp->title().c_str()), aTab,
+                               (SUIT_PreferenceMgr::PrefItemType) aProp->type(),
+                               QString(aProp->section().c_str()), QString(aProp->name().c_str()));
     }
   }
 }
 
-
 void XGUI_PreferencesDlg::accept()
 {
   myPreferences->store();
@@ -210,25 +199,22 @@ void XGUI_PreferencesDlg::accept()
   QDialog::accept();
 }
 
-
 void XGUI_PreferencesDlg::modified(XGUI_Prefs& theModified) const
 {
   theModified = myPreferences->modified();
 }
 
-
-
 //**********************************************************
 //**********************************************************
 //**********************************************************
-void XGUI_PreferencesMgr::changedResources( const ResourceMap& theMap)
+void XGUI_PreferencesMgr::changedResources(const ResourceMap& theMap)
 {
   myModified.clear();
   ResourceMap::ConstIterator it;
   QString sec, param;
-  for (it = theMap.begin(); it != theMap.end(); ++it ) {
+  for (it = theMap.begin(); it != theMap.end(); ++it) {
     XGUI_Pref aPref;
-    it.key()->resource( aPref.first, aPref.second );
+    it.key()->resource(aPref.first, aPref.second);
     myModified.append(aPref);
   }
 }
index a694c34ba60446a24db62af1ba804ba9c8c924d7..7307de3ef4b034319ae1356f115537163da9a85b 100644 (file)
@@ -18,12 +18,11 @@ class QWidget;
 typedef QPair<QString, QString> XGUI_Pref;
 typedef QList<XGUI_Pref> XGUI_Prefs;
 
-
 //***********************************************************************
 /// Class for manipulation  with preferences in the application
 class XGUI_EXPORT XGUI_Preferences
 {
-public:
+ public:
   static const QString VIEWER_SECTION;
   static const QString MENU_SECTION;
 
@@ -35,7 +34,7 @@ public:
 
   static void loadCustomProps();
 
-private:
+ private:
   static SUIT_ResourceMgr* myResourceMgr;
 };
 
@@ -43,50 +42,58 @@ private:
 /// Manager of preferences
 class XGUI_EXPORT XGUI_PreferencesMgr : public SUIT_PreferenceMgr
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_PreferencesMgr(QtxResourceMgr* theResource, QWidget* theParent)
-    :SUIT_PreferenceMgr(theResource, theParent) {}
+      : SUIT_PreferenceMgr(theResource, theParent)
+  {
+  }
 
-  virtual ~XGUI_PreferencesMgr() {}
+  virtual ~XGUI_PreferencesMgr()
+  {
+  }
 
-  XGUI_Prefs modified() const { return myModified; }
+  XGUI_Prefs modified() const
+  {
+    return myModified;
+  }
 
-protected:
-  virtual void changedResources( const ResourceMap& theMap);
+ protected:
+  virtual void changedResources(const ResourceMap& theMap);
 
-private:
+ private:
   XGUI_Prefs myModified;
 };
 
-
 //***********************************************************************
 /// Dialog box for preferences editing
-class XGUI_EXPORT XGUI_PreferencesDlg: public QDialog
+class XGUI_EXPORT XGUI_PreferencesDlg : public QDialog
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent = 0);
   virtual ~XGUI_PreferencesDlg();
 
-  bool isChanged() const { return myIsChanged; }
+  bool isChanged() const
+  {
+    return myIsChanged;
+  }
 
   void modified(XGUI_Prefs& theModified) const;
 
-public slots:
+ public slots:
   virtual void accept();
 
-private:
+ private:
   void createEditors();
   void createViewerPage(int thePageId);
   void createMenuPage(int thePageId);
   void createCustomPage(int thePageId);
 
   void updateCustomProps();
-  
+
   XGUI_PreferencesMgr* myPreferences;
   bool myIsChanged;
 };
 
-
-#endif
\ No newline at end of file
+#endif
index b686fcebf3c80e4b8d4971e6576552afb47d14c4..9a6e9500c288f99d491a27974764bed34656301b 100644 (file)
@@ -22,8 +22,8 @@
 #include <iostream>
 #endif
 
-XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent) :
-QDockWidget(theParent)
+XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent)
+    : QDockWidget(theParent)
 {
   this->setWindowTitle(tr("Property Panel"));
   QAction* aViewAct = this->toggleViewAction();
@@ -72,7 +72,7 @@ XGUI_PropertyPanel::~XGUI_PropertyPanel()
 
 void XGUI_PropertyPanel::cleanContent()
 {
-  myWidgets.clear(); 
+  myWidgets.clear();
   qDeleteAll(myCustomWidget->children());
 }
 
@@ -81,21 +81,22 @@ void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& t
   myWidgets = theWidgets;
 
   if (!theWidgets.empty()) {
-    QList<ModuleBase_ModelWidget*>::const_iterator anIt = theWidgets.begin(), aLast = theWidgets.end();
+    QList<ModuleBase_ModelWidget*>::const_iterator anIt = theWidgets.begin(), aLast =
+        theWidgets.end();
     for (; anIt != aLast; anIt++) {
-      connect(*anIt, SIGNAL(keyReleased(const std::string&, QKeyEvent*)),
-              this, SIGNAL(keyReleased(const std::string&, QKeyEvent*)));
+      connect(*anIt, SIGNAL(keyReleased(const std::string&, QKeyEvent*)), this,
+              SIGNAL(keyReleased(const std::string&, QKeyEvent*)));
 
-      connect(*anIt, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)),
-              this, SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
+      connect(*anIt, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)), this,
+              SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
 
       //connect(*anIt, SIGNAL(activated(ModuleBase_ModelWidget*)),
       //        this, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)));
 
       ModuleBase_WidgetPoint2D* aPointWidget = dynamic_cast<ModuleBase_WidgetPoint2D*>(*anIt);
       if (aPointWidget)
-        connect(aPointWidget, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)),
-                this, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)));
+        connect(aPointWidget, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)), this,
+                SIGNAL(storedPoint2D(ObjectPtr, const std::string&)));
     }
     ModuleBase_ModelWidget* aLastWidget = theWidgets.last();
     if (aLastWidget) {
@@ -125,7 +126,7 @@ bool XGUI_PropertyPanel::eventFilter(QObject *theObject, QEvent *theEvent)
   QPushButton* aCancelBtn = findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
   if (theObject == anOkBtn || theObject == aCancelBtn) {
     if (theEvent->type() == QEvent::KeyRelease) {
-      QKeyEvent* aKeyEvent = (QKeyEvent*)theEvent;
+      QKeyEvent* aKeyEvent = (QKeyEvent*) theEvent;
       if (aKeyEvent && aKeyEvent->key() == Qt::Key_Return) {
         // TODO: this is enter button processing when the focus is on "Apply" or "Cancel" buttons
         emit keyReleased("", (QKeyEvent*) theEvent);
@@ -143,7 +144,8 @@ QWidget* XGUI_PropertyPanel::contentWidget()
 
 void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature)
 {
-  foreach(ModuleBase_ModelWidget* eachWidget, myWidgets) {
+  foreach(ModuleBase_ModelWidget* eachWidget, myWidgets)
+  {
     eachWidget->setFeature(theFeature);
     eachWidget->restoreValue();
   }
@@ -154,10 +156,9 @@ void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature)
 void XGUI_PropertyPanel::onActivateNextWidget(ModuleBase_ModelWidget* theWidget)
 {
   ModuleBase_ModelWidget* aNextWidget = 0;
-  QList<ModuleBase_ModelWidget*>::const_iterator anIt = myWidgets.begin(),
-                                                 aLast = myWidgets.end();
+  QList<ModuleBase_ModelWidget*>::const_iterator anIt = myWidgets.begin(), aLast = myWidgets.end();
   bool isFoundWidget = false;
-  for (;anIt != aLast && !aNextWidget; anIt++) {
+  for (; anIt != aLast && !aNextWidget; anIt++) {
     if (isFoundWidget || !theWidget) {
       if ((*anIt)->focusTo()) {
         aNextWidget = *anIt;
index 7b55b2c0f5713feefc9896af887ad6c0cb2c89d3..7331bc53136ecdec2a184c985c090f6ec397408d 100644 (file)
 class QKeyEvent;
 class QVBoxLayout;
 
-class XGUI_EXPORT XGUI_PropertyPanel: public QDockWidget
+class XGUI_EXPORT XGUI_PropertyPanel : public QDockWidget
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_PropertyPanel(QWidget* theParent);
   virtual ~XGUI_PropertyPanel();
 
@@ -31,10 +31,10 @@ public:
 
   void cleanContent();
 
-protected:
+ protected:
   virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
 
-public slots:
+ public slots:
   void updateContentWidget(FeaturePtr theFeature);
   /// slot to activate the next widget in the property panel
   /// \param theWidget a widget. The next widget should be activated
@@ -56,7 +56,7 @@ signals:
   /// \param the attribute of the feature
   void storedPoint2D(ObjectPtr theFeature, const std::string& theAttribute);
 
-private:
+ private:
   QWidget* myCustomWidget;
 
   QList<ModuleBase_ModelWidget*> myWidgets;
index 66140015ba1aacc0350ed886fe25653b5128592c..f6cf5857bf9b7d88aca08791ea7e0b7d3fd28469 100644 (file)
  */\r
 \r
 XGUI_AbstractRubberBand::XGUI_AbstractRubberBand(QWidget* theParent)\r
-    : QWidget(theParent), myPoints(), myIsClosed(false)\r
+    : QWidget(theParent),\r
+      myPoints(),\r
+      myIsClosed(false)\r
 {\r
   setAttribute(Qt::WA_TransparentForMouseEvents);\r
 #ifndef WIN32\r
   setAttribute(Qt::WA_NoSystemBackground);\r
-#endif //WIN32\r  setAttribute(Qt::WA_WState_ExplicitShowHide);\r  setVisible(false);\r  theParent->installEventFilter(this);\r
-  setGeometry(QRect(QPoint(0, 0), theParent->size()));\r
+#endif //WIN32\r  setAttribute(Qt::WA_WState_ExplicitShowHide);\r  setVisible(false);\r  theParent->installEventFilter(this);\r  setGeometry(QRect(QPoint(0, 0), theParent->size()));\r
 }\r
 \r
 /*!\r
@@ -100,7 +101,7 @@ QRegion createRegion(const QPointF& p1, const QPointF& p2)
   if (p1 == p2)\r
     return QRegion();\r
 \r
-  QLineF n = QLineF(p1, p2).normalVector(); //.unitVector();\r
+  QLineF n = QLineF(p1, p2).normalVector();  //.unitVector();\r
   n.setLength(1);\r
   n.translate(p1 * -1);\r
   QPointF nPoint = n.p2();\r
@@ -116,7 +117,7 @@ void XGUI_AbstractRubberBand::updateMask()
   QRegion r;\r
 \r
   QVectorIterator<QPoint> it(myPoints);\r
-  while(it.hasNext()) {\r
+  while (it.hasNext()) {\r
     QPoint p = it.next();\r
     if (!it.hasNext())\r
       break;\r
@@ -151,7 +152,7 @@ void XGUI_RectRubberBand::initGeometry(const QRect& theRect)
 {\r
   myPoints.clear();\r
   myPoints << theRect.topLeft() << theRect.topRight() << theRect.bottomRight()\r
-      << theRect.bottomLeft();\r
+           << theRect.bottomLeft();\r
   //setMask( QRegion( myPoints ) );\r
   updateMask();\r
 }\r
@@ -175,7 +176,7 @@ void XGUI_RectRubberBand::setEndPoint(const QPoint& thePoint)
 void XGUI_RectRubberBand::clearGeometry()\r
 {\r
   QMutableVectorIterator<QPoint> i(myPoints);\r
-  while(i.hasNext()) {\r
+  while (i.hasNext()) {\r
     i.next();\r
     i.setValue(QPoint(-1, -1));\r
   }\r
index 3f6199af9e222f8f9725b1451847227c6a0577a0..e31eafdee1a4fd9ab509fe594ec27b865815e907 100644 (file)
@@ -5,26 +5,26 @@
 #include <QWidget>
 
 /*!
 \class XGUI_AbstractRubberBand
 \ingroup GUI
 \brief Analog of class QRubberBand with possibility of creation non-rectangular contour for selection.
-  
 Currently this class does not support Style functionality in full.
-*/
-class XGUI_EXPORT XGUI_AbstractRubberBand: public QWidget
+ \class XGUI_AbstractRubberBand
+ \ingroup GUI
+ \brief Analog of class QRubberBand with possibility of creation non-rectangular contour for selection.
+ Currently this class does not support Style functionality in full.
+ */
+class XGUI_EXPORT XGUI_AbstractRubberBand : public QWidget
 {
 Q_OBJECT
-protected:
+ protected:
   XGUI_AbstractRubberBand(QWidget*);
 
-public:
+ public:
   virtual ~XGUI_AbstractRubberBand();
 
   virtual void clearGeometry();
 
   bool isClosed();
 
-protected:
+ protected:
   virtual void paintEvent(QPaintEvent*);
   virtual void showEvent(QShowEvent*);
   virtual void moveEvent(QMoveEvent*);
@@ -34,24 +34,24 @@ protected:
 
   virtual void updateMask();
 
-protected:
+ protected:
   QPolygon myPoints;
 
   bool myIsClosed;
 };
 
 /*!
 \class XGUI_RectRubberBand
 \ingroup GUI
 \brief Analog of class QRubberBand with possibility of creation non-rectangular contour for selection.
-  
 Redefinition for rectangular rubber band
-*/
-class XGUI_RectRubberBand: public XGUI_AbstractRubberBand
+ \class XGUI_RectRubberBand
+ \ingroup GUI
+ \brief Analog of class QRubberBand with possibility of creation non-rectangular contour for selection.
+ Redefinition for rectangular rubber band
+ */
+class XGUI_RectRubberBand : public XGUI_AbstractRubberBand
 {
 Q_OBJECT
 
-public:
+ public:
   XGUI_RectRubberBand(QWidget*);
   virtual ~XGUI_RectRubberBand();
 
@@ -62,11 +62,11 @@ public:
   virtual void clearGeometry();
 };
 
-class XGUI_PolyRubberBand: public XGUI_AbstractRubberBand
+class XGUI_PolyRubberBand : public XGUI_AbstractRubberBand
 {
 Q_OBJECT
 
-public:
+ public:
   XGUI_PolyRubberBand(QWidget*);
   virtual ~XGUI_PolyRubberBand();
 
index 48bb6e10f7515f81768dc034740762af94b3d2e5..58489c127b61c50d5a96ac17b2fbd37055a8e2ae 100644 (file)
@@ -10,12 +10,12 @@ class QMainWindow;
 class XGUI_SalomeViewer;
 
 /**
-* An interface which provides a connection of XGUI functionality 
-* with functionality of SALOME module interface.
-*/
+ * An interface which provides a connection of XGUI functionality 
+ * with functionality of SALOME module interface.
+ */
 class XGUI_EXPORT XGUI_SalomeConnector
 {
-public:
+ public:
   //! Creates a feature (command) in SALOME desktop
   //! \param theWBName - a workbench name
   //! \param theId - an id of the feature
@@ -25,13 +25,9 @@ public:
   //! \param isCheckable - is checkable or not
   //! \param theKeys - hot keys
   //! returns created action
-  virtual QAction* addFeature(const QString& theWBName,
-                              const QString& theId, 
-                              const QString& theTitle, 
-                              const QString& theTip,
-                              const QIcon& theIcon, 
-                              const QKeySequence& theKeys,
-                              bool isCheckable) = 0;
+  virtual QAction* addFeature(const QString& theWBName, const QString& theId,
+                              const QString& theTitle, const QString& theTip, const QIcon& theIcon,
+                              const QKeySequence& theKeys, bool isCheckable) = 0;
 
   //! Creates a command in Edit menu of SALOME desktop
   //! \param theId - an id of the feature
@@ -41,12 +37,9 @@ public:
   //! \param isCheckable - is checkable or not
   //! \param theKeys - hot keys
   //! returns created action
-  virtual QAction* addEditCommand(const QString& theId,
-                                  const QString& theTitle,
-                                  const QString& theTip,
-                                  const QIcon& theIcon, 
-                                  const QKeySequence& theKeys,
-                                  bool isCheckable) = 0;
+  virtual QAction* addEditCommand(const QString& theId, const QString& theTitle,
+                                  const QString& theTip, const QIcon& theIcon,
+                                  const QKeySequence& theKeys, bool isCheckable) = 0;
 
   //! Insert separator into Edit menu of SALOME desktop
   virtual void addEditMenuSeparator() = 0;
@@ -78,4 +71,4 @@ public:
   virtual XGUI_SalomeViewer* viewer() const = 0;
 };
 
-#endif
\ No newline at end of file
+#endif
index d35937900240d77e028ab446ff1d9101d828371d..1b3de1d1f0f51074d90a038a9a92b9ee0cf31fc9 100644 (file)
@@ -12,14 +12,17 @@ class QKeyEvent;
 class QContextMenuEvent;
 
 /**
-* A Base object for definition of connector object to
-* Salome Viewer. Reimplemented in NewGeom_SalomeViewer class
-*/
-class XGUI_EXPORT XGUI_SalomeViewer: public QObject
+ * A Base object for definition of connector object to
+ * Salome Viewer. Reimplemented in NewGeom_SalomeViewer class
+ */
+class XGUI_EXPORT XGUI_SalomeViewer : public QObject
 {
-  Q_OBJECT
-public:
-  XGUI_SalomeViewer(QObject* theParent):QObject(theParent) {}
+Q_OBJECT
+ public:
+  XGUI_SalomeViewer(QObject* theParent)
+      : QObject(theParent)
+  {
+  }
 
   //! Returns AIS_InteractiveContext from current OCCViewer
   virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
@@ -62,4 +65,4 @@ signals:
   void contextMenuRequested(QContextMenuEvent*);
 };
 
-#endif
\ No newline at end of file
+#endif
index b42f8c4b9926c24334bde2944e658ebb099a8fe6..d39e31359aff576cb559a684bc691afbb432a15c 100644 (file)
@@ -14,9 +14,8 @@
 
 #include <set>
 
-
 XGUI_Selection::XGUI_Selection(XGUI_Workshop* theWorkshop)
-: myWorkshop(theWorkshop)
+    : myWorkshop(theWorkshop)
 {
 }
 
@@ -81,7 +80,7 @@ QList<ObjectPtr> XGUI_Selection::selectedObjects() const
 {
   return myWorkshop->objectBrowser()->selectedObjects();
 }
-  
+
 QList<ObjectPtr> XGUI_Selection::selectedPresentations() const
 {
   QList<ObjectPtr> aSelectedList;
@@ -96,10 +95,9 @@ QList<ObjectPtr> XGUI_Selection::selectedPresentations() const
   return aSelectedList;
 }
 
-
 //**************************************************************
-QModelIndexList XGUI_Selection::selectedIndexes() const 
-{ 
+QModelIndexList XGUI_Selection::selectedIndexes() const
+{
   return myWorkshop->objectBrowser()->selectedIndexes();
 }
 
index dd3b48586ca5b0b0d9291a7e26bb1c50bbf91e0e..b67adbc52e34b5da5b71e46f1ea32eadae53d7de 100644 (file)
@@ -20,9 +20,9 @@
 
 class XGUI_Workshop;
 
-class XGUI_EXPORT XGUI_Selection: public ModuleBase_ISelection
+class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection
 {
-public:
+ public:
   XGUI_Selection(XGUI_Workshop* theWorkshop);
 
   /// Returns a list of viewer selected presentations
@@ -36,15 +36,15 @@ public:
   virtual std::list<ModuleBase_ViewerPrs> getHighlighted(int theShapeTypeToSkip = -1) const;
 
   /**
-  * Returns list of currently selected objects
-  */
+   * Returns list of currently selected objects
+   */
   virtual QList<ObjectPtr> selectedObjects() const;
 
   /**
-  * Returns list of currently selected results
-  */
+   * Returns list of currently selected results
+   */
   virtual QList<ObjectPtr> selectedPresentations() const;
-  
+
   //! Returns list of currently selected QModelIndexes
   virtual QModelIndexList selectedIndexes() const;
 
@@ -54,8 +54,8 @@ public:
   //! Returns list of currently selected shapes
   virtual void selectedShapes(NCollection_List<TopoDS_Shape>& theList) const;
 
-private:
+ private:
   XGUI_Workshop* myWorkshop;
 };
 
-#endif
\ No newline at end of file
+#endif
index caf78cededfa473823d177c7ad21591edcd6f852..2d37228bae86492e1b38b9abf6090d41c8075e50 100644 (file)
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Object.h>
 
-
-
-XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent) :
-  QObject(theParent), myWorkshop(theParent)
+XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent)
+    : QObject(theParent),
+      myWorkshop(theParent)
 {
   mySelection = new XGUI_Selection(myWorkshop);
 }
@@ -31,12 +30,11 @@ XGUI_SelectionMgr::~XGUI_SelectionMgr()
 //**************************************************************
 void XGUI_SelectionMgr::connectViewers()
 {
-  connect(myWorkshop->objectBrowser(), SIGNAL(selectionChanged()), 
-    this, SLOT(onObjectBrowserSelection()));
+  connect(myWorkshop->objectBrowser(), SIGNAL(selectionChanged()), this,
+          SLOT(onObjectBrowserSelection()));
 
   //Connect to other viewers
-  connect(myWorkshop->viewer(), SIGNAL(selectionChanged()),
-    this, SLOT(onViewerSelection()));
+  connect(myWorkshop->viewer(), SIGNAL(selectionChanged()), this, SLOT(onViewerSelection()));
 }
 
 //**************************************************************
@@ -68,33 +66,33 @@ void XGUI_SelectionMgr::onViewerSelection()
 
 //**************************************************************
 /*QFeatureList XGUI_SelectionMgr::selectedFeatures() const 
-{ 
 return myWorkshop->objectBrowser()->selectedFeatures(); 
-}
+ 
+ return myWorkshop->objectBrowser()->selectedFeatures(); 
+ }
 
-//**************************************************************
-QModelIndexList XGUI_SelectionMgr::selectedIndexes() const 
-{ 
 return myWorkshop->objectBrowser()->selectedIndexes();
-}
+ //**************************************************************
+ QModelIndexList XGUI_SelectionMgr::selectedIndexes() const 
+ 
+ return myWorkshop->objectBrowser()->selectedIndexes();
+ }
 
-//**************************************************************
-void XGUI_SelectionMgr::selectedAISObjects(AIS_ListOfInteractive& theList) const
-{
 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
 theList.Clear();
 for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
   theList.Append(aContext->SelectedInteractive());
-}
+ //**************************************************************
+ void XGUI_SelectionMgr::selectedAISObjects(AIS_ListOfInteractive& theList) const
+ {
+ Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+ theList.Clear();
+ for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
+ theList.Append(aContext->SelectedInteractive());
+ }
 
-//**************************************************************
-void XGUI_SelectionMgr::selectedShapes(NCollection_List<TopoDS_Shape>& theList) const
-{
 theList.Clear();
 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
 for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
   TopoDS_Shape aShape = aContext->SelectedShape();
   if (!aShape.IsNull())
     theList.Append(aShape);
 }
-}*/
+ //**************************************************************
+ void XGUI_SelectionMgr::selectedShapes(NCollection_List<TopoDS_Shape>& theList) const
+ {
+ theList.Clear();
+ Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+ for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+ TopoDS_Shape aShape = aContext->SelectedShape();
+ if (!aShape.IsNull())
+ theList.Append(aShape);
+ }
+ }*/
index 0519e29d019ef11b8f750ef3e6363b43de055e71..7a445878c73f037d2e1e54ddf63faf5dd83f610b 100644 (file)
@@ -21,12 +21,15 @@ class XGUI_Selection;
  */
 class XGUI_EXPORT XGUI_SelectionMgr : public QObject
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_SelectionMgr(XGUI_Workshop* theParent);
   virtual ~XGUI_SelectionMgr();
 
-  XGUI_Selection* selection() const { return mySelection; }
+  XGUI_Selection* selection() const
+  {
+    return mySelection;
+  }
 
   //! Connects the manager to all viewers accessible by Workshop
   void connectViewers();
@@ -35,11 +38,11 @@ signals:
   //! Emited when selection in a one of viewers was changed
   void selectionChanged();
 
-private slots:
+ private slots:
   void onObjectBrowserSelection();
   void onViewerSelection();
 
-private:
+ private:
   XGUI_Workshop* myWorkshop;
   XGUI_Selection* mySelection;
 };
index 5672163dcf06273e50eaa790bec519328784fb9b..95a219c6ae9bd3b5bede0e4c26eb7b7c9139b026 100644 (file)
@@ -9,8 +9,7 @@
 #include <iostream>
 #include <sstream>
 
-namespace XGUI_Tools
-{
+namespace XGUI_Tools {
 //******************************************************************
 QString dir(const QString& path, bool isAbs)
 {
@@ -25,7 +24,7 @@ QString dir(const QString& path, bool isAbs)
 QString file(const QString& path, bool withExt)
 {
   QString fPath = path;
-  while(!fPath.isEmpty() && (fPath[fPath.length() - 1] == '\\' || fPath[fPath.length() - 1] == '/'))
+  while (!fPath.isEmpty() && (fPath[fPath.length() - 1] == '\\' || fPath[fPath.length() - 1] == '/'))
     fPath.remove(fPath.length() - 1, 1);
 
   if (withExt)
@@ -65,7 +64,7 @@ bool isModelObject(FeaturePtr theFeature)
 //******************************************************************
 std::string featureInfo(FeaturePtr theFeature)
 {
-  std::ostringstream aStream; 
+  std::ostringstream aStream;
   if (theFeature)
     aStream << theFeature.get() << " " << theFeature->getKind();
   return QString(aStream.str().c_str()).toStdString();
@@ -73,14 +72,13 @@ std::string featureInfo(FeaturePtr theFeature)
 
 //******************************************************************
 /*FeaturePtr realFeature(const FeaturePtr theFeature)
-{
-  if (theFeature->data()) {
-    return theFeature;
-  } else {
-    ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
-    return aObject->featureRef();
-  }
-}*/
-
+ {
+ if (theFeature->data()) {
+ return theFeature;
+ } else {
+ ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
+ return aObject->featureRef();
+ }
+ }*/
 
 }
index 0ad21160aed3d7d068e7d48cc9a910a192158ba4..518d5e597f1da4c01ce8788164f6b4aaf108a40c 100644 (file)
  \param abs if true (default) \a path parameter is treated as absolute file path
  \return directory part of the file path
  */
-namespace XGUI_Tools
-{
-  QString XGUI_EXPORT dir(const QString& path, bool isAbs = true);
-
-  /*!
-   \brief Return file name part of the file path.
-
-   \param path file path
-   \param withExt if true (default) complete file name (with all
-   extension except the last) is returned, otherwise only base name
-   is returned
-   \return file name part of the file path
-   */
-  QString XGUI_EXPORT file(const QString& path, bool withExt = true);
-
-  /*!
-   \brief Return extension part of the file path.
-
-   \param path file path
-   \param full if true complete extension (all extensions, dot separated)
-   is returned, otherwise (default) only last extension is returned
-   \return extension part of the file path 
-   */
-  QString XGUI_EXPORT extension(const QString& path, bool full = false);
-
-  /*!
-   \brief Add a slash (platform-specific) to the end of \a path
-   if it is not already there.
-   \param path directory path
-   \return modified path (with slash added to the end)
-   */
-  QString XGUI_EXPORT addSlash(const QString& path);
-
-  /*! 
-   Creates a rect with TopLeft = ( min(x1,x2), min(y1,y2) )
-   and BottomRight = ( TopLeft + (x2-x1)(y2-y1) )    
-   */
-  QRect XGUI_EXPORT makeRect(const int x1, const int y1, const int x2, const int y2);
-
-  /// The model concerning tools
-
-  /*!
-   Returns true if the feature is a model object
-   \param theFeature a feature
-  */
-  bool XGUI_EXPORT isModelObject(FeaturePtr theFeature);
-
-  /*!
-   Returns the string presentation of the given feature
-   \param theFeature a feature
-  */
-  std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
+namespace XGUI_Tools {
+QString XGUI_EXPORT dir(const QString& path, bool isAbs = true);
+
+/*!
+ \brief Return file name part of the file path.
+
+ \param path file path
+ \param withExt if true (default) complete file name (with all
+ extension except the last) is returned, otherwise only base name
+ is returned
+ \return file name part of the file path
+ */
+QString XGUI_EXPORT file(const QString& path, bool withExt = true);
+
+/*!
+ \brief Return extension part of the file path.
+
+ \param path file path
+ \param full if true complete extension (all extensions, dot separated)
+ is returned, otherwise (default) only last extension is returned
+ \return extension part of the file path 
+ */
+QString XGUI_EXPORT extension(const QString& path, bool full = false);
+
+/*!
+ \brief Add a slash (platform-specific) to the end of \a path
+ if it is not already there.
+ \param path directory path
+ \return modified path (with slash added to the end)
+ */
+QString XGUI_EXPORT addSlash(const QString& path);
+
+/*! 
+ Creates a rect with TopLeft = ( min(x1,x2), min(y1,y2) )
+ and BottomRight = ( TopLeft + (x2-x1)(y2-y1) )    
+ */
+QRect XGUI_EXPORT makeRect(const int x1, const int y1, const int x2, const int y2);
+
+/// The model concerning tools
+
+/*!
+ Returns true if the feature is a model object
+ \param theFeature a feature
+ */
+bool XGUI_EXPORT isModelObject(FeaturePtr theFeature);
+
+/*!
+ Returns the string presentation of the given feature
+ \param theFeature a feature
+ */
+std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
 }
 
 #endif
index 580f4cff017428453f2d32b38a60f0bc4057dab3..c7ac791cc00bddd8a6f20a676ec4b954efd64e25 100644 (file)
@@ -5,7 +5,9 @@
  Creates invalid background data.
  */
 XGUI_ViewBackground::XGUI_ViewBackground()
-    : myTextureMode(XGUI::CenterTexture), myGradientType(XGUI::NoGradient), myTextureShown(false)
+    : myTextureMode(XGUI::CenterTexture),
+      myGradientType(XGUI::NoGradient),
+      myTextureShown(false)
 {
   setMode(XGUI::NoBackground);
 }
@@ -16,7 +18,9 @@ XGUI_ViewBackground::XGUI_ViewBackground()
  \param c color
  */
 XGUI_ViewBackground::XGUI_ViewBackground(const QColor& theColor)
-    : myTextureMode(XGUI::CenterTexture), myGradientType(XGUI::NoGradient), myTextureShown(false)
+    : myTextureMode(XGUI::CenterTexture),
+      myGradientType(XGUI::NoGradient),
+      myTextureShown(false)
 {
   setColor(theColor);
 }
@@ -31,7 +35,9 @@ XGUI_ViewBackground::XGUI_ViewBackground(const QColor& theColor)
  */
 XGUI_ViewBackground::XGUI_ViewBackground(XGUI::GradientType type, const QColor& c1,
                                          const QColor& c2)
-    : myTextureMode(XGUI::CenterTexture), myGradientType(XGUI::NoGradient), myTextureShown(false)
+    : myTextureMode(XGUI::CenterTexture),
+      myGradientType(XGUI::NoGradient),
+      myTextureShown(false)
 {
   setGradient(type, c1, c2);
 }
@@ -42,7 +48,9 @@ XGUI_ViewBackground::XGUI_ViewBackground(XGUI::GradientType type, const QColor&
  \param grad gradient data
  */
 XGUI_ViewBackground::XGUI_ViewBackground(const QGradient& grad)
-    : myTextureMode(XGUI::CenterTexture), myGradientType(XGUI::NoGradient), myTextureShown(false)
+    : myTextureMode(XGUI::CenterTexture),
+      myGradientType(XGUI::NoGradient),
+      myTextureShown(false)
 {
   setGradient(grad);
 }
index 789c3543ee5322f4744303986af983462bfde957..74528490a90decfe92e6535f9938a3732b0d37ff 100644 (file)
@@ -47,7 +47,7 @@ typedef QList<QColor> QColorList;     //!< list of colors
  */
 class XGUI_EXPORT XGUI_ViewBackground
 {
-public:
+ public:
   XGUI_ViewBackground();
   XGUI_ViewBackground(const QColor& theColor);
   XGUI_ViewBackground(XGUI::GradientType type, const QColor& theColor1, const QColor& theColor2);
@@ -96,7 +96,7 @@ public:
   const QGradient* gradient() const;
   void setGradient(const QGradient&);
 
-private:
+ private:
   XGUI::BackgroundMode myMode;
   XGUI::TextureMode myTextureMode;
   QString myFileName;
index f59055beb2b1b3605d1c779025f853aa856226c0..d5f31152b108181eba8189ee916f658800eed108 100644 (file)
@@ -1,4 +1,3 @@
-
 #include "XGUI_ViewPort.h"
 #include "XGUI_ViewWindow.h"
 #include "XGUI_Viewer.h"
@@ -28,7 +27,6 @@ static int sx = 0;
 static int sy = 0;
 static Standard_Boolean zRotation = Standard_False;
 
-
 /*!
  Create native view window for CasCade view [ static ]
  */
@@ -44,12 +42,10 @@ Handle(Aspect_Window) CreateCasWindow(const Handle(V3d_View)& view, WId winId)
   return viewWindow;
 }
 
-
 //************************************************************************
 //************************************************************************
 //************************************************************************
-XGUI_ViewPort::XGUI_ViewPort(XGUI_ViewWindow* theParent,
-                             const Handle(V3d_Viewer)& theViewer,
+XGUI_ViewPort::XGUI_ViewPort(XGUI_ViewWindow* theParent, const Handle(V3d_Viewer)& theViewer,
                              V3d_TypeOfView theType)
     : QWidget(theParent),
       myPaintersRedrawing(false),
@@ -92,7 +88,7 @@ bool XGUI_ViewPort::mapView(const Handle(V3d_View)& theView)
   if (!mapped(theView)) {
     theView->SetWindow(myWindow);
     //if (theView != activeView())
-      //theView->View()->Deactivate();
+    //theView->View()->Deactivate();
   }
 
   /* create static trihedron (16551: EDF PAL 501) */
@@ -155,78 +151,80 @@ void XGUI_ViewPort::updateBackground()
   //   single-colored).
   // In OCCT 6.5.3 all above mentioned problems are fixed; so, above comment should be removed as soon
   // as SALOME is migrated to OCCT 6.5.3. The same concerns #ifdef statements in the below code
-  switch(myBackground.mode()) {
-  case Qtx::ColorBackground: {
-    QColor c = myBackground.color();
-    if (c.isValid()) {
-      // Unset texture should be done here
-      // ...
-      Quantity_Color qCol(c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB);
-      activeView()->SetBgGradientStyle(Aspect_GFM_NONE); // cancel gradient background
-      activeView()->SetBgImageStyle(Aspect_FM_NONE); // cancel texture background
-      // then change background color
-      activeView()->SetBackgroundColor(qCol);
-      // update viewer
-      activeView()->Update();
+  switch (myBackground.mode()) {
+    case Qtx::ColorBackground: {
+      QColor c = myBackground.color();
+      if (c.isValid()) {
+        // Unset texture should be done here
+        // ...
+        Quantity_Color qCol(c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB);
+        activeView()->SetBgGradientStyle(Aspect_GFM_NONE);  // cancel gradient background
+        activeView()->SetBgImageStyle(Aspect_FM_NONE);  // cancel texture background
+        // then change background color
+        activeView()->SetBackgroundColor(qCol);
+        // update viewer
+        activeView()->Update();
+      }
+      break;
     }
-    break;
-  }
-  case Qtx::SimpleGradientBackground: {
-    QColor c1, c2;
-    int type = myBackground.gradient(c1, c2);
-    if (c1.isValid() && type >= XGUI::HorizontalGradient && type <= XGUI::LastGradient) {
-      // Unset texture should be done here
-      // ...
-      // Get colors and set-up gradiented background
-      if (!c2.isValid())
-        c2 = c1;
-      Quantity_Color qCol1(c1.red() / 255., c1.green() / 255., c1.blue() / 255., Quantity_TOC_RGB);
-      Quantity_Color qCol2(c2.red() / 255., c2.green() / 255., c2.blue() / 255., Quantity_TOC_RGB);
-      activeView()->SetBgImageStyle(Aspect_FM_NONE); // cancel texture background
-      switch(type) {
-      case XGUI::HorizontalGradient:
-        activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_HOR,
-        Standard_True);
-        break;
-      case XGUI::VerticalGradient:
-        activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_VER,
-        Standard_True);
-        break;
-      case XGUI::Diagonal1Gradient:
-        activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_DIAG1,
-        Standard_True);
-        break;
-      case XGUI::Diagonal2Gradient:
-        activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_DIAG2,
-        Standard_True);
-        break;
-      case XGUI::Corner1Gradient:
-        activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER1,
-        Standard_True);
-        break;
-      case XGUI::Corner2Gradient:
-        activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER2,
-        Standard_True);
-        break;
-      case XGUI::Corner3Gradient:
-        activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER3,
-        Standard_True);
-        break;
-      case XGUI::Corner4Gradient:
-        activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER4,
-        Standard_True);
-        break;
-      default:
-        break;
+    case Qtx::SimpleGradientBackground: {
+      QColor c1, c2;
+      int type = myBackground.gradient(c1, c2);
+      if (c1.isValid() && type >= XGUI::HorizontalGradient && type <= XGUI::LastGradient) {
+        // Unset texture should be done here
+        // ...
+        // Get colors and set-up gradiented background
+        if (!c2.isValid())
+          c2 = c1;
+        Quantity_Color qCol1(c1.red() / 255., c1.green() / 255., c1.blue() / 255.,
+                             Quantity_TOC_RGB);
+        Quantity_Color qCol2(c2.red() / 255., c2.green() / 255., c2.blue() / 255.,
+                             Quantity_TOC_RGB);
+        activeView()->SetBgImageStyle(Aspect_FM_NONE);  // cancel texture background
+        switch (type) {
+          case XGUI::HorizontalGradient:
+            activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_HOR,
+            Standard_True);
+            break;
+          case XGUI::VerticalGradient:
+            activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_VER,
+            Standard_True);
+            break;
+          case XGUI::Diagonal1Gradient:
+            activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_DIAG1,
+            Standard_True);
+            break;
+          case XGUI::Diagonal2Gradient:
+            activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_DIAG2,
+            Standard_True);
+            break;
+          case XGUI::Corner1Gradient:
+            activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER1,
+            Standard_True);
+            break;
+          case XGUI::Corner2Gradient:
+            activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER2,
+            Standard_True);
+            break;
+          case XGUI::Corner3Gradient:
+            activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER3,
+            Standard_True);
+            break;
+          case XGUI::Corner4Gradient:
+            activeView()->SetBgGradientColors(qCol1, qCol2, Aspect_GFM_CORNER4,
+            Standard_True);
+            break;
+          default:
+            break;
+        }
       }
+      break;
     }
-    break;
-  }
-  case Qtx::CustomGradientBackground:
-    // NOT IMPLEMENTED YET
-    break;
-  default:
-    break;
+    case Qtx::CustomGradientBackground:
+      // NOT IMPLEMENTED YET
+      break;
+    default:
+      break;
   }
   // VSR: In OCCT before v6.5.3 below code can't be used because of very ugly bug - it has been impossible to
   // clear the background texture image as soon as it was once set to the viewer.
@@ -236,21 +234,21 @@ void XGUI_ViewPort::updateBackground()
     QFileInfo fi(fileName);
     if (!fileName.isEmpty() && fi.exists()) {
       // set texture image: file name and fill mode
-      switch(textureMode) {
-      case XGUI::CenterTexture:
-        activeView()->SetBackgroundImage(fi.absoluteFilePath().toLatin1().constData(),
-                                         Aspect_FM_CENTERED);
-        break;
-      case XGUI::TileTexture:
-        activeView()->SetBackgroundImage(fi.absoluteFilePath().toLatin1().constData(),
-                                         Aspect_FM_TILED);
-        break;
-      case XGUI::StretchTexture:
-        activeView()->SetBackgroundImage(fi.absoluteFilePath().toLatin1().constData(),
-                                         Aspect_FM_STRETCH);
-        break;
-      default:
-        break;
+      switch (textureMode) {
+        case XGUI::CenterTexture:
+          activeView()->SetBackgroundImage(fi.absoluteFilePath().toLatin1().constData(),
+                                           Aspect_FM_CENTERED);
+          break;
+        case XGUI::TileTexture:
+          activeView()->SetBackgroundImage(fi.absoluteFilePath().toLatin1().constData(),
+                                           Aspect_FM_TILED);
+          break;
+        case XGUI::StretchTexture:
+          activeView()->SetBackgroundImage(fi.absoluteFilePath().toLatin1().constData(),
+                                           Aspect_FM_STRETCH);
+          break;
+        default:
+          break;
       }
       activeView()->Update();
     }
@@ -351,36 +349,36 @@ void XGUI_ViewPort::startRotation(int x, int y, int theRotationPointType,
                                   const gp_Pnt& theSelectedPoint)
 {
   if (!activeView().IsNull()) {
-    switch(theRotationPointType) {
-    case XGUI::GRAVITY:
-      activeView()->StartRotation(x, y, 0.45);
-      break;
-    case XGUI::SELECTED:
-      sx = x;
-      sy = y;
-
-      double X, Y;
-      activeView()->Size(X, Y);
-      rx = Standard_Real(activeView()->Convert(X));
-      ry = Standard_Real(activeView()->Convert(Y));
-
-      activeView()->Rotate(0., 0., 0., theSelectedPoint.X(), theSelectedPoint.Y(),
-                           theSelectedPoint.Z(),
-                           Standard_True);
-
-      Quantity_Ratio zRotationThreshold;
-      zRotation = Standard_False;
-      zRotationThreshold = 0.45;
-      if (zRotationThreshold > 0.) {
-        Standard_Real dx = Abs(sx - rx / 2.);
-        Standard_Real dy = Abs(sy - ry / 2.);
-        Standard_Real dd = zRotationThreshold * (rx + ry) / 2.;
-        if (dx > dd || dy > dd)
-          zRotation = Standard_True;
-      }
-      break;
-    default:
-      break;
+    switch (theRotationPointType) {
+      case XGUI::GRAVITY:
+        activeView()->StartRotation(x, y, 0.45);
+        break;
+      case XGUI::SELECTED:
+        sx = x;
+        sy = y;
+
+        double X, Y;
+        activeView()->Size(X, Y);
+        rx = Standard_Real(activeView()->Convert(X));
+        ry = Standard_Real(activeView()->Convert(Y));
+
+        activeView()->Rotate(0., 0., 0., theSelectedPoint.X(), theSelectedPoint.Y(),
+                             theSelectedPoint.Z(),
+                             Standard_True);
+
+        Quantity_Ratio zRotationThreshold;
+        zRotation = Standard_False;
+        zRotationThreshold = 0.45;
+        if (zRotationThreshold > 0.) {
+          Standard_Real dx = Abs(sx - rx / 2.);
+          Standard_Real dy = Abs(sy - ry / 2.);
+          Standard_Real dd = zRotationThreshold * (rx + ry) / 2.;
+          if (dx > dd || dy > dd)
+            zRotation = Standard_True;
+        }
+        break;
+      default:
+        break;
     }
     activeView()->DepthFitAll();
   }
@@ -392,28 +390,28 @@ void XGUI_ViewPort::startRotation(int x, int y, int theRotationPointType,
 void XGUI_ViewPort::rotate(int x, int y, int theRotationPointType, const gp_Pnt& theSelectedPoint)
 {
   if (!activeView().IsNull()) {
-    switch(theRotationPointType) {
-    case XGUI::GRAVITY:
-      activeView()->Rotation(x, y);
-      break;
-    case XGUI::SELECTED:
-      double dx, dy, dz;
-      if (zRotation) {
-        dz = atan2(Standard_Real(x) - rx / 2., ry / 2. - Standard_Real(y))
-            - atan2(sx - rx / 2., ry / 2. - sy);
-        dx = dy = 0.;
-      } else {
-        dx = (Standard_Real(x) - sx) * M_PI / rx;
-        dy = (sy - Standard_Real(y)) * M_PI / ry;
-        dz = 0.;
-      }
-
-      activeView()->Rotate(dx, dy, dz, theSelectedPoint.X(), theSelectedPoint.Y(),
-                           theSelectedPoint.Z(),
-                           Standard_False);
-      break;
-    default:
-      break;
+    switch (theRotationPointType) {
+      case XGUI::GRAVITY:
+        activeView()->Rotation(x, y);
+        break;
+      case XGUI::SELECTED:
+        double dx, dy, dz;
+        if (zRotation) {
+          dz = atan2(Standard_Real(x) - rx / 2., ry / 2. - Standard_Real(y))
+              - atan2(sx - rx / 2., ry / 2. - sy);
+          dx = dy = 0.;
+        } else {
+          dx = (Standard_Real(x) - sx) * M_PI / rx;
+          dy = (sy - Standard_Real(y)) * M_PI / ry;
+          dz = 0.;
+        }
+
+        activeView()->Rotate(dx, dy, dz, theSelectedPoint.X(), theSelectedPoint.Y(),
+                             theSelectedPoint.Z(),
+                             Standard_False);
+        break;
+      default:
+        break;
     }
     emit vpTransformed();
   }
@@ -503,52 +501,57 @@ void XGUI_ViewPort::setBackground(const Qtx::BackgroundData& bgData)
 
 void XGUI_ViewPort::fitAll(bool theKeepScale, bool theWithZ, bool theUpd)
 {
-  if ( activeView().IsNull() )
+  if (activeView().IsNull())
     return;
 
-  if ( theKeepScale )
+  if (theKeepScale)
     myScale = activeView()->Scale();
 
   Standard_Real aMargin = 0.01;
-  activeView()->FitAll( aMargin, theWithZ, theUpd );
+  activeView()->FitAll(aMargin, theWithZ, theUpd);
   activeView()->SetZSize(0.);
-  emit vpTransformed( );
+  emit vpTransformed();
 }
 
-void XGUI_ViewPort::syncronizeWith( const XGUI_ViewPort* ref )
+void XGUI_ViewPort::syncronizeWith(const XGUI_ViewPort* ref)
 {
   Handle(V3d_View) refView = ref->getView();
   Handle(V3d_View) tgtView = getView();
 
   /*  The following params are copied:
-      - view type( ortho/persp )
-      - position of view point
-      - orientation of high point
-      - position of the eye
-      - projection vector
-      - view center ( 2D )
-      - view twist
-      - view scale
-  */
+   - view type( ortho/persp )
+   - position of view point
+   - orientation of high point
+   - position of the eye
+   - projection vector
+   - view center ( 2D )
+   - view twist
+   - view scale
+   */
 
   /* we'll update after setting all params */
-  tgtView->SetImmediateUpdate( Standard_False );
+  tgtView->SetImmediateUpdate( Standard_False);
 
   /* perspective */
-  if ( refView->Type() == V3d_PERSPECTIVE )
-    tgtView->SetFocale( refView->Focale() );
+  if (refView->Type() == V3d_PERSPECTIVE)
+    tgtView->SetFocale(refView->Focale());
 
   /* copy params */
   Standard_Real x, y, z;
-  refView->At( x, y, z ); tgtView->SetAt( x, y, z );
-  refView->Up( x, y, z ); tgtView->SetUp( x, y, z );
-  refView->Eye( x, y, z ); tgtView->SetEye( x, y, z );
-  refView->Proj( x, y, z ); tgtView->SetProj( x, y, z );
-  refView->Center( x, y ); tgtView->SetCenter( x, y );
-  tgtView->SetScale( refView->Scale() );
-  tgtView->SetTwist( refView->Twist() );
+  refView->At(x, y, z);
+  tgtView->SetAt(x, y, z);
+  refView->Up(x, y, z);
+  tgtView->SetUp(x, y, z);
+  refView->Eye(x, y, z);
+  tgtView->SetEye(x, y, z);
+  refView->Proj(x, y, z);
+  tgtView->SetProj(x, y, z);
+  refView->Center(x, y);
+  tgtView->SetCenter(x, y);
+  tgtView->SetScale(refView->Scale());
+  tgtView->SetTwist(refView->Twist());
 
   /* update */
   tgtView->Update();
-  tgtView->SetImmediateUpdate( Standard_True );
+  tgtView->SetImmediateUpdate( Standard_True);
 }
index 2988e8fed69494726b90a7480fe725a7e605656d..7c2ad4b22182b3b0e9c068cc523885555be30ebe 100644 (file)
 
 class XGUI_ViewWindow;
 
-class XGUI_EXPORT XGUI_ViewPort: public QWidget
+class XGUI_EXPORT XGUI_ViewPort : public QWidget
 {
 Q_OBJECT
-public:
+ public:
   XGUI_ViewPort(XGUI_ViewWindow* theParent, const Handle(V3d_Viewer)& theViewer,
                 V3d_TypeOfView theType = V3d_ORTHOGRAPHIC);
   virtual ~XGUI_ViewPort();
@@ -60,7 +60,7 @@ public:
 
   void setBackground(const Qtx::BackgroundData& bgData);
 
-  void syncronizeWith( const XGUI_ViewPort* ref );
+  void syncronizeWith(const XGUI_ViewPort* ref);
 
 signals:
   void vpChangeBackground(const Qtx::BackgroundData&);
@@ -70,11 +70,11 @@ signals:
   void vpUpdated();
   void resized();
 
-protected:
+ protected:
   virtual void paintEvent(QPaintEvent*);
   virtual void resizeEvent(QResizeEvent*);
 
-private:
+ private:
   Handle(V3d_View) activeView() const
   {
     return myActiveView;
index c62a266524ab56dbe29c05f6a2c27b16d874c0b6..69e4f2a4acc81cfd5682dff791fcdc6acf12c5db 100644 (file)
@@ -78,9 +78,10 @@ const char* imageCrossCursor[] = { "32 32 3 1", ". c None", "a c #000000", "# c
     "................................", "................................",
     "................................", "................................" };
 
-
 ViewerToolbar::ViewerToolbar(QWidget* theParent, XGUI_ViewPort* thePort)
-  : QToolBar(theParent), myVPort(thePort), myResize(false)
+    : QToolBar(theParent),
+      myVPort(thePort),
+      myResize(false)
 {
   connect(myVPort, SIGNAL(resized()), this, SLOT(onViewPortResized()));
 }
@@ -95,8 +96,8 @@ void ViewerToolbar::paintEvent(QPaintEvent* theEvent)
   QPoint aGlobPnt = mapToGlobal(aRect.topLeft());
   QPoint aPnt = myVPort->mapFromGlobal(aGlobPnt);
 
-  QRect aImgRect(QRect(aPnt.x(), aPnt.y() + aVPRect.height() - aRect.height(),
-                       aRect.width(), aRect.height()));
+  QRect aImgRect(
+      QRect(aPnt.x(), aPnt.y() + aVPRect.height() - aRect.height(), aRect.width(), aRect.height()));
   QImage aImg = myVPort->dumpView(aImgRect, myResize);
   if (!aImg.isNull())
     aPainter.drawImage(aRect, aImg);
@@ -112,11 +113,11 @@ void ViewerToolbar::paintEvent(QPaintEvent* theEvent)
     style->drawPrimitive(QStyle::PE_IndicatorToolBarHandle, &aOpt, &aPainter, this);
 }
 
-
-
 //**************************************************************************
 ViewerLabel::ViewerLabel(QWidget* theParent, XGUI_ViewPort* thePort)
-  : QLabel(theParent), myVPort(thePort), myResize(false)
+    : QLabel(theParent),
+      myVPort(thePort),
+      myResize(false)
 {
   connect(myVPort, SIGNAL(resized()), this, SLOT(onViewPortResized()));
 }
@@ -128,8 +129,8 @@ void ViewerLabel::paintEvent(QPaintEvent* theEvent)
   QPoint aGlobPnt = mapToGlobal(aRect.topLeft());
   QPoint aPnt = myVPort->mapFromGlobal(aGlobPnt);
 
-  QRect aImgRect(QRect(aPnt.x(), aPnt.y() + aVPRect.height() - aRect.height(), 
-                 aRect.width(), aRect.height()));
+  QRect aImgRect(
+      QRect(aPnt.x(), aPnt.y() + aVPRect.height() - aRect.height(), aRect.width(), aRect.height()));
   QImage aImg = myVPort->dumpView(aImgRect, myResize);
   if (!aImg.isNull())
     QPainter(this).drawImage(aRect, aImg);
@@ -141,25 +142,34 @@ void ViewerLabel::paintEvent(QPaintEvent* theEvent)
 //**************************************************************************
 //**************************************************************************
 XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType)
-    : QFrame(), 
-    myViewer(theViewer), 
-    myMoving(false), 
-    MinimizeIco(":pictures/wnd_minimize.png"), 
-    MaximizeIco(":pictures/wnd_maximize.png"), 
-    CloseIco(":pictures/wnd_close.png"), 
-    RestoreIco(":pictures/wnd_restore.png"), 
-    myInteractionStyle(XGUI::STANDARD), 
-    myRectBand(0), 
-    myIsKeyFree(false), 
-    my2dMode(XGUI::No2dMode), 
-    myCurrPointType(XGUI::GRAVITY), 
-    myPrevPointType(XGUI::GRAVITY), 
-    myRotationPointSelection(false),
-    myClosable(true),
-    myStartX(0), myStartY(0), myCurrX(0), myCurrY(0), myCurScale(0.0), myCurSketch(0),
-    myDrawRect(false), myEnableDrawMode(false), myCursorIsHand(false), myEventStarted(false),
-    myIsActive(false),
-    myLastState(WindowNormalState), myOperation(NOTHING)
+    : QFrame(),
+      myViewer(theViewer),
+      myMoving(false),
+      MinimizeIco(":pictures/wnd_minimize.png"),
+      MaximizeIco(":pictures/wnd_maximize.png"),
+      CloseIco(":pictures/wnd_close.png"),
+      RestoreIco(":pictures/wnd_restore.png"),
+      myInteractionStyle(XGUI::STANDARD),
+      myRectBand(0),
+      myIsKeyFree(false),
+      my2dMode(XGUI::No2dMode),
+      myCurrPointType(XGUI::GRAVITY),
+      myPrevPointType(XGUI::GRAVITY),
+      myRotationPointSelection(false),
+      myClosable(true),
+      myStartX(0),
+      myStartY(0),
+      myCurrX(0),
+      myCurrY(0),
+      myCurScale(0.0),
+      myCurSketch(0),
+      myDrawRect(false),
+      myEnableDrawMode(false),
+      myCursorIsHand(false),
+      myEventStarted(false),
+      myIsActive(false),
+      myLastState(WindowNormalState),
+      myOperation(NOTHING)
 {
   mySelectedPoint = gp_Pnt(0., 0., 0.);
   setFrameStyle(QFrame::Raised);
@@ -185,14 +195,14 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType)
   QVBoxLayout* aVPLay = new QVBoxLayout(myViewPort);
   aVPLay->setMargin(0);
   aVPLay->setSpacing(0);
-  aVPLay->setContentsMargins(0,0,0,0);
+  aVPLay->setContentsMargins(0, 0, 0, 0);
 
   QHBoxLayout* aToolLay = new QHBoxLayout();
   aToolLay->setMargin(0);
   aToolLay->setSpacing(0);
-  aToolLay->setContentsMargins(0,0,0,0);
+  aToolLay->setContentsMargins(0, 0, 0, 0);
   aVPLay->addLayout(aToolLay);
-  aVPLay->addStretch(); 
+  aVPLay->addStretch();
 
   myGripWgt = new ViewerLabel(this, myViewPort);
   myGripWgt->setPixmap(QPixmap(":pictures/wnd_grip.png"));
@@ -201,10 +211,10 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType)
   myGripWgt->setCursor(Qt::OpenHandCursor);
   aToolLay->addWidget(myGripWgt);
 
-    // Create Viewer management buttons
+  // Create Viewer management buttons
   myViewBar = new ViewerToolbar(this, myViewPort);
   myViewBar->setCursor(Qt::PointingHandCursor);
-  aToolLay->addWidget(myViewBar); 
+  aToolLay->addWidget(myViewBar);
   aToolLay->addStretch();
 
   QAction* aBtn;
@@ -270,7 +280,7 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType)
   connect(aBtn, SIGNAL(triggered()), SLOT(cloneView()));
   myViewBar->addAction(aBtn);
 
-    // Create Window management buttons
+  // Create Window management buttons
   myWindowBar = new ViewerToolbar(this, myViewPort);
   myWindowBar->setCursor(Qt::PointingHandCursor);
   aToolLay->addWidget(myWindowBar);
@@ -293,8 +303,8 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType)
   //Support copy of background on updating of viewer
   connect(myViewPort, SIGNAL(vpTransformed()), this, SLOT(updateToolBar()));
   connect(myViewPort, SIGNAL(vpUpdated()), this, SLOT(updateToolBar()));
-  connect(this, SIGNAL(vpTransformationFinished(XGUI_ViewWindow::OperationType)), 
-          this, SLOT(updateToolBar()));
+  connect(this, SIGNAL(vpTransformationFinished(XGUI_ViewWindow::OperationType)), this,
+          SLOT(updateToolBar()));
 }
 
 //****************************************************************
@@ -302,7 +312,6 @@ XGUI_ViewWindow::~XGUI_ViewWindow()
 {
 }
 
-
 //****************************************************************
 void XGUI_ViewWindow::showEvent(QShowEvent* theEvent)
 {
@@ -318,7 +327,7 @@ void XGUI_ViewWindow::changeEvent(QEvent* theEvent)
     if (isMinimized()) {
       if (myPicture->isHidden()) {
         myViewBar->hide();
-        myGripWgt->hide(); 
+        myGripWgt->hide();
         myWindowBar->hide();
         myViewPort->hide();
         myPicture->show();
@@ -340,8 +349,6 @@ void XGUI_ViewWindow::changeEvent(QEvent* theEvent)
     QWidget::changeEvent(theEvent);
 }
 
-
-
 //****************************************************************
 void XGUI_ViewWindow::windowActivated()
 {
@@ -354,9 +361,10 @@ void XGUI_ViewWindow::windowActivated()
     }
     myViewBar->show();
     myWindowBar->show();
-    myGripWgt->setVisible(!(isMaximized() || isMinimized() ||
-        parentWidget()->isMaximized() || parentWidget()->isMinimized()));
-  } else 
+    myGripWgt->setVisible(
+        !(isMaximized() || isMinimized() || parentWidget()->isMaximized()
+            || parentWidget()->isMinimized()));
+  } else
     myIsActive = false;
 }
 
@@ -372,11 +380,10 @@ void XGUI_ViewWindow::windowDeactivated()
     }
     myViewBar->hide();
     myWindowBar->hide();
-    myGripWgt->hide(); 
+    myGripWgt->hide();
   }
 }
 
-
 //****************************************************************
 void XGUI_ViewWindow::onClose()
 {
@@ -397,15 +404,16 @@ void XGUI_ViewWindow::onMinimize()
   int aH = height();
   double aR = aW / 100.;
   int aNewH = int(aH / aR);
-  myPicture->setPixmap(aPMap.scaled(100,  aNewH));
+  myPicture->setPixmap(aPMap.scaled(100, aNewH));
 
-  myLastState = (isMaximized() || parentWidget()->isMaximized()) ? MaximizedState : WindowNormalState;
+  myLastState =
+      (isMaximized() || parentWidget()->isMaximized()) ? MaximizedState : WindowNormalState;
   showMinimized();
   parentWidget()->showMinimized();
   parentWidget()->setGeometry(parentWidget()->x(), parentWidget()->y(), 100, aNewH);
   parentWidget()->lower();
   windowDeactivated();
-  myViewer->onWindowMinimized((QMdiSubWindow*)parentWidget());
+  myViewer->onWindowMinimized((QMdiSubWindow*) parentWidget());
 }
 
 //****************************************************************
@@ -424,7 +432,7 @@ void XGUI_ViewWindow::onMaximize()
   }
   parentWidget()->activateWindow();
   myMinimizeBtn->setIcon(MinimizeIco);
-  
+
   //  In order to avoid frosen background in toolbars when it shown as a second view
   QTimer::singleShot(50, parentWidget(), SLOT(setFocus()));
 }
@@ -432,57 +440,57 @@ void XGUI_ViewWindow::onMaximize()
 //****************************************************************
 bool XGUI_ViewWindow::processWindowControls(QObject *theObj, QEvent *theEvent)
 {
-  switch(theEvent->type()) {
-  case QEvent::MouseButtonPress: {
-    QMouseEvent* aEvent = static_cast<QMouseEvent*>(theEvent);
-    if ((aEvent->button() == Qt::LeftButton) && (!myMoving)) {
-      myMoving = true;
-      myMousePnt = aEvent->globalPos();
-      return true;
-    }
-  }
-    break;
-  case QEvent::MouseButtonRelease: {
-    QMouseEvent* aEvent = static_cast<QMouseEvent*>(theEvent);
-    if ((aEvent->button() == Qt::LeftButton) && myMoving) {
-      myMoving = false;
-      return true;
+  switch (theEvent->type()) {
+    case QEvent::MouseButtonPress: {
+      QMouseEvent* aEvent = static_cast<QMouseEvent*>(theEvent);
+      if ((aEvent->button() == Qt::LeftButton) && (!myMoving)) {
+        myMoving = true;
+        myMousePnt = aEvent->globalPos();
+        return true;
+      }
     }
-  }
-    break;
-  case QEvent::MouseMove: {
-    QMouseEvent* aEvent = static_cast<QMouseEvent*>(theEvent);
-    if (myMoving) {
-      QMdiSubWindow* aParent = static_cast<QMdiSubWindow*>(parentWidget());
-      QMdiArea* aMDIArea = aParent->mdiArea();
-
-      QPoint aPnt = aEvent->globalPos();
-      QPoint aMDIPnt = aMDIArea->mapFromGlobal(aPnt);
-      if (aMDIArea->rect().contains(aMDIPnt)) {
-                    int aX = aParent->x() + (aPnt.x() - myMousePnt.x());
-                    int aY = aParent->y() + (aPnt.y() - myMousePnt.y());
-                    aParent->move(aX, aY);
-        myMousePnt = aPnt;
+      break;
+    case QEvent::MouseButtonRelease: {
+      QMouseEvent* aEvent = static_cast<QMouseEvent*>(theEvent);
+      if ((aEvent->button() == Qt::LeftButton) && myMoving) {
+        myMoving = false;
+        return true;
       }
-      return true;
     }
-  }
-    break;
-  case QEvent::MouseButtonDblClick:
-    if (theObj == myPicture) {
-      myMoving = false;
-      if (myLastState == MaximizedState) {
-        showMaximized();
-      } else {
-        showNormal();
+      break;
+    case QEvent::MouseMove: {
+      QMouseEvent* aEvent = static_cast<QMouseEvent*>(theEvent);
+      if (myMoving) {
+        QMdiSubWindow* aParent = static_cast<QMdiSubWindow*>(parentWidget());
+        QMdiArea* aMDIArea = aParent->mdiArea();
+
+        QPoint aPnt = aEvent->globalPos();
+        QPoint aMDIPnt = aMDIArea->mapFromGlobal(aPnt);
+        if (aMDIArea->rect().contains(aMDIPnt)) {
+          int aX = aParent->x() + (aPnt.x() - myMousePnt.x());
+          int aY = aParent->y() + (aPnt.y() - myMousePnt.y());
+          aParent->move(aX, aY);
+          myMousePnt = aPnt;
+        }
+        return true;
       }
-      myViewer->onWindowActivated((QMdiSubWindow*)parentWidget());
+    }
+      break;
+    case QEvent::MouseButtonDblClick:
+      if (theObj == myPicture) {
+        myMoving = false;
+        if (myLastState == MaximizedState) {
+          showMaximized();
+        } else {
+          showNormal();
+        }
+        myViewer->onWindowActivated((QMdiSubWindow*) parentWidget());
 
-      //  In order to avoid frosen background in toolbars when it shown as a second view
-      QTimer::singleShot(20, parentWidget(), SLOT(setFocus()));
+        //  In order to avoid frosen background in toolbars when it shown as a second view
+        QTimer::singleShot(20, parentWidget(), SLOT(setFocus()));
 
-      return true;
-    }
+        return true;
+      }
   }
   return false;
 }
@@ -490,34 +498,33 @@ bool XGUI_ViewWindow::processWindowControls(QObject *theObj, QEvent *theEvent)
 //****************************************************************
 bool XGUI_ViewWindow::processViewPort(QEvent *theEvent)
 {
-  switch(theEvent->type()) {
-  case QEvent::MouseButtonPress:
-    vpMousePressEvent((QMouseEvent*) theEvent);
-    return true;
-
-  case QEvent::MouseButtonRelease:
-    vpMouseReleaseEvent((QMouseEvent*) theEvent);
-    return true;
-
-  case QEvent::MouseMove:
-    vpMouseMoveEvent((QMouseEvent*) theEvent);
-    return true;
-
-  case QEvent::MouseButtonDblClick:
-    emit mouseDoubleClicked(this, (QMouseEvent*) theEvent);
-    return true;
-    case QEvent::Wheel:
-        {
-            QWheelEvent* aEvent = (QWheelEvent*) theEvent;
-            myViewPort->startZoomAtPoint( aEvent->x(), aEvent->y() );
-            double aDelta = (double)( aEvent->delta() ) / ( 15 * 8 );
-            int x  = aEvent->x();
-            int y  = aEvent->y();
-            int x1 = (int)( aEvent->x() + width()*aDelta/100 );
-            int y1 = (int)( aEvent->y() + height()*aDelta/100 );
-            myViewPort->zoom( x, y, x1, y1 );
-        }
-        return true;
+  switch (theEvent->type()) {
+    case QEvent::MouseButtonPress:
+      vpMousePressEvent((QMouseEvent*) theEvent);
+      return true;
+
+    case QEvent::MouseButtonRelease:
+      vpMouseReleaseEvent((QMouseEvent*) theEvent);
+      return true;
+
+    case QEvent::MouseMove:
+      vpMouseMoveEvent((QMouseEvent*) theEvent);
+      return true;
+
+    case QEvent::MouseButtonDblClick:
+      emit mouseDoubleClicked(this, (QMouseEvent*) theEvent);
+      return true;
+    case QEvent::Wheel: {
+      QWheelEvent* aEvent = (QWheelEvent*) theEvent;
+      myViewPort->startZoomAtPoint(aEvent->x(), aEvent->y());
+      double aDelta = (double) (aEvent->delta()) / (15 * 8);
+      int x = aEvent->x();
+      int y = aEvent->y();
+      int x1 = (int) (aEvent->x() + width() * aDelta / 100);
+      int y1 = (int) (aEvent->y() + height() * aDelta / 100);
+      myViewPort->zoom(x, y, x1, y1);
+    }
+      return true;
   }
   return false;
 }
@@ -575,97 +582,97 @@ void XGUI_ViewWindow::vpMousePressEvent(QMouseEvent* theEvent)
     aSwitchToZoom = getButtonState(theEvent, anInteractionStyle) == ZOOMVIEW;
   }
 
-  switch(myOperation) {
-  case WINDOWFIT:
-    if (theEvent->button() == Qt::LeftButton)
-      emit vpTransformationStarted(WINDOWFIT);
-    break;
-
-  case PANGLOBAL:
-    if (theEvent->button() == Qt::LeftButton)
-      emit vpTransformationStarted(PANGLOBAL);
-    break;
-
-  case ZOOMVIEW:
-    if (theEvent->button() == Qt::LeftButton) {
-      myViewPort->startZoomAtPoint(myStartX, myStartY);
-      emit vpTransformationStarted(ZOOMVIEW);
-    }
-    break;
-
-  case PANVIEW:
-    if (aSwitchToZoom) {
-      myViewPort->startZoomAtPoint(myStartX, myStartY);
-      activateZoom();
-    } else if (theEvent->button() == Qt::LeftButton)
-      emit vpTransformationStarted(PANVIEW);
-    break;
-
-  case ROTATE:
-    if (aSwitchToZoom) {
-      myViewPort->startZoomAtPoint(myStartX, myStartY);
-      activateZoom();
-    } else if (theEvent->button() == Qt::LeftButton) {
-      myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint);
-      emit vpTransformationStarted(ROTATE);
-    }
-    break;
-
-  default:
-    /*  Try to activate a transformation */
-    OperationType aState;
-    if (interactionStyle() == XGUI::STANDARD)
-      aState = getButtonState(theEvent, anInteractionStyle);
-    else {
-      aState = XGUI_ViewWindow::NOTHING;
-      myIsKeyFree = true;
-    }
-    switch(aState) {
+  switch (myOperation) {
+    case WINDOWFIT:
+      if (theEvent->button() == Qt::LeftButton)
+        emit vpTransformationStarted(WINDOWFIT);
+      break;
+
+    case PANGLOBAL:
+      if (theEvent->button() == Qt::LeftButton)
+        emit vpTransformationStarted(PANGLOBAL);
+      break;
+
     case ZOOMVIEW:
-      myViewPort->startZoomAtPoint(myStartX, myStartY);
-      activateZoom();
+      if (theEvent->button() == Qt::LeftButton) {
+        myViewPort->startZoomAtPoint(myStartX, myStartY);
+        emit vpTransformationStarted(ZOOMVIEW);
+      }
       break;
+
     case PANVIEW:
-      activatePanning();
+      if (aSwitchToZoom) {
+        myViewPort->startZoomAtPoint(myStartX, myStartY);
+        activateZoom();
+      } else if (theEvent->button() == Qt::LeftButton)
+        emit vpTransformationStarted(PANVIEW);
       break;
+
     case ROTATE:
-      activateRotation();
-      myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint);
+      if (aSwitchToZoom) {
+        myViewPort->startZoomAtPoint(myStartX, myStartY);
+        activateZoom();
+      } else if (theEvent->button() == Qt::LeftButton) {
+        myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint);
+        emit vpTransformationStarted(ROTATE);
+      }
       break;
+
     default:
-      if (myRotationPointSelection) {
-        if (theEvent->button() == Qt::LeftButton) {
-          Handle(AIS_InteractiveContext) ic = myViewer->AISContext();
-          ic->Select();
-          for(ic->InitSelected(); ic->MoreSelected(); ic->NextSelected()) {
-            TopoDS_Shape aShape = ic->SelectedShape();
-            if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX) {
-              gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(ic->SelectedShape()));
-              /*if ( mySetRotationPointDlg ) {
-               myRotationPointSelection = false;
-               mySetRotationPointDlg->setCoords(aPnt.X(), aPnt.Y(), aPnt.Z());
-               }*/
-            } else {
-              myCurrPointType = myPrevPointType;
-              break;
+      /*  Try to activate a transformation */
+      OperationType aState;
+      if (interactionStyle() == XGUI::STANDARD)
+        aState = getButtonState(theEvent, anInteractionStyle);
+      else {
+        aState = XGUI_ViewWindow::NOTHING;
+        myIsKeyFree = true;
+      }
+      switch (aState) {
+        case ZOOMVIEW:
+          myViewPort->startZoomAtPoint(myStartX, myStartY);
+          activateZoom();
+          break;
+        case PANVIEW:
+          activatePanning();
+          break;
+        case ROTATE:
+          activateRotation();
+          myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint);
+          break;
+        default:
+          if (myRotationPointSelection) {
+            if (theEvent->button() == Qt::LeftButton) {
+              Handle(AIS_InteractiveContext) ic = myViewer->AISContext();
+              ic->Select();
+              for (ic->InitSelected(); ic->MoreSelected(); ic->NextSelected()) {
+                TopoDS_Shape aShape = ic->SelectedShape();
+                if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX) {
+                  gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(ic->SelectedShape()));
+                  /*if ( mySetRotationPointDlg ) {
+                   myRotationPointSelection = false;
+                   mySetRotationPointDlg->setCoords(aPnt.X(), aPnt.Y(), aPnt.Z());
+                   }*/
+                } else {
+                  myCurrPointType = myPrevPointType;
+                  break;
+                }
+              }
+              if (ic->NbSelected() == 0)
+                myCurrPointType = myPrevPointType;
+              //if ( mySetRotationPointDlg ) mySetRotationPointDlg->toggleChange();
+              ic->CloseAllContexts();
+              myOperation = NOTHING;
+              myViewPort->setCursor(myCursor);
+              myCursorIsHand = false;
+              myRotationPointSelection = false;
             }
-          }
-          if (ic->NbSelected() == 0)
-            myCurrPointType = myPrevPointType;
-          //if ( mySetRotationPointDlg ) mySetRotationPointDlg->toggleChange();
-          ic->CloseAllContexts();
-          myOperation = NOTHING;
-          myViewPort->setCursor(myCursor);
-          myCursorIsHand = false;
-          myRotationPointSelection = false;
-        }
-      } else
-        emit mousePressed(this, theEvent);
-      break;
-    }
-    /* notify that we start a transformation */
-    if (transformRequested())
-      emit vpTransformationStarted(myOperation);
+          } else
+            emit mousePressed(this, theEvent);
+          break;
+      }
+      /* notify that we start a transformation */
+      if (transformRequested())
+        emit vpTransformationStarted(myOperation);
   }
   if (transformRequested())
     setTransformInProcess(true);
@@ -689,51 +696,51 @@ void XGUI_ViewWindow::contextMenuEvent(QContextMenuEvent* theEvent)
 //****************************************************************
 void XGUI_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent)
 {
-  switch(myOperation) {
-  case NOTHING: {
-    int prevState = myCurSketch;
-    /*            if(theEvent->button() == Qt::RightButton) {
-     QList<OCCViewer_ViewSketcher*>::Iterator it;
-     for ( it = mySketchers.begin(); it != mySketchers.end() && myCurSketch != -1; ++it ) {
-     OCCViewer_ViewSketcher* sk = (*it);
-     if( ( sk->sketchButton() & theEvent->button() ) && sk->sketchButton() == myCurSketch )
-     myCurSketch = -1;
-     }
-     }
-     */
-    emit mouseReleased(this, theEvent);
-  }
-    break;
-  case ROTATE:
-    myViewPort->endRotation();
-    resetState();
-    break;
-
-  case PANVIEW:
-  case ZOOMVIEW:
-    resetState();
-    break;
-
-  case PANGLOBAL:
-    if (theEvent->button() == Qt::LeftButton) {
-      myViewPort->setCenter(theEvent->x(), theEvent->y());
-      myViewPort->getView()->SetScale(myCurScale);
-      resetState();
+  switch (myOperation) {
+    case NOTHING: {
+      int prevState = myCurSketch;
+      /*            if(theEvent->button() == Qt::RightButton) {
+       QList<OCCViewer_ViewSketcher*>::Iterator it;
+       for ( it = mySketchers.begin(); it != mySketchers.end() && myCurSketch != -1; ++it ) {
+       OCCViewer_ViewSketcher* sk = (*it);
+       if( ( sk->sketchButton() & theEvent->button() ) && sk->sketchButton() == myCurSketch )
+       myCurSketch = -1;
+       }
+       }
+       */
+      emit mouseReleased(this, theEvent);
     }
-    break;
-
-  case WINDOWFIT:
-    if (theEvent->button() == Qt::LeftButton) {
-      myCurrX = theEvent->x();
-      myCurrY = theEvent->y();
-      drawRect();
-      QRect rect = XGUI_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY);
-      if (!rect.isEmpty())
-        myViewPort->fitRect(rect);
-      endDrawRect();
+      break;
+    case ROTATE:
+      myViewPort->endRotation();
       resetState();
-    }
-    break;
+      break;
+
+    case PANVIEW:
+    case ZOOMVIEW:
+      resetState();
+      break;
+
+    case PANGLOBAL:
+      if (theEvent->button() == Qt::LeftButton) {
+        myViewPort->setCenter(theEvent->x(), theEvent->y());
+        myViewPort->getView()->SetScale(myCurScale);
+        resetState();
+      }
+      break;
+
+    case WINDOWFIT:
+      if (theEvent->button() == Qt::LeftButton) {
+        myCurrX = theEvent->x();
+        myCurrY = theEvent->y();
+        drawRect();
+        QRect rect = XGUI_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY);
+        if (!rect.isEmpty())
+          myViewPort->fitRect(rect);
+        endDrawRect();
+        resetState();
+      }
+      break;
   }
 
   // NOTE: viewer 3D detects a rectangle of selection using this event
@@ -755,97 +762,97 @@ void XGUI_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent)
 {
   if (myIsKeyFree && interactionStyle() == XGUI::KEY_FREE) {
     myIsKeyFree = false;
-    switch(getButtonState(theEvent, interactionStyle())) {
+    switch (getButtonState(theEvent, interactionStyle())) {
+      case ZOOMVIEW:
+        myViewPort->startZoomAtPoint(myStartX, myStartY);
+        activateZoom();
+        break;
+      case PANVIEW:
+        activatePanning();
+        break;
+      case ROTATE:
+        activateRotation();
+        myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint);
+        break;
+      default:
+        break;
+    }
+  }
+
+  myCurrX = theEvent->x();
+  myCurrY = theEvent->y();
+  switch (myOperation) {
+    case ROTATE:
+      myViewPort->rotate(myCurrX, myCurrY, myCurrPointType, mySelectedPoint);
+      break;
+
     case ZOOMVIEW:
-      myViewPort->startZoomAtPoint(myStartX, myStartY);
-      activateZoom();
+      myViewPort->zoom(myStartX, myStartY, myCurrX, myCurrY);
+      myStartX = myCurrX;
+      myStartY = myCurrY;
       break;
+
     case PANVIEW:
-      activatePanning();
-      break;
-    case ROTATE:
-      activateRotation();
-      myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint);
+      myViewPort->pan(myCurrX - myStartX, myStartY - myCurrY);
+      myStartX = myCurrX;
+      myStartY = myCurrY;
       break;
-    default:
+
+    case PANGLOBAL:
       break;
-    }
-  }
 
-  myCurrX = theEvent->x();
-  myCurrY = theEvent->y();
-  switch(myOperation) {
-  case ROTATE:
-    myViewPort->rotate(myCurrX, myCurrY, myCurrPointType, mySelectedPoint);
-    break;
-
-  case ZOOMVIEW:
-    myViewPort->zoom(myStartX, myStartY, myCurrX, myCurrY);
-    myStartX = myCurrX;
-    myStartY = myCurrY;
-    break;
-
-  case PANVIEW:
-    myViewPort->pan(myCurrX - myStartX, myStartY - myCurrY);
-    myStartX = myCurrX;
-    myStartY = myCurrY;
-    break;
-
-  case PANGLOBAL:
-    break;
-
-  default:
-    if (myRotationPointSelection /*|| isSketcherStyle()*/) {
-      emit mouseMoving(this, theEvent);
-    } else {
-      int aState = theEvent->modifiers();
-      int aButton = theEvent->buttons();
-      int anInteractionStyle = interactionStyle();
-      if (((anInteractionStyle == XGUI::STANDARD) && (aButton == Qt::LeftButton)
-          && (aState == Qt::NoModifier || Qt::ShiftModifier))
-          || ((anInteractionStyle == XGUI::KEY_FREE) && (aButton == Qt::LeftButton)
-              && (aState == Qt::ControlModifier
-                  || aState == (Qt::ControlModifier | Qt::ShiftModifier)))) {
-        myDrawRect = myEnableDrawMode;
-        if (myDrawRect) {
-          drawRect();
-          if (!myCursorIsHand) {   // we are going to sketch a rectangle
-            QCursor handCursor(Qt::PointingHandCursor);
-            myCursorIsHand = true;
-            myCursor = cursor();
-            myViewPort->setCursor(handCursor);
-          }
-        }
-        emit mouseMoving(this, theEvent);
-      } /* else if ( ( (anInteractionStyle == XGUI::STANDARD) &&
-       (aButton == Qt::RightButton) && 
-       ( aState == Qt::NoModifier || Qt::ShiftModifier ) ) ||
-       ( (anInteractionStyle == XGUI::KEY_FREE) &&
-       (aButton == Qt::RightButton) && 
-       ( aState == Qt::ControlModifier || aState == ( Qt::ControlModifier|Qt::ShiftModifier ) ) ) ) {
-       OCCViewer_ViewSketcher* sketcher = 0;
-       QList<OCCViewer_ViewSketcher*>::Iterator it;
-       for ( it = mySketchers.begin(); it != mySketchers.end() && !sketcher; ++it ) {
-       OCCViewer_ViewSketcher* sk = (*it);
-       if( sk->isDefault() && sk->sketchButton() == aButton )
-       sketcher = sk;
-       }
-       if ( sketcher && myCurSketch == -1 ) {
-       activateSketching( sketcher->type() );
-       if ( mypSketcher ) {
-       myCurSketch = mypSketcher->sketchButton();
-
-       if ( l_mbPressEvent )  {
-       QApplication::sendEvent( getViewPort(), l_mbPressEvent );
-       delete l_mbPressEvent;
-       l_mbPressEvent = 0;
-       }
-       QApplication::sendEvent( getViewPort(), theEvent );
-       }
-       }
-       } */else
+    default:
+      if (myRotationPointSelection /*|| isSketcherStyle()*/) {
         emit mouseMoving(this, theEvent);
-    }
+      } else {
+        int aState = theEvent->modifiers();
+        int aButton = theEvent->buttons();
+        int anInteractionStyle = interactionStyle();
+        if (((anInteractionStyle == XGUI::STANDARD) && (aButton == Qt::LeftButton)
+            && (aState == Qt::NoModifier || Qt::ShiftModifier))
+            || ((anInteractionStyle == XGUI::KEY_FREE) && (aButton == Qt::LeftButton)
+                && (aState == Qt::ControlModifier
+                    || aState == (Qt::ControlModifier | Qt::ShiftModifier)))) {
+          myDrawRect = myEnableDrawMode;
+          if (myDrawRect) {
+            drawRect();
+            if (!myCursorIsHand) {   // we are going to sketch a rectangle
+              QCursor handCursor(Qt::PointingHandCursor);
+              myCursorIsHand = true;
+              myCursor = cursor();
+              myViewPort->setCursor(handCursor);
+            }
+          }
+          emit mouseMoving(this, theEvent);
+        } /* else if ( ( (anInteractionStyle == XGUI::STANDARD) &&
+         (aButton == Qt::RightButton) && 
+         ( aState == Qt::NoModifier || Qt::ShiftModifier ) ) ||
+         ( (anInteractionStyle == XGUI::KEY_FREE) &&
+         (aButton == Qt::RightButton) && 
+         ( aState == Qt::ControlModifier || aState == ( Qt::ControlModifier|Qt::ShiftModifier ) ) ) ) {
+         OCCViewer_ViewSketcher* sketcher = 0;
+         QList<OCCViewer_ViewSketcher*>::Iterator it;
+         for ( it = mySketchers.begin(); it != mySketchers.end() && !sketcher; ++it ) {
+         OCCViewer_ViewSketcher* sk = (*it);
+         if( sk->isDefault() && sk->sketchButton() == aButton )
+         sketcher = sk;
+         }
+         if ( sketcher && myCurSketch == -1 ) {
+         activateSketching( sketcher->type() );
+         if ( mypSketcher ) {
+         myCurSketch = mypSketcher->sketchButton();
+
+         if ( l_mbPressEvent )  {
+         QApplication::sendEvent( getViewPort(), l_mbPressEvent );
+         delete l_mbPressEvent;
+         l_mbPressEvent = 0;
+         }
+         QApplication::sendEvent( getViewPort(), theEvent );
+         }
+         }
+         } */else
+          emit mouseMoving(this, theEvent);
+      }
   }
 }
 
@@ -943,22 +950,22 @@ void XGUI_ViewWindow::activatePanning()
 }
 
 /*!
 \brief Start global panning operation
+ \brief Start global panning operation
 
 Sets the corresponding cursor for the widget.
-*/
+ Sets the corresponding cursor for the widget.
+ */
 void XGUI_ViewWindow::activateGlobalPanning()
 {
   Handle(V3d_View) aView3d = myViewPort->getView();
-  if ( !aView3d.IsNull() ) {
-    QPixmap globalPanPixmap (imageCrossCursor);
-    QCursor glPanCursor (globalPanPixmap);
+  if (!aView3d.IsNull()) {
+    QPixmap globalPanPixmap(imageCrossCursor);
+    QCursor glPanCursor(globalPanPixmap);
     myCurScale = aView3d->Scale();
     aView3d->FitAll(0.01, false);
     myCursor = cursor();                // save old cursor
-    myViewPort->fitAll(); // fits view before selecting a new scene center
-    if( setTransformRequested( PANGLOBAL ) )
-      myViewPort->setCursor( glPanCursor );
+    myViewPort->fitAll();  // fits view before selecting a new scene center
+    if (setTransformRequested(PANGLOBAL))
+      myViewPort->setCursor(glPanCursor);
   }
 }
 
@@ -1011,20 +1018,20 @@ Qtx::BackgroundData XGUI_ViewWindow::background() const
 
 void XGUI_ViewWindow::setBackground(const Qtx::BackgroundData& theBackground)
 {
-  if (myViewPort) 
-       myViewPort->setBackground( theBackground );
+  if (myViewPort)
+    myViewPort->setBackground(theBackground);
 }
 
 /*!
  \brief Create one more window with same content.
-*/
+ \brief Create one more window with same content.
+ */
 void XGUI_ViewWindow::cloneView()
 {
   QMdiSubWindow* vw = myViewer->createView();
   XGUI_ViewWindow* aNewWnd = static_cast<XGUI_ViewWindow*>(vw->widget());
   aNewWnd->viewPort()->syncronizeWith(myViewPort);
 
-  emit viewCloned( vw );
+  emit viewCloned(vw);
 
   //  In order to avoid frosen background in toolbars when it shown as a second view
   QTimer::singleShot(20, vw, SLOT(setFocus()));
@@ -1034,15 +1041,16 @@ void XGUI_ViewWindow::dumpView()
 {
   QString aFilter(tr("Images Files (*.bmp *.png *.jpg *.jpeg *.eps *.ps)"));
   QString aSelectedFilter;
-  QString aFileName = QFileDialog::getSaveFileName(this, "Save picture", QString(), aFilter, &aSelectedFilter);
+  QString aFileName = QFileDialog::getSaveFileName(this, "Save picture", QString(), aFilter,
+                                                   &aSelectedFilter);
   if (!aFileName.isNull()) {
-    QApplication::setOverrideCursor( Qt::WaitCursor );
+    QApplication::setOverrideCursor(Qt::WaitCursor);
     QImage aPicture = myViewPort->dumpView();
 
     QString aFmt = XGUI_Tools::extension(aFileName).toUpper();
-    if( aFmt.isEmpty() )
-      aFmt = QString( "BMP" ); // default format
-    else if( aFmt == "JPG" )
+    if (aFmt.isEmpty())
+      aFmt = QString("BMP");  // default format
+    else if (aFmt == "JPG")
       aFmt = "JPEG";
 
     Handle(Visual3d_View) a3dView = myViewPort->getView()->View();
@@ -1051,128 +1059,126 @@ void XGUI_ViewWindow::dumpView()
     else if (aFmt == "EPS")
       a3dView->Export(strdup(qPrintable(aFileName)), Graphic3d_EF_EnhPostScript);
     else
-      aPicture.save( aFileName, aFmt.toLatin1() );
+      aPicture.save(aFileName, aFmt.toLatin1());
     QApplication::restoreOverrideCursor();
   }
 }
 
 void XGUI_ViewWindow::fitAll()
 {
-  emit vpTransformationStarted( FITALLVIEW );
+  emit vpTransformationStarted(FITALLVIEW);
   myViewPort->fitAll();
-  emit vpTransformationFinished( FITALLVIEW );
+  emit vpTransformationFinished(FITALLVIEW);
 }
 
 /*!
 \brief Starts fit operation.
+ \brief Starts fit operation.
 
 Sets the corresponding cursor for the widget.
-*/
+ Sets the corresponding cursor for the widget.
+ */
 void XGUI_ViewWindow::activateWindowFit()
 {
-  if ( !transformRequested() && !myCursorIsHand )
-    myCursor = cursor();                /* save old cursor */
+  if (!transformRequested() && !myCursorIsHand)
+    myCursor = cursor(); /* save old cursor */
 
-  if ( myOperation != WINDOWFIT ) {
-    QCursor handCursor (Qt::PointingHandCursor);
-    if( setTransformRequested ( WINDOWFIT ) ) {
-      myViewPort->setCursor ( handCursor );
+  if (myOperation != WINDOWFIT) {
+    QCursor handCursor(Qt::PointingHandCursor);
+    if (setTransformRequested(WINDOWFIT)) {
+      myViewPort->setCursor(handCursor);
       myCursorIsHand = true;
     }
   }
 }
 
-
 /*!
 \brief Perform "front view" transformation.
-*/
+ \brief Perform "front view" transformation.
+ */
 void XGUI_ViewWindow::frontView()
 {
-  emit vpTransformationStarted ( FRONTVIEW );
+  emit vpTransformationStarted(FRONTVIEW);
   Handle(V3d_View) aView3d = myViewPort->getView();
-  if ( !aView3d.IsNull() ) 
-    aView3d->SetProj (V3d_Xpos);
+  if (!aView3d.IsNull())
+    aView3d->SetProj(V3d_Xpos);
   myViewPort->fitAll();
-  emit vpTransformationFinished ( FRONTVIEW );
+  emit vpTransformationFinished(FRONTVIEW);
 }
 
 /*!
 \brief Perform "back view" transformation.
-*/
+ \brief Perform "back view" transformation.
+ */
 void XGUI_ViewWindow::backView()
 {
-  emit vpTransformationStarted ( BACKVIEW );
+  emit vpTransformationStarted(BACKVIEW);
   Handle(V3d_View) aView3d = myViewPort->getView();
-  if ( !aView3d.IsNull() ) 
-    aView3d->SetProj (V3d_Xneg);
+  if (!aView3d.IsNull())
+    aView3d->SetProj(V3d_Xneg);
   myViewPort->fitAll();
-  emit vpTransformationFinished ( BACKVIEW );
+  emit vpTransformationFinished(BACKVIEW);
 }
 
 /*!
 \brief Perform "top view" transformation.
-*/
+ \brief Perform "top view" transformation.
+ */
 void XGUI_ViewWindow::topView()
 {
-  emit vpTransformationStarted ( TOPVIEW );
+  emit vpTransformationStarted(TOPVIEW);
   Handle(V3d_View) aView3d = myViewPort->getView();
-  if ( !aView3d.IsNull() ) 
-    aView3d->SetProj (V3d_Zpos);
+  if (!aView3d.IsNull())
+    aView3d->SetProj(V3d_Zpos);
   myViewPort->fitAll();
-  emit vpTransformationFinished ( TOPVIEW );
+  emit vpTransformationFinished(TOPVIEW);
 }
 
 /*!
 \brief Perform "bottom view" transformation.
-*/
+ \brief Perform "bottom view" transformation.
+ */
 void XGUI_ViewWindow::bottomView()
 {
-  emit vpTransformationStarted ( BOTTOMVIEW );
+  emit vpTransformationStarted(BOTTOMVIEW);
   Handle(V3d_View) aView3d = myViewPort->getView();
-  if ( !aView3d.IsNull() ) 
-    aView3d->SetProj (V3d_Zneg);
+  if (!aView3d.IsNull())
+    aView3d->SetProj(V3d_Zneg);
   myViewPort->fitAll();
-  emit vpTransformationFinished ( BOTTOMVIEW );
+  emit vpTransformationFinished(BOTTOMVIEW);
 }
 
 /*!
 \brief Perform "left view" transformation.
-*/
+ \brief Perform "left view" transformation.
+ */
 void XGUI_ViewWindow::leftView()
 {
-  emit vpTransformationStarted ( LEFTVIEW );
+  emit vpTransformationStarted(LEFTVIEW);
   Handle(V3d_View) aView3d = myViewPort->getView();
-  if ( !aView3d.IsNull() ) 
-    aView3d->SetProj (V3d_Yneg);
+  if (!aView3d.IsNull())
+    aView3d->SetProj(V3d_Yneg);
   myViewPort->fitAll();
-  emit vpTransformationFinished ( LEFTVIEW );
+  emit vpTransformationFinished(LEFTVIEW);
 }
 
 /*!
 \brief Perform "right view" transformation.
-*/
+ \brief Perform "right view" transformation.
+ */
 void XGUI_ViewWindow::rightView()
 {
-  emit vpTransformationStarted ( RIGHTVIEW );
+  emit vpTransformationStarted(RIGHTVIEW);
   Handle(V3d_View) aView3d = myViewPort->getView();
-  if ( !aView3d.IsNull() ) 
-    aView3d->SetProj (V3d_Ypos);
+  if (!aView3d.IsNull())
+    aView3d->SetProj(V3d_Ypos);
   myViewPort->fitAll();
-  emit vpTransformationFinished ( RIGHTVIEW );
+  emit vpTransformationFinished(RIGHTVIEW);
 }
 
 void XGUI_ViewWindow::reset()
 {
-  emit vpTransformationStarted( RESETVIEW );
-  bool upd = myViewPort->getView()->SetImmediateUpdate( false );
-  myViewPort->getView()->Reset( false );
-  myViewPort->fitAll( false, true, false );
-  myViewPort->getView()->SetImmediateUpdate( upd );
+  emit vpTransformationStarted(RESETVIEW);
+  bool upd = myViewPort->getView()->SetImmediateUpdate(false);
+  myViewPort->getView()->Reset(false);
+  myViewPort->fitAll(false, true, false);
+  myViewPort->getView()->SetImmediateUpdate(upd);
   myViewPort->getView()->Update();
-  emit vpTransformationFinished( RESETVIEW );
+  emit vpTransformationFinished(RESETVIEW);
 }
 
-
 void XGUI_ViewWindow::updateToolBar()
 {
   myGripWgt->update();
@@ -1181,10 +1187,9 @@ void XGUI_ViewWindow::updateToolBar()
 }
 
 /*!
 \brief Update state of enable draw mode state.
-*/
+ \brief Update state of enable draw mode state.
+ */
 void XGUI_ViewWindow::updateEnabledDrawMode()
 {
-  myEnableDrawMode = myViewer->isSelectionEnabled() && 
-                     myViewer->isMultiSelectionEnabled();
+  myEnableDrawMode = myViewer->isSelectionEnabled() && myViewer->isMultiSelectionEnabled();
 }
index 016c261d969f0402b77113db4edd06379d2d2ca8..bd2aef20eacc7f510421e0608527ba68bb89d541 100644 (file)
@@ -23,16 +23,16 @@ class XGUI_RectRubberBand;
 class QMdiSubWindow;
 
 /*!
 \class XGUI_ViewWindow
 \ingroup GUI
 \brief Implements a one view window of 3d viewer object.
 It contains a view port object (drawing area) and toolbars for view camera and window management.
 Also it managements events in view port
-*/
-class XGUI_EXPORT XGUI_ViewWindow: public QFrame
+ \class XGUI_ViewWindow
+ \ingroup GUI
+ \brief Implements a one view window of 3d viewer object.
+ It contains a view port object (drawing area) and toolbars for view camera and window management.
+ Also it managements events in view port
+ */
+class XGUI_EXPORT XGUI_ViewWindow : public QFrame
 {
 Q_OBJECT
-public:
+ public:
   //! Types of viewer operations
   enum OperationType
   {
@@ -83,16 +83,28 @@ public:
   void setBackground(const Qtx::BackgroundData& theBackground);
 
   //! Returns true if the current view window can be closed
-  bool closable() const { return myClosable; }
+  bool closable() const
+  {
+    return myClosable;
+  }
 
   //! Sets the current view window closable or not
-  void setClosable( const bool isClosable ) { myClosable = isClosable; }
+  void setClosable(const bool isClosable)
+  {
+    myClosable = isClosable;
+  }
 
   //! Enable/Disable drawing of ribbon line
-  void enableDrawMode(bool toEnable) { myEnableDrawMode = toEnable; }
+  void enableDrawMode(bool toEnable)
+  {
+    myEnableDrawMode = toEnable;
+  }
 
   //! Returns true if ribbon line drawing enabled
-  bool isDrawModeEnabled() const { return myEnableDrawMode; }
+  bool isDrawModeEnabled() const
+  {
+    return myEnableDrawMode;
+  }
 
   //! Updates drawing mode in the view window
   void updateEnabledDrawMode();
@@ -113,7 +125,7 @@ signals:
   void tryClosing(XGUI_ViewWindow*);
 
   //! Emited when window is closing
-  void closed( QMdiSubWindow* );
+  void closed(QMdiSubWindow*);
 
   //! Emited on mouse press in view port
   void mousePressed(XGUI_ViewWindow*, QMouseEvent*);
@@ -126,20 +138,20 @@ signals:
 
   //! Emited on mouse moving in view port
   void mouseMoving(XGUI_ViewWindow*, QMouseEvent*);
+
   //! Emited on key press in view port
   void keyPressed(XGUI_ViewWindow*, QKeyEvent*);
+
   //! Emited on key release in view port
   void keyReleased(XGUI_ViewWindow*, QKeyEvent*);
+
   //! Emited on context menu request in view port
   void contextMenuRequested(QContextMenuEvent *e);
 
   //void viewModified(XGUI_ViewWindow*);
-  void viewCloned( QMdiSubWindow* theView );
+  void viewCloned(QMdiSubWindow* theView);
 
-public slots:
+ public slots:
   //! Start zooming operation
   void activateZoom();
 
@@ -189,7 +201,7 @@ public slots:
 
   void windowDeactivated();
 
-protected:
+ protected:
   virtual void changeEvent(QEvent* theEvent);
 
   virtual bool eventFilter(QObject *theObj, QEvent *theEvent);
@@ -198,7 +210,7 @@ protected:
 
   virtual void contextMenuEvent(QContextMenuEvent* theEvent);
 
-private slots:
+ private slots:
   void onClose();
   void onMinimize();
   void onMaximize();
@@ -206,7 +218,7 @@ private slots:
   void updateToolBar();
 //  void repaintToolBar();
 
-private:
+ private:
   enum WindowState
   {
     MinimizedState,
@@ -240,7 +252,7 @@ private:
     myEventStarted = bOn;
   }
 
-private:
+ private:
   XGUI_Viewer* myViewer;
 
   QLabel* myPicture;
@@ -287,7 +299,7 @@ private:
 
   gp_Pnt mySelectedPoint;
 
-  XGUI_RectRubberBand* myRectBand; //!< selection rectangle rubber band
+  XGUI_RectRubberBand* myRectBand;  //!< selection rectangle rubber band
 
   typedef QMap<OperationType, bool> MapOfTransformStatus;
   MapOfTransformStatus myStatus;
@@ -297,48 +309,52 @@ private:
 
 //******************************************************
 /*!
 \class ViewerToolbar
 \ingroup GUI
 \brief Provides a toolbar widget with treansparent background over OCCT View window
-*/
-class ViewerToolbar: public QToolBar
+ \class ViewerToolbar
+ \ingroup GUI
+ \brief Provides a toolbar widget with treansparent background over OCCT View window
+ */
+class ViewerToolbar : public QToolBar
 {
 Q_OBJECT
-public:
+ public:
   ViewerToolbar(QWidget* theParent, XGUI_ViewPort* thePort);
 
-protected slots:
-  void onViewPortResized() { myResize = true; }
+ protected slots:
+  void onViewPortResized()
+  {
+    myResize = true;
+  }
 
-protected:
+ protected:
   virtual void paintEvent(QPaintEvent* theEvent);
 
-
-
-private:
+ private:
   XGUI_ViewPort* myVPort;
   bool myResize;
 };
 
 //******************************************************
 /*!
 \class ViewerToolbar
 \ingroup GUI
 \brief Provides a Label widget with treansparent background over OCCT View window
-*/
-class ViewerLabel: public QLabel
+ \class ViewerToolbar
+ \ingroup GUI
+ \brief Provides a Label widget with treansparent background over OCCT View window
+ */
+class ViewerLabel : public QLabel
 {
 Q_OBJECT
-public:
+ public:
   ViewerLabel(QWidget* theParent, XGUI_ViewPort* thePort);
 
-protected slots:
-  void onViewPortResized() { myResize = true; }
+ protected slots:
+  void onViewPortResized()
+  {
+    myResize = true;
+  }
 
-protected:
+ protected:
   virtual void paintEvent(QPaintEvent* theEvent);
 
-private:
+ private:
   XGUI_ViewPort* myVPort;
   bool myResize;
 };
index e605d2a07b9f2a1249a493c6df7580e807dedbd7..a2864475b963179cd6ee7bed4b6ed4d94d89dbe6 100644 (file)
@@ -27,7 +27,6 @@
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <AIS_Shape.hxx>
 
-
 #ifdef WIN32
 #include <WNT_Window.hxx>
 #else
@@ -71,13 +70,13 @@ Handle(V3d_Viewer) CreateViewer(const Standard_ExtString name, const Standard_CS
  */
 QString XGUI_Viewer::backgroundData(QStringList& gradList, QIntList& idList, QIntList& txtList)
 {
-  gradList << tr("Horizontal gradient") << tr("Vertical gradient")
-      << tr("First diagonal gradient") << tr("Second diagonal gradient")
-      << tr("First corner gradient") << tr("Second corner gradient")
-      << tr("Third corner gradient") << tr("Fourth corner gradient");
+  gradList << tr("Horizontal gradient") << tr("Vertical gradient") << tr("First diagonal gradient")
+           << tr("Second diagonal gradient") << tr("First corner gradient")
+           << tr("Second corner gradient") << tr("Third corner gradient")
+           << tr("Fourth corner gradient");
   idList << XGUI::HorizontalGradient << XGUI::VerticalGradient << XGUI::Diagonal1Gradient
-      << XGUI::Diagonal2Gradient << XGUI::Corner1Gradient << XGUI::Corner2Gradient
-      << XGUI::Corner3Gradient << XGUI::Corner4Gradient;
+         << XGUI::Diagonal2Gradient << XGUI::Corner1Gradient << XGUI::Corner2Gradient
+         << XGUI::Corner3Gradient << XGUI::Corner4Gradient;
 #ifdef OCC_ENABLE_TEXTURED_BACKGROUND
   txtList << XGUI::CenterTexture << XGUI::TileTexture << XGUI::StretchTexture;
 #endif
@@ -85,16 +84,16 @@ QString XGUI_Viewer::backgroundData(QStringList& gradList, QIntList& idList, QIn
 }
 
 XGUI_Viewer::XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron)
-    : QObject(theParent), 
-    myMainWindow(theParent), 
-    myPreselectionEnabled(true), 
-    mySelectionEnabled(true), 
-    myMultiSelectionEnabled(true), 
-    myIsRelative(true), 
-    myInteractionStyle(XGUI::STANDARD), 
-    myTrihedronSize(100),
-    myActiveView(0),
-    myWndIdCount(0)
+    : QObject(theParent),
+      myMainWindow(theParent),
+      myPreselectionEnabled(true),
+      mySelectionEnabled(true),
+      myMultiSelectionEnabled(true),
+      myIsRelative(true),
+      myInteractionStyle(XGUI::STANDARD),
+      myTrihedronSize(100),
+      myActiveView(0),
+      myWndIdCount(0)
 {
   if (!isInitialized) {
     isInitialized = true;
@@ -122,8 +121,8 @@ XGUI_Viewer::XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron)
     XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::ROTATE] = Qt::NoModifier;
     XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::ROTATE] = Qt::LeftButton;
 
-    XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::FIT_AREA] = Qt::NoModifier; // unused
-    XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::FIT_AREA] = Qt::NoButton; // unused
+    XGUI_Viewer::myStateMap[XGUI::KEY_FREE][XGUI::FIT_AREA] = Qt::NoModifier;  // unused
+    XGUI_Viewer::myButtonMap[XGUI::KEY_FREE][XGUI::FIT_AREA] = Qt::NoButton;  // unused
   }
 
   // init CasCade viewers
@@ -158,7 +157,8 @@ XGUI_Viewer::XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron)
   //myZoomingStyle = 0;
 
   QMdiArea* aMDI = myMainWindow->mdiArea();
-  connect(aMDI, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(onWindowActivated(QMdiSubWindow*)));
+  connect(aMDI, SIGNAL(subWindowActivated(QMdiSubWindow*)), this,
+          SLOT(onWindowActivated(QMdiSubWindow*)));
 
 }
 
@@ -180,11 +180,12 @@ QMdiSubWindow* XGUI_Viewer::createView(V3d_TypeOfView theType)
   //vw->setBackground( background(0) ); // 0 means MAIN_VIEW (other views are not yet created here)
   // connect signal from viewport
   //connect(view->viewPort(), SIGNAL(vpClosed()), this, SLOT(onViewClosed()));
-    //connect(view->viewPort(), SIGNAL(vpMapped()), this, SLOT(onViewMapped()));
-  if (myViews.size() == 0) 
+  //connect(view->viewPort(), SIGNAL(vpMapped()), this, SLOT(onViewMapped()));
+  if (myViews.size() == 0)
     setTrihedronShown(true);
 
-  Qtx::BackgroundData aBk = XGUI_Preferences::resourceMgr()->backgroundValue("Viewer", "background");
+  Qtx::BackgroundData aBk = XGUI_Preferences::resourceMgr()->backgroundValue("Viewer",
+                                                                             "background");
   view->setBackground(aBk);
   view->updateEnabledDrawMode();
 
@@ -200,15 +201,16 @@ QMdiSubWindow* XGUI_Viewer::createView(V3d_TypeOfView theType)
 
 void XGUI_Viewer::updateFromResources()
 {
-  Qtx::BackgroundData aBk = XGUI_Preferences::resourceMgr()->backgroundValue("Viewer", "background");
-  foreach (QMdiSubWindow* aWnd, myViews) {
+  Qtx::BackgroundData aBk = XGUI_Preferences::resourceMgr()->backgroundValue("Viewer",
+                                                                             "background");
+  foreach (QMdiSubWindow* aWnd, myViews)
+  {
     XGUI_ViewWindow* aView = dynamic_cast<XGUI_ViewWindow*>(aWnd->widget());
     if (aView)
       aView->setBackground(aBk);
   }
 }
 
-
 XGUI_ViewWindow* XGUI_Viewer::activeViewWindow() const
 {
   if (myActiveView)
@@ -386,7 +388,7 @@ bool XGUI_Viewer::computeTrihedronSize(double& theNewSize, double& theSize)
   if (aMaxSide < Precision::Confusion())
     return false;
 
-  static float EPS = (float)5.0E-3;
+  static float EPS = (float) 5.0E-3;
   theSize = trihedron()->Size();
   //theNewSize = aMaxSide*aSizeInPercents / 100.0;
 
@@ -395,18 +397,19 @@ bool XGUI_Viewer::computeTrihedronSize(double& theNewSize, double& theSize)
 
 void XGUI_Viewer::onViewClosed(QMdiSubWindow* theView)
 {
-  if ( !theView )
+  if (!theView)
     return;
 
-  emit deleteView( static_cast<XGUI_ViewWindow*>(theView->widget()) );
-  removeView( theView );
+  emit deleteView(static_cast<XGUI_ViewWindow*>(theView->widget()));
+  removeView(theView);
 
   // if this is last view
   if (myViews.size() == 0) {
     Standard_Integer aViewsNb = 0;
-    for ( myV3dViewer->InitActiveViews(); myV3dViewer->MoreActiveViews(); myV3dViewer->NextActiveViews())
+    for (myV3dViewer->InitActiveViews(); myV3dViewer->MoreActiveViews();
+        myV3dViewer->NextActiveViews())
       ++aViewsNb;
-    if ( aViewsNb < 2 ) {
+    if (aViewsNb < 2) {
       //clean up presentations before last view is closed
       myAISContext->RemoveAll(Standard_False);
     }
@@ -415,83 +418,79 @@ void XGUI_Viewer::onViewClosed(QMdiSubWindow* theView)
 
 /*!Remove view window \a theView from view manager.
  *And close the last view, if it has \a theView.
-*/
-void XGUI_Viewer::removeView( QMdiSubWindow* theView )
+ */
+void XGUI_Viewer::removeView(QMdiSubWindow* theView)
 {
-    XGUI_ViewWindow* aWindow = static_cast<XGUI_ViewWindow*>(theView->widget());
-
-    aWindow->disconnect( this );
-    myViews.removeAt( myViews.indexOf( theView ) );
-    if ( myActiveView == theView )
-        myActiveView = 0;
-    if ( myViews.size() == 0 )
-        emit lastViewClosed();
-}
+  XGUI_ViewWindow* aWindow = static_cast<XGUI_ViewWindow*>(theView->widget());
 
+  aWindow->disconnect(this);
+  myViews.removeAt(myViews.indexOf(theView));
+  if (myActiveView == theView)
+    myActiveView = 0;
+  if (myViews.size() == 0)
+    emit lastViewClosed();
+}
 
 /*void XGUI_Viewer::onViewMapped()
-{
-  setTrihedronShown(true);
-}*/
-
+ {
+ setTrihedronShown(true);
+ }*/
 
 void XGUI_Viewer::addView(QMdiSubWindow* theView)
 {
-    XGUI_ViewWindow* aWindow = dynamic_cast<XGUI_ViewWindow*>(theView->widget());
+  XGUI_ViewWindow* aWindow = dynamic_cast<XGUI_ViewWindow*>(theView->widget());
 
-    connect(aWindow, SIGNAL(closed(QMdiSubWindow*)),
-            this,    SLOT(onViewClosed(QMdiSubWindow*)));
+  connect(aWindow, SIGNAL(closed(QMdiSubWindow*)), this, SLOT(onViewClosed(QMdiSubWindow*)));
 
-    connect(aWindow, SIGNAL(tryClosing(XGUI_ViewWindow*)),
-            this,    SIGNAL(tryCloseView(XGUI_ViewWindow*)));
+  connect(aWindow, SIGNAL(tryClosing(XGUI_ViewWindow*)), this,
+          SIGNAL(tryCloseView(XGUI_ViewWindow*)));
 
-    connect(aWindow, SIGNAL(mousePressed(XGUI_ViewWindow*, QMouseEvent*)),
-            this,    SLOT(onMousePressed(XGUI_ViewWindow*, QMouseEvent*)));
+  connect(aWindow, SIGNAL(mousePressed(XGUI_ViewWindow*, QMouseEvent*)), this,
+          SLOT(onMousePressed(XGUI_ViewWindow*, QMouseEvent*)));
 
-    connect(aWindow, SIGNAL(mouseDoubleClicked(XGUI_ViewWindow*, QMouseEvent*)),
-            this,    SIGNAL(mouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*)));
+  connect(aWindow, SIGNAL(mouseDoubleClicked(XGUI_ViewWindow*, QMouseEvent*)), this,
+          SIGNAL(mouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*)));
 
-    connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)),
-            this,    SIGNAL(mouseMove(XGUI_ViewWindow*, QMouseEvent*)));
+  connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)), this,
+          SIGNAL(mouseMove(XGUI_ViewWindow*, QMouseEvent*)));
 
-    connect(aWindow, SIGNAL(keyPressed(XGUI_ViewWindow*, QKeyEvent*)),
-            this,    SIGNAL(keyPress(XGUI_ViewWindow*, QKeyEvent*)));
+  connect(aWindow, SIGNAL(keyPressed(XGUI_ViewWindow*, QKeyEvent*)), this,
+          SIGNAL(keyPress(XGUI_ViewWindow*, QKeyEvent*)));
 
-    connect(aWindow, SIGNAL(keyReleased(XGUI_ViewWindow*, QKeyEvent*)),
-            this,    SIGNAL(keyRelease(XGUI_ViewWindow*, QKeyEvent*)));
+  connect(aWindow, SIGNAL(keyReleased(XGUI_ViewWindow*, QKeyEvent*)), this,
+          SIGNAL(keyRelease(XGUI_ViewWindow*, QKeyEvent*)));
 
-    //connect(aWindow, SIGNAL(contextMenuRequested( QContextMenuEvent* )),
-    //        this,    SLOT  (onContextMenuRequested( QContextMenuEvent* )));
-    connect(aWindow, SIGNAL( contextMenuRequested(QContextMenuEvent*) ), 
-            this, SIGNAL( contextMenuRequested(QContextMenuEvent*) ) );
+  //connect(aWindow, SIGNAL(contextMenuRequested( QContextMenuEvent* )),
+  //        this,    SLOT  (onContextMenuRequested( QContextMenuEvent* )));
+  connect(aWindow, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
+          SIGNAL(contextMenuRequested(QContextMenuEvent*)));
 
-    connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)),
-            this, SLOT(onMouseMove(XGUI_ViewWindow*, QMouseEvent*)));
+  connect(aWindow, SIGNAL(mouseMoving(XGUI_ViewWindow*, QMouseEvent*)), this,
+          SLOT(onMouseMove(XGUI_ViewWindow*, QMouseEvent*)));
 
-    connect(aWindow, SIGNAL(mouseReleased(XGUI_ViewWindow*, QMouseEvent*)),
-            this, SLOT(onMouseReleased(XGUI_ViewWindow*, QMouseEvent*)));
+  connect(aWindow, SIGNAL(mouseReleased(XGUI_ViewWindow*, QMouseEvent*)), this,
+          SLOT(onMouseReleased(XGUI_ViewWindow*, QMouseEvent*)));
 
-    myViews.append(theView);
+  myViews.append(theView);
 }
 
 /*!
   Emit activated for view \a view.
-*/
+ Emit activated for view \a view.
+ */
 void XGUI_Viewer::onWindowActivated(QMdiSubWindow* view)
 {
   if (view && (view != myActiveView) && (!view->isMinimized())) {
     myActiveView = view;
-    ((XGUI_ViewWindow*)myActiveView->widget())->windowActivated();
+    ((XGUI_ViewWindow*) myActiveView->widget())->windowActivated();
     QList<QMdiSubWindow*>::iterator aIt;
     for (aIt = myViews.begin(); aIt != myViews.end(); ++aIt) {
       if ((*aIt) != myActiveView) {
-        ((XGUI_ViewWindow*)(*aIt)->widget())->windowDeactivated();
+        ((XGUI_ViewWindow*) (*aIt)->widget())->windowDeactivated();
       }
     }
   }
 }
 
-
 void XGUI_Viewer::onWindowMinimized(QMdiSubWindow* theWnd)
 {
   if (myActiveView == theWnd) {
@@ -508,31 +507,34 @@ void XGUI_Viewer::onWindowMinimized(QMdiSubWindow* theWnd)
 }
 
 /*!
 SLOT: called on mouse button press, stores current mouse position as start point for transformations
-*/
+ SLOT: called on mouse button press, stores current mouse position as start point for transformations
+ */
 void XGUI_Viewer::onMousePressed(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent)
 {
-  myStartPnt.setX(theEvent->x()); myStartPnt.setY(theEvent->y());
+  myStartPnt.setX(theEvent->x());
+  myStartPnt.setY(theEvent->y());
   emit mousePress(theWindow, theEvent);
 }
 
 /*!
 SLOT: called on mouse move, processes hilighting
-*/
+ SLOT: called on mouse move, processes hilighting
+ */
 void XGUI_Viewer::onMouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent)
 {
-  myCurPnt.setX(theEvent->x()); myCurPnt.setY(theEvent->y());
-  if (!mySelectionEnabled) return;
+  myCurPnt.setX(theEvent->x());
+  myCurPnt.setY(theEvent->y());
+  if (!mySelectionEnabled)
+    return;
 
   Handle(V3d_View) aView3d = theWindow->viewPort()->getView();
-  if ( !aView3d.IsNull() ) {
+  if (!aView3d.IsNull()) {
     myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView3d);
   }
 }
 
 /*!
 SLOT: called on mouse button release, finishes selection
-*/
+ SLOT: called on mouse button release, finishes selection
+ */
 void XGUI_Viewer::onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent)
 {
   if (!mySelectionEnabled || theEvent->button() != Qt::LeftButton) {
@@ -540,16 +542,17 @@ void XGUI_Viewer::onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEv
     return;
   }
 
-  myEndPnt.setX(theEvent->x()); myEndPnt.setY(theEvent->y());
+  myEndPnt.setX(theEvent->x());
+  myEndPnt.setY(theEvent->y());
   bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
-  
+
   //if (!aHasShift) 
   //  emit deselection();
 
   if (myStartPnt == myEndPnt) {
     // the MoveTo is necessary for the second click in the same point. Otherwise the selection is lost.
     Handle(V3d_View) aView3d = theWindow->viewPort()->getView();
-    if ( !aView3d.IsNull() ) {
+    if (!aView3d.IsNull()) {
       myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView3d);
     }
     if (aHasShift && myMultiSelectionEnabled)
@@ -558,21 +561,19 @@ void XGUI_Viewer::onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEv
       myAISContext->Select();
   } else {
     if (aHasShift && myMultiSelectionEnabled)
-      myAISContext->ShiftSelect(myStartPnt.x(), myStartPnt.y(),
-                                myEndPnt.x(), myEndPnt.y(),
-                                theWindow->viewPort()->getView(), false );
+      myAISContext->ShiftSelect(myStartPnt.x(), myStartPnt.y(), myEndPnt.x(), myEndPnt.y(),
+                                theWindow->viewPort()->getView(), false);
     else
-      myAISContext->Select(myStartPnt.x(), myStartPnt.y(),
-                           myEndPnt.x(), myEndPnt.y(),
-                           theWindow->viewPort()->getView(), false );
+      myAISContext->Select(myStartPnt.x(), myStartPnt.y(), myEndPnt.x(), myEndPnt.y(),
+                           theWindow->viewPort()->getView(), false);
 
     int Nb = myAISContext->NbSelected();
-    if( Nb>1 && !myMultiSelectionEnabled ) {
+    if (Nb > 1 && !myMultiSelectionEnabled) {
       myAISContext->InitSelected();
       Handle( SelectMgr_EntityOwner ) anOwner = myAISContext->SelectedOwner();
-      if( !anOwner.IsNull() ) {
-        myAISContext->ClearSelected( Standard_False );
-        myAISContext->AddOrRemoveSelected( anOwner, Standard_False );
+      if (!anOwner.IsNull()) {
+        myAISContext->ClearSelected( Standard_False);
+        myAISContext->AddOrRemoveSelected(anOwner, Standard_False);
       }
     }
 
@@ -583,23 +584,24 @@ void XGUI_Viewer::onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEv
 }
 
 //******************************************************
-void XGUI_Viewer::setMultiSelectionEnabled(bool toEnable) 
-{ 
-  myMultiSelectionEnabled = toEnable; 
+void XGUI_Viewer::setMultiSelectionEnabled(bool toEnable)
+{
+  myMultiSelectionEnabled = toEnable;
   updateViewsDrawMode();
 }
 
 //******************************************************
-void XGUI_Viewer::setSelectionEnabled(bool toEnable) 
-{ 
-  mySelectionEnabled = toEnable; 
+void XGUI_Viewer::setSelectionEnabled(bool toEnable)
+{
+  mySelectionEnabled = toEnable;
   updateViewsDrawMode();
 }
 
 //******************************************************
 void XGUI_Viewer::updateViewsDrawMode() const
 {
-  foreach(QMdiSubWindow* aWnd, myViews){
+  foreach(QMdiSubWindow* aWnd, myViews)
+  {
     XGUI_ViewWindow* aView = static_cast<XGUI_ViewWindow*>(aWnd->widget());
     aView->updateEnabledDrawMode();
   }
index 218fd26d0ee6e29786db6b54ec09951afcf6784d..2ae7cdd04feb2b5dfa73364bd174a35a07d7afaf 100644 (file)
@@ -17,7 +17,6 @@
 #include <NCollection_List.hxx>
 #include <TopoDS_Shape.hxx>
 
-
 class XGUI_MainWindow;
 class QMdiSubWindow;
 class XGUI_ViewWindow;
@@ -31,10 +30,10 @@ class AIS_ListOfInteractive;
  * \brief Represents a 3d viewer. The viewer manages 3d scene and a set of view windows
  * when each of view window is a one point of view on this scene.
  */
-class XGUI_EXPORT XGUI_Viewer: public QObject
+class XGUI_EXPORT XGUI_Viewer : public QObject
 {
 Q_OBJECT
-public:
+ public:
   static QString backgroundData(QStringList&, QIntList&, QIntList&);
 
   XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron = true);
@@ -66,7 +65,7 @@ public:
 
   /// Return objects selected in 3D viewer
   /// \param theList - list to be filled with selected objects
-  void  getSelectedObjects(AIS_ListOfInteractive& theList);
+  void getSelectedObjects(AIS_ListOfInteractive& theList);
 
   /// Return shapes selected in 3D viewer
   /// \param theList - list to be filled with selected shapes
@@ -74,17 +73,23 @@ public:
 
   /// Selects objects in 3D viewer. Other selected objects are left as selected
   /// \param theList - list objects to be selected
-  void  setObjectsSelected(const AIS_ListOfInteractive& theList);
+  void setObjectsSelected(const AIS_ListOfInteractive& theList);
 
   /// Returns true if selection in the viewer is enabled
-  bool isSelectionEnabled() const { return mySelectionEnabled; }
+  bool isSelectionEnabled() const
+  {
+    return mySelectionEnabled;
+  }
 
   /// Enable or disable selectioon in the viewer
   // \param toEnable - true or false (enable or disable selection)
   void setSelectionEnabled(bool toEnable);
 
   /// Returns true if multi-selection in the viewer is enabled
-  bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
+  bool isMultiSelectionEnabled() const
+  {
+    return myMultiSelectionEnabled;
+  }
 
   /// Enable or disable selectioon in the viewer
   // \param toEnable - true or false (enable or disable selection)
@@ -92,7 +97,10 @@ public:
 
   /// Select the object in 3D viewer.
   /// \param theIO - list objects to be selected
-  void setSelected(const Handle(AIS_InteractiveObject)& theIO) { myAISContext->SetSelected(theIO); }
+  void setSelected(const Handle(AIS_InteractiveObject)& theIO)
+  {
+    myAISContext->SetSelected(theIO);
+  }
 
   //! Trihedron 3d object shown in the viewer
   Handle(AIS_Trihedron) trihedron() const
@@ -126,7 +134,10 @@ public:
   bool computeTrihedronSize(double& theNewSize, double& theSize);
 
   //! Add action to the viewer
-  void addAction(QAction* theAction) { myActions.append(theAction); }
+  void addAction(QAction* theAction)
+  {
+    myActions.append(theAction);
+  }
 
   void updateFromResources();
 
@@ -160,18 +171,18 @@ signals:
 
   void contextMenuRequested(QContextMenuEvent*);
 
-public slots:
+ public slots:
   void onWindowMinimized(QMdiSubWindow*);
   void onWindowActivated(QMdiSubWindow*);
 
-private slots:
+ private slots:
   void onViewClosed(QMdiSubWindow*);
   void onMouseMove(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
   void onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
   void onMousePressed(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
   //void onContextMenuRequested(QContextMenuEvent* theEvent);
 
-private:
+ private:
   void addView(QMdiSubWindow* theView);
 
   /*! Removes the View from internal Views list.*/
@@ -179,12 +190,10 @@ private:
 
   void updateViewsDrawMode() const;
 
-private:
+ private:
   XGUI_MainWindow* myMainWindow;
 
-  Handle(V3d_Viewer) myV3dViewer;
-  Handle(AIS_Trihedron) myTrihedron;
-  Handle(AIS_InteractiveContext) myAISContext;
+  Handle(V3d_Viewer) myV3dViewer;Handle(AIS_Trihedron) myTrihedron;Handle(AIS_InteractiveContext) myAISContext;
 
   XGUI::InteractionStyle myInteractionStyle;
 
@@ -194,7 +203,7 @@ private:
   bool myIsRelative;
 
   double myTrihedronSize;
-  
+
   QList<QMdiSubWindow*> myViews;
 
   QMdiSubWindow* myActiveView;
index 65c21fc5853e4efd9e6bfbc7ddc30040a1109f69..ad1685d524130ac6a234703cbb5276c8f7aacf9e 100644 (file)
@@ -6,13 +6,12 @@
 #include "XGUI_Viewer.h"
 #include "XGUI_SalomeConnector.h"
 
-
 XGUI_ViewerProxy::XGUI_ViewerProxy(XGUI_Workshop* theParent)
-: XGUI_SalomeViewer(theParent), myWorkshop(theParent)
+    : XGUI_SalomeViewer(theParent),
+      myWorkshop(theParent)
 {
 }
 
-
 Handle(AIS_InteractiveContext) XGUI_ViewerProxy::AISContext() const
 {
   if (myWorkshop->isSalomeMode()) {
@@ -37,18 +36,17 @@ Handle(V3d_View) XGUI_ViewerProxy::activeView() const
     return myWorkshop->salomeConnector()->viewer()->activeView();
   } else {
     XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
-    return (aViewer->activeViewWindow())?
-      aViewer->activeViewWindow()->viewPort()->getView():
-      Handle(V3d_View)();
+    return (aViewer->activeViewWindow()) ? aViewer->activeViewWindow()->viewPort()->getView() :
+    Handle(V3d_View)();
   }
 }
+
 void XGUI_ViewerProxy::setViewProjection(double theX, double theY, double theZ)
 {
   Handle(V3d_View) aView3d = activeView();
-  if ( !aView3d.IsNull() ) {
+  if (!aView3d.IsNull()) {
     aView3d->SetProj(theX, theY, theZ);
-    aView3d->FitAll( 0.01, true, true );
+    aView3d->FitAll(0.01, true, true);
     aView3d->SetZSize(0.);
   }
 }
@@ -57,8 +55,7 @@ void XGUI_ViewerProxy::fitAll()
 {
   if (myWorkshop->isSalomeMode()) {
     myWorkshop->salomeConnector()->viewer()->fitAll();
-  }
-  else {
+  } else {
     XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
     if (aViewer->activeViewWindow())
       aViewer->activeViewWindow()->viewPort()->fitAll();
@@ -70,69 +67,54 @@ void XGUI_ViewerProxy::connectToViewer()
   if (myWorkshop->isSalomeMode()) {
     XGUI_SalomeViewer* aViewer = myWorkshop->salomeConnector()->viewer();
 
-    connect(aViewer, SIGNAL(lastViewClosed()),
-            this, SIGNAL(lastViewClosed()));
-    connect(aViewer, SIGNAL(tryCloseView()),
-            this, SIGNAL(tryCloseView()));
-    connect(aViewer, SIGNAL(deleteView()),
-            this, SIGNAL(deleteView()));
-    connect(aViewer, SIGNAL(viewCreated()),
-            this, SIGNAL(viewCreated()));
-    connect(aViewer, SIGNAL(activated()),
-            this, SIGNAL(activated()));
-
-    connect(aViewer, SIGNAL(mousePress(QMouseEvent*)),
-            this, SIGNAL(mousePress(QMouseEvent*)));
-
-    connect(aViewer, SIGNAL(mouseRelease(QMouseEvent*)),
-            this, SIGNAL(mouseRelease(QMouseEvent*)));
-    
-    connect(aViewer, SIGNAL(mouseDoubleClick(QMouseEvent*)),
-            this, SIGNAL(mouseDoubleClick(QMouseEvent*)));
-    
-    connect(aViewer, SIGNAL(mouseMove(QMouseEvent*)),
-            this, SIGNAL(mouseMove(QMouseEvent*)));
-    
-    connect(aViewer, SIGNAL(keyPress(QKeyEvent*)),
-            this, SIGNAL(keyPress(QKeyEvent*)));
-    
-    connect(aViewer, SIGNAL(keyRelease(QKeyEvent*)),
-            this, SIGNAL(keyRelease(QKeyEvent*)));
+    connect(aViewer, SIGNAL(lastViewClosed()), this, SIGNAL(lastViewClosed()));
+    connect(aViewer, SIGNAL(tryCloseView()), this, SIGNAL(tryCloseView()));
+    connect(aViewer, SIGNAL(deleteView()), this, SIGNAL(deleteView()));
+    connect(aViewer, SIGNAL(viewCreated()), this, SIGNAL(viewCreated()));
+    connect(aViewer, SIGNAL(activated()), this, SIGNAL(activated()));
+
+    connect(aViewer, SIGNAL(mousePress(QMouseEvent*)), this, SIGNAL(mousePress(QMouseEvent*)));
+
+    connect(aViewer, SIGNAL(mouseRelease(QMouseEvent*)), this, SIGNAL(mouseRelease(QMouseEvent*)));
+
+    connect(aViewer, SIGNAL(mouseDoubleClick(QMouseEvent*)), this,
+            SIGNAL(mouseDoubleClick(QMouseEvent*)));
+
+    connect(aViewer, SIGNAL(mouseMove(QMouseEvent*)), this, SIGNAL(mouseMove(QMouseEvent*)));
+
+    connect(aViewer, SIGNAL(keyPress(QKeyEvent*)), this, SIGNAL(keyPress(QKeyEvent*)));
+
+    connect(aViewer, SIGNAL(keyRelease(QKeyEvent*)), this, SIGNAL(keyRelease(QKeyEvent*)));
 
     connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
-    connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), 
-            this, SIGNAL(contextMenuRequested(QContextMenuEvent*)));
+    connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
+            SIGNAL(contextMenuRequested(QContextMenuEvent*)));
 
   } else {
     XGUI_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
 
-    connect(aViewer, SIGNAL(lastViewClosed()),
-            this, SIGNAL(lastViewClosed()));
-    connect(aViewer, SIGNAL(tryCloseView(XGUI_ViewWindow*)),
-            this, SIGNAL(tryCloseView()));
-    connect(aViewer, SIGNAL(deleteView(XGUI_ViewWindow*)),
-            this, SIGNAL(deleteView()));
-    connect(aViewer, SIGNAL(viewCreated(XGUI_ViewWindow*)),
-            this, SIGNAL(viewCreated()));
-    connect(aViewer, SIGNAL(activated(XGUI_ViewWindow*)),
-            this, SIGNAL(activated()));
-
-    connect(aViewer, SIGNAL(mousePress(XGUI_ViewWindow*, QMouseEvent*)),
-            this, SLOT(onMousePress(XGUI_ViewWindow*, QMouseEvent*)));
-    connect(aViewer, SIGNAL(mouseRelease(XGUI_ViewWindow*, QMouseEvent*)),
-            this, SLOT(onMouseRelease(XGUI_ViewWindow*, QMouseEvent*)));
-    connect(aViewer, SIGNAL(mouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*)),
-            this, SLOT(onMouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*)));
-    connect(aViewer, SIGNAL(mouseMove(XGUI_ViewWindow*, QMouseEvent*)),
-            this, SLOT(onMouseMove(XGUI_ViewWindow*, QMouseEvent*)));
-    connect(aViewer, SIGNAL(keyPress(XGUI_ViewWindow*, QKeyEvent*)),
-            this, SLOT(onKeyPress(XGUI_ViewWindow*, QKeyEvent*)));
-    connect(aViewer, SIGNAL(keyRelease(XGUI_ViewWindow*, QKeyEvent*)),
-            this, SLOT(onKeyRelease(XGUI_ViewWindow*, QKeyEvent*)));
+    connect(aViewer, SIGNAL(lastViewClosed()), this, SIGNAL(lastViewClosed()));
+    connect(aViewer, SIGNAL(tryCloseView(XGUI_ViewWindow*)), this, SIGNAL(tryCloseView()));
+    connect(aViewer, SIGNAL(deleteView(XGUI_ViewWindow*)), this, SIGNAL(deleteView()));
+    connect(aViewer, SIGNAL(viewCreated(XGUI_ViewWindow*)), this, SIGNAL(viewCreated()));
+    connect(aViewer, SIGNAL(activated(XGUI_ViewWindow*)), this, SIGNAL(activated()));
+
+    connect(aViewer, SIGNAL(mousePress(XGUI_ViewWindow*, QMouseEvent*)), this,
+            SLOT(onMousePress(XGUI_ViewWindow*, QMouseEvent*)));
+    connect(aViewer, SIGNAL(mouseRelease(XGUI_ViewWindow*, QMouseEvent*)), this,
+            SLOT(onMouseRelease(XGUI_ViewWindow*, QMouseEvent*)));
+    connect(aViewer, SIGNAL(mouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*)), this,
+            SLOT(onMouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*)));
+    connect(aViewer, SIGNAL(mouseMove(XGUI_ViewWindow*, QMouseEvent*)), this,
+            SLOT(onMouseMove(XGUI_ViewWindow*, QMouseEvent*)));
+    connect(aViewer, SIGNAL(keyPress(XGUI_ViewWindow*, QKeyEvent*)), this,
+            SLOT(onKeyPress(XGUI_ViewWindow*, QKeyEvent*)));
+    connect(aViewer, SIGNAL(keyRelease(XGUI_ViewWindow*, QKeyEvent*)), this,
+            SLOT(onKeyRelease(XGUI_ViewWindow*, QKeyEvent*)));
 
     connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
-    connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), 
-            this, SIGNAL(contextMenuRequested(QContextMenuEvent*)));
+    connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
+            SIGNAL(contextMenuRequested(QContextMenuEvent*)));
   }
 }
 
index dfd632bdab9699a1497f78fcdca15e941d36f6c7..6bc769cdd196369ad6665a20152102e94170fdb9 100644 (file)
@@ -8,15 +8,15 @@ class XGUI_Workshop;
 class XGUI_ViewWindow;
 
 /**
-* Proxy class which repersents or XGUI_Viewer or Salome Viewer
-* dependently on current launching environment.
-* It is reccomennded to use this class in operation for accessing to viewer 
-* functionality instead of direct access to a viewer
-*/
-class XGUI_EXPORT XGUI_ViewerProxy: public XGUI_SalomeViewer
+ * Proxy class which repersents or XGUI_Viewer or Salome Viewer
+ * dependently on current launching environment.
+ * It is reccomennded to use this class in operation for accessing to viewer 
+ * functionality instead of direct access to a viewer
+ */
+class XGUI_EXPORT XGUI_ViewerProxy : public XGUI_SalomeViewer
 {
-  Q_OBJECT
-public:
+Q_OBJECT
+ public:
   XGUI_ViewerProxy(XGUI_Workshop* theParent);
 
   //! Returns AIS_InteractiveContext from current OCCViewer
@@ -52,7 +52,7 @@ public:
   /// Connects to a viewer according to current environment
   void connectToViewer();
 
-private slots:
+ private slots:
   void onMousePress(XGUI_ViewWindow*, QMouseEvent*);
   void onMouseRelease(XGUI_ViewWindow*, QMouseEvent*);
   void onMouseDoubleClick(XGUI_ViewWindow*, QMouseEvent*);
@@ -60,7 +60,7 @@ private slots:
   void onKeyPress(XGUI_ViewWindow*, QKeyEvent*);
   void onKeyRelease(XGUI_ViewWindow*, QKeyEvent*);
 
-private:
+ private:
   XGUI_Workshop* myWorkshop;
 };
 
index 36efadf9f210ca4ddacd1c76192e30e1f04e0e15..8826b335f576318696b0426e5f8526a1083b487e 100644 (file)
@@ -8,15 +8,15 @@
 #define SCROLL_STEP 20
 
 //**************************************************
-class CommandsArea: public QScrollArea
+class CommandsArea : public QScrollArea
 {
-public:
+ public:
   CommandsArea(QWidget* theParent)
       : QScrollArea(theParent)
   {
   }
 
-protected:
+ protected:
   virtual void resizeEvent(QResizeEvent * theEvent);
 };
 
@@ -84,7 +84,7 @@ XGUI_MenuGroupPanel* XGUI_Workbench::addGroup(const QString& theId)
   XGUI_MenuGroupPanel* aGroup = new XGUI_MenuGroupPanel(myChildWidget);
   aGroup->setObjectName(theId);
   myLayout->addWidget(aGroup);
-  if(theId != "Default") {
+  if (theId != "Default") {
     addSeparator();
   }
   myLayout->addStretch();
@@ -188,7 +188,8 @@ XGUI_Command* XGUI_Workbench::feature(const QString& theId) const
 QList<XGUI_Command*> XGUI_Workbench::features() const
 {
   QList<XGUI_Command*> aList;
-  foreach (XGUI_MenuGroupPanel* aGroup, myGroups) {
+  foreach (XGUI_MenuGroupPanel* aGroup, myGroups)
+  {
     aList.append(aGroup->features());
   }
   return aList;
index 144a23a2d2fe8ffa84965b6b1facfe2f8346e150..7ede0b98faa4ff12a4095878697b81d8d73236ba 100644 (file)
@@ -13,10 +13,10 @@ class CommandsArea;
 class QHBoxLayout;
 class QPushButton;
 
-class XGUI_EXPORT XGUI_Workbench: public QWidget
+class XGUI_EXPORT XGUI_Workbench : public QWidget
 {
 Q_OBJECT
-public:
+ public:
   XGUI_Workbench(QWidget* theParent);
 
   XGUI_MenuGroupPanel* addGroup(const QString& theId);
@@ -28,16 +28,15 @@ public:
   //! Returns list of created commands
   QList<XGUI_Command*> features() const;
 
-private slots:
+ private slots:
   void onLeftScroll();
   void onRightScroll();
 
-protected:
+ protected:
   virtual void resizeEvent(QResizeEvent * theEvent);
   virtual bool eventFilter(QObject *theObj, QEvent *theEvent);
 
-
-private:
+ private:
   void addSeparator();
   bool isExceedsLeft();
   bool isExceedsRight();
index 021ab16b1ac00e857d3d0e8f9e6898a88e2080bc..ad35f6f8106b90f4139421454325e3c0c9a470e8 100644 (file)
@@ -81,15 +81,15 @@ QString XGUI_Workshop::featureIcon(const std::string& theId)
 }
 
 XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
-  : QObject(),
-  myCurrentDir(QString()),
-  myModule(NULL),
-  mySalomeConnector(theConnector),
-  myPropertyPanel(0),
-  myObjectBrowser(0),
-  myDisplayer(0)
+    : QObject(),
+      myCurrentDir(QString()),
+      myModule(NULL),
+      mySalomeConnector(theConnector),
+      myPropertyPanel(0),
+      myObjectBrowser(0),
+      myDisplayer(0)
 {
-  myMainWindow = mySalomeConnector? 0 : new XGUI_MainWindow();
+  myMainWindow = mySalomeConnector ? 0 : new XGUI_MainWindow();
 
   myDisplayer = new XGUI_Displayer(this);
 
@@ -100,20 +100,22 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
   myActionsMgr = new XGUI_ActionsMgr(this);
   myErrorDlg = new XGUI_ErrorDialog(myMainWindow);
   myContextMenuMgr = new XGUI_ContextMenuMgr(this);
-  connect(myContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), 
-          this, SLOT(onContextMenuCommand(const QString&, bool)));
+  connect(myContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this,
+          SLOT(onContextMenuCommand(const QString&, bool)));
 
   myViewerProxy = new XGUI_ViewerProxy(this);
   connect(myViewerProxy, SIGNAL(selectionChanged()), this, SLOT(updateCommandsOnViewSelection()));
-  
+
   myModuleConnector = new XGUI_ModuleConnector(this);
 
   connect(myOperationMgr, SIGNAL(operationStarted()), SLOT(onOperationStarted()));
   connect(myOperationMgr, SIGNAL(operationResumed()), SLOT(onOperationStarted()));
-  connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), SLOT(onOperationStopped(ModuleBase_Operation*)));
+  connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
+          SLOT(onOperationStopped(ModuleBase_Operation*)));
   connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit()));
   connect(myOperationMgr, SIGNAL(operationStarted()), myActionsMgr, SLOT(update()));
-  connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), myActionsMgr, SLOT(update()));
+  connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)), myActionsMgr,
+          SLOT(update()));
   connect(this, SIGNAL(errorOccurred(const QString&)), myErrorDlg, SLOT(addError(const QString&)));
 }
 
@@ -128,7 +130,7 @@ void XGUI_Workshop::startApplication()
   initMenu();
   //Initialize event listening
   Events_Loop* aLoop = Events_Loop::loop();
-  aLoop->registerListener(this, Events_Error::errorID()); //!< Listening application errors.
+  aLoop->registerListener(this, Events_Error::errorID());  //!< Listening application errors.
   //TODO(sbh): Implement static method to extract event id [SEID]
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_LOADED));
   // TODO Is it good to use non standard event within workshop?
@@ -156,15 +158,14 @@ void XGUI_Workshop::initMenu()
 
   if (isSalomeMode()) {
     // Create only Undo, Redo commands
-    QAction* aAction = salomeConnector()->addEditCommand("UNDO_CMD", 
-                                      tr("Undo"), tr("Undo last command"),
-                                      QIcon(":pictures/undo.png"), 
-                                      QKeySequence::Undo, false);
+    QAction* aAction = salomeConnector()->addEditCommand("UNDO_CMD", tr("Undo"),
+                                                         tr("Undo last command"),
+                                                         QIcon(":pictures/undo.png"),
+                                                         QKeySequence::Undo, false);
     connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onUndo()));
-    aAction = salomeConnector()->addEditCommand("REDO_CMD", 
-                                      tr("Redo"), tr("Redo last command"),
-                                      QIcon(":pictures/redo.png"), 
-                                      QKeySequence::Redo, false);
+    aAction = salomeConnector()->addEditCommand("REDO_CMD", tr("Redo"), tr("Redo last command"),
+                                                QIcon(":pictures/redo.png"), QKeySequence::Redo,
+                                                false);
     connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRedo()));
     salomeConnector()->addEditMenuSeparator();
     return;
@@ -230,8 +231,9 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage)
 {
   //A message to start feature creation received.
   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_FEATURE_LOADED)) {
-    const Config_FeatureMessage* aFeatureMsg = dynamic_cast<const Config_FeatureMessage*>(theMessage);
-    if(!aFeatureMsg->isInternal()) {
+    const Config_FeatureMessage* aFeatureMsg =
+        dynamic_cast<const Config_FeatureMessage*>(theMessage);
+    if (!aFeatureMsg->isInternal()) {
       addFeature(aFeatureMsg);
     }
     return;
@@ -239,14 +241,16 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage)
 
   // Process creation of Part
   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
-    const ModelAPI_ObjectUpdatedMessage* aUpdMsg = dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+    const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
+        dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
     onFeatureCreatedMsg(aUpdMsg);
     return;
   }
 
   // Redisplay feature
   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) {
-    const ModelAPI_ObjectUpdatedMessage* aUpdMsg = dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
+    const ModelAPI_ObjectUpdatedMessage* aUpdMsg =
+        dynamic_cast<const ModelAPI_ObjectUpdatedMessage*>(theMessage);
     onFeatureRedisplayMsg(aUpdMsg);
     return;
   }
@@ -270,17 +274,18 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage)
   if (theMessage->eventID() == Events_LongOp::eventID()) {
     if (Events_LongOp::isPerformed())
       QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
-      //QTimer::singleShot(10, this, SLOT(onStartWaiting()));
-    else 
+    //QTimer::singleShot(10, this, SLOT(onStartWaiting()));
+    else
       QApplication::restoreOverrideCursor();
     return;
   }
 
   //An operation passed by message. Start it, process and commit.
   if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) {
-    const Config_PointerMessage* aPartSetMsg = dynamic_cast<const Config_PointerMessage*>(theMessage);
+    const Config_PointerMessage* aPartSetMsg =
+        dynamic_cast<const Config_PointerMessage*>(theMessage);
     //myPropertyPanel->cleanContent();
-    ModuleBase_Operation* anOperation = (ModuleBase_Operation*)aPartSetMsg->pointer();
+    ModuleBase_Operation* anOperation = (ModuleBase_Operation*) aPartSetMsg->pointer();
 
     if (myOperationMgr->startOperation(anOperation)) {
       myPropertyPanel->updateContentWidget(anOperation->feature());
@@ -310,16 +315,15 @@ void XGUI_Workshop::onStartWaiting()
 void XGUI_Workshop::onFeatureUpdatedMsg(const ModelAPI_ObjectUpdatedMessage* theMsg)
 {
   std::set<ObjectPtr> aFeatures = theMsg->objects();
-  if (myOperationMgr->hasOperation())
-  {
+  if (myOperationMgr->hasOperation()) {
     FeaturePtr aCurrentFeature = myOperationMgr->currentOperation()->feature();
     std::set<ObjectPtr>::const_iterator aIt;
     for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) {
       ObjectPtr aNewFeature = (*aIt);
-      if(aNewFeature == aCurrentFeature) {
+      if (aNewFeature == aCurrentFeature) {
         myPropertyPanel->updateContentWidget(aCurrentFeature);
         break;
-      } 
+      }
     }
   }
   myOperationMgr->validateCurrentOperation();
@@ -335,13 +339,13 @@ void XGUI_Workshop::onFeatureRedisplayMsg(const ModelAPI_ObjectUpdatedMessage* t
     if (!aObj->data() || !aObj->data()->isValid())
       myDisplayer->erase(aObj, false);
     else {
-      if (myDisplayer->isVisible(aObj)) // TODO VSV: Correction sketch drawing
-        myDisplayer->display(aObj, false); // In order to update presentation
+      if (myDisplayer->isVisible(aObj))  // TODO VSV: Correction sketch drawing
+        myDisplayer->display(aObj, false);  // In order to update presentation
       else {
-        if(myOperationMgr->hasOperation()) {
+        if (myOperationMgr->hasOperation()) {
           ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
-          if (aOperation->hasObject(aObj)) { // Display only current operation results
-            myDisplayer->display(aObj, false);        
+          if (aOperation->hasObject(aObj)) {  // Display only current operation results
+            myDisplayer->display(aObj, false);
           }
         }
       }
@@ -362,11 +366,11 @@ void XGUI_Workshop::onFeatureCreatedMsg(const ModelAPI_ObjectUpdatedMessage* the
     ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(*aIt);
     if (aPart) {
       aHasPart = true;
-    // If a feature is created from the aplication's python console  
-    // it doesn't stored in the operation mgr and doesn't displayed
-    } else if(myOperationMgr->hasOperation()) {
+      // If a feature is created from the aplication's python console  
+      // it doesn't stored in the operation mgr and doesn't displayed
+    } else if (myOperationMgr->hasOperation()) {
       ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
-      if (aOperation->hasObject(*aIt)) { // Display only current operation results
+      if (aOperation->hasObject(*aIt)) {  // Display only current operation results
         myDisplayer->display(*aIt, false);
         isDisplayed = true;
       }
@@ -392,7 +396,7 @@ void XGUI_Workshop::onOperationStarted()
 {
   ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
 
-  if(aOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel
+  if (aOperation->getDescription()->hasXmlRepresentation()) {  //!< No need for property panel
     connectWithOperation(aOperation);
 
     showPropertyPanel();
@@ -402,7 +406,7 @@ void XGUI_Workshop::onOperationStarted()
 
     myPropertyPanel->cleanContent();
     aFactory.createWidget(myPropertyPanel->contentWidget());
-    
+
     QList<ModuleBase_ModelWidget*> aWidgets = aFactory.getModelWidgets();
     QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
     ModuleBase_ModelWidget* aWidget;
@@ -410,12 +414,11 @@ void XGUI_Workshop::onOperationStarted()
       aWidget = *anIt;
       aWidget->setFeature(aOperation->feature());
       //QObject::connect(aWidget, SIGNAL(valuesChanged()),  aOperation, SLOT(storeCustomValue()));
-      QObject::connect(aWidget, SIGNAL(valuesChanged()),
-                       this, SLOT(onWidgetValuesChanged()));
+      QObject::connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged()));
       // Init default values
       if (!aOperation->isEditOperation() && aWidget->hasDefaultValue()) {
         //aWidget->storeValue(aOperation->feature());
-        
+
         aWidget->storeValue();
       }
     }
@@ -455,12 +458,11 @@ void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage)
   bool isUsePropPanel = theMessage->isUseInput();
   QString aFeatureId = QString::fromStdString(theMessage->id());
   if (isSalomeMode()) {
-    QAction* aAction = salomeConnector()->addFeature(aWchName,
-                              aFeatureId,
-                              QString::fromStdString(theMessage->text()),
-                              QString::fromStdString(theMessage->tooltip()),
-                              QIcon(theMessage->icon().c_str()),
-                              QKeySequence(), isUsePropPanel);
+    QAction* aAction = salomeConnector()->addFeature(aWchName, aFeatureId,
+                                                     QString::fromStdString(theMessage->text()),
+                                                     QString::fromStdString(theMessage->tooltip()),
+                                                     QIcon(theMessage->icon().c_str()),
+                                                     QKeySequence(), isUsePropPanel);
     salomeConnector()->setNestedActions(aFeatureId, aNestedFeatures.split(" "));
     myActionsMgr->addCommand(aAction);
     myModule->featureCreated(aAction);
@@ -484,8 +486,8 @@ void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage)
     XGUI_Command* aCommand = aGroup->addFeature(aFeatureId,
                                                 QString::fromStdString(theMessage->text()),
                                                 QString::fromStdString(theMessage->tooltip()),
-                                                QIcon(theMessage->icon().c_str()),
-                                                aHotKey, isUsePropPanel);
+                                                QIcon(theMessage->icon().c_str()), aHotKey,
+                                                isUsePropPanel);
     aCommand->setNestedCommands(aNestedFeatures.split(" ", QString::SkipEmptyParts));
     myActionsMgr->addCommand(aCommand);
     myModule->featureCreated(aCommand);
@@ -528,14 +530,13 @@ void XGUI_Workshop::onExit()
 {
   PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
   DocumentPtr aDoc = aMgr->rootDocument();
-  if(aDoc->isModified()) {
+  if (aDoc->isModified()) {
     int anAnswer = QMessageBox::question(
-        myMainWindow, tr("Save current file"),
-        tr("The document is modified, save before exit?"),
+        myMainWindow, tr("Save current file"), tr("The document is modified, save before exit?"),
         QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
-    if(anAnswer == QMessageBox::Save) {
+    if (anAnswer == QMessageBox::Save) {
       bool saved = onSave();
-      if(!saved) {
+      if (!saved) {
         return;
       }
     } else if (anAnswer == QMessageBox::Cancel) {
@@ -571,13 +572,13 @@ void XGUI_Workshop::onOpen()
   //save current file before close if modified
   PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
   DocumentPtr aDoc = aMgr->rootDocument();
-  if(aDoc->isModified()) {
+  if (aDoc->isModified()) {
     //TODO(sbh): re-launch the app?
     int anAnswer = QMessageBox::question(
         myMainWindow, tr("Save current file"),
         tr("The document is modified, save before opening another?"),
         QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
-    if(anAnswer == QMessageBox::Save) {
+    if (anAnswer == QMessageBox::Save) {
       onSave();
     } else if (anAnswer == QMessageBox::Cancel) {
       return;
@@ -588,10 +589,10 @@ void XGUI_Workshop::onOpen()
 
   //show file dialog, check if readable and open
   myCurrentDir = QFileDialog::getExistingDirectory(mainWindow());
-  if(myCurrentDir.isEmpty())
+  if (myCurrentDir.isEmpty())
     return;
   QFileInfo aFileInfo(myCurrentDir);
-  if(!aFileInfo.exists() || !aFileInfo.isReadable()) {
+  if (!aFileInfo.exists() || !aFileInfo.isReadable()) {
     QMessageBox::critical(myMainWindow, tr("Warning"), tr("Unable to open the file."));
     myCurrentDir = "";
     return;
@@ -607,7 +608,7 @@ void XGUI_Workshop::onOpen()
 //******************************************************
 bool XGUI_Workshop::onSave()
 {
-  if(myCurrentDir.isEmpty()) {
+  if (myCurrentDir.isEmpty()) {
     return onSaveAs();
   }
   saveDocument(myCurrentDir);
@@ -625,18 +626,19 @@ bool XGUI_Workshop::onSaveAs()
   dialog.setOptions(QFileDialog::HideNameFilterDetails | QFileDialog::ShowDirsOnly);
   dialog.setViewMode(QFileDialog::Detail);
 
-  if(!dialog.exec()) {
+  if (!dialog.exec()) {
     return false;
   }
   QString aTempDir = dialog.selectedFiles().first();
   QDir aDir(aTempDir);
-  if(aDir.exists() && !aDir.entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries).isEmpty()) {
-    int answer = QMessageBox::question(myMainWindow,
-                                       //: Title of the dialog which asks user if he wants to save study in existing non-empty folder
-                                       tr("Save"),
-                                       tr("The folder already contains some files, save anyway?"),
-                                       QMessageBox::Save|QMessageBox::Cancel);
-    if(answer == QMessageBox::Cancel) {
+  if (aDir.exists() && !aDir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).isEmpty()) {
+    int answer = QMessageBox::question(
+        myMainWindow,
+        //: Title of the dialog which asks user if he wants to save study in existing non-empty folder
+        tr("Save"),
+        tr("The folder already contains some files, save anyway?"),
+        QMessageBox::Save | QMessageBox::Cancel);
+    if (answer == QMessageBox::Cancel) {
       return false;
     }
   }
@@ -675,13 +677,14 @@ void XGUI_Workshop::onPreferences()
   XGUI_Preferences::editPreferences(aModif);
   if (aModif.size() > 0) {
     QString aSection;
-    foreach (XGUI_Pref aPref, aModif) {
+    foreach (XGUI_Pref aPref, aModif)
+    {
       aSection = aPref.first;
       if (aSection == XGUI_Preferences::VIEWER_SECTION) {
-        if (!isSalomeMode()) 
+        if (!isSalomeMode())
           myMainWindow->viewer()->updateFromResources();
       } else if (aSection == XGUI_Preferences::MENU_SECTION) {
-        if (!isSalomeMode()) 
+        if (!isSalomeMode())
           myMainWindow->menuObject()->updateFromResources();
       }
     }
@@ -691,11 +694,9 @@ void XGUI_Workshop::onPreferences()
 //******************************************************
 ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
 {
-  QString libName =
-      QString::fromStdString(library(theModule.toStdString()));
+  QString libName = QString::fromStdString(library(theModule.toStdString()));
   if (libName.isEmpty()) {
-    qWarning(
-    qPrintable( tr( "Information about module \"%1\" doesn't exist." ).arg( theModule ) ));
+    qWarning(qPrintable(tr("Information about module \"%1\" doesn't exist.").arg(theModule)));
     return 0;
   }
 
@@ -743,7 +744,7 @@ ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
     if (mainWindow()) {
       QMessageBox::warning(mainWindow(), tr("Error"), err);
     } else {
-      qWarning( qPrintable( err ));
+      qWarning(qPrintable(err));
     }
   }
   return aModule;
@@ -766,7 +767,7 @@ bool XGUI_Workshop::activateModule()
 void XGUI_Workshop::updateCommandStatus()
 {
   QList<QAction*> aCommands;
-  if (isSalomeMode()) { // update commands in SALOME mode
+  if (isSalomeMode()) {  // update commands in SALOME mode
     aCommands = salomeConnector()->commandList();
   } else {
     XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
@@ -777,26 +778,29 @@ void XGUI_Workshop::updateCommandStatus()
   if (aMgr->hasRootDocument()) {
     QAction* aUndoCmd;
     QAction* aRedoCmd;
-    foreach(QAction* aCmd, aCommands) {
+    foreach(QAction* aCmd, aCommands)
+    {
       QString aId = aCmd->data().toString();
       if (aId == "UNDO_CMD")
         aUndoCmd = aCmd;
       else if (aId == "REDO_CMD")
         aRedoCmd = aCmd;
-      else // Enable all commands
+      else
+        // Enable all commands
         aCmd->setEnabled(true);
     }
     DocumentPtr aDoc = aMgr->rootDocument();
     aUndoCmd->setEnabled(aDoc->canUndo());
     aRedoCmd->setEnabled(aDoc->canRedo());
   } else {
-    foreach(QAction* aCmd, aCommands) {
+    foreach(QAction* aCmd, aCommands)
+    {
       QString aId = aCmd->data().toString();
       if (aId == "NEW_CMD")
         aCmd->setEnabled(true);
       else if (aId == "EXIT_CMD")
         aCmd->setEnabled(true);
-      else 
+      else
         aCmd->setEnabled(false);
     }
   }
@@ -807,11 +811,12 @@ void XGUI_Workshop::updateCommandStatus()
 QList<QAction*> XGUI_Workshop::getModuleCommands() const
 {
   QList<QAction*> aCommands;
-  if (isSalomeMode()) { // update commands in SALOME mode
+  if (isSalomeMode()) {  // update commands in SALOME mode
     aCommands = salomeConnector()->commandList();
   } else {
     XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
-    foreach(XGUI_Command* aCmd, aMenuBar->features()) {
+    foreach(XGUI_Command* aCmd, aMenuBar->features())
+    {
       aCommands.append(aCmd);
     }
   }
@@ -824,9 +829,11 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
   QDockWidget* aObjDock = new QDockWidget(theParent);
   aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
   aObjDock->setWindowTitle(tr("Object browser"));
-  aObjDock->setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
+  aObjDock->setStyleSheet(
+      "::title { position: relative; padding-left: 5px; text-align: left center }");
   myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
-  connect(myObjectBrowser, SIGNAL(activePartChanged(ObjectPtr)), this, SLOT(changeCurrentDocument(ObjectPtr)));
+  connect(myObjectBrowser, SIGNAL(activePartChanged(ObjectPtr)), this,
+          SLOT(changeCurrentDocument(ObjectPtr)));
   aObjDock->setWidget(myObjectBrowser);
 
   myContextMenuMgr->connectObjectBrowser();
@@ -840,13 +847,12 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
  */
 void XGUI_Workshop::createDockWidgets()
 {
-  QMainWindow* aDesktop = isSalomeMode()? salomeConnector()->desktop() :
-                                          myMainWindow;
+  QMainWindow* aDesktop = isSalomeMode() ? salomeConnector()->desktop() : myMainWindow;
   QDockWidget* aObjDock = createObjectBrowser(aDesktop);
   aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
   myPropertyPanel = new XGUI_PropertyPanel(aDesktop);
   aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
-  hidePropertyPanel(); //<! Invisible by default
+  hidePropertyPanel();  //<! Invisible by default
   hideObjectBrowser();
   aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel);
 
@@ -855,15 +861,15 @@ void XGUI_Workshop::createDockWidgets()
   QPushButton* aCancelBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
   connect(aCancelBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onAbortOperation()));
 
-  connect(myPropertyPanel, SIGNAL(keyReleased(const std::string&, QKeyEvent*)),
-          myOperationMgr, SLOT(onKeyReleased(const std::string&, QKeyEvent*)));
+  connect(myPropertyPanel, SIGNAL(keyReleased(const std::string&, QKeyEvent*)), myOperationMgr,
+          SLOT(onKeyReleased(const std::string&, QKeyEvent*)));
 
-  connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)),
-          myOperationMgr, SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
-  connect(myOperationMgr, SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)),
-          myPropertyPanel, SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
-  connect(myOperationMgr, SIGNAL(operationValidated(bool)),
-          myPropertyPanel, SLOT(setAcceptEnabled(bool)));
+  connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), myOperationMgr,
+          SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
+  connect(myOperationMgr, SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)), myPropertyPanel,
+          SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
+  connect(myOperationMgr, SIGNAL(operationValidated(bool)), myPropertyPanel,
+          SLOT(setAcceptEnabled(bool)));
 
 }
 
@@ -922,7 +928,7 @@ void XGUI_Workshop::changeCurrentDocument(ObjectPtr theObj)
         return;
       }
     }
-  } 
+  }
   aMgr->setCurrentDocument(aMgr->rootDocument());
 }
 
@@ -932,11 +938,10 @@ void XGUI_Workshop::salomeViewerSelectionChanged()
   emit salomeViewerSelection();
 }
 
-
 //**************************************************************
-XGUI_SalomeViewer* XGUI_Workshop::salomeViewer() const 
-{ 
-  return mySalomeConnector->viewer(); 
+XGUI_SalomeViewer* XGUI_Workshop::salomeViewer() const
+{
+  return mySalomeConnector->viewer();
 }
 
 //**************************************************************
@@ -946,7 +951,7 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
   if ((theId == "ACTIVATE_PART_CMD") && (aObjects.size() > 0)) {
     ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObjects.first());
     activatePart(aPart);
-  } else if (theId == "DEACTIVATE_PART_CMD") 
+  } else if (theId == "DEACTIVATE_PART_CMD")
     activatePart(ResultPartPtr());
   else if (theId == "DELETE_CMD")
     deleteObjects(aObjects);
@@ -970,7 +975,7 @@ void XGUI_Workshop::onWidgetValuesChanged()
   QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
   for (; anIt != aLast; anIt++) {
     ModuleBase_ModelWidget* aCustom = *anIt;
-    if (aCustom && (/*!aCustom->isInitialized(aFeature) ||*/ aCustom == aSenderWidget)) {
+    if (aCustom && (/*!aCustom->isInitialized(aFeature) ||*/aCustom == aSenderWidget)) {
       //aCustom->storeValue(aFeature);
       aCustom->storeValue();
     }
@@ -999,15 +1004,16 @@ void XGUI_Workshop::activateLastPart()
 //**************************************************************
 void XGUI_Workshop::deleteObjects(const QList<ObjectPtr>& theList)
 {
-  QMainWindow* aDesktop = isSalomeMode()? salomeConnector()->desktop() : myMainWindow;
-  QMessageBox::StandardButton aRes = QMessageBox::warning(aDesktop, tr("Delete features"), 
-                                                          tr("Seleted features will be deleted. Continue?"), 
-                                                          QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
+  QMainWindow* aDesktop = isSalomeMode() ? salomeConnector()->desktop() : myMainWindow;
+  QMessageBox::StandardButton aRes = QMessageBox::warning(
+      aDesktop, tr("Delete features"), tr("Seleted features will be deleted. Continue?"),
+      QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
   // ToDo: definbe deleting method
   if (aRes == QMessageBox::Yes) {
     PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
     aMgr->rootDocument()->startOperation();
-    foreach (ObjectPtr aObj, theList) {
+    foreach (ObjectPtr aObj, theList)
+    {
       ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
       if (aPart) {
         DocumentPtr aDoc = aPart->document();
@@ -1029,7 +1035,8 @@ void XGUI_Workshop::deleteObjects(const QList<ObjectPtr>& theList)
 //**************************************************************
 void XGUI_Workshop::showObjects(const QList<ObjectPtr>& theList, bool isVisible)
 {
-  foreach (ObjectPtr aObj, theList) {
+  foreach (ObjectPtr aObj, theList)
+  {
     ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
     if (aRes) {
       if (isVisible) {
@@ -1052,15 +1059,16 @@ void XGUI_Workshop::updateCommandsOnViewSelection()
     return;
 
   QList<QAction*> aActions = getModuleCommands();
-  foreach(QAction* aAction, aActions) {
+  foreach(QAction* aAction, aActions)
+  {
     QString aId = aAction->data().toString();
     std::list<ModelAPI_Validator*> aValidators;
     aFactory->validators(aId.toStdString(), aValidators);
     std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
-    for(; aValidator != aValidators.end(); aValidator++) {
+    for (; aValidator != aValidators.end(); aValidator++) {
       if (*aValidator) {
-        const ModuleBase_SelectionValidator* aSelValidator = 
-          dynamic_cast<const ModuleBase_SelectionValidator*>(*aValidator);
+        const ModuleBase_SelectionValidator* aSelValidator =
+            dynamic_cast<const ModuleBase_SelectionValidator*>(*aValidator);
         if (aSelValidator) {
           aAction->setEnabled(aSelValidator->isValid(aSelection));
         }
@@ -1069,7 +1077,6 @@ void XGUI_Workshop::updateCommandsOnViewSelection()
   }
 }
 
-
 //**************************************************************
 void XGUI_Workshop::registerValidators() const
 {
@@ -1077,7 +1084,6 @@ void XGUI_Workshop::registerValidators() const
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
 }
 
-
 //**************************************************************
 void XGUI_Workshop::displayAllResults()
 {
index f80b8cf7d30e4fe82e656c3aa0ae067b0a5248f3..458b8a4c415a9a35c8d358ce98d574adc325900a 100644 (file)
@@ -13,7 +13,6 @@
 #include <QIcon>
 #include <QKeySequence>
 
-
 class XGUI_MainWindow;
 class XGUI_Command;
 class XGUI_Workbench;
@@ -47,10 +46,10 @@ class QAction;
  * \ingroup GUI
  * \brief Class which defines a configuration of the application (Workshop) and launches it.
  */
-class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener
+class XGUI_EXPORT XGUI_Workshop : public QObject, public Events_Listener
 {
 Q_OBJECT
-public:
+ public:
 
   XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
   virtual ~XGUI_Workshop();
@@ -65,22 +64,41 @@ public:
   }
 
   //! Returns selection manager object
-  XGUI_SelectionMgr* selector() const { return mySelector; }
+  XGUI_SelectionMgr* selector() const
+  {
+    return mySelector;
+  }
 
   //! Returns displayer
-  XGUI_Displayer* displayer() const { return myDisplayer; }
+  XGUI_Displayer* displayer() const
+  {
+    return myDisplayer;
+  }
 
   //! ! Returns operation manager.
-  XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
+  XGUI_OperationMgr* operationMgr() const
+  {
+    return myOperationMgr;
+  }
 
   //! ! Returns an actions manager
-  XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; };
+  XGUI_ActionsMgr* actionsMgr() const
+  {
+    return myActionsMgr;
+  }
+  ;
 
   //! Returns property panel widget
-  XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
+  XGUI_PropertyPanel* propertyPanel() const
+  {
+    return myPropertyPanel;
+  }
 
   //! Returns context menu manager object
-  XGUI_ContextMenuMgr* contextMenuMgr() const { return myContextMenuMgr; }
+  XGUI_ContextMenuMgr* contextMenuMgr() const
+  {
+    return myContextMenuMgr;
+  }
 
   //! Creates and adds a new workbench (menu group) with the given name and returns it
   XGUI_Workbench* addWorkbench(const QString& theName);
@@ -89,24 +107,39 @@ public:
   virtual void processEvent(const Events_Message* theMessage);
 
   //! Returns an object which provides interface to Salome Module (LightApp_Module)
-  XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
+  XGUI_SalomeConnector* salomeConnector() const
+  {
+    return mySalomeConnector;
+  }
 
   //! Provides an object which provides interface to Salome Viewer
   XGUI_SalomeViewer* salomeViewer() const;
 
   //! Returns true if the application works as SALOME module
-  bool isSalomeMode() const { return mySalomeConnector != 0; }
+  bool isSalomeMode() const
+  {
+    return mySalomeConnector != 0;
+  }
 
   //! Returns Object browser
-  XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
+  XGUI_ObjectsBrowser* objectBrowser() const
+  {
+    return myObjectBrowser;
+  }
 
   void salomeViewerSelectionChanged();
 
-  XGUI_ViewerProxy* viewer() const { return myViewerProxy; }
+  XGUI_ViewerProxy* viewer() const
+  {
+    return myViewerProxy;
+  }
 
   /// Returns the module connectory
   /// \returns the instance of connector
-  XGUI_ModuleConnector* moduleConnector() const { return myModuleConnector; }
+  XGUI_ModuleConnector* moduleConnector() const
+  {
+    return myModuleConnector;
+  }
 
   //! Returns icon name according to feature Id
   static QString featureIcon(const std::string& theId);
@@ -121,13 +154,16 @@ public:
   //! Show the given features in 3d Viewer
   void showObjects(const QList<ObjectPtr>& theList, bool isVisible);
 
-  ModuleBase_IModule* module() const { return myModule; }
+  ModuleBase_IModule* module() const
+  {
+    return myModule;
+  }
 
 signals:
   void salomeViewerSelection();
   void errorOccurred(const QString&);
 
-public slots:
+ public slots:
   void updateCommandStatus();
   void updateCommandsOnViewSelection();
 
@@ -150,7 +186,7 @@ public slots:
 
   void activateLastPart();
 
-protected:
+ protected:
   //Event-loop processing methods:
   void addFeature(const Config_FeatureMessage*);
   void connectWithOperation(ModuleBase_Operation* theOperation);
@@ -169,7 +205,7 @@ protected:
   void displayDocumentResults(DocumentPtr theDoc);
   void displayGroupResults(DocumentPtr theDoc, std::string theGroup);
 
-protected slots:
+ protected slots:
   /// SLOT, that is called after the operation is started. Update workshop state according to
   /// the started operation, e.g. visualizes the property panel and connect to it.
   void onOperationStarted();
@@ -184,12 +220,11 @@ protected slots:
 
   void onStartWaiting();
 
-private:
+ private:
   void initMenu();
 
   void registerValidators() const;
 
-
   ModuleBase_IModule* loadModule(const QString& theModule);
   bool activateModule();
 
@@ -205,7 +240,7 @@ private:
   XGUI_PropertyPanel* myPropertyPanel;
   XGUI_SelectionMgr* mySelector;
   XGUI_Displayer* myDisplayer;
-  XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
+  XGUI_OperationMgr* myOperationMgr;  ///< manager to manipulate through the operations
   XGUI_ActionsMgr* myActionsMgr;
   XGUI_SalomeConnector* mySalomeConnector;
   XGUI_ErrorDialog* myErrorDlg;