Added new values Aspect_TOL_EMPTY (line type) and Aspect_TOM_EMPTY (marker type).
#define _Aspect_TypeOfLine_HeaderFile
//! Definition of line types
-//!
-//! TOL_SOLID continuous
-//! TOL_DASH dashed 2.0,1.0 (MM)
-//! TOL_DOT dotted 0.2,0.5 (MM)
-//! TOL_DOTDASH mixed 10.0,1.0,2.0,1.0 (MM)
-//! TOL_USERDEFINED defined by Users
enum Aspect_TypeOfLine
{
-Aspect_TOL_SOLID,
-Aspect_TOL_DASH,
-Aspect_TOL_DOT,
-Aspect_TOL_DOTDASH,
-Aspect_TOL_USERDEFINED
+ Aspect_TOL_EMPTY = -1, //!< hidden
+ Aspect_TOL_SOLID = 0, //!< continuous
+ Aspect_TOL_DASH, //!< dashed 2.0,1.0 (MM)
+ Aspect_TOL_DOT, //!< dotted 0.2,0.5 (MM)
+ Aspect_TOL_DOTDASH, //!< mixed 10.0,1.0,2.0,1.0 (MM)
+ Aspect_TOL_USERDEFINED //!< defined by Users
};
#endif // _Aspect_TypeOfLine_HeaderFile
#define _Aspect_TypeOfMarker_HeaderFile
//! Definition of types of markers
-//!
-//! TOM_POINT point .
-//! TOM_PLUS plus +
-//! TOM_STAR star *
-//! TOM_X cross x
-//! TOM_O circle O
-//! TOM_O_POINT a point in a circle
-//! TOM_O_PLUS a plus in a circle
-//! TOM_O_STAR a star in a circle
-//! TOM_O_X a cross in a circle
-//! TOM_RING1 a large ring
-//! TOM_RING2 a medium ring
-//! TOM_RING3 a small ring
-//! TOM_BALL a ball with 1 color and different saturations
-//! TOM_USERDEFINED defined by Users
enum Aspect_TypeOfMarker
{
-Aspect_TOM_POINT,
-Aspect_TOM_PLUS,
-Aspect_TOM_STAR,
-Aspect_TOM_X,
-Aspect_TOM_O,
-Aspect_TOM_O_POINT,
-Aspect_TOM_O_PLUS,
-Aspect_TOM_O_STAR,
-Aspect_TOM_O_X,
-Aspect_TOM_RING1,
-Aspect_TOM_RING2,
-Aspect_TOM_RING3,
-Aspect_TOM_BALL,
-Aspect_TOM_USERDEFINED
+ Aspect_TOM_EMPTY = -1, //!< hidden
+ Aspect_TOM_POINT = 0, //!< point .
+ Aspect_TOM_PLUS, //!< plus +
+ Aspect_TOM_STAR, //!< star *
+ Aspect_TOM_X, //!< cross x
+ Aspect_TOM_O, //!< circle O
+ Aspect_TOM_O_POINT, //!< a point in a circle
+ Aspect_TOM_O_PLUS, //!< a plus in a circle
+ Aspect_TOM_O_STAR, //!< a star in a circle
+ Aspect_TOM_O_X, //!< a cross in a circle
+ Aspect_TOM_RING1, //!< a large ring
+ Aspect_TOM_RING2, //!< a medium ring
+ Aspect_TOM_RING3, //!< a small ring
+ Aspect_TOM_BALL, //!< a ball with 1 color and different saturations
+ Aspect_TOM_USERDEFINED //!< defined by Users (custom image)
};
#endif // _Aspect_TypeOfMarker_HeaderFile
SpriteAKey = aNewKeyA;
}
if (theType == Aspect_TOM_POINT
+ || theType == Aspect_TOM_EMPTY
|| !aNewResource
|| (theType == Aspect_TOM_USERDEFINED && theMarkerImage.IsNull()))
{
theKeyA = theMarkerImage->GetImageAlphaId();
}
}
- else if (theType != Aspect_TOM_POINT)
+ else if (theType != Aspect_TOM_POINT
+ && theType != Aspect_TOM_EMPTY)
{
// predefined markers are defined with 0.5 step
const Standard_Integer aScale = Standard_Integer(theScale * 10.0f + 0.5f);
aPattern = 0xFF18;
break;
}
+ case Aspect_TOL_EMPTY:
case Aspect_TOL_SOLID:
{
aPattern = 0xFFFF;
}
#if !defined(GL_ES_VERSION_2_0)
- if (theType != Aspect_TOL_SOLID)
+ if (aPattern != 0xFFFF)
{
#ifdef HAVE_GL2PS
if (IsFeedback())
#endif
// Temporarily disable environment mapping
Handle(OpenGl_Texture) aTextureBack;
- if (myDrawMode <= GL_LINE_STRIP)
+ bool toDrawArray = true;
+ if (myDrawMode > GL_LINE_STRIP)
+ {
+ toDrawArray = anAspectFace->Aspect()->InteriorStyle() != Aspect_IS_EMPTY;
+ }
+ else if (myDrawMode <= GL_LINE_STRIP)
{
aTextureBack = theWorkspace->DisableTexture();
+ if (myDrawMode == GL_POINTS)
+ {
+ toDrawArray = anAspectMarker->Aspect()->Type() != Aspect_TOM_EMPTY;
+ }
+ else
+ {
+ toDrawArray = anAspectLine->Aspect()->Type() != Aspect_TOL_EMPTY;
+ }
}
- if ((myDrawMode > GL_LINE_STRIP && anAspectFace->Aspect()->InteriorStyle() != Aspect_IS_EMPTY) ||
- (myDrawMode <= GL_LINE_STRIP))
+ if (toDrawArray)
{
const bool toHilight = theWorkspace->ToHighlight();
const Standard_Boolean hasVertColor = hasColorAttrib && !toHilight;
#include <ViewerTest.hxx>
#include <ViewerTest_CmdParser.hxx>
+#include <Draw.hxx>
#include <TopLoc_Location.hxx>
#include <TopTools_HArray1OfShape.hxx>
#include <TColStd_HArray1OfTransient.hxx>
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 :
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;
#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;
//! 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
// 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;
}
}
return 1;
}
- TCollection_AsciiString aType = theArgs[++anIt];
- aType.UpperCase();
-
- if (aType.IsEqual ("SOLID"))
- {
- 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"))
+ ++anIt;
+ Aspect_TypeOfLine aTypeEnum = Aspect_TOL_SOLID;
+ if (!ViewerTest::ParseLineType (theArgs[anIt], aTypeEnum))
{
- 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"))
{
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)
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())
{
// select appropriate line type
if (argc == 9)
{
- switch (Draw::Atoi (argv[8]))
+ if (!ViewerTest::ParseLineType (argv[8], 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[8] << "'\n";
}
}