Handle(HYDROData_Profile) aRefProfile = GetProfile();
setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRefProfile, "SetProfile" );
+ aResList << QString( "%1.SetEquiDistance( %2 );" ).arg( aName ).arg( GetEquiDistance() );
+
aResList << QString( "" );
aResList << QString( "%1.Update();" ).arg( aName );
aResList << QString( "" );
bool HYDROData_Channel::CreatePresentations( const Handle(HYDROData_Polyline3D)& theGuideLine,
const Handle(HYDROData_Profile)& theProfile,
- PrsDefinition& thePrs )
+ PrsDefinition& thePrs,
+ double theEquiDistance )
{
// Check input parameters
if ( theGuideLine.IsNull() || theProfile.IsNull() ) {
int aNbPoints = aPolylinePoints.Length();
*/
- double aEqDistance = 1; // TODO: to pass via properties and OCAF
- HYDROData_Polyline3D::Polyline3DPoints aPolylinePoints3D = theGuideLine->GetPoints( aEqDistance );
+ HYDROData_Polyline3D::Polyline3DPoints aPolylinePoints3D = theGuideLine->GetPoints( theEquiDistance );
int aNbPoints = aPolylinePoints3D.Length();
if ( aNbPoints < 2 )
return false;
Handle(HYDROData_Profile) aProfile = GetProfile();
PrsDefinition aResultPrs;
- if ( !CreatePresentations( aGuideLine, aProfile, aResultPrs ) )
+ double anEquiDistance = GetEquiDistance();
+ if ( !CreatePresentations( aGuideLine, aProfile, aResultPrs, anEquiDistance ) )
return;
SetShape3D( aResultPrs.myPrs3D );
HYDROData_SequenceOfObjects aGroups = GetGroups();
return HYDROData_Tool::getFirstShapeFromGroup( aGroups, 2);
}
+
+void HYDROData_Channel::SetEquiDistance( double theEquiDistance )
+{
+ double anEquiDistance = theEquiDistance > 0 ? theEquiDistance : 1E-3;
+ SetDouble( DataTag_EquiDistance, theEquiDistance );
+}
+
+double HYDROData_Channel::GetEquiDistance() const
+{
+ return GetDouble( DataTag_EquiDistance, 1.0 );
+}
DataTag_First = HYDROData_ArtificialObject::DataTag_First + 100, ///< first tag, to reserve
DataTag_GuideLine,
DataTag_Profile,
+ DataTag_EquiDistance,
};
public:
*/
HYDRODATA_EXPORT static bool CreatePresentations( const Handle(HYDROData_Polyline3D)& theGuideLine,
const Handle(HYDROData_Profile)& theProfile,
- PrsDefinition& thePrs );
+ PrsDefinition& thePrs,
+ double theEquiDistance );
public:
*/
HYDRODATA_EXPORT virtual void RemoveProfile();
+ HYDRODATA_EXPORT void SetEquiDistance( double );
+ HYDRODATA_EXPORT double GetEquiDistance() const;
protected:
/**
#include <TDataStd_Integer.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TDataStd_ReferenceList.hxx>
+#include <TDataStd_Real.hxx>
#include <TDF_CopyLabel.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
#include <TNaming_Builder.hxx>
}
return TopoDS_Shape();
}
+
+void HYDROData_Entity::SetDouble( int theTag, double theValue )
+{
+ Handle(TDataStd_Real) anAttr;
+ TDF_Label aLabel = myLab.FindChild( theTag );
+ if( !aLabel.FindAttribute( TDataStd_Real::GetID(), anAttr ) )
+ aLabel.AddAttribute( anAttr = new TDataStd_Real() );
+ anAttr->Set( theValue );
+}
+
+double HYDROData_Entity::GetDouble( int theTag, double theDefValue ) const
+{
+ Handle(TDataStd_Real) anAttr;
+ TDF_Label aLabel = myLab.FindChild( theTag );
+ if( !aLabel.FindAttribute( TDataStd_Real::GetID(), anAttr ) )
+ return theDefValue;
+
+ return anAttr->Get();
+}
void SetShape( int theTag, const TopoDS_Shape& theShape );
TopoDS_Shape GetShape( int theTag ) const;
+ void SetDouble( int theTag, double theValue );
+ double GetDouble( int theTag, double theDefValue = 0.0 ) const;
+
int GetGeomChangeFlag() const;
protected:
#include <TopExp_Explorer.hxx>
#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <TopExp.hxx>
-#include <TDataStd_Real.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeFix_Shape.hxx>
void HYDROData_LandCoverMap::SetTransparency( double theTransparency )
{
- Handle(TDataStd_Real) anAttr;
- TDF_Label aLabel = myLab.FindChild( DataTag_Transparency );
- if( !aLabel.FindAttribute( TDataStd_Real::GetID(), anAttr ) )
- aLabel.AddAttribute( anAttr = new TDataStd_Real() );
- anAttr->Set( theTransparency );
+ SetDouble( DataTag_Transparency, theTransparency );
}
double HYDROData_LandCoverMap::GetTransparency() const
{
- Handle(TDataStd_Real) anAttr;
- TDF_Label aLabel = myLab.FindChild( DataTag_Transparency );
- if( !aLabel.FindAttribute( TDataStd_Real::GetID(), anAttr ) )
- return 0.5;
-
- return anAttr->Get();
-
+ return GetDouble( DataTag_Transparency, 0.5 );
}
bool HYDROData_LandCoverMap::ImportSHP( const QString& theSHPFileName,
#include <QLabel>
#include <QLayout>
#include <QLineEdit>
+#include <QtxDoubleSpinBox.h>
HYDROGUI_ChannelDlg::HYDROGUI_ChannelDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle )
myProfiles = new QComboBox( aParamGroup );
myProfiles->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myEquiDistance = new QtxDoubleSpinBox( aParamGroup );
+ myEquiDistance->setRange( 0.01, 100 );
+ myEquiDistance->setValue( 1.0 );
+ myEquiDistance->setSingleStep( 1.0 );
+
QGridLayout* aParamsLayout = new QGridLayout( aParamGroup );
aParamsLayout->setMargin( 5 );
aParamsLayout->setSpacing( 5 );
aParamsLayout->addWidget( myGuideLines, 0, 1 );
aParamsLayout->addWidget( new QLabel( tr( "CHANNEL_PROFILE" ), aParamGroup ), 1, 0 );
aParamsLayout->addWidget( myProfiles, 1, 1 );
+ aParamsLayout->addWidget( new QLabel( tr( "EQUI_DISTANCE" ), aParamGroup ), 2, 0 );
+ aParamsLayout->addWidget( myEquiDistance, 2, 1 );
// Common
addWidget( myObjectNameGroup );
emit CreatePreview();
}
+
+double HYDROGUI_ChannelDlg::getEquiDistance() const
+{
+ return myEquiDistance->value();
+}
+
+void HYDROGUI_ChannelDlg::setEquiDistance( double theValue )
+{
+ myEquiDistance->setValue( theValue );
+}
class QComboBox;
class QGroupBox;
class QLineEdit;
+class QtxDoubleSpinBox;
class HYDROGUI_ChannelDlg : public HYDROGUI_InputPanel
{
void setProfileName( const QString& theProfile );
QString getProfileName() const;
+ double getEquiDistance() const;
+ void setEquiDistance( double );
+
signals:
void CreatePreview();
QComboBox* myGuideLines;
QComboBox* myProfiles;
+
+ QtxDoubleSpinBox* myEquiDistance;
};
#endif
aPanel->setGuideLineName( aSelectedGuideLine );
aPanel->setProfileName( aSelectedProfile );
+ if( !myEditedObject.IsNull() )
+ aPanel->setEquiDistance( myEditedObject->GetEquiDistance() );
+ else
+ aPanel->setEquiDistance( 1.0 );
+
aPanel->blockSignals( false );
onCreatePreview();
myEditedObject->RemoveProfile();
myEditedObject->SetProfile( aProfile );
+ myEditedObject->SetEquiDistance( aPanel->getEquiDistance() );
}
if ( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d ) )
HYDROGUI_Tool::FindObjectByName( module(), aProfileName, KIND_PROFILE ) );
HYDROData_Channel::PrsDefinition aPrsDef;
- if ( !HYDROData_Channel::CreatePresentations( aGuideLine, aProfile, aPrsDef ) )
+ if ( !HYDROData_Channel::CreatePresentations( aGuideLine, aProfile, aPrsDef, aPanel->getEquiDistance() ) )
{
erasePreview();
return;
<source>CHANNEL_PROFILE</source>
<translation>Profile</translation>
</message>
+ <message>
+ <source>EQUI_DISTANCE</source>
+ <translation>Equidistance</translation>
+ </message>
</context>
<context>
*/
void RemoveProfile();
-
+ void SetEquiDistance( double );
+ double GetEquiDistance() const;
+
protected:
/**