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 
00770     CStatus BeginPickDraw( LONG x, LONG y, LONG width, LONG height);
00771 
00776     CStatus EndPickDraw();
00777 
00780     bool IsPickDraw() const;
00783     //*****************************************************************************
00787 
00795     CStatus BeginParameterUpdate(const Parameter &in_param, double in_time = DBL_MAX);
00796 
00805     CStatus UpdateParameter(const Parameter &in_param, const CValue &in_value);
00806 
00814     CStatus EndParameterUpdate(const Parameter &in_param);
00815 
00824     CStatus BeginKinematicStateUpdate(const KinematicState &in_kine, double in_time = DBL_MAX);
00825 
00834     CStatus UpdateKinematicState(const KinematicState &in_kine, const MATH::CTransformation &in_value);
00835 
00843     CStatus EndKinematicStateUpdate(const KinematicState &in_kine);
00844 
00853     CStatus BeginTransformUpdate(const CRefArray &in_objects, double in_time = DBL_MAX);
00854 
00870     CStatus UpdateTransform(
00871         const CRefArray &               in_objects,
00872         const MATH::CTransformation &   in_value,
00873         siTransformFilter               in_srt,
00874         siRefMode                       in_refMode      = siLocal,
00875         siDeltaMode                     in_delta        = siRelative,
00876         siAxesFilter                    in_axesFilter   = siXYZ,
00877         bool                            in_usePivot     = false,
00878         const MATH::CVector3 &          in_pivot        = MATH::CVector3(),
00879         const MATH::CTransformation &   in_reference    = MATH::CTransformation()
00880     );
00881 
00889     CStatus EndTransformUpdate(const CRefArray &in_objects);
00892     //*****************************************************************************
00896 
00902     siSnapType GetSnapType() const;
00903 
00909     CRef GetSnapObject() const;
00910 
00916     CRef GetSnapComponent() const;
00917 
00946     CStatus Snap( LONG x, LONG y, LONG size, ULONG in_snaptype, const CStringArray& in_families, const CRefArray &in_objects, MATH::CVector3 &out_world ) const;
00949     //*****************************************************************************
00953 
00999     CStatus Pick( const CLongArray &in_points, siPickMode in_pickMode, siPickType in_pickType, const CString &in_filter, const CRefArray &in_objects, CRefArray &out_picked ) const;
01000 
01032     PickBuffer GetPickBuffer( LONG x, LONG y, LONG width, LONG height, const CString &in_filter, const CRefArray &in_objects, siViewMode in_viewMode = siShaded ) const;
01035     //*****************************************************************************
01039 
01050     CStatus ShowContextMenu( LONG x, LONG y, siAlignment in_hPos = siLeftAlign, siAlignment in_vPos = siTopAlign );
01053     //*****************************************************************************
01057 
01063     Image LoadImageFromFile( const CString &in_filename, bool in_relativePath = true );
01066 private:
01067     ToolContext * operator&() const;
01068     ToolContext * operator&();
01069 };
01070 
01071 };
01072 #endif // __XSITOOLCONTEXT_H__