-- File: AIS_Shape.cdl
-- Created: Fri Dec 20 15:18:05 1996
-- Author: Robert COUBLANC
--- <rob@robox.paris1.matra-dtv.fr>
-- GG : GER61351 17/11/1999 Change SetColor() with a compatible Quantity_Color instead
-- the restricted NameOfColor.
-- Redefines the Color(),Material(),Transparency() methods
-- - mode 7 - Compsolid
-- - mode 8 - Compound
- LoadRecomputable(me:mutable;TheMode : Integer from Standard) is static private;
+ LoadRecomputable(me:mutable;TheMode : Integer from Standard) is static protected;
Compute(me : mutable;
aProjector : Projector from Prs3d;
// File: AIS_Shape.cxx
// Created: Fri Dec 20 17:18:37 1996
// Author: Robert COUBLANC
-// <rob@robox.paris1.matra-dtv.fr>
#define BUC60577 //GG_191099 Draw correct bounding box and Menage ...
//=======================================================================
void AIS_Shape::SetColor(const Quantity_NameOfColor aCol)
-#ifdef GER61351
{
SetColor(Quantity_Color(aCol));
}
+//=======================================================================
+//function : SetColor
+//purpose :
+//=======================================================================
+
void AIS_Shape::SetColor(const Quantity_Color &aCol)
-#endif
{
- hasOwnColor = Standard_True;
-#ifdef GER61351
if( !HasColor() && !IsTransparent() && !HasMaterial() ) {
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
}
-#else
- myOwnColor = aCol;
- if(!myDrawer->HasShadingAspect()){
- Handle(Prs3d_ShadingAspect) asp = new Prs3d_ShadingAspect();
-// retrieve the reference materials...
- if(myDrawer->HasLink()){
- const Handle(Prs3d_Drawer)& refdr = myDrawer->Link();
- Graphic3d_MaterialAspect theRefMat =
- refdr->ShadingAspect()->Aspect()->FrontMaterial();
- theRefMat.SetTransparency(myTransparency);
- asp->SetMaterial(theRefMat);
- }
-
- myDrawer->SetShadingAspect(asp);
- }
-#endif
+ hasOwnColor = Standard_True;
-#ifdef GER61351
myDrawer->ShadingAspect()->SetColor(aCol,myCurrentFacingModel);
-#else
- myDrawer->ShadingAspect()->SetColor(aCol);
-#endif
+ myDrawer->ShadingAspect()->SetTransparency(myTransparency,myCurrentFacingModel);
myDrawer->SetShadingAspectGlobal(Standard_False);
-
- Standard_Real WW = HasWidth()? Width():AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line);
+
+ const Standard_Real WW = HasWidth()? Width():AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line);
myDrawer->SetLineAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
myDrawer->SetWireAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
LoadRecomputable(0);
LoadRecomputable(2);
}
+
//=======================================================================
//function : UnsetColor
//purpose :
void AIS_Shape::UnsetColor()
{
- if(!HasColor() ){ myToRecomputeModes.Clear();
- return;}
-
+ if ( !HasColor() )
+ {
+ myToRecomputeModes.Clear();
+ return;
+ }
hasOwnColor = Standard_False;
Handle(Prs3d_LineAspect) NullAsp;
Handle(Prs3d_ShadingAspect) NullShA;
- if(!HasWidth()){
+ if(!HasWidth()) {
myDrawer->SetLineAspect(NullAsp);
myDrawer->SetWireAspect(NullAsp);
myDrawer->SetFreeBoundaryAspect(NullAsp);
myDrawer->SetUnFreeBoundaryAspect(NullAsp);
myDrawer->SetSeenLineAspect(NullAsp);
}
- else{
-#ifdef GER61351
+ else {
Quantity_Color CC;
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
myDrawer->LineAspect()->SetColor(CC);
myDrawer->UnFreeBoundaryAspect()->SetColor(CC);
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Seen,CC);
myDrawer->SeenLineAspect()->SetColor(CC);
-#else
- myDrawer->LineAspect()->SetColor(AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line));
- myDrawer->WireAspect()->SetColor(AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Wire));
- myDrawer->FreeBoundaryAspect()->SetColor(AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Free));
- myDrawer->UnFreeBoundaryAspect()->SetColor(AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_UnFree));
- myDrawer->SeenLineAspect()->SetColor(AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Seen));
-#endif
}
-
- if(myDrawer->HasShadingAspect()){
+
+ if( HasMaterial() || IsTransparent()) {
+ Graphic3d_MaterialAspect mat = AIS_GraphicTool::GetMaterial(HasMaterial()? myDrawer : myDrawer->Link());
+ if( HasMaterial() ) {
+ Quantity_Color color = myDrawer->Link()->ShadingAspect()->Color(myCurrentFacingModel);
+ mat.SetColor(color);
+ }
+ if( IsTransparent() ) {
+ Standard_Real trans = myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel);
+ mat.SetTransparency(trans);
+ }
+ myDrawer->ShadingAspect()->SetMaterial(mat,myCurrentFacingModel);
+ }
+ else {
myDrawer->SetShadingAspect(NullShA);
- }
-
+ }
+
if(!GetContext().IsNull()){
if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) P = GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(P);
-
- Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->Link()->ShadingAspect()->Aspect();
-#ifdef GER61351
- Quantity_Color CC;
- AIS_GraphicTool::GetInteriorColor(myDrawer->Link(),CC);
- a4bis->SetInteriorColor(CC);
-#else
- Quantity_NameOfColor KOL = AIS_GraphicTool::GetInteriorColor(myDrawer->Link());
- a4bis->SetInteriorColor(Quantity_Color(KOL));
-#endif
+ Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
P->SetPrimitivesAspect(a4bis);
G->SetGroupPrimitivesAspect(a4bis);
}
-}
+ }
LoadRecomputable(0);
LoadRecomputable(2);
-
}
-
//=======================================================================
//function : SetWidth
//purpose :
void AIS_Shape::SetWidth(const Standard_Real W)
{
- if(HasColor() || HasWidth()){
+ if(HasColor() || HasWidth()){
myDrawer->LineAspect()->SetWidth(W);
myDrawer->WireAspect()->SetWidth(W);
myDrawer->FreeBoundaryAspect()->SetWidth(W);
myDrawer->SeenLineAspect()->SetWidth(W);
}
else{
-#ifdef GER61351
Quantity_Color CC;
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
myDrawer->SetLineAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
myDrawer->SetUnFreeBoundaryAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Seen,CC);
myDrawer->SetSeenLineAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
-#else
- Quantity_NameOfColor KOL = AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line);
- myDrawer->SetLineAspect(new Prs3d_LineAspect(KOL,Aspect_TOL_SOLID,W));
-
- KOL = AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Wire);
- myDrawer->SetWireAspect(new Prs3d_LineAspect(KOL,Aspect_TOL_SOLID,W));
-
- KOL = AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Free);
- myDrawer->SetFreeBoundaryAspect(new Prs3d_LineAspect(KOL,Aspect_TOL_SOLID,W));
-
- KOL = AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_UnFree);
- myDrawer->SetUnFreeBoundaryAspect(new Prs3d_LineAspect(KOL,Aspect_TOL_SOLID,W));
-
- KOL = AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Seen);
- myDrawer->SetSeenLineAspect(new Prs3d_LineAspect(KOL,Aspect_TOL_SOLID,W));
-#endif
}
myOwnWidth = W;
LoadRecomputable(0); // means that it is necessary to recompute only the wireframe....
LoadRecomputable(2); // and the bounding box...
-
}
//=======================================================================
void AIS_Shape::UnsetWidth()
{
- if(myOwnWidth== 0.0){ myToRecomputeModes.Clear();
- return;}
+ if(myOwnWidth == 0.0)
+ {
+ myToRecomputeModes.Clear();
+ return;
+ }
myOwnWidth=0.0;
+
Handle(Prs3d_LineAspect) NullAsp;
-
+
if(!HasColor()){
myDrawer->SetLineAspect(NullAsp);
myDrawer->SetWireAspect(NullAsp);
LoadRecomputable(0);
}
-
//=======================================================================
//function : SetMaterial
//purpose :
//=======================================================================
+
void AIS_Shape::SetMaterial(const Graphic3d_NameOfMaterial aMat)
{
-#ifdef GER61351
if( !HasColor() && !IsTransparent() && !HasMaterial() ) {
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
}
- myDrawer->ShadingAspect()->SetMaterial(aMat,myCurrentFacingModel);
hasOwnMaterial = Standard_True;
-#else
- AIS_InteractiveObject::SetMaterial(aMat);
-#endif
+
+ myDrawer->ShadingAspect()->SetMaterial(aMat,myCurrentFacingModel);
+ myDrawer->ShadingAspect()->SetTransparency(myTransparency,myCurrentFacingModel);
+
if(!GetContext().IsNull()){
if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) P = GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(P);
-
Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
P->SetPrimitivesAspect(a4bis);
G->SetGroupPrimitivesAspect(a4bis);
}
}
myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
- myToRecomputeModes.Clear();
+ myToRecomputeModes.Clear();
}
+
//=======================================================================
//function : SetMaterial
//purpose :
//=======================================================================
+
void AIS_Shape::SetMaterial(const Graphic3d_MaterialAspect& aMat)
{
-#ifdef GER61351
if( !HasColor() && !IsTransparent() && !HasMaterial() ) {
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
}
- myDrawer->ShadingAspect()->SetMaterial(aMat,myCurrentFacingModel);
hasOwnMaterial = Standard_True;
-#else
- AIS_InteractiveObject::SetMaterial(aMat);
-#endif
+
+ myDrawer->ShadingAspect()->SetMaterial(aMat,myCurrentFacingModel);
+ myDrawer->ShadingAspect()->SetTransparency(myTransparency,myCurrentFacingModel);
+
if(!GetContext().IsNull()){
- if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
- Handle(Prs3d_Presentation) P = GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
- Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(P);
-
- Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
- P->SetPrimitivesAspect(a4bis);
- G->SetGroupPrimitivesAspect(a4bis);
+ if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
+ Handle(Prs3d_Presentation) P = GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
+ Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(P);
+ Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
+ P->SetPrimitivesAspect(a4bis);
+ G->SetGroupPrimitivesAspect(a4bis);
+ }
}
-}
myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
myToRecomputeModes.Clear();
}
//function : UnsetMaterial
//purpose :
//=======================================================================
+
void AIS_Shape::UnsetMaterial()
{
-#ifdef GER61351
if( !HasMaterial() ) return;
+
if( HasColor() || IsTransparent()) {
Graphic3d_MaterialAspect mat = AIS_GraphicTool::GetMaterial(myDrawer->Link());
if( HasColor() ) {
myDrawer->SetShadingAspect(SA);
}
hasOwnMaterial = Standard_False;
-#else
- AIS_InteractiveObject::UnsetMaterial();
-#endif
- if(!GetContext().IsNull()){
+ if(!GetContext().IsNull()){
if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) P = GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(P);
-
Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
P->SetPrimitivesAspect(a4bis);
G->SetGroupPrimitivesAspect(a4bis);
}
myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
myToRecomputeModes.Clear();
-
}
+
//=======================================================================
//function : SetTransparency
//purpose :
void AIS_Shape::SetTransparency(const Standard_Real AValue)
{
-#ifdef GER61351
- if(!HasColor() && !HasMaterial() ) {
- myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
+ if ( !HasColor() && !HasMaterial() ) {
+ myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
}
myDrawer->ShadingAspect()->SetTransparency(AValue,myCurrentFacingModel);
myTransparency = AValue;
-#else
- AIS_InteractiveObject::SetTransparency(AValue);
-#endif
+
if(!GetContext().IsNull()){
if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) P = GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(P);
-
Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
P->SetPrimitivesAspect(a4bis);
#ifdef BUC60918 //force highest priority for transparent objects
}
}
myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
- myToRecomputeModes.Clear();
-
+ myToRecomputeModes.Clear();
}
//=======================================================================
//function : UnsetTransparency
//purpose :
//=======================================================================
+
void AIS_Shape::UnsetTransparency()
{
-#ifdef GER61351
- if(HasColor() || HasMaterial() ) {
+ if( HasColor() || HasMaterial() ) {
myDrawer->ShadingAspect()->SetTransparency(0.0,myCurrentFacingModel);
} else {
Handle(Prs3d_ShadingAspect) SA;
myDrawer->SetShadingAspect(SA);
}
myTransparency = 0.0;
-#else
- AIS_InteractiveObject::UnsetTransparency();
-#endif
+
if(!GetContext().IsNull()){
-
if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
Handle(Prs3d_Presentation) P = GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(P);
-
Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
P->SetPrimitivesAspect(a4bis);
G->SetGroupPrimitivesAspect(a4bis);
}
}
myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
- myToRecomputeModes.Clear();
+ myToRecomputeModes.Clear();
}
+//=======================================================================
+//function : LoadRecomputable
+//purpose :
+//=======================================================================
void AIS_Shape::LoadRecomputable(const Standard_Integer TheMode)
{
- myRecomputeEveryPrs =Standard_False;
+ myRecomputeEveryPrs = Standard_False;
if(!IsInList(myToRecomputeModes,TheMode))
myToRecomputeModes.Append(TheMode);
}
-
-
//=======================================================================
//function : BoundingBox
//purpose :
// File: ViewerTest.cxx
// Created: Wed Jul 23 14:14:01 1997
// Author: Henri JEANNIN
-// <bbl@entrax.paris3.matra-dtv.fr>
// Modified by Eric Gouthiere [sep-oct 98] -> add commands for display...
//
// Modified by Robert Coublanc [nov 16-17-18 1998]
Standard_Boolean ThereIsCurrent;
Standard_Boolean ThereIsArgument;
Standard_Boolean IsBound = Standard_False ;
- Standard_Boolean HaveToSet;
- if (!strcasecmp( argv[0],"vsetcolor")) HaveToSet=Standard_True;
- else HaveToSet=Standard_False;
+ const Standard_Boolean HaveToSet=(strcasecmp( argv[0],"vsetcolor") == 0);
if (HaveToSet) {
- if ( argc<2 || argc > 3 ) { di << argv[0] << " syntax error: Passez 2 ou 3 arguments" << "\n"; return 1; }
- if ( argc == 2 ) {ThereIsArgument=Standard_False;}
- else ThereIsArgument=Standard_True;
-
+ if ( argc < 2 || argc > 3 ) { di << argv[0] << " syntax error: Give 2 or 3 arguments" << "\n"; return 1; }
+ ThereIsArgument = (argc != 2);
}
else {
- if ( argc > 2 ) { di << argv[0] << " syntax error: Passez au plus un argument" << "\n"; return 1; }
- if(argc==2) ThereIsArgument=Standard_True;
- else ThereIsArgument=Standard_False;
+ if ( argc > 2 ) { di << argv[0] << " syntax error: Given too many arguments" << "\n"; return 1; }
+ ThereIsArgument = (argc == 2);
}
if ( !a3DView().IsNull() ) {
Handle(AIS_InteractiveObject) ashape =
Handle(AIS_InteractiveObject)::DownCast (anObj);
#ifdef DEB
- //cout << "HaveToSet "<<HaveToSet <<" Color Given "<< argv[2] << " Color returned "<< GetColorFromName(argv[2]) << endl;
if (HaveToSet)
di << "HaveToSet "<< "1" <<" Color Given "<< argv[2] << " Color returned "<< GetColorFromName(argv[2]) << "\n";
else
- di << "HaveToSet "<< "0" <<" Color Given "<< argv[2] << " Color returned "<< GetColorFromName(argv[2]) << "\n";
+ di << "HaveToSet 0\n";
#endif
- if(HaveToSet) {
+ if(HaveToSet)
TheAISContext()->SetColor(ashape,GetColorFromName(argv[2]) );
- }
else
TheAISContext()->UnsetColor(ashape);
} else if (anObj->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) {
Handle(NIS_Triangulated) ashape =
Handle(NIS_Triangulated)::DownCast (anObj);
- if (ashape.IsNull() == Standard_False)
+ if (!ashape.IsNull())
ashape->SetColor (GetColorFromName(argv[2]));
}
}
TheAISContext() -> MoreCurrent() ;
TheAISContext() ->NextCurrent() )
{
- const Handle(AIS_InteractiveObject) ashape= TheAISContext()->Current();
+ const Handle(AIS_InteractiveObject) ashape= TheAISContext()->Current();
if (ashape.IsNull())
continue;
#ifdef DEB
- //cout << "HaveToSet "<<HaveToSet <<" Color Given "<< argv[2] << " Color returned "<< GetColorFromName(argv[2]) << endl;
- if (HaveToSet)
- di << "HaveToSet "<< "1" <<" Color Given "<< argv[2] << " Color returned "<< GetColorFromName(argv[2]) << "\n";
- else
- di << "HaveToSet "<< "0" <<" Color Given "<< argv[2] << " Color returned "<< GetColorFromName(argv[2]) << "\n";
+ if (HaveToSet)
+ di << "HaveToSet "<< "1" <<" Color Given "<< argv[2] << " Color returned "<< GetColorFromName(argv[2]) << "\n";
+ else
+ di << "HaveToSet 0\n";
#endif
- if(HaveToSet)
- TheAISContext()->SetColor(ashape,GetColorFromName(argv[1]),Standard_False);
- else
- TheAISContext()->UnsetColor(ashape,Standard_False);
+ if(HaveToSet)
+ TheAISContext()->SetColor(ashape,GetColorFromName(argv[1]),Standard_False);
+ else
+ TheAISContext()->UnsetColor(ashape,Standard_False);
}
TheAISContext()->UpdateCurrentViewer();
else if (!ThereIsCurrent && !ThereIsArgument){
ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS());
while ( it.More() ) {
- const Handle(AIS_InteractiveObject) ashape =
+ const Handle(AIS_InteractiveObject) ashape =
Handle(AIS_InteractiveObject)::DownCast(it.Key1());
if (!ashape.IsNull())
if(HaveToSet)
- TheAISContext()->SetColor(ashape,GetColorFromName(argv[1]),
- Standard_False);
+ TheAISContext()->SetColor(ashape,GetColorFromName(argv[1]),Standard_False);
else
TheAISContext()->UnsetColor(ashape,Standard_False);
- it.Next();
+ it.Next();
}
TheAISContext()->UpdateCurrentViewer();
}
//Draw arg : vtransparency [name] TransparencyCoeficient
//==============================================================================
-
static int VTransparency (Draw_Interpretor& di, Standard_Integer argc,
const char** argv)
{
Standard_Boolean ThereIsCurrent;
Standard_Boolean ThereIsArgument;
Standard_Boolean IsBound = Standard_False ;
- Standard_Boolean HaveToSet;
- if (!strcasecmp( argv[0],"vsettransparency"))
- HaveToSet=Standard_True;
- else
- HaveToSet=Standard_False;
+ const Standard_Boolean HaveToSet = (strcasecmp( argv[0],"vsettransparency") == 0);
if (HaveToSet) {
if ( argc < 2 || argc > 3 ) { di << argv[0] << " syntax error passez 1 ou 2 arguments" << "\n"; return 1; }
- if ( argc == 2 ) {ThereIsArgument=Standard_False;}
- else ThereIsArgument=Standard_True;
+ ThereIsArgument = (argc != 2);
}
else{
if ( argc > 2 ) { di << argv[0] << " syntax error: Passez au plus un argument" << "\n"; return 1; }
- if(argc==2) ThereIsArgument=Standard_True;
- else ThereIsArgument=Standard_False;
+ ThereIsArgument = (argc == 2);
}
if ( !a3DView().IsNull() ) {
TheAISContext()->SetTransparency(ashape,atof(argv[2]) );
else
TheAISContext()->UnsetTransparency(ashape);
-} else if (anObj->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) {
+ } else if (anObj->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) {
const Handle(NIS_InteractiveObject) ashape =
Handle(NIS_InteractiveObject)::DownCast(anObj);
if(HaveToSet)
TheAISContext() -> MoreCurrent() ;
TheAISContext() ->NextCurrent() )
{
- Handle(AIS_InteractiveObject) ashape = TheAISContext() -> Current();
- if(HaveToSet) {
- TheAISContext()->SetTransparency(ashape,atof(argv[1]),Standard_False);
- }
- else
- TheAISContext()->UnsetTransparency(ashape,Standard_False);
+ Handle(AIS_InteractiveObject) ashape = TheAISContext() -> Current();
+ if(HaveToSet)
+ TheAISContext()->SetTransparency(ashape,atof(argv[1]),Standard_False);
+ else
+ TheAISContext()->UnsetTransparency(ashape,Standard_False);
}
TheAISContext()->UpdateCurrentViewer();
ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName
it(GetMapOfAIS());
while ( it.More() ) {
- Handle(AIS_InteractiveObject) ashape =
+ Handle(AIS_InteractiveObject) ashape =
Handle(AIS_InteractiveObject)::DownCast(it.Key1());
if (!ashape.IsNull())
if(HaveToSet)
- TheAISContext()->SetTransparency(ashape,atof(argv[1]),
- Standard_False);
+ TheAISContext()->SetTransparency(ashape,atof(argv[1]),Standard_False);
else
TheAISContext()->UnsetTransparency(ashape,Standard_False);
- it.Next();
+ it.Next();
}
TheAISContext()->UpdateCurrentViewer();
}
Standard_Boolean ThereIsName;
Standard_Boolean IsBound = Standard_False ;
- Standard_Boolean HaveToSet;
- if (!strcasecmp( argv[0],"vsetmaterial")) HaveToSet=Standard_True;
- else HaveToSet=Standard_False;
+ const Standard_Boolean HaveToSet = (strcasecmp( argv[0],"vsetmaterial") == 0);
if (HaveToSet) {
if ( argc < 2 || argc > 3 ) { di << argv[0] << " syntax error passez 1 ou 2 arguments" << "\n"; return 1; }
- if ( argc == 2 ) {ThereIsName=Standard_False;}
- else ThereIsName=Standard_True;
+ ThereIsName = (argc != 2);
}
else {
if ( argc>2 ) { di << argv[0] << " syntax error passez au plus un argument" << "\n"; return 1; }
- if (argc==2) ThereIsName=Standard_True;
- else ThereIsName=Standard_False;
-
+ ThereIsName = (argc == 2);
}
if ( !a3DView().IsNull() ) {
Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(name));
if (!ashape.IsNull())
if (HaveToSet)
- TheAISContext()->SetMaterial (ashape,
- GetMaterialFromName (argv[2]) );
+ TheAISContext()->SetMaterial(ashape,GetMaterialFromName(argv[2]));
else
TheAISContext()->UnsetMaterial(ashape);
}
TheAISContext() -> MoreCurrent() ;
TheAISContext() ->NextCurrent() )
{
- Handle(AIS_InteractiveObject) ashape = TheAISContext() -> Current();
- if (HaveToSet)
- TheAISContext()->SetMaterial(ashape,GetMaterialFromName(argv[1]),
- Standard_False);
- else
- TheAISContext()->UnsetMaterial(ashape,Standard_False);
+ Handle(AIS_InteractiveObject) ashape = TheAISContext()->Current();
+ if (HaveToSet)
+ TheAISContext()->SetMaterial(ashape,GetMaterialFromName(argv[1]),Standard_False);
+ else
+ TheAISContext()->UnsetMaterial(ashape,Standard_False);
}
TheAISContext()->UpdateCurrentViewer();
}
ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName
it(GetMapOfAIS());
while ( it.More() ) {
- Handle(AIS_InteractiveObject) ashape =
+ Handle(AIS_InteractiveObject) ashape =
Handle(AIS_InteractiveObject)::DownCast (it.Key1());
- if (!ashape.IsNull())
+ if (!ashape.IsNull())
if (HaveToSet)
- TheAISContext()->SetMaterial(ashape,GetMaterialFromName(argv[1]),
- Standard_False );
+ TheAISContext()->SetMaterial(ashape,GetMaterialFromName(argv[1]),Standard_False);
else
TheAISContext()->UnsetMaterial(ashape,Standard_False);
- it.Next();
+ it.Next();
}
TheAISContext()->UpdateCurrentViewer();
}
Standard_Boolean ThereIsArgument;
Standard_Boolean IsBound = Standard_False ;
- Standard_Boolean HaveToSet;
- if (!strcasecmp( argv[0],"vsetwidth")) HaveToSet=Standard_True;
- else HaveToSet=Standard_False;
+ const Standard_Boolean HaveToSet = (strcasecmp( argv[0],"vsetwidth") == 0);
if (HaveToSet) {
if ( argc < 2 || argc > 3 ) { di << argv[0] << " syntax error passez 1 ou 2 arguments" << "\n"; return 1; }
- if ( argc == 2 ) {ThereIsArgument=Standard_False;}
- else ThereIsArgument=Standard_True;
+ ThereIsArgument = (argc != 2);
}
else {
if ( argc>2 ) { di << argv[0] << " syntax error passez au plus 1 argument" << "\n"; return 1; }
- if (argc==2) ThereIsArgument=Standard_True;
- else ThereIsArgument=Standard_False;
+ ThereIsArgument = (argc == 2);
}
if ( !a3DView().IsNull() ) {
TCollection_AsciiString name;
TheAISContext() -> MoreCurrent() ;
TheAISContext() ->NextCurrent() )
{
- Handle(AIS_InteractiveObject) ashape = TheAISContext() -> Current();
- if (HaveToSet)
- TheAISContext()->SetWidth(ashape,atof (argv[1]),Standard_False);
- else
- TheAISContext()->UnsetWidth (ashape,Standard_False);
-
+ Handle(AIS_InteractiveObject) ashape = TheAISContext() -> Current();
+ if (HaveToSet)
+ TheAISContext()->SetWidth(ashape,atof(argv[1]),Standard_False);
+ else
+ TheAISContext()->UnsetWidth(ashape,Standard_False);
}
TheAISContext()->UpdateCurrentViewer();
}
Handle(AIS_InteractiveObject)::DownCast (it.Key1());
if (!ashape.IsNull())
if (HaveToSet)
- TheAISContext()->SetWidth(ashape,atof (argv[1]),Standard_False );
+ TheAISContext()->SetWidth(ashape,atof(argv[1]),Standard_False);
else
- TheAISContext()->UnsetWidth (ashape,Standard_False);
+ TheAISContext()->UnsetWidth(ashape,Standard_False);
it.Next();
}
TheAISContext()->UpdateCurrentViewer();
//purpose : Sharpen or roughten the quality of the shading
//Draw arg : vshading ShapeName 0.1->0.00001 1 deg-> 30 deg
//==============================================================================
-static int VShading(Draw_Interpretor& ,Standard_Integer argc, const char** argv) {
- Standard_Boolean HaveToSet;
-// Standard_Real myDevAngle;
+static int VShading(Draw_Interpretor& ,Standard_Integer argc, const char** argv)
+{
Standard_Real myDevCoef;
Handle(AIS_InteractiveObject) TheAisIO;
// Verifications
- if (!strcasecmp(argv[0],"vsetshading") ) HaveToSet=Standard_True;
- else HaveToSet=Standard_False;
+ const Standard_Boolean HaveToSet = (strcasecmp(argv[0],"vsetshading") == 0);
+
if (TheAISContext()->HasOpenedContext())
TheAISContext()->CloseLocalContext();
myDevCoef =atof(argv[2]);
}
-
TCollection_AsciiString name=argv[1];
if (GetMapOfAIS().IsBound2(name ))
- TheAisIO =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
+ TheAisIO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
if (TheAisIO.IsNull())
TheAisIO=GetAISShapeFromName((const char *)name.ToCString());
- if (HaveToSet) {
+ if (HaveToSet)
TheAISContext()->SetDeviationCoefficient(TheAisIO,myDevCoef,Standard_True);
- }
-
- else {
+ else
TheAISContext()->SetDeviationCoefficient(TheAisIO,0.0008,Standard_True);
- }
-
TheAISContext()->Redisplay(TheAisIO);
return 0;
}
static int VActivatedMode (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
- Standard_Boolean HaveToSet;
Standard_Boolean ThereIsName = Standard_False ;
if(!a3DView().IsNull()){
- if (!strcasecmp(argv[0],"vsetam")) HaveToSet=Standard_True;
- else HaveToSet=Standard_False;
-
+ const Standard_Boolean HaveToSet = (strcasecmp(argv[0],"vsetam") == 0);
// verification des arguments
if (HaveToSet) {
if (argc<2||argc>3) { di<<" Syntaxe error"<<"\n";return 1;}
- if (argc==3) ThereIsName=Standard_True;
- else ThereIsName=Standard_False;
+ ThereIsName = (argc == 3);
}
else {
// vunsetam
if (argc>1) {di<<" Syntaxe error"<<"\n";return 1;}
else {
- di<<" R.A.Z de tous les modes de selecion"<<"\n";
- di<<" Fermeture du Context local"<<"\n";
+ di<<" R.A.Z de tous les modes de selecion"<<"\n";
+ di<<" Fermeture du Context local"<<"\n";
if (TheAISContext()->HasOpenedContext())
TheAISContext()->CloseLocalContext();
}
-
}
-
// IL n'y a aps de nom de shape passe en argument
if (HaveToSet && !ThereIsName){
Standard_Integer aMode=atoi(argv [1]);
const char *cmode="???";
-
switch (aMode) {
case 0: cmode = "Shape"; break;
case 1: cmode = "Vertex"; break;
}
if( !TheAISContext()->HasOpenedContext() ) {
- // il n'y a pas de Context local d'ouvert
- // on en ouvre un et on charge toutes les shapes displayees
- // on load tous les objets displayees et on Activate les objets de la liste
- AIS_ListOfInteractive ListOfIO;
- // on sauve dans une AISListOfInteractive tous les objets currents
- if (TheAISContext()->NbCurrents()>0 ){
- TheAISContext()->UnhilightCurrents(Standard_False);
-
- for (TheAISContext()->InitCurrent(); TheAISContext()->MoreCurrent(); TheAISContext()->NextCurrent() ){
- ListOfIO.Append(TheAISContext()->Current() );
-
+ // il n'y a pas de Context local d'ouvert
+ // on en ouvre un et on charge toutes les shapes displayees
+ // on load tous les objets displayees et on Activate les objets de la liste
+ AIS_ListOfInteractive ListOfIO;
+ // on sauve dans une AISListOfInteractive tous les objets currents
+ if (TheAISContext()->NbCurrents()>0 ){
+ TheAISContext()->UnhilightCurrents(Standard_False);
+
+ for (TheAISContext()->InitCurrent(); TheAISContext()->MoreCurrent(); TheAISContext()->NextCurrent() ){
+ ListOfIO.Append(TheAISContext()->Current() );
}
}
//==============================================================================
static int VState(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
- Standard_Boolean ThereIsCurrent=Standard_False;
- Standard_Boolean ThereIsArguments=Standard_False;
TheAISContext()->CloseAllContexts();
- if (argc>=2 ) {
- ThereIsArguments=Standard_True;
- }
- if (TheAISContext()->NbCurrents()>0 ) {
- ThereIsCurrent=Standard_True;
- }
+ const Standard_Boolean ThereIsArguments=(argc>=2);
+ const Standard_Boolean ThereIsCurrent=(TheAISContext()->NbCurrents()>0);
// Debut...
// ==================
// Il y a un argument
// ==================
- if (ThereIsArguments ) {
+ if (ThereIsArguments) {
for (int cpt=1;cpt<argc;cpt++) {
// Verification que lq piece est bien bindee.
if (GetMapOfAIS().IsBound2(argv[cpt]) ) {
--- File: XCAFPrs.cdl
--- Created: Fri Aug 11 16:28:46 2000
--- Author: Andrey BETENEV
--- <abv@doomox.nnov.matra-dtv.fr>
----Copyright: Matra Datavision 2000
+-- File: XCAFPrs.cdl
+-- Created: Fri Aug 11 16:28:46 2000
+-- Author: Andrey BETENEV
+---Copyright: Matra Datavision 2000
package XCAFPrs
TopLoc,
TopoDS,
TopTools,
+ Graphic3d,
Prs3d,
PrsMgr,
TPrsStd,
--- File: XCAFPrs_AISObject.cdl
--- Created: Fri Aug 11 16:37:11 2000
--- Author: Andrey BETENEV
--- <abv@doomox.nnov.matra-dtv.fr>
----Copyright: Matra Datavision 2000
+-- File: XCAFPrs_AISObject.cdl
+-- Created: Fri Aug 11 16:37:11 2000
+-- Author: Andrey BETENEV
+---Copyright: Matra Datavision 2000
class AISObject from XCAFPrs inherits Shape from AIS
PresentationManager3d from PrsMgr,
Presentation from Prs3d,
Label from TDF,
+ Color from Quantity,
+ NameOfMaterial from Graphic3d,
+ MaterialAspect from Graphic3d,
Style from XCAFPrs
is
Create (lab: Label from TDF);
---Purpose: Creates an object to visualise the shape label
+ SetColor(me:mutable;aColor:Color from Quantity) is redefined virtual;
+
+ UnsetColor(me:mutable) is redefined virtual;
+
+ SetMaterial(me:mutable;aName:NameOfMaterial from Graphic3d) is redefined virtual;
+
+ SetMaterial(me:mutable;aName:MaterialAspect from Graphic3d) is redefined virtual;
+
+ UnsetMaterial(me:mutable) is redefined virtual;
+
+ SetTransparency(me:mutable;aValue : Real from Standard=0.6) is redefined virtual;
+
+ UnsetTransparency(me:mutable) is redefined virtual;
+
AddStyledItem (me: mutable; style: Style from XCAFPrs;
shape: Shape from TopoDS;
aPresentationManager : PresentationManager3d from PrsMgr;
// File: XCAFPrs_AISObject.cxx
// Created: Fri Aug 11 16:49:09 2000
// Author: Andrey BETENEV
-// <abv@doomox.nnov.matra-dtv.fr>
#include <XCAFPrs_AISObject.ixx>
#include <TCollection_ExtendedString.hxx>
}
//=======================================================================
-//function : Compute
+//function : SetColor
+//purpose :
+//=======================================================================
+
+void XCAFPrs_AISObject::SetColor(const Quantity_Color &aCol)
+{
+ AIS_Shape::SetColor(aCol);
+ LoadRecomputable(1);
+}
+
+//=======================================================================
+//function : UnsetColor
+//purpose :
+//=======================================================================
+
+void XCAFPrs_AISObject::UnsetColor()
+{
+ if (HasColor())
+ {
+ AIS_Shape::UnsetColor();
+ LoadRecomputable(1);
+ }
+ else
+ {
+ myToRecomputeModes.Clear();
+ }
+}
+
+//=======================================================================
+//function : SetMaterial
+//purpose :
+//=======================================================================
+
+void XCAFPrs_AISObject::SetMaterial(const Graphic3d_NameOfMaterial aMat)
+{
+ AIS_Shape::SetMaterial(aMat);
+ LoadRecomputable(1);
+}
+
+//=======================================================================
+//function : SetMaterial
//purpose :
//=======================================================================
-void DisplayBox(const Handle(Prs3d_Presentation)& aPrs,
- const Bnd_Box& B,
- const Handle(Prs3d_Drawer)& aDrawer)
+void XCAFPrs_AISObject::SetMaterial(const Graphic3d_MaterialAspect& aMat)
+{
+ AIS_Shape::SetMaterial(aMat);
+ LoadRecomputable(1);
+}
+
+//=======================================================================
+//function : UnsetMaterial
+//purpose :
+//=======================================================================
+
+void XCAFPrs_AISObject::UnsetMaterial()
+{
+ if (HasMaterial())
+ {
+ AIS_Shape::UnsetMaterial();
+ LoadRecomputable(1);
+ }
+ else
+ {
+ myToRecomputeModes.Clear();
+ }
+}
+
+//=======================================================================
+//function : SetTransparency
+//purpose :
+//=======================================================================
+
+void XCAFPrs_AISObject::SetTransparency(const Standard_Real AValue)
+{
+ AIS_Shape::SetTransparency(AValue);
+ LoadRecomputable(1);
+}
+
+//=======================================================================
+//function : UnsetTransparency
+//purpose :
+//=======================================================================
+
+void XCAFPrs_AISObject::UnsetTransparency()
+{
+ AIS_Shape::UnsetTransparency();
+ LoadRecomputable(1);
+}
+
+//=======================================================================
+//function : DisplayBox
+//purpose :
+//=======================================================================
+
+static void DisplayBox(const Handle(Prs3d_Presentation)& aPrs,
+ const Bnd_Box& B,
+ const Handle(Prs3d_Drawer)& aDrawer)
{
Standard_Real X[2],Y[2],Z[2];
Standard_Integer Indx [16] ;
G->EndPrimitives();
}
+//=======================================================================
+//function : AddStyledItem
+//purpose :
+//=======================================================================
+
void XCAFPrs_AISObject::AddStyledItem (const XCAFPrs_Style &style,
const TopoDS_Shape &shape,
const Handle(PrsMgr_PresentationManager3d)&, // aPresentationManager,
}
}
}
-
}
//=======================================================================
// support different color settings for different subshapes of a single shape
void XCAFPrs_AISObject::Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
- const Handle(Prs3d_Presentation)& aPrs,
- const Standard_Integer aMode)
+ const Handle(Prs3d_Presentation)& aPrs,
+ const Standard_Integer aMode)
{
#ifdef DEB
- cout << "XCAFPrs_AISObject: Update called" << endl;
+ //cout << "XCAFPrs_AISObject: Update called" << endl;
#endif
aPrs->Clear();
// abv: 06 Mar 00: to have good colors
Handle(TPrsStd_AISPresentation) prs = Handle(TPrsStd_AISPresentation)::DownCast ( GetOwner() );
- Graphic3d_NameOfMaterial material = ( prs.IsNull() ? Graphic3d_NOM_PLASTIC : prs->Material() );
-// Graphic3d_NameOfMaterial material = Material();
- SetMaterial ( material );
-
-// SetMaterial ( Graphic3d_NOM_PLASTIC );
+ if ( prs.IsNull() || !prs->HasOwnMaterial() )
+ AIS_Shape::SetMaterial ( Graphic3d_NOM_PLASTIC );
TopoDS_Shape shape;
if ( ! XCAFDoc_ShapeTool::GetShape ( myLabel, shape ) || shape.IsNull() ) return;
XCAFPrs_DataMapOfShapeStyle settings;
XCAFPrs::CollectStyleSettings ( myLabel, L, settings );
#ifdef DEB
- cout << "Styles collected" << endl;
+ //cout << "Styles collected" << endl;
#endif
// dispatch (sub)shapes by their styles
DefStyle.SetColorCurv ( White );
XCAFPrs::DispatchStyles ( shape, settings, items, DefStyle );
#ifdef DEB
- cout << "Dispatch done" << endl;
+ //cout << "Dispatch done" << endl;
#endif
// add subshapes to presentation (one shape per style)
XCAFPrs_DataMapIteratorOfDataMapOfStyleShape it ( items );
#ifdef DEB
- Standard_Integer i=1;
+ //Standard_Integer i=1;
#endif
for ( ; it.More(); it.Next() ) {
XCAFPrs_Style s = it.Key();
#ifdef DEB
- cout << "Style " << i << ": [" <<
- ( s.IsSetColorSurf() ? Quantity_Color::StringName ( s.GetColorSurf().Name() ) : "" ) << ", " <<
- ( s.IsSetColorCurv() ? Quantity_Color::StringName ( s.GetColorCurv().Name() ) : "" ) << "]" <<
- " --> si_" << i << ( s.IsVisible() ? "" : " <invisible>" ) << endl;
-#ifdef DEBUG
- char str[200];
- sprintf ( str, "si_%d", i );
- DBRep::Set ( str, it.Value() );
- try { OCC_CATCH_SIGNALS ; } // to handle all till the end of for
- catch (Standard_Failure) {
- cout << "Exception in AddStyledItem!" << endl;
- continue;
- }
-#endif
- i++;
+ //cout << "Style " << i << ": [" <<
+ // ( s.IsSetColorSurf() ? Quantity_Color::StringName ( s.GetColorSurf().Name() ) : "" ) << ", " <<
+ // ( s.IsSetColorCurv() ? Quantity_Color::StringName ( s.GetColorCurv().Name() ) : "" ) << "]" <<
+ //" --> si_" << i << ( s.IsVisible() ? "" : " <invisible>" ) << endl;
+ //i++;
#endif
if (! s.IsVisible() ) continue;
AddStyledItem ( s, it.Value(), aPresentationManager, aPrs, aMode );
if ( XCAFPrs::GetViewNameMode() ) {
// Displaying Name attributes
#ifdef DEB
- cout << "Now display name of shapes" << endl;
+ //cout << "Now display name of shapes" << endl;
#endif
aPrs->SetDisplayPriority(10);
DisplayText (myLabel, aPrs, Attributes()->LengthAspect()->TextAspect(), TopLoc_Location());//no location
}
#ifdef DEB
- cout << "Compute finished" << endl;
+ //cout << "Compute finished" << endl;
#endif
aPrs->ReCompute(); // for hidden line recomputation if necessary...
// File: XDEDRAW.cxx
// Created: Fri Aug 4 14:38:55 2000
// Author: Pavel TELKOV
-// <ptv@zamox.nnov.matra-dtv.fr>
-
#include <XDEDRAW.ixx>
#include <stdio.h>
}
+//=======================================================================
+//function : XSetTransparency
+//purpose :
+//=======================================================================
+static Standard_Integer XSetTransparency (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3) {
+ di<<"Use: "<<argv[0]<<" Doc Transparency [label1 label2 ...] "<<"\n";
+ return 1;
+ }
+
+ Handle(TDocStd_Document) Doc;
+ DDocStd::GetDocument(argv[1], Doc);
+ if ( Doc.IsNull() ) { di << argv[1] << " is not a document" << "\n"; return 1; }
+
+ const Standard_Real aTransparency = atof(argv[2]);
+
+ // collect sequence of labels
+ Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+ TDF_LabelSequence seq;
+ if ( argc > 3 ) {
+ for ( Standard_Integer i=3; i < argc; i++ ) {
+ TDF_Label aLabel;
+ TDF_Tool::Label(Doc->GetData(), argv[i], aLabel);
+ if ( aLabel.IsNull() || ! shapes->IsShape ( aLabel ) ) {
+ di << argv[i] << " is not a valid shape label!";
+ continue;
+ }
+ seq.Append ( aLabel );
+ }
+ }
+ else {
+ shapes->GetFreeShapes ( seq );
+ }
+
+ // find presentations and set transparency
+ for ( Standard_Integer i=1; i <= seq.Length(); i++ ) {
+ Handle(TPrsStd_AISPresentation) prs;
+ if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) ) {
+ prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
+ prs->SetMaterial ( Graphic3d_NOM_PLASTIC );
+ }
+ prs->SetTransparency( aTransparency );
+ }
+ TPrsStd_AISViewer::Update(Doc->GetData()->Root());
+ return 0;
+}
+
+
//=======================================================================
//function : Init
//purpose :
di.Add ("XGetViewNameMode", "\t: Print if mode of displaying names is turn on.",
__FILE__, getviewName, g);
+ di.Add ("XSetTransparency", "Doc Transparency [label1 label2 ...]\t: Set transparency for given label(s) or whole doc",
+ __FILE__, XSetTransparency, g);
+
// Specialized commands
XDEDRAW_Shapes::InitCommands ( di );
XDEDRAW_Colors::InitCommands ( di );