1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

0023634: Eliminate Polyline and Polygon usage in drawers

Polylines and polygons removed, now everything is based on PrimitiveArrays.
Added use of Graphic3d_ArrayOfSegments, some additional clean up in Graphic3d_Group.
Dead code elimination in AIS and V3d
Corrected compilation errors
Fixed grid presentation
Adding test case correction
This commit is contained in:
kgv
2013-01-18 13:36:18 +04:00
parent 44cf55e600
commit b8ddfc2f5d
134 changed files with 4369 additions and 9572 deletions

View File

@@ -101,7 +101,7 @@
#include <GC_MakeConicalSurface.hxx>
#include <gce_MakePln.hxx>
#include <gce_MakeCone.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
//=======================================================================
//function : Constructor
@@ -1975,19 +1975,17 @@ void AIS_AngleDimension::ComputeConeAngleSelection(const Handle(SelectMgr_Select
gp_Pnt AttachmentPnt;
gp_Pnt OppositePnt;
gp_Pnt aPnt, tmpPnt;
Quantity_Length X,Y,Z;
Standard_Real param = ElCLib::Parameter(myCircle, myPosition);
aPnt = Apex;
gp_Pnt aPnt = Apex;
gp_Pnt P1 = ElCLib::Value(0., myCircle);
gp_Pnt P2 = ElCLib::Value(M_PI, myCircle);
gce_MakePln mkPln(P1, P2, aPnt); // create a plane whitch defines plane for projection aPosition on it
gce_MakePln mkPln(P1, P2, aPnt); // create a plane whitch defines plane for projection aPosition on it
aPnt = AIS::ProjectPointOnPlane(myPosition, mkPln.Value());
tmpPnt = aPnt;
aPnt = AIS::ProjectPointOnPlane(myPosition, mkPln.Value());
gp_Pnt tmpPnt = aPnt;
if( aPnt.Distance(P1) < aPnt.Distance(P2) ){
AttachmentPnt = P1;
@@ -2015,49 +2013,30 @@ void AIS_AngleDimension::ComputeConeAngleSelection(const Handle(SelectMgr_Select
if( myPosition.Distance( myCircle.Location() ) <= myCircle.Radius() )
if( 2 * myCircle.Radius() > aCircle2.Radius() * 0.4 ) IsArrowOut = Standard_False; //four times more than an arrow size
Graphic3d_Array1OfVertex V(1, 12);
Standard_Real angle;
param = ElCLib::Parameter(aCircle2, tmpPnt);
if(IsArrowOut) {
angle = OppParam - AttParam + M_PI / 6; //An angle between AttParam and OppParam + 30 degrees
param = AttParam - M_PI / 12; //out parts of dimension line are 15 degrees
while ( angle > 2 * M_PI ) angle -= 2 * M_PI;
for( i = 0; i <= 11; i++ ) { //calculating of arc
aPnt = ElCLib::Value(param + angle/11 * i, aCircle2);
aPnt.Coord(X, Y, Z);
V(i+1).SetCoord(X, Y, Z);
}
}
else {
angle = OppParam - AttParam;
param = AttParam;
while ( angle > 2 * M_PI ) angle -= 2 * M_PI;
for( i = 0; i <= 11; i++ ) { //calculating of arc
aPnt = ElCLib::Value(param + angle/11 * i, aCircle2);
aPnt.Coord(X, Y, Z);
V(i+1).SetCoord(X, Y, Z);
}
}
for(i = 1; i<=11; i++) {
param = AttParam;
Standard_Real angle = OppParam - AttParam;
V(i).Coord(X, Y, Z);
P1.SetCoord(X, Y, Z);
V(i+1).Coord(X, Y, Z);
P1.SetCoord(X, Y, Z);
seg = new Select3D_SensitiveSegment(owner, P1, P2);
aSelection->Add(seg);
if(IsArrowOut)
{
angle += M_PI / 6; //An angle between AttParam and OppParam + 30 degrees
param -= M_PI / 12; //out parts of dimension line are 15 degrees
}
tmpPnt = tmpPnt.Translated(gp_Vec(0, 0, -1)*2);
while ( angle > 2. * M_PI ) angle -= 2. * M_PI;
Standard_Real size(Min(myVal/100.+1.e-6,myArrowSize+1.e-6));
gp_Pnt Vprev = ElCLib::Value(param, aCircle2);
for( i = 1; i <= 11; i++ ) //calculating of arc
{
gp_Pnt Vcur = ElCLib::Value(param + angle/11 * i, aCircle2);
seg = new Select3D_SensitiveSegment(owner, Vprev, Vcur);
aSelection->Add(seg);
Vprev = Vcur;
}
tmpPnt = tmpPnt.Translated(gp_Vec(0, 0, -2));
const Standard_Real size(Min(myVal/100.+1.e-6,myArrowSize+1.e-6));
Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox( owner,
tmpPnt.X(),
tmpPnt.Y(),
@@ -2067,6 +2046,3 @@ void AIS_AngleDimension::ComputeConeAngleSelection(const Handle(SelectMgr_Select
tmpPnt.Z() + size);
aSelection->Add(box);
}

View File

@@ -19,15 +19,13 @@
// and conditions governing the rights and limitations under the License.
#define GER61351 //GG_171199 Enable to set an object RGB color
// instead a restricted object NameOfColor.
//GER61351 //GG_171199 Enable to set an object RGB color instead a restricted object NameOfColor.
#include <AIS_Axis.ixx>
#include <Aspect_TypeOfLine.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_DatumAspect.hxx>
#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_Structure.hxx>
#include <TColgp_Array1OfPnt.hxx>
@@ -177,10 +175,7 @@ void AIS_Axis::Compute(const Handle(PrsMgr_PresentationManager3d)&,
aPresentation->SetDisplayPriority(5);
if (!myIsXYZAxis ){
GeomAdaptor_Curve curv(myComponent);
Standard_Boolean isPrimitiveArraysEnabled = Graphic3d_ArrayOfPrimitives::IsEnable();
if(isPrimitiveArraysEnabled) Graphic3d_ArrayOfPrimitives::Disable();
StdPrs_Curve::Add(aPresentation,curv,myDrawer);
if(isPrimitiveArraysEnabled) Graphic3d_ArrayOfPrimitives::Enable();
}
else {
DsgPrs_XYZAxisPresentation::Add(aPresentation,myLineAspect,myDir,myVal,myText,myPfirst,myPlast);
@@ -217,13 +212,11 @@ void AIS_Axis::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
void AIS_Axis::SetColor(const Quantity_NameOfColor aCol)
#ifdef GER61351
{
SetColor(Quantity_Color(aCol));
}
void AIS_Axis::SetColor(const Quantity_Color &aCol)
#endif
{
hasOwnColor=Standard_True;
myOwnColor=aCol;

View File

@@ -19,14 +19,12 @@
// and conditions governing the rights and limitations under the License.
#define GER61351 //GG_171199 Enable to set an object RGB color
// instead a restricted object NameOfColor.
//GER61351 //GG_171199 Enable to set an object RGB color instead a restricted object NameOfColor.
#include <AIS_Circle.ixx>
#include <Aspect_TypeOfLine.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_Structure.hxx>
#include <TColgp_Array1OfPnt.hxx>
@@ -122,7 +120,6 @@ void AIS_Circle::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
//=======================================================================
void AIS_Circle::SetColor(const Quantity_NameOfColor aCol)
#ifdef GER61351
{
SetColor(Quantity_Color(aCol));
}
@@ -133,7 +130,6 @@ void AIS_Circle::SetColor(const Quantity_NameOfColor aCol)
//=======================================================================
void AIS_Circle::SetColor(const Quantity_Color &aCol)
#endif
{
hasOwnColor=Standard_True;
myOwnColor=aCol;
@@ -157,17 +153,10 @@ void AIS_Circle::SetWidth(const Standard_Real aValue)
{
myOwnWidth=aValue;
#ifndef GER61351
Quantity_NameOfColor CC =
HasColor() ? myOwnColor : AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line);
#endif
if (!myDrawer->HasLineAspect ()) {
#ifdef GER61351
Quantity_Color CC;
if( HasColor() ) CC = myOwnColor;
else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
#endif
myDrawer->SetLineAspect (new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,aValue));
} else
myDrawer->LineAspect()->SetWidth(aValue);
@@ -186,17 +175,12 @@ void AIS_Circle::UnsetColor()
if (!HasWidth()) myDrawer->SetLineAspect(NullAsp);
else{
#ifdef GER61351
Quantity_Color CC;
if( HasColor() ) CC = myOwnColor;
else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
#else
Quantity_NameOfColor CC =
#endif
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line);
Quantity_Color CC;
if( HasColor() ) CC = myOwnColor;
else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
myDrawer->LineAspect()->SetColor(CC);
myOwnColor = CC;
}
}
}
//=======================================================================
@@ -225,10 +209,7 @@ void AIS_Circle::ComputeCircle( const Handle(Prs3d_Presentation)& aPresentation)
GeomAdaptor_Curve curv(myComponent);
Standard_Real prevdev = myDrawer->DeviationCoefficient();
myDrawer->SetDeviationCoefficient(1.e-5);
Standard_Boolean isPrimitiveArraysEnabled = Graphic3d_ArrayOfPrimitives::IsEnable();
if(isPrimitiveArraysEnabled) Graphic3d_ArrayOfPrimitives::Disable();
StdPrs_DeflectionCurve::Add(aPresentation,curv,myDrawer);
if(isPrimitiveArraysEnabled) Graphic3d_ArrayOfPrimitives::Enable();
myDrawer->SetDeviationCoefficient(prevdev);
}
@@ -240,16 +221,11 @@ void AIS_Circle::ComputeCircle( const Handle(Prs3d_Presentation)& aPresentation)
//=======================================================================
void AIS_Circle::ComputeArc( const Handle(Prs3d_Presentation)& aPresentation)
{
GeomAdaptor_Curve curv(myComponent,myUStart,myUEnd);
Standard_Real prevdev = myDrawer->DeviationCoefficient();
myDrawer->SetDeviationCoefficient(1.e-5);
Standard_Boolean isPrimitiveArraysEnabled = Graphic3d_ArrayOfPrimitives::IsEnable();
if(isPrimitiveArraysEnabled) Graphic3d_ArrayOfPrimitives::Disable();
StdPrs_DeflectionCurve::Add(aPresentation,curv,myDrawer);
if(isPrimitiveArraysEnabled) Graphic3d_ArrayOfPrimitives::Enable();
myDrawer->SetDeviationCoefficient(prevdev);
}
//=======================================================================

View File

@@ -19,8 +19,7 @@
// and conditions governing the rights and limitations under the License.
#define GER61351 //GG_171199 Enable to get an object RGB color
// instead a restricted object NameOfColor.
//GER61351 //GG_171199 Enable to get an object RGB color instead a restricted object NameOfColor.
@@ -92,7 +91,6 @@ static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
}
Quantity_NameOfColor AIS_GraphicTool::GetLineColor (const Handle(Prs3d_Drawer)& Dr, const AIS_TypeOfAttribute Att)
#ifdef GER61351
{
Quantity_Color color;
GetLineColor(Dr,Att,color);
@@ -100,20 +98,10 @@ Quantity_NameOfColor AIS_GraphicTool::GetLineColor (const Handle(Prs3d_Drawer)&
}
void AIS_GraphicTool::GetLineColor (const Handle(Prs3d_Drawer)& Dr, const AIS_TypeOfAttribute Att, Quantity_Color &aColor)
#endif
{
Standard_Real W;
Aspect_TypeOfLine TYP;
Handle(Prs3d_LineAspect) LA = GetLineAspect(Dr,Att);
#ifdef GER61351
LA->Aspect()->Values(aColor,TYP,W);
#else
Quantity_Color QCol;
LA->Aspect()->Values(QCol,TYP,W);
return QCol.Name();
#endif
GetLineAspect(Dr,Att)->Aspect()->Values(aColor,TYP,W);
}
Standard_Real AIS_GraphicTool::GetLineWidth (const Handle(Prs3d_Drawer)& Dr,
@@ -159,7 +147,6 @@ void AIS_GraphicTool::GetLineAtt(const Handle(Prs3d_Drawer)& Dr,
}
Quantity_NameOfColor AIS_GraphicTool::GetInteriorColor(const Handle(Prs3d_Drawer)& Dr)
#ifdef GER61351
{
Quantity_Color color;
GetInteriorColor(Dr,color);
@@ -167,24 +154,16 @@ Quantity_NameOfColor AIS_GraphicTool::GetInteriorColor(const Handle(Prs3d_Drawer
}
void AIS_GraphicTool::GetInteriorColor(const Handle(Prs3d_Drawer)& Dr, Quantity_Color &aColor)
#endif
{
Handle(Graphic3d_AspectFillArea3d) AFA = Dr->ShadingAspect()->Aspect();
Aspect_InteriorStyle IS;
Aspect_TypeOfLine T;
Standard_Real W;
#ifdef GER61351
Quantity_Color EC;
AFA->Values(IS,aColor,EC,T,W);
#else
Quantity_Color IC,EC;
AFA->Values(IS,IC,EC,T,W);
return IC.Name();
#endif
}
Graphic3d_MaterialAspect AIS_GraphicTool::GetMaterial(const Handle(Prs3d_Drawer)& Dr)
{
return Dr->ShadingAspect()->Aspect()->BackMaterial();
}

View File

@@ -23,12 +23,11 @@
#define BUC60577 //GG_101099 Enable to compute correctly
// transparency with more than one object in the view.
#define GER61351 //GG_171199 Enable to set an object RGB color
// instead a restricted object NameOfColor.
//GER61351 //GG_171199 Enable to set an object RGB color instead a restricted object NameOfColor.
#define G003 //EUG_26/01/00 Degenerate support (G003)
#define IMP140200 //GG Add SetSelectedAspect() method.
//IMP140200 //GG Add SetSelectedAspect() method.
#define BUC60632 //GG 15/03/00 Add protection on SetDisplayMode()
// method, compute only authorized presentation.
@@ -1914,15 +1913,13 @@ UnsetDisplayMode(const Handle(AIS_InteractiveObject)& anIObj,
//purpose :
//=======================================================================
#ifdef GER61351
void AIS_InteractiveContext::SetCurrentFacingModel(
const Handle(AIS_InteractiveObject)& anIObj,
const Aspect_TypeOfFacingModel aModel) {
if ( !anIObj.IsNull () ) {
anIObj->SetCurrentFacingModel(aModel);
}
const Aspect_TypeOfFacingModel aModel)
{
if ( !anIObj.IsNull () )
anIObj->SetCurrentFacingModel(aModel);
}
#endif
//=======================================================================
//function : SetColor
@@ -1932,7 +1929,6 @@ void AIS_InteractiveContext::SetCurrentFacingModel(
void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj,
const Quantity_NameOfColor aColor,
const Standard_Boolean updateviewer)
#ifdef GER61351
{
SetColor(anIObj,Quantity_Color(aColor),updateviewer);
}
@@ -1940,7 +1936,6 @@ void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIOb
void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj,
const Quantity_Color &aColor,
const Standard_Boolean updateviewer)
#endif
{
if(anIObj.IsNull()) return ;
@@ -2292,13 +2287,11 @@ Quantity_NameOfColor AIS_InteractiveContext::Color(const Handle(AIS_InteractiveO
return anIObj->Color();
}
#ifdef GER61351
void AIS_InteractiveContext::Color(const Handle(AIS_InteractiveObject)& anIObj,
Quantity_Color &aColor) const
Quantity_Color &aColor) const
{
anIObj->Color(aColor);
}
#endif
//=======================================================================
//function : Width
@@ -2541,7 +2534,6 @@ void AIS_InteractiveContext :: SetDegenerateModel (
} // end AIS_InteractiveContext :: SetDegenerateModel
#endif
#ifdef IMP140200
//=======================================================================
//function : SetSelectedAspect
//purpose :
@@ -2549,7 +2541,8 @@ void AIS_InteractiveContext :: SetDegenerateModel (
void AIS_InteractiveContext::SetSelectedAspect(
const Handle(Prs3d_BasicAspect)& anAspect,
const Standard_Boolean globalChange,
const Standard_Boolean updateViewer) {
const Standard_Boolean updateViewer)
{
if( !HasOpenedContext() ) {
Standard_Boolean found = Standard_False;
Handle(AIS_Selection) sel =
@@ -2563,11 +2556,10 @@ void AIS_InteractiveContext::SetSelectedAspect(
if( found && updateViewer) {
myMainVwr->Update();
if( !(myIsCollClosed && myCollectorVwr.IsNull()) )
myCollectorVwr->Update();
myCollectorVwr->Update();
}
}
}
#endif
//=======================================================================
//function : SetLocalAttributes

View File

@@ -19,8 +19,7 @@
// and conditions governing the rights and limitations under the License.
#define GER61351 //GG_171199 Enable to set an object RGB color
// instead a restricted object NameOfColor.
//GER61351 //GG_171199 Enable to set an object RGB color instead a restricted object NameOfColor.
inline Standard_Boolean AIS_InteractiveObject::AcceptShapeDecomposition() const
@@ -66,19 +65,13 @@ inline Standard_Integer AIS_InteractiveObject::SelectionMode() const
inline Quantity_NameOfColor AIS_InteractiveObject::Color() const
{
#ifdef GER61351
return myOwnColor.Name();
#else
return myOwnColor;
#endif
return myOwnColor.Name();
}
#ifdef GER61351
inline void AIS_InteractiveObject::Color(Quantity_Color& aColor) const
{
aColor = myOwnColor;
aColor = myOwnColor;
}
#endif
inline Standard_Boolean AIS_InteractiveObject::HasWidth() const
{return (!myOwnWidth == 0.);}

View File

@@ -19,15 +19,13 @@
// and conditions governing the rights and limitations under the License.
#define GER61351 //GG_171199 Enable to set an object RGB color
// instead a restricted object NameOfColor.
//GER61351 //GG_171199 Enable to set an object RGB color instead a restricted object NameOfColor.
#include <AIS_Line.ixx>
#include <Aspect_TypeOfLine.hxx>
#include <Prs3d_Drawer.hxx>
#include <Precision.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_Structure.hxx>
#include <TColgp_Array1OfPnt.hxx>
@@ -157,13 +155,11 @@ void AIS_Line::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
//=======================================================================
void AIS_Line::SetColor(const Quantity_NameOfColor aCol)
#ifdef GER61351
{
SetColor(Quantity_Color(aCol));
}
void AIS_Line::SetColor(const Quantity_Color &aCol)
#endif
{
hasOwnColor=Standard_True;
myOwnColor=aCol;
@@ -190,15 +186,9 @@ void AIS_Line::UnsetColor()
if (!HasWidth()) myDrawer->SetLineAspect(NullAsp);
else{
#ifdef GER61351
Quantity_Color CC;
if( HasColor() ) CC = myOwnColor;
else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
#else
Quantity_NameOfColor CC =
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line);
#endif
myDrawer->LineAspect()->SetColor(CC);
myOwnColor = CC;
}
@@ -212,17 +202,10 @@ void AIS_Line::SetWidth(const Standard_Real aValue)
{
myOwnWidth=aValue;
#ifndef GER61351
Quantity_NameOfColor CC =
HasColor()? myOwnColor : AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line);
#endif
if (!myDrawer->HasLineAspect ()) {
#ifdef GER61351
Quantity_Color CC;
if( HasColor() ) CC = myOwnColor;
else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
#endif
myDrawer->SetLineAspect (new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,aValue));
} else
myDrawer->LineAspect()->SetWidth(aValue);
@@ -251,16 +234,11 @@ void AIS_Line::UnsetWidth()
//=======================================================================
void AIS_Line::ComputeInfiniteLine( const Handle(Prs3d_Presentation)& aPresentation)
{
GeomAdaptor_Curve curv(myComponent);
Standard_Boolean isPrimitiveArraysEnabled = Graphic3d_ArrayOfPrimitives::IsEnable();
if(isPrimitiveArraysEnabled) Graphic3d_ArrayOfPrimitives::Disable();
StdPrs_Curve::Add(aPresentation,curv,myDrawer);
if(isPrimitiveArraysEnabled) Graphic3d_ArrayOfPrimitives::Enable();
//pas de prise en compte lors du FITALL
aPresentation->SetInfiniteState (Standard_True);
}
//=======================================================================
@@ -269,7 +247,6 @@ void AIS_Line::ComputeInfiniteLine( const Handle(Prs3d_Presentation)& aPresentat
//=======================================================================
void AIS_Line::ComputeSegmentLine( const Handle(Prs3d_Presentation)& aPresentation)
{
gp_Pnt P1 = myStartPoint->Pnt();
gp_Pnt P2 = myEndPoint->Pnt();
@@ -277,11 +254,7 @@ void AIS_Line::ComputeSegmentLine( const Handle(Prs3d_Presentation)& aPresentati
Standard_Real dist = P1.Distance(P2);
GeomAdaptor_Curve curv(myComponent,0.,dist);
Standard_Boolean isPrimitiveArraysEnabled = Graphic3d_ArrayOfPrimitives::IsEnable();
if(isPrimitiveArraysEnabled) Graphic3d_ArrayOfPrimitives::Disable();
StdPrs_Curve::Add(aPresentation,curv,myDrawer);
if(isPrimitiveArraysEnabled) Graphic3d_ArrayOfPrimitives::Enable();
}

View File

@@ -93,7 +93,7 @@
#include <AIS_LocalStatus.hxx>
#include <StdPrs_WFShape.hxx>
#include <Visual3d_TransientManager.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_Group.hxx>
#include <Select3D_SensitiveTriangulation.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
@@ -1430,17 +1430,18 @@ void AIS_LocalContext::HilightTriangle(const Standard_Integer Rank,
{
static Standard_Integer PrevRank(0);
if(Rank==PrevRank) return;
// PrevRank = Rank;
Handle(SelectBasics_SensitiveEntity) SE = myMainVS->Primitive(Rank);
if(SE->IsKind(STANDARD_TYPE(Select3D_SensitiveTriangulation))){
if(SE->IsKind(STANDARD_TYPE(Select3D_SensitiveTriangulation)))
{
Handle(Select3D_SensitiveTriangulation) Tr = *((Handle(Select3D_SensitiveTriangulation)*)&SE);
gp_Pnt p1,p2,p3 ; Tr->DetectedTriangle(p1,p2,p3);
static Graphic3d_Array1OfVertex Vtt(1,3);
Vtt.SetValue(1,Graphic3d_Vertex(p1.X(),p1.Y(),p1.Z()));
Vtt.SetValue(2,Graphic3d_Vertex(p2.X(),p2.Y(),p2.Z()));
Vtt.SetValue(3,Graphic3d_Vertex(p3.X(),p3.Y(),p3.Z()));
static Handle(Prs3d_Presentation) TriPrs =
Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles(3);
aTris->AddVertex(p1);
aTris->AddVertex(p2);
aTris->AddVertex(p3);
static Handle(Prs3d_Presentation) TriPrs =
new Prs3d_Presentation(myMainPM->StructureManager());
TriPrs->Clear();
#ifdef IMP300101
@@ -1448,20 +1449,17 @@ void AIS_LocalContext::HilightTriangle(const Standard_Integer Rank,
asp->SetColor(myCTX->HilightColor());
TriPrs->SetShadingAspect(asp);
#endif
Prs3d_Root::CurrentGroup(TriPrs)->Polygon(Vtt);
Prs3d_Root::CurrentGroup(TriPrs)->AddPrimitiveArray(aTris);
#ifndef IMP300101
if(view->TransientManagerBeginDraw())
Visual3d_TransientManager::EndDraw();
#endif
if(view->TransientManagerBeginDraw()) {
//P->Exploration();
Visual3d_TransientManager::DrawStructure(TriPrs);
Visual3d_TransientManager::EndDraw();
}
}
}
//=======================================================================

View File

@@ -31,7 +31,7 @@
#include <gp_Pnt.hxx>
#include <ElSLib.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfQuadrangles.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_LineAspect.hxx>
@@ -245,58 +245,59 @@ void AIS_Plane::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
ComputeFields();
aPresentation->SetInfiniteState(myInfiniteState);
if (myCurrentMode)
myDrawer->PlaneAspect()->EdgesAspect()->SetWidth(3);
else
myDrawer->PlaneAspect()->EdgesAspect()->SetWidth(1);
if(aMode == 0){
if (!myIsXYZPlane){
ComputeFrame();
const Handle(Geom_Plane)& pl = myComponent;
const Handle(Geom_Plane)& thegoodpl = Handle(Geom_Plane)::DownCast
(pl->Translated(pl->Location(),myCenter));
GeomAdaptor_Surface surf(thegoodpl);
StdPrs_Plane::Add(aPresentation,surf,myDrawer);
}
else {
DsgPrs_XYZPlanePresentation::Add(aPresentation,myDrawer,myCenter,myPmin,myPmax);
}
}
else if (aMode == 1){
if (!myIsXYZPlane){
ComputeFrame();
Handle(Prs3d_PlaneAspect) theaspect = myDrawer->PlaneAspect();
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
gp_Pnt p1;
Standard_Real Xmax,Ymax;
Xmax = Standard_Real(theaspect->PlaneXLength())/2.;
Ymax = Standard_Real(theaspect->PlaneYLength())/2.;
static Graphic3d_Array1OfVertex vertices(1,5);
TheGroup->SetPrimitivesAspect(myDrawer->ShadingAspect()->Aspect());
myComponent->D0(-Xmax,Ymax,p1);
vertices(1).SetCoord(p1.X(),p1.Y(),p1.Z());
vertices(5).SetCoord(p1.X(),p1.Y(),p1.Z());
myComponent->D0(Xmax,Ymax,p1);
vertices(2).SetCoord(p1.X(),p1.Y(),p1.Z());
myComponent->D0(Xmax,-Ymax,p1);
vertices(3).SetCoord(p1.X(),p1.Y(),p1.Z());
myComponent->D0(-Xmax,-Ymax,p1);
vertices(4).SetCoord(p1.X(),p1.Y(),p1.Z());
TheGroup->Polygon(vertices);
}
else{
DsgPrs_ShadedPlanePresentation::Add(aPresentation,myDrawer,myCenter,myPmin,myPmax);
}
}
myDrawer->PlaneAspect()->EdgesAspect()->SetWidth(myCurrentMode == 0? 1 : 3);
switch (aMode)
{
case 0:
{
if (!myIsXYZPlane)
{
ComputeFrame();
const Handle(Geom_Plane)& pl = myComponent;
const Handle(Geom_Plane)& thegoodpl = Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(),myCenter));
GeomAdaptor_Surface surf(thegoodpl);
StdPrs_Plane::Add(aPresentation,surf,myDrawer);
}
else
DsgPrs_XYZPlanePresentation::Add(aPresentation,myDrawer,myCenter,myPmin,myPmax);
break;
}
case 1:
{
if (!myIsXYZPlane)
{
ComputeFrame();
Handle(Prs3d_PlaneAspect) theaspect = myDrawer->PlaneAspect();
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
TheGroup->SetPrimitivesAspect(myDrawer->ShadingAspect()->Aspect());
gp_Pnt p1;
const Standard_Real Xmax = 0.5*Standard_Real(theaspect->PlaneXLength());
const Standard_Real Ymax = 0.5*Standard_Real(theaspect->PlaneYLength());
Handle(Graphic3d_ArrayOfQuadrangles) aQuads = new Graphic3d_ArrayOfQuadrangles(4);
myComponent->D0(-Xmax,Ymax,p1);
aQuads->AddVertex(p1);
myComponent->D0(Xmax,Ymax,p1);
aQuads->AddVertex(p1);
myComponent->D0(Xmax,-Ymax,p1);
aQuads->AddVertex(p1);
myComponent->D0(-Xmax,-Ymax,p1);
aQuads->AddVertex(p1);
TheGroup->AddPrimitiveArray(aQuads);
}
else
DsgPrs_ShadedPlanePresentation::Add(aPresentation,myDrawer,myCenter,myPmin,myPmax);
break;
}
}
}
void AIS_Plane::Compute(const Handle_Prs3d_Projector& aProjector, const Handle_Geom_Transformation& aTransformation, const Handle_Prs3d_Presentation& aPresentation)
{
// Standard_NotImplemented::Raise("AIS_Plane::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
PrsMgr_PresentableObject::Compute(aProjector, aTransformation, aPresentation);
}
//=======================================================================

View File

@@ -19,8 +19,7 @@
// and conditions governing the rights and limitations under the License.
#define GER61351 //GG_171199 Enable to set an object RGB color
// instead a restricted object NameOfColor.
//GER61351 //GG_171199 Enable to set an object RGB color instead a restricted object NameOfColor.
#define OCC218 //SAV using DsgPrs_XYZAxisPresentation to draw axes.
// + X/YAxis() returns AIS_Line instead of AIS_Axis
@@ -280,13 +279,11 @@ void AIS_PlaneTrihedron::ComputeSelection(const Handle(SelectMgr_Selection)& aSe
}
void AIS_PlaneTrihedron::SetColor(const Quantity_NameOfColor aCol)
#ifdef GER61351
{
SetColor(Quantity_Color(aCol));
}
void AIS_PlaneTrihedron::SetColor(const Quantity_Color &aCol)
#endif
{
hasOwnColor=Standard_True;
myOwnColor = aCol;

View File

@@ -19,14 +19,12 @@
// and conditions governing the rights and limitations under the License.
#define GER61351 //GG_171199 Enable to set an object RGB color
// instead a restricted object NameOfColor.
//GER61351 //GG_171199 Enable to set an object RGB color instead a restricted object NameOfColor.
#define BUC60915 //GG 05/06/01 Enable to compute the requested arrow size
// if any in all dimensions.
#include <AIS.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_Group.hxx>
#include <AIS_Relation.ixx>
@@ -222,13 +220,11 @@ void AIS_Relation::ComputeProjVertexPresentation(const Handle(Prs3d_Presentation
//=======================================================================
void AIS_Relation::SetColor(const Quantity_NameOfColor aCol)
#ifdef GER61351
{
SetColor(Quantity_Color(aCol));
}
void AIS_Relation::SetColor(const Quantity_Color &aCol)
#endif
{
if(hasOwnColor && myOwnColor==aCol) return;
@@ -268,13 +264,9 @@ void AIS_Relation::UnsetColor()
if (!hasOwnColor) return;
hasOwnColor = Standard_False;
const Handle(Prs3d_LineAspect)& LA = myDrawer->LineAspect();
#ifdef GER61351
Quantity_Color CC;
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
LA->SetColor(CC);
#else
LA->SetColor(AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line));
#endif
myDrawer->AngleAspect()->SetLineAspect(LA);
myDrawer->LengthAspect()->SetLineAspect(LA);
myDrawer->SetTextAspect(myDrawer->Link()->TextAspect());

View File

@@ -44,8 +44,7 @@
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_MaterialAspect.hxx>
#include <Prs3d_Presentation.hxx>
@@ -104,24 +103,18 @@ void AIS_Shape::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] ;
static const Standard_Integer Indx[][3] =
{ { 0, 0, 0 }, { 1, 0, 0 }, { 1, 0, 1 }, { 0, 0, 1 },
{ 0, 1, 1 }, { 1, 1, 1 }, { 1, 1, 0 }, { 0, 1, 0 },
{ 0, 0, 0 }, { 0, 0, 1 }, { 1, 0, 1 }, { 1, 1, 1 },
{ 0, 1, 1 }, { 0, 1, 0 }, { 1, 1, 0 }, { 1, 0, 0 } };
if ( B.IsVoid() )
return; // nothing to show
Indx [0]=1;Indx [1]=2;Indx [2]=4;Indx [3]=3;
Indx [4]=5;Indx [5]=6;Indx [6]=8;Indx [7]=7;
Indx [8]=1;Indx [9]=3;Indx [10]=7;Indx [11]=5;
Indx [12]=2;Indx [13]=4;Indx [14]=8;Indx [15]=6;
Standard_Real X[2],Y[2],Z[2];
B.Get(X[0], Y[0], Z[0], X[1], Y[1], Z[1]);
Graphic3d_Array1OfVertex V(1,8);
Standard_Integer Rank(0);
for(Standard_Integer k=0;k<=1;k++)
for(Standard_Integer j=0;j<=1;j++)
for(Standard_Integer i=0;i<=1;i++)
V(++Rank) = Graphic3d_Vertex(X[i],Y[j],Z[k]);
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPrs);
Quantity_Color Q;
Aspect_TypeOfLine A;
@@ -130,16 +123,11 @@ void AIS_Shape::DisplayBox(const Handle(Prs3d_Presentation)& aPrs,
G->SetGroupPrimitivesAspect(new Graphic3d_AspectLine3d(Q,Aspect_TOL_DOTDASH,W));
G->BeginPrimitives();Standard_Integer I,J;
Graphic3d_Array1OfVertex VVV (1,5);
for(I=1;I<=4;I++){
for(J=1;J<=4;J++){
VVV.SetValue(J,V(Indx[J+4*I-5]));
}
VVV.SetValue(5,VVV(1));
G->Polyline(VVV);
}
G->EndPrimitives();
Handle(Graphic3d_ArrayOfPolylines) aPolyline = new Graphic3d_ArrayOfPolylines(16);
Standard_Integer i(0);
for(;i<16;i++)
aPolyline->AddVertex(X[Indx[i][0]],Y[Indx[i][1]],Z[Indx[i][2]]);
G->AddPrimitiveArray(aPolyline);
}
static Standard_Boolean IsInList(const TColStd_ListOfInteger& LL, const Standard_Integer aMode)

View File

@@ -30,7 +30,6 @@
#include <Graphic3d_Group.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_ArrayOfPrimitives.hxx>
IMPLEMENT_STANDARD_HANDLE(AIS_Triangulation, AIS_InteractiveObject)
@@ -66,7 +65,7 @@ void AIS_Triangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre
if( myFlagColor == 1 )
hasVColors = Standard_True;
Handle(Graphic3d_ArrayOfTriangles) array =
Handle(Graphic3d_ArrayOfTriangles) anArray =
new Graphic3d_ArrayOfTriangles ( myNbNodes, //maxVertexs
myNbTriangles * 3,//maxEdges
hasVNormals, //hasVNormals
@@ -83,24 +82,22 @@ void AIS_Triangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre
Standard_Real ambient = aspect->FrontMaterial().Ambient();
for ( i = nodes.Lower(); i<= nodes.Upper(); i++ ){
if( myFlagColor == 1 )
array->AddVertex( nodes(i), AttenuateColor(myColor->Value(i),ambient));
anArray->AddVertex( nodes(i), AttenuateColor(myColor->Value(i),ambient));
if( myFlagColor == 0 )
array->AddVertex( nodes(i) );
anArray->AddVertex( nodes(i) );
j = (i - nodes.Lower()) * 3;
array->SetVertexNormal(i, normals(j+1), normals(j+2), normals(j+3));
anArray->SetVertexNormal(i, normals(j+1), normals(j+2), normals(j+3));
}
Standard_Integer indexTriangle[3] = {0,0,0};
for ( i = triangles.Lower(); i<= triangles.Upper(); i++ ) {
triangles(i).Get(indexTriangle[0], indexTriangle[1], indexTriangle[2]);
array->AddEdge(indexTriangle[0]);
array->AddEdge(indexTriangle[1]);
array->AddEdge(indexTriangle[2]);
anArray->AddEdge(indexTriangle[0]);
anArray->AddEdge(indexTriangle[1]);
anArray->AddEdge(indexTriangle[2]);
}
TheGroup->SetPrimitivesAspect(aspect);
TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(array);
TheGroup->EndPrimitives();
TheGroup->AddPrimitiveArray(anArray);
break;
}
}

View File

@@ -19,8 +19,7 @@
// and conditions governing the rights and limitations under the License.
#define GER61351 //GG_171199 Enable to set an object RGB color
// instead a restricted object NameOfColor.
//GER61351 //GG_171199 Enable to set an object RGB color instead a restricted object NameOfColor.
#define IMP120100 // GG Add SetTextColor() and SetArrowColor() methods
@@ -430,13 +429,11 @@ void AIS_Trihedron::ComputeSelection(const Handle(SelectMgr_Selection)& aSelecti
//=======================================================================
void AIS_Trihedron::SetColor(const Quantity_NameOfColor aCol)
#ifdef GER61351
{
SetColor(Quantity_Color(aCol));
}
void AIS_Trihedron::SetColor(const Quantity_Color &aCol)
#endif
{
hasOwnColor=Standard_True;
myOwnColor = aCol;