myDoc->SetUndoLimit(UNDO_LIMIT);
NewID(); // needed to have at least one attribute in initial document to avoid errors
myTransactionsAfterSave = 0;
+ myLX = -1;
+ myLY = -1;
}
HYDROData_Document::HYDROData_Document(const Handle(TDocStd_Document)& theDoc)
{
myDoc = theDoc;
myTransactionsAfterSave = 0;
+ myLX = -1;
+ myLY = -1;
}
HYDROData_Document::~HYDROData_Document()
gp_Pnt aLocalCS3d( theLocalCS.X(), theLocalCS.Y(), 0 );
aLocalCS->SetPosition( aLocalCS3d );
+ myLX = theLocalCS.X();
+ myLY = theLocalCS.Y();
}
+
+void HYDROData_Document::Transform( gp_Pnt& thePnt, bool IsToLocalCS ) const
+{
+ if( myLX < 0 || myLY < 0 )
+ {
+ gp_Pnt2d aLCS = GetLocalCS();
+ HYDROData_Document* aThat = const_cast<HYDROData_Document*>( this );
+ aThat->myLX = aLCS.X();
+ aThat->myLY = aLCS.Y();
+ }
+ double X = IsToLocalCS ? thePnt.X() - myLX : thePnt.X() + myLX;
+ double Y = IsToLocalCS ? thePnt.Y() - myLY : thePnt.Y() + myLY;
+ double Z = thePnt.Z();
+ thePnt = gp_Pnt( X, Y, Z );
+}
+
class QFile;
class gp_Pnt2d;
+class gp_Pnt;
/**
* Errors that could appear on document open/save actions.
HYDRODATA_EXPORT gp_Pnt2d GetLocalCS() const;
HYDRODATA_EXPORT void SetLocalCS( const gp_Pnt2d& );
+ HYDRODATA_EXPORT void Transform( gp_Pnt& thePnt, bool IsToLocalCS ) const;
public:
private:
Handle(TDocStd_Document) myDoc; ///< OCAF document instance corresponding for keeping all persistent data
int myTransactionsAfterSave; ///< number of transactions after the last "save" call, used for "IsModified" method
+ double myLX, myLY;
};
#endif
void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* )
{
- double aX, aY, aZ;
+ double X, Y, Z;
bool doShow = false;
HYDROGUI_Displayer* aDisplayer = getDisplayer();
if ( aDisplayer )
aDisplayer->SaveCursorViewPosition( theViewWindow );
- doShow = aDisplayer->GetCursorViewCoordinates( theViewWindow, aX, aY, aZ );
+ doShow = aDisplayer->GetCursorViewCoordinates( theViewWindow, X, Y, Z );
if ( doShow )
{
// Show the coordinates in the status bar
SUIT_Desktop* aDesktop = getApp()->desktop();
- if ( aDesktop && aDesktop->statusBar() ) {
- QString aXStr = HYDROGUI_Tool::GetCoordinateString( aX );
- QString anYStr = HYDROGUI_Tool::GetCoordinateString( aY );
- aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aXStr ).arg( anYStr ) );
+ if ( aDesktop && aDesktop->statusBar() )
+ {
+ gp_Pnt aWPnt( X, Y, Z );
+ int aStudyId = application()->activeStudy()->id();
+ HYDROData_Document::Document( aStudyId )->Transform( aWPnt, false );
+ double WX = aWPnt.X(), WY = aWPnt.Y();
+
+ QString aXStr = HYDROGUI_Tool::GetCoordinateString( X );
+ QString anYStr = HYDROGUI_Tool::GetCoordinateString( Y );
+ QString aWXStr = HYDROGUI_Tool::GetCoordinateString( WX );
+ QString aWYStr = HYDROGUI_Tool::GetCoordinateString( WY );
+ QString aMsg = tr( "COORDINATES_INFO" );
+ aMsg = aMsg.arg( aXStr ).arg( anYStr ).arg( aWXStr ).arg( aWYStr );
+ aDesktop->statusBar()->showMessage( aMsg );
}
}
}
gp_Pnt aPnt3( aRect.bottomRight().x(), aRect.bottomRight().y(), 0 );
gp_Pnt aPnt4( aRect.bottomLeft().x(), aRect.bottomLeft().y(), 0 );
+ Handle_HYDROData_Document aDoc = HYDROData_Document::Document( anImageObj->Label() );
+ aDoc->Transform( aPnt1, true );
+ aDoc->Transform( aPnt2, true );
+ aDoc->Transform( aPnt3, true );
+ aDoc->Transform( aPnt4, true );
+
TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge( aPnt1, aPnt2 ).Edge();
TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge( aPnt2, aPnt3 ).Edge();
TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge( aPnt3, aPnt4 ).Edge();
</message>
<message>
<source>COORDINATES_INFO</source>
- <translation>X: %1, Y: %2</translation>
+ <translation>
+X: %1, Y: %2
+WX: %3, WY: %4
+ </translation>
</message>
<message>
<source>POLYLINE3D_POLYLINE</source>