#include <TopExp_Explorer.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <StdSelect_ShapeTypeFilter.hxx>
-#include <AIS.hxx>
#include <AIS_ColoredShape.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_Trihedron.hxx>
#include <AIS_Axis.hxx>
-#include <AIS_Relation.hxx>
+#include <PrsDim.hxx>
+#include <PrsDim_Relation.hxx>
#include <AIS_TypeFilter.hxx>
#include <AIS_SignatureFilter.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <Graphic3d_CStructure.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Graphic3d_GraphicDriver.hxx>
+#include <Graphic3d_MediaTextureSet.hxx>
#include <Image_AlienPixMap.hxx>
+#include <Message.hxx>
#include <OSD_File.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <StdSelect_ViewerSelector3d.hxx>
#include <TopTools_MapOfShape.hxx>
#include <ViewerTest_AutoUpdater.hxx>
+#include <Aspect_XRSession.hxx>
#include <stdio.h>
#define DEFAULT_MATERIAL Graphic3d_NOM_BRASS
//=======================================================================
-//function : GetColorFromName
-//purpose : get the Quantity_NameOfColor from a string
+// function : GetColorFromName
+// purpose : get the Quantity_NameOfColor from a string
//=======================================================================
Quantity_NameOfColor ViewerTest::GetColorFromName (const Standard_CString theName)
return aColor;
}
-
//=======================================================================
-//function : parseColor
-//purpose :
+// function : ParseColor
+// purpose :
//=======================================================================
-Standard_Integer ViewerTest::parseColor (Standard_Integer theArgNb,
- const char** theArgVec,
- Quantity_ColorRGBA& theColor,
- bool theToParseAlpha)
+Standard_Integer ViewerTest::ParseColor (const Standard_Integer theArgNb,
+ const char* const* const theArgVec,
+ Quantity_ColorRGBA& theColor)
{
- Quantity_NameOfColor aColor = Quantity_NOC_BLACK;
- if (theArgNb >= 1
- && Quantity_Color::ColorFromName (theArgVec[0], aColor))
- {
- theColor = Quantity_ColorRGBA (aColor);
- if (theArgNb >= 2
- && theToParseAlpha)
- {
- const TCollection_AsciiString anAlphaStr (theArgVec[1]);
- if (anAlphaStr.IsRealValue())
- {
- float anAlpha = (float )anAlphaStr.RealValue();
- if (anAlpha < 0.0f || anAlpha > 1.0f)
- {
- std::cout << "Syntax error: alpha should be within range 0..1!\n";
- return 0;
- }
- return 2;
- }
- }
- return 1;
- }
- else if (theArgNb >= 3)
- {
- Graphic3d_Vec4 anRgba;
- Standard_Integer aNbComps = Min (theArgNb, theToParseAlpha ? 4 : 3);
- for (int aCompIter = 0; aCompIter < aNbComps; ++aCompIter)
- {
- const TCollection_AsciiString anRgbaStr (theArgVec[aCompIter]);
- if (!anRgbaStr.IsRealValue())
- {
- if (aCompIter == 3)
- {
- anRgba.a() = 1.0f;
- aNbComps = 3;
- break;
- }
- return 0;
- }
-
- anRgba[aCompIter] = (float )anRgbaStr.RealValue();
- if (anRgba[aCompIter] < 0.0 || anRgba[aCompIter] > 1.0)
- {
- std::cout << "Error: RGBA color values should be within range 0..1!\n";
- return 0;
- }
- }
- theColor = Quantity_ColorRGBA (anRgba);
- return aNbComps;
- }
+ return Draw::ParseColor (theArgNb, theArgVec, theColor);
+}
- return 0;
+//=======================================================================
+// function : ParseColor
+// purpose :
+//=======================================================================
+Standard_Integer ViewerTest::ParseColor (const Standard_Integer theArgNb,
+ const char* const* const theArgVec,
+ Quantity_Color& theColor)
+{
+ return Draw::ParseColor (theArgNb, theArgVec, theColor);
}
//=======================================================================
Standard_Boolean ViewerTest::ParseOnOff (Standard_CString theArg,
Standard_Boolean& theIsOn)
{
- TCollection_AsciiString aFlag(theArg);
- aFlag.LowerCase();
- if (aFlag == "on"
- || aFlag == "1")
- {
- theIsOn = Standard_True;
- return Standard_True;
- }
- else if (aFlag == "off"
- || aFlag == "0")
- {
- theIsOn = Standard_False;
- return Standard_True;
- }
- return Standard_False;
+ return Draw::ParseOnOff (theArg, theIsOn);
}
//=======================================================================
//function : ParseLineType
//purpose :
//=======================================================================
-Standard_Boolean ViewerTest::ParseLineType (Standard_CString theArg,
- Aspect_TypeOfLine& theType)
+Standard_Boolean ViewerTest::ParseLineType (Standard_CString theArg,
+ Aspect_TypeOfLine& theType,
+ uint16_t& thePattern)
{
TCollection_AsciiString aTypeStr (theArg);
aTypeStr.LowerCase();
- if (aTypeStr == "empty")
+ if (aTypeStr == "empty"
+ || aTypeStr == "-1")
{
theType = Aspect_TOL_EMPTY;
+ thePattern = Graphic3d_Aspects::DefaultLinePatternForType (theType);
}
- else if (aTypeStr == "solid")
+ else if (aTypeStr == "solid"
+ || aTypeStr == "0")
{
theType = Aspect_TOL_SOLID;
+ thePattern = Graphic3d_Aspects::DefaultLinePatternForType (theType);
}
- else if (aTypeStr == "dot")
+ else if (aTypeStr == "dot"
+ || aTypeStr == "2")
{
theType = Aspect_TOL_DOT;
+ thePattern = Graphic3d_Aspects::DefaultLinePatternForType (theType);
}
- else if (aTypeStr == "dash")
+ else if (aTypeStr == "dash"
+ || aTypeStr == "1")
{
theType = Aspect_TOL_DASH;
+ thePattern = Graphic3d_Aspects::DefaultLinePatternForType (theType);
}
- else if (aTypeStr == "dotdash")
+ else if (aTypeStr == "dotdash"
+ || aTypeStr == "3")
{
theType = Aspect_TOL_DOTDASH;
+ thePattern = Graphic3d_Aspects::DefaultLinePatternForType (theType);
}
- else if (aTypeStr.IsIntegerValue())
+ else
{
- const int aTypeInt = aTypeStr.IntegerValue();
- if (aTypeInt < -1 || aTypeInt >= Aspect_TOL_USERDEFINED)
+ if (aTypeStr.StartsWith ("0x"))
+ {
+ aTypeStr = aTypeStr.SubString (3, aTypeStr.Length());
+ }
+
+ if (aTypeStr.Length() != 4
+ || !std::isxdigit (static_cast<unsigned char> (aTypeStr.Value (1)))
+ || !std::isxdigit (static_cast<unsigned char> (aTypeStr.Value (2)))
+ || !std::isxdigit (static_cast<unsigned char> (aTypeStr.Value (3)))
+ || !std::isxdigit (static_cast<unsigned char> (aTypeStr.Value (4))))
{
return Standard_False;
}
- theType = (Aspect_TypeOfLine )aTypeInt;
- }
- else
- {
- return Standard_False;
+
+ std::stringstream aStream;
+ aStream << std::setbase (16) << aTypeStr.ToCString();
+ if (aStream.fail())
+ {
+ return Standard_False;
+ }
+
+ Standard_Integer aNumber = -1;
+ aStream >> aNumber;
+ if (aStream.fail())
+ {
+ return Standard_False;
+ }
+
+ thePattern = (uint16_t )aNumber;
+ theType = Graphic3d_Aspects::DefaultLineTypeForPattern (thePattern);
}
return Standard_True;
}
{
theModel = Graphic3d_TOSM_FRAGMENT;
}
+ else if (aTypeStr == "pbr")
+ {
+ theModel = Graphic3d_TOSM_PBR;
+ }
+ else if (aTypeStr == "pbr_facet")
+ {
+ theModel = Graphic3d_TOSM_PBR_FACET;
+ }
else if (aTypeStr == "default"
|| aTypeStr == "def")
{
return Standard_True;
}
+//=======================================================================
+//function : parseZLayer
+//purpose :
+//=======================================================================
+Standard_Boolean ViewerTest::parseZLayer (Standard_CString theArg,
+ Standard_Boolean theToAllowInteger,
+ Graphic3d_ZLayerId& theLayer)
+{
+ TCollection_AsciiString aName (theArg);
+ aName.LowerCase();
+ if (aName == "default"
+ || aName == "def")
+ {
+ theLayer = Graphic3d_ZLayerId_Default;
+ }
+ else if (aName == "top")
+ {
+ theLayer = Graphic3d_ZLayerId_Top;
+ }
+ else if (aName == "topmost")
+ {
+ theLayer = Graphic3d_ZLayerId_Topmost;
+ }
+ else if (aName == "overlay"
+ || aName == "toposd")
+ {
+ theLayer = Graphic3d_ZLayerId_TopOSD;
+ }
+ else if (aName == "underlay"
+ || aName == "botosd")
+ {
+ theLayer = Graphic3d_ZLayerId_BotOSD;
+ }
+ else if (aName == "undefined")
+ {
+ theLayer = Graphic3d_ZLayerId_UNKNOWN;
+ }
+ else if (!GetAISContext().IsNull())
+ {
+ const Handle(V3d_Viewer)& aViewer = ViewerTest::GetAISContext()->CurrentViewer();
+ TColStd_SequenceOfInteger aLayers;
+ aViewer->GetAllZLayers (aLayers);
+ for (TColStd_SequenceOfInteger::Iterator aLayeriter (aLayers); aLayeriter.More(); aLayeriter.Next())
+ {
+ Graphic3d_ZLayerSettings aSettings = aViewer->ZLayerSettings (aLayeriter.Value());
+ if (TCollection_AsciiString::IsSameString (aSettings.Name(), aName, Standard_False))
+ {
+ theLayer = aLayeriter.Value();
+ return true;
+ }
+ }
+
+ if (!theToAllowInteger
+ || !aName.IsIntegerValue())
+ {
+ return false;
+ }
+ Graphic3d_ZLayerId aLayer = aName.IntegerValue();
+ if (aLayer == Graphic3d_ZLayerId_UNKNOWN
+ || std::find (aLayers.begin(), aLayers.end(), aLayer) != aLayers.end())
+ {
+ theLayer = aLayer;
+ return true;
+ }
+ return false;
+ }
+ return true;
+}
+
//=======================================================================
//function : GetTypeNames
//purpose :
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
- std::cout << "Error: AIS context is not available.\n";
+ Message::SendFail ("Error: AIS context is not available.");
return Standard_False;
}
{
if (!theReplaceIfExists)
{
- std::cout << "Error: other interactive object has been already registered with name: " << theName << ".\n"
- << "Please use another name.\n";
+ Message::SendFail() << "Error: other interactive object has been already registered with name: " << theName << ".\n"
+ << "Please use another name.";
return Standard_False;
}
return ViewerTest::Display (theName, theObject, Standard_True, theReplaceIfExists);
}
-static TColStd_MapOfInteger theactivatedmodes(8);
-static TColStd_ListOfTransient theEventMgrs;
-
-static void VwrTst_InitEventMgr(const Handle(V3d_View)& aView,
- const Handle(AIS_InteractiveContext)& Ctx)
-{
- theEventMgrs.Clear();
- theEventMgrs.Prepend(new ViewerTest_EventManager(aView, Ctx));
-}
+static NCollection_List<Handle(ViewerTest_EventManager)> theEventMgrs;
static Handle(V3d_View)& a3DView()
{
void ViewerTest::ResetEventManager()
{
- const Handle(V3d_View) aView = ViewerTest::CurrentView();
- VwrTst_InitEventMgr(aView, ViewerTest::GetAISContext());
+ theEventMgrs.Clear();
+ theEventMgrs.Prepend (new ViewerTest_EventManager (ViewerTest::CurrentView(), ViewerTest::GetAISContext()));
}
Handle(ViewerTest_EventManager) ViewerTest::CurrentEventManager()
{
- Handle(ViewerTest_EventManager) EM;
- if(theEventMgrs.IsEmpty()) return EM;
- Handle(Standard_Transient) Tr = theEventMgrs.First();
- EM = Handle(ViewerTest_EventManager)::DownCast (Tr);
- return EM;
+ return !theEventMgrs.IsEmpty()
+ ? theEventMgrs.First()
+ : Handle(ViewerTest_EventManager)();
}
//=======================================================================
if (theCtx.IsNull()
|| theView.IsNull())
{
- std::cout << "Error: cannot find an active view!\n";
+ Message::SendFail ("Error: cannot find an active view!");
return Standard_False;
}
return Standard_True;
continue;
}
- std::cout << "Remove " << anObjIter.Key2() << std::endl;
+ Message::SendInfo() << "Remove " << anObjIter.Key2();
TheAISContext()->Remove (anObj, Standard_False);
aListRemoved.Append (anObj);
}
GetMapOfAIS().Find2(name, aShape);
if (aShape.IsNull())
{
- std::cout << "Syntax error: object '" << name << "' is not found\n";
+ Message::SendFail() << "Syntax error: object '" << name << "' is not found";
return 1;
}
{
if (theArgNb > 1)
{
- std::cout << "Error: wrong syntax!\n";
+ Message::SendFail ("Error: wrong syntax!");
return 1;
}
{
if (theArgNb > 1)
{
- std::cout << "Error: wrong syntax!\n";
+ Message::SendFail ("Error: wrong syntax!");
return 1;
}
//purpose : To list the displayed object with their attributes
//==============================================================================
static int VDir (Draw_Interpretor& theDI,
- Standard_Integer ,
- const char** )
+ Standard_Integer theNbArgs,
+ const char** theArgVec)
{
- for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
- anIter.More(); anIter.Next())
+ TCollection_AsciiString aMatch;
+ Standard_Boolean toFormat = Standard_False;
+ for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
+ {
+ TCollection_AsciiString anArgCase (theArgVec[anArgIter]);
+ anArgCase.LowerCase();
+ if (anArgCase == "-list"
+ || anArgCase == "-format")
+ {
+ toFormat = Standard_True;
+ }
+ else if (aMatch.IsEmpty())
+ {
+ aMatch = theArgVec[anArgIter];
+ }
+ else
+ {
+ Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
+ return 1;
+ }
+ }
+
+ TCollection_AsciiString aRes;
+ for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS()); anIter.More(); anIter.Next())
{
- theDI << "\t" << anIter.Key2() << "\n";
+ if (!aMatch.IsEmpty())
+ {
+ const TCollection_AsciiString aCheck = TCollection_AsciiString ("string match '") + aMatch + "' '" + anIter.Key2() + "'";
+ if (theDI.Eval (aCheck.ToCString()) == 0
+ && *theDI.Result() != '1')
+ {
+ continue;
+ }
+ }
+
+ if (toFormat)
+ {
+ aRes += TCollection_AsciiString("\t") + anIter.Key2() + "\n";
+ }
+ else
+ {
+ aRes += anIter.Key2() + " ";
+ }
}
+ theDI.Reset();
+ theDI << aRes;
return 0;
}
Standard_Integer theArgNb,
Standard_CString* theArgVec)
{
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
if (theArgNb < 2)
{
- std::cout << "Error: wrong number of arguments! Image file name should be specified at least.\n";
+ Message::SendFail ("Error: wrong number of arguments! Image file name should be specified at least.");
+ return 1;
+ }
+ if (aView.IsNull())
+ {
+ Message::SendFail() << "Error: cannot find an active view!";
return 1;
}
Standard_CString aFilePath = theArgVec[anArgIter++];
ViewerTest_StereoPair aStereoPair = ViewerTest_SP_Single;
V3d_ImageDumpOptions aParams;
+ Handle(Graphic3d_Camera) aCustomCam;
aParams.BufferType = Graphic3d_BT_RGB;
aParams.StereoOptions = V3d_SDO_MONO;
for (; anArgIter < theArgNb; ++anArgIter)
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
{
aParams.BufferType = Graphic3d_BT_RGB;
}
+ else if (aBufArg == "red")
+ {
+ aParams.BufferType = Graphic3d_BT_Red;
+ }
else if (aBufArg == "depth")
{
aParams.BufferType = Graphic3d_BT_Depth;
}
else
{
- std::cout << "Error: unknown buffer '" << aBufArg << "'\n";
+ Message::SendFail() << "Error: unknown buffer '" << aBufArg << "'";
return 1;
}
}
+ else if (anArgIter + 1 < theArgNb
+ && anArg == "-xrpose")
+ {
+ TCollection_AsciiString anXRArg (theArgVec[++anArgIter]);
+ anXRArg.LowerCase();
+ if (anXRArg == "base")
+ {
+ aCustomCam = aView->View()->BaseXRCamera();
+ }
+ else if (anXRArg == "head")
+ {
+ aCustomCam = aView->View()->PosedXRCamera();
+ }
+ else if (anXRArg == "handleft"
+ || anXRArg == "handright")
+ {
+ if (aView->View()->IsActiveXR())
+ {
+ aCustomCam = new Graphic3d_Camera();
+ aView->View()->ComputeXRPosedCameraFromBase (*aCustomCam, anXRArg == "handleft"
+ ? aView->View()->XRSession()->LeftHandPose()
+ : aView->View()->XRSession()->RightHandPose());
+ }
+ }
+ else
+ {
+ Message::SendFail() << "Syntax error: unknown XR pose '" << anXRArg << "'";
+ return 1;
+ }
+ if (aCustomCam.IsNull())
+ {
+ Message::SendFail() << "Error: undefined XR pose";
+ return 0;
+ }
+ }
else if (anArg == "-stereo")
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+ Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
return 1;
}
}
else
{
- std::cout << "Error: unknown stereo format '" << aStereoArg << "'\n";
+ Message::SendFail() << "Error: unknown stereo format '" << aStereoArg << "'";
return 1;
}
}
{
aParams.BufferType = Graphic3d_BT_RGB;
}
+ else if (anArg == "-red"
+ || anArg == "red")
+ {
+ aParams.BufferType = Graphic3d_BT_Red;
+ }
else if (anArg == "-depth"
|| anArg == "depth")
{
{
if (aParams.Width != 0)
{
- std::cout << "Error: wrong syntax at " << theArgVec[anArgIter] << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << theArgVec[anArgIter];
return 1;
}
else if (++anArgIter >= theArgNb)
{
- std::cout << "Error: integer value is expected right after 'width'\n";
+ Message::SendFail() << "Error: integer value is expected right after 'width'";
return 1;
}
aParams.Width = Draw::Atoi (theArgVec[anArgIter]);
{
if (aParams.Height != 0)
{
- std::cout << "Error: wrong syntax at " << theArgVec[anArgIter] << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << theArgVec[anArgIter];
return 1;
}
else if (++anArgIter >= theArgNb)
{
- std::cout << "Error: integer value is expected right after 'height'\n";
+ Message::SendFail() << "Error: integer value is expected right after 'height'";
return 1;
}
aParams.Height = Draw::Atoi (theArgVec[anArgIter]);
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: integer value is expected right after 'tileSize'\n";
+ Message::SendFail() << "Error: integer value is expected right after 'tileSize'";
return 1;
}
aParams.TileSize = Draw::Atoi (theArgVec[anArgIter]);
}
else
{
- std::cout << "Error: unknown argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Error: unknown argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
if ((aParams.Width <= 0 && aParams.Height > 0)
|| (aParams.Width > 0 && aParams.Height <= 0))
{
- std::cout << "Error: dimensions " << aParams.Width << "x" << aParams.Height << " are incorrect\n";
- return 1;
- }
-
- Handle(V3d_View) aView = ViewerTest::CurrentView();
- if (aView.IsNull())
- {
- std::cout << "Error: cannot find an active view!\n";
+ Message::SendFail() << "Error: dimensions " << aParams.Width << "x" << aParams.Height << " are incorrect";
return 1;
}
case Graphic3d_BT_RGBA: aFormat = Image_Format_RGBA; break;
case Graphic3d_BT_Depth: aFormat = Image_Format_GrayF; break;
case Graphic3d_BT_RGB_RayTraceHdrLeft: aFormat = Image_Format_RGBF; break;
+ case Graphic3d_BT_Red: aFormat = Image_Format_Gray; break;
}
+ const bool wasImmUpdate = aView->SetImmediateUpdate (false);
+ Handle(Graphic3d_Camera) aCamBack = aView->Camera();
+ if (!aCustomCam.IsNull())
+ {
+ aView->SetCamera (aCustomCam);
+ }
switch (aStereoPair)
{
case ViewerTest_SP_Single:
break;
}
}
+ if (!aCustomCam.IsNull())
+ {
+ aView->SetCamera (aCamBack);
+ }
+ aView->SetImmediateUpdate (wasImmUpdate);
if (!aPixMap.Save (aFilePath))
{
if (argc < 1
|| argc > 3)
{
- std::cout << "Syntax error: wrong number of arguments\n";
+ Message::SendFail() << "Syntax error: wrong number of arguments";
return 1;
}
{
if (!GetMapOfAIS().IsBound2 (mySeqIter.Value()))
{
- std::cout << "Error: object " << mySeqIter.Value() << " is not displayed!\n";
+ Message::SendFail() << "Error: object " << mySeqIter.Value() << " is not displayed!";
return;
}
myCurrentName = mySeqIter.Value();
Standard_Integer ToSetColor;
Quantity_Color Color;
+ Standard_Integer ToSetBackFaceColor;
+ Quantity_Color BackFaceColor;
Standard_Integer ToSetLineWidth;
Standard_Real LineWidth;
Standard_Integer ToSetTypeOfLine;
- Aspect_TypeOfLine TypeOfLine;
+ uint16_t StippleLinePattern;
+ uint16_t StippleLineFactor;
Standard_Integer ToSetTypeOfMarker;
Aspect_TypeOfMarker TypeOfMarker;
Standard_Integer ToEnableIsoOnTriangulation;
+ Standard_Integer ToSetFaceBoundaryDraw;
+ Standard_Integer ToSetFaceBoundaryUpperContinuity;
+ GeomAbs_Shape FaceBoundaryUpperContinuity;
+
+ Standard_Integer ToSetFaceBoundaryColor;
+ Quantity_Color FaceBoundaryColor;
+
+ Standard_Integer ToSetFaceBoundaryWidth;
+ Standard_Real FaceBoundaryWidth;
+
+ Standard_Integer ToSetTypeOfFaceBoundaryLine;
+ Aspect_TypeOfLine TypeOfFaceBoundaryLine;
+
Standard_Integer ToSetMaxParamValue;
Standard_Real MaxParamValue;
Standard_Integer ToSetInterior;
Aspect_InteriorStyle InteriorStyle;
+ Standard_Integer ToSetDrawSilhouette;
+
Standard_Integer ToSetDrawEdges;
Standard_Integer ToSetQuadEdges;
Visibility (1),
ToSetColor (0),
Color (DEFAULT_COLOR),
+ ToSetBackFaceColor(0),
+ BackFaceColor (DEFAULT_COLOR),
ToSetLineWidth (0),
LineWidth (1.0),
ToSetTypeOfLine (0),
- TypeOfLine (Aspect_TOL_SOLID),
+ StippleLinePattern(0xFFFF),
+ StippleLineFactor (1),
ToSetTypeOfMarker (0),
TypeOfMarker (Aspect_TOM_PLUS),
ToSetMarkerSize (0),
FreeBoundaryWidth (1.0),
ToSetFreeBoundaryColor (0),
FreeBoundaryColor (DEFAULT_FREEBOUNDARY_COLOR),
- ToEnableIsoOnTriangulation (-1),
+ ToEnableIsoOnTriangulation (0),
+ //
+ ToSetFaceBoundaryDraw (0),
+ ToSetFaceBoundaryUpperContinuity (0),
+ FaceBoundaryUpperContinuity(GeomAbs_CN),
+ ToSetFaceBoundaryColor (0),
+ FaceBoundaryColor (Quantity_NOC_BLACK),
+ ToSetFaceBoundaryWidth (0),
+ FaceBoundaryWidth (1.0f),
+ ToSetTypeOfFaceBoundaryLine(0),
+ TypeOfFaceBoundaryLine (Aspect_TOL_SOLID),
+ //
ToSetMaxParamValue (0),
MaxParamValue (500000),
ToSetSensitivity (0),
ShadingModel (Graphic3d_TOSM_DEFAULT),
ToSetInterior (0),
InteriorStyle (Aspect_IS_SOLID),
+ ToSetDrawSilhouette (0),
ToSetDrawEdges (0),
ToSetQuadEdges (0),
ToSetEdgeColor (0),
&& ToSetTransparency == 0
&& ToSetAlphaMode == 0
&& ToSetColor == 0
+ && ToSetBackFaceColor == 0
&& ToSetMaterial == 0
&& ToSetShowFreeBoundary == 0
&& ToSetFreeBoundaryColor == 0
&& ToSetFreeBoundaryWidth == 0
+ && ToEnableIsoOnTriangulation == 0
+ && ToSetFaceBoundaryDraw == 0
+ && ToSetFaceBoundaryUpperContinuity == 0
+ && ToSetFaceBoundaryColor == 0
+ && ToSetFaceBoundaryWidth == 0
+ && ToSetTypeOfFaceBoundaryLine == 0
&& ToSetMaxParamValue == 0
&& ToSetSensitivity == 0
&& ToSetHatch == 0
&& ToSetShadingModel == 0
&& ToSetInterior == 0
+ && ToSetDrawSilhouette == 0
&& ToSetDrawEdges == 0
&& ToSetQuadEdges == 0
&& ToSetEdgeColor == 0
Standard_Boolean isOk = Standard_True;
if (Visibility != 0 && Visibility != 1)
{
- std::cout << "Error: the visibility should be equal to 0 or 1 (0 - invisible; 1 - visible) (specified " << Visibility << ")\n";
+ Message::SendFail() << "Error: the visibility should be equal to 0 or 1 (0 - invisible; 1 - visible) (specified " << Visibility << ")";
isOk = Standard_False;
}
if (LineWidth <= 0.0
|| LineWidth > 10.0)
{
- std::cout << "Error: the width should be within [1; 10] range (specified " << LineWidth << ")\n";
+ Message::SendFail() << "Error: the width should be within [1; 10] range (specified " << LineWidth << ")";
isOk = Standard_False;
}
if (Transparency < 0.0
|| Transparency > 1.0)
{
- std::cout << "Error: the transparency should be within [0; 1] range (specified " << Transparency << ")\n";
+ Message::SendFail() << "Error: the transparency should be within [0; 1] range (specified " << Transparency << ")";
isOk = Standard_False;
}
if (ToSetAlphaMode == 1
&& (AlphaCutoff <= 0.0f || AlphaCutoff >= 1.0f))
{
- std::cout << "Error: alpha cutoff value should be within (0; 1) range (specified " << AlphaCutoff << ")\n";
- isOk = Standard_False;
- }
- if (ToSetMaterial == 1
- && Material == Graphic3d_NOM_DEFAULT)
- {
- std::cout << "Error: unknown material " << MatName << ".\n";
+ Message::SendFail() << "Error: alpha cutoff value should be within (0; 1) range (specified " << AlphaCutoff << ")";
isOk = Standard_False;
}
if (FreeBoundaryWidth <= 0.0
|| FreeBoundaryWidth > 10.0)
{
- std::cout << "Error: the free boundary width should be within [1; 10] range (specified " << FreeBoundaryWidth << ")\n";
+ Message::SendFail() << "Error: the free boundary width should be within [1; 10] range (specified " << FreeBoundaryWidth << ")";
isOk = Standard_False;
}
if (MaxParamValue < 0.0)
{
- std::cout << "Error: the max parameter value should be greater than zero (specified " << MaxParamValue << ")\n";
+ Message::SendFail() << "Error: the max parameter value should be greater than zero (specified " << MaxParamValue << ")";
isOk = Standard_False;
}
if (Sensitivity <= 0 && ToSetSensitivity)
{
- std::cout << "Error: sensitivity parameter value should be positive (specified " << Sensitivity << ")\n";
+ Message::SendFail() << "Error: sensitivity parameter value should be positive (specified " << Sensitivity << ")";
isOk = Standard_False;
}
if (ToSetHatch == 1 && StdHatchStyle < 0 && PathToHatchPattern == "")
{
- std::cout << "Error: hatch style must be specified\n";
+ Message::SendFail ("Error: hatch style must be specified");
isOk = Standard_False;
}
if (ToSetShadingModel == 1
- && (ShadingModel < Graphic3d_TOSM_DEFAULT || ShadingModel > Graphic3d_TOSM_FRAGMENT))
+ && (ShadingModel < Graphic3d_TOSM_DEFAULT || ShadingModel > Graphic3d_TOSM_PBR_FACET))
{
- std::cout << "Error: unknown shading model " << ShadingModelName << ".\n";
+ Message::SendFail() << "Error: unknown shading model " << ShadingModelName << ".";
isOk = Standard_False;
}
return isOk;
|| theDrawer->HasOwnSeenLineAspect())
{
toRecompute = theDrawer->SetOwnLineAspects() || toRecompute;
- theDrawer->LineAspect()->SetTypeOfLine (TypeOfLine);
- theDrawer->WireAspect()->SetTypeOfLine (TypeOfLine);
- theDrawer->FreeBoundaryAspect()->SetTypeOfLine (TypeOfLine);
- theDrawer->UnFreeBoundaryAspect()->SetTypeOfLine (TypeOfLine);
- theDrawer->SeenLineAspect()->SetTypeOfLine (TypeOfLine);
+ theDrawer->LineAspect()->Aspect()->SetLinePattern (StippleLinePattern);
+ theDrawer->LineAspect()->Aspect()->SetLineStippleFactor (StippleLineFactor);
+ theDrawer->WireAspect()->Aspect()->SetLinePattern (StippleLinePattern);
+ theDrawer->WireAspect()->Aspect()->SetLineStippleFactor (StippleLineFactor);
+ theDrawer->FreeBoundaryAspect()->Aspect()->SetLinePattern (StippleLinePattern);
+ theDrawer->FreeBoundaryAspect()->Aspect()->SetLineStippleFactor (StippleLineFactor);
+ theDrawer->UnFreeBoundaryAspect()->Aspect()->SetLinePattern (StippleLinePattern);
+ theDrawer->UnFreeBoundaryAspect()->Aspect()->SetLineStippleFactor (StippleLineFactor);
+ theDrawer->SeenLineAspect()->Aspect()->SetLinePattern (StippleLinePattern);
+ theDrawer->SeenLineAspect()->Aspect()->SetLineStippleFactor (StippleLineFactor);
}
}
if (ToSetTypeOfMarker != 0)
toRecompute = true;
}
}
+ if (ToSetFaceBoundaryDraw != 0)
+ {
+ if (ToSetFaceBoundaryDraw != -1
+ || theDrawer->HasOwnFaceBoundaryDraw())
+ {
+ toRecompute = true;
+ theDrawer->SetFaceBoundaryDraw (ToSetFaceBoundaryDraw == 1);
+ }
+ }
+ if (ToSetFaceBoundaryUpperContinuity != 0)
+ {
+ if (ToSetFaceBoundaryUpperContinuity != -1
+ || theDrawer->HasOwnFaceBoundaryUpperContinuity())
+ {
+ toRecompute = true;
+ if (ToSetFaceBoundaryUpperContinuity == -1)
+ {
+ theDrawer->UnsetFaceBoundaryUpperContinuity();
+ }
+ else
+ {
+ theDrawer->SetFaceBoundaryUpperContinuity (FaceBoundaryUpperContinuity);
+ }
+ }
+ }
+ if (ToSetFaceBoundaryColor != 0)
+ {
+ if (ToSetFaceBoundaryColor != -1
+ || theDrawer->HasOwnFaceBoundaryAspect())
+ {
+ if (ToSetFaceBoundaryColor == -1)
+ {
+ toRecompute = true;
+ theDrawer->SetFaceBoundaryAspect (Handle(Prs3d_LineAspect)());
+ }
+ else
+ {
+ toRecompute = theDrawer->SetupOwnFaceBoundaryAspect (aDefDrawer) || toRecompute;
+ theDrawer->FaceBoundaryAspect()->SetColor (FaceBoundaryColor);
+ }
+ }
+ }
+ if (ToSetFaceBoundaryWidth != 0)
+ {
+ if (ToSetFaceBoundaryWidth != -1
+ || theDrawer->HasOwnFaceBoundaryAspect())
+ {
+ toRecompute = theDrawer->SetupOwnFaceBoundaryAspect (aDefDrawer) || toRecompute;
+ theDrawer->FaceBoundaryAspect()->SetWidth (FaceBoundaryWidth);
+ }
+ }
+ if (ToSetTypeOfFaceBoundaryLine != 0)
+ {
+ if (ToSetTypeOfFaceBoundaryLine != -1
+ || theDrawer->HasOwnFaceBoundaryAspect())
+ {
+ toRecompute = theDrawer->SetupOwnFaceBoundaryAspect (aDefDrawer) || toRecompute;
+ theDrawer->FaceBoundaryAspect()->SetTypeOfLine (TypeOfFaceBoundaryLine);
+ }
+ }
if (ToSetShadingModel != 0)
{
if (ToSetShadingModel != -1
theDrawer->ShadingAspect()->Aspect()->SetShadingModel (ShadingModel);
}
}
+ if (ToSetBackFaceColor != 0)
+ {
+ if (ToSetBackFaceColor != -1
+ || theDrawer->HasOwnShadingAspect())
+ {
+ toRecompute = theDrawer->SetupOwnShadingAspect (aDefDrawer) || toRecompute;
+ theDrawer->ShadingAspect()->SetColor (BackFaceColor, Aspect_TOFM_BACK_SIDE);
+ }
+ }
if (ToSetAlphaMode != 0)
{
if (ToSetAlphaMode != -1
}
else
{
- std::cout << "Error: cannot load the following image: " << PathToHatchPattern << "\n";
+ Message::SendFail() << "Error: cannot load the following image: " << PathToHatchPattern;
}
}
else if (StdHatchStyle != -1)
}
}
}
+ if (ToSetDrawSilhouette != 0)
+ {
+ if (ToSetDrawSilhouette != -1
+ || theDrawer->HasOwnShadingAspect())
+ {
+ toRecompute = theDrawer->SetupOwnShadingAspect (aDefDrawer) || toRecompute;
+ theDrawer->ShadingAspect()->Aspect()->SetDrawSilhouette (ToSetDrawSilhouette == 1);
+ }
+ }
if (ToSetDrawEdges != 0)
{
if (ToSetDrawEdges != -1
//function : VAspects
//purpose :
//==============================================================================
-static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
+static Standard_Integer VAspects (Draw_Interpretor& theDI,
Standard_Integer theArgNb,
const char** theArgVec)
{
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
if (aCtx.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
if (!aNames.IsEmpty() && isDefaults)
{
- std::cout << "Error: wrong syntax. If -defaults is used there should not be any objects' names!\n";
+ Message::SendFail ("Error: wrong syntax. If -defaults is used there should not be any objects' names!");
return 1;
}
// parse syntax of legacy commands
bool toParseAliasArgs = false;
+ Standard_Boolean toDump = 0;
+ Standard_Boolean toCompactDump = 0;
+ Standard_Integer aDumpDepth = -1;
if (aCmdName == "vsetwidth")
{
if (aNames.IsEmpty()
|| !aNames.Last().IsRealValue())
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
aChangeSet->ToSetLineWidth = 1;
{
if (aNames.IsEmpty())
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
aChangeSet->ToSetColor = 1;
aNames.Remove (aNames.Length());
isOk = Standard_True;
}
+ else if (Quantity_Color::ColorFromHex (aNames.Last().ToCString(), aChangeSet->Color))
+ {
+ aNames.Remove (aNames.Length());
+ isOk = Standard_True;
+ }
else if (aNames.Length() >= 3)
{
const char* anArgVec[3] =
aNames.Value (aNames.Upper() - 0).ToCString(),
};
- Standard_Integer aNbParsed = ViewerTest::ParseColor (3, anArgVec, aChangeSet->Color);
+ Standard_Integer aNbParsed = Draw::ParseColor (3, anArgVec, aChangeSet->Color);
isOk = aNbParsed == 3;
aNames.Remove (aNames.Length());
aNames.Remove (aNames.Length());
}
if (!isOk)
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
}
if (aNames.IsEmpty()
|| !aNames.Last().IsRealValue())
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
aChangeSet->ToSetTransparency = 1;
{
if (aNames.IsEmpty())
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
aChangeSet->ToSetMaterial = 1;
- aChangeSet->MatName = aNames.Last();
- aChangeSet->Material = Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString());
+ aChangeSet->MatName = aNames.Last();
aNames.Remove (aNames.Length());
+ if (!Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString(), aChangeSet->Material))
+ {
+ Message::SendFail() << "Syntax error: unknown material '" << aChangeSet->MatName << "'.";
+ return 1;
+ }
}
else if (aCmdName == "vunsetmaterial")
{
if (aNames.IsEmpty()
|| !aNames.Last().IsRealValue())
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
aChangeSet->ToSetInterior = 1;
if (!parseInteriorStyle (aNames.Last(), aChangeSet->InteriorStyle))
{
- std::cout << "Error: wrong syntax at " << aNames.Last() << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << aNames.Last();
return 1;
}
aNames.Remove (aNames.Length());
aChangeSet->ToSetTypeOfEdge = -1;
aChangeSet->TypeOfEdge = Aspect_TOL_SOLID;
}
+ else if (aCmdName == "vshowfaceboundary")
+ {
+ aChangeSet->ToSetFaceBoundaryDraw = 1;
+ toParseAliasArgs = true;
+ if (aNames.Size() >= 2
+ && aNames.Value (2).IsIntegerValue())
+ {
+ if (aNames.Size() == 7)
+ {
+ if (ViewerTest::ParseLineType (aNames.Value (7).ToCString(), aChangeSet->TypeOfFaceBoundaryLine))
+ {
+ aChangeSet->ToSetTypeOfFaceBoundaryLine = 1;
+ aNames.Remove (7);
+ }
+ }
+ if (aNames.Size() == 6
+ && aNames.Value (6).IsRealValue())
+ {
+ aChangeSet->ToSetFaceBoundaryWidth = 1;
+ aChangeSet->FaceBoundaryWidth = aNames.Value (6).RealValue();
+ aNames.Remove (6);
+ }
+ if (aNames.Size() == 5
+ && aNames.Value (3).IsIntegerValue()
+ && aNames.Value (4).IsIntegerValue()
+ && aNames.Value (5).IsIntegerValue())
+ {
+ aChangeSet->ToSetFaceBoundaryColor = 1;
+ aChangeSet->FaceBoundaryColor = Quantity_Color (aNames.Value (3).IntegerValue() / 255.0,
+ aNames.Value (4).IntegerValue() / 255.0,
+ aNames.Value (5).IntegerValue() / 255.0,
+ Quantity_TOC_sRGB);
+ aNames.Remove (5);
+ aNames.Remove (4);
+ aNames.Remove (3);
+ }
+ if (aNames.Size() == 2)
+ {
+ toParseAliasArgs = false;
+ aChangeSet->ToSetFaceBoundaryDraw = aNames.Value (2).IntegerValue() == 1 ? 1 : -1;
+ aNames.Remove (2);
+ }
+ }
+ }
else if (anArgIter >= theArgNb)
{
- std::cout << "Error: not enough arguments!\n";
+ Message::SendFail ("Error: not enough arguments!");
return 1;
}
|| anArg == "-setedgewidth"
|| anArg == "-setedgeswidth"
|| anArg == "-edgewidth"
- || anArg == "-edgeswidth")
+ || anArg == "-edgeswidth"
+ || anArg == "-setfaceboundarywidth"
+ || anArg == "-setboundarywidth"
+ || anArg == "-faceboundarywidth"
+ || anArg == "-boundarywidth")
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
+
+ const Standard_Real aWidth = Draw::Atof (theArgVec[anArgIter]);
if (anArg == "-setedgewidth"
|| anArg == "-setedgeswidth"
|| anArg == "-edgewidth"
|| aCmdName == "vsetedgetype")
{
aChangeSet->ToSetEdgeWidth = 1;
- aChangeSet->EdgeWidth = Draw::Atof (theArgVec[anArgIter]);
+ aChangeSet->EdgeWidth = aWidth;
+ }
+ else if (anArg == "-setfaceboundarywidth"
+ || anArg == "-setboundarywidth"
+ || anArg == "-faceboundarywidth"
+ || anArg == "-boundarywidth"
+ || aCmdName == "vshowfaceboundary")
+ {
+ aChangeSet->ToSetFaceBoundaryWidth = 1;
+ aChangeSet->FaceBoundaryWidth = aWidth;
}
else
{
aChangeSet->ToSetLineWidth = 1;
- aChangeSet->LineWidth = Draw::Atof (theArgVec[anArgIter]);
+ aChangeSet->LineWidth = aWidth;
}
}
else if (anArg == "-unsetwidth"
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetTransparency = 1;
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetAlphaMode = 1;
}
else
{
- std::cout << "Error: wrong syntax at " << aParam << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << aParam;
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetTransparency = 1;
if (aChangeSet->Transparency < 0.0
|| aChangeSet->Transparency > 1.0)
{
- std::cout << "Error: the transparency should be within [0; 1] range (specified " << aChangeSet->Transparency << ")\n";
+ Message::SendFail() << "Error: the transparency should be within [0; 1] range (specified " << aChangeSet->Transparency << ")";
return 1;
}
aChangeSet->Transparency = 1.0 - aChangeSet->Transparency;
aChangeSet->Transparency = 0.0;
}
else if (anArg == "-setcolor"
- || anArg == "-color")
+ || anArg == "-color"
+ || anArg == "-setbackfacecolor"
+ || anArg == "-backfacecolor"
+ || anArg == "-setbackcolor"
+ || anArg == "-backcolor"
+ || anArg == "-setfaceboundarycolor"
+ || anArg == "-setboundarycolor"
+ || anArg == "-faceboundarycolor"
+ || anArg == "-boundarycolor")
{
Quantity_Color aColor;
- Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
- theArgVec + anArgIter + 1,
- aColor);
+ Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
+ theArgVec + anArgIter + 1,
+ aColor);
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
aChangeSet->ToSetEdgeColor = 1;
aChangeSet->EdgeColor = Quantity_ColorRGBA (aColor);
}
+ else if (aCmdName == "vshowfaceboundary"
+ || anArg == "-setfaceboundarycolor"
+ || anArg == "-setboundarycolor"
+ || anArg == "-faceboundarycolor"
+ || anArg == "-boundarycolor")
+ {
+ aChangeSet->ToSetFaceBoundaryColor = 1;
+ aChangeSet->FaceBoundaryColor = aColor;
+ }
+ else if (anArg == "-setbackfacecolor"
+ || anArg == "-backfacecolor"
+ || anArg == "-setbackcolor"
+ || anArg == "-backcolor")
+ {
+ aChangeSet->ToSetBackFaceColor = 1;
+ aChangeSet->BackFaceColor = aColor;
+ }
else
{
aChangeSet->ToSetColor = 1;
|| anArg == "-setedgestype"
|| anArg == "-edgetype"
|| anArg == "-edgestype"
+ || anArg == "-setfaceboundarystyle"
+ || anArg == "-faceboundarystyle"
+ || anArg == "-boundarystyle"
+ || anArg == "-setfaceboundarytype"
+ || anArg == "-faceboundarytype"
+ || anArg == "-setboundarytype"
+ || anArg == "-boundarytype"
|| anArg == "-type")
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
Aspect_TypeOfLine aLineType = Aspect_TOL_EMPTY;
- if (!ViewerTest::ParseLineType (theArgVec[anArgIter], aLineType))
+ uint16_t aLinePattern = 0xFFFF;
+ if (!ViewerTest::ParseLineType (theArgVec[anArgIter], aLineType, aLinePattern))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
+
if (anArg == "-setedgetype"
|| anArg == "-setedgestype"
|| anArg == "-edgetype"
|| anArg == "-edgestype"
|| aCmdName == "vsetedgetype")
{
- aChangeSet->TypeOfEdge = aLineType;
+ aChangeSet->TypeOfEdge = Graphic3d_Aspects::DefaultLineTypeForPattern (aLinePattern);
aChangeSet->ToSetTypeOfEdge = 1;
}
+ else if (anArg == "-setfaceboundarystyle"
+ || anArg == "-faceboundarystyle"
+ || anArg == "-boundarystyle"
+ || anArg == "-setfaceboundarytype"
+ || anArg == "-faceboundarytype"
+ || anArg == "-setboundarytype"
+ || anArg == "-boundarytype"
+ || aCmdName == "vshowfaceboundary")
+ {
+ aChangeSet->TypeOfFaceBoundaryLine = Graphic3d_Aspects::DefaultLineTypeForPattern (aLinePattern);
+ aChangeSet->ToSetTypeOfFaceBoundaryLine = 1;
+ }
else
{
- aChangeSet->TypeOfLine = aLineType;
+ aChangeSet->StippleLinePattern = aLinePattern;
aChangeSet->ToSetTypeOfLine = 1;
}
}
aChangeSet->ToSetTypeOfLine = -1;
}
}
+ else if (anArg == "-setstipplelinefactor"
+ || anArg == "-setstipplefactor"
+ || anArg == "-setlinefactor"
+ || anArg == "-stipplelinefactor"
+ || anArg == "-stipplefactor"
+ || anArg == "-linefactor")
+ {
+ if (aChangeSet->ToSetTypeOfLine == -1)
+ {
+ Message::SendFail() << "Error: -setStippleLineFactor requires -setLineType";
+ return 1;
+ }
+ if (++anArgIter >= theArgNb)
+ {
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
+ return 1;
+ }
+ aChangeSet->StippleLineFactor = (uint16_t )Draw::Atoi (theArgVec[anArgIter]);
+ }
else if (anArg == "-setmarkertype"
|| anArg == "-markertype"
|| anArg == "-setpointtype"
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
if (!ViewerTest::ParseMarkerType (theArgVec[anArgIter], aChangeSet->TypeOfMarker, aChangeSet->MarkerImage))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetMarkerSize = 1;
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetMaterial = 1;
- aChangeSet->MatName = theArgVec[anArgIter];
- aChangeSet->Material = Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString());
+ aChangeSet->MatName = theArgVec[anArgIter];
+ if (!Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString(), aChangeSet->Material))
+ {
+ Message::SendFail() << "Syntax error: unknown material '" << aChangeSet->MatName << "'.";
+ return 1;
+ }
}
else if (anArg == "-unsetmat"
|| anArg == "-unsetmaterial")
{
if (isDefaults)
{
- std::cout << "Error: wrong syntax. -subshapes can not be used together with -defaults call!\n";
+ Message::SendFail() << "Error: wrong syntax. -subshapes can not be used together with -defaults call!";
return 1;
}
if (aNames.IsEmpty())
{
- std::cout << "Error: main objects should specified explicitly when -subshapes is used!\n";
+ Message::SendFail() << "Error: main objects should specified explicitly when -subshapes is used!";
return 1;
}
TopoDS_Shape aSubShape = DBRep::Get (aSubShapeName);
if (aSubShape.IsNull())
{
- std::cerr << "Error: shape " << aSubShapeName << " doesn't found!\n";
+ Message::SendFail() << "Error: shape " << aSubShapeName << " doesn't found!";
return 1;
}
aChangeSet->SubShapes.Append (aSubShape);
if (aChangeSet->SubShapes.IsEmpty())
{
- std::cerr << "Error: empty list is specified after -subshapes!\n";
+ Message::SendFail() << "Error: empty list is specified after -subshapes!";
return 1;
}
}
|| anArg == "-setfb"
|| anArg == "-fb")
{
- if (++anArgIter >= theArgNb)
+ bool toEnable = true;
+ if (!Draw::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
- return 1;
- }
- TCollection_AsciiString aValue (theArgVec[anArgIter]);
- aValue.LowerCase();
- if (aValue == "on"
- || aValue == "1")
- {
- aChangeSet->ToSetShowFreeBoundary = 1;
- }
- else if (aValue == "off"
- || aValue == "0")
- {
- aChangeSet->ToSetShowFreeBoundary = -1;
- }
- else
- {
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
+ ++anArgIter;
+ aChangeSet->ToSetShowFreeBoundary = toEnable ? 1 : -1;
}
else if (anArg == "-setfreeboundarywidth"
|| anArg == "-freeboundarywidth"
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetFreeBoundaryWidth = 1;
|| anArg == "-setfbcolor"
|| anArg == "-fbcolor")
{
- Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
- theArgVec + anArgIter + 1,
- aChangeSet->FreeBoundaryColor);
+ Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
+ theArgVec + anArgIter + 1,
+ aChangeSet->FreeBoundaryColor);
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
|| anArg == "-setisoontriang"
|| anArg == "-isoontriang")
{
- if (++anArgIter >= theArgNb)
+ bool toEnable = true;
+ if (!Draw::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
- TCollection_AsciiString aValue (theArgVec[anArgIter]);
- aValue.LowerCase();
- if (aValue == "on"
- || aValue == "1")
+ ++anArgIter;
+ aChangeSet->ToEnableIsoOnTriangulation = toEnable ? 1 : -1;
+ }
+ else if (anArg == "-setfaceboundarydraw"
+ || anArg == "-setdrawfaceboundary"
+ || anArg == "-setdrawfaceboundaries"
+ || anArg == "-setshowfaceboundary"
+ || anArg == "-setshowfaceboundaries"
+ || anArg == "-setdrawfaceedges"
+ || anArg == "-faceboundarydraw"
+ || anArg == "-drawfaceboundary"
+ || anArg == "-drawfaceboundaries"
+ || anArg == "-showfaceboundary"
+ || anArg == "-showfaceboundaries"
+ || anArg == "-drawfaceedges"
+ || anArg == "-faceboundary"
+ || anArg == "-faceboundaries"
+ || anArg == "-faceedges")
+ {
+ bool toEnable = true;
+ if (!Draw::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
+ {
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
+ return 1;
+ }
+ ++anArgIter;
+ aChangeSet->ToSetFaceBoundaryDraw = toEnable ? 1 : -1;
+ }
+ else if (anArg == "-unsetfaceboundary"
+ || anArg == "-unsetboundary")
+ {
+ aChangeSet->ToSetFaceBoundaryDraw = -1;
+ aChangeSet->ToSetFaceBoundaryColor = -1;
+ }
+ else if (anArg == "-setmostcontinuity"
+ || anArg == "-mostcontinuity")
+ {
+ TCollection_AsciiString aClassArg (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "");
+ aClassArg.LowerCase();
+ GeomAbs_Shape aClass = GeomAbs_CN;
+ if (aClassArg == "c0"
+ || aClassArg == "0")
+ {
+ aClass = GeomAbs_C0;
+ }
+ else if (aClassArg == "c1"
+ || aClassArg == "1")
+ {
+ aClass = GeomAbs_C1;
+ }
+ else if (aClassArg == "c2"
+ || aClassArg == "2")
{
- aChangeSet->ToEnableIsoOnTriangulation = 1;
+ aClass = GeomAbs_C2;
}
- else if (aValue == "off"
- || aValue == "0")
+ else if (aClassArg == "c3"
+ || aClassArg == "3")
{
- aChangeSet->ToEnableIsoOnTriangulation = 0;
+ aClass = GeomAbs_C3;
+ }
+ else if (aClassArg == "cn"
+ || aClassArg == "n")
+ {
+ aClass = GeomAbs_CN;
}
else
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
+
+ ++anArgIter;
+ aChangeSet->ToSetFaceBoundaryUpperContinuity = 1;
+ aChangeSet->FaceBoundaryUpperContinuity = aClass;
}
else if (anArg == "-setmaxparamvalue"
|| anArg == "-maxparamvalue")
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetMaxParamValue = 1;
{
if (isDefaults)
{
- std::cout << "Error: wrong syntax. -setSensitivity can not be used together with -defaults call!\n";
+ Message::SendFail() << "Error: wrong syntax. -setSensitivity can not be used together with -defaults call!";
return 1;
}
if (aNames.IsEmpty())
{
- std::cout << "Error: object and selection mode should specified explicitly when -setSensitivity is used!\n";
+ Message::SendFail() << "Error: object and selection mode should specified explicitly when -setSensitivity is used!";
return 1;
}
if (anArgIter + 2 >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetSensitivity = 1;
{
if (isDefaults)
{
- std::cout << "Error: wrong syntax. -setHatch can not be used together with -defaults call!\n";
+ Message::SendFail() << "Error: wrong syntax. -setHatch can not be used together with -defaults call!";
return 1;
}
if (aNames.IsEmpty())
{
- std::cout << "Error: object should be specified explicitly when -setHatch is used!\n";
+ Message::SendFail() << "Error: object should be specified explicitly when -setHatch is used!";
return 1;
}
if (anIntStyle < 0
|| anIntStyle >= Aspect_HS_NB)
{
- std::cout << "Error: hatch style is out of range [0, " << (Aspect_HS_NB - 1) << "]!\n";
+ Message::SendFail() << "Error: hatch style is out of range [0, " << (Aspect_HS_NB - 1) << "]!";
return 1;
}
aChangeSet->StdHatchStyle = anIntStyle;
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetShadingModel = 1;
aChangeSet->ShadingModelName = theArgVec[anArgIter];
if (!ViewerTest::ParseShadingModel (theArgVec[anArgIter], aChangeSet->ShadingModel))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aChangeSet->ToSetInterior = 1;
if (!parseInteriorStyle (theArgVec[anArgIter], aChangeSet->InteriorStyle))
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
}
aChangeSet->ToSetInterior = -1;
aChangeSet->InteriorStyle = Aspect_IS_SOLID;
}
+ else if (anArg == "-setdrawoutline"
+ || anArg == "-setdrawsilhouette"
+ || anArg == "-setoutline"
+ || anArg == "-setsilhouette"
+ || anArg == "-outline"
+ || anArg == "-outlined"
+ || anArg == "-silhouette")
+ {
+ bool toDrawOutline = true;
+ if (anArgIter + 1 < theArgNb
+ && Draw::ParseOnOff (theArgVec[anArgIter + 1], toDrawOutline))
+ {
+ ++anArgIter;
+ }
+ aChangeSet->ToSetDrawSilhouette = toDrawOutline ? 1 : -1;
+ }
else if (anArg == "-setdrawedges"
|| anArg == "-setdrawedge"
|| anArg == "-drawedges"
{
bool toDrawEdges = true;
if (anArgIter + 1 < theArgNb
- && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toDrawEdges))
+ && Draw::ParseOnOff (theArgVec[anArgIter + 1], toDrawEdges))
{
++anArgIter;
}
{
bool isQuadMode = true;
if (anArgIter + 1 < theArgNb
- && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], isQuadMode))
+ && Draw::ParseOnOff (theArgVec[anArgIter + 1], isQuadMode))
{
++anArgIter;
}
|| anArg == "-edgecolor"
|| anArg == "-edgescolor")
{
- Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
- theArgVec + anArgIter + 1,
- aChangeSet->EdgeColor);
+ Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1,
+ theArgVec + anArgIter + 1,
+ aChangeSet->EdgeColor);
if (aNbParsed == 0)
{
- std::cout << "Syntax error at '" << anArg << "'\n";
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
return 1;
}
anArgIter += aNbParsed;
aChangeSet->ToSetLineWidth = -1;
aChangeSet->LineWidth = 1.0;
aChangeSet->ToSetTypeOfLine = -1;
- aChangeSet->TypeOfLine = Aspect_TOL_SOLID;
+ aChangeSet->StippleLinePattern = 0xFFFF;
+ aChangeSet->StippleLineFactor = 1;
aChangeSet->ToSetTypeOfMarker = -1;
aChangeSet->TypeOfMarker = Aspect_TOM_PLUS;
aChangeSet->ToSetMarkerSize = -1;
aChangeSet->AlphaCutoff = 0.5f;
aChangeSet->ToSetColor = -1;
aChangeSet->Color = DEFAULT_COLOR;
+ //aChangeSet->ToSetBackFaceColor = -1; // should be reset by ToSetColor
+ //aChangeSet->BackFaceColor = DEFAULT_COLOR;
aChangeSet->ToSetMaterial = -1;
aChangeSet->Material = Graphic3d_NOM_DEFAULT;
aChangeSet->ToSetShowFreeBoundary = -1;
aChangeSet->FreeBoundaryColor = DEFAULT_FREEBOUNDARY_COLOR;
aChangeSet->ToSetFreeBoundaryWidth = -1;
aChangeSet->FreeBoundaryWidth = 1.0;
+ aChangeSet->ToEnableIsoOnTriangulation = -1;
+ //
+ aChangeSet->ToSetFaceBoundaryDraw = -1;
+ aChangeSet->ToSetFaceBoundaryUpperContinuity = -1;
+ aChangeSet->FaceBoundaryUpperContinuity = GeomAbs_CN;
+ aChangeSet->ToSetFaceBoundaryColor = -1;
+ aChangeSet->FaceBoundaryColor = Quantity_NOC_BLACK;
+ aChangeSet->ToSetFaceBoundaryWidth = -1;
+ aChangeSet->FaceBoundaryWidth = 1.0f;
+ aChangeSet->ToSetTypeOfFaceBoundaryLine = -1;
+ aChangeSet->TypeOfFaceBoundaryLine = Aspect_TOL_SOLID;
+ //
aChangeSet->ToSetHatch = -1;
aChangeSet->StdHatchStyle = -1;
aChangeSet->PathToHatchPattern.Clear();
aChangeSet->ShadingModel = Graphic3d_TOSM_DEFAULT;
aChangeSet->ToSetInterior = -1;
aChangeSet->InteriorStyle = Aspect_IS_SOLID;
+ aChangeSet->ToSetDrawSilhouette = -1;
aChangeSet->ToSetDrawEdges = -1;
aChangeSet->ToSetQuadEdges = -1;
aChangeSet->ToSetEdgeColor = -1;
aChangeSet->ToSetTypeOfEdge = -1;
aChangeSet->TypeOfEdge = Aspect_TOL_SOLID;
}
+ else if (anArg == "-dumpjson")
+ {
+ toDump = Standard_True;
+ }
+ else if (anArg == "-dumpcompact")
+ {
+ toCompactDump = Standard_False;
+ if (++anArgIter >= theArgNb && Draw::ParseOnOff (theArgVec[anArgIter + 1], toCompactDump))
+ ++anArgIter;
+ }
+ else if (anArg == "-dumpdepth")
+ {
+ if (++anArgIter >= theArgNb)
+ {
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
+ return 1;
+ }
+ aDumpDepth = Draw::Atoi (theArgVec[anArgIter]);
+ }
else
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
}
{
aDrawer->ShadingAspect()->SetMaterial (aChangeSet->Material);
}
- if (aChangeSet->ToEnableIsoOnTriangulation != -1)
+ if (aChangeSet->ToEnableIsoOnTriangulation != 0)
{
aDrawer->SetIsoOnTriangulation (aChangeSet->ToEnableIsoOnTriangulation == 1);
}
aCtx->Redisplay (aPrs, Standard_False);
}
}
+ if (toDump)
+ {
+ Standard_SStream aStream;
+ aDrawer->DumpJson (aStream, aDumpDepth);
+
+ if (toCompactDump)
+ theDI << Standard_Dump::Text (aStream);
+ else
+ theDI << Standard_Dump::FormatJson (aStream);
+ }
return 0;
}
Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast (aPrs);
if (aShapePrs.IsNull())
{
- std::cout << "Error: an object " << aName << " is not an AIS_Shape presentation!\n";
+ Message::SendFail() << "Error: an object " << aName << " is not an AIS_Shape presentation!";
return 1;
}
aColoredPrs = Handle(AIS_ColoredShape)::DownCast (aShapePrs);
{
aCtx->UnsetWidth (aPrs, Standard_False);
}
- else if (aChangeSet->ToEnableIsoOnTriangulation != -1)
+ else if (aChangeSet->ToEnableIsoOnTriangulation != 0)
{
aCtx->IsoOnTriangulation (aChangeSet->ToEnableIsoOnTriangulation == 1, aPrs);
toRedisplay = Standard_True;
{
aPrs->SynchronizeAspects();
}
+
+ if (toDump)
+ {
+ Standard_SStream aStream;
+ aDrawer->DumpJson (aStream);
+
+ theDI << aName << ": \n";
+ theDI << Standard_Dump::FormatJson (aStream);
+ theDI << "\n";
+ }
}
}
return 0;
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
if (aCtx.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
if (aCtx.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
Standard_Boolean isContextOnly = Standard_False;
Standard_Boolean toRemoveAll = Standard_False;
Standard_Boolean toPrintInfo = Standard_True;
+ Standard_Boolean toFailOnError = Standard_True;
Standard_Integer anArgIter = 1;
for (; anArgIter < theArgNb; ++anArgIter)
{
toPrintInfo = Standard_False;
}
+ else if (anArg == "-noerror"
+ || anArg == "-nofail")
+ {
+ toFailOnError = Standard_False;
+ }
else if (anUpdateTool.parseRedrawMode (anArg))
{
continue;
if (toRemoveAll
&& anArgIter < theArgNb)
{
- std::cerr << "Error: wrong syntax!\n";
+ Message::SendFail ("Error: wrong syntax!");
return 1;
}
{
for (; anArgIter < theArgNb; ++anArgIter)
{
- TCollection_AsciiString aName = theArgVec[anArgIter];
- Handle(AIS_InteractiveObject) anIO;
- if (!GetMapOfAIS().Find2 (aName, anIO))
+ const TCollection_AsciiString aName (theArgVec[anArgIter]);
+ if (aName.Search ("*") != -1)
{
- theDI << aName << " was not bound to some object.\n";
+ for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName aPrsIter (GetMapOfAIS()); aPrsIter.More(); aPrsIter.Next())
+ {
+ if (aPrsIter.Key1()->GetContext() != aCtx)
+ {
+ continue;
+ }
+ const TCollection_AsciiString aCheck = TCollection_AsciiString ("string match '") + aName + "' '" + aPrsIter.Key2() + "'";
+ if (theDI.Eval (aCheck.ToCString()) == 0
+ && *theDI.Result() == '1')
+ {
+ anIONameList.Append (aPrsIter.Key2());
+ }
+ }
+ theDI.Reset();
continue;
}
- if (anIO->GetContext() != aCtx)
+ Handle(AIS_InteractiveObject) anIO;
+ if (!GetMapOfAIS().Find2 (aName, anIO))
{
- theDI << aName << " was not displayed in current context.\n";
- theDI << "Please activate view with this object displayed and try again.\n";
- continue;
+ if (toFailOnError)
+ {
+ Message::SendFail() << "Syntax error: '" << aName << "' was not bound to some object.";
+ return 1;
+ }
+ }
+ else if (anIO->GetContext() != aCtx)
+ {
+ if (toFailOnError)
+ {
+ Message::SendFail() << "Syntax error: '" << aName << "' was not displayed in current context.\n"
+ << "Please activate view with this object displayed and try again.";
+ return 1;
+ }
+ }
+ else
+ {
+ anIONameList.Append (aName);
}
-
- anIONameList.Append (aName);
- continue;
}
}
else if (aCtx->NbSelected() > 0)
aCtx->Remove (anIO, Standard_False);
if (toPrintInfo)
{
- theDI << anIter.Value() << " was removed\n";
+ theDI << anIter.Value() << " ";
}
if (!isContextOnly)
{
ViewerTest_AutoUpdater anUpdateTool (aCtx, aView);
if (aCtx.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
Standard_Integer anArgIter = 1;
Standard_Boolean toEraseInView = Standard_False;
+ Standard_Boolean toFailOnError = Standard_True;
TColStd_SequenceOfAsciiString aNamesOfEraseIO;
for (; anArgIter < theArgNb; ++anArgIter)
{
{
toEraseInView = Standard_True;
}
+ else if (anArgCase == "-noerror"
+ || anArgCase == "-nofail")
+ {
+ toFailOnError = Standard_False;
+ }
else
{
aNamesOfEraseIO.Append (theArgVec[anArgIter]);
if (!aNamesOfEraseIO.IsEmpty() && toEraseAll)
{
- std::cerr << "Error: wrong syntax, " << theArgVec[0] << " too much arguments.\n";
+ Message::SendFail() << "Error: wrong syntax, " << theArgVec[0] << " too much arguments.";
return 1;
}
if (!aNamesOfEraseIO.IsEmpty())
{
// Erase named objects
- for (Standard_Integer anIter = 1; anIter <= aNamesOfEraseIO.Length(); ++anIter)
+ NCollection_IndexedDataMap<Handle(AIS_InteractiveObject), TCollection_AsciiString> aPrsList;
+ for (TColStd_SequenceOfAsciiString::Iterator anIter (aNamesOfEraseIO); anIter.More(); anIter.Next())
{
- TCollection_AsciiString aName = aNamesOfEraseIO.Value (anIter);
- Handle(AIS_InteractiveObject) anIO;
- if (!GetMapOfAIS().Find2 (aName, anIO))
+ const TCollection_AsciiString& aName = anIter.Value();
+ if (aName.Search ("*") != -1)
{
- continue;
+ for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName aPrsIter (GetMapOfAIS()); aPrsIter.More(); aPrsIter.Next())
+ {
+ const TCollection_AsciiString aCheck = TCollection_AsciiString ("string match '") + aName + "' '" + aPrsIter.Key2() + "'";
+ if (theDI.Eval (aCheck.ToCString()) == 0
+ && *theDI.Result() == '1')
+ {
+ aPrsList.Add (aPrsIter.Key1(), aPrsIter.Key2());
+ }
+ }
+ theDI.Reset();
}
-
- theDI << aName << " ";
- if (!anIO.IsNull())
+ else
{
- if (toEraseInView)
+ Handle(AIS_InteractiveObject) anIO;
+ if (!GetMapOfAIS().Find2 (aName, anIO))
{
- aCtx->SetViewAffinity (anIO, aView, Standard_False);
+ if (toFailOnError)
+ {
+ Message::SendFail() << "Syntax error: '" << aName << "' is not found";
+ return 1;
+ }
}
else
{
- aCtx->Erase (anIO, Standard_False);
+ aPrsList.Add (anIO, aName);
}
}
}
+
+ for (NCollection_IndexedDataMap<Handle(AIS_InteractiveObject), TCollection_AsciiString>::Iterator anIter (aPrsList); anIter.More(); anIter.Next())
+ {
+ theDI << anIter.Value() << " ";
+ if (toEraseInView)
+ {
+ aCtx->SetViewAffinity (anIter.Key(), aView, Standard_False);
+ }
+ else
+ {
+ aCtx->Erase (anIter.Key(), Standard_False);
+ }
+ }
}
else if (!toEraseAll && aCtx->NbSelected() > 0)
{
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
if (aCtx.IsNull())
{
- std::cerr << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
}
if (anArgIter < theArgNb)
{
- std::cout << theArgVec[0] << "Error: wrong syntax\n";
+ Message::SendFail() << theArgVec[0] << "Error: wrong syntax";
return 1;
}
Bnd_Box aBox;
for (PrsMgr_Presentations::Iterator aPrsIter (theObj->Presentations()); aPrsIter.More(); aPrsIter.Next())
{
- if (aPrsIter.Value().Mode() != theDispMode)
+ if (aPrsIter.Value()->Mode() != theDispMode)
continue;
- aBox = aPrsIter.Value().Presentation()->Presentation()->MinMaxValues();
+ aBox = aPrsIter.Value()->MinMaxValues();
}
gp_Pnt aMin = aBox.CornerMin();
gp_Pnt aMax = aBox.CornerMax();
ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
if (aCtx.IsNull())
{
- std::cout << "Error: no active view!\n";
+ Message::SendFail ("Error: no active view!");
return 1;
}
{
if (++anArgIter >= theArgNb)
{
- std::cout << "Error: wrong syntax at " << anArg << "\n";
+ Message::SendFail() << "Error: wrong syntax at " << anArg;
return 1;
}
aMode = Draw::Atoi (theArgVec[anArgIter]);
Handle(AIS_InteractiveObject) anIO;
if (!GetMapOfAIS().Find2 (aName, anIO))
{
- std::cout << "Error: presentation " << aName << " does not exist\n";
+ Message::SendFail() << "Error: presentation " << aName << " does not exist";
return 1;
}
aHighlightedMode = checkMode (aCtx, anIO, aMode);
if (aHighlightedMode == -1)
{
- std::cout << "Error: object " << aName << " has no presentation with mode " << aMode << std::endl;
+ Message::SendFail() << "Error: object " << aName << " has no presentation with mode " << aMode;
return 1;
}
bndPresentation (theDI, aCtx->MainPrsMgr(), anIO, aHighlightedMode, aName, anAction, aStyle);
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
- std::cout << "Error: no active view!\n";
+ Message::SendFail() << "Error: no active view!";
return 1;
}
}
if (aTexturedIO.IsNull())
{
- std::cout << "Syntax error: shape " << aName << " does not exists in the viewer.\n";
+ Message::SendFail() << "Syntax error: shape " << aName << " does not exists in the viewer.";
return 1;
}
}
}
}
- std::cout << "Syntax error: unexpected argument '" << aName << "'\n";
+ Message::SendFail() << "Syntax error: unexpected argument '" << aName << "'";
return 1;
}
else if (!aTexturedShape.IsNull()
}
}
}
- std::cout << "Syntax error: unexpected argument '" << aName << "'\n";
+ Message::SendFail() << "Syntax error: unexpected argument '" << aName << "'";
return 1;
}
else if (!aTexturedShape.IsNull()
}
}
}
- std::cout << "Syntax error: unexpected argument '" << aName << "'\n";
+ Message::SendFail() << "Syntax error: unexpected argument '" << aName << "'";
return 1;
}
else if (aNameCase == "-modulate")
{
bool toModulateBool = true;
if (anArgIter + 1 < theArgsNb
- && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toModulateBool))
+ && Draw::ParseOnOff (theArgVec[anArgIter + 1], toModulateBool))
{
++anArgIter;
}
}
else
{
- std::cout << "Syntax error: unexpected argument '" << aValue << "'\n";
+ Message::SendFail() << "Syntax error: unexpected argument '" << aValue << "'";
return 1;
}
}
}
else
{
- std::cout << "Syntax error: unexpected argument '" << aValue << "'\n";
+ Message::SendFail() << "Syntax error: unexpected argument '" << aValue << "'";
return 1;
}
}
{
toSetDefaults = true;
}
+ else if ((aNameCase == "-video")
+ && anArgIter + 1 < theArgsNb)
+ {
+ const TCollection_AsciiString anInput (theArgVec[++anArgIter]);
+ Handle(Graphic3d_MediaTextureSet) aMedia = Handle(Graphic3d_MediaTextureSet)::DownCast (aTextureSetOld);
+ if (aMedia.IsNull())
+ {
+ aMedia = new Graphic3d_MediaTextureSet();
+ }
+ if (aMedia->Input() != anInput)
+ {
+ aMedia->OpenInput (anInput, false);
+ }
+ else
+ {
+ if (aMedia->SwapFrames()
+ && !aCtx->CurrentViewer()->ZLayerSettings (aTexturedIO->ZLayer()).IsImmediate())
+ {
+ ViewerTest::CurrentView()->Invalidate();
+ }
+ }
+ if (aTexturedIO->Attributes()->SetupOwnShadingAspect (aCtx->DefaultDrawer())
+ && aTexturedShape.IsNull())
+ {
+ aTexturedIO->SetToUpdate();
+ }
+
+ toComputeUV = aTextureSetOld.IsNull();
+ aTexturedIO->Attributes()->ShadingAspect()->Aspect()->SetTextureMapOn (true);
+ aTexturedIO->Attributes()->ShadingAspect()->Aspect()->SetTextureSet (aMedia);
+ aTextureSetOld.Nullify();
+ }
else if (aCommandName == "vtexture"
&& (aTextureVecNew.IsEmpty()
|| aNameCase.StartsWith ("-tex")))
if (anArgIter + 1 >= theArgsNb
|| aNameCase.Length() < 5)
{
- std::cout << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'";
return 1;
}
TCollection_AsciiString aTexIndexStr = aNameCase.SubString (5, aNameCase.Length());
if (!aTexIndexStr.IsIntegerValue())
{
- std::cout << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'";
return 1;
}
if (aTexIndex >= Graphic3d_TextureUnit_NB
|| aTexIndex >= aCtx->CurrentViewer()->Driver()->InquireLimit (Graphic3d_TypeOfLimit_MaxCombinedTextureUnits))
{
- std::cout << "Error: too many textures specified\n";
+ Message::SendFail ("Error: too many textures specified");
return 1;
}
const Standard_Integer aValue = aTexName.IntegerValue();
if (aValue < 0 || aValue >= Graphic3d_Texture2D::NumberOfTextures())
{
- std::cout << "Syntax error: texture with ID " << aValue << " is undefined!\n";
+ Message::SendFail() << "Syntax error: texture with ID " << aValue << " is undefined!";
return 1;
}
aTextureVecNew.SetValue (aTexIndex, new Graphic3d_Texture2Dmanual (Graphic3d_NameOfTexture2D (aValue)));
{
if (!OSD_File (aTexName).Exists())
{
- std::cout << "Syntax error: non-existing image file has been specified '" << aTexName << "'.\n";
+ Message::SendFail() << "Syntax error: non-existing image file has been specified '" << aTexName << "'.";
return 1;
}
aTextureVecNew.SetValue (aTexIndex, new Graphic3d_Texture2Dmanual (aTexName));
}
else
{
- std::cout << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'";
return 1;
}
}
{
if (theArgNb < 2)
{
- std::cerr << theArgVec[0] << "Error: wrong number of arguments.\n";
+ Message::SendFail ("Syntax error: wrong number of arguments.");
return 1;
}
+ if (theArgNb == 2
+ && TCollection_AsciiString (theArgVec[1]) == "*")
+ {
+ // alias
+ return VDisplayAll (theDI, 1, theArgVec);
+ }
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
anObjDispMode = Draw::Atoi (theArgVec [anArgIter]);
}
- else if (aNameCase == "-highmode"
+ else if (aNameCase == "-himode"
+ || aNameCase == "-highmode"
|| aNameCase == "-highlightmode")
{
if (++anArgIter >= theArgNb)
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
if (++anArgIter >= theArgNb
|| !aTrsfPers.IsNull())
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
aPersFlags.LowerCase();
if (!parseTrsfPersFlag (aPersFlags, aTrsfPersFlags))
{
- std::cerr << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".\n";
+ Message::SendFail() << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".";
return 1;
}
if (anArgIter + 2 >= theArgNb
|| aTrsfPers.IsNull())
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
if (!aX.IsRealValue()
|| !aY.IsRealValue())
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
if (anArgIter + 1 < theArgNb)
aTrsfPers = Graphic3d_TransformPers::FromDeprecatedParams (aTrsfPers->Mode(), aPnt);
}
}
- else if (aNameCase == "-layer")
+ else if (aNameCase == "-layer"
+ || aNameCase == "-zlayer")
{
- if (++anArgIter >= theArgNb)
- {
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
- return 1;
- }
-
- TCollection_AsciiString aValue (theArgVec[anArgIter]);
- if (!aValue.IsIntegerValue())
+ ++anArgIter;
+ if (anArgIter >= theArgNb
+ || !ViewerTest::ParseZLayer (theArgVec[anArgIter], aZLayer)
+ || aZLayer == Graphic3d_ZLayerId_UNKNOWN)
{
- std::cerr << "Error: wrong syntax at " << aName << ".\n";
+ Message::SendFail() << "Error: wrong syntax at " << aName << ".";
return 1;
}
-
- aZLayer = aValue.IntegerValue();
}
else if (aNameCase == "-view"
|| aNameCase == "-inview")
if (aNamesOfDisplayIO.IsEmpty())
{
- std::cerr << theArgVec[0] << "Error: wrong number of arguments.\n";
+ Message::SendFail ("Syntax error: wrong number of arguments.");
return 1;
}
}
if (anObjDispMode != -2)
{
- aShape->SetDisplayMode (anObjDispMode);
+ if (anObjDispMode == -1)
+ {
+ aShape->UnsetDisplayMode();
+ }
+ if (!aShape->AcceptDisplayMode (anObjDispMode))
+ {
+ Message::SendFail() << "Syntax error: " << aShape->DynamicType()->Name() << " rejects " << anObjDispMode << " display mode";
+ return 1;
+ }
+ else
+ {
+ aShape->SetDisplayMode (anObjDispMode);
+ }
}
if (anObjHighMode != -2)
{
+ if (anObjHighMode != -1
+ && !aShape->AcceptDisplayMode (anObjHighMode))
+ {
+ Message::SendFail() << "Syntax error: " << aShape->DynamicType()->Name() << " rejects " << anObjHighMode << " display mode";
+ return 1;
+ }
aShape->SetHilightMode (anObjHighMode);
}
}
else
{
- std::cerr << "Error: object with name '" << aName << "' does not exist!\n";
+ Message::SendFail() << "Error: object with name '" << aName << "' does not exist!";
}
continue;
}
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << theArgVec[0] << "AIS context is not available.\n";
+ Message::SendFail ("Syntax error: AIS context is not available.");
return 1;
}
Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
if (aContextAIS.IsNull())
{
- std::cout << theArgVec[0] << "AIS context is not available.\n";
+ Message::SendFail ("Syntax error: AIS context is not available.");
return 1;
}
if (theArgsNb < 2)
{
- std::cout << theArgVec[0] << ": insufficient arguments. Type help for more information.\n";
+ Message::SendFail ("Syntax error: insufficient arguments. Type help for more information.");
return 1;
}
GetMapOfAIS().Find2 (aName, anAISObj);
if (anAISObj.IsNull())
{
- std::cout << theArgVec[0] << ": no AIS interactive object named \"" << aName << "\".\n";
+ Message::SendFail() << theArgVec[0] << ": no AIS interactive object named \"" << aName << "\".";
return 1;
}
}
else if (theObj->Type() == AIS_KOI_Relation)
{
- // AIS_Dimention and AIS_Relation
- Handle(AIS_Relation) aRelation = Handle(AIS_Relation)::DownCast (theObj);
+ // PrsDim_Dimention and AIS_Relation
+ Handle(PrsDim_Relation) aRelation = Handle(PrsDim_Relation)::DownCast (theObj);
switch (aRelation->KindOfDimension())
{
- case AIS_KOD_PLANEANGLE: theDI << " AIS_AngleDimension"; break;
- case AIS_KOD_LENGTH: theDI << " AIS_Chamf2/3dDimension/AIS_LengthDimension"; break;
- case AIS_KOD_DIAMETER: theDI << " AIS_DiameterDimension"; break;
- case AIS_KOD_ELLIPSERADIUS: theDI << " AIS_EllipseRadiusDimension"; break;
- //case AIS_KOD_FILLETRADIUS: theDI << " AIS_FilletRadiusDimension "; break;
- case AIS_KOD_OFFSET: theDI << " AIS_OffsetDimension"; break;
- case AIS_KOD_RADIUS: theDI << " AIS_RadiusDimension"; break;
+ case PrsDim_KOD_PLANEANGLE: theDI << " PrsDim_AngleDimension"; break;
+ case PrsDim_KOD_LENGTH: theDI << " PrsDim_Chamf2/3dDimension/PrsDim_LengthDimension"; break;
+ case PrsDim_KOD_DIAMETER: theDI << " PrsDim_DiameterDimension"; break;
+ case PrsDim_KOD_ELLIPSERADIUS: theDI << " PrsDim_EllipseRadiusDimension"; break;
+ //case PrsDim_KOD_FILLETRADIUS: theDI << " PrsDim_FilletRadiusDimension "; break;
+ case PrsDim_KOD_OFFSET: theDI << " PrsDim_OffsetDimension"; break;
+ case PrsDim_KOD_RADIUS: theDI << " PrsDim_RadiusDimension"; break;
default: theDI << " UNKNOWN dimension"; break;
}
}
Handle(AIS_InteractiveContext) aCtx = TheAISContext();
if (aCtx.IsNull())
{
- std::cerr << "Error: No opened viewer!\n";
+ Message::SendFail ("Error: No opened viewer!");
return 1;
}
SelectMgr_SelectingVolumeManager aMgr = aSelector->GetManager();
for (Standard_Integer aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
- const SelectMgr_SortCriterion& aPickData = aSelector->PickedData (aPickIter);
- const Handle(SelectBasics_SensitiveEntity)& anEntity = aSelector->PickedEntity (aPickIter);
- Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
- Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
- TCollection_AsciiString aName = GetMapOfAIS().Find1 (anObj);
+ const SelectMgr_SortCriterion& aPickData = aSelector->PickedData (aPickIter);
+ const Handle(Select3D_SensitiveEntity)& anEntity = aSelector->PickedEntity (aPickIter);
+ const Handle(SelectMgr_EntityOwner)& anOwner = anEntity->OwnerId();
+ Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
+
+ TCollection_AsciiString aName;
+ GetMapOfAIS().Find1 (anObj, aName);
aName.LeftJustify (20, ' ');
char anInfoStr[512];
- Sprintf (anInfoStr,
- " Depth: %g Distance: %g Point: %g %g %g",
- aPickData.Depth,
- aPickData.MinDist,
- aPickData.Point.X(), aPickData.Point.Y(), aPickData.Point.Z());
+ if (aPickData.Normal.SquareModulus() > ShortRealEpsilon())
+ {
+ Sprintf (anInfoStr,
+ " Depth: %g Distance: %g Point: %g %g %g Normal: %g %g %g",
+ aPickData.Depth,
+ aPickData.MinDist,
+ aPickData.Point.X(), aPickData.Point.Y(), aPickData.Point.Z(),
+ aPickData.Normal.x(), aPickData.Normal.y(), aPickData.Normal.z());
+ }
+ else
+ {
+ Sprintf (anInfoStr,
+ " Depth: %g Distance: %g Point: %g %g %g",
+ aPickData.Depth,
+ aPickData.MinDist,
+ aPickData.Point.X(), aPickData.Point.Y(), aPickData.Point.Z());
+ }
theDI << " " << aName
<< anInfoStr
<< " (" << anEntity->DynamicType()->Name() << ")"
// handle whole object selection
if (anOwner == anObj->GlobalSelOwner())
{
- TCollection_AsciiString aName = GetMapOfAIS().Find1 (anObj);
+ TCollection_AsciiString aName;
+ GetMapOfAIS().Find1 (anObj, aName);
aName.LeftJustify (20, ' ');
theDI << aName << " ";
objInfo (aDetected, anObj, theDI);
const Standard_Integer aNbToReach = theResArray->Length();
if (aNbToReach > 1)
{
- std::cout << " WARNING : Pick with Shift+ MB1 for Selection of more than 1 object\n";
+ Message::SendWarning ("WARNING : Pick with Shift+ MB1 for Selection of more than 1 object");
}
// step 1: prepare the data
{
++aNbPickFail;
}
- std::cout << "NbPicked = " << aNbPickGood << " | Nb Pick Fail :" << aNbPickFail << "\n";
+ Message::SendInfo() << "NbPicked = " << aNbPickGood << " | Nb Pick Fail :" << aNbPickFail;
}
// step3 get result.
else if (aShapeArg == "solid") aShapeType = TopAbs_SOLID;
else
{
- std::cout << "Syntax error at '" << argv[1] << "'\n";
+ Message::SendFail() << "Syntax error at '" << argv[1] << "'";
return 1;
}
}
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull())
{
- std::cout << "Error: AIS context is not available.\n";
+ Message::SendFail ("Error: AIS context is not available.");
return 1;
}
{
aContext->RemoveFilters();
}
+ else if (anArg == "-contextfilter" && anArgIter + 1 < theArgc)
+ {
+ TCollection_AsciiString aVal (theArgv[++anArgIter]);
+ aVal.LowerCase();
+ if (aVal == "and")
+ {
+ aContext->SetFilterType (SelectMgr_FilterType_AND);
+ }
+ else if (aVal == "or")
+ {
+ aContext->SetFilterType (SelectMgr_FilterType_OR);
+ }
+ else
+ {
+ Message::SendFail() << "Syntax error: wrong command attribute value '" << aVal << "'";
+ return 1;
+ }
+ }
else if (anArg == "-type"
&& anArgIter + 1 < theArgc)
{
TopAbs_ShapeEnum aShapeType = TopAbs_COMPOUND;
if (!TopAbs::ShapeTypeFromString (aVal.ToCString(), aShapeType))
{
- std::cout << "Syntax error: wrong command attribute value '" << aVal << "'\n";
+ Message::SendFail() << "Syntax error: wrong command attribute value '" << aVal << "'";
+ return 1;
+ }
+
+ Handle(SelectMgr_Filter) aFilter;
+ if (aShapeType == TopAbs_SHAPE)
+ {
+ aFilter = new AIS_TypeFilter (AIS_KOI_Shape);
+ }
+ else
+ {
+ aFilter = new StdSelect_ShapeTypeFilter (aShapeType);
+ }
+ aContext->AddFilter (aFilter);
+ }
+ else if (anArg == "-secondtype"
+ && anArgIter + 1 < theArgc)
+ {
+ TCollection_AsciiString aVal (theArgv[++anArgIter]);
+ TopAbs_ShapeEnum aShapeType = TopAbs_COMPOUND;
+ if (!TopAbs::ShapeTypeFromString (aVal.ToCString(), aShapeType))
+ {
+ Message::SendFail() << "Syntax error: wrong command attribute value '" << aVal << "'";
return 1;
}
}
else
{
- std::cout << "Syntax error: unknown argument '" << theArgv[anArgIter] << "'\n";
+ Message::SendFail() << "Syntax error: unknown argument '" << theArgv[anArgIter] << "'";
return 1;
}
}
if(dimension_status == -1)
TheAISContext()->Erase(curio,Standard_False);
else {
- AIS_KindOfDimension KOD = Handle(AIS_Relation)::DownCast (curio)->KindOfDimension();
- if ((dimension_status==0 && KOD == AIS_KOD_NONE)||
- (dimension_status==1 && KOD != AIS_KOD_NONE))
+ PrsDim_KindOfDimension KOD = Handle(PrsDim_Relation)::DownCast (curio)->KindOfDimension();
+ if ((dimension_status==0 && KOD == PrsDim_KOD_NONE)||
+ (dimension_status==1 && KOD != PrsDim_KOD_NONE))
TheAISContext()->Erase(curio,Standard_False);
}
}
if(dimension_status == -1)
TheAISContext()->Display(curio,Standard_False);
else {
- AIS_KindOfDimension KOD = Handle(AIS_Relation)::DownCast (curio)->KindOfDimension();
- if ((dimension_status==0 && KOD == AIS_KOD_NONE)||
- (dimension_status==1 && KOD != AIS_KOD_NONE))
+ PrsDim_KindOfDimension KOD = Handle(PrsDim_Relation)::DownCast (curio)->KindOfDimension();
+ if ((dimension_status==0 && KOD == PrsDim_KOD_NONE)||
+ (dimension_status==1 && KOD != PrsDim_KOD_NONE))
TheAISContext()->Display(curio,Standard_False);
}
static Standard_Integer vr(Draw_Interpretor& , Standard_Integer , const char** a)
{
- ifstream s(a[1]);
+ std::ifstream s(a[1]);
BRep_Builder builder;
TopoDS_Shape shape;
BRepTools::Read(shape, s, builder);
if (aView.IsNull()
|| aViewer.IsNull())
{
- std::cerr << "No active viewer!\n";
+ Message::SendFail ("Error: No active viewer!");
return 1;
}
ViewerTest_CmdParser aCmd;
- aCmd.AddDescription ("Adjusts parameters of material BSDF:");
+ aCmd.SetDescription ("Adjusts parameters of material BSDF:");
aCmd.AddOption ("print|echo|p", "Prints BSDF");
}
// find object
- TCollection_AsciiString aName (aCmd.Arg ("", 0).c_str());
+ TCollection_AsciiString aName (aCmd.Arg (ViewerTest_CmdParser::THE_UNNAMED_COMMAND_OPTION_KEY, 0).c_str());
Handle(AIS_InteractiveObject) anIObj;
if (!GetMapOfAIS().Find2 (aName, anIObj))
{
- std::cerr << "Use 'vdisplay' before\n";
+ Message::SendFail ("Error: no active viewer");
return 1;
}
{
if (theArgNb < 2)
{
- std::cerr << theArgVec[0] << "Error: wrong number of arguments.\n";
+ Message::SendFail ("Syntax error: wrong number of arguments.");
return 1;
}
}
if (aShape.IsNull())
{
- std::cout << "Syntax error: presentation '" << aName << "' not found\n";
+ Message::SendFail() << "Syntax error: presentation '" << aName << "' not found";
return 1;
}
__FILE__, VUpdate, group);
theCommands.Add("verase",
- "verase [-noupdate|-update] [-local] [name1] ... [name n]"
+ "verase [-noupdate|-update] [-local] [name1] ... [name n] [-noerror]"
"\n\t\t: Erases selected or named objects."
"\n\t\t: If there are no selected or named objects the whole viewer is erased."
"\n\t\t: Option -local enables erasing of selected or named objects without"
- "\n\t\t: closing local selection context.",
+ "\n\t\t: closing local selection context."
+ "\n\t\t: Option -noerror prevents exception on non-existing objects.",
__FILE__, VErase, group);
theCommands.Add("vremove",
- "vremove [-noupdate|-update] [-context] [-all] [-noinfo] [name1] ... [name n]"
+ "vremove [-noupdate|-update] [-context] [-all] [-noinfo] [name1] ... [name n] [-noerror]"
"or vremove [-context] -all to remove all objects"
"\n\t\t: Removes selected or named objects."
"\n\t\t If -context is in arguments, the objects are not deleted"
"\n\t\t: closing local selection context. Empty local selection context will be"
"\n\t\t: closed."
"\n\t\t: Option -noupdate suppresses viewer redraw call."
- "\n\t\t: Option -noinfo suppresses displaying the list of removed objects.",
+ "\n\t\t: Option -noinfo suppresses displaying the list of removed objects."
+ "\n\t\t: Option -noerror prevents exception on non-existing objects.",
__FILE__, VRemove, group);
theCommands.Add("vdonly",
__FILE__,VDispMode,group);
theCommands.Add("vdir",
- "Lists all objects displayed in 3D viewer",
+ "vdir [mask] [-list]"
+ "\n\t\t: Lists all objects displayed in 3D viewer"
+ "\n\t\t: mask - name filter like prefix*"
+ "\n\t\t: -list - format list with new-line per name; OFF by default",
__FILE__,VDir,group);
#ifdef HAVE_FREEIMAGE
"vdump <filename>." DUMP_FORMATS " [-width Width -height Height]"
"\n\t\t: [-buffer rgb|rgba|depth=rgb]"
"\n\t\t: [-stereo mono|left|right|blend|sideBySide|overUnder=mono]"
+ "\n\t\t: [-xrPose base|head|handLeft|handRight=base]"
"\n\t\t: [-tileSize Size=0]"
"\n\t\t: Dumps content of the active view into image file",
__FILE__,VDump,group);
__FILE__,VSubInt,group);
theCommands.Add("vaspects",
- "vaspects [-noupdate|-update] [name1 [name2 [...]] | -defaults]"
- "\n\t\t: [-setVisibility 0|1]"
- "\n\t\t: [-setColor ColorName] [-setcolor R G B] [-unsetColor]"
- "\n\t\t: [-setMaterial MatName] [-unsetMaterial]"
- "\n\t\t: [-setTransparency Transp] [-unsetTransparency]"
- "\n\t\t: [-setWidth LineWidth] [-unsetWidth]"
- "\n\t\t: [-setLineType {solid|dash|dot|dotDash}] [-unsetLineType]"
- "\n\t\t: [-setMarkerType {.|+|x|O|xcircle|pointcircle|ring1|ring2|ring3|ball|ImagePath}]"
+ "vaspects [-noupdate|-update] [name1 [name2 [...]] | -defaults] [-subshapes subname1 [subname2 [...]]]"
+ "\n\t\t: [-visibility {0|1}]"
+ "\n\t\t: [-color {ColorName | R G B}] [-unsetColor]"
+ "\n\t\t: [-backfaceColor Color]"
+ "\n\t\t: [-material MatName] [-unsetMaterial]"
+ "\n\t\t: [-transparency Transp] [-unsetTransparency]"
+ "\n\t\t: [-width LineWidth] [-unsetWidth]"
+ "\n\t\t: [-lineType {solid|dash|dot|dotDash|0xHexPattern} [-stippleFactor factor]]"
+ "\n\t\t: [-unsetLineType]"
+ "\n\t\t: [-markerType {.|+|x|O|xcircle|pointcircle|ring1|ring2|ring3|ball|ImagePath}]"
"\n\t\t: [-unsetMarkerType]"
- "\n\t\t: [-setMarkerSize Scale] [-unsetMarkerSize]"
- "\n\t\t: [-freeBoundary {off/on | 0/1}]"
- "\n\t\t: [-setFreeBoundaryWidth Width] [-unsetFreeBoundaryWidth]"
- "\n\t\t: [-setFreeBoundaryColor {ColorName | R G B}] [-unsetFreeBoundaryColor]"
- "\n\t\t: [-subshapes subname1 [subname2 [...]]]"
- "\n\t\t: [-isoontriangulation 0|1]"
- "\n\t\t: [-setMaxParamValue {value}]"
- "\n\t\t: [-setSensitivity {selection_mode} {value}]"
- "\n\t\t: [-setShadingModel {color|flat|gouraud|phong}]"
+ "\n\t\t: [-markerSize Scale] [-unsetMarkerSize]"
+ "\n\t\t: [-freeBoundary {0|1}]"
+ "\n\t\t: [-freeBoundaryWidth Width] [-unsetFreeBoundaryWidth]"
+ "\n\t\t: [-freeBoundaryColor {ColorName | R G B}] [-unsetFreeBoundaryColor]"
+ "\n\t\t: [-isoOnTriangulation 0|1]"
+ "\n\t\t: [-maxParamValue {value}]"
+ "\n\t\t: [-sensitivity {selection_mode} {value}]"
+ "\n\t\t: [-shadingModel {unlit|flat|gouraud|phong|pbr|pbr_facet}]"
"\n\t\t: [-unsetShadingModel]"
- "\n\t\t: [-setInterior {solid|hatch|hidenline|point}]"
- "\n\t\t: [-unsetInterior] [-setHatch HatchStyle]"
- "\n\t\t: [-setDrawEdges {0|1}] [-setEdgeType LineType] [-setEdgeColor R G B] [-setQuadEdges {0|1}]"
- "\n\t\t: [-setAlphaMode {opaque|mask|blend|blendauto} [alphaCutOff=0.5]]"
+ "\n\t\t: [-interior {solid|hatch|hidenline|point}] [-setHatch HatchStyle]"
+ "\n\t\t: [-unsetInterior]"
+ "\n\t\t: [-faceBoundaryDraw {0|1}] [-mostContinuity {c0|c1|c2|c3|cn}]"
+ "\n\t\t: [-faceBoundaryWidth LineWidth] [-faceBoundaryColor R G B] [-faceBoundaryType LineType]"
+ "\n\t\t: [-drawEdges {0|1}] [-edgeType LineType] [-edgeColor R G B] [-quadEdges {0|1}]"
+ "\n\t\t: [-drawSilhouette {0|1}]"
+ "\n\t\t: [-alphaMode {opaque|mask|blend|blendauto} [alphaCutOff=0.5]]"
+ "\n\t\t: [-dumpJson]"
+ "\n\t\t: [-dumpCompact {0|1}]"
+ "\n\t\t: [-dumpDepth depth]"
"\n\t\t: Manage presentation properties of all, selected or named objects."
- "\n\t\t: When -subshapes is specified than following properties will be"
- "\n\t\t: assigned to specified sub-shapes."
+ "\n\t\t: When -subshapes is specified than following properties will be assigned to specified sub-shapes."
"\n\t\t: When -defaults is specified than presentation properties will be"
"\n\t\t: assigned to all objects that have not their own specified properties"
"\n\t\t: and to all objects to be displayed in the future."
- "\n\t\t: If -defaults is used there should not be any objects' names and -subshapes specifier.",
+ "\n\t\t: If -defaults is used there should not be any objects' names nor -subshapes specifier."
+ "\n\t\t: See also vlistcolors and vlistmaterials to list named colors and materials"
+ "\n\t\t: accepted by arguments -material and -color",
__FILE__,VAspects,group);
theCommands.Add("vsetcolor",
"\n\t\t: Alias for vaspects [name] -unsetEdgeType.",
__FILE__, VAspects, group);
+ theCommands.Add ("vshowfaceboundary",
+ "vshowfaceboundary [name]"
+ "\n\t\t: Alias for vaspects [name] -setFaceBoundaryDraw on",
+ __FILE__, VAspects, group);
+
theCommands.Add("vsensdis",
"vsensdis : Display active entities (sensitive entities of one of the standard types corresponding to active selection modes)."
"\n\t\t: Standard entity types are those defined in Select3D package:"
__FILE__,vr, group);
theCommands.Add("vselfilter",
- "vselfilter [-type {VERTEX|EDGE|WIRE|FACE|SHAPE|SHELL|SOLID}] [-clear]"
+ "vselfilter [-contextfilter {AND|OR}]"
+ "\n [-type {VERTEX|EDGE|WIRE|FACE|SHAPE|SHELL|SOLID}]"
+ "\n [-secondtype {VERTEX|EDGE|WIRE|FACE|SHAPE|SHELL|SOLID}]"
+ "\n [-clear]"
"\nSets selection shape type filter in context or remove all filters."
+ "\n : Option -contextfilter : To define a selection filter for two or more types of entity,"
+ "\n use value AND (OR by default)."
"\n : Option -type set type of selection filter. Filters are applyed with Or combination."
"\n : Option -clear remove all filters in context",
__FILE__,VSelFilter,group);
#include <DBRep.hxx>
#include <TopoDS_Face.hxx>
#include <gp_Pln.hxx>
-#include <AIS_KindOfSurface.hxx>
#include <BRepOffsetAPI_DraftAngle.hxx>
#include <Precision.hxx>
#include <BRepAlgo.hxx>
#include <OSD_Environment.hxx>
#include <DrawTrSurf.hxx>
-//#include <DbgTools.hxx>
-//#include <FeatAlgo_MakeLinearForm.hxx>
-
-
-
//=======================================================================
//function : IsValid
Standard_Boolean ToCheck = Standard_True;
if (!checkValid.IsEmpty()) {
#ifdef OCCT_DEBUG
- cout <<"DONT_SWITCH_IS_VALID positionnee a :"<<checkValid.ToCString()<<"\n";
+ std::cout <<"DONT_SWITCH_IS_VALID positionnee a :"<<checkValid.ToCString()<<"\n";
#endif
if ( checkValid=="true" || checkValid=="TRUE" ) {
ToCheck= Standard_False;
}
} else {
#ifdef OCCT_DEBUG
- cout <<"DONT_SWITCH_IS_VALID non positionne\n";
+ std::cout <<"DONT_SWITCH_IS_VALID non positionne\n";
#endif
}
Standard_Boolean IsValid = Standard_True;
anAngle = 2*M_PI * anAngle / 360.0;
gp_Pln aPln;
Handle( Geom_Surface )aSurf;
- AIS_KindOfSurface aSurfType;
+ PrsDim_KindOfSurface aSurfType;
Standard_Real Offset;
gp_Dir aDir;
if(argc > 4) { // == 5
}
TopoDS_Face face2 = TopoDS::Face(Plane);
- if(!AIS::GetPlaneFromFace(face2, aPln, aSurf, aSurfType, Offset))
+ if(!PrsDim::GetPlaneFromFace(face2, aPln, aSurf, aSurfType, Offset))
{
di << "TEST : Can't find plane\n";
return 1;