aPanel->reset();
- myEditedObject.Nullify();
+ if ( isApplyAndClose() )
+ myEditedObject.Nullify();
QString aSelectedGuideLine, aSelectedProfile;
QString anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_CHANNEL_NAME" ) );
if ( myIsEdit )
{
- myEditedObject =
- Handle(HYDROData_Channel)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ if ( isApplyAndClose() )
+ myEditedObject =
+ Handle(HYDROData_Channel)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
if ( !myEditedObject.IsNull() )
{
anObjectName = myEditedObject->GetName();
}
// collect information about existing profiles
- QStringList aProfiles = HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_PROFILE, true );
+ QStringList aProfiles = HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_PROFILE, false );
aPanel->setObjectName( anObjectName );
if ( !myIsEdit )
{
- myEditedObject->SetFillingColor( getDefaultFillingColor() );
- myEditedObject->SetBorderColor( getDefaultBorderColor() );
+ myEditedObject->SetFillingColor( myEditedObject->DefaultFillingColor() );
+ myEditedObject->SetBorderColor( myEditedObject->DefaultBorderColor() );
}
QString aGuideLineName = aPanel->getGuideLineName();
QString aProfileName = aPanel->getProfileName();
- if ( aGuideLineName.isEmpty() || aProfileName.isEmpty() )
+ /*if ( aGuideLineName.isEmpty() || aProfileName.isEmpty() )
{
myEditedObject->RemoveGuideLine();
myEditedObject->RemoveProfile();
}
- else
+ else*/
{
Handle(HYDROData_Polyline3D) aGuideLine = Handle(HYDROData_Polyline3D)::DownCast(
HYDROGUI_Tool::FindObjectByName( module(), aGuideLineName, KIND_POLYLINE ) );
+ if ( aGuideLine.IsNull() )
+ {
+ theErrorMsg = tr( "GUIDE_LINE_IS_NOT_SELECTED" );
+ return false;
+ }
+
+ myEditedObject->RemoveGuideLine();
myEditedObject->SetGuideLine( aGuideLine );
Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast(
HYDROGUI_Tool::FindObjectByName( module(), aProfileName, KIND_PROFILE ) );
+ if ( aProfile.IsNull() )
+ {
+ theErrorMsg = tr( "PROFILE_IS_NOT_SELECTED" );
+ return false;
+ }
+
+ myEditedObject->RemoveProfile();
myEditedObject->SetProfile( aProfile );
}
- if ( myEditedObject->IsMustBeUpdated() )
+ if ( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d ) )
myEditedObject->Update();
erasePreview();
return Handle(HYDROData_Channel)::DownCast( doc()->CreateObject( KIND_CHANNEL ) );
}
-QColor HYDROGUI_ChannelOp::getDefaultFillingColor() const
-{
- return HYDROData_Channel::DefaultFillingColor();
-}
-
-QColor HYDROGUI_ChannelOp::getDefaultBorderColor() const
-{
- return HYDROData_Channel::DefaultBorderColor();
-}
-
void HYDROGUI_ChannelOp::onCreatePreview()
{
HYDROGUI_ChannelDlg* aPanel = ::qobject_cast<HYDROGUI_ChannelDlg*>( inputPanel() );
{
myPreviewPrs = new HYDROGUI_Shape( aCtx, NULL, getPreviewZLayer() );
- QColor aFillingColor = getDefaultFillingColor();
- QColor aBorderColor = getDefaultBorderColor();
+ QColor aFillingColor = Qt::blue;
+ QColor aBorderColor = Qt::transparent;
if ( !myEditedObject.IsNull() )
{
aFillingColor = myEditedObject->GetFillingColor();