File indexing completed on 2025-01-18 10:05:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _ViewerTest_HeaderFile
0016 #define _ViewerTest_HeaderFile
0017
0018 #include <Aspect_TypeOfLine.hxx>
0019 #include <Aspect_TypeOfMarker.hxx>
0020 #include <Aspect_TypeOfTriedronPosition.hxx>
0021 #include <Draw_Interpretor.hxx>
0022 #include <Graphic3d_TypeOfShadingModel.hxx>
0023 #include <Graphic3d_Vec2.hxx>
0024 #include <Graphic3d_ZLayerId.hxx>
0025 #include <TColStd_HArray1OfTransient.hxx>
0026 #include <TopTools_ListOfShape.hxx>
0027 #include <TopTools_HArray1OfShape.hxx>
0028 #include <Quantity_ColorRGBA.hxx>
0029
0030 class AIS_InteractiveContext;
0031 class AIS_InteractiveObject;
0032 class Image_PixMap;
0033 class V3d_View;
0034 class V3d_Viewer;
0035 class ViewerTest_EventManager;
0036 class TopoDS_Shape;
0037 class WNT_WClass;
0038
0039
0040 struct ViewerTest_VinitParams
0041 {
0042 TCollection_AsciiString ViewName;
0043 TCollection_AsciiString DisplayName;
0044 Handle(V3d_View) ViewToClone;
0045 Handle(V3d_View) ParentView;
0046 Graphic3d_Vec2d Offset;
0047 Graphic3d_Vec2d Size;
0048 Aspect_TypeOfTriedronPosition Corner;
0049 Graphic3d_Vec2i SubviewMargins;
0050 Standard_Boolean IsVirtual;
0051 Standard_Boolean IsComposer;
0052
0053 ViewerTest_VinitParams() : Corner (Aspect_TOTP_LEFT_UPPER), IsVirtual (false), IsComposer (false) {}
0054 };
0055
0056 class ViewerTest
0057 {
0058 public:
0059
0060 DEFINE_STANDARD_ALLOC
0061
0062
0063 Standard_EXPORT static void Factory (Draw_Interpretor& theDI);
0064
0065
0066
0067
0068
0069 Standard_EXPORT static TCollection_AsciiString ViewerInit (const ViewerTest_VinitParams& theParams);
0070
0071
0072 static TCollection_AsciiString ViewerInit (const TCollection_AsciiString& theViewName = "")
0073 {
0074 ViewerTest_VinitParams aParams;
0075 aParams.ViewName = theViewName;
0076 return ViewerInit (aParams);
0077 }
0078
0079
0080 static TCollection_AsciiString ViewerInit (const Standard_Integer thePxLeft,
0081 const Standard_Integer thePxTop,
0082 const Standard_Integer thePxWidth,
0083 const Standard_Integer thePxHeight,
0084 const TCollection_AsciiString& theViewName,
0085 const TCollection_AsciiString& theDisplayName = "",
0086 const Handle(V3d_View)& theViewToClone = Handle(V3d_View)(),
0087 const Standard_Boolean theIsVirtual = false)
0088 {
0089 ViewerTest_VinitParams aParams;
0090 aParams.Offset.SetValues ((float )thePxLeft, (float)thePxTop);
0091 aParams.Size.SetValues ((float)thePxWidth, (float)thePxHeight);
0092 aParams.ViewName = theViewName;
0093 aParams.DisplayName = theDisplayName;
0094 aParams.ViewToClone = theViewToClone;
0095 aParams.IsVirtual = theIsVirtual;
0096 return ViewerInit (aParams);
0097 }
0098
0099 Standard_EXPORT static void RemoveViewName (const TCollection_AsciiString& theName);
0100
0101 Standard_EXPORT static void InitViewName (const TCollection_AsciiString& theName,
0102 const Handle(V3d_View)& theView);
0103
0104 Standard_EXPORT static TCollection_AsciiString GetCurrentViewName();
0105
0106
0107 Standard_EXPORT static void ActivateView (const Handle(V3d_View)& theView,
0108 Standard_Boolean theToUpdate);
0109
0110
0111
0112 Standard_EXPORT static void RemoveView (const TCollection_AsciiString& theViewName,
0113 const Standard_Boolean theToRemoveContext = Standard_True);
0114
0115
0116
0117 Standard_EXPORT static void RemoveView (const Handle(V3d_View)& theView,
0118 const Standard_Boolean theToRemoveContext = Standard_True);
0119
0120
0121
0122
0123
0124
0125
0126 Standard_EXPORT static Standard_Boolean Display (const TCollection_AsciiString& theName,
0127 const Handle(AIS_InteractiveObject)& theObject,
0128 const Standard_Boolean theToUpdate = Standard_True,
0129 const Standard_Boolean theReplaceIfExists = Standard_True);
0130
0131
0132
0133
0134 Standard_EXPORT static TopoDS_Shape PickShape (const TopAbs_ShapeEnum aType,
0135 const Standard_Integer MaxPick = 5);
0136
0137
0138
0139
0140 Standard_EXPORT static Standard_Boolean PickShapes (const TopAbs_ShapeEnum aType,
0141 Handle(TopTools_HArray1OfShape)& thepicked,
0142 const Standard_Integer MaxPick = 5);
0143
0144 Standard_EXPORT static void Commands (Draw_Interpretor& theCommands);
0145
0146 Standard_EXPORT static void ViewerCommands (Draw_Interpretor& theCommands);
0147
0148 Standard_EXPORT static void RelationCommands (Draw_Interpretor& theCommands);
0149
0150 Standard_EXPORT static void ObjectCommands (Draw_Interpretor& theCommands);
0151
0152 Standard_EXPORT static void FilletCommands (Draw_Interpretor& theCommands);
0153
0154 Standard_EXPORT static void OpenGlCommands (Draw_Interpretor& theCommands);
0155
0156 Standard_EXPORT static void GetMousePosition (Standard_Integer& xpix, Standard_Integer& ypix);
0157
0158 Standard_EXPORT static Handle(V3d_Viewer) GetViewerFromContext();
0159
0160 Standard_EXPORT static Handle(V3d_Viewer) GetCollectorFromContext();
0161
0162 Standard_EXPORT static const Handle(AIS_InteractiveContext)& GetAISContext();
0163
0164 Standard_EXPORT static void SetAISContext (const Handle(AIS_InteractiveContext)& aContext);
0165
0166 Standard_EXPORT static const Handle(V3d_View)& CurrentView();
0167
0168 Standard_EXPORT static void CurrentView (const Handle(V3d_View)& aViou);
0169
0170 Standard_EXPORT static void Clear();
0171
0172
0173 Standard_EXPORT static void SetEventManager (const Handle(ViewerTest_EventManager)& theMgr);
0174
0175
0176 Standard_EXPORT static void UnsetEventManager();
0177
0178
0179
0180 Standard_EXPORT static void ResetEventManager();
0181
0182 Standard_EXPORT static Handle(ViewerTest_EventManager) CurrentEventManager();
0183
0184 Standard_EXPORT static void RemoveSelected();
0185
0186
0187 Standard_EXPORT static void RedrawAllViews();
0188
0189
0190
0191
0192 Standard_EXPORT static Standard_Boolean SplitParameter (const TCollection_AsciiString& theString,
0193 TCollection_AsciiString& theName,
0194 TCollection_AsciiString& theValue);
0195
0196
0197 Standard_EXPORT static void GetSelectedShapes (TopTools_ListOfShape& theShapes);
0198
0199
0200
0201 Standard_EXPORT static Standard_Boolean ParseLineType (Standard_CString theArg,
0202 Aspect_TypeOfLine& theType,
0203 uint16_t& thePattern);
0204
0205
0206
0207 static Standard_Boolean ParseLineType (Standard_CString theArg,
0208 Aspect_TypeOfLine& theType)
0209 {
0210 uint16_t aPattern = 0xFFFF;
0211 return ParseLineType (theArg, theType, aPattern);
0212 }
0213
0214
0215
0216 Standard_EXPORT static Standard_Boolean ParseMarkerType (Standard_CString theArg,
0217 Aspect_TypeOfMarker& theType,
0218 Handle(Image_PixMap)& theImage);
0219
0220
0221
0222 Standard_EXPORT static Standard_Boolean ParseShadingModel (Standard_CString theArg,
0223 Graphic3d_TypeOfShadingModel& theModel);
0224
0225
0226
0227
0228
0229 static Standard_Boolean ParseZLayerName (Standard_CString theArg,
0230 Graphic3d_ZLayerId& theLayer)
0231 {
0232 return parseZLayer (theArg, false, theLayer);
0233 }
0234
0235
0236
0237
0238
0239 static Standard_Boolean ParseZLayer (Standard_CString theArg,
0240 Graphic3d_ZLayerId& theLayer)
0241 {
0242 return parseZLayer (theArg, true, theLayer);
0243 }
0244
0245
0246 Standard_EXPORT static Standard_Boolean ParseCorner (Standard_CString theArg,
0247 Aspect_TypeOfTriedronPosition& theCorner);
0248
0249 public:
0250
0251
0252 Standard_DEPRECATED("Method has been moved to Draw::ParseColor()")
0253 Standard_EXPORT static Standard_Integer ParseColor (const Standard_Integer theArgNb,
0254 const char* const* const theArgVec,
0255 Quantity_ColorRGBA& theColor);
0256
0257
0258
0259 Standard_DEPRECATED("Method has been moved to Draw::ParseColor()")
0260 Standard_EXPORT static Standard_Integer ParseColor (const Standard_Integer theArgNb,
0261 const char* const* const theArgVec,
0262 Quantity_Color& theColor);
0263
0264
0265
0266 Standard_DEPRECATED("Method has been moved to Draw::ParseOnOff()")
0267 Standard_EXPORT static Standard_Boolean ParseOnOff (Standard_CString theArg,
0268 Standard_Boolean& theIsOn);
0269
0270 Standard_DEPRECATED("Method has been moved to Quantity_Color::ColorFromName()")
0271 Standard_EXPORT static Quantity_NameOfColor GetColorFromName (const Standard_CString name);
0272
0273 private:
0274
0275
0276
0277
0278
0279
0280 Standard_EXPORT static Standard_Boolean parseZLayer (Standard_CString theArg,
0281 Standard_Boolean theToAllowInteger,
0282 Graphic3d_ZLayerId& theLayer);
0283
0284
0285
0286
0287
0288
0289
0290 static const Handle(WNT_WClass)& WClass();
0291 };
0292
0293 #endif