HYDROGUI_PrsImage.h
HYDROGUI_PrsImageDriver.h
HYDROGUI_PrsImageFrame.h
+ HYDROGUI_PrsPolyline.h
+ HYDROGUI_PrsPolylineDriver.h
HYDROGUI_ShowHideOp.h
HYDROGUI_Tool.h
HYDROGUI_TwoImagesDlg.h
HYDROGUI_PrsImage.cxx
HYDROGUI_PrsImageDriver.cxx
HYDROGUI_PrsImageFrame.cxx
+ HYDROGUI_PrsPolyline.cxx
+ HYDROGUI_PrsPolylineDriver.cxx
HYDROGUI_ShowHideOp.cxx
HYDROGUI_Tool.cxx
HYDROGUI_TwoImagesDlg.cxx
#include "HYDROGUI_Module.h"
#include "HYDROGUI_Prs.h"
#include "HYDROGUI_PrsImageDriver.h"
+#include "HYDROGUI_PrsPolylineDriver.h"
#include "HYDROGUI_Tool.h"
#include <GraphicsView_Viewer.h>
aDriver = new HYDROGUI_PrsImageDriver();
myPrsDriversMap[ aKind ] = aDriver;
break;
+ case KIND_POLYLINE:
+ aDriver = new HYDROGUI_PrsPolylineDriver();
+ myPrsDriversMap[ aKind ] = aDriver;
+ break;
default:
break;
}
#include "HYDROGUI_Prs.h"
+#include <GraphicsView_ViewPort.h>
+
+#include <QCursor>
+
//=======================================================================
// name : HYDROGUI_Prs
// Purpose : Constructor
myObject( theObject ),
myIsToUpdate( false )
{
+ myHighlightCursor = new QCursor( Qt::PointingHandCursor );
}
//=======================================================================
//=======================================================================
HYDROGUI_Prs::~HYDROGUI_Prs()
{
+ if( myHighlightCursor )
+ {
+ delete myHighlightCursor;
+ myHighlightCursor = 0;
+ }
+}
+
+//================================================================
+// Function : addTo
+// Purpose :
+//================================================================
+void HYDROGUI_Prs::addTo( GraphicsView_ViewPort* theViewPort )
+{
+ GraphicsView_Object::addTo( theViewPort );
+
+ double aZValue = 0;
+ GraphicsView_ObjectListIterator anIter( theViewPort->getObjects() );
+ while( anIter.hasNext() )
+ {
+ if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
+ {
+ double aZValueRef = aPrs->zValue();
+ aZValue = qMax( aZValue, aZValueRef );
+ }
+ }
+ setZValue( aZValue + 1 );
}
bool getIsToUpdate() const { return myIsToUpdate; }
void setIsToUpdate( bool theState ) { myIsToUpdate = theState; }
+public:
+ // from GraphicsView_Object
+ virtual void addTo( GraphicsView_ViewPort* theViewPort );
+
+protected:
+ QCursor* getHighlightCursor() const { return myHighlightCursor; }
+
private:
Handle(HYDROData_Object) myObject;
bool myIsToUpdate;
+
+private:
+ QCursor* myHighlightCursor;
};
#endif
myIsTransformationPointPreview( false ),
myTransformationPointMode( None )
{
- myHighlightCursor = new QCursor( Qt::PointingHandCursor );
myTransformationPointCursor = new QCursor( Qt::CrossCursor );
}
//=======================================================================
HYDROGUI_PrsImage::~HYDROGUI_PrsImage()
{
- if( myHighlightCursor )
- {
- delete myHighlightCursor;
- myHighlightCursor = 0;
- }
-
if( myTransformationPointCursor )
{
delete myTransformationPointCursor;
//================================================================
void HYDROGUI_PrsImage::addTo( GraphicsView_ViewPort* theViewPort )
{
- GraphicsView_Object::addTo( theViewPort );
+ HYDROGUI_Prs::addTo( theViewPort );
theViewPort->addItem( myPrsImageFrame );
-
- double aZValue = 0;
- GraphicsView_ObjectListIterator anIter( theViewPort->getObjects() );
- while( anIter.hasNext() )
- {
- if( HYDROGUI_PrsImage* aPrs = dynamic_cast<HYDROGUI_PrsImage*>( anIter.next() ) )
- {
- double aZValueRef = aPrs->zValue();
- aZValue = qMax( aZValue, aZValueRef );
- }
- }
- setZValue( aZValue + 1 );
}
//================================================================
//================================================================
void HYDROGUI_PrsImage::removeFrom( GraphicsView_ViewPort* theViewPort )
{
- GraphicsView_Object::removeFrom( theViewPort );
+ HYDROGUI_Prs::removeFrom( theViewPort );
theViewPort->removeItem( myPrsImageFrame );
}
return true;
}
- bool anIsSelected = GraphicsView_Object::select( theX, theY, theRect );
+ bool anIsSelected = HYDROGUI_Prs::select( theX, theY, theRect );
myPrsImageFrame->updateVisibility();
return anIsSelected;
}
//================================================================
void HYDROGUI_PrsImage::unselect()
{
- GraphicsView_Object::unselect();
+ HYDROGUI_Prs::unselect();
myPrsImageFrame->updateVisibility();
}
//================================================================
void HYDROGUI_PrsImage::setSelected( bool theState )
{
- GraphicsView_Object::setSelected( theState );
+ HYDROGUI_Prs::setSelected( theState );
myPrsImageFrame->updateVisibility();
}
void computeTransformationPoints();
protected:
- QCursor* getHighlightCursor() const { return myHighlightCursor; }
QCursor* getTransformationPointCursor() const { return myTransformationPointCursor; }
protected:
TransformationPointMap myTransformationPointMap;
private:
- QCursor* myHighlightCursor;
QCursor* myTransformationPointCursor;
};
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROGUI_PrsPolyline.h"
+
+//=======================================================================
+// name : HYDROGUI_PrsPolyline
+// Purpose : Constructor
+//=======================================================================
+HYDROGUI_PrsPolyline::HYDROGUI_PrsPolyline( const Handle(HYDROData_Object)& theObject )
+: HYDROGUI_Prs( theObject ),
+ myPolylineItem( 0 )
+{
+}
+
+//=======================================================================
+// name : HYDROGUI_PrsPolyline
+// Purpose : Destructor
+//=======================================================================
+HYDROGUI_PrsPolyline::~HYDROGUI_PrsPolyline()
+{
+}
+
+//================================================================
+// Function : setPath
+// Purpose :
+//================================================================
+void HYDROGUI_PrsPolyline::setPath( const QPainterPath& thePath )
+{
+ myPath = thePath;
+}
+
+//================================================================
+// Function : getPath
+// Purpose :
+//================================================================
+QPainterPath HYDROGUI_PrsPolyline::getPath() const
+{
+ return myPath;
+}
+
+//================================================================
+// Function : boundingRect
+// Purpose :
+//================================================================
+QRectF HYDROGUI_PrsPolyline::boundingRect() const
+{
+ return myPolylineItem->boundingRect();
+}
+
+//================================================================
+// Function : compute
+// Purpose :
+//================================================================
+void HYDROGUI_PrsPolyline::compute()
+{
+ if( !myPolylineItem )
+ {
+ myPolylineItem = new QGraphicsPathItem( this );
+ addToGroup( myPolylineItem );
+ }
+ myPolylineItem->setPath( myPath );
+}
+
+//================================================================
+// Function : checkHighlight
+// Purpose :
+//================================================================
+bool HYDROGUI_PrsPolyline::checkHighlight( double theX, double theY, QCursor& theCursor ) const
+{
+ // to do
+ return false;
+}
+
+//================================================================
+// Function : select
+// Purpose :
+//================================================================
+bool HYDROGUI_PrsPolyline::select( double theX, double theY, const QRectF& theRect )
+{
+ return GraphicsView_Object::select( theX, theY, theRect );
+}
+
+//================================================================
+// Function : unselect
+// Purpose :
+//================================================================
+void HYDROGUI_PrsPolyline::unselect()
+{
+ GraphicsView_Object::unselect();
+}
+
+//================================================================
+// Function : setSelected
+// Purpose :
+//================================================================
+void HYDROGUI_PrsPolyline::setSelected( bool theState )
+{
+ GraphicsView_Object::setSelected( theState );
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_PRSPOLYLINE_H
+#define HYDROGUI_PRSPOLYLINE_H
+
+#include "HYDROGUI_Prs.h"
+
+/*
+ Class : HYDROGUI_PrsPolyline
+ Description : Presentation for polyline object
+*/
+class HYDROGUI_PrsPolyline : public HYDROGUI_Prs
+{
+public:
+ HYDROGUI_PrsPolyline( const Handle(HYDROData_Object)& theObject );
+ virtual ~HYDROGUI_PrsPolyline();
+
+public:
+ void setPath( const QPainterPath& thePath );
+ QPainterPath getPath() const;
+
+public:
+ // from QGraphicsItem
+ virtual QRectF boundingRect() const;
+
+ // from GraphicsView_Object
+ virtual void compute();
+
+ virtual bool isMovable() const { return false; }
+
+ virtual bool checkHighlight( double theX, double theY, QCursor& theCursor ) const;
+
+ virtual bool select( double theX, double theY, const QRectF& theRect );
+ virtual void unselect();
+ virtual void setSelected( bool theState );
+
+protected:
+ QGraphicsPathItem* myPolylineItem;
+
+ QPainterPath myPath;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROGUI_PrsPolylineDriver.h"
+
+#include "HYDROGUI_PrsPolyline.h"
+
+#include <HYDROData_Polyline.h>
+
+HYDROGUI_PrsPolylineDriver::HYDROGUI_PrsPolylineDriver()
+:HYDROGUI_PrsDriver()
+{
+}
+
+HYDROGUI_PrsPolylineDriver::~HYDROGUI_PrsPolylineDriver()
+{
+}
+
+bool HYDROGUI_PrsPolylineDriver::Update( const Handle(HYDROData_Object)& theObj,
+ HYDROGUI_Prs*& thePrs )
+{
+ HYDROGUI_PrsDriver::Update( theObj, thePrs );
+
+ if( theObj.IsNull() )
+ return false;
+
+ Handle(HYDROData_Polyline) aPolyline = Handle(HYDROData_Polyline)::DownCast( theObj );
+ if( aPolyline.IsNull() )
+ return false;
+
+ if( !thePrs )
+ thePrs = new HYDROGUI_PrsPolyline( theObj );
+
+ HYDROGUI_PrsPolyline* aPrsPolyline = (HYDROGUI_PrsPolyline*)thePrs;
+
+ aPrsPolyline->setName( aPolyline->GetName() );
+ aPrsPolyline->setPath( aPolyline->painterPathLinear() );
+
+ aPrsPolyline->compute();
+
+ return true;
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_PRSPOLYLINEDRIVER_H
+#define HYDROGUI_PRSPOLYLINEDRIVER_H
+
+#include <HYDROGUI_PrsDriver.h>
+
+/**
+ * \class HYDROGUI_PrsPolylineDriver
+ * \brief Presentation driver for polyline objects.
+ */
+class HYDROGUI_PrsPolylineDriver : public HYDROGUI_PrsDriver
+{
+public:
+ /**
+ * \brief Constructor.
+ */
+ HYDROGUI_PrsPolylineDriver();
+
+ /**
+ * \brief Destructor.
+ */
+ virtual ~HYDROGUI_PrsPolylineDriver();
+
+public:
+ /**
+ * \brief Update or create the polyline presentation on a basis of data object.
+ * \param theObj data object
+ * \param thePrs presentation
+ * \return status of the operation
+ */
+ virtual bool Update( const Handle(HYDROData_Object)& theObj,
+ HYDROGUI_Prs*& thePrs );
+};
+
+#endif