#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_MaterialAspect.hxx>
-#include <HYDROData_Domain.h>
+#include <HYDROData_Document.h>
#include <HYDROData_Image.h>
+#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Polyline.h>
+#include <HYDROData_Region.h>
+#include <HYDROData_Zone.h>
+#include <TopoDS.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <QFile>
HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
- const Handle(HYDROData_Object)& theObject )
+ const Handle(HYDROData_Entity)& theObject )
: myContext( theContext ),
myObject( theObject ),
myIsHighlight( false ),
// Try to retrieve information from object
if ( !myObject.IsNull() )
{
- if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Domain) ) )
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myObject->Label() );
+
+ if ( myObject->IsKind( STANDARD_TYPE(HYDROData_ImmersibleZone) ) )
{
- Handle(HYDROData_Domain) aDomainObj =
- Handle(HYDROData_Domain)::DownCast( myObject );
+ Handle(HYDROData_ImmersibleZone) aZoneObj =
+ Handle(HYDROData_ImmersibleZone)::DownCast( myObject );
- QColor aFillingColor = aDomainObj->GetFillingColor();
- QColor aBorderColor = aDomainObj->GetBorderColor();
- TopoDS_Face aDomainFace = aDomainObj->Face();
+ QColor aFillingColor = aZoneObj->GetFillingColor();
+ QColor aBorderColor = aZoneObj->GetBorderColor();
+ TopoDS_Face aZoneFace = TopoDS::Face( aZoneObj->GetTopShape() );
setFillingColor( aFillingColor, false, false );
setBorderColor( aBorderColor, false, false );
- setFace( aDomainFace, false, false );
+ setFace( aZoneFace, false, false );
}
else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Polyline) ) )
{
Handle(HYDROData_Polyline) aPolyline =
Handle(HYDROData_Polyline)::DownCast( myObject );
- TopoDS_Wire aPolylineWire = aPolyline->Wire();
+ TopoDS_Wire aPolylineWire = TopoDS::Wire( aPolyline->GetTopShape() );
setWire( aPolylineWire, false, false );
}
+ else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Region) ) )
+ {
+ Handle(HYDROData_Region) aRegion =
+ Handle(HYDROData_Region)::DownCast( myObject );
+ }
+ else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Zone) ) )
+ {
+ Handle(HYDROData_Zone) aZone =
+ Handle(HYDROData_Zone)::DownCast( myObject );
+
+ TopoDS_Face aZoneFace = TopoDS::Face( aZone->GetShape() );
+
+ // Generate the filling color for zone
+ QStringList aGeomObjectsNames;
+
+ HYDROData_SequenceOfObjects aRefObjects = aZone->GetGeometryObjects();
+ HYDROData_SequenceOfObjects::Iterator anIter( aRefObjects );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Object) aRefbject =
+ Handle(HYDROData_Object)::DownCast( anIter.Value() );
+ if ( aRefbject.IsNull() )
+ continue;
+
+ QString aRefObjectName = aRefbject->GetName();
+ if ( aRefObjectName.isEmpty() )
+ continue;
+
+ aGeomObjectsNames.append( aRefObjectName );
+ }
+
+ setFace( aZoneFace, false, false );
+ setFillingColor( HYDROGUI_Tool::GenerateFillingColor( aDocument, aGeomObjectsNames ) );
+ }
else if ( myObject->IsKind( STANDARD_TYPE(HYDROData_Image) ) )
{
Handle(HYDROData_Image) anImageObj =
int aWidth = anImage.width();
int aHeight = anImage.height();
- anImage = anImage.transformed( aTrsf, Qt::SmoothTransformation );
+ QTransform anInversion = QTransform::fromScale( -1, -1 );
+ anImage = anImage.transformed( anInversion * aTrsf, Qt::SmoothTransformation );
// temporary optimization, to reduce the saved image size (and the texture quality)
QImage anImageToSave = reduceTexture( anImage, 500 );
}
}
-QString HYDROGUI_Shape::generateTextureFileName( const Handle(HYDROData_Object)& theImageObj )
+QString HYDROGUI_Shape::generateTextureFileName( const Handle(HYDROData_Entity)& theImageObj )
{
QString aResult;
if( !theImageObj.IsNull() )