#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewWindow.h>
-
+#include <gp_Ax1.hxx>
+#include <gp_Ax2.hxx>
+#include <gp_Ax3.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pln.hxx>
+#include <gp.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
HYDROGUI_StreamOp::HYDROGUI_StreamOp( HYDROGUI_Module* theModule, bool theIsEdit )
: HYDROGUI_Operation( theModule ),
myIsEdit( theIsEdit ),
}
// Check that there are no other objects with the same name in the document
- if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anObjectName ) )
+ if( myEditedObject->GetName() != anObjectName )
{
Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName );
if( !anObject.IsNull() ) {
HYDROData_SequenceOfObjects aVerifiedProfiles;
HYDROData_SequenceOfObjects aSelectedProfiles = HYDROGUI_Tool::GetSelectedObjects( module() );
+ gp_Ax2 aX2(gp::XOY());
+ gp_Ax3 aX3(aX2);
+ gp_Pln aPln(aX3);
+ BRepBuilderAPI_MakeFace aMkr(aPln);
+ if(!aMkr.IsDone()) return;
+ const TopoDS_Face& aPlane = TopoDS::Face(aMkr.Shape());
+ Standard_Real aPar(.0);
for( int i = 1, n = aSelectedProfiles.Length(); i <= n; i++ ) {
Handle(HYDROData_Profile) aProfile =
Handle(HYDROData_Profile)::DownCast( aSelectedProfiles.Value( i ) );
anInvalidProfiles << aProfileName;
} else if ( aCurrentProfiles.contains( aProfileName ) ) { // check whether the profile is already added
anExistingProfiles << aProfileName;
- } else if ( !myEditedObject->HasIntersection( aProfile ) ) { // check whether the profile has intersection
+ } else if ( !myEditedObject->HasIntersection( aProfile, aPlane, aPar ) ) { // check whether the profile has intersection
aHasNoIntersectionProfiles << aProfileName;
} else {
aVerifiedProfiles.Append( aProfile );
}
// Show message box with the ignored profiles
- if ( aVerifiedProfiles.Length() < aSelectedProfiles.Length() ) {
+ if ( !anInvalidProfiles.isEmpty() || !anExistingProfiles.isEmpty() ||
+ !aHasNoIntersectionProfiles.isEmpty() ) {
QString aMessage = tr( "IGNORED_PROFILES" );
if ( !anInvalidProfiles.isEmpty() ) {
aMessage.append( "\n\n" );