--- /dev/null
+.gitattributes eol=lf
+.gitignore eol=lf
+*.txt eol=lf
+*.in eol=lf
+*.h eol=lf
+*.c eol=lf
+*.inl eol=lf
+*.cpp eol=lf
+*.cxx eol=lf
+*.hxx eol=lf
+*.cls eol=lf
+*.sty eol=lf
+*.tex eol=lf
+*.m eol=lf
+*.sh eol=lf
+*.csh eol=lf
+*.workspace eol=lf
+*.cbp eol=lf
+*.svg eol=lf
+*.dia eol=lf
+*.xib eol=lf
+*.plist eol=lf
+*.java eol=lf
+*.ts eol=lf
+*.qml eol=lf
+*.qrc eol=lf
+*.bat eol=crlf
+*.cmd eol=crlf
+*.dll binary
+*.so binary
+*.dylib binary
+*.7z binary
+*.pdf binary
+*.png binary
+*.jpg binary
+*.bmp binary
+*.gif binary
+*.xwd binary
+*.ico binary
+*.icns binary
+*.std binary
+*.gz binary
+*.doc binary
+*.rgb binary
+*.mft binary
+*.stl binary
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif (CMAKE_GENERATOR MATCHES "NMake Makefiles")
+
+# Add special Git hooks
+if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
+ configure_file("${CMAKE_SOURCE_DIR}/GitHooks/pre-commit.in"
+ "${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit")
+endif()
--- /dev/null
+set noparent
+linelength=100
+filter=-,+whitespace/line_length,+whitespace/end_of_line
+root=src
+
+# whitespace/line_length
+# whitespace/end_of_line
+# whitespace/empty_loop_body
+# readability/multiline_string
--- /dev/null
+#!/bin/bash
+
+function isDOSFile
+{
+ local FILENAME="$1"
+ file "$FILENAME" | grep -q "CRLF line terminators"
+}
+
+if git rev-parse --verify HEAD >/dev/null 2>&1
+then
+ against=HEAD
+else
+ # Initial commit: diff against an empty tree object
+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+# If you want to allow non-ASCII filenames set this variable to true.
+allownonascii=$(git config hooks.allownonascii)
+
+# Redirect output to stderr.
+exec 1>&2
+
+# Cross platform projects tend to avoid non-ASCII filenames; prevent
+# them from being added to the repository. We exploit the fact that the
+# printable range starts at the space character and ends with tilde.
+if [ "$allownonascii" != "true" ] &&
+ # Note that the use of brackets around a tr range is ok here, (it's
+ # even required, for portability to Solaris 10's /usr/bin/tr), since
+ # the square bracket bytes happen to fall in the designated range.
+ test $(git diff --cached --name-only --diff-filter=A -z $against |
+ LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
+then
+ cat <<\EOF
+Error: Attempt to add a non-ASCII file name.
+
+This can cause problems if you want to work with people on other platforms.
+
+To be portable it is advisable to rename the file.
+
+If you know what you are doing you can disable this check using:
+
+ git config hooks.allownonascii true
+EOF
+ exit 1
+fi
+
+FOUND=0
+# If there are whitespace errors, print the offending file names and fail.
+if [ "$(exec git diff-index --check --cached $against -- )" != "" ]
+then
+ FOUND=1
+fi
+
+# Find files with DOS line endings
+for FILE in $(exec git diff --name-only --cached $against -- | sed '/^[+-]/d' | sed -r 's/:[0-9]+:.*//' | uniq) ; do
+ isDOSFile "$FILE"
+ if (( $? == 0 ))
+ then
+ echo "ERROR: \"$FILE\" has DOS line endings" >&2
+ FOUND=1
+ fi
+done
+
+exit $FOUND
--- /dev/null
+#!/bin/bash
+
+source env.sh
+
+CPPLINT_ARGS=""
+CPPLINT_ARGS="${CPPLINT_ARGS} --verbose=0"
+CPPLINT_ARGS="${CPPLINT_ARGS} --recursive"
+CPPLINT_ARGS="${CPPLINT_ARGS} --counting=detailed"
+CPPLINT_ARGS="${CPPLINT_ARGS} --extensions=h,cpp"
+CPPLINT_ARGS="${CPPLINT_ARGS} --exclude=src/XAO/* --exclude=src/XAO/tests/*"
+CPPLINT_ARGS="${CPPLINT_ARGS} --output=vs7"
+
+! cpplint.py ${CPPLINT_ARGS} . 2>&1 | grep -v Done
+++ /dev/null
-linelength=100
-filter=-,+whitespace/line_length
-root=src
-
-# whitespace/line_length
-# whitespace/end_of_line
-# whitespace/empty_loop_body
-# readability/multiline_string
# This script uses:
#
-# SHAPER_PDIR - path of PRODUCTS for SHAPER (SolveSpace, lcov)
+# SHAPER_PDIR - path of PRODUCTS for SHAPER (SolveSpace, lcov, cpplint)
# SHAPER_ROOT_DIR - path of SHAPER installation
for path in SHAPER_PDIR SHAPER_ROOT_DIR; do
export PATH=${LCOV_ROOT_DIR}/bin:${PATH}
##
+#------ cpplint ------
+export CPPLINT_ROOT_DIR=${SHAPER_PDIR}/cpplint-1.3.0
+export PATH=${CPPLINT_ROOT_DIR}:${PATH}
+##
+
#------ OCCT ------
# Defaults
export CSF_PluginDefaults=${CAS_ROOT_DIR}/src/StdResource
#!/bin/bash
+FIX_LINE_ENDINGS=0
+while [[ $# > 0 ]]; do
+ key="$1"
+
+ case $key in
+ fix)
+ FIX_LINE_ENDINGS=1
+ shift
+ ;;
+ *)
+ shift
+ ;;
+ esac
+done
+
+source env.sh
+
find . \( -name "*.h" -o -name "*.cpp" \) -exec cpplint.py --filter=-,+whitespace/end_of_line --verbose=0 --counting=detailed {} \+ 2>&1 | grep -v Done | tee ./tofix
-python correction_auto_2.py --cpplint_output_file ./tofix
+WRONG=0
+if [ -s ./tofix ]; then
+ if [[ ${FIX_LINE_ENDINGS} == 1 ]]; then
+ python correction_auto_2.py --cpplint_output_file ./tofix
+ echo "NOTE: Line endings are fixed"
+ else
+ WRONG=1
+ fi
+fi
-rm ./tofix
\ No newline at end of file
+rm ./tofix
+exit $WRONG
void CollectionPlugin_Group::initAttributes()
{
- data()->addAttribute(CollectionPlugin_Group::LIST_ID(),
+ data()->addAttribute(CollectionPlugin_Group::LIST_ID(),
ModelAPI_AttributeSelectionList::typeId());
}
if (myPanelTypes.find(theType) == myPanelTypes.end())
return aWidget;
- if (theType == "field-panel") {
+ if (theType == "field-panel") {
aWidget = new CollectionPlugin_WidgetField(theParent, theWorkshop, theWidgetApi);
}
class DataTableItemDelegate : public QStyledItemDelegate
{
public:
- DataTableItemDelegate(ModelAPI_AttributeTables::ValueType theType) :
+ DataTableItemDelegate(ModelAPI_AttributeTables::ValueType theType) :
QStyledItemDelegate() { myType = theType; }
- virtual QWidget* createEditor(QWidget* theParent,
- const QStyleOptionViewItem & theOption,
+ virtual QWidget* createEditor(QWidget* theParent,
+ const QStyleOptionViewItem & theOption,
const QModelIndex& theIndex) const;
ModelAPI_AttributeTables::ValueType dataType() const { return myType; }
void setDataType(ModelAPI_AttributeTables::ValueType theType) { myType = theType; }
-
+
signals:
void startEditing();
ModelAPI_AttributeTables::ValueType myType;
};
-QWidget* DataTableItemDelegate::createEditor(QWidget* theParent,
- const QStyleOptionViewItem & theOption,
+QWidget* DataTableItemDelegate::createEditor(QWidget* theParent,
+ const QStyleOptionViewItem & theOption,
const QModelIndex& theIndex ) const
{
if ((theIndex.column() == 0) && (theIndex.row() > 0)) {
QLineEdit* aLineEdt = 0;
switch (myType) {
case ModelAPI_AttributeTables::DOUBLE:
- aLineEdt = dynamic_cast<QLineEdit*>(QStyledItemDelegate::createEditor(theParent,
- theOption,
+ aLineEdt = dynamic_cast<QLineEdit*>(QStyledItemDelegate::createEditor(theParent,
+ theOption,
theIndex));
if (aLineEdt) {
aLineEdt->setValidator(new QDoubleValidator(aLineEdt));
}
break;
case ModelAPI_AttributeTables::INTEGER:
- aLineEdt = dynamic_cast<QLineEdit*>(QStyledItemDelegate::createEditor(theParent,
- theOption,
+ aLineEdt = dynamic_cast<QLineEdit*>(QStyledItemDelegate::createEditor(theParent,
+ theOption,
theIndex));
if (aLineEdt) {
aLineEdt->setValidator(new QIntValidator(aLineEdt));
return aLineEdt;
}
break;
- case ModelAPI_AttributeTables::BOOLEAN:
+ case ModelAPI_AttributeTables::BOOLEAN:
{
QComboBox* aBox = new QComboBox(theParent);
aBox->addItem(MYFalse);
//**********************************************************************************
//**********************************************************************************
CollectionPlugin_WidgetField::
- CollectionPlugin_WidgetField(QWidget* theParent,
- ModuleBase_IWorkshop* theWorkshop,
+ CollectionPlugin_WidgetField(QWidget* theParent,
+ ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData):
ModuleBase_WidgetSelector(theParent, theWorkshop, theData), myHeaderEditor(0),
myIsEditing(false), myActivation(false)
// Type of shapes
myShapeTypeCombo = new QComboBox(aTypesWgt);
QStringList aShapeTypes;
- aShapeTypes << tr("Vertices") << tr("Edges") << tr("Faces")
+ aShapeTypes << tr("Vertices") << tr("Edges") << tr("Faces")
<< tr("Solids") << tr("Objects") << tr("Parts");
myShapeTypeCombo->addItems(aShapeTypes);
aTypesLayout->addRow(tr("Type of shapes"), myShapeTypeCombo);
// Type of field
myFieldTypeCombo = new QComboBox(aTypesWgt);
QStringList aFieldTypes;
- aFieldTypes << tr("Boolean") << tr("Integer") << tr("Double")
+ aFieldTypes << tr("Boolean") << tr("Integer") << tr("Double")
<< tr("String");
myFieldTypeCombo->addItems(aFieldTypes);
myFieldTypeCombo->setCurrentIndex(2);
}
}
} else if ((theObject == myHeaderEditor) && (theEvent->type() == QEvent::FocusOut)) {
- //QHeaderView* aHeader =
+ //QHeaderView* aHeader =
// static_cast<QHeaderView*>(myHeaderEditor->parentWidget()->parentWidget());
QString aNewTitle = myHeaderEditor->text();
//save item text
case ModelAPI_AttributeTables::INTEGER:
aItem->setText("0");
break;
- case ModelAPI_AttributeTables::BOOLEAN:
+ case ModelAPI_AttributeTables::BOOLEAN:
aItem->setText(MYFalse);
break;
}
case ModelAPI_AttributeTables::INTEGER:
aItem->setText(QString::number(theVal.myInt));
break;
- case ModelAPI_AttributeTables::BOOLEAN:
+ case ModelAPI_AttributeTables::BOOLEAN:
aItem->setText(theVal.myBool? MYTrue : MYFalse);
break;
- case ModelAPI_AttributeTables::STRING:
+ case ModelAPI_AttributeTables::STRING:
aItem->setText(theVal.myStr.c_str());
}
return aItem;
QTableWidget* aTable = myDataTblList.first();
int aRows = aTable->rowCount();
// first column contains selected names which should not be stored
- int aColumns = aTable->columnCount() - 1;
+ int aColumns = aTable->columnCount() - 1;
aTablesAttr->setSize(aRows, aColumns, aNbSteps);
aTablesAttr->setType((ModelAPI_AttributeTables::ValueType)aFldType);
aTablesAttr->setSize(aTablesAttr->rows(), aTablesAttr->columns(), myDataTblList.size());
- AttributeSelectionListPtr aSelList =
+ AttributeSelectionListPtr aSelList =
myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID());
if (!aSelList->isInitialized())
return;
if (myShapeTypeCombo->currentIndex() == 5)
return;
- QList<ModuleBase_ViewerPrsPtr> aSelected =
+ QList<ModuleBase_ViewerPrsPtr> aSelected =
myWorkshop->selection()->getSelected(ModuleBase_ISelection::AllControls);
- AttributeSelectionListPtr aSelList =
+ AttributeSelectionListPtr aSelList =
myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID());
aSelList->setSelectionType(getSelectionType(myShapeTypeCombo->currentIndex()));
aSelList->clear();
QTableWidgetItem* aItem = 0;
foreach(QTableWidget* aTable, myDataTblList) {
aTable->setRowCount(aNewRows);
- if (aNewRows > aRows) {
+ if (aNewRows > aRows) {
// Add new data
for(int i = 0; i < aColumns; i++) {
if (i == 0) {
aTable->item(j, i)->setText("0");
}
break;
- case ModelAPI_AttributeTables::BOOLEAN:
+ case ModelAPI_AttributeTables::BOOLEAN:
aTable->item(j, i)->setText(MYFalse);
break;
}
{
activateSelectionAndFilters(theType == 5? false:true);
- AttributeSelectionListPtr aSelList =
+ AttributeSelectionListPtr aSelList =
myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID());
std::string aTypeName = getSelectionType(theType);
{
Q_OBJECT
public:
- CollectionPlugin_WidgetField(QWidget* theParent,
- ModuleBase_IWorkshop* theWorkshop,
+ CollectionPlugin_WidgetField(QWidget* theParent,
+ ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData);
virtual ~CollectionPlugin_WidgetField() {}
}
}
// send
- std::map<char*, std::map<void*, std::list<Events_Listener*> > >::iterator aFindID =
+ std::map<char*, std::map<void*, std::list<Events_Listener*> > >::iterator aFindID =
myListeners.find(theMessage->eventID().eventText());
if (aFindID != myListeners.end()) {
std::map<void*, std::list<Events_Listener*> >::iterator aFindSender = aFindID->second.find(
myImmediateListeners[theID.eventText()] = theListener;
return;
}
- std::map<char*, std::map<void*, std::list<Events_Listener*> > >::iterator aFindID =
+ std::map<char*, std::map<void*, std::list<Events_Listener*> > >::iterator aFindID =
myListeners.find(theID.eventText());
if (aFindID == myListeners.end()) { // create container associated with ID
myListeners[theID.eventText()] = std::map<void*, std::list<Events_Listener*> >();
aFindID = myListeners.find(theID.eventText());
}
- std::map<void*, std::list<Events_Listener*> >::iterator aFindSender =
+ std::map<void*, std::list<Events_Listener*> >::iterator aFindSender =
aFindID->second.find(theSender);
if (aFindSender == aFindID->second.end()) { // create container associated with sender
aFindID->second[theSender] = std::list<Events_Listener*>();
}
}
// send accumulated messages to "groupListeners"
- std::map<char*, std::map<void*, std::list<Events_Listener*> > >::iterator aFindID =
+ std::map<char*, std::map<void*, std::list<Events_Listener*> > >::iterator aFindID =
myListeners.find(theID.eventText());
if (aFindID != myListeners.end()) {
std::map<void*, std::list<Events_Listener*> >::iterator aFindSender =
// conversion of dimension
std::string aSelectionType = aSelectionList->selectionType();
- std::string aDimensionString =
+ std::string aDimensionString =
ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType);
XAO::Dimension aGroupDimension = XAO::XaoUtils::stringToDimension(aDimensionString);
// conversion of dimension
std::string aSelectionType = aSelectionList->selectionType();
- std::string aDimensionString =
+ std::string aDimensionString =
ExchangePlugin_Tools::selectionType2xaoDimension(aSelectionType);
XAO::Dimension aFieldDimension = XAO::XaoUtils::stringToDimension(aDimensionString);
bool isWholePart = aSelectionType == "part";
std::string aPlacedName = "Placed";
std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTransformAlgo.mapOfSubShapes();
- FeaturesPlugin_Tools::storeModifiedShapes(theTransformAlgo, theResultBody,
- theBaseShape, aPlacedTag, aPlacedName,
+ FeaturesPlugin_Tools::storeModifiedShapes(theTransformAlgo, theResultBody,
+ theBaseShape, aPlacedTag, aPlacedName,
*aSubShapes.get());
}
std::string aRotatedName = "Rotated";
std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theRotaionAlgo.mapOfSubShapes();
- FeaturesPlugin_Tools::storeModifiedShapes(theRotaionAlgo, theResultBody,
- theBaseShape, aRotatedTag, aRotatedName,
+ FeaturesPlugin_Tools::storeModifiedShapes(theRotaionAlgo, theResultBody,
+ theBaseShape, aRotatedTag, aRotatedName,
*aSubShapes.get());
}
PyDict_Clear(_local_context);
}
-double InitializationPlugin_PyInterp::evaluate(const std::string& theExpression, std::string& theError)
+double InitializationPlugin_PyInterp::evaluate(const std::string& theExpression,
+ std::string& theError)
{
PyLockWrapper lck; // Acquire GIL until the end of the method
PyCompilerFlags aFlags = {CO_FUTURE_DIVISION};
aFeatureOwner->removeResults(0, false);
}
aSel.Select(aNewSub, aNewContext);
-
+
if (aEraseResults) { // flash after Select : in Groups it makes selection with shift working
static Events_Loop* aLoop = Events_Loop::loop();
static const Events_ID kDeletedEvent = aLoop->eventByName(EVENT_OBJECT_DELETED);
if (myArray.IsNull() || !myArray->IsValid()) {
// this could be on undo and then redo creation of the attribute
// in result creation it may be uninitialized
- myIsInitialized =
+ myIsInitialized =
myLab.FindAttribute(TDataStd_ExtStringArray::GetID(), myArray) == Standard_True;
}
// checking the validity because attribute (as a field) may be presented,
(myType == ModelAPI_AttributeTables::BOOLEAN) ?
new TColStd_HArray1OfByte(0, aNewSize - 1) : Handle(TColStd_HArray1OfByte)();
Handle(TColStd_HArray1OfInteger) anOldInt, aNewInt =
- (myType == ModelAPI_AttributeTables::INTEGER) ?
+ (myType == ModelAPI_AttributeTables::INTEGER) ?
new TColStd_HArray1OfInteger(0, aNewSize - 1) : Handle(TColStd_HArray1OfInteger)();
Handle(TColStd_HArray1OfExtendedString) anOldStr, aNewStr =
- (myType == ModelAPI_AttributeTables::STRING) ?
+ (myType == ModelAPI_AttributeTables::STRING) ?
new TColStd_HArray1OfExtendedString(0, aNewSize - 1) :
Handle(TColStd_HArray1OfExtendedString)();
if (aSize != 0) { // copy the previous values into new positions, otherwise default values
myLab.ForgetAttribute(MY_ARRAY_ID(theType));
myType = theType;
int aTables = myTables;
- myTables = 0; // to let setSize know that there is no old array
+ myTables = 0; // to let setSize know that there is no old array
setSize(myRows, myCols, aTables);
} else {
myType = theType;
///
/// The type of values can be changed. But all the values in the tables must have the same one
/// type. The currently allowed types now are: Boolean, Integer, Double, String.
-/// By default there is only one table, but it may be increased/decreased by adding/removing
+/// By default there is only one table, but it may be increased/decreased by adding/removing
/// tables one by one.
/// The number of rows and columns are equal in all tables. If table, row or column is added,
/// the previous values are kept unchanged. New cells are filled by zero, false or empty strings.
for(int a = 0; a < aResults; a++) {
ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(
document()->object(ModelAPI_ResultBody::group(), a));
- if (!aBody.get())
+ if (!aBody.get())
continue;
// check that only results that were created before this field are used
FeaturePtr aResultFeature = document()->feature(aBody);
TNaming_Iterator anItL(aNS);
for(int i = 1; anItL.More(); anItL.Next(), i++) {
// in #1766 IsEqual produced no index of the face
- if(anItL.NewShape().IsSame(theShape)) {
+ if(anItL.NewShape().IsSame(theShape)) {
aName += aPostFix;
aName += TCollection_AsciiString (i).ToCString();
break;
///
/// The type of values can be changed. But all the values in the tables must have the same one
/// type. The currently allowed types now are: Boolean, Integer, Double, String.
-/// By default there is only one table, but it may be increased/decreased by adding/removing
+/// By default there is only one table, but it may be increased/decreased by adding/removing
/// tables one by one.
/// The number of rows and columns are equal in all tables. If table, row or column is added,
/// the previous values are kept unchanged. New cells are filled by zero, false or empty strings.
return myIsProcessed;
}
-const std::list<std::shared_ptr<ModelAPI_ResultParameter> >&
- ModelAPI_ParameterEvalMessage::params() const
+const std::list<std::shared_ptr<ModelAPI_ResultParameter> >&
+ ModelAPI_ParameterEvalMessage::params() const
{
return myParamsList;
}
int anIndex = 0;
for (auto it = theValue.begin(); it != theValue.end(); ++it, ++anIndex)
- theAttribute->setValue(anIndex, *it);
+ theAttribute->setValue(anIndex, *it);
}
//--------------------------------------------------------------------------------------
MODELHIGHAPI_EXPORT
GeomAPI_Shape::ShapeType getShapeType(const ModelHighAPI_Selection& theSelection);
-MODELHIGHAPI_EXPORT
+MODELHIGHAPI_EXPORT
ModelAPI_AttributeTables::ValueType valueTypeByStr(const std::string& theValueTypeStr);
-MODELHIGHAPI_EXPORT
+MODELHIGHAPI_EXPORT
std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType);
/// Performs the high level API dump, then closes all and executes the script:
std::string anExpressionString = theExpression;
// ask interpreter to compute the positions in the expression
- std::shared_ptr<ModelAPI_ComputePositionsMessage> aMsg =
+ std::shared_ptr<ModelAPI_ComputePositionsMessage> aMsg =
ModelAPI_ComputePositionsMessage::send(theExpression, theOldName, this);
const std::list<std::pair<int, int> >& aPositions = aMsg->positions();
SessionPtr aMgr = ModelAPI_Session::get();
bool isNewTransaction = !aMgr->isOperation();
// activation may cause changes in current features in document, so it must be in transaction
- if (isNewTransaction)
+ if (isNewTransaction)
aMgr->startOperation("Activation");
aMgr->setActiveDocument(aMgr->moduleDocument());
if (isNewTransaction) aMgr->finishOperation();