X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMToolsGUI%2FGEOMToolsGUI_MarkerDlg.cxx;h=f0426ddd7a7d9d2d8f1b87f666200c6267e31de6;hb=e067674b75266d9f67a2c474d8dc901d9f65fe48;hp=10c67dd92f2a5fd62a688a2cde85446b0a8fe436;hpb=1405980f7eb1ae349f5fdc23d2627ff25d2f2685;p=modules%2Fgeom.git diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx index 10c67dd92..f0426ddd7 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_MarkerDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -169,11 +169,7 @@ void GEOMToolsGUI_MarkerDlg::setStandardMarker( GEOM::marker_type type, GEOM::ma myTypeGroup->button( 0 )->setChecked( true ); myWGStack->setCurrentIndex( 0 ); myStdTypeCombo->setCurrentId( (int)type ); -#ifdef WIN32 - int asize = max( (int)GEOM::MS_10, min( (int)GEOM::MS_70, (int)size ) ); -#else int asize = std::max( (int)GEOM::MS_10, std::min( (int)GEOM::MS_70, (int)size ) ); -#endif myStdScaleCombo->setCurrentId( asize ); } } @@ -220,19 +216,21 @@ void GEOMToolsGUI_MarkerDlg::accept() _PTR(SObject) aSObject( study->FindObjectID( it.Value()->getEntry() ) ); GEOM::GEOM_Object_var anObject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) ); - if ( !anObject->_is_nil() && GeometryGUI::IsInGeomComponent( aSObject )) { - if ( myWGStack->currentIndex() == 0 ) { + if ( myWGStack->currentIndex() == 0 ) { + if ( !anObject->_is_nil() && GeometryGUI::IsInGeomComponent( aSObject )) { anObject->SetMarkerStd( getMarkerType(), getStandardMarkerScale() ); - QString aMarker = "%1%2%3"; - aMarker = aMarker.arg(getMarkerType()); - aMarker = aMarker.arg(GEOM::subSectionSeparator()); - aMarker = aMarker.arg(getStandardMarkerScale()); - getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),GEOM::propertyName( GEOM::PointMarker ), aMarker); } - else if ( getCustomMarkerID() > 0 ) { + QString aMarker = "%1%2%3"; + aMarker = aMarker.arg(getMarkerType()); + aMarker = aMarker.arg(GEOM::subSectionSeparator()); + aMarker = aMarker.arg(getStandardMarkerScale()); + getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),GEOM::propertyName( GEOM::PointMarker ), aMarker); + } + else if ( getCustomMarkerID() > 0 ) { + if ( !anObject->_is_nil() && GeometryGUI::IsInGeomComponent( aSObject )) { anObject->SetMarkerTexture( getCustomMarkerID() ); - getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),GEOM::propertyName( GEOM::PointMarker ), QString::number(getCustomMarkerID())); } + getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),GEOM::propertyName( GEOM::PointMarker ), QString::number(getCustomMarkerID())); } } GEOM_Displayer displayer; @@ -298,6 +296,7 @@ void GEOMToolsGUI_MarkerDlg::init() GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( aSObject ) ); if ( !anObject->_is_nil() && GeometryGUI::IsInGeomComponent( aSObject )) { GEOM::marker_type mtype = anObject->GetMarkerType(); + if ( aType == -1 ) aType = mtype; else if ( aType != mtype ) { @@ -319,6 +318,47 @@ void GEOMToolsGUI_MarkerDlg::init() break; } } + else { + // try study object properties + QStringList aMarkerProp; + SUIT_ViewWindow* window = getStudy()->application()->desktop()->activeWindow(); + if (window && window->getViewManager()) { + int mgrId = window->getViewManager()->getGlobalId(); + PropMap aPropMap = getStudy()->getObjectProperties(mgrId, it.Value()->getEntry()); + aMarkerProp = aPropMap.value(GEOM::propertyName(GEOM::PointMarker)).toString().split( GEOM::subSectionSeparator()); + } + if ( aMarkerProp.size() == 2 ) { + // standard marker string contains "TypeOfMarker:ScaleOfMarker" + GEOM::marker_type mtype = (GEOM::marker_type)aMarkerProp[0].toInt(); + GEOM::marker_size msize = (GEOM::marker_size)aMarkerProp[1].toInt(); + + if ( aType == -1 ) + aType = mtype; + else if ( aType != mtype ) { + aType = (GEOM::marker_type)-1; + break; + } + if ( aSize == -1 ) + aSize = msize; + else if ( aSize != msize ) + break; + } + else if ( aMarkerProp.size() == 1 ) { + // custom marker string contains "IdOfTexture" + int mtexture = aMarkerProp[0].toInt(); + + if ( aType == -1 ) + aType = GEOM::MT_USER; + else if ( aType != GEOM::MT_USER) { + aType = (GEOM::marker_type)-1; + break; + } + if ( aTexture == 0 ) + aTexture = mtexture; + else if ( aTexture != mtexture ) + break; + } + } } } }