xsi_toolcontext.h Source File
 
 
 
xsi_toolcontext.h
Go to the documentation of this file.
00001 //*****************************************************************************
00011 //*****************************************************************************
00012 
00013 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
00014 #pragma once
00015 #endif
00016 
00017 #ifndef __XSITOOLCONTEXT_H__
00018 #define __XSITOOLCONTEXT_H__
00019 
00020 #include <xsi_context.h>
00021 #include <xsi_line.h>
00022 #include <xsi_plane.h>
00023 #include <xsi_image.h>
00024 #include <xsi_camera.h>
00025 #include <xsi_kinematicstate.h>
00026 #include <xsi_pickbuffer.h>
00027 
00028 namespace XSI {
00029 
00030 //*****************************************************************************
00375 //*****************************************************************************
00376 
00377 class SICPPSDKDECL ToolContext : public Context
00378 {
00379 public:
00381         ToolContext();
00382 
00384         ~ToolContext();
00385 
00389         ToolContext(const CRef& in_ref);
00390 
00394         ToolContext(const ToolContext& in_obj);
00395 
00400         bool IsA( siClassID in_ClassID) const;
00401 
00405         siClassID GetClassID() const;
00406 
00411         ToolContext& operator=(const ToolContext& in_obj);
00412 
00418         ToolContext& operator=(const CRef& in_ref);
00419 
00420         //*****************************************************************************
00424 
00431         CStatus GetMousePosition( LONG &x, LONG &y ) const;
00432 
00435         bool IsLeftButtonDown() const;
00436 
00439         bool IsMiddleButtonDown() const;
00440 
00443         bool IsRightButtonDown() const;
00444 
00447         bool IsDoubleClick() const;
00448 
00451         bool IsShiftKeyDown() const;
00452 
00455         bool IsControlKeyDown() const;
00456 
00465         CStatus RegisterShortcutKey( ULONG in_virtualKeycode, const CString &in_description, ULONG in_modifiers = 0, bool in_repeats = false );
00466 
00473         CStatus UnRegisterShortcutKey( ULONG in_virtualKeycode, ULONG in_modifiers = 0 );
00481         bool IsShortcutKeyDown( ULONG in_virtualKeycode, ULONG in_modifiers = 0 ) const;
00482 
00486         ULONG GetShortcutKey() const;
00487 
00491         ULONG GetShortcutKeyModifiers() const;
00494         //*****************************************************************************
00498 
00505         CStatus GetViewSize( LONG &width, LONG &height ) const;
00506 
00516         CStatus GetViewport( LONG &x, LONG &y, LONG &width, LONG &height ) const;
00517 
00520         bool IsInteracting() const;
00521 
00524         bool IsActiveView() const;
00525 
00528         bool IsNavigating() const;
00529 
00534         LONG GetViewIndex() const;
00535 
00539         Camera GetCamera() const;
00540 
00543         //*****************************************************************************
00547 
00553         CStatus SetCursor( siToolCursor in_cursorId );
00554 
00560         CStatus SetToolDescription( const CString &in_message );
00561 
00567         CStatus EnableSnapping( bool in_enable );
00568 
00574         CStatus GetViewPlane( MATH::CPlane &out_plane ) const;
00575 
00581         CStatus GetGridPlane( MATH::CPlane &out_plane ) const;
00582 
00588         CStatus SetManipulationPlane( const MATH::CPlane &in_plane );
00589 
00594         CStatus ClearManipulationPlane();
00595 
00598         bool WasAborted() const;
00599 
00604         CStatus ExitTool();
00605 
00610         bool GetFlag( LONG in_flag ) const;
00611 
00619         CStatus SetFlag( LONG in_flag, bool in_enable );
00625 
00636         CStatus GetWorldPosition( LONG x, LONG y, MATH::CVector3 &out_world ) const;
00637 
00648         CStatus GetWorldRay( LONG x, LONG y, MATH::CLine &out_ray ) const;
00649 
00659         CStatus WorldToView( const MATH::CVector3 &in_world, MATH::CVector3 &out_view ) const;
00660 
00668         CStatus ViewToWorld( const MATH::CVector3 &in_view, MATH::CVector3 &out_world ) const;
00669 
00677         CStatus WorldToCamera( const MATH::CVector3 &in_world, MATH::CVector3 &out_camera ) const;
00678 
00686         CStatus CameraToWorld( const MATH::CVector3 &in_view, MATH::CVector3 &out_world ) const;
00687 
00693         CStatus GetWorldToViewMatrix( MATH::CMatrix4 &out_worldToView ) const;
00694 
00700         CStatus GetWorldToCameraMatrix( MATH::CMatrix4 &out_worldToCamera ) const;
00706 
00713         CStatus Redraw( bool in_allViews = true );
00714 
00722         CStatus DrawTextString( const CString &in_str, siAlignment in_hPos = siLeftAlign, siAlignment in_vPos = siBottomAlign );
00723 
00732         CStatus GetTextSize( const CString &in_str, LONG &out_width, LONG &out_height, LONG &out_descent ) const;
00733 
00744         CStatus EditTextString( CString &io_str, LONG x, LONG y, LONG width, LONG height );
00745 
00750         CStatus BeginViewDraw();
00751 
00756         CStatus EndViewDraw();
00757 
00760         bool IsViewDraw() const;
00761 
00772         CStatus BeginPickDraw( LONG x, LONG y, LONG width, LONG height);
00773 
00778         CStatus EndPickDraw();
00779 
00782         bool IsPickDraw() const;
00785         //*****************************************************************************
00789 
00797         CStatus BeginParameterUpdate(const Parameter &in_param, double in_time = DBL_MAX);
00798 
00807         CStatus UpdateParameter(const Parameter &in_param, const CValue &in_value);
00808 
00816         CStatus EndParameterUpdate(const Parameter &in_param);
00817 
00826         CStatus BeginKinematicStateUpdate(const KinematicState &in_kine, double in_time = DBL_MAX);
00827 
00836         CStatus UpdateKinematicState(const KinematicState &in_kine, const MATH::CTransformation &in_value);
00837 
00845         CStatus EndKinematicStateUpdate(const KinematicState &in_kine);
00846 
00855         CStatus BeginTransformUpdate(const CRefArray &in_objects, double in_time = DBL_MAX);
00856 
00872         CStatus UpdateTransform(
00873                 const CRefArray &                               in_objects,
00874                 const MATH::CTransformation &   in_value,
00875                 siTransformFilter                               in_srt,
00876                 siRefMode                                               in_refMode              = siLocal,
00877                 siDeltaMode                                             in_delta                = siRelative,
00878                 siAxesFilter                                    in_axesFilter   = siXYZ,
00879                 bool                                                    in_usePivot             = false,
00880                 const MATH::CVector3 &                  in_pivot                = MATH::CVector3(),
00881                 const MATH::CTransformation &   in_reference    = MATH::CTransformation()
00882         );
00883 
00891         CStatus EndTransformUpdate(const CRefArray &in_objects);
00894         //*****************************************************************************
00898 
00904         siSnapType GetSnapType() const;
00905 
00911         CRef GetSnapObject() const;
00912 
00918         CRef GetSnapComponent() const;
00919 
00948         CStatus Snap( LONG x, LONG y, LONG size, ULONG in_snaptype, const CStringArray& in_families, const CRefArray &in_objects, MATH::CVector3 &out_world ) const;
00951         //*****************************************************************************
00955 
01001         CStatus Pick( const CLongArray &in_points, siPickMode in_pickMode, siPickType in_pickType, const CString &in_filter, const CRefArray &in_objects, CRefArray &out_picked ) const;
01002 
01034         PickBuffer GetPickBuffer( LONG x, LONG y, LONG width, LONG height, const CString &in_filter, const CRefArray &in_objects, siViewMode in_viewMode = siShaded ) const;
01037         //*****************************************************************************
01041 
01052         CStatus ShowContextMenu( LONG x, LONG y, siAlignment in_hPos = siLeftAlign, siAlignment in_vPos = siTopAlign );
01055         //*****************************************************************************
01059 
01065         Image LoadImageFromFile( const CString &in_filename, bool in_relativePath = true );
01068 private:
01069         ToolContext * operator&() const;
01070         ToolContext * operator&();
01071 };
01072 
01073 };
01074 #endif // __XSITOOLCONTEXT_H__