mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028215: Visualization - define EMPTY type line for consistenct with Interior Style
Added new values Aspect_TOL_EMPTY (line type) and Aspect_TOM_EMPTY (marker type).
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <ViewerTest.hxx>
|
||||
#include <ViewerTest_CmdParser.hxx>
|
||||
|
||||
#include <Draw.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopTools_HArray1OfShape.hxx>
|
||||
#include <TColStd_HArray1OfTransient.hxx>
|
||||
@@ -173,6 +174,47 @@ Standard_Boolean ViewerTest::ParseOnOff (Standard_CString theArg,
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ParseLineType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean ViewerTest::ParseLineType (Standard_CString theArg,
|
||||
Aspect_TypeOfLine& theType)
|
||||
{
|
||||
TCollection_AsciiString aTypeStr (theArg);
|
||||
aTypeStr.LowerCase();
|
||||
if (aTypeStr == "empty")
|
||||
{
|
||||
theType = Aspect_TOL_EMPTY;
|
||||
}
|
||||
else if (aTypeStr == "solid")
|
||||
{
|
||||
theType = Aspect_TOL_SOLID;
|
||||
}
|
||||
else if (aTypeStr == "dot")
|
||||
{
|
||||
theType = Aspect_TOL_DOT;
|
||||
}
|
||||
else if (aTypeStr == "dash")
|
||||
{
|
||||
theType = Aspect_TOL_DASH;
|
||||
}
|
||||
else if (aTypeStr == "dotdash")
|
||||
{
|
||||
theType = Aspect_TOL_DOTDASH;
|
||||
}
|
||||
else
|
||||
{
|
||||
const int aTypeInt = Draw::Atoi (theArg);
|
||||
if (aTypeInt < -1 || aTypeInt >= Aspect_TOL_USERDEFINED)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
theType = (Aspect_TypeOfLine )aTypeInt;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetTypeNames
|
||||
//purpose :
|
||||
@@ -1893,27 +1935,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
|
||||
std::cout << "Error: wrong syntax at " << anArg << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aValue (theArgVec[anArgIter]);
|
||||
aValue.LowerCase();
|
||||
|
||||
if (aValue.IsEqual ("solid"))
|
||||
{
|
||||
aChangeSet->TypeOfLine = Aspect_TOL_SOLID;
|
||||
}
|
||||
else if (aValue.IsEqual ("dot"))
|
||||
{
|
||||
aChangeSet->TypeOfLine = Aspect_TOL_DOT;
|
||||
}
|
||||
else if (aValue.IsEqual ("dash"))
|
||||
{
|
||||
aChangeSet->TypeOfLine = Aspect_TOL_DASH;
|
||||
}
|
||||
else if (aValue.IsEqual ("dotdash"))
|
||||
{
|
||||
aChangeSet->TypeOfLine = Aspect_TOL_DOTDASH;
|
||||
}
|
||||
else
|
||||
if (!ViewerTest::ParseLineType (theArgVec[anArgIter], aChangeSet->TypeOfLine))
|
||||
{
|
||||
std::cout << "Error: wrong syntax at " << anArg << "\n";
|
||||
return 1;
|
||||
|
@@ -26,9 +26,11 @@
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopTools_HArray1OfShape.hxx>
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <TColStd_HArray1OfTransient.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
|
||||
|
||||
class TCollection_AsciiString;
|
||||
class V3d_View;
|
||||
class MMgt_TShared;
|
||||
@@ -187,6 +189,12 @@ public:
|
||||
//! Handles either flag specified by 0|1 or on|off.
|
||||
Standard_EXPORT static Standard_Boolean ParseOnOff (Standard_CString theArg,
|
||||
Standard_Boolean& theIsOn);
|
||||
|
||||
//! Parses line type argument.
|
||||
//! Handles either enumeration (integer) value or string constant.
|
||||
Standard_EXPORT static Standard_Boolean ParseLineType (Standard_CString theArg,
|
||||
Aspect_TypeOfLine& theType);
|
||||
|
||||
private:
|
||||
|
||||
//! Returns a window class that implements standard behavior of
|
||||
|
@@ -5270,13 +5270,10 @@ static Standard_Integer VShowFaceBoundary (Draw_Interpretor& /*di*/,
|
||||
// select appropriate line type
|
||||
if (argc == 8)
|
||||
{
|
||||
switch (Draw::Atoi (argv[7]))
|
||||
if (!ViewerTest::ParseLineType (argv[7], aLineType))
|
||||
{
|
||||
case 1: aLineType = Aspect_TOL_DASH; break;
|
||||
case 2: aLineType = Aspect_TOL_DOT; break;
|
||||
case 3: aLineType = Aspect_TOL_DOTDASH; break;
|
||||
default:
|
||||
aLineType = Aspect_TOL_SOLID;
|
||||
std::cout << "Syntax error: unknown line type '" << argv[7] << "'\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5913,31 +5910,14 @@ static int VSetEdgeType (Draw_Interpretor& theDI,
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aType = theArgs[++anIt];
|
||||
aType.UpperCase();
|
||||
|
||||
if (aType.IsEqual ("SOLID"))
|
||||
++anIt;
|
||||
Aspect_TypeOfLine aTypeEnum = Aspect_TOL_SOLID;
|
||||
if (!ViewerTest::ParseLineType (theArgs[anIt], aTypeEnum))
|
||||
{
|
||||
anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType(Aspect_TOL_SOLID);
|
||||
}
|
||||
else if (aType.IsEqual ("DASH"))
|
||||
{
|
||||
anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType(Aspect_TOL_DASH);
|
||||
}
|
||||
else if (aType.IsEqual ("DOT"))
|
||||
{
|
||||
anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType(Aspect_TOL_DOT);
|
||||
}
|
||||
else if (aType.IsEqual ("DOTDASH"))
|
||||
{
|
||||
anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType(Aspect_TOL_DOTDASH);
|
||||
}
|
||||
else
|
||||
{
|
||||
theDI << theArgs[0] << " error: wrong line type: '" << aType.ToCString() << "'.\n";
|
||||
std::cout << "Syntax error: wrong line type: '" << theArgs[anIt] << "'.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeLineType (aTypeEnum);
|
||||
}
|
||||
else if (aParam.IsEqual ("-color"))
|
||||
{
|
||||
|
@@ -4886,17 +4886,21 @@ static int VLayerLine(Draw_Interpretor& di, Standard_Integer argc, const char**
|
||||
Standard_Real X2 = Draw::Atof(argv[3]);
|
||||
Standard_Real Y2 = Draw::Atof(argv[4]);
|
||||
|
||||
Standard_Real aWidth = 0.5;
|
||||
Standard_Integer aType = 0;
|
||||
Standard_Real aTransparency = 1.0;
|
||||
Standard_Real aWidth = 0.5;
|
||||
Standard_Real aTransparency = 1.0;
|
||||
|
||||
// has width
|
||||
if (argc > 5)
|
||||
aWidth = Draw::Atof(argv[5]);
|
||||
|
||||
// has type
|
||||
if (argc > 6)
|
||||
aType = (Standard_Integer) Draw::Atoi(argv[6]);
|
||||
// select appropriate line type
|
||||
Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
|
||||
if (argc > 6
|
||||
&& !ViewerTest::ParseLineType (argv[6], aLineType))
|
||||
{
|
||||
std::cout << "Syntax error: unknown line type '" << argv[6] << "'\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// has transparency
|
||||
if (argc > 7)
|
||||
@@ -4906,26 +4910,6 @@ static int VLayerLine(Draw_Interpretor& di, Standard_Integer argc, const char**
|
||||
aTransparency = 1.0;
|
||||
}
|
||||
|
||||
// select appropriate line type
|
||||
Aspect_TypeOfLine aLineType;
|
||||
switch (aType)
|
||||
{
|
||||
case 1:
|
||||
aLineType = Aspect_TOL_DASH;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
aLineType = Aspect_TOL_DOT;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
aLineType = Aspect_TOL_DOTDASH;
|
||||
break;
|
||||
|
||||
default:
|
||||
aLineType = Aspect_TOL_SOLID;
|
||||
}
|
||||
|
||||
static Handle (V3d_LineItem) aLine;
|
||||
if (!aLine.IsNull())
|
||||
{
|
||||
|
Reference in New Issue
Block a user