mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 02:00:35 +05:00
*** empty log message ***
This commit is contained in:
parent
1b285d81c4
commit
26c427c3c2
@ -216,7 +216,8 @@ void CurveCreator_ICurve::removeSection(const int theISection)
|
|||||||
delete *anIterRm;
|
delete *anIterRm;
|
||||||
mySections.erase(anIterRm);
|
mySections.erase(anIterRm);
|
||||||
}
|
}
|
||||||
myListener->sectionRemoved(theISection);
|
if( myListener )
|
||||||
|
myListener->sectionRemoved(theISection);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -268,7 +269,8 @@ void CurveCreator_ICurve::removePoints(const int theISection,
|
|||||||
aSection->myPoints.end() : anIterBegin + toICoord(theNbPoints));
|
aSection->myPoints.end() : anIterBegin + toICoord(theNbPoints));
|
||||||
|
|
||||||
aSection->myPoints.erase(anIterBegin, anIterEnd);
|
aSection->myPoints.erase(anIterBegin, anIterEnd);
|
||||||
myListener->pointRemoved(theISection, theIPnt, theNbPoints );
|
if( myListener )
|
||||||
|
myListener->pointRemoved(theISection, theIPnt, theNbPoints );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -160,6 +160,11 @@ QModelIndex CurveCreator_TreeViewModel::sectionIndex( int theSection ) const
|
|||||||
return createIndex( theSection, 0, ID_SECTION );
|
return createIndex( theSection, 0, ID_SECTION );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QModelIndex CurveCreator_TreeViewModel::nbPointsIndex( int theSection ) const
|
||||||
|
{
|
||||||
|
return createIndex( theSection, 1, ID_SECTION );
|
||||||
|
}
|
||||||
|
|
||||||
QModelIndex CurveCreator_TreeViewModel::pointIndex( int theSection, int thePoint ) const
|
QModelIndex CurveCreator_TreeViewModel::pointIndex( int theSection, int thePoint ) const
|
||||||
{
|
{
|
||||||
return createIndex( thePoint, 0, theSection );
|
return createIndex( thePoint, 0, theSection );
|
||||||
@ -203,9 +208,10 @@ CurveCreator_TreeView::CurveCreator_TreeView( CurveCreator_Curve* theCurve, QWid
|
|||||||
CurveCreator_TreeViewModel* aModel = new CurveCreator_TreeViewModel(theCurve, this);
|
CurveCreator_TreeViewModel* aModel = new CurveCreator_TreeViewModel(theCurve, this);
|
||||||
setModel(aModel);
|
setModel(aModel);
|
||||||
setSelectionBehavior(SelectRows);
|
setSelectionBehavior(SelectRows);
|
||||||
setSelectionMode(ExtendedSelection);
|
setSelectionMode(SingleSelection);
|
||||||
setRootIsDecorated(false);
|
setRootIsDecorated(false);
|
||||||
setItemsExpandable(false);
|
setItemsExpandable(false);
|
||||||
|
setAllColumnsShowFocus(true);
|
||||||
connect( selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
connect( selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
this, SIGNAL(selectionChanged()) );
|
this, SIGNAL(selectionChanged()) );
|
||||||
connect( this, SIGNAL(activated(QModelIndex)), this, SLOT(onActivated(QModelIndex)));
|
connect( this, SIGNAL(activated(QModelIndex)), this, SLOT(onActivated(QModelIndex)));
|
||||||
@ -235,6 +241,7 @@ void CurveCreator_TreeView::pointsAdded( int theSection, int thePoint, int thePo
|
|||||||
QModelIndex aSectIndx = aModel->sectionIndex( theSection );
|
QModelIndex aSectIndx = aModel->sectionIndex( theSection );
|
||||||
rowsInserted(aSectIndx, thePoint, thePoint + thePointsCnt - 1 );
|
rowsInserted(aSectIndx, thePoint, thePoint + thePointsCnt - 1 );
|
||||||
// expand( aSectIndx );
|
// expand( aSectIndx );
|
||||||
|
update( aModel->nbPointsIndex( theSection ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ public:
|
|||||||
// virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole);
|
// virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole);
|
||||||
|
|
||||||
QModelIndex sectionIndex( int theSection ) const;
|
QModelIndex sectionIndex( int theSection ) const;
|
||||||
|
QModelIndex nbPointsIndex( int theSection ) const;
|
||||||
QModelIndex pointIndex( int theSection, int thePoint ) const;
|
QModelIndex pointIndex( int theSection, int thePoint ) const;
|
||||||
|
|
||||||
bool isSection( const QModelIndex& theIndx ) const;
|
bool isSection( const QModelIndex& theIndx ) const;
|
||||||
|
@ -226,11 +226,6 @@ void CurveCreator_Widget::onSelectionChanged()
|
|||||||
QList<ActionId> anEnabledAct;
|
QList<ActionId> anEnabledAct;
|
||||||
if( myCurve ){
|
if( myCurve ){
|
||||||
anEnabledAct << NEW_SECTION_ID;
|
anEnabledAct << NEW_SECTION_ID;
|
||||||
int aSectCnt = myCurve->getNbPoints();
|
|
||||||
if( aSectCnt > 0 )
|
|
||||||
anEnabledAct << CLEAR_ALL_ID;
|
|
||||||
if( aSectCnt > 1 )
|
|
||||||
anEnabledAct << JOIN_ALL_ID;
|
|
||||||
QList<int> aSelSections = mySectionView->getSelectedSections();
|
QList<int> aSelSections = mySectionView->getSelectedSections();
|
||||||
QList< QPair< int, int > > aSelPoints = mySectionView->getSelectedPoints();
|
QList< QPair< int, int > > aSelPoints = mySectionView->getSelectedPoints();
|
||||||
CurveCreator_TreeView::SelectionType aSelType = mySectionView->getSelectionType();
|
CurveCreator_TreeView::SelectionType aSelType = mySectionView->getSelectionType();
|
||||||
@ -239,22 +234,40 @@ void CurveCreator_Widget::onSelectionChanged()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CurveCreator_TreeView::ST_SECTIONS:{
|
case CurveCreator_TreeView::ST_SECTIONS:{
|
||||||
if( aSelSections.size() > 1 ){
|
/*if( aSelSections[0] > 0 ){
|
||||||
anEnabledAct << JOIN_ID;
|
|
||||||
}
|
|
||||||
if( aSelSections[0] > 0 ){
|
|
||||||
anEnabledAct << UP_ID;
|
anEnabledAct << UP_ID;
|
||||||
}
|
}*/
|
||||||
if( aSelSections.size() == 1 ){
|
if( aSelSections.size() == 1 ){
|
||||||
anEnabledAct << CREATION_MODE_ID << EDITION_MODE_ID << DETECTION_MODE_ID;
|
anEnabledAct << CREATION_MODE_ID << EDITION_MODE_ID << DETECTION_MODE_ID;
|
||||||
}
|
}
|
||||||
if( aSelSections[ aSelSections.size() - 1 ] < ( myCurve->getNbSections() - 1 ) ){
|
if (myActionMap[CREATION_MODE_ID]->isChecked()) {
|
||||||
anEnabledAct << DOWN_ID;
|
mySection = -1;
|
||||||
|
myPointNum = -1;
|
||||||
|
QList<int> aSelSection = mySectionView->getSelectedSections();
|
||||||
|
if( aSelSection.size() > 0 ){
|
||||||
|
mySection = aSelSection[0];
|
||||||
|
myPointNum = myCurve->getNbPoints(mySection);
|
||||||
|
}
|
||||||
|
} else if (myActionMap[EDITION_MODE_ID]->isChecked()) {
|
||||||
|
anEnabledAct << REMOVE_ID;
|
||||||
|
anEnabledAct << CLOSE_SECTIONS_ID << UNCLOSE_SECTIONS_ID << SET_SECTIONS_POLYLINE_ID << SET_SECTIONS_SPLINE_ID;
|
||||||
|
int aSectCnt = myCurve->getNbSections();
|
||||||
|
if( aSectCnt > 0 )
|
||||||
|
anEnabledAct << CLEAR_ALL_ID;
|
||||||
|
if( aSectCnt > 1 )
|
||||||
|
anEnabledAct << JOIN_ALL_ID;
|
||||||
|
if( aSelSections.size() > 1 ){
|
||||||
|
anEnabledAct << JOIN_ID;
|
||||||
|
}
|
||||||
|
} else if (myActionMap[DETECTION_MODE_ID]->isChecked()) {
|
||||||
|
} else { //no active mode
|
||||||
}
|
}
|
||||||
anEnabledAct << CLOSE_SECTIONS_ID << UNCLOSE_SECTIONS_ID << SET_SECTIONS_POLYLINE_ID << SET_SECTIONS_SPLINE_ID;
|
/*if( aSelSections[ aSelSections.size() - 1 ] < ( myCurve->getNbSections() - 1 ) ){
|
||||||
|
anEnabledAct << DOWN_ID;
|
||||||
|
}*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CurveCreator_TreeView::ST_POINTS_ONE_SECTION:{
|
/*case CurveCreator_TreeView::ST_POINTS_ONE_SECTION:{
|
||||||
if( aSelPoints[0].second > 0 ){
|
if( aSelPoints[0].second > 0 ){
|
||||||
anEnabledAct << UP_ID;
|
anEnabledAct << UP_ID;
|
||||||
}
|
}
|
||||||
@ -267,15 +280,17 @@ void CurveCreator_Widget::onSelectionChanged()
|
|||||||
anEnabledAct << INSERT_POINT_BEFORE_ID << INSERT_POINT_AFTER_ID;
|
anEnabledAct << INSERT_POINT_BEFORE_ID << INSERT_POINT_AFTER_ID;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
int aSelObjsCnt = aSelPoints.size() + aSelSections.size();
|
/*int aSelObjsCnt = aSelPoints.size() + aSelSections.size();
|
||||||
if( aSelObjsCnt > 0 ){
|
if( aSelObjsCnt > 0 ){
|
||||||
anEnabledAct << REMOVE_ID;
|
anEnabledAct << REMOVE_ID;
|
||||||
}
|
}
|
||||||
if( (myCurve->getNbSections() + myCurve->getNbPoints()) > 0 ){
|
if( (myCurve->getNbSections() + myCurve->getNbPoints()) > 0 ){
|
||||||
anEnabledAct << REMOVE_ALL_ID;
|
anEnabledAct << REMOVE_ALL_ID;
|
||||||
}
|
}*/
|
||||||
if( myCurve->getNbSections() > 1 ){
|
if( myCurve->getNbSections() > 1 ){
|
||||||
anEnabledAct << JOIN_ALL_ID;
|
anEnabledAct << JOIN_ALL_ID;
|
||||||
}
|
}
|
||||||
@ -356,29 +371,30 @@ void CurveCreator_Widget::onDetectPoints(bool checked)
|
|||||||
|
|
||||||
void CurveCreator_Widget::onModeChanged(bool checked)
|
void CurveCreator_Widget::onModeChanged(bool checked)
|
||||||
{
|
{
|
||||||
if (!checked)
|
if (checked) {
|
||||||
return;
|
QAction* anAction = (QAction*)sender();
|
||||||
QAction* anAction = (QAction*)sender();
|
switch(myActionMap.key(anAction)) {
|
||||||
switch(myActionMap.key(anAction)) {
|
case CREATION_MODE_ID:
|
||||||
case CREATION_MODE_ID:
|
if (myActionMap[EDITION_MODE_ID]->isChecked())
|
||||||
if (myActionMap[EDITION_MODE_ID]->isChecked())
|
myActionMap[EDITION_MODE_ID]->trigger();
|
||||||
myActionMap[EDITION_MODE_ID]->trigger();
|
else if (myActionMap[DETECTION_MODE_ID]->isChecked())
|
||||||
else if (myActionMap[DETECTION_MODE_ID]->isChecked())
|
myActionMap[DETECTION_MODE_ID]->trigger();
|
||||||
myActionMap[DETECTION_MODE_ID]->trigger();
|
break;
|
||||||
break;
|
case EDITION_MODE_ID:
|
||||||
case EDITION_MODE_ID:
|
if (myActionMap[CREATION_MODE_ID]->isChecked())
|
||||||
if (myActionMap[CREATION_MODE_ID]->isChecked())
|
myActionMap[CREATION_MODE_ID]->trigger();
|
||||||
myActionMap[CREATION_MODE_ID]->trigger();
|
else if (myActionMap[DETECTION_MODE_ID]->isChecked())
|
||||||
else if (myActionMap[DETECTION_MODE_ID]->isChecked())
|
myActionMap[DETECTION_MODE_ID]->trigger();
|
||||||
myActionMap[DETECTION_MODE_ID]->trigger();
|
break;
|
||||||
break;
|
case DETECTION_MODE_ID:
|
||||||
case DETECTION_MODE_ID:
|
if (myActionMap[CREATION_MODE_ID]->isChecked())
|
||||||
if (myActionMap[CREATION_MODE_ID]->isChecked())
|
myActionMap[CREATION_MODE_ID]->trigger();
|
||||||
myActionMap[CREATION_MODE_ID]->trigger();
|
else if (myActionMap[EDITION_MODE_ID]->isChecked())
|
||||||
else if (myActionMap[EDITION_MODE_ID]->isChecked())
|
myActionMap[EDITION_MODE_ID]->trigger();
|
||||||
myActionMap[EDITION_MODE_ID]->trigger();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
onSelectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurveCreator_Widget::onAddNewPoint()
|
void CurveCreator_Widget::onAddNewPoint()
|
||||||
@ -387,8 +403,8 @@ void CurveCreator_Widget::onAddNewPoint()
|
|||||||
return;
|
return;
|
||||||
CurveCreator::Coordinates aCoords = myNewPointEditor->getCoordinates();
|
CurveCreator::Coordinates aCoords = myNewPointEditor->getCoordinates();
|
||||||
myEdit->insertPoints(aCoords, mySection, myPointNum );
|
myEdit->insertPoints(aCoords, mySection, myPointNum );
|
||||||
// mySectionView->pointsAdded( mySection, myPointNum );
|
mySectionView->pointsAdded( mySection, myPointNum );
|
||||||
// myNewPointEditor->clear();
|
myNewPointEditor->clear();
|
||||||
myPointNum++;
|
myPointNum++;
|
||||||
onSelectionChanged();
|
onSelectionChanged();
|
||||||
updateUndoRedo();
|
updateUndoRedo();
|
||||||
|
Loading…
Reference in New Issue
Block a user