From: Artem Zhidkov Date: Thu, 14 May 2020 12:39:41 +0000 (+0300) Subject: Get rid of compilation warnings. Part I. X-Git-Tag: V9_5_0b1~2^2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1dfcab3d738e427bea678317e167c587dfbff195;p=modules%2Fshaper.git Get rid of compilation warnings. Part I. --- diff --git a/src/BuildPlugin/BuildPlugin_SubShapes.cpp b/src/BuildPlugin/BuildPlugin_SubShapes.cpp index b23458fa3..02c481b1d 100644 --- a/src/BuildPlugin/BuildPlugin_SubShapes.cpp +++ b/src/BuildPlugin/BuildPlugin_SubShapes.cpp @@ -122,8 +122,6 @@ void BuildPlugin_SubShapes::execute() } // Store result. - const int aModVertexTag = 1; - const int aModEdgeTag = 2; ResultBodyPtr aResultBody = document()->createBody(data()); aResultBody->storeModified(aBaseShape, aResultShape); aResultBody->loadModifiedShapes(aBuilder, aBaseShape, GeomAPI_Shape::EDGE); diff --git a/src/BuildPlugin/BuildPlugin_Validators.cpp b/src/BuildPlugin/BuildPlugin_Validators.cpp index 0a3776bab..78f8e6c9d 100644 --- a/src/BuildPlugin/BuildPlugin_Validators.cpp +++ b/src/BuildPlugin/BuildPlugin_Validators.cpp @@ -243,7 +243,7 @@ bool BuildPlugin_ValidatorBaseForFace::isValid(const std::shared_ptrsize() && aFatherGroup.size() != 1) // already good + if (aFatherGroup.size() < (size_t)aList->size() && aFatherGroup.size() != 1) // already good break; - if (aFatherGroup.size() == aList->size()) // no sence to iterate further + if (aFatherGroup.size() == (size_t)aList->size()) // no sence to iterate further break; if (aFatherGroup.size() == 1 && aList->size() > 1 && aCurrentDepth == aMinDepth) aSplitAnyway = true; // split anyway, better that just move @@ -152,7 +152,6 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId) std::set aRemoved; bool aStay = false; // to indicate that the good attribute found stays in the list - int anIndex = 1; // index of the name assigned to group-feature and result // added in the order: 3 2 1 orig=0, so, keep the results to give names later std::list aResults; for(int aNext = aList->size() - 1; aNext >= 0; aNext--) { @@ -171,7 +170,7 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId) aRemoved.insert(aNext); FeaturePtr aNew; - if (aSplitAnyway || aFGroup > aResults.size()) { + if (aSplitAnyway || aFGroup > (int)aResults.size()) { aNew = aDoc->addFeature(ID(), false); aResults.push_front(aNew); // to keep the order } else { // appending in already created new result diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 6254f286e..bbba6b2d7 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -20,141 +20,147 @@ #ifndef CONFIG_KEYWORDS_H_ #define CONFIG_KEYWORDS_H_ +#if defined __GNUC__ || defined __clang__ +#define MAYBE_UNUSED __attribute__((unused)) +#else +#define MAYBE_UNUSED +#endif + /* * Hardcoded xml entities of plugin-*.xml */ -const static char* NODE_WORKBENCH = "workbench"; -const static char* NODE_GROUP = "group"; -const static char* NODE_FEATURE = "feature"; -const static char* NODE_SOURCE = "source"; -const static char* NODE_VALIDATOR = "validator"; -const static char* NODE_XMLPARENT = "libxml_parent"; +MAYBE_UNUSED const static char* NODE_WORKBENCH = "workbench"; +MAYBE_UNUSED const static char* NODE_GROUP = "group"; +MAYBE_UNUSED const static char* NODE_FEATURE = "feature"; +MAYBE_UNUSED const static char* NODE_SOURCE = "source"; +MAYBE_UNUSED const static char* NODE_VALIDATOR = "validator"; +MAYBE_UNUSED const static char* NODE_XMLPARENT = "libxml_parent"; // Property panels -const static char* PROPERTY_PANEL_ID = "property_panel_id"; +MAYBE_UNUSED const static char* PROPERTY_PANEL_ID = "property_panel_id"; // Widgets -const static char* WDG_INFO = "label"; -const static char* WDG_UNDOLABEL = "undo_label"; -const static char* WDG_DOUBLEVALUE = "doublevalue"; -const static char* WDG_DOUBLEVALUELABEL = "labelvalue"; -const static char* WDG_INTEGERVALUE = "integervalue"; -const static char* WDG_BOOLVALUE = "boolvalue"; -const static char* WDG_STRINGVALUE = "stringvalue"; -const static char* WDG_NAMEVALUE = "namevalue"; -const static char* WDG_MULTISELECTOR = "multi_selector"; -const static char* WDG_SHAPE_SELECTOR = "shape_selector"; -const static char* WDG_FEATURE_SELECTOR = "feature_selector"; -const static char* WDG_CONCEALED_OBJECTS_VIEW = "concealed_objects_view"; -const static char* WDG_CHOICE = "choice"; -const static char* WDG_DOUBLEVALUE_EDITOR = "doublevalue_editor"; -const static char* WDG_FILE_SELECTOR= "file_selector"; -const static char* WDG_EXPR_EDITOR = "expr_editor"; -const static char* WDG_PLACE_HOLDER = "placeholder"; -const static char* WDG_ACTION = "action"; -const static char* WDG_POINT_INPUT = "point_input"; -const static char* WDG_SELECTION_FILTERS = "selection_filters"; +MAYBE_UNUSED const static char* WDG_INFO = "label"; +MAYBE_UNUSED const static char* WDG_UNDOLABEL = "undo_label"; +MAYBE_UNUSED const static char* WDG_DOUBLEVALUE = "doublevalue"; +MAYBE_UNUSED const static char* WDG_DOUBLEVALUELABEL = "labelvalue"; +MAYBE_UNUSED const static char* WDG_INTEGERVALUE = "integervalue"; +MAYBE_UNUSED const static char* WDG_BOOLVALUE = "boolvalue"; +MAYBE_UNUSED const static char* WDG_STRINGVALUE = "stringvalue"; +MAYBE_UNUSED const static char* WDG_NAMEVALUE = "namevalue"; +MAYBE_UNUSED const static char* WDG_MULTISELECTOR = "multi_selector"; +MAYBE_UNUSED const static char* WDG_SHAPE_SELECTOR = "shape_selector"; +MAYBE_UNUSED const static char* WDG_FEATURE_SELECTOR = "feature_selector"; +MAYBE_UNUSED const static char* WDG_CONCEALED_OBJECTS_VIEW = "concealed_objects_view"; +MAYBE_UNUSED const static char* WDG_CHOICE = "choice"; +MAYBE_UNUSED const static char* WDG_DOUBLEVALUE_EDITOR = "doublevalue_editor"; +MAYBE_UNUSED const static char* WDG_FILE_SELECTOR= "file_selector"; +MAYBE_UNUSED const static char* WDG_EXPR_EDITOR = "expr_editor"; +MAYBE_UNUSED const static char* WDG_PLACE_HOLDER = "placeholder"; +MAYBE_UNUSED const static char* WDG_ACTION = "action"; +MAYBE_UNUSED const static char* WDG_POINT_INPUT = "point_input"; +MAYBE_UNUSED const static char* WDG_SELECTION_FILTERS = "selection_filters"; // Containers -const static char* WDG_GROUP = "groupbox"; -const static char* WDG_OPTIONALBOX = "optionalbox"; -const static char* WDG_TOOLBOX = "toolbox"; -const static char* WDG_RADIOBOX = "radiobox"; -const static char* WDG_RADIOBOX_ITEM = "radio"; -const static char* WDG_TOOLBOX_BOX = "box"; -const static char* WDG_SWITCH = "switch"; -const static char* WDG_SWITCH_CASE = "case"; -const static char* WDG_FILTER = "filter"; +MAYBE_UNUSED const static char* WDG_GROUP = "groupbox"; +MAYBE_UNUSED const static char* WDG_OPTIONALBOX = "optionalbox"; +MAYBE_UNUSED const static char* WDG_TOOLBOX = "toolbox"; +MAYBE_UNUSED const static char* WDG_RADIOBOX = "radiobox"; +MAYBE_UNUSED const static char* WDG_RADIOBOX_ITEM = "radio"; +MAYBE_UNUSED const static char* WDG_TOOLBOX_BOX = "box"; +MAYBE_UNUSED const static char* WDG_SWITCH = "switch"; +MAYBE_UNUSED const static char* WDG_SWITCH_CASE = "case"; +MAYBE_UNUSED const static char* WDG_FILTER = "filter"; // Common properties (xml attributes of nodes) -const static char* _ID = "id"; +MAYBE_UNUSED const static char* _ID = "id"; // NODE_WORKBENCH properties -const static char* WORKBENCH_DOC = "document"; +MAYBE_UNUSED const static char* WORKBENCH_DOC = "document"; // NODE_SOURCE properties -const static char* SOURCE_FILE = "path"; +MAYBE_UNUSED const static char* SOURCE_FILE = "path"; // NODE_FEATURE properties -const static char* FEATURE_TOOLTIP = "tooltip"; -const static char* GROUP_TOOLBAR = "toolbar"; -const static char* FEATURE_ICON = "icon"; -const static char* FEATURE_TEXT = "title"; -const static char* HELP_FILE = "helpfile"; -const static char* ABORT_CONFIRMATION = "abort_confirmation"; -const static char* HIDEFACES_PANEL = "hidefaces_panel"; -const static char* FEATURE_KEYSEQUENCE = "keysequence"; -const static char* FEATURE_NESTED = "nested"; -const static char* FEATURE_WHEN_NESTED = "when_nested"; -const static char* FEATURE_WHEN_NESTED_ACCEPT = "accept"; -const static char* FEATURE_WHEN_NESTED_ABORT = "abort"; -const static char* FEATURE_DOC = WORKBENCH_DOC; -const static char* FEATURE_MODAL = "modal"; -const static char* FEATURE_APPLY_CONTINUE = "apply_continue"; -const static char* FEATURE_AUTO_PREVIEW = "auto_preview"; -const static char* FEATURE_TITLE_IN_TOOLBAR = "titleInToolbar"; +MAYBE_UNUSED const static char* FEATURE_TOOLTIP = "tooltip"; +MAYBE_UNUSED const static char* GROUP_TOOLBAR = "toolbar"; +MAYBE_UNUSED const static char* FEATURE_ICON = "icon"; +MAYBE_UNUSED const static char* FEATURE_TEXT = "title"; +MAYBE_UNUSED const static char* HELP_FILE = "helpfile"; +MAYBE_UNUSED const static char* ABORT_CONFIRMATION = "abort_confirmation"; +MAYBE_UNUSED const static char* HIDEFACES_PANEL = "hidefaces_panel"; +MAYBE_UNUSED const static char* FEATURE_KEYSEQUENCE = "keysequence"; +MAYBE_UNUSED const static char* FEATURE_NESTED = "nested"; +MAYBE_UNUSED const static char* FEATURE_WHEN_NESTED = "when_nested"; +MAYBE_UNUSED const static char* FEATURE_WHEN_NESTED_ACCEPT = "accept"; +MAYBE_UNUSED const static char* FEATURE_WHEN_NESTED_ABORT = "abort"; +MAYBE_UNUSED const static char* FEATURE_DOC = WORKBENCH_DOC; +MAYBE_UNUSED const static char* FEATURE_MODAL = "modal"; +MAYBE_UNUSED const static char* FEATURE_APPLY_CONTINUE = "apply_continue"; +MAYBE_UNUSED const static char* FEATURE_AUTO_PREVIEW = "auto_preview"; +MAYBE_UNUSED const static char* FEATURE_TITLE_IN_TOOLBAR = "titleInToolbar"; // NODE_VALIDATOR properties -const static char* _PARAMETERS = "parameters"; +MAYBE_UNUSED const static char* _PARAMETERS = "parameters"; // Widget (attribute) properties -const static char* ATTR_TOOLTIP = FEATURE_TOOLTIP; -const static char* ATTR_ICON = FEATURE_ICON; -const static char* ATTR_LABEL = "label"; -const static char* ATTR_STYLE_SHEET = "styleSheet"; -const static char* ATTR_HTML_STYLE = "isHTML"; -const static char* ATTR_DEFAULT = "default"; -const static char* ATTR_INTERNAL = "internal"; -const static char* ATTR_OBLIGATORY = "obligatory"; -const static char* ATTR_CONCEALMENT = "concealment"; -const static char* ATTR_USE_RESET = "use_reset"; -const static char* ATTR_GREED = "greed"; -const static char* ATTR_MODIFIED_IN_EDIT = "modified_in_edit"; -const static char* ATTR_MAIN_ARG = "main_argument"; -const static char* ATTR_GEOMETRICAL_SELECTION = "geometrical_selection"; -const static char* ATTR_VISUAL_CHANGED = "change_visual_attributes"; +MAYBE_UNUSED const static char* ATTR_TOOLTIP = FEATURE_TOOLTIP; +MAYBE_UNUSED const static char* ATTR_ICON = FEATURE_ICON; +MAYBE_UNUSED const static char* ATTR_LABEL = "label"; +MAYBE_UNUSED const static char* ATTR_STYLE_SHEET = "styleSheet"; +MAYBE_UNUSED const static char* ATTR_HTML_STYLE = "isHTML"; +MAYBE_UNUSED const static char* ATTR_DEFAULT = "default"; +MAYBE_UNUSED const static char* ATTR_INTERNAL = "internal"; +MAYBE_UNUSED const static char* ATTR_OBLIGATORY = "obligatory"; +MAYBE_UNUSED const static char* ATTR_CONCEALMENT = "concealment"; +MAYBE_UNUSED const static char* ATTR_USE_RESET = "use_reset"; +MAYBE_UNUSED const static char* ATTR_GREED = "greed"; +MAYBE_UNUSED const static char* ATTR_MODIFIED_IN_EDIT = "modified_in_edit"; +MAYBE_UNUSED const static char* ATTR_MAIN_ARG = "main_argument"; +MAYBE_UNUSED const static char* ATTR_GEOMETRICAL_SELECTION = "geometrical_selection"; +MAYBE_UNUSED const static char* ATTR_VISUAL_CHANGED = "change_visual_attributes"; // WDG_INFO properties -const static char* INFO_WDG_TEXT = FEATURE_TEXT; -const static char* INFO_WDG_TOOLTIP = FEATURE_TOOLTIP; +MAYBE_UNUSED const static char* INFO_WDG_TEXT = FEATURE_TEXT; +MAYBE_UNUSED const static char* INFO_WDG_TOOLTIP = FEATURE_TOOLTIP; // WDG_DOUBLEVALUE properties: -const static char* DOUBLE_WDG_MIN = "min"; -const static char* DOUBLE_WDG_MAX = "max"; -const static char* DOUBLE_WDG_STEP = "step"; -const static char* DOUBLE_WDG_DEFAULT_COMPUTED = "computed"; -const static char* DOUBLE_WDG_ACCEPT_EXPRESSIONS = "accept_expressions"; -const static char* DOUBLE_WDG_ENABLE_VALUE = "enable_value"; +MAYBE_UNUSED const static char* DOUBLE_WDG_MIN = "min"; +MAYBE_UNUSED const static char* DOUBLE_WDG_MAX = "max"; +MAYBE_UNUSED const static char* DOUBLE_WDG_STEP = "step"; +MAYBE_UNUSED const static char* DOUBLE_WDG_DEFAULT_COMPUTED = "computed"; +MAYBE_UNUSED const static char* DOUBLE_WDG_ACCEPT_EXPRESSIONS = "accept_expressions"; +MAYBE_UNUSED const static char* DOUBLE_WDG_ENABLE_VALUE = "enable_value"; -const static char* DOUBLE_WDG_ENABLE_VALUE_BY_PREFERENCES = "enable_by_preferences"; +MAYBE_UNUSED const static char* DOUBLE_WDG_ENABLE_VALUE_BY_PREFERENCES = "enable_by_preferences"; // WDG_TOOLBOX/WDG_SWITCH properties -const static char* CONTAINER_PAGE_NAME = "title"; -const static char* CONTAINER_PAGE_ICON = "icon"; +MAYBE_UNUSED const static char* CONTAINER_PAGE_NAME = "title"; +MAYBE_UNUSED const static char* CONTAINER_PAGE_ICON = "icon"; /* * Hardcoded xml entities of plugins.xml */ -const static char* PLUGIN_FILE = "plugins.xml"; -const static char* NODE_PLUGIN = "plugin"; -const static char* NODE_PLUGINS = "plugins"; +MAYBE_UNUSED const static char* PLUGIN_FILE = "plugins.xml"; +MAYBE_UNUSED const static char* NODE_PLUGIN = "plugin"; +MAYBE_UNUSED const static char* NODE_PLUGINS = "plugins"; -const static char* PLUGINS_MODULE = "module"; -const static char* PLUGIN_CONFIG = "configuration"; -const static char* PLUGIN_LIBRARY = "library"; -const static char* PLUGIN_SCRIPT = "script"; -const static char* PLUGIN_DEPENDENCY = "dependency"; -const static char* PLUGIN_USES = "uses"; +MAYBE_UNUSED const static char* PLUGINS_MODULE = "module"; +MAYBE_UNUSED const static char* PLUGIN_CONFIG = "configuration"; +MAYBE_UNUSED const static char* PLUGIN_LIBRARY = "library"; +MAYBE_UNUSED const static char* PLUGIN_SCRIPT = "script"; +MAYBE_UNUSED const static char* PLUGIN_DEPENDENCY = "dependency"; +MAYBE_UNUSED const static char* PLUGIN_USES = "uses"; /* * Hardcoded xml entities of dataModel.xml */ -const static char* DATAMODEL_FILE = "dataModel.xml"; -const static char* NODE_FOLDER = "folder"; -const static char* FOLDER_NAME = "name"; -const static char* GROUP_TYPE = "group_type"; -const static char* ROOT_DOCUMENT = "root_document"; -const static char* SUB_DOCUMENT = "sub_document"; -const static char* NODE_ICON = "icon"; -const static char* SHOW_EMPTY = "show_empty"; -const static char* LINK_ITEM = "from_result"; -const static char* FOLDER_FEATURES = "folder_features"; +MAYBE_UNUSED const static char* DATAMODEL_FILE = "dataModel.xml"; +MAYBE_UNUSED const static char* NODE_FOLDER = "folder"; +MAYBE_UNUSED const static char* FOLDER_NAME = "name"; +MAYBE_UNUSED const static char* GROUP_TYPE = "group_type"; +MAYBE_UNUSED const static char* ROOT_DOCUMENT = "root_document"; +MAYBE_UNUSED const static char* SUB_DOCUMENT = "sub_document"; +MAYBE_UNUSED const static char* NODE_ICON = "icon"; +MAYBE_UNUSED const static char* SHOW_EMPTY = "show_empty"; +MAYBE_UNUSED const static char* LINK_ITEM = "from_result"; +MAYBE_UNUSED const static char* FOLDER_FEATURES = "folder_features"; #endif /* CONFIG_KEYWORDS_H_ */ diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp index 843af882a..6863ee74c 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp @@ -494,7 +494,8 @@ std::shared_ptr makeRectangularFace(const std::shared_ptrcustomisePresentation(theResult, thePrs, theDefaultPrs); //thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol - return true; + return isCustomized; } //================================================================================================== diff --git a/src/ConstructionPlugin/ConstructionPlugin_Validators.cpp b/src/ConstructionPlugin/ConstructionPlugin_Validators.cpp index 16cb67088..b36b2bd51 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Validators.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Validators.cpp @@ -136,14 +136,11 @@ bool ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel::isValid( aShape2 = aContext2->shape(); } - bool isPlaneFirst = false; anEdge = getEdge(aShape1); - aFace = getFace(aShape2); if(!anEdge.get() || !aFace.get()) { anEdge = getEdge(aShape2); aFace = getFace(aShape1); - isPlaneFirst = true; } if(!anEdge.get() || !aFace.get()) { diff --git a/src/Events/Events_Loop.cpp b/src/Events/Events_Loop.cpp index c0934847c..b62b5694a 100644 --- a/src/Events/Events_Loop.cpp +++ b/src/Events/Events_Loop.cpp @@ -200,9 +200,12 @@ void Events_Loop::flush(const Events_ID& theID) // TODO: Stabilization fix. Check later. if(myFlushed.find(theID.myID) != myFlushed.end()) { myFlushed.erase(myFlushed.find(theID.myID)); - } else { + } +#ifdef _DEBUG + else { bool aProblem = true; } +#endif } // send accumulated messages to "groupListeners" std::map > >::iterator aFindID = diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp index 2a6bfebe4..4253f2bb5 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp @@ -200,7 +200,7 @@ void ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName, anError = "Unsupported format: " + aFormatName; } - if (!anError.empty()) { + if (!aResult || !anError.empty()) { setError("An error occurred while exporting " + theFileName + ": " + anError); return; } diff --git a/src/ExchangePlugin/ExchangePlugin_Import.cpp b/src/ExchangePlugin/ExchangePlugin_Import.cpp index 0f40dacb9..03ade5546 100644 --- a/src/ExchangePlugin/ExchangePlugin_Import.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Import.cpp @@ -138,7 +138,7 @@ void ExchangePlugin_Import::attributeChanged(const std::string& theID) anAcceptedValues.push_back((*aFIt)->name()); } - if (aPartsAttr->size() != anAcceptedValues.size()) + if ((size_t)aPartsAttr->size() != anAcceptedValues.size()) aTargetAttr->setValue(0); aPartsAttr->setSize((int)anAcceptedValues.size()); diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index e4eaa0c95..0b1c6cb95 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -413,7 +413,6 @@ void ExchangePlugin_ImportFeature::loadNamingDS( //load result theResultBody->store(theGeomShape); - int aTag(1); std::string aNameMS = "Shape"; theResultBody->loadFirstLevel(theGeomShape, aNameMS); } diff --git a/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp b/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp index 0f8b06c09..e63d5ee9c 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportPart.cpp @@ -105,7 +105,7 @@ void ExchangePlugin_ImportPart::attributeChanged(const std::string& theID) anAcceptedValues.push_back((*aFIt)->name()); } - if (aPartsAttr->size() != anAcceptedValues.size()) + if ((size_t)aPartsAttr->size() != anAcceptedValues.size()) aTargetAttr->setValue(0); aPartsAttr->setSize((int)anAcceptedValues.size()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp index 01b7f103f..2a3eed919 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp @@ -374,6 +374,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, theMakeShapes.push_back(aMakeShapeList); break; } + default: // [to avoid compilation warnings] + break; } return true; diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index 466cf7121..f49aa97a8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -177,13 +177,10 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes case GeomAPI_Shape::COMPOUND: { aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; } + default: // [to avoid compilation warnings] + break; } - int aLateralIndex = 1; - int aBaseEdgeIndex = 1; - int aVertexIndex = 1; - int aBaseVertexIndex = 1; - if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX || aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) { theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX); @@ -252,6 +249,8 @@ void FeaturesPlugin_CompositeSketch::storeShapes( aShapeTypeToExplore = GeomAPI_Shape::COMPOUND; break; } + default: // [to avoid compilation warnings] + break; } // Store shapes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp index 5828351ef..be47490ad 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp @@ -274,7 +274,7 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBa // Store generated edges/faces. GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType(); - GeomAPI_Shape::ShapeType aShapeTypeToExplode; + GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE; switch(aBaseShapeType) { case GeomAPI_Shape::VERTEX: { @@ -303,6 +303,8 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBa case GeomAPI_Shape::COMPOUND: { aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; } + default: + return; // unsupported type of shape } if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX || @@ -344,7 +346,7 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes, { GeomShapePtr aBaseShape = *anIter; GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType(); - GeomAPI_Shape::ShapeType aShapeTypeToExplode; + GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE; switch(aBaseShapeType) { case GeomAPI_Shape::VERTEX: { aShapeTypeToExplode = GeomAPI_Shape::VERTEX; @@ -367,6 +369,8 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes, aShapeTypeToExplode = GeomAPI_Shape::EDGE; break; } + default: + return; // unsupported type of shape } aResultBody->loadGeneratedShapes(thePipeAlgo, aBaseShape, aShapeTypeToExplode); } @@ -414,6 +418,8 @@ void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody, aShapeTypeToExplore = GeomAPI_Shape::COMPOUND; break; } + default: + return; // unsupported type of shape } // Store shapes. diff --git a/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp b/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp index c5f2f829d..7277bfe0f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp @@ -92,6 +92,8 @@ void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody, GeomAPI_Shape::VERTEX, theName); } + default: // [to avoid compilation warning] + break; } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index 37d1385dd..8b504ec4d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -546,8 +546,7 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid( // LCOV_EXCL_STOP } - std::list::const_iterator - anArgsIt = theArguments.begin(), aLast = theArguments.end(); + std::list::const_iterator anArgsIt = theArguments.begin(); AttributePtr aCheckAttribute = theFeature->attribute(*anArgsIt); ++anArgsIt; @@ -1135,7 +1134,6 @@ bool FeaturesPlugin_ValidatorUnionSelection::isValid(const AttributePtr& theAttr } for(int anIndex = 0; anIndex < aBaseObjectsAttrList->size(); ++anIndex) { - bool isSameFound = false; AttributeSelectionPtr anAttrSelectionInList = aBaseObjectsAttrList->value(anIndex); ResultPtr aContext = anAttrSelectionInList->context(); if (!aContext.get()) { @@ -1686,7 +1684,7 @@ bool FeaturesPlugin_ValidatorBooleanFuseArguments::isValid( int anObjectsNb = 0, aToolsNb = 0; - std::list::const_iterator anIt = theArguments.begin(), aLast = theArguments.end(); + std::list::const_iterator anIt = theArguments.begin(); bool isAllInSameCompSolid = true; ResultBodyPtr aCompSolid; @@ -1737,8 +1735,6 @@ bool FeaturesPlugin_ValidatorBooleanFuseArguments::isValid( } } - anIt++; - if (anObjectsNb + aToolsNb < 2) { theError = "Not enough arguments for Fuse operation."; return false; @@ -1840,9 +1836,8 @@ bool FeaturesPlugin_ValidatorBooleanCommonArguments::isValid( int anObjectsNb = 0, aToolsNb = 0; - std::list::const_iterator anIt = theArguments.begin(), aLast = theArguments.end(); + std::list::const_iterator anIt = theArguments.begin(); - bool isAllInSameCompSolid = true; ResultBodyPtr aCompSolid; AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt); diff --git a/src/FiltersPlugin/FiltersPlugin_OnPlane.cpp b/src/FiltersPlugin/FiltersPlugin_OnPlane.cpp index a1ff1e500..91634e9ad 100644 --- a/src/FiltersPlugin/FiltersPlugin_OnPlane.cpp +++ b/src/FiltersPlugin/FiltersPlugin_OnPlane.cpp @@ -41,6 +41,8 @@ bool FiltersPlugin_OnPlane::isSupported(GeomAPI_Shape::ShapeType theType) const case GeomAPI_Shape::EDGE: case GeomAPI_Shape::VERTEX: return true; + default: // [to avoid compilation warning] + break; } return false; } diff --git a/src/GeomAPI/GeomAPI_Shape.cpp b/src/GeomAPI/GeomAPI_Shape.cpp index 3af9bb739..2fb3073a2 100644 --- a/src/GeomAPI/GeomAPI_Shape.cpp +++ b/src/GeomAPI/GeomAPI_Shape.cpp @@ -227,9 +227,9 @@ bool GeomAPI_Shape::isConnectedTopology() const // (if shapes are connected, vertices are connected for sure) TopExp_Explorer anExp2(aNewIter.Value(), TopAbs_VERTEX); for(; !aConnected && anExp2.More(); anExp2.Next()) { - NCollection_List::Iterator aNotIter(aNotVertices); - for(; aNotIter.More(); aNotIter.Next()) { - if (aNotIter.Value().IsSame(anExp2.Current())) { + NCollection_List::Iterator aNotVIter(aNotVertices); + for(; aNotVIter.More(); aNotVIter.Next()) { + if (aNotVIter.Value().IsSame(anExp2.Current())) { aConnected = true; break; } @@ -551,8 +551,6 @@ GeomAPI_Shape::Orientation GeomAPI_Shape::orientation() const void GeomAPI_Shape::setOrientation(const GeomAPI_Shape::Orientation theOrientation) { - TopAbs_Orientation anOrientation = MY_SHAPE->Orientation(); - switch(theOrientation) { case FORWARD: MY_SHAPE->Orientation(TopAbs_FORWARD); break; case REVERSED: MY_SHAPE->Orientation(TopAbs_REVERSED); break; diff --git a/src/GeomAPI/GeomAPI_Shell.cpp b/src/GeomAPI/GeomAPI_Shell.cpp index bbd473804..dcd990372 100644 --- a/src/GeomAPI/GeomAPI_Shell.cpp +++ b/src/GeomAPI/GeomAPI_Shell.cpp @@ -97,8 +97,8 @@ std::shared_ptr GeomAPI_Shell::getCylinder() const GeomPointPtr aLocation; GeomDirPtr anAxis; - double aRadius; - double aHeight; + double aRadius = 0.0; + double aHeight = 0.0; for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); anExp.Next()) { GeomFacePtr aFace(new GeomAPI_Face); @@ -175,8 +175,8 @@ std::shared_ptr GeomAPI_Shell::getCone() const GeomPointPtr anApex; GeomDirPtr anAxis; - double aSemiAngle, aTanSemiAngle; - double aHeight1, aHeight2; + double aSemiAngle = 0.0, aTanSemiAngle = 0.0; + double aHeight1 = 0.0, aHeight2 = 0.0; for (TopExp_Explorer anExp(impl(), TopAbs_FACE); anExp.More(); anExp.Next()) { GeomFacePtr aFace(new GeomAPI_Face); @@ -210,7 +210,7 @@ std::shared_ptr GeomAPI_Shell::getCone() const double aSign = anAxis->dot(aCurCone->axis()); double aCurSemiAngle = aCurCone->semiAngle(); - double aTanCurSemiAngle = Tan(aSemiAngle); + double aTanCurSemiAngle = Tan(aCurSemiAngle); double aH = aCurCone->radius1() / aTanCurSemiAngle * aSign; if (aH < aHeight1) diff --git a/src/GeomAPI/GeomAPI_Solid.cpp b/src/GeomAPI/GeomAPI_Solid.cpp index da5513119..9fb6d44fd 100644 --- a/src/GeomAPI/GeomAPI_Solid.cpp +++ b/src/GeomAPI/GeomAPI_Solid.cpp @@ -68,8 +68,8 @@ std::shared_ptr GeomAPI_Solid::getCylinder() const GeomPointPtr aLocation; GeomDirPtr anAxis; - double aRadius; - double aHeight; + double aRadius = 0.0; + double aHeight = 0.0; GeomPlanePtr aCaps[2]; @@ -173,8 +173,8 @@ std::shared_ptr GeomAPI_Solid::getCone() const GeomPointPtr anApex; GeomDirPtr anAxis; - double aSemiAngle; - double aHeight; + double aSemiAngle = 0.0; + double aHeight = 0.0; GeomPlanePtr aCaps[2]; diff --git a/src/GeomAPI/GeomAPI_Tools.cpp b/src/GeomAPI/GeomAPI_Tools.cpp index f09603760..863698110 100644 --- a/src/GeomAPI/GeomAPI_Tools.cpp +++ b/src/GeomAPI/GeomAPI_Tools.cpp @@ -32,8 +32,6 @@ GeomShapePtr GeomAPI_Tools::getTypedShape(const GeomShapePtr& theShape) GeomShapePtr aTypedShape = theShape; - GeomAPI_Shape::ShapeType aType = theShape->shapeType(); - switch (theShape->shapeType()) { case GeomAPI_Shape::VERTEX: aTypedShape = GeomShapePtr(new GeomAPI_Vertex(theShape)); @@ -47,6 +45,8 @@ GeomShapePtr GeomAPI_Tools::getTypedShape(const GeomShapePtr& theShape) case GeomAPI_Shape::WIRE: aTypedShape = GeomShapePtr(new GeomAPI_Wire(theShape)); break; + default: + break; } return aTypedShape; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp index 5ee9d9544..cc000fc26 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_MakeShape.cpp @@ -233,6 +233,8 @@ void GeomAlgoAPI_MakeShape::initialize() myShape->setImpl(new TopoDS_Shape(implPtr()->Shape())); break; } + default: + break; } if(myMap.get()) { diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp index 6151984e2..4d5620144 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Sewing.cpp @@ -84,7 +84,6 @@ void GeomAlgoAPI_Sewing::build(const ListOfShape& theShapes) void GeomAlgoAPI_Sewing::modified(const std::shared_ptr theShape, ListOfShape& theHistory) { - static int anIndex = 0; if(!theShape.get()) { return; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index d478adfa3..639e9aace 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -276,7 +276,6 @@ std::shared_ptr GeomAlgoAPI_ShapeTools::combineShapes( NCollection_Vector> aShapesWithCommonSubshapes; for(TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIter(aMapSA); anIter.More(); anIter.Next()) { - const TopoDS_Shape& aShape = anIter.Key(); TopTools_ListOfShape& aListOfShape = anIter.ChangeValue(); if(aListOfShape.IsEmpty()) { continue; @@ -598,7 +597,6 @@ std::list > Standard_Real aYArr[2] = {aBndBox.CornerMin().Y(), aBndBox.CornerMax().Y()}; Standard_Real aZArr[2] = {aBndBox.CornerMin().Z(), aBndBox.CornerMax().Z()}; std::list > aResultPoints; - int aNum = 0; for(int i = 0; i < 2; i++) { for(int j = 0; j < 2; j++) { for(int k = 0; k < 2; k++) { @@ -1057,7 +1055,7 @@ static TopoDS_Wire fixParametricGaps(const TopoDS_Wire& theWire) { TopoDS_Wire aFixedWire; Handle(Geom_Curve) aPrevCurve; - double aPrevLastParam = 0.0; + double aPrevLastParam = -Precision::Infinite(); BRep_Builder aBuilder; aBuilder.MakeWire(aFixedWire); @@ -1067,7 +1065,7 @@ static TopoDS_Wire fixParametricGaps(const TopoDS_Wire& theWire) TopoDS_Edge anEdge = aWExp.Current(); double aFirst, aLast; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast); - if (aCurve == aPrevCurve) { + if (aCurve == aPrevCurve && Abs(aFirst - aPrevLastParam) > Precision::Confusion()) { // if parametric gap occurs, create new edge based on the copied curve aCurve = Handle(Geom_Curve)::DownCast(aCurve->Copy()); TopoDS_Vertex aV1, aV2; diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp index 21c6a9b4d..3dea07408 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_WireBuilder.cpp @@ -153,7 +153,6 @@ bool GeomAlgoAPI_WireBuilder::isSelfIntersected(const GeomShapePtr& theWire) } // Check intersections between edges pair-wise - int aNbEdges = (int)anEdges.size(); std::list::const_iterator anEdgesIt = anEdges.begin(); for (int i = 0; anEdgesIt != anEdges.end(); ++anEdgesIt, i++) { GeomEdgePtr anEdge1(new GeomAPI_Edge(*anEdgesIt)); diff --git a/src/GeomValidators/GeomValidators_ShapeType.cpp b/src/GeomValidators/GeomValidators_ShapeType.cpp index 61e1a048b..5b5fd026a 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.cpp +++ b/src/GeomValidators/GeomValidators_ShapeType.cpp @@ -81,11 +81,11 @@ std::string getShapeTypeDescription(const GeomValidators_ShapeType::TypeOfShape& if (MyShapeTypes.size() != 0) { std::map::const_iterator anIt = MyShapeTypes.begin(), aLast = MyShapeTypes.end(); - for (; anIt != aLast; anIt++) { - if (anIt->second == theType) + for (; anIt != aLast; anIt++) + if (anIt->second == theType) { aValue = anIt->first; break; - } + } } return aValue; } diff --git a/src/GeomValidators/GeomValidators_ZeroOffset.cpp b/src/GeomValidators/GeomValidators_ZeroOffset.cpp index 37cbd0c9a..ff484ce85 100644 --- a/src/GeomValidators/GeomValidators_ZeroOffset.cpp +++ b/src/GeomValidators/GeomValidators_ZeroOffset.cpp @@ -46,7 +46,7 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr& } // LCOV_EXCL_STOP - std::list::const_iterator anIt = theArguments.begin(), aLast = theArguments.end(); + std::list::const_iterator anIt = theArguments.begin(); std::string aSelectedMethod; if(theFeature->string(*anIt)) { diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index f3b094d6c..888f0c00a 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -146,8 +146,6 @@ bool Model_AttributeSelection::setValue(const ObjectPtr& theContext, isDegeneratedEdge = BRep_Tool::Degenerated(TopoDS::Edge(aSubShape)) == Standard_True; } if (!theContext.get() || isDegeneratedEdge) { - // to keep the reference attribute label - TDF_Label aRefLab = myRef.myRef->Label(); aSelLab.ForgetAllAttributes(true); myRef.myRef = TDF_Reference::Set(aSelLab.Father(), aSelLab.Father()); if (aToUnblock) @@ -232,6 +230,8 @@ void Model_AttributeSelection::setValueCenter( anUpdated = !aSelLab.IsAttribute(kELLIPSE_CENTER2); TDataStd_UAttribute::Set(aSelLab, kELLIPSE_CENTER2); break; + default: // [to avoid compilation warning] + break; } if (anUpdated) owner()->data()->sendAttributeUpdated(this); @@ -1690,7 +1690,6 @@ void Model_AttributeSelection::updateInHistory(bool& theRemove) if (!aPairIter.More()) return; TopoDS_Shape aNewCShape = aPairIter.NewShape(); - bool anIterate = true; // trying to update also the sub-shape selected GeomShapePtr aSubShape = value(); if (aSubShape.get() && aSubShape->isEqual(aContext->shape())) diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 6acbcc4a9..e28cbe647 100644 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -79,6 +79,7 @@ static int getGenerationTag(const TopoDS_Shape& theShape) { case TopAbs_VERTEX: return GENERATED_VERTICES_TAG; case TopAbs_EDGE: return GENERATED_EDGES_TAG; case TopAbs_FACE: return GENERATED_FACES_TAG; + default: break; // [to avoid compilation warning] } return INVALID_TAG; @@ -90,6 +91,7 @@ static int getModificationTag(const TopoDS_Shape& theShape) { case TopAbs_VERTEX: return MODIFIED_VERTICES_TAG; case TopAbs_EDGE: return MODIFIED_EDGES_TAG; case TopAbs_FACE: return MODIFIED_FACES_TAG; + default: break; // [to avoid compilation warning] } return INVALID_TAG; @@ -218,7 +220,6 @@ void Model_BodyBuilder::storeGenerated(const GeomShapePtr& theFromShape, { std::shared_ptr aData = std::dynamic_pointer_cast(data()); if (aData) { - TDF_Label aShapeLab = aData->shapeLab(); // clean builders if (theIsCleanStored) clean(); diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index ef56b55d5..8469e5e75 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -104,8 +104,11 @@ static const int TAG_EXTERNAL_CONSTRUCTIONS = 5; static const Standard_GUID kEXTERNAL_SHAPE_REF("9aa5dd14-6d34-4a8d-8786-05842fd7bbbd"); Model_Document::Model_Document(const int theID, const std::string theKind) - : myID(theID), myKind(theKind), myIsActive(false), myIsSetCurrentFeature(false), - myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format + : myID(theID), + myKind(theKind), + myDoc(new TDocStd_Document("BinOcaf")), // binary OCAF format + myIsActive(false), + myIsSetCurrentFeature(false) { #ifdef TINSPECTOR CDF_Session::CurrentSession()->Directory()->Add(myDoc); @@ -386,7 +389,6 @@ bool Model_Document::importPart(const char* theFileName, TDF_LabelList anAllNewFeatures; // Perform the copying twice for correct references: // 1. copy labels hierarchy and fill the relocation table - TDF_Label aMain = myDoc->Main(); for (TDF_ChildIterator anIt(aTempDoc->Main()); anIt.More(); anIt.Next()) { TDF_Label aCurrentLab = anIt.Value(); Handle(TDataStd_Comment) aFeatureID; @@ -990,7 +992,7 @@ bool Model_Document::isOperation() const bool Model_Document::isModified() { // is modified if at least one operation was committed and not undone - return myTransactions.size() != myTransactionSave || isOperation(); + return (int)myTransactions.size() != myTransactionSave || isOperation(); } bool Model_Document::canUndo() @@ -1928,7 +1930,7 @@ ResultPtr Model_Document::findByName( } if (aNumInHistory) { std::map >::iterator aFind = myNamingNames.find(aName); - if (aFind != myNamingNames.end() && aFind->second.size() > aNumInHistory) { + if (aFind != myNamingNames.end() && (int)aFind->second.size() > aNumInHistory) { std::list::reverse_iterator aLibIt = aFind->second.rbegin(); for(; aNumInHistory != 0; aNumInHistory--) aLibIt++; diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index c3f62ce67..e1a2d99c2 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -49,6 +49,10 @@ #include #include +// 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); + int kUNDEFINED_FEATURE_INDEX = -1; static const std::string& groupNameFoldering(const std::string& theGroupID, @@ -619,9 +623,6 @@ ObjectPtr Model_Objects::object(const std::string& theGroupID, return ObjectPtr(); createHistory(theGroupID); const std::string& aGroupID = groupNameFoldering(theGroupID, theAllowFolder); - const std::vector& aVec = myHistory[theGroupID]; - //if (aVec.size() <= theIndex) - // return aVec[aVec.size() - 1]; // too high index requested (to avoid crash in #2360) return aGroupID.empty() ? myHistory[theGroupID][theIndex] : myHistory[aGroupID][theIndex]; } @@ -809,11 +810,11 @@ void Model_Objects::synchronizeFeatures( return; // after all updates, sends a message that groups of features were created or updated Events_Loop* aLoop = Events_Loop::loop(); - static Events_ID aDispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static Events_ID aCreateEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); + //static Events_ID aDispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); + static Events_ID aCreateEvent = aLoop->eventByName(EVENT_OBJECT_CREATED); + static Events_ID anUpdateEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED); static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); - static Events_ID aDeleteEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED); + static Events_ID aDeleteEvent = aLoop->eventByName(EVENT_OBJECT_DELETED); static Events_ID aToHideEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY); bool isActive = aLoop->activateFlushes(false); @@ -1826,7 +1827,7 @@ std::string Model_Objects::featureResultGroup(FeaturePtr theFeature) if (aLabIter.More()) { TDF_Label anArgLab = aLabIter.Value(); Handle(TDataStd_Comment) aGroup; - if (aLabIter.Value().FindAttribute(TDataStd_Comment::GetID(), aGroup)) { + if (anArgLab.FindAttribute(TDataStd_Comment::GetID(), aGroup)) { return TCollection_AsciiString(aGroup->Get()).ToCString(); } } @@ -1885,7 +1886,7 @@ void Model_Objects::updateResults(FeaturePtr theFeature, std::set& t if (aGroup->Get() == ModelAPI_ResultBody::group().c_str()) { aNewBody = createBody(theFeature->data(), aResIndex); } else if (aGroup->Get() == ModelAPI_ResultPart::group().c_str()) { - if (aResIndex <= theFeature->results().size()) { // to avoid crash if previous execute + if (aResIndex <= (int)theFeature->results().size()) { // to avoid crash if previous execute // for index = 0 erases result std::shared_ptr aNewP = createPart(theFeature->data(), aResIndex); if (!aNewP->data()->isDeleted()) { @@ -2103,7 +2104,6 @@ std::shared_ptr Model_Objects::internalFeature(const int theIn 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) { diff --git a/src/Model/Model_Objects.h b/src/Model/Model_Objects.h index e44023208..1be771ea1 100644 --- a/src/Model/Model_Objects.h +++ b/src/Model/Model_Objects.h @@ -35,10 +35,6 @@ #include #include -// 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); - extern int kUNDEFINED_FEATURE_INDEX; /**\class Model_Objects @@ -192,7 +188,7 @@ class Model_Objects DocumentPtr owner() {return myDoc;} //! Deletes all managed features with emitting of corresponded signal - ~Model_Objects(); + virtual ~Model_Objects(); protected: diff --git a/src/Model/Model_ResultConstruction.cpp b/src/Model/Model_ResultConstruction.cpp index 87f3ec6b8..ee7f404a7 100644 --- a/src/Model/Model_ResultConstruction.cpp +++ b/src/Model/Model_ResultConstruction.cpp @@ -440,7 +440,6 @@ void storeFacesOnLabel(std::shared_ptr& theDocument, aBuilder.Generated(theShape); theDocument->addNamingName(theShapeLabel, theName); // set new faces to the labels - int aCurrentTag = 1; NCollection_List::Iterator anUnordered(theUnorderedFaces); for (int aCurrentTag = 1; !theFacesOrder.IsEmpty() || anUnordered.More(); aCurrentTag++) { TopoDS_Face aFaceToPut; diff --git a/src/Model/Model_ResultField.cpp b/src/Model/Model_ResultField.cpp index 5efa5dd39..0f406a934 100644 --- a/src/Model/Model_ResultField.cpp +++ b/src/Model/Model_ResultField.cpp @@ -104,14 +104,14 @@ void Model_ResultField::updateSteps() { // Update Array of steps int aNbSteps = stepsSize(); - if (mySteps.size() != aNbSteps) { - while(mySteps.size() > aNbSteps) { + if ((int)mySteps.size() != aNbSteps) { + while((int)mySteps.size() > aNbSteps) { //delete mySteps.back(); mySteps.pop_back(); } - while(mySteps.size() < aNbSteps) { + while((int)mySteps.size() < aNbSteps) { mySteps.push_back(FieldStepPtr(new Model_ResultField::Model_FieldStep(this, - int(mySteps.size())))); + (int)mySteps.size()))); } } } @@ -146,7 +146,7 @@ std::string Model_ResultField::textLine(int theLine) const // LCOV_EXCL_START std::shared_ptr Model_ResultField::step(int theId) const { - if (theId < mySteps.size()) { + if (theId < (int)mySteps.size()) { return mySteps[theId]; } return NULL; diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index cd3997aca..044893237 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -290,7 +290,7 @@ std::string Model_ResultPart::nameInPart(const std::shared_ptr& t std::shared_ptr aDoc = std::dynamic_pointer_cast(partDoc()); if (!aDoc.get()) // the part document is not presented for the moment return ""; - TDF_Label anAccessLabel = aDoc->generalLabel(); + MAYBE_UNUSED TDF_Label anAccessLabel = aDoc->generalLabel(); // make the selection attribute anyway: // otherwise just by name it is not stable to search the result std::string aName; diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index d006d4374..9e8de8d22 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -227,7 +227,7 @@ bool Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { void Model_Update::processEvent(const std::shared_ptr& theMessage) { static Events_Loop* aLoop = Events_Loop::loop(); - static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); + //static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); static const Events_ID kCreatedEvent = aLoop->eventByName(EVENT_OBJECT_CREATED); static const Events_ID kUpdatedEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED); static const Events_ID kOpFinishEvent = aLoop->eventByName("FinishOperation"); @@ -265,7 +265,7 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag } } processFeatures(); - myIsPreviewBlocked = myIsPreviewBlocked; + myIsPreviewBlocked = aPreviewBlockedState; } } diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index 5b2992312..0547252dc 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -37,78 +37,85 @@ class ModelAPI_Document; class ModelAPI_ResultParameter; class GeomAPI_Pnt2d; +#if defined __GNUC__ || defined __clang__ +#define MAYBE_UNUSED __attribute__((unused)) +#else +#define MAYBE_UNUSED +#endif + /// Event ID that feature is created (comes with ModelAPI_ObjectUpdatedMessage) -static const char * EVENT_OBJECT_CREATED = "ObjectCreated"; +MAYBE_UNUSED static const char * EVENT_OBJECT_CREATED = "ObjectCreated"; /// Event ID that data of feature is updated (comes with Model_ObjectUpdatedMessage) -static const char * EVENT_OBJECT_UPDATED = "ObjectUpdated"; +MAYBE_UNUSED static const char * EVENT_OBJECT_UPDATED = "ObjectUpdated"; /// Event ID that data of feature is deleted (comes with Model_ObjectDeletedMessage) -static const char * EVENT_OBJECT_DELETED = "ObjectDeleted"; +MAYBE_UNUSED static const char * EVENT_OBJECT_DELETED = "ObjectDeleted"; /// Event ID that name of feature is changed (comes with Model_ObjectRenamedMessage) -static const char * EVENT_OBJECT_RENAMED = "ObjectRenamed"; +MAYBE_UNUSED static const char * EVENT_OBJECT_RENAMED = "ObjectRenamed"; /// Event ID that data of feature is updated (comes with ModelAPI_ObjectUpdatedMessage) -static const char * EVENT_OBJECT_MOVED = "ObjectsMoved"; +MAYBE_UNUSED static const char * EVENT_OBJECT_MOVED = "ObjectsMoved"; /// Event ID that visualization must be redisplayed (comes with ModelAPI_ObjectUpdatedMessage) -static const char * EVENT_OBJECT_TO_REDISPLAY = "ObjectsToRedisplay"; +MAYBE_UNUSED static const char * EVENT_OBJECT_TO_REDISPLAY = "ObjectsToRedisplay"; /// Event ID that plugin is loaded (comes with ModelAPI_ObjectUpdatedMessage) -static const char * EVENT_PLUGIN_LOADED = "PluginLoaded"; +MAYBE_UNUSED static const char * EVENT_PLUGIN_LOADED = "PluginLoaded"; /// The active document becomes another one -static const char * EVENT_DOCUMENT_CHANGED = "CurrentDocumentChanged"; +MAYBE_UNUSED static const char * EVENT_DOCUMENT_CHANGED = "CurrentDocumentChanged"; /// Event ID that order of objects in group is changed, /// so, tree must be fully recreated (movement of feature) -static const char * EVENT_ORDER_UPDATED = "OrderUpdated"; +MAYBE_UNUSED static const char * EVENT_ORDER_UPDATED = "OrderUpdated"; /// Event ID that the sketch is prepared and all grouped messages for the solver may be flushed -static const char * EVENT_UPDATE_SELECTION = "UpdateSelection"; +MAYBE_UNUSED static const char * EVENT_UPDATE_SELECTION = "UpdateSelection"; /// Request for the enabled/disabled actions behavior for some specific features -static const char * EVENT_FEATURE_STATE_REQUEST = "FeatureStateRequest"; +MAYBE_UNUSED static const char * EVENT_FEATURE_STATE_REQUEST = "FeatureStateRequest"; /// Reply for the enabled/disabled actions behavior for some specific features -static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse"; +MAYBE_UNUSED static const char * EVENT_FEATURE_STATE_RESPONSE = "FeatureStateResponse"; /// To block the viewer updates -static const char * EVENT_UPDATE_VIEWER_BLOCKED = "UpdateViewerBlocked"; +MAYBE_UNUSED static const char * EVENT_UPDATE_VIEWER_BLOCKED = "UpdateViewerBlocked"; /// To unblock the viewer updates -static const char * EVENT_UPDATE_VIEWER_UNBLOCKED = "UpdateViewerUnblocked"; +MAYBE_UNUSED static const char * EVENT_UPDATE_VIEWER_UNBLOCKED = "UpdateViewerUnblocked"; /// To inform that there is an empty presentation in the viewer -static const char * EVENT_EMPTY_AIS_PRESENTATION = "EmptyAISPresentation"; +MAYBE_UNUSED static const char * EVENT_EMPTY_AIS_PRESENTATION = "EmptyAISPresentation"; /// To inform that there is an empty operation for presentation in the viewer -static const char * EVENT_EMPTY_OPERATION_PRESENTATION = "EmptyOperationPresentation"; +MAYBE_UNUSED static const char * EVENT_EMPTY_OPERATION_PRESENTATION = "EmptyOperationPresentation"; /// To block preview -static const char * EVENT_PREVIEW_BLOCKED = "PreviewBlocked"; +MAYBE_UNUSED static const char * EVENT_PREVIEW_BLOCKED = "PreviewBlocked"; /// To preview the current feature in the viewer (to compute the result) -static const char * EVENT_PREVIEW_REQUESTED = "PreviewRequested"; +MAYBE_UNUSED static const char * EVENT_PREVIEW_REQUESTED = "PreviewRequested"; /// To block automatic recomputation of any feature (by the GUI button press) -static const char * EVENT_AUTOMATIC_RECOMPUTATION_DISABLE = "DisableAutomaticRecomputation"; +MAYBE_UNUSED static const char * EVENT_AUTOMATIC_RECOMPUTATION_DISABLE = "DisableAutomaticRecomputation"; /// To unblock block automatic recomputation (default state: the GUI button unpressed) -static const char * EVENT_AUTOMATIC_RECOMPUTATION_ENABLE = "EnableAutomaticRecomputation"; +MAYBE_UNUSED static const char * EVENT_AUTOMATIC_RECOMPUTATION_ENABLE = "EnableAutomaticRecomputation"; /// Event ID that solver has conflicting constraints (comes with ModelAPI_SolverFailedMessage) -static const char * EVENT_SOLVER_FAILED = "SolverFailed"; +MAYBE_UNUSED static const char * EVENT_SOLVER_FAILED = "SolverFailed"; /// Event ID that the problem in solver disappeared -static const char * EVENT_SOLVER_REPAIRED = "SolverRepaired"; +MAYBE_UNUSED static const char * EVENT_SOLVER_REPAIRED = "SolverRepaired"; /// Event Id that sketch has DoF = 0 -static const char * EVENT_SKETCH_FULLY_CONSTRAINED = "SketchFullyConstrainted"; +MAYBE_UNUSED static const char * EVENT_SKETCH_FULLY_CONSTRAINED = "SketchFullyConstrainted"; /// Event Id that sketch has DoF > 0 -static const char * EVENT_SKETCH_UNDER_CONSTRAINED = "SketchUnderConstrainted"; +MAYBE_UNUSED static const char * EVENT_SKETCH_UNDER_CONSTRAINED = "SketchUnderConstrainted"; /// Event Id that sketch has DoF < 0 -static const char * EVENT_SKETCH_OVER_CONSTRAINED = "SketchOverConstrainted"; +MAYBE_UNUSED static const char * EVENT_SKETCH_OVER_CONSTRAINED = "SketchOverConstrainted"; /// Event ID that informs that some object has changed the stability -static const char * EVENT_STABILITY_CHANGED = "StabilityChanged"; +MAYBE_UNUSED static const char * EVENT_STABILITY_CHANGED = "StabilityChanged"; /// Event ID that the sketch is prepared and all grouped messages for the solver may be flushed -static const char * EVENT_SKETCH_PREPARED = "SketchPrepared"; +MAYBE_UNUSED static const char * EVENT_SKETCH_PREPARED = "SketchPrepared"; /// Event ID that provides a request for list of non-fixed objects necessary for DoF = 0 -static const char * EVENT_GET_DOF_OBJECTS = "GetDoFObjects"; +MAYBE_UNUSED static const char * EVENT_GET_DOF_OBJECTS = "GetDoFObjects"; /// Event ID that provides a request for list of non-fixed objects necessary for DoF = 0 -static const char * EVENT_DOF_OBJECTS = "DoFObjects"; +MAYBE_UNUSED static const char * EVENT_DOF_OBJECTS = "DoFObjects"; /// Event ID that requests updates visual attributes for presentations -static const char * EVENT_VISUAL_ATTRIBUTES = "UpdateVisualAttributes"; +MAYBE_UNUSED static const char * EVENT_VISUAL_ATTRIBUTES = "UpdateVisualAttributes"; + /// Message that feature was changed (used for Object Browser update): moved, updated and deleted class MODELAPI_EXPORT ModelAPI_ObjectUpdatedMessage : public Events_MessageGroup @@ -175,6 +182,8 @@ public: class MODELAPI_EXPORT ModelAPI_EventCreator { public: + virtual ~ModelAPI_EventCreator() {} + /// 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; diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index 7b354f891..bf478d4e7 100644 --- a/src/ModelAPI/ModelAPI_Feature.h +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -254,6 +254,8 @@ typedef std::shared_ptr FeaturePtr; //! over this feature. class ModelAPI_FeatureCopyInterface { public: + virtual ~ModelAPI_FeatureCopyInterface() {} + /// An algorithm to update the moved feature by the separate Copy feature /// \param theContext the original context object /// \param theValue the original shape diff --git a/src/ModelAPI/ModelAPI_FiltersFactory.h b/src/ModelAPI/ModelAPI_FiltersFactory.h index e458e9df5..d8735a5c6 100644 --- a/src/ModelAPI/ModelAPI_FiltersFactory.h +++ b/src/ModelAPI/ModelAPI_FiltersFactory.h @@ -34,6 +34,8 @@ class ModelAPI_FiltersFactory { public: + virtual ~ModelAPI_FiltersFactory() {} + /// Register an instance of a filter /// \param theID unique identifier of the filter, not necessary equal to the name of filter /// \param theFilter the filter's instance diff --git a/src/ModelAPI/ModelAPI_Validator.h b/src/ModelAPI/ModelAPI_Validator.h index 442ad4a18..b7f378b98 100644 --- a/src/ModelAPI/ModelAPI_Validator.h +++ b/src/ModelAPI/ModelAPI_Validator.h @@ -65,6 +65,8 @@ typedef std::shared_ptr ValidatorPtr; class MODELAPI_EXPORT ModelAPI_ValidatorsFactory { public: + virtual ~ModelAPI_ValidatorsFactory() {} + /// Registers the instance of the validator by the ID virtual void registerValidator(const std::string& theID, ModelAPI_Validator* theValidator) = 0; diff --git a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp index 45b1d3a33..19328db10 100644 --- a/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp +++ b/src/ModelGeomAlgo/ModelGeomAlgo_Point2D.cpp @@ -386,7 +386,7 @@ std::string doubleToString(double theValue) { std::string aValueStr; char aBuf[50]; - int n = sprintf(aBuf, "%g", theValue); + sprintf(aBuf, "%g", theValue); aValueStr = std::string(aBuf); return aValueStr; } diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 03047bfa9..c25f2cbc6 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -674,7 +674,6 @@ void ModelHighAPI_Dumper::saveResultNames(const FeaturePtr& theFeature) bool isFeatureDefaultName = myNames[theFeature].myIsDefault; // Save only names of results which is not correspond to default feature name - const std::list& aResults = theFeature->results(); std::list allRes; ModelAPI_Tools::allResults(theFeature, allRes); for(std::list::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) { @@ -1618,7 +1617,7 @@ void ModelHighAPI_Dumper::exportVariables() const exportVariable(anEntry, aNameIter->second.myCurrentName); size_t aSize = aFeature->results().size(); if (aSize > 1) { // additional entries for features with more than one result - for(int a = 1; a < aSize; a++) { + for(size_t a = 1; a < aSize; a++) { std::ostringstream aResEntryStr; aResEntryStr<selectSubShape( myWeakNamingPair.first, myWeakNamingPair.second.first, myWeakNamingPair.second.second); break; + case VT_Filtering: + break; // do nothing [to avoid compilation warning] } if (theAttribute->isInvalid()) { @@ -178,6 +180,8 @@ std::string ModelHighAPI_Selection::shapeType() const myResultSubShapePair.first->shape()->shapeTypeStr(); case VT_TypeSubShapeNamePair: return myTypeSubShapeNamePair.first; case VT_TypeInnerPointPair: return myTypeInnerPointPair.first; + default: + break; // do nothing [to avoid compilation warning] } return "SHAPE"; diff --git a/src/ModelHighAPI/ModelHighAPI_Tools.cpp b/src/ModelHighAPI/ModelHighAPI_Tools.cpp index 52f07aa79..3f82be311 100644 --- a/src/ModelHighAPI/ModelHighAPI_Tools.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Tools.cpp @@ -375,6 +375,8 @@ GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection aShapeType = shapeTypeByStr(aType); break; } + default: + break; // do nothing [to avoid compilation warning] } return aShapeType; @@ -419,7 +421,7 @@ std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc, } } // store the model features information: iterate all features - int anObjectsCount = 0; // stores the number of compared features for this document to compare + size_t anObjectsCount = 0; // stores the number of compared features for this document to compare std::set aProcessed; // processed features names (that are in the current document) // process all objects (features and folders) diff --git a/src/ModuleBase/ModuleBase_IPropertyPanel.cpp b/src/ModuleBase/ModuleBase_IPropertyPanel.cpp index a3ba9012a..ece81f88f 100644 --- a/src/ModuleBase/ModuleBase_IPropertyPanel.cpp +++ b/src/ModuleBase/ModuleBase_IPropertyPanel.cpp @@ -61,7 +61,6 @@ ModuleBase_ModelWidget* ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget ModuleBase_ModelWidget* aWgt; QList::const_iterator aWIt; - bool isOffToolBox = false; for (aWIt = theWidgets.begin(); aWIt != theWidgets.end() && !aFirstWidget; ++aWIt) { aWgt = (*aWIt); if (!aValidators->isCase(aWgt->feature(), aWgt->attributeID())) diff --git a/src/ModuleBase/ModuleBase_ISelection.h b/src/ModuleBase/ModuleBase_ISelection.h index 29002e2e5..87a1b3565 100644 --- a/src/ModuleBase/ModuleBase_ISelection.h +++ b/src/ModuleBase/ModuleBase_ISelection.h @@ -42,9 +42,11 @@ class SelectMgr_EntityOwner; /// A selection can be obtained as from a viewer as from Object browser in various forms class MODULEBASE_EXPORT ModuleBase_ISelection { - public: - /// Types of the selection place, where the selection is obtained - enum SelectionPlace { Browser, Viewer, AllControls }; +public: + /// Types of the selection place, where the selection is obtained + enum SelectionPlace { Browser, Viewer, AllControls }; + + virtual ~ModuleBase_ISelection() {} /// Returns a list of viewer selected presentations /// \return list of presentations diff --git a/src/ModuleBase/ModuleBase_ISelectionActivate.h b/src/ModuleBase/ModuleBase_ISelectionActivate.h index b63819420..c1ec22c13 100644 --- a/src/ModuleBase/ModuleBase_ISelectionActivate.h +++ b/src/ModuleBase/ModuleBase_ISelectionActivate.h @@ -39,7 +39,7 @@ public: ModuleBase_ISelectionActivate(ModuleBase_IWorkshop* theWorkshop) : myWorkshop(theWorkshop) {} /// Destructor - ~ModuleBase_ISelectionActivate() {} + virtual ~ModuleBase_ISelectionActivate() {} /// Updates active selection modes in the viewer depending on the application state MODULEBASE_EXPORT virtual void updateSelectionModes() = 0; diff --git a/src/ModuleBase/ModuleBase_IconFactory.h b/src/ModuleBase/ModuleBase_IconFactory.h index 216dce14c..ce3705b09 100644 --- a/src/ModuleBase/ModuleBase_IconFactory.h +++ b/src/ModuleBase/ModuleBase_IconFactory.h @@ -34,6 +34,8 @@ class MODULEBASE_EXPORT ModuleBase_IconFactory { public: + virtual ~ModuleBase_IconFactory() {} + /// Returns icons factory instance static ModuleBase_IconFactory* get(); diff --git a/src/ModuleBase/ModuleBase_LabelValue.cpp b/src/ModuleBase/ModuleBase_LabelValue.cpp index ebab17d18..1b67bf687 100644 --- a/src/ModuleBase/ModuleBase_LabelValue.cpp +++ b/src/ModuleBase/ModuleBase_LabelValue.cpp @@ -28,7 +28,7 @@ ModuleBase_LabelValue::ModuleBase_LabelValue(QWidget* theParent, const QString& theText, const QString& theToolTip, const QString& theIcon, int thePrecision) -: QWidget(theParent), myPrecision(thePrecision), myValue(0) +: QWidget(theParent), myValue(0), myPrecision(thePrecision) { QHBoxLayout* aLayout = new QHBoxLayout(this); aLayout->setContentsMargins(2, 0, 0, 0); diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index f0c413712..b3bc3a100 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -52,11 +52,11 @@ ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent, const Config_WidgetAPI* theData) : QWidget(theParent), + myWidgetValidator(0), myIsEditing(false), myState(Stored), myIsValueStateBlocked(false), - myFlushUpdateBlocked(false), - myWidgetValidator(0) + myFlushUpdateBlocked(false) { #ifdef DEBUG_WIDGET_INSTANCE qDebug("ModuleBase_ModelWidget::ModuleBase_ModelWidget"); diff --git a/src/ModuleBase/ModuleBase_OperationFeature.cpp b/src/ModuleBase/ModuleBase_OperationFeature.cpp index 15376639a..8b3b4c410 100644 --- a/src/ModuleBase/ModuleBase_OperationFeature.cpp +++ b/src/ModuleBase/ModuleBase_OperationFeature.cpp @@ -393,20 +393,16 @@ ModuleBase_ModelWidget* ModuleBase_OperationFeature::activateByPreselection( } } else { - bool isSet = false; // 1. apply the selection to controls for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) { aWgt = (*aWIt); if (!aWgt->canAcceptFocus()) continue; aPropertyPanel->setPreselectionWidget(aWgt); - if (myPreSelection.empty() || !aWgt->setSelection(myPreSelection, true)) { - isSet = false; + if (myPreSelection.empty() || !aWgt->setSelection(myPreSelection, true)) break; - } else { - isSet = true; + else aFilledWgt = aWgt; - } } } aPropertyPanel->setPreselectionWidget(NULL); diff --git a/src/ModuleBase/ModuleBase_PagedContainer.cpp b/src/ModuleBase/ModuleBase_PagedContainer.cpp index 957bdfa65..284e4bf7a 100644 --- a/src/ModuleBase/ModuleBase_PagedContainer.cpp +++ b/src/ModuleBase/ModuleBase_PagedContainer.cpp @@ -34,7 +34,7 @@ static QMap defaultValues; ModuleBase_PagedContainer::ModuleBase_PagedContainer(QWidget* theParent, const Config_WidgetAPI* theData) : ModuleBase_ModelWidget(theParent, theData), - myIsFocusOnCurrentPage(false), myIsFirst(true), myRemeberChoice(true) + myRemeberChoice(true), myIsFocusOnCurrentPage(false), myIsFirst(true) { // it is not obligatory to be ignored when property panel tries to activate next active widget // but if focus is moved to this control, it can accept it. diff --git a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp index fcfbf2949..5d48ad9a8 100644 --- a/src/ModuleBase/ModuleBase_ParamSpinBox.cpp +++ b/src/ModuleBase/ModuleBase_ParamSpinBox.cpp @@ -47,9 +47,9 @@ ModuleBase_ParamSpinBox::ModuleBase_ParamSpinBox(QWidget* theParent, int thePrec : QAbstractSpinBox(theParent), myIsEquation(false), myAcceptVariables(true), - mySingleStep(1), myMinimum(-DBL_MAX), - myMaximum(DBL_MAX) + myMaximum(DBL_MAX), + mySingleStep(1) { myCompleter = new QCompleter(this); myCompleter->setWidget(lineEdit()); diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index ee5f55447..e07a3119b 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -153,7 +153,6 @@ void ModuleBase_Preferences::resetConfigPropPreferences(SUIT_PreferenceMgr* theP void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int thePageId) { SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); - bool isResModified = false; // Make a Tab from each section std::list aSections = Config_PropManager::getSections(); @@ -169,10 +168,9 @@ void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int // check that the property is defined QString aSection(aProp->section().c_str()); QString aName(aProp->name().c_str()); - if (!aResMgr->hasValue(aSection, aName)) { + if (!aResMgr->hasValue(aSection, aName)) aResMgr->setValue(aSection, aName, QString(aProp->value().c_str())); - isResModified = true; - } + // Add item if (aProp->type() != Config_Prop::Disabled) { SUIT_PreferenceMgr::PrefItemType aPrefType = SUIT_PreferenceMgr::Auto; @@ -228,6 +226,8 @@ void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int thePref->setItemProperty("icons", aIconsList, anId); } break; + default: // [to avoid compilation warnings] + break; } } } diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 7d15974a3..2caa00fb7 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -69,8 +69,11 @@ IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape); //******************************************************************** ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) - : ViewerData_AISShape(TopoDS_Shape()), myResult(theResult), myAdditionalSelectionPriority(0), - myTransparency(1), myIsSubstituted(false) + : ViewerData_AISShape(TopoDS_Shape()), + myResult(theResult), + myIsSubstituted(false), + myTransparency(1), + myAdditionalSelectionPriority(0) { GeomShapePtr aShapePtr = ModelAPI_Tools::shape(theResult); @@ -199,8 +202,6 @@ void ModuleBase_ResultPrs::setEdgesDefaultColor() //******************************************************************** void ModuleBase_ResultPrs::setSubShapeHidden(const TopoDS_ListOfShape& theShapes) { - bool isModified = false; - TopoDS_Compound aCompound; BRep_Builder aBBuilder; aBBuilder.MakeCompound (aCompound); diff --git a/src/ModuleBase/ModuleBase_ToolBox.cpp b/src/ModuleBase/ModuleBase_ToolBox.cpp index e884203dd..2efbf3d3f 100644 --- a/src/ModuleBase/ModuleBase_ToolBox.cpp +++ b/src/ModuleBase/ModuleBase_ToolBox.cpp @@ -121,7 +121,6 @@ bool ModuleBase_ToolBox::isOffToolBoxParent(ModuleBase_ModelWidget* theWidget) while (aParent) { QStackedWidget* aStackedWidget = dynamic_cast(aParent); if (aStackedWidget) { - int anIndex = aStackedWidget->currentIndex(); isOffToolBox = aStackedWidget->currentWidget() != aWidget; break; } diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 17e6c516e..40b17fe76 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -1011,8 +1011,6 @@ bool askToDelete(const std::set theFeatures, aPartFeatureNames.sort(); anOtherFeatureNames.sort(); - bool aCanReplaceParameters = !aFeaturesRefsToParameterOnly.empty(); - QMessageBox aMessageBox(theParent); aMessageBox.setWindowTitle(QObject::tr("Delete features")); aMessageBox.setIcon(QMessageBox::Warning); @@ -1041,7 +1039,9 @@ bool askToDelete(const std::set theFeatures, "be deleted.\nOr parameters could be replaced by their values.\n"; aText += QString(QObject::tr(aMsg)) .arg(aParamFeatureNames.join(aSep)); +#ifdef _DEBUG QPushButton *aReplaceButton = +#endif aMessageBox.addButton(QObject::tr("Replace"), QMessageBox::ActionRole); } @@ -1287,8 +1287,6 @@ std::string generateName(const AttributePtr& theAttribute, { std::string aName; if (theAttribute.get() != NULL) { - ModuleBase_Operation* anOperation = theWorkshop->currentOperation(); - FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner()); if (aFeature.get()) { std::string aXmlCfg, aDescription; diff --git a/src/ModuleBase/ModuleBase_ViewerFilters.cpp b/src/ModuleBase/ModuleBase_ViewerFilters.cpp index d24dbfd69..f3d5da986 100644 --- a/src/ModuleBase/ModuleBase_ViewerFilters.cpp +++ b/src/ModuleBase/ModuleBase_ViewerFilters.cpp @@ -158,6 +158,8 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk( case Prs3d_DP_ZAxis: aDir = anAxis.Direction(); break; + default: // [to avoid compilation warning] + break; } gp_Lin aLine(aTrihedron->Component()->Location(), aDir); return aPlane.Contains(aLine, Precision::Confusion(), Precision::Angular()); diff --git a/src/ModuleBase/ModuleBase_ViewerPrs.cpp b/src/ModuleBase/ModuleBase_ViewerPrs.cpp index c492b4da7..06463235a 100644 --- a/src/ModuleBase/ModuleBase_ViewerPrs.cpp +++ b/src/ModuleBase/ModuleBase_ViewerPrs.cpp @@ -26,8 +26,8 @@ ModuleBase_ViewerPrs::ModuleBase_ViewerPrs(ObjectPtr theResult, const GeomShapePtr& theShape, Handle(SelectMgr_EntityOwner) theOwner) : myResult(theResult), - myShape(theShape), - myOwner(theOwner) + myOwner(theOwner), + myShape(theShape) { } diff --git a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp index 06d6685a3..425e60ae6 100644 --- a/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp +++ b/src/ModuleBase/ModuleBase_WidgetConcealedObjects.cpp @@ -73,14 +73,12 @@ bool ModuleBase_WidgetConcealedObjects::storeValueCustom() DataPtr aData = myFeature->data(); AttributeRefListPtr anAttributeList = aData->reflist(attributeID()); anAttributeList->clear(); - int aSize1 = anAttributeList->size(false); for (int i = 0, aSize = myView->rowCount(); i < aSize; i++) { QCheckBox* aButton = dynamic_cast(myView->cellWidget(i, 0)->findChild()); if (aButton->isChecked()) anAttributeList->append(myConcealedResults[i]); } - int aSize = anAttributeList->size(false); return true; } @@ -127,7 +125,6 @@ bool ModuleBase_WidgetConcealedObjects::restoreValueCustom() DataPtr aData = myFeature->data(); AttributeRefListPtr anAttributeList = aData->reflist(attributeID()); - int aSize = anAttributeList->size(); for (int i = 0, aSize = myView->rowCount(); i < aSize; i++) { ResultPtr aResult = myConcealedResults[i]; QCheckBox* aButton = diff --git a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp index 22a88b2c4..f76eb34e1 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp @@ -98,7 +98,6 @@ ModuleBase_WidgetFeatureSelector::~ModuleBase_WidgetFeatureSelector() //******************************************************************** bool ModuleBase_WidgetFeatureSelector::setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs) { - ModuleBase_ISelection* aSelection = myWorkshop->selection(); ObjectPtr anObject = ModelAPI_Feature::feature(thePrs->object()); GeomShapePtr aShape; diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.cpp b/src/ModuleBase/ModuleBase_WidgetLabel.cpp index bb2bd26c8..7a47835c8 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLabel.cpp @@ -84,7 +84,10 @@ bool ModuleBase_WidgetLabel::restoreValueCustom() std::wstring aWStr((wchar_t*)aStr); static const int aBufSize = 1000; static char aMBStr[aBufSize]; - size_t aLen = wcstombs(aMBStr, aWStr.c_str(), aBufSize); +#ifdef _DEBUG + size_t aLen = +#endif + wcstombs(aMBStr, aWStr.c_str(), aBufSize); std::string aCodec = Config_Translator::codec(""); aText = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aMBStr); } else { diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index 5c5c8a8ef..451a371ec 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -1119,6 +1119,8 @@ QList i--; } break; + default: // [to avoid compilation warning] + break; } } return aList; diff --git a/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp b/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp index 7fcc62c35..656bb7309 100644 --- a/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp +++ b/src/ModuleBase/ModuleBase_WidgetOptionalBox.cpp @@ -44,9 +44,9 @@ ModuleBase_WidgetOptionalBox::ModuleBase_WidgetOptionalBox(QWidget* theParent, myGroupBox(0), myGroupBoxLayout(0), myCheckGroup(0), - myCheckGroupLayout(0), - myCheckContent(0), myCheckGroupBtn(0), + myCheckContent(0), + myCheckGroupLayout(0), myEnableOnCheck(true) { myToolTip = theData->widgetTooltip(); diff --git a/src/ModuleBase/ModuleBase_WidgetSwitch.cpp b/src/ModuleBase/ModuleBase_WidgetSwitch.cpp index d6c7e1024..4c97737c4 100644 --- a/src/ModuleBase/ModuleBase_WidgetSwitch.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSwitch.cpp @@ -57,7 +57,9 @@ int ModuleBase_WidgetSwitch::addPage(ModuleBase_PageBase* thePage, const QString const QPixmap& theIcon, const QString& theTooltip) { +#ifdef _DEBUG int aSuperCount = +#endif ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon, theTooltip); myCombo->addItem(translate(theName.toStdString())); int aResultCount = myCombo->count(); diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index e86c5e4aa..af4f04e98 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -328,8 +328,6 @@ bool ModuleBase_WidgetValidated::isValidAttribute(const AttributePtr& theAttribu //******************************************************************** bool ModuleBase_WidgetValidated::isFilterActivated() const { - bool isActivated = false; - Handle(SelectMgr_Filter) aSelFilter = myWorkshop->validatorFilter(); ModuleBase_IViewer* aViewer = myWorkshop->viewer(); diff --git a/src/ModuleBase/ModuleBase_WidgetValidator.cpp b/src/ModuleBase/ModuleBase_WidgetValidator.cpp index 67f28aa8d..9f1e5a5b8 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidator.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidator.cpp @@ -28,7 +28,7 @@ ModuleBase_WidgetValidator::ModuleBase_WidgetValidator(ModuleBase_ModelWidget* theModelWidget, ModuleBase_IWorkshop* theWorkshop) -: myModelWidget(theModelWidget), myWorkshop(theWorkshop), myIsInValidate(false) + : myIsInValidate(false), myModelWidget(theModelWidget), myWorkshop(theWorkshop) { myAttributeStore = new ModuleBase_WidgetSelectorStore(); } @@ -78,8 +78,6 @@ bool ModuleBase_WidgetValidator::isValidAttribute(const AttributePtr& theAttribu bool ModuleBase_WidgetValidator::isFilterActivated() const { - bool isActivated = false; - Handle(SelectMgr_Filter) aSelFilter = myWorkshop->validatorFilter(); ModuleBase_IViewer* aViewer = myWorkshop->viewer(); diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp index d35164f51..32194253c 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp @@ -60,11 +60,6 @@ static std::string toStdString(double theValue) return sstream.str() + aPnt; } -static std::set toSet(const std::list& theContainer) -{ - return std::set(theContainer.begin(), theContainer.end()); -} - //------------------------------------------------------------------------------ ParametersPlugin_EvalListener::ParametersPlugin_EvalListener() @@ -76,7 +71,7 @@ ParametersPlugin_EvalListener::ParametersPlugin_EvalListener() ModelAPI_ReplaceParameterMessage::eventId() }; - for (int i = 0; i < sizeof(anEvents_IDs)/sizeof(anEvents_IDs[0]); ++i) + for (unsigned long long i = 0; i < sizeof(anEvents_IDs)/sizeof(anEvents_IDs[0]); ++i) aLoop->registerListener(this, anEvents_IDs[i], NULL, true); } diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp index bb118bb05..49121ea3a 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp @@ -150,7 +150,7 @@ double ParametersPlugin_Parameter::evaluate(const std::string& theExpression, st theError = aProcessMessage->error(); // compare the list of parameters to store if changed AttributeRefListPtr aParams = reflist(ARGUMENTS_ID()); - bool aDifferent = aParams->size() != aParamsList.size(); + bool aDifferent = aParams->size() != (int)aParamsList.size(); if (!aDifferent) { std::list::const_iterator aNewIter = aParamsList.begin(); std::list anOldList = aParams->list(); diff --git a/src/PartSet/PartSet_BSplineWidget.cpp b/src/PartSet/PartSet_BSplineWidget.cpp index 11c3e7a37..2e246ba83 100644 --- a/src/PartSet/PartSet_BSplineWidget.cpp +++ b/src/PartSet/PartSet_BSplineWidget.cpp @@ -140,7 +140,7 @@ bool PartSet_BSplineWidget::restoreValueCustom() aData->attribute(SketchPlugin_BSpline::POLES_ID())); AttributeDoubleArrayPtr aWeights = aData->realArray(SketchPlugin_BSpline::WEIGHTS_ID()); - while (myPoles.size() < aPoles->size()) + while ((int)myPoles.size() < aPoles->size()) addPoleWidget(); std::list::iterator anIt = myPoles.begin(); diff --git a/src/PartSet/PartSet_CustomPrs.h b/src/PartSet/PartSet_CustomPrs.h index a491ec7ec..11f635666 100644 --- a/src/PartSet/PartSet_CustomPrs.h +++ b/src/PartSet/PartSet_CustomPrs.h @@ -152,9 +152,9 @@ private: Quantity_Color getShapeColor(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag); private: - bool myPresentationIsEmpty; /// Boolean state about empty presentation - FeaturePtr myFeature; /// Reference to a feature object ModuleBase_IWorkshop* myWorkshop; /// current workshop + FeaturePtr myFeature; /// Reference to a feature object + bool myPresentationIsEmpty; /// Boolean state about empty presentation /// map of presentation type to AIS object QMap myPresentations; /// State whether the presentation is activated/deactivated diff --git a/src/PartSet/PartSet_FieldStepPrs.cpp b/src/PartSet/PartSet_FieldStepPrs.cpp index 4d3ed48ee..ec091abe1 100644 --- a/src/PartSet/PartSet_FieldStepPrs.cpp +++ b/src/PartSet/PartSet_FieldStepPrs.cpp @@ -119,6 +119,8 @@ QList PartSet_FieldStepPrs::range(double& theMin, double& theMax) const case ModelAPI_AttributeTables::INTEGER: aFieldStepData << aVal.myInt; break; + default: // [to avoid compilation warning] + break; } } } @@ -256,7 +258,6 @@ QList PartSet_FieldStepPrs::booleanValues() const } } QList aShapeData; - double aRangeMin = aFieldStepData.first(), aRangeMax = aFieldStepData.last(); for (int aRow = 0; aRow < aRows - 1; aRow++) { double aNorm = 0; int aBaseIndex = aRow * aCols; diff --git a/src/PartSet/PartSet_IconFactory.cpp b/src/PartSet/PartSet_IconFactory.cpp index 5846b9e48..d6f054093 100644 --- a/src/PartSet/PartSet_IconFactory.cpp +++ b/src/PartSet/PartSet_IconFactory.cpp @@ -137,6 +137,8 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) return QIcon(":icons/group_face.png"); case GeomAPI_Shape::SOLID: return QIcon(":icons/group_solid.png"); + default: // [to avoid compilation warning] + break; } } ResultBodyPtr aBody = std::dynamic_pointer_cast(aResult); @@ -151,6 +153,8 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) case GeomAPI_Shape::WIRE: return QIcon(":pictures/wire.png"); case GeomAPI_Shape::EDGE: return QIcon(":pictures/edge.png"); case GeomAPI_Shape::VERTEX: return QIcon(":pictures/vertex.png"); + default: // [to avoid compilation warning] + break; } } } diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index ee9175316..d3c508a5b 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -285,7 +285,6 @@ void addRefCoincidentFeatures(const std::set& theRefList, std::shared_ptr aPnt = PartSet_Tools::getCoincedencePoint(aConstrFeature); if (aPnt.get() == NULL) return; - gp_Pnt aP = aPnt->impl(); if (theRefPnt->isEqual(aPnt) && (!theOutList.contains(aConstrFeature))) { theOutList.append(aConstrFeature); } @@ -317,11 +316,9 @@ void PartSet_MenuMgr::onLineDetach(QAction* theAction) if (aToDelFeatures.size() > 0) { XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); XGUI_Workshop* aWorkshop = aConnector->workshop(); - ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation(); ModuleBase_Operation* anOpAction = new ModuleBase_Operation(tr("Detach %1").arg(aLine->data()->name().c_str()), myModule); - bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation); XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr(); // the active nested sketch operation should be aborted unconditionally // the Delete action should be additionally granted for the Sketch operation @@ -384,7 +381,6 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr(); if (isUseTransaction) { anOpAction = new ModuleBase_Operation(anAction->text(), myModule); - bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation); bool isCommitted; if (!anOpMgr->canStartOperation(anOpAction->id(), isCommitted)) @@ -518,7 +514,6 @@ void PartSet_MenuMgr::onActivateAllParts() DocumentPtr aDoc = aMgr->moduleDocument(); int aNbParts = aDoc->size(ModelAPI_ResultPart::group()); - bool isActivated = false; QList aPartsToLoad; for (int i = 0; i < aNbParts; i++) { ObjectPtr aObj = aDoc->object(ModelAPI_ResultPart::group(), i); diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index e9b14cd76..969ffe1ac 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -155,18 +155,15 @@ extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* //****************************************************** PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) : ModuleBase_IModule(theWshop), + myIsOperationIsLaunched(false), myVisualLayerId(0), - myRoot(0), - myIsOperationIsLaunched(false) + myRoot(0) { new PartSet_IconFactory(this); mySketchMgr = new PartSet_SketcherMgr(this); mySketchReentrantMgr = new PartSet_SketcherReentrantMgr(theWshop); - XGUI_ModuleConnector* aConnector = dynamic_cast(theWshop); - XGUI_Workshop* aWorkshop = aConnector->workshop(); - ModuleBase_IViewer* aViewer = theWshop->viewer(); connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)), this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*))); @@ -874,7 +871,6 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th Config_WidgetAPI* theWidgetApi) { ModuleBase_IWorkshop* aWorkshop = workshop(); - XGUI_Workshop* aXUIWorkshop = getWorkshop(); ModuleBase_ModelWidget* aWgt = NULL; if (theType == "sketch-start-label") { PartSet_WidgetSketchLabel* aLabelWgt = new PartSet_WidgetSketchLabel(theParent, aWorkshop, @@ -1156,8 +1152,6 @@ void PartSet_Module::onViewTransformed(int theTrsfType) (aCurrentOperation->id() == "Measurement"))) { double aLen = aView->Convert(SketcherPrs_Tools::getConfigArrowSize()); - - double aPrevLen = SketcherPrs_Tools::getArrowSize(); SketcherPrs_Tools::setArrowSize(aLen); const double aCurScale = aViewer->activeView()->Camera()->Scale(); aViewer->SetScale(aViewer->activeView(), aCurScale); diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index 66d422e34..b6f0e4953 100644 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -123,7 +123,6 @@ void PartSet_OperationPrs::Compute( thePresentation->Clear(); bool aReadyToDisplay = !myShapeToPrsMap.IsEmpty(); - XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(myWorkshop)->displayer(); Handle(Prs3d_Drawer) aDrawer = Attributes(); // create presentations on the base of the shapes BRep_Builder aBuilder; @@ -144,7 +143,6 @@ void PartSet_OperationPrs::Compute( int aWidth = anIO->Width(); /// workaround for zero width. Else, there will be a crash if (aWidth == 0) { // width returns of TSolid shape is zero - bool isDisplayed = !anIO->GetContext().IsNull(); aWidth = PartSet_Tools::getAISDefaultWidth();// default width value } setWidth(aDrawer, aWidth); @@ -244,8 +242,8 @@ void PartSet_OperationPrs::appendShapeIfVisible(ModuleBase_IWorkshop* theWorksho GeomShapePtr theGeomShape, QMap >& theObjectShapes) { - XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer(); - // VSV: Do not use isVisible checking because it can be used when state "Show Only" is ON + //XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer(); + //// VSV: Do not use isVisible checking because it can be used when state "Show Only" is ON //if (XGUI_Displayer::isVisible(aDisplayer, theObject)) { if (theGeomShape.get()) { if (theObjectShapes.contains(theObject)) @@ -364,8 +362,6 @@ void PartSet_OperationPrs::getResultShapes(const FeaturePtr& theFeature, if (!theFeature.get()) return; - XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer(); - std::list aResults; ModelAPI_Tools::allResults(theFeature, aResults); std::list::const_iterator aRIt = aResults.begin(), diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index 64e1aae6f..a40d0f208 100644 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -48,7 +48,7 @@ #include #include -#define DEBUG_WIRE +//#define DEBUG_WIRE #ifdef DEBUG_WIRE #include diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 9f0571e11..aaa1ff6d4 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -170,10 +170,17 @@ void getAttributesOrResults(const Handle(SelectMgr_EntityOwner)& theOwner, } PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module* theModule) - : QObject(theModule), myModule(theModule), myIsEditLaunching(false), myIsDragging(false), - myDragDone(false), myIsMouseOverWindow(false), - myIsMouseOverViewProcessed(true), myPreviousUpdateViewerEnabled(true), - myIsPopupMenuActive(false), myExternalPointsMgr(0), myNoDragMoving(false) + : QObject(theModule), + myModule(theModule), + myIsEditLaunching(false), + myIsDragging(false), + myDragDone(false), + myIsMouseOverWindow(false), + myIsMouseOverViewProcessed(true), + myIsPopupMenuActive(false), + myPreviousUpdateViewerEnabled(true), + myExternalPointsMgr(0), + myNoDragMoving(false) { ModuleBase_IWorkshop* anIWorkshop = myModule->workshop(); ModuleBase_IViewer* aViewer = anIWorkshop->viewer(); @@ -681,7 +688,6 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve #endif Handle(V3d_View) aView = theWnd->v3dView(); - gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView); Point aMousePnt; get2dPoint(theWnd, theEvent, aMousePnt); @@ -1185,7 +1191,6 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) qDebug(QString("startSketch: %1, %2").arg(anInfo.size()).arg(anInfoStr).toStdString().c_str()); #endif - bool aHasPlane = false; std::shared_ptr aPln; aPln = PartSet_Tools::sketchPlane(myCurrentSketch); Handle(SelectMgr_Filter) aFilter = myModule->selectionFilter(SF_SketchPlaneFilter); @@ -1501,8 +1506,6 @@ bool PartSet_SketcherMgr::canDisplayConstraint(const FeaturePtr& theFeature, std::string aKind = theFeature->getKind(); if (aConstrIds.contains(QString(aKind.c_str()))) { - bool isTypedConstraint = false; - switch (theState) { case PartSet_Tools::Dimensional: { bool isDistance = isDistanceKind(aKind); @@ -1752,8 +1755,6 @@ void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature, std::map aSelectedAttributes = anInfo.myAttributes; std::set aSelectedResults = anInfo.myResults; - ModuleBase_IViewer* aViewer = theWorkshop->viewer(); - XGUI_ModuleConnector* aConnector = dynamic_cast(theWorkshop); XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer(); @@ -1824,13 +1825,13 @@ void PartSet_SketcherMgr::getSelectionOwners(const FeaturePtr& theFeature, // result owners are put in the list of selection only if local selected shapes were not // found if (aSelectedResults.find(aResult) != aSelectedResults.end()) { - for ( Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++ ) { + for (Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++ ) { Handle(StdSelect_BRepOwner) anOwner = - Handle(StdSelect_BRepOwner)::DownCast(aSelectedOwners(i)); - if ( anOwner.IsNull() || !anOwner->HasShape() || theOwnersToSelect.FindIndex(anOwner)) + Handle(StdSelect_BRepOwner)::DownCast(aSelectedOwners(i)); + if (anOwner.IsNull() || !anOwner->HasShape() || theOwnersToSelect.FindIndex(anOwner)) continue; - // select whole result - theOwnersToSelect.Add(anOwner); + // select whole result + theOwnersToSelect.Add(anOwner); } } } @@ -1864,8 +1865,8 @@ void PartSet_SketcherMgr::widgetStateChanged(int thePreviousState) ModuleBase_OperationFeature* aFOperation = dynamic_cast (getCurrentOperation()); if (aFOperation) { - if (PartSet_SketcherMgr::isSketchOperation(aFOperation) || - isNestedSketchOperation(aFOperation) && + if ((PartSet_SketcherMgr::isSketchOperation(aFOperation) || + isNestedSketchOperation(aFOperation)) && thePreviousState == ModuleBase_ModelWidget::ModifiedInPP) { FeaturePtr aFeature = aFOperation->feature(); visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature)); @@ -1924,9 +1925,6 @@ void PartSet_SketcherMgr::visualizeFeature(const FeaturePtr& theFeature, if (isEditOperation || !theFeature.get()) return; - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); - // 1. change visibility of the object itself, here the presentable object is processed, // e.g. constraints features //FeaturePtr aFeature = aFOperation->feature(); @@ -2065,8 +2063,6 @@ void PartSet_SketcherMgr::updateBySketchParameters( case PartSet_Tools::Geometrical: case PartSet_Tools::Dimensional: { if (aPrevState != theState) { - ModuleBase_IWorkshop* aWorkshop = myModule->workshop(); - XGUI_ModuleConnector* aConnector = dynamic_cast(aWorkshop); int aNumberOfSubs = myCurrentSketch->numberOfSubs(); for (int i = 0; i < aNumberOfSubs; i++) { FeaturePtr aSubFeature = myCurrentSketch->subFeature(i); @@ -2091,6 +2087,8 @@ void PartSet_SketcherMgr::updateBySketchParameters( } } break; + default: // [to avoid compilation warning] + break; } } @@ -2279,7 +2277,6 @@ bool isIncludeToResult(const ObjectPtr& theObject) std::vector PartSet_SketcherMgr::colorOfObject(const ObjectPtr& theObject, const FeaturePtr& theFeature, bool isConstruction) const { - static const QStringList& aConstrIds = constraintsIdList(); PartSet_OverconstraintListener* aOCListener = myModule->overconstraintListener(); std::string aKind = theFeature->getKind(); diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.cpp b/src/PartSet/PartSet_SketcherReentrantMgr.cpp index 6a646a1e8..0ebd810fa 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReentrantMgr.cpp @@ -448,10 +448,7 @@ void PartSet_SketcherReentrantMgr::onVertexSelected() void PartSet_SketcherReentrantMgr::onAfterValuesChangedInPropertyPanel() { - if (isInternalEditActive()) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast - (myWorkshop->currentOperation()); ModuleBase_ModelWidget* aWidget = (ModuleBase_ModelWidget*)sender(); if (!aWidget->isModifiedInEdit().empty()) restartOperation(); @@ -534,9 +531,9 @@ bool PartSet_SketcherReentrantMgr::startInternalEdit(const std::string& thePrevi QList aWidgets = aPanel->modelWidgets(); for (int i = 0, aNb = aWidgets.size(); i < aNb && !aPreviousAttributeWidget; i++) { if (aWidgets[i]->attributeID() == thePreviousAttributeID) { - /// workaround for the same attributes used in different stacked widgets(attribute types) - if (ModuleBase_ToolBox::isOffToolBoxParent(aWidgets[i])) - continue; + // workaround for the same attributes used in different stacked widgets(attribute types) + if (ModuleBase_ToolBox::isOffToolBoxParent(aWidgets[i])) + continue; aPreviousAttributeWidget = aWidgets[i]; } } diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index 694aa7da4..f65ed4adb 100644 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -683,8 +683,6 @@ bool PartSet_CoincidentAttr::isValid(const AttributePtr& theAttribute, // there is a check whether the feature contains a point and a linear edge or two point values std::string aParamA = theArguments.front(); - SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); @@ -715,13 +713,13 @@ bool PartSet_CoincidentAttr::isValid(const AttributePtr& theAttribute, AttributePtr aAR = aRAttr->attr(); if (aAR->id() != SketchPlugin_Arc::CENTER_ID()) // ignore constraint to center of arc aCoinList.insert(aConstrFeature); - QList anIsAttributes; - PartSet_Tools::findCoincidences(aConstrFeature, aCoinsideLines, aCoins, - SketchPlugin_ConstraintCoincidence::ENTITY_A(), - anIsAttributes); - PartSet_Tools::findCoincidences(aConstrFeature, aCoinsideLines, aCoins, - SketchPlugin_ConstraintCoincidence::ENTITY_B(), - anIsAttributes); + QList anIsAttributes; + PartSet_Tools::findCoincidences(aConstrFeature, aCoinsideLines, aCoins, + SketchPlugin_ConstraintCoincidence::ENTITY_A(), + anIsAttributes); + PartSet_Tools::findCoincidences(aConstrFeature, aCoinsideLines, aCoins, + SketchPlugin_ConstraintCoincidence::ENTITY_B(), + anIsAttributes); } } // if there is no coincidence then it is not valid diff --git a/src/PartSet/PartSet_WidgetBSplinePoints.cpp b/src/PartSet/PartSet_WidgetBSplinePoints.cpp index 5819a5f6a..b6a17e16b 100644 --- a/src/PartSet/PartSet_WidgetBSplinePoints.cpp +++ b/src/PartSet/PartSet_WidgetBSplinePoints.cpp @@ -87,7 +87,10 @@ PartSet_WidgetBSplinePoints::PartSet_WidgetBSplinePoints(QWidget* theParent, myBox->setFlat(false); aMainLayout->addWidget(myBox); - bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); +#ifdef _DEBUG + bool aAcceptVariables = +#endif + theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); // B-spline weights attribute myWeightsAttr = theData->getProperty("weights"); @@ -167,8 +170,6 @@ void PartSet_WidgetBSplinePoints::removeLastPoint() bool PartSet_WidgetBSplinePoints::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue) { - bool aValid = true; - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); if (aModule->sketchReentranceMgr()->isInternalEditActive()) return true; // when internal edit is started a new feature is created. I has not results, AIS @@ -359,7 +360,7 @@ bool PartSet_WidgetBSplinePoints::restoreValueCustom() AttributeDoubleArrayPtr aWeightsArray = aData->realArray(myWeightsAttr); if (aPointArray->isInitialized()) { - while (myXSpin.size() < aPointArray->size()) + while ((int)myXSpin.size() < aPointArray->size()) createNextPoint(); std::vector::iterator aXIt = myXSpin.begin(); diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index af34ee022..c8068e18c 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -106,43 +106,21 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, myGroupBox = new QGroupBox(aPageName, theParent); myGroupBox->setFlat(false); - bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); +#ifdef _DEBUG + bool aAcceptVariables = +#endif + theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true); QGridLayout* aGroupLay = new QGridLayout(myGroupBox); ModuleBase_Tools::adjustMargins(aGroupLay); aGroupLay->setSpacing(2); aGroupLay->setColumnStretch(1, 1); - { - QLabel* aLabel = new QLabel(myGroupBox); - - myXSpin = new ModuleBase_LabelValue(myGroupBox, tr("X")); - //ModuleBase_ParamSpinBox(myGroupBox); - //myXSpin->setAcceptVariables(aAcceptVariables); - //myXSpin->setMinimum(-DBL_MAX); - //myXSpin->setMaximum(DBL_MAX); - //myXSpin->setToolTip(tr("X")); - aGroupLay->addWidget(myXSpin, 0, 1); - - //connect(myXSpin, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); - //myXSpin->setValueEnabled(isValueEnabled()); - } - { - //QLabel* aLabel = new QLabel(myGroupBox); - //aLabel->setText(tr("Y ")); - //aGroupLay->addWidget(aLabel, 1, 0); - - myYSpin = new ModuleBase_LabelValue(myGroupBox, tr("Y")); - //ModuleBase_ParamSpinBox(myGroupBox); - //myYSpin = new ModuleBase_ParamSpinBox(myGroupBox); - //myYSpin->setAcceptVariables(aAcceptVariables); - //myYSpin->setMinimum(-DBL_MAX); - //myYSpin->setMaximum(DBL_MAX); - //myYSpin->setToolTip(tr("Y")); - aGroupLay->addWidget(myYSpin, 1, 1); - - //connect(myYSpin, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified())); - //myYSpin->setValueEnabled(isValueEnabled()); - } + + myXSpin = new ModuleBase_LabelValue(myGroupBox, tr("X")); + aGroupLay->addWidget(myXSpin, 0, 1); + myYSpin = new ModuleBase_LabelValue(myGroupBox, tr("Y")); + aGroupLay->addWidget(myYSpin, 1, 1); + QVBoxLayout* aLayout = new QVBoxLayout(this); ModuleBase_Tools::zeroMargins(aLayout); aLayout->addWidget(myGroupBox); @@ -155,8 +133,6 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, bool PartSet_WidgetPoint2D::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue) { - bool aValid = true; - PartSet_Module* aModule = dynamic_cast(myWorkshop->module()); if (aModule->sketchReentranceMgr()->isInternalEditActive()) return true; /// when internal edit is started a new feature is created. I has not results, AIS @@ -662,7 +638,6 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo } } if (!anExternal) { - bool isProcessed = false; GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aShape, mySketch); if (aPnt && isFeatureContainsPoint(myFeature, aPnt->x(), aPnt->y())) { // when the point is selected, the coordinates of the point should be set into the attribute diff --git a/src/PartSet/PartSet_WidgetSketchCreator.cpp b/src/PartSet/PartSet_WidgetSketchCreator.cpp index 3df7e1f3c..f8cdc2c76 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.cpp +++ b/src/PartSet/PartSet_WidgetSketchCreator.cpp @@ -288,8 +288,6 @@ bool PartSet_WidgetSketchCreator::isSelectionMode() const bool PartSet_WidgetSketchCreator::hasSubObjects() const { bool aHasSubObjects = false; - - bool aCanSetFocus = true; CompositeFeaturePtr aComposite = std::dynamic_pointer_cast(myFeature); if (aComposite.get()) aHasSubObjects = aComposite->numberOfSubs() > 0; @@ -379,7 +377,6 @@ bool PartSet_WidgetSketchCreator::startSketchOperation( } // manually deactivation because the widget was not activated as has no focus acceptin controls deactivate(); - bool aHidePreview = myPreviewPlanes->isPreviewDisplayed(); myPreviewPlanes->erasePreviewPlanes(myWorkshop); // start edit operation for the sketch diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 171cf3abc..f0ec77b08 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -409,9 +409,6 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs if (aModule) aModule->onViewTransformed(); - // 6. Update sketcher actions - XGUI_ActionsMgr* anActMgr = aWorkshop->actionsMgr(); - myWorkshop->updateCommandStatus(); aWorkshop->selector()->clearSelection(); myWorkshop->viewer()->update(); diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp index 5d6c24c12..245b471f2 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp @@ -159,7 +159,6 @@ void PrimitivesPlugin_Box::loadNamingDS(std::shared_ptr theBoxA theBoxAlgo->prepareNamingFaces(); // Insert to faces - int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theBoxAlgo->getCreatedFaces(); for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp index 634c5e4a9..90d662044 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp @@ -182,7 +182,6 @@ void PrimitivesPlugin_Torus::loadNamingDS(std::shared_ptr the // Insert to faces // Naming for faces - int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theTorusAlgo->getCreatedFaces(); for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index 0cd96374c..efdddb88e 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -184,17 +184,26 @@ void SHAPERGUI::initialize(CAM_Application* theApp) QString aToolName = tr("Inspection"); int aTool = createTool(aToolName); - int aToolId = createTool(myWhatIsAction, aTool); +#ifdef _DEBUG + int aToolId = +#endif + createTool(myWhatIsAction, aTool); registerCommandToolbar(aToolName, aId); // Define Edit toolbars command aId = getNextCommandId(); //myActionsList.append(aId); Do not use it for editing of toolbars aTip = tr("Edit toolbars of the module"); - QAction* aAction = createAction(aId, aTip, QIcon(":pictures/configure_toolbars.png"), +#ifdef _DEBUG + QAction* aAction = +#endif + createAction(aId, aTip, QIcon(":pictures/configure_toolbars.png"), tr("Edit toolbars..."), aTip, QKeySequence(), aDesk, false, this, SLOT(onEditToolbars())); int aEditMenu = createMenu(tr("MEN_DESK_EDIT"), -1, -1, 30); - int aEditItem = createMenu(aId, aEditMenu); +#ifdef _DEBUG + int aEditItem = +#endif + createMenu(aId, aEditMenu); // Initialize viewer proxy if OCC viewer is already exist ViewManagerList aOCCViewManagers; @@ -655,12 +664,18 @@ QAction* SHAPERGUI::addFeature(const QString& theWBName, const QString& theTBNam aAction->setData(theId); int aWBMenu = createMenu(theWBName, -1, -1, 30/*10-Window, 1000 - Help*/); - int aItemId = createMenu(aId, aWBMenu); +#ifdef _DEBUG + int aItemId = +#endif + createMenu(aId, aWBMenu); if (isAddSeparator) createMenu(separator(), aWBMenu); int aWBTool = createTool(theTBName, theTBName); - int aToolId = createTool(aId, aWBTool); +#ifdef _DEBUG + int aToolId = +#endif + createTool(aId, aWBTool); registerCommandToolbar(theTBName, aId); if (isAddSeparator) { createTool(separator(), aWBTool); @@ -697,7 +712,10 @@ QAction* SHAPERGUI::addFeatureOfNested(const QString& theWBName, createMenu(separator(), aWBMenu); /// nested action is always separated of others int aWBTool = createTool(theWBName, theWBName); - int aToolId = createTool(anAction, aWBTool); +#ifdef _DEBUG + int aToolId = +#endif + createTool(anAction, aWBTool); registerCommandToolbar(theWBName, aItemId); createTool(separator(), aWBTool); /// nested action is always separated of others registerCommandToolbar(theWBName, -1); @@ -1055,7 +1073,10 @@ void SHAPERGUI::saveToolbarsConfig() return; // Save toolbars configuration into map QMap aToolbarsConfig; - QtxActionToolMgr* aMgr = toolMgr(); +#ifdef _DEBUG + QtxActionToolMgr* aMgr = +#endif + toolMgr(); QStringList aToolbars = myToolbars.keys(); QIntList aActionsIds; foreach(QString aName, aToolbars) { diff --git a/src/SHAPERGUI/SHAPERGUI_DataModel.cpp b/src/SHAPERGUI/SHAPERGUI_DataModel.cpp index 50b2462bc..ebb553221 100644 --- a/src/SHAPERGUI/SHAPERGUI_DataModel.cpp +++ b/src/SHAPERGUI/SHAPERGUI_DataModel.cpp @@ -68,7 +68,6 @@ bool SHAPERGUI_DataModel::open(const QString& thePath, CAM_Study* theStudy, QStr LightApp_Study* aStudy = dynamic_cast( myModule->application()->activeStudy() ); QString aNewTmpDir = aStudy->GetTmpDir("", false).c_str(); - bool isDone = true; QDir aDir(aTmpDir); QStringList aFiles = aDir.entryList(QDir::Files); QStringList::const_iterator anIt = aFiles.begin(), aLast = aFiles.end(); diff --git a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp index e6f35c488..5118208f1 100644 --- a/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp +++ b/src/SHAPERGUI/SHAPERGUI_ToolbarsMgr.cpp @@ -42,7 +42,7 @@ class SHAPERGUI_CommandIdItem : public QListWidgetItem { public: SHAPERGUI_CommandIdItem(QListWidget* theParent, int theId, SHAPERGUI* theModule) - : QListWidgetItem(theParent), myId(theId), myModule(theModule) {} + : QListWidgetItem(theParent), myModule(theModule), myId(theId) {} virtual QVariant data(int theRole) const { diff --git a/src/Selector/Selector_Algo.h b/src/Selector/Selector_Algo.h index a946a1c83..6f171afb1 100644 --- a/src/Selector/Selector_Algo.h +++ b/src/Selector/Selector_Algo.h @@ -59,6 +59,8 @@ public: /// Initializes the algorithm SELECTOR_EXPORT Selector_Algo(); + virtual ~Selector_Algo() {} + /// Initializes the selector structure on the label. /// Stores the name data to restore after modification. /// \param theContext whole shape that contains the selected sub-shape diff --git a/src/Selector/Selector_Container.cpp b/src/Selector/Selector_Container.cpp index b03621166..8b5c537ed 100644 --- a/src/Selector/Selector_Container.cpp +++ b/src/Selector/Selector_Container.cpp @@ -70,7 +70,6 @@ bool Selector_Container::restore() return false; myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get()); // restore sub-selectors - bool aSubResult = true; for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) { Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument()); if (!append(aSubSel, false)) { @@ -161,6 +160,8 @@ bool Selector_Container::solve(const TopoDS_Shape& theContext) aResult = aWire; break; } + default: + break; } TopoDS_ListOfShape aSubSelectorShapes; std::list::const_iterator aSubSel = list().cbegin(); diff --git a/src/Selector/Selector_FilterByNeighbors.cpp b/src/Selector/Selector_FilterByNeighbors.cpp index e492ab8d3..0035d48f0 100644 --- a/src/Selector/Selector_FilterByNeighbors.cpp +++ b/src/Selector/Selector_FilterByNeighbors.cpp @@ -273,7 +273,6 @@ bool Selector_FilterByNeighbors::restore() myNBLevel.push_back(anArray->Value(anIndex)); } // restore sub-selectors - bool aSubResult = true; for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) { Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument()); if (!append(aSubSel, false)) { @@ -282,7 +281,7 @@ bool Selector_FilterByNeighbors::restore() // some selector fails, try to use rest selectors, myNBLevel becomes negative: unused if (myNBLevel.size() > list().size()) { std::list::iterator aListIter = myNBLevel.begin(); - for(int a = 0; a < list().size(); a++) + for(size_t a = 0; a < list().size(); a++) aListIter++; *aListIter = -*aListIter; list().push_back(NULL); diff --git a/src/Selector/Selector_Intersect.cpp b/src/Selector/Selector_Intersect.cpp index a104911de..49b0764d7 100644 --- a/src/Selector/Selector_Intersect.cpp +++ b/src/Selector/Selector_Intersect.cpp @@ -168,7 +168,6 @@ bool Selector_Intersect::restore() return false; myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get()); // restore sub-selectors - bool aSubResult = true; for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) { Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument()); if (!append(aSubSel, false)) { diff --git a/src/SketchPlugin/SketchPlugin_Constraint.h b/src/SketchPlugin/SketchPlugin_Constraint.h index 6d46dbd3a..7d36c8f5e 100644 --- a/src/SketchPlugin/SketchPlugin_Constraint.h +++ b/src/SketchPlugin/SketchPlugin_Constraint.h @@ -25,7 +25,7 @@ #include /// Size of the list of constraint attributes -const unsigned int CONSTRAINT_ATTR_SIZE = 4; +const int CONSTRAINT_ATTR_SIZE = 4; /** \class SketchPlugin_Constraint * \brief Abstract interface to the SketchPlugin_ConstraintBase diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp index 41fc3b9bb..646d93a5d 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp @@ -83,14 +83,6 @@ void SketchPlugin_ConstraintLength::execute() GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::END_ID())); if (aPoint1.get() && aPoint2.get()) { - double aLenght = aPoint1->pnt()->distance(aPoint2->pnt()); - - //std::shared_ptr aValueAttr = std::dynamic_pointer_cast< - // ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE())); - //if(!aValueAttr->isInitialized()) { - // aValueAttr->setValue(aLenght); - //} - // the value should to be computed here, not in the getAISObject // in order to change the model value // inside the object transaction. This is important for creating a constraint by preselection. diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp index a8dda2fa8..2acbc1ce6 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp @@ -76,27 +76,6 @@ void SketchPlugin_ConstraintRadius::execute() ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A())); FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object()); if (aFeature) { - double aRadius = 0; - std::shared_ptr aData = aFeature->data(); - if (aFeature->getKind() == SketchPlugin_Circle::ID()) { - AttributeDoublePtr anAttribute = std::dynamic_pointer_cast( - aData->attribute(SketchPlugin_Circle::RADIUS_ID())); - if (anAttribute) - aRadius = anAttribute->value(); - } else if (aFeature->getKind() == SketchPlugin_Arc::ID()) { - std::shared_ptr aCenterAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::CENTER_ID())); - std::shared_ptr aStartAttr = std::dynamic_pointer_cast< - GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID())); - if (aCenterAttr && aStartAttr) - aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt()); - } - //std::shared_ptr aValueAttr = std::dynamic_pointer_cast< - // ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE())); - //if(!aValueAttr->isInitialized()) { - // aValueAttr->setValue(aRadius); - //} - // the value should to be computed here, // not in the getAISObject in order to change the model value // inside the object transaction. This is important for creating a constraint by preselection. diff --git a/src/SketchPlugin/SketchPlugin_Fillet.cpp b/src/SketchPlugin/SketchPlugin_Fillet.cpp index 924af019b..54f6805ba 100644 --- a/src/SketchPlugin/SketchPlugin_Fillet.cpp +++ b/src/SketchPlugin/SketchPlugin_Fillet.cpp @@ -81,7 +81,7 @@ static std::set findFeaturesToRemove(const FeaturePtr theFeature, const AttributePtr theAttribute); SketchPlugin_Fillet::SketchPlugin_Fillet() -: myFilletCreated(false), myIsReversed(false) +: myIsReversed(false), myFilletCreated(false) { myIsNotInversed[0] = myIsNotInversed[1] = true; } diff --git a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp index f74c9745c..6e453b9c7 100644 --- a/src/SketchPlugin/SketchPlugin_MacroCircle.cpp +++ b/src/SketchPlugin/SketchPlugin_MacroCircle.cpp @@ -397,7 +397,6 @@ AISObjectPtr SketchPlugin_MacroCircle::getAISObject(AISObjectPtr thePrevious) } void SketchPlugin_MacroCircle::attributeChanged(const std::string& theID) { - double aRadius = 0.0; // If circle type switched reset all attributes. if(theID == CIRCLE_TYPE()) { SketchPlugin_Tools::resetAttribute(this, CENTER_POINT_ID()); diff --git a/src/SketchPlugin/SketchPlugin_Tools.cpp b/src/SketchPlugin/SketchPlugin_Tools.cpp index 4a066288c..e5d148323 100644 --- a/src/SketchPlugin/SketchPlugin_Tools.cpp +++ b/src/SketchPlugin/SketchPlugin_Tools.cpp @@ -246,7 +246,7 @@ private: continue; // already processed theCoincidences.insert(*aCIt); // iterate on coincident attributes - for (int i = 0, aPtInd = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { + for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { AttributeRefAttrPtr aRefAttr = (*aCIt)->refattr(SketchPlugin_Constraint::ATTRIBUTE(i)); if (aRefAttr && !aRefAttr->isObject()) { diff --git a/src/SketchPlugin/SketchPlugin_Trim.cpp b/src/SketchPlugin/SketchPlugin_Trim.cpp index 6cb54d681..53ca4deb1 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.cpp +++ b/src/SketchPlugin/SketchPlugin_Trim.cpp @@ -76,9 +76,6 @@ static const double PI = 3.141592653589793238463; -static const std::string OPERATION_HIGHLIGHT_COLOR() { return "128, 0, 0"; } -static const std::string OPERATION_REMOVE_FEATURE_COLOR() { return "255, 174, 201"; } - SketchPlugin_Trim::SketchPlugin_Trim() { } diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index b4463445b..0597d95a0 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -157,8 +157,6 @@ bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute // there is a check whether the feature contains a point and a linear edge or two point values std::string aParamA = theArguments.front(); - SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); FeaturePtr anAttributeFeature = std::dynamic_pointer_cast(theAttribute->owner()); @@ -255,8 +253,6 @@ bool SketchPlugin_PerpendicularAttrValidator::isValid(const AttributePtr& theAtt } std::string aParamA = theArguments.front(); - SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); FeaturePtr anOwner = std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefAttrPtr aRefAttr = @@ -447,8 +443,6 @@ bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttri // there is a check whether the feature contains a point and a linear edge or two point values std::string aParamA = theArguments.front(); - SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); FeaturePtr aConstraint = std::dynamic_pointer_cast(theAttribute->owner()); AttributeRefAttrPtr aRefAttrA = aConstraint->data()->refattr(aParamA); @@ -823,8 +817,6 @@ bool SketchPlugin_MiddlePointAttrValidator::isValid(const AttributePtr& theAttri // there is a check whether the feature contains a point and a linear edge or two point values std::string aParamA = theArguments.front(); - SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); FeaturePtr anAttributeFeature = std::dynamic_pointer_cast(theAttribute->owner()); diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index b363fdfc1..5d626ed8c 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -54,11 +54,15 @@ extern void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, AIS_AngleDimension); SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint, - SketchPlugin_Sketch* theSketcher) -: AIS_AngleDimension(gp_Pnt(0,0,0), gp_Pnt(1,0,0), gp_Pnt(0,1,0)), myConstraint(theConstraint), + SketchPlugin_Sketch* theSketcher) +: AIS_AngleDimension(gp_Pnt(0,0,0), gp_Pnt(1,0,0), gp_Pnt(0,1,0)), + myConstraint(theConstraint), mySketcher(theSketcher), - myFirstPoint(gp_Pnt(0,0,0)), myCenterPoint(gp_Pnt(1,0,0)), mySecondPoint(gp_Pnt(0,1,0)), - myValue(90., false, ""), myFlyOutPoint(0, 0.5, 0) + myFirstPoint(gp_Pnt(0,0,0)), + mySecondPoint(gp_Pnt(0,1,0)), + myCenterPoint(gp_Pnt(1, 0, 0)), + myFlyOutPoint(0, 0.5, 0), + myValue(90., false, "") { myAspect = new Prs3d_DimensionAspect(); myAspect->MakeArrows3d(false); diff --git a/src/SketcherPrs/SketcherPrs_Mirror.cpp b/src/SketcherPrs/SketcherPrs_Mirror.cpp index bb818cf69..ec96adf23 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.cpp +++ b/src/SketcherPrs/SketcherPrs_Mirror.cpp @@ -64,7 +64,6 @@ bool SketcherPrs_Mirror::IsReadyToDisplay(ModelAPI_Feature* theConstraint, if (anAttrC.get() == NULL) return aReadyToDisplay; - SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); int aNb = anAttrB->size(); // If size of source objects and mirrored ones is not equal then the constraint is not computed if (aNb != anAttrC->size()) diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp index c8c94c68a..c5c949ffd 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp @@ -424,7 +424,7 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition( gp_Vec aVecPos; // If number of angle less then number of symbols then each symbol can be placed // directly inside of the angle - if (aAngles.size() >= aPos[1] && !aVectors.empty()) { + if ((int)aAngles.size() >= aPos[1] && !aVectors.empty()) { int aId = aPos[0]; aVecPos = *(std::next(aVectors.begin(), aId)); @@ -439,9 +439,7 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition( double aAng; std::list::const_iterator aItAng; - double aAngPos; bool aHasPlace = false; - //int aIntId = 0; // a position inside a one sector while (aPosCount < aPos[1]) { for (aItAng = aAngles.cbegin(), aItVec = aVectors.cbegin(); aItAng != aAngles.cend(); ++aItAng, ++aItVec) { @@ -451,9 +449,7 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition( if ((!aHasPlace) && (aPosCount >= (aPos[0] + 1))) { aHasPlace = true; - aAngPos = (*aItAng); aVecPos = (*aItVec); - //aIntId = aPos[0] - (aPosCount - Nb); } } if (aPosCount < aPos[1]) { diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 465633f92..96eaade66 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -119,9 +119,10 @@ std::map SketcherPrs_SymbolPrs::myIconsM SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, SketchPlugin_Sketch* theSketcher) - : AIS_InteractiveObject(), myConstraint(theConstraint), - myIsCustomColor(false), - mySketcher(theSketcher) + : AIS_InteractiveObject(), + myConstraint(theConstraint), + mySketcher(theSketcher), + myIsCustomColor(false) { SetAutoHilight(Standard_False); } @@ -229,8 +230,6 @@ void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group)& theGroup, std::shared_ptr aPnt1 = aEdge->firstPoint(); std::shared_ptr aPnt2 = aEdge->lastPoint(); - gp_Pnt aP1 = aPnt1->impl(); - gp_Pnt aP2 = aPnt2->impl(); // Draw line by two points Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments(2, 1); diff --git a/src/XGUI/XGUI.h b/src/XGUI/XGUI.h index 625e54445..39f58930a 100644 --- a/src/XGUI/XGUI.h +++ b/src/XGUI/XGUI.h @@ -36,4 +36,10 @@ #endif #endif +#if defined __GNUC__ || defined __clang__ +#define MAYBE_UNUSED __attribute__((unused)) +#else +#define MAYBE_UNUSED +#endif + #endif diff --git a/src/XGUI/XGUI_ActiveControlMgr.cpp b/src/XGUI/XGUI_ActiveControlMgr.cpp index 691d0dbed..f0c7455ff 100644 --- a/src/XGUI/XGUI_ActiveControlMgr.cpp +++ b/src/XGUI/XGUI_ActiveControlMgr.cpp @@ -55,7 +55,7 @@ void XGUI_ActiveControlMgr::addSelector(XGUI_ActiveControlSelector* theSelector) //******************************************************************** XGUI_ActiveControlSelector* XGUI_ActiveControlMgr::getSelector(const QString& theType) { - XGUI_ActiveControlSelector* aSelector; + XGUI_ActiveControlSelector* aSelector = 0; for (int i = 0, aCount = mySelectors.count(); i < aCount; i++) { if (mySelectors[i]->getType() != theType) diff --git a/src/XGUI/XGUI_ColorDialog.cpp b/src/XGUI/XGUI_ColorDialog.cpp index ac16bf5f0..a0f6a620e 100644 --- a/src/XGUI/XGUI_ColorDialog.cpp +++ b/src/XGUI/XGUI_ColorDialog.cpp @@ -62,8 +62,6 @@ XGUI_ColorDialog::XGUI_ColorDialog(QWidget* theParent) bool XGUI_ColorDialog::isRandomColor() const { - int anId = myButtonGroup->checkedId(); - return myButtonGroup->checkedId() == 1; } diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 7e99ec5ee..2972b77c5 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -525,7 +525,6 @@ void XGUI_ContextMenuMgr::updateViewerMenu() aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer); if (aPrsList.size() > 0) { bool isVisible = false; - bool isShading = false; bool canBeShaded = false; bool hasPlanar = false; ObjectPtr aObject; @@ -536,9 +535,7 @@ void XGUI_ContextMenuMgr::updateViewerMenu() GeomShapePtr aShape = aPrs->shape(); if (aObject->isDisplayed()) { isVisible = true; - canBeShaded = myWorkshop->displayer()->canBeShaded(aObject); - isShading = - (myWorkshop->displayer()->displayMode(aObject) == XGUI_Displayer::Shading); + canBeShaded = aDisplayer->canBeShaded(aObject); } if (aShape.get()) { if (aShape->isPlanar()) { diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index 7e47d3dd8..8b7ff8c7e 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -210,7 +210,6 @@ void XGUI_DataModel::processEvent(const std::shared_ptr& theMess QObjectPtrList aCreated; std::set::const_iterator aIt; - bool aRebuildAll = false; for (aIt = aObjects.cbegin(); aIt != aObjects.cend(); aIt++) { ObjectPtr aObj = (*aIt); if (aObj->groupName() == ModelAPI_ResultField::group()) { diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 365717787..e29ed8122 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -126,8 +126,10 @@ QString qIntListInfo(const QIntList& theValues, const QString& theSeparator = QS //************************************************************** XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop) -: myWorkshop(theWorkshop), myNeedUpdate(false), - myViewerBlockedRecursiveCount(0), myContextId(0) +: myWorkshop(theWorkshop), + myViewerBlockedRecursiveCount(0), + myContextId(0), + myNeedUpdate(false) { BRepMesh_IncrementalMesh::SetParallelDefault(Standard_True); } @@ -1144,7 +1146,7 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th Handle(AIS_Shape) anOwnerPresentation = Handle(AIS_Shape)::DownCast(anOwner->Selectable()); const TopoDS_Shape& aPresentationShape = anOwnerPresentation->Shape(); - if (aParameterShape.IsSame(anOwnerPresentation->Shape()) && + if (aParameterShape.IsSame(aPresentationShape) && !aCompsolidPresentations.Contains(anOwnerPresentation)) aCompsolidPresentations.Add(anOwnerPresentation); } diff --git a/src/XGUI/XGUI_ErrorMgr.cpp b/src/XGUI/XGUI_ErrorMgr.cpp index 42e3521a3..94be43669 100644 --- a/src/XGUI/XGUI_ErrorMgr.cpp +++ b/src/XGUI/XGUI_ErrorMgr.cpp @@ -52,13 +52,13 @@ const QString INVALID_VALUE = "invalid_action"; XGUI_ErrorMgr::XGUI_ErrorMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop) : ModuleBase_IErrorMgr(theParent), + myWorkshop(theWorkshop), myErrorDialog(0), myErrorLabel(0), - myWorkshop(theWorkshop), - myAcceptAllToolTip(""), - myAcceptAllStatusTip(""), myAcceptToolTip(""), - myAcceptStatusTip("") + myAcceptAllToolTip(""), + myAcceptStatusTip(""), + myAcceptAllStatusTip("") { } @@ -69,7 +69,6 @@ XGUI_ErrorMgr::~XGUI_ErrorMgr() void XGUI_ErrorMgr::updateActions(const FeaturePtr& theFeature) { //update Ok Action and header of property panel if the current operation started for the feature - XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); ModuleBase_OperationFeature* aFOperation = dynamic_cast (workshop()->operationMgr()->currentOperation()); if (aFOperation && aFOperation->feature() == theFeature) { @@ -144,7 +143,6 @@ bool XGUI_ErrorMgr::isApplyEnabled() const void XGUI_ErrorMgr::storeInitialActionValues() { - ModuleBase_ModelWidget* anActiveWidget = activeWidget(); XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr(); QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll); myAcceptAllToolTip = anAcceptAllAction->toolTip(); diff --git a/src/XGUI/XGUI_FacesPanel.cpp b/src/XGUI/XGUI_FacesPanel.cpp index 30b41d154..df5c2ddd7 100644 --- a/src/XGUI/XGUI_FacesPanel.cpp +++ b/src/XGUI/XGUI_FacesPanel.cpp @@ -88,12 +88,12 @@ void updateHiddenShapes(Handle(ModuleBase_ResultPrs) thePrs, const TopoDS_ListOf //******************************************************************** XGUI_FacesPanel::XGUI_FacesPanel(QWidget* theParent, XGUI_Workshop* theWorkshop) - : QDockWidget(theParent), myIsActive(false), myWorkshop(theWorkshop) + : QDockWidget(theParent), myWorkshop(theWorkshop), myIsActive(false) { setWindowTitle(tr("Hide Faces")); setObjectName("Hide Faces"); - QAction* aViewAct = toggleViewAction(); + MAYBE_UNUSED QAction* aViewAct = toggleViewAction(); setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }"); QWidget* aContent = new QWidget(this); @@ -469,7 +469,6 @@ bool XGUI_FacesPanel::processDelete() if (aSelectedIds.empty()) return false; - bool isModified = false; std::set aRestored; std::set::const_iterator anIt; for (anIt = aSelectedIds.begin(); anIt != aSelectedIds.end(); anIt++) { @@ -477,7 +476,6 @@ bool XGUI_FacesPanel::processDelete() if (aRestored.find(aPrs) == aRestored.end()) { aRestored.insert(aPrs); myItems.remove(*anIt); - isModified = true; } } std::map anObjectToShapes; diff --git a/src/XGUI/XGUI_HistoryMenu.cpp b/src/XGUI/XGUI_HistoryMenu.cpp index 09d220a40..a23cf7fda 100644 --- a/src/XGUI/XGUI_HistoryMenu.cpp +++ b/src/XGUI/XGUI_HistoryMenu.cpp @@ -68,7 +68,10 @@ void XGUI_HistoryMenu::setHistory(const QList& theActions) { myHistoryList->clear(); foreach(ActionInfo anAct, theActions) { - QListWidgetItem* anItem = new QListWidgetItem(anAct.icon, anAct.text, myHistoryList); +#ifdef _DEBUG + QListWidgetItem* anItem = +#endif + new QListWidgetItem(anAct.icon, anAct.text, myHistoryList); } } diff --git a/src/XGUI/XGUI_InspectionPanel.cpp b/src/XGUI/XGUI_InspectionPanel.cpp index 921709a9a..ed6be7433 100644 --- a/src/XGUI/XGUI_InspectionPanel.cpp +++ b/src/XGUI/XGUI_InspectionPanel.cpp @@ -367,6 +367,8 @@ void XGUI_InspectionPanel::setShapeParams(const TopoDS_Shape& theShape) case GeomAPI_Shape::COMPOUND: fillContainer(aShape); break; + default: // [to avoid compilation warning] + break; } } diff --git a/src/XGUI/XGUI_InspectionPanel.h b/src/XGUI/XGUI_InspectionPanel.h index 3a333cf60..4073ca614 100644 --- a/src/XGUI/XGUI_InspectionPanel.h +++ b/src/XGUI/XGUI_InspectionPanel.h @@ -57,7 +57,7 @@ class GeomAPI_Box; class ModuleBase_PageWidget; /// Internal name of property panel widget -const static char* INSPECTION_PANEL = "inspection_panel_dock"; +MAYBE_UNUSED const static char* INSPECTION_PANEL = "inspection_panel_dock"; /** * \ingroup GUI diff --git a/src/XGUI/XGUI_MenuMgr.cpp b/src/XGUI/XGUI_MenuMgr.cpp index 9d269bcf1..53145b795 100644 --- a/src/XGUI/XGUI_MenuMgr.cpp +++ b/src/XGUI/XGUI_MenuMgr.cpp @@ -174,7 +174,7 @@ void XGUI_MenuMgr::createFeatureActions() std::list >::const_iterator aFIt = aFeaturesInfo.begin(), aFLast = aFeaturesInfo.end(); size_t aFSize = aFeaturesInfo.size(); - for(int i = 0; aFIt != aFLast; aFIt++, i++) { + for(size_t i = 0; aFIt != aFLast; aFIt++, i++) { std::shared_ptr aMessage = *aFIt; bool aUseSeparator = i == aFSize-1; QAction* aAction = buildAction(aMessage, aWchName, aUseSeparator); diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp index 608969312..8ea40ee6a 100644 --- a/src/XGUI/XGUI_ModuleConnector.cpp +++ b/src/XGUI/XGUI_ModuleConnector.cpp @@ -124,7 +124,6 @@ ObjectPtr XGUI_ModuleConnector::findPresentedObject(const AISObjectPtr& theAIS) void XGUI_ModuleConnector::setSelected(const QList& theValues) { - XGUI_Displayer* aDisp = myWorkshop->displayer(); XGUI_ObjectsBrowser* aBrowser = myWorkshop->objectBrowser(); if (theValues.isEmpty()) { myWorkshop->selector()->clearSelection(); diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index beb73a742..139fe20b2 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -125,7 +125,7 @@ private: XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent, ModuleBase_IWorkshop* theWorkshop) -: QObject(theParent), myWorkshop(theWorkshop), mySHIFTPressed(false), myActiveMessageBox(0) +: QObject(theParent), myWorkshop(theWorkshop), myActiveMessageBox(0), mySHIFTPressed(false) { /// we need to install filter to the application in order to react to 'Delete' key button /// this key can not be a short cut for a corresponded action because we need to set @@ -388,7 +388,6 @@ bool XGUI_OperationMgr::isGrantedOperation(const QString& theId) QListIterator anIt(myOperations); anIt.toBack(); - ModuleBase_Operation* aPreviousOperation = 0; while (anIt.hasPrevious() && !isGranted) { ModuleBase_Operation* anOp = anIt.previous(); if (anOp) @@ -723,7 +722,6 @@ bool XGUI_OperationMgr::onKeyReleased(QObject *theObject, QKeyEvent* theEvent) bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent* theEvent) { // Let the manager decide what to do with the given key combination. - ModuleBase_Operation* anOperation = currentOperation(); bool isAccepted = false; switch (theEvent->key()) { case Qt::Key_Escape: { diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 70f7c2956..565f9d773 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -65,14 +65,14 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent, XGUI_OperationMgr* theMgr) : ModuleBase_IPropertyPanel(theParent), + myPanelPage(NULL), myActiveWidget(NULL), myPreselectionWidget(NULL), myInternalActiveWidget(NULL), - myPanelPage(NULL), myOperationMgr(theMgr) { setWindowTitle(tr("Property Panel")); - QAction* aViewAct = toggleViewAction(); + MAYBE_UNUSED QAction* aViewAct = toggleViewAction(); setObjectName(PROP_PANEL); setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }"); diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index feec29d67..b8f5523e8 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -36,22 +36,22 @@ class ModuleBase_PageWidget; class XGUI_OperationMgr; /// Internal name of property panel widget -const static char* PROP_PANEL = "property_panel_dock"; +MAYBE_UNUSED const static char* PROP_PANEL = "property_panel_dock"; /// Internal name of Ok button -const static char* PROP_PANEL_OK = "property_panel_ok"; +MAYBE_UNUSED const static char* PROP_PANEL_OK = "property_panel_ok"; /// Internal name of Ok button -const static char* PROP_PANEL_OK_PLUS = "property_panel_ok_plus"; +MAYBE_UNUSED const static char* PROP_PANEL_OK_PLUS = "property_panel_ok_plus"; /// Internal name of Cancel button -const static char* PROP_PANEL_CANCEL = "property_panel_cancel"; +MAYBE_UNUSED const static char* PROP_PANEL_CANCEL = "property_panel_cancel"; /// Internal name of Help button -const static char* PROP_PANEL_HELP = "property_panel_help"; +MAYBE_UNUSED const static char* PROP_PANEL_HELP = "property_panel_help"; /// Internal name of Preview button -const static char* PROP_PANEL_PREVIEW = "property_panel_preview"; +MAYBE_UNUSED const static char* PROP_PANEL_PREVIEW = "property_panel_preview"; /** * \ingroup GUI diff --git a/src/XGUI/XGUI_Selection.cpp b/src/XGUI/XGUI_Selection.cpp index 6f86809b2..e38e5c5b5 100644 --- a/src/XGUI/XGUI_Selection.cpp +++ b/src/XGUI/XGUI_Selection.cpp @@ -358,7 +358,6 @@ QList XGUI_Selection::getHighlighted() const return aPresentations; QList aSelectedIds; // Remember of selected address in order to avoid duplicates - XGUI_Displayer* aDisplayer = myWorkshop->displayer(); for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) { Handle(SelectMgr_EntityOwner) anOwner = aContext->DetectedOwner(); if (!anOwner.IsNull()) { diff --git a/src/XGUI/XGUI_SelectionActivate.cpp b/src/XGUI/XGUI_SelectionActivate.cpp index 6b3547f8d..1a11a9e27 100644 --- a/src/XGUI/XGUI_SelectionActivate.cpp +++ b/src/XGUI/XGUI_SelectionActivate.cpp @@ -229,17 +229,24 @@ void XGUI_SelectionActivate::activateObjects(const QIntList& theModes, return; AIS_ListIteratorOfListOfInteractive aLIt; +#ifdef _DEBUG bool isActivationChanged = false; +#endif for(aLIt.Initialize(aPrsList); aLIt.More(); aLIt.Next()) { anAISIO = aLIt.Value(); - if (activate(anAISIO, false)) + if (activate(anAISIO, false)) { +#ifdef _DEBUG isActivationChanged = true; +#endif + } } for(aLIt.Initialize(aPrsListToBeDeactivated); aLIt.More(); aLIt.Next()) { anAISIO = aLIt.Value(); deactivateAIS(anAISIO); +#ifdef _DEBUG isActivationChanged = true; +#endif } } @@ -423,7 +430,7 @@ bool XGUI_SelectionActivate::activate(const Handle(AIS_InteractiveObject)& theIO for (; itr.More(); itr.Next() ) { Standard_Integer aMode = itr.Value(); aHasValidMode = aHasValidMode || aMode != -1; - int aShapeMode = (aMode > 8)? aMode : AIS_Shape::SelectionType(aMode); + //int aShapeMode = (aMode > 8)? aMode : AIS_Shape::SelectionType(aMode); if (!myActiveSelectionModes.contains(aMode)) { deactivateAIS(theIO, aMode); isDeactivated = true; diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index e1aa196e4..94cc72a80 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -200,13 +200,13 @@ static QString MyImportPartFilter(QObject::tr("Part files (*.shaperpart);;All fi XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector) : QObject(), myModule(NULL), - mySalomeConnector(theConnector), + myObjectBrowser(0), myPropertyPanel(0), - myInspectionPanel(0), myFacesPanel(0), - myObjectBrowser(0), - myDisplayer(0) - //myViewerSelMode(TopAbs_FACE) + myDisplayer(0), + mySalomeConnector(theConnector), + //myViewerSelMode(TopAbs_FACE), + myInspectionPanel(0) { mySelector = new XGUI_SelectionMgr(this); myModuleConnector = new XGUI_ModuleConnector(this); @@ -595,13 +595,11 @@ void XGUI_Workshop::onStartWaiting() //****************************************************** void XGUI_Workshop::onAcceptActionClicked() { - QAction* anAction = dynamic_cast(sender()); XGUI_OperationMgr* anOperationMgr = operationMgr(); if (anOperationMgr) { ModuleBase_OperationFeature* aFOperation = dynamic_cast (anOperationMgr->currentOperation()); if (aFOperation) { - //if (errorMgr()->canProcessClick(anAction, aFOperation->feature())) myOperationMgr->commitOperation(); } } @@ -610,7 +608,6 @@ void XGUI_Workshop::onAcceptActionClicked() //****************************************************** void XGUI_Workshop::onAcceptPlusActionClicked() { - QAction* anAction = dynamic_cast(sender()); XGUI_OperationMgr* anOperationMgr = operationMgr(); if (anOperationMgr) { ModuleBase_OperationFeature* aFOperation = dynamic_cast @@ -2802,7 +2799,6 @@ void XGUI_Workshop::setNormalView(bool toInvert) aFace->computeSize(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); Handle(V3d_View) aView = myViewerProxy->activeView(); - double aScale = aView->Scale(); aView->SetAt(aPos->x(), aPos->y(), aPos->z()); aView->SetProj(aNormal->x(), aNormal->y(), aNormal->z()); Bnd_Box aBox; @@ -2815,7 +2811,7 @@ void XGUI_Workshop::setNormalView(bool toInvert) void XGUI_Workshop::registerValidators() const { SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + MAYBE_UNUSED ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); } //************************************************************** @@ -3145,7 +3141,6 @@ void XGUI_Workshop::onAutoApply() void XGUI_Workshop::updateAutoComputeState() { SessionPtr aMgr = ModelAPI_Session::get(); - bool isComputeBlocked = aMgr->isAutoUpdateBlocked(); #ifdef HAVE_SALOME // QAction* aUpdateCmd; // QList aCommands = mySalomeConnector->commandList(); @@ -3158,6 +3153,7 @@ void XGUI_Workshop::updateAutoComputeState() // aUpdateCmd->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") : // QIcon(":pictures/autoapply_start.png")); #else + bool isComputeBlocked = aMgr->isAutoUpdateBlocked(); AppElements_MainMenu* aMenuBar = myMainWindow->menuObject(); AppElements_Command* aUpdateCmd = aMenuBar->feature("AUTOCOMPUTE_CMD"); aUpdateCmd->button()->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") : diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 5f83d9784..537a38e18 100644 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -86,7 +86,6 @@ XGUI_WorkshopListener::XGUI_WorkshopListener(XGUI_Workshop* theWorkshop) : myWorkshop(theWorkshop), myUpdatePrefs(false) { - XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr(); } //****************************************************** @@ -430,7 +429,6 @@ void XGUI_WorkshopListener:: !anObject->isDisplayed(); if (!aHide) { // check that this is not hidden result ResultPtr aRes = std::dynamic_pointer_cast(anObject); - bool isConcealed = aRes && aRes->isConcealed(); aHide = aRes && aRes->isConcealed(); // Hide the presentation with an empty shape. But isDisplayed state of the object should not // be changed to the object becomes visible when the shape becomes not empty @@ -448,7 +446,7 @@ void XGUI_WorkshopListener:: } } - bool isCustomized = customizeFeature(anObjects, aDisplayed); + MAYBE_UNUSED bool isCustomized = customizeFeature(anObjects, aDisplayed); //if (myObjectBrowser) // myObjectBrowser->processEvent(theMsg); @@ -522,7 +520,6 @@ bool XGUI_WorkshopListener::displayObject(ObjectPtr theObj) return aDisplayed; XGUI_Displayer* aDisplayer = aWorkshop->displayer(); - int aNb = aDisplayer->objectsCount(); return aDisplayer->display(theObj, false); }