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
#include <GC_MakeConicalSurface.hxx>
#include <gce_MakePln.hxx>
#include <gce_MakeCone.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+
//=======================================================================
//function : Constructor
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;
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);
- }
+ param = AttParam;
+ Standard_Real angle = OppParam - AttParam;
+
+ 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
}
-
- for(i = 1; i<=11; i++) {
- V(i).Coord(X, Y, Z);
- P1.SetCoord(X, Y, Z);
- V(i+1).Coord(X, Y, Z);
- P1.SetCoord(X, Y, Z);
+ while ( angle > 2. * M_PI ) angle -= 2. * M_PI;
- seg = new Select3D_SensitiveSegment(owner, P1, P2);
- aSelection->Add(seg);
+ 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, -1)*2);
+ tmpPnt = tmpPnt.Translated(gp_Vec(0, 0, -2));
- Standard_Real size(Min(myVal/100.+1.e-6,myArrowSize+1.e-6));
+ 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(),
tmpPnt.Z() + size);
aSelection->Add(box);
}
-
-
-
// 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>
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);
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;
// 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>
//=======================================================================
void AIS_Circle::SetColor(const Quantity_NameOfColor aCol)
-#ifdef GER61351
{
SetColor(Quantity_Color(aCol));
}
//=======================================================================
void AIS_Circle::SetColor(const Quantity_Color &aCol)
-#endif
{
hasOwnColor=Standard_True;
myOwnColor=aCol;
{
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);
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;
- }
+ }
}
//=======================================================================
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);
}
//=======================================================================
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);
-
}
//=======================================================================
// 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.
}
Quantity_NameOfColor AIS_GraphicTool::GetLineColor (const Handle(Prs3d_Drawer)& Dr, const AIS_TypeOfAttribute Att)
-#ifdef GER61351
{
Quantity_Color color;
GetLineColor(Dr,Att,color);
}
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,
}
Quantity_NameOfColor AIS_GraphicTool::GetInteriorColor(const Handle(Prs3d_Drawer)& Dr)
-#ifdef GER61351
{
Quantity_Color color;
GetInteriorColor(Dr,color);
}
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();
-
}
#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.
//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
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);
}
void AIS_InteractiveContext::SetColor(const Handle(AIS_InteractiveObject)& anIObj,
const Quantity_Color &aColor,
const Standard_Boolean updateviewer)
-#endif
{
if(anIObj.IsNull()) return ;
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
} // end AIS_InteractiveContext :: SetDegenerateModel
#endif
-#ifdef IMP140200
//=======================================================================
//function : SetSelectedAspect
//purpose :
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 =
if( found && updateViewer) {
myMainVwr->Update();
if( !(myIsCollClosed && myCollectorVwr.IsNull()) )
- myCollectorVwr->Update();
+ myCollectorVwr->Update();
}
}
}
-#endif
//=======================================================================
//function : SetLocalAttributes
// 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
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.);}
// 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>
//=======================================================================
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;
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;
}
{
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);
//=======================================================================
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);
-
}
//=======================================================================
//=======================================================================
void AIS_Line::ComputeSegmentLine( const Handle(Prs3d_Presentation)& aPresentation)
{
-
gp_Pnt P1 = myStartPoint->Pnt();
gp_Pnt P2 = myEndPoint->Pnt();
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();
-
}
#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>
{
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
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();
}
-
}
-
}
//=======================================================================
#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>
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);
+ 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;
}
- }
- 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);
-
+ 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);
-
+ 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);
}
//=======================================================================
// 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
}
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;
// 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>
//=======================================================================
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;
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());
#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>
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;
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)
#include <Graphic3d_Group.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
-#include <Graphic3d_ArrayOfPrimitives.hxx>
IMPLEMENT_STANDARD_HANDLE(AIS_Triangulation, AIS_InteractiveObject)
if( myFlagColor == 1 )
hasVColors = Standard_True;
- Handle(Graphic3d_ArrayOfTriangles) array =
+ Handle(Graphic3d_ArrayOfTriangles) anArray =
new Graphic3d_ArrayOfTriangles ( myNbNodes, //maxVertexs
myNbTriangles * 3,//maxEdges
hasVNormals, //hasVNormals
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;
}
}
// 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
//=======================================================================
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;
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_AnglePresentation.ixx>
#include <gp_Lin.hxx>
#include <gp_Dir.hxx>
#include <ElCLib.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_AngleAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <UnitsAPI.hxx>
-//pop pour NT
-//#if WNT
#include <stdio.h>
-//#endif
+//------------------------------------------------------------------------------------------------------------------
+// Returns 1 if C is above of CMin; 0 if C is bitween CMin and CMax; -1 if C is Below CMax
+//-----------------------------------------------------------------------------------------------------------------
+static Standard_Integer AboveInBelowCone(const gp_Circ &CMax, const gp_Circ &CMin, const gp_Circ &C)
+{
+ const Standard_Real D = CMax.Location().Distance( CMin.Location() );
+ const Standard_Real D1 = CMax.Location().Distance( C.Location() );
+ const Standard_Real D2 = CMin.Location().Distance( C.Location() );
-static Standard_Integer AboveInBelowCone(gp_Circ CMax, gp_Circ CMin, gp_Circ C);
+ if ( D >= D1 && D >= D2 ) return 0;
+ if ( D < D2 && D1 < D2 ) return -1;
+ if ( D < D1 && D2 < D1 ) return 1;
+
+ return 0;
+}
//==========================================================================
// purpose : draws the presentation of the cone's angle;
//==========================================================================
void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
- const Handle(Prs3d_Drawer)& aDrawer,
- const Standard_Real aVal,
- const TCollection_ExtendedString& aText,
- const gp_Circ& aCircle,
+ const Handle(Prs3d_Drawer)& aDrawer,
+ const Standard_Real aVal,
+ const TCollection_ExtendedString& aText,
+ const gp_Circ& aCircle,
const gp_Pnt& aPosition,
const gp_Pnt& Apex,
- const gp_Circ& VminCircle,
- const gp_Circ& VmaxCircle,
- const Standard_Real aArrowSize)
+ const gp_Circ& VminCircle,
+ const gp_Circ& VmaxCircle,
+ const Standard_Real aArrowSize)
{
-
-
-
Handle(Prs3d_AngleAspect) anAngleAspect = aDrawer->AngleAspect();
Handle(Prs3d_LengthAspect) aLengthAspect = aDrawer->LengthAspect();
- Standard_Real myArrowSize;
- TCollection_ExtendedString txt = aText;
- if( aArrowSize == 0.0 ) myArrowSize = aCircle.Radius()/ 10.;
- else myArrowSize = aArrowSize;
+ TCollection_ExtendedString txt(aText);
+
+ const Standard_Real myArrowSize = ( aArrowSize == 0.0 )? (0.1 * aCircle.Radius()) : aArrowSize;
anAngleAspect->ArrowAspect()->SetLength(myArrowSize);
aDrawer->ArrowAspect()->SetLength(myArrowSize);
- Standard_Boolean IsArrowOut = Standard_True; //Is arrows inside or outside of the cone
Standard_Boolean IsConeTrimmed = Standard_False;
gp_Circ myCircle = aCircle;
-
-
if( VminCircle.Radius() > 0.01 ) {
IsConeTrimmed = Standard_True;
- if( AboveInBelowCone( VmaxCircle, VminCircle, myCircle ) == 1 ) myCircle = VminCircle;
+ if( AboveInBelowCone( VmaxCircle, VminCircle, myCircle ) == 1 ) myCircle = VminCircle;
}
- gp_Pnt AttachmentPnt;
- gp_Pnt OppositePnt;
- gp_Pnt aPnt, tmpPnt;
-
-
- Quantity_Length X,Y,Z;
-
- Standard_Real param = 0.; //ElCLib::Parameter(myCircle, aPosition);
-
- 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, Apex); // create a plane whitch defines plane for projection aPosition on it
gp_Vec aVector( mkPln.Value().Location(), aPosition ); //project aPosition on a plane
gp_Vec Normal = mkPln.Value().Axis().Direction();
Normal = (aVector * Normal) * Normal;
- aPnt = aPosition;
- aPnt = aPnt.Translated( -Normal );
+ gp_Pnt aPnt = aPosition;
+ aPnt = aPnt.Translated( -Normal );
- tmpPnt = aPnt;
+ gp_Pnt tmpPnt = aPnt;
- if( aPnt.Distance(P1) < aPnt.Distance(P2) ){
+ gp_Pnt AttachmentPnt, OppositePnt;
+ if( aPnt.Distance(P1) < aPnt.Distance(P2) ) {
AttachmentPnt = P1;
OppositePnt = P2;
}
AttachmentPnt = P2;
OppositePnt = P1;
}
-
+
aPnt = AttachmentPnt ; // Creating of circle whitch defines a plane for a dimension arc
gp_Vec Vec(AttachmentPnt, Apex); // Dimension arc is a part of the circle
- Vec.Scale(2);
+ Vec.Scale(2.);
aPnt.Translate(Vec);
- GC_MakeCircle mkCirc(AttachmentPnt, OppositePnt, aPnt);
- gp_Circ aCircle2 = mkCirc.Value()->Circ();
+ GC_MakeCircle mkCirc(AttachmentPnt, OppositePnt, aPnt);
+ gp_Circ aCircle2 = mkCirc.Value()->Circ();
Standard_Integer i;
Standard_Real AttParam = ElCLib::Parameter(aCircle2, AttachmentPnt); //must be equal to zero (look circle construction)
Standard_Real OppParam = ElCLib::Parameter(aCircle2, OppositePnt);
- gp_Dir aDir, aDir2;
- while ( AttParam >= 2 * M_PI ) AttParam -= 2 * M_PI;
- while ( OppParam >= 2 * M_PI ) OppParam -= 2 * M_PI;
+ while ( AttParam >= 2. * M_PI ) AttParam -= 2. * M_PI;
+ while ( OppParam >= 2. * M_PI ) OppParam -= 2. * M_PI;
//-------------------------- Compute angle ------------------------
- if( txt.Length() == 0 ) {
- Standard_Real angle = UnitsAPI::CurrentFromLS( Abs( OppParam ),"PLANE ANGLE");
- char res[80];
- sprintf(res, "%g", angle );
- txt = TCollection_ExtendedString(res);
- }
+ if( txt.Length() == 0 ) {
+ Standard_Real angle = UnitsAPI::CurrentFromLS( Abs( OppParam ),"PLANE ANGLE");
+ char res[80];
+ sprintf(res, "%g", angle );
+ txt = TCollection_ExtendedString(res);
+ }
//-----------------------------------------------------------------
-
-
+ Standard_Boolean IsArrowOut = Standard_True; //Is arrows inside or outside of the cone
if( ElCLib::Parameter(aCircle2, tmpPnt) < OppParam )
- // if( aPosition.Distance( myCircle.Location() ) <= myCircle.Radius() )
- if( 2 * myCircle.Radius() > 4 * myArrowSize ) IsArrowOut = Standard_False; //four times more than an arrow size
-
-
- Graphic3d_Array1OfVertex V(1, 12);
-
- Standard_Real angle;
-// param = ElCLib::Parameter(aCircle2, tmpPnt);
- angle = OppParam - AttParam;
- param = AttParam;
+ if( 2. * myCircle.Radius() > 4. * myArrowSize ) IsArrowOut = Standard_False; //four times more than an arrow size
+ Standard_Real angle = OppParam - AttParam;
+ Standard_Real param = AttParam;
+
+ gp_Dir aDir, aDir2;
if(IsArrowOut) {
- aDir = gp_Dir( ( gp_Vec( ElCLib::Value( AttParam - M_PI / 12, aCircle2 ), AttachmentPnt) ) );
- aDir2 = gp_Dir( ( gp_Vec( ElCLib::Value( OppParam + M_PI / 12, aCircle2 ), OppositePnt) ) );
+ aDir = gp_Dir( ( gp_Vec( ElCLib::Value( AttParam - M_PI / 12., aCircle2 ), AttachmentPnt) ) );
+ aDir2 = gp_Dir( ( gp_Vec( ElCLib::Value( OppParam + M_PI / 12., aCircle2 ), OppositePnt) ) );
}
else {
- aDir = gp_Dir( ( gp_Vec( ElCLib::Value( AttParam + M_PI / 12, aCircle2 ), AttachmentPnt ) ) );
- aDir2 = gp_Dir( ( gp_Vec( ElCLib::Value( OppParam - M_PI / 12, aCircle2 ), OppositePnt ) ) );
- }
-
- while ( angle > 2 * M_PI ) angle -= 2 * M_PI;
- for( i = 0; i <= 11; i++ ) { //calculating of arc
- ( ElCLib::Value(param + angle/11 * i, aCircle2) ).Coord(X, Y, Z);
- V(i+1).SetCoord(X, Y, Z);
+ aDir = gp_Dir( ( gp_Vec( ElCLib::Value( AttParam + M_PI / 12., aCircle2 ), AttachmentPnt ) ) );
+ aDir2 = gp_Dir( ( gp_Vec( ElCLib::Value( OppParam - M_PI / 12., aCircle2 ), OppositePnt ) ) );
}
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V); //add the arc
+ while ( angle > 2. * M_PI ) angle -= 2. * M_PI;
+
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(12);
+ for( i = 0; i <= 11; i++ )
+ aPrims->AddVertex(ElCLib::Value(param + angle/11 * i, aCircle2));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
DsgPrs::ComputeSymbol(aPresentation, anAngleAspect, AttachmentPnt,
- AttachmentPnt, aDir, aDir, DsgPrs_AS_LASTAR);
+ AttachmentPnt, aDir, aDir, DsgPrs_AS_LASTAR);
DsgPrs::ComputeSymbol(aPresentation, anAngleAspect, OppositePnt,
- OppositePnt, aDir2, aDir2, DsgPrs_AS_LASTAR);
+ OppositePnt, aDir2, aDir2, DsgPrs_AS_LASTAR);
param = ElCLib::Parameter(aCircle2, tmpPnt);
tmpPnt = ElCLib::Value(param, aCircle2);
- tmpPnt = tmpPnt.Translated(gp_Vec(0, 0, -1)*2);
- Prs3d_Text::Draw(aPresentation,aLengthAspect->TextAspect(), txt, tmpPnt); //add the TCollection_ExtendedString
-
- angle = 2 * M_PI - param ;
- if( param > OppParam ) {
- while ( angle > 2 * M_PI ) angle -= 2 * M_PI;
- for( i = 11; i >= 0; i-- ) { //calculating of arc
- ( ElCLib::Value(-angle/11 * i, aCircle2) ).Coord(X, Y, Z);
- V(i+1).SetCoord(X, Y, Z);
- }
-
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V); //add additional line
+ tmpPnt = tmpPnt.Translated(gp_Vec(0, 0, -2));
+ Prs3d_Text::Draw(aPresentation, aLengthAspect->TextAspect(), txt, tmpPnt); //add the TCollection_ExtendedString
+
+ angle = 2. * M_PI - param ;
+ if( param > OppParam )
+ {
+ while ( angle > 2. * M_PI ) angle -= 2. * M_PI;
+ aPrims = new Graphic3d_ArrayOfPolylines(12);
+ for( i = 11; i >= 0; i-- )
+ aPrims->AddVertex(ElCLib::Value(-angle/11 * i, aCircle2));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
-
- if( AboveInBelowCone( VmaxCircle, VminCircle, myCircle ) == 1 && !IsConeTrimmed ) { //above
- Graphic3d_Array1OfVertex V2(1,3);
- AttachmentPnt.Coord(X, Y, Z);
- V2(1).SetCoord(X, Y, Z);
- Apex.Coord(X, Y, Z);
- V2(2).SetCoord(X, Y, Z);
- OppositePnt.Coord(X, Y, Z);
- V2(3).SetCoord(X, Y, Z);
-
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V2); //add the additional lines
+
+ if( AboveInBelowCone( VmaxCircle, VminCircle, myCircle ) == 1 && !IsConeTrimmed ) //above
+ {
+ aPrims = new Graphic3d_ArrayOfPolylines(3);
+ aPrims->AddVertex(AttachmentPnt);
+ aPrims->AddVertex(Apex);
+ aPrims->AddVertex(OppositePnt);
}
- else {
+ else
+ {
aPnt = OppositePnt ;
if ( AboveInBelowCone( VmaxCircle, VminCircle, myCircle ) == 0 ) return;
- Graphic3d_Array1OfVertex V3(1,2);
+
gp_Pnt P11 = ElCLib::Value( 0., VmaxCircle );
gp_Pnt P12 = ElCLib::Value( M_PI, VmaxCircle );
-
- AttachmentPnt.Coord(X, Y, Z);
- V3(1).SetCoord(X, Y, Z);
- if( aPnt.Distance(P1) < aPnt.Distance(P2) ) P12.Coord(X, Y, Z);
- else P11.Coord(X, Y, Z);
- V3(2).SetCoord(X, Y, Z);
-
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V3);
-
- OppositePnt.Coord(X, Y, Z);
- V3(1).SetCoord(X, Y, Z);
- if( aPnt.Distance(P1) < aPnt.Distance(P2) ) P11.Coord(X, Y, Z);
- else P12.Coord(X, Y, Z);
- V3(2).SetCoord(X, Y, Z);
-
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V3);
- }
-}
-//------------------------------------------------------------------------------------------------------------------
-// Returns 1 if C is above of CMin; 0 if C is bitween CMin and CMax; -1 if C is Below CMax
-//-----------------------------------------------------------------------------------------------------------------
-static Standard_Integer AboveInBelowCone(gp_Circ CMax, gp_Circ CMin, gp_Circ C)
-{
- Standard_Real D, D1, D2;
-
- D = CMax.Location().Distance( CMin.Location() );
- D1 = CMax.Location().Distance( C.Location() );
- D2 = CMin.Location().Distance( C.Location() );
-
-
- if ( D >= D1 && D >= D2 ) return 0;
- if ( D < D2 && D1 < D2 ) return -1;
- if ( D < D1 && D2 < D1 ) return 1;
-
- return 0;
+ aPrims = new Graphic3d_ArrayOfSegments(4);
+ aPrims->AddVertex(AttachmentPnt);
+ aPrims->AddVertex(( aPnt.Distance(P1) < aPnt.Distance(P2) )? P12 : P11);
+ aPrims->AddVertex(OppositePnt);
+ aPrims->AddVertex(( aPnt.Distance(P1) < aPnt.Distance(P2) )? P11 : P12);
+ }
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
//==========================================================================
void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
- const Handle(Prs3d_Drawer)& aDrawer,
- const Standard_Real theval,
- const TCollection_ExtendedString& aText,
- const gp_Pnt& CenterPoint,
- const gp_Pnt& AttachmentPoint1,
- const gp_Pnt& AttachmentPoint2,
- const gp_Dir& dir1,
- const gp_Dir& dir2,
- const gp_Dir& axisdir,
- const gp_Pnt& OffsetPoint) {
+ const Handle(Prs3d_Drawer)& aDrawer,
+ const Standard_Real theval,
+ const TCollection_ExtendedString& aText,
+ const gp_Pnt& CenterPoint,
+ const gp_Pnt& AttachmentPoint1,
+ const gp_Pnt& AttachmentPoint2,
+ const gp_Dir& dir1,
+ const gp_Dir& dir2,
+ const gp_Dir& axisdir,
+ const gp_Pnt& OffsetPoint)
+{
char valcar[80];
sprintf(valcar,"%5.2f",theval);
-
+
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Circ cer(ax,CenterPoint.Distance(OffsetPoint));
gp_Vec vec1(dir1);
vec1 *= cer.Radius();
-#ifdef DEB
- gp_Pnt p1 =
-#endif
- CenterPoint.Translated(vec1);
gp_Vec vec2(dir2);
vec2 *= cer.Radius();
gp_Pnt p2 = CenterPoint.Translated(vec2);
if (uco > ufin) {
if (Abs(theval)<M_PI) {
// test if uco is in the opposite sector
- if (uco > udeb+M_PI && uco < ufin+M_PI){
- udeb = udeb + M_PI;
- ufin = ufin + M_PI;
- uc1 = udeb;
- uc2 = ufin;
+ if (uco > udeb+M_PI && uco < ufin+M_PI) {
+ udeb += M_PI;
+ ufin += M_PI;
+ uc1 = udeb;
+ uc2 = ufin;
}
}
}
if (uco > ufin) {
- if ((uco-uc2) < (uc1-uco+(2*M_PI))) {
+ if ((uco-uc2) < (uc1-uco+(2.*M_PI))) {
ufin = uco;
}
else {
- udeb = uco - 2*M_PI;
+ udeb = uco - 2.*M_PI;
}
}
- Standard_Real alpha = Abs(ufin-udeb);
- Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
- Graphic3d_Array1OfVertex V(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- gp_Pnt ptcur;
- for (Standard_Integer i = 1; i<=nbp; i++) {
- ptcur = ElCLib::Value(udeb+ dteta*(i-1),cer);
- V(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
+ const Standard_Real alpha = Abs(ufin-udeb);
+ const Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
+ const Standard_Real dteta = alpha/(nbp-1);
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp+4,3);
+ aPrims->AddBound(nbp);
+ for (Standard_Integer i = 1; i<=nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(udeb+ dteta*(i-1),cer));
+
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,OffsetPoint);
+ Standard_Real length = LA->ArrowAspect()->Length();
+ if (length < Precision::Confusion()) length = 1.e-04;
+
gp_Vec vecarr;
gp_Pnt ptarr;
ElCLib::D1(uc1,cer,ptarr,vecarr);
+
gp_Ax1 ax1(ptarr, axisdir);
gp_Dir dirarr(-vecarr);
+
//calculate angle of rotation
- Standard_Real beta(0.);
- Standard_Real length = LA->ArrowAspect()->Length();
- if (length < Precision::Confusion()) length = 1.e-04;
gp_Pnt ptarr2(ptarr.XYZ() + length*dirarr.XYZ());
- Standard_Real parcir = ElCLib::Parameter(cer, ptarr2);
+ const Standard_Real parcir = ElCLib::Parameter(cer, ptarr2);
gp_Pnt ptarr3 = ElCLib::Value(parcir, cer);
- gp_Vec v1(ptarr,ptarr2 );
- gp_Vec v2(ptarr, ptarr3);
- beta = v1.Angle(v2);
+ gp_Vec v1(ptarr,ptarr2);
+ gp_Vec v2(ptarr,ptarr3);
+ const Standard_Real beta = v1.Angle(v2);
dirarr.Rotate(ax1, beta);
- Prs3d_Arrow::Draw(aPresentation,
- ptarr,
- dirarr,
- LA->ArrowAspect()->Angle(),
- length);
-
- Graphic3d_Array1OfVertex Vrap(1,2);
- Vrap(1).SetCoord(AttachmentPoint1.X(),
- AttachmentPoint1.Y(),
- AttachmentPoint1.Z());
- Vrap(2).SetCoord(ptarr.X(),ptarr.Y(),ptarr.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrap);
-
+ Prs3d_Arrow::Draw(aPresentation,ptarr,dirarr,LA->ArrowAspect()->Angle(),length);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(ptarr);
+
ElCLib::D1(uc2,cer,ptarr,vecarr);
+
ax1.SetLocation(ptarr);
gp_Dir dirarr2(vecarr);
dirarr2.Rotate(ax1,-beta);
- Prs3d_Arrow::Draw(aPresentation,
- ptarr,
- dirarr2,
- LA->ArrowAspect()->Angle(),
- length);
-
- Vrap(1).SetCoord(AttachmentPoint2.X(),
- AttachmentPoint2.Y(),
- AttachmentPoint2.Z());
- Vrap(2).SetCoord(ptarr.X(),ptarr.Y(),ptarr.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrap);
+ Prs3d_Arrow::Draw(aPresentation,ptarr,dirarr2,LA->ArrowAspect()->Angle(),length);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(ptarr);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
// purpose : Adds prezentation of angle between two faces
//==========================================================================
-void DsgPrs_AnglePresentation::Add( const Handle(Prs3d_Presentation)& aPresentation,
- const Handle(Prs3d_Drawer)& aDrawer,
- const Standard_Real theval,
- const TCollection_ExtendedString& aText,
- const gp_Pnt& CenterPoint,
- const gp_Pnt& AttachmentPoint1,
- const gp_Pnt& AttachmentPoint2,
- const gp_Dir& dir1,
- const gp_Dir& dir2,
- const gp_Dir& axisdir,
- const Standard_Boolean isPlane,
- const gp_Ax1& AxisOfSurf,
- const gp_Pnt& OffsetPoint,
- const DsgPrs_ArrowSide ArrowPrs )
+void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
+ const Handle(Prs3d_Drawer)& aDrawer,
+ const Standard_Real theval,
+ const TCollection_ExtendedString& aText,
+ const gp_Pnt& CenterPoint,
+ const gp_Pnt& AttachmentPoint1,
+ const gp_Pnt& AttachmentPoint2,
+ const gp_Dir& dir1,
+ const gp_Dir& dir2,
+ const gp_Dir& axisdir,
+ const Standard_Boolean isPlane,
+ const gp_Ax1& AxisOfSurf,
+ const gp_Pnt& OffsetPoint,
+ const DsgPrs_ArrowSide ArrowPrs )
{
char valcar[80];
- sprintf( valcar, "%5.2f", theval );
+ sprintf(valcar,"%5.2f",theval);
Handle( Prs3d_AngleAspect ) LA = aDrawer->AngleAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
FirstParAttachCirc,
LastParAttachCirc );
- Graphic3d_Array1OfVertex Vrap(1,2);
-
// Creating the angle's arc or line if null angle
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims;
if (theval > Precision::Angular() && Abs( M_PI-theval ) > Precision::Angular())
- {
- Standard_Real Alpha = Abs( LastParAngleCirc - FirstParAngleCirc );
- Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
- Graphic3d_Array1OfVertex ApproxArc( 0, NodeNumber-1 );
- Standard_Real delta = Alpha / (Standard_Real)( NodeNumber - 1 );
- gp_Pnt CurPnt;
- for (Standard_Integer i = 0 ; i < NodeNumber; i++)
- {
- CurPnt = ElCLib::Value( FirstParAngleCirc, AngleCirc );
- ApproxArc(i).SetCoord( CurPnt.X(), CurPnt.Y(), CurPnt.Z() );
- FirstParAngleCirc += delta ;
- }
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( ApproxArc );
- }
+ {
+ const Standard_Real Alpha = Abs( LastParAngleCirc - FirstParAngleCirc );
+ const Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
+ const Standard_Real delta = Alpha / (Standard_Real)( NodeNumber - 1 );
+
+ aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber+4,3);
+ aPrims->AddBound(NodeNumber);
+ for (Standard_Integer i = 0; i < NodeNumber; i++, FirstParAngleCirc += delta)
+ aPrims->AddVertex(ElCLib::Value( FirstParAngleCirc, AngleCirc ));
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ aPrims = new Graphic3d_ArrayOfSegments(4);
+ }
else // null angle
- {
- Vrap(1).SetCoord( OffsetPoint.X(),
- OffsetPoint.Y(),
- OffsetPoint.Z());
- Vrap(2).SetCoord( EndOfArrow1.X(), EndOfArrow1.Y(), EndOfArrow1.Z() );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( Vrap );
- }
+ {
+ aPrims = new Graphic3d_ArrayOfSegments(6);
+ aPrims->AddVertex(OffsetPoint);
+ aPrims->AddVertex(EndOfArrow1);
+ }
// Add presentation of arrows
DsgPrs::ComputeSymbol( aPresentation, LA, EndOfArrow1, EndOfArrow2, DirOfArrow1, DirOfArrow2, ArrowPrs );
Prs3d_Text::Draw( aPresentation, LA->TextAspect(), aText, OffsetPoint );
// Line from AttachmentPoint1 to end of Arrow1
- Vrap(1).SetCoord(AttachmentPoint1.X(),
- AttachmentPoint1.Y(),
- AttachmentPoint1.Z());
- Vrap(2).SetCoord( EndOfArrow1.X(), EndOfArrow1.Y(), EndOfArrow1.Z() );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( Vrap );
-
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(EndOfArrow1);
+ // Line from "projection" of AttachmentPoint2 to end of Arrow2
+ aPrims->AddVertex(ProjAttachPoint2);
+ aPrims->AddVertex(EndOfArrow2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
// Line or arc from AttachmentPoint2 to its "projection"
if (AttachmentPoint2.Distance( ProjAttachPoint2 ) > Precision::Confusion())
- {
- if (isPlane)
+ {
+ if (isPlane)
{
// Creating the line from AttachmentPoint2 to its projection
- Vrap(1).SetCoord( AttachmentPoint2.X(),
- AttachmentPoint2.Y(),
- AttachmentPoint2.Z() );
- Vrap(2).SetCoord( ProjAttachPoint2.X(),
- ProjAttachPoint2.Y(),
- ProjAttachPoint2.Z() );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( Vrap );
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(ProjAttachPoint2);
}
- else
+ else
{
// Creating the arc from AttachmentPoint2 to its projection
- Standard_Real Alpha = Abs( LastParAttachCirc - FirstParAttachCirc );
- Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
- Graphic3d_Array1OfVertex ApproxArc( 0, NodeNumber-1 );
- Standard_Real delta = Alpha / (Standard_Real)( NodeNumber - 1 );
- gp_Pnt CurPnt;
- for (Standard_Integer i = 0 ; i < NodeNumber; i++)
- {
- CurPnt = ElCLib::Value( FirstParAttachCirc, AttachCirc );
- ApproxArc(i).SetCoord( CurPnt.X(), CurPnt.Y(), CurPnt.Z() );
- FirstParAttachCirc += delta ;
- }
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( ApproxArc );
+ const Standard_Real Alpha = Abs( LastParAttachCirc - FirstParAttachCirc );
+ const Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
+ const Standard_Real delta = Alpha / (Standard_Real)( NodeNumber - 1 );
+
+ aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
+ for (Standard_Integer i = 0; i < NodeNumber; i++, FirstParAttachCirc += delta)
+ aPrims->AddVertex(ElCLib::Value( FirstParAttachCirc, AttachCirc ));
}
- }
- // Line from "projection" of AttachmentPoint2 to end of Arrow2
- Vrap(1).SetCoord( ProjAttachPoint2.X(),
- ProjAttachPoint2.Y(),
- ProjAttachPoint2.Z() );
- Vrap(2).SetCoord( EndOfArrow2.X(), EndOfArrow2.Y(), EndOfArrow2.Z());
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( Vrap );
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
}
//==========================================================================
void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
- const Handle(Prs3d_Drawer)& aDrawer,
- const Standard_Real theval,
- const TCollection_ExtendedString& aText,
- const gp_Pnt& CenterPoint,
- const gp_Pnt& AttachmentPoint1,
- const gp_Pnt& AttachmentPoint2,
- const gp_Dir& dir1,
- const gp_Dir& dir2,
- const gp_Pnt& OffsetPoint) {
+ const Handle(Prs3d_Drawer)& aDrawer,
+ const Standard_Real theval,
+ const TCollection_ExtendedString& aText,
+ const gp_Pnt& CenterPoint,
+ const gp_Pnt& AttachmentPoint1,
+ const gp_Pnt& AttachmentPoint2,
+ const gp_Dir& dir1,
+ const gp_Dir& dir2,
+ const gp_Pnt& OffsetPoint)
+{
char valcar[80];
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
gp_Dir Norm;
if (!dir1.IsParallel(dir2, Precision::Angular())) {
Norm = dir1.Crossed(dir2);
gp_Circ cer(ax,CenterPoint.Distance(OffsetPoint));
gp_Vec vec1(dir1);
vec1 *= cer.Radius();
-#ifdef DEB
- gp_Pnt p1 =
-#endif
- CenterPoint.Translated(vec1);
gp_Vec vec2(dir2);
vec2 *= cer.Radius();
gp_Pnt p2 = CenterPoint.Translated(vec2);
if (uco > ufin) {
if (Abs(theval)<M_PI) {
// test if uco is in the opposite sector
- if (uco > udeb+M_PI && uco < ufin+M_PI){
- udeb = udeb + M_PI;
- ufin = ufin + M_PI;
- uc1 = udeb;
- uc2 = ufin;
+ if (uco > udeb+M_PI && uco < ufin+M_PI) {
+ udeb += M_PI;
+ ufin += M_PI;
+ uc1 = udeb;
+ uc2 = ufin;
}
}
}
if (uco > ufin) {
- if ((uco-uc2) < (uc1-uco+(2*M_PI))) {
+ if ((uco-uc2) < (uc1-uco+(2.*M_PI))) {
ufin = uco;
}
else {
- udeb = uco - 2*M_PI;
+ udeb = uco - 2.*M_PI;
}
}
- Standard_Real alpha = Abs(ufin-udeb);
- Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
- Graphic3d_Array1OfVertex V(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- gp_Pnt ptcur;
- for (Standard_Integer i = 1; i<=nbp; i++) {
- ptcur = ElCLib::Value(udeb+ dteta*(i-1),cer);
- V(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ const Standard_Real alpha = Abs(ufin-udeb);
+ const Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
+ const Standard_Real dteta = alpha/(nbp-1);
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp+4,3);
+ aPrims->AddBound(nbp);
+ for (Standard_Integer i = 1; i<=nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(udeb+ dteta*(i-1),cer));
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,OffsetPoint);
+ Standard_Real length = LA->ArrowAspect()->Length();
+ if (length < Precision::Confusion()) length = 1.e-04;
+
gp_Vec vecarr;
gp_Pnt ptarr;
ElCLib::D1(uc1,cer,ptarr,vecarr);
+
gp_Ax1 ax1(ptarr, Norm);
gp_Dir dirarr(-vecarr);
//calculate the angle of rotation
- Standard_Real beta;
- Standard_Real length = LA->ArrowAspect()->Length();
- if (length < Precision::Confusion()) length = 1.e-04;
gp_Pnt ptarr2(ptarr.XYZ() + length*dirarr.XYZ());
- Standard_Real parcir = ElCLib::Parameter(cer, ptarr2);
+ const Standard_Real parcir = ElCLib::Parameter(cer, ptarr2);
gp_Pnt ptarr3 = ElCLib::Value(parcir, cer);
- gp_Vec v1(ptarr,ptarr2 );
- gp_Vec v2(ptarr, ptarr3);
- beta = v1.Angle(v2);
+ gp_Vec v1(ptarr,ptarr2);
+ gp_Vec v2(ptarr,ptarr3);
+ const Standard_Real beta = v1.Angle(v2);
dirarr.Rotate(ax1, beta);
- Prs3d_Arrow::Draw(aPresentation,
- ptarr,
- dirarr,
- LA->ArrowAspect()->Angle(),
- length);
- Graphic3d_Array1OfVertex Vrap(1,2);
- Vrap(1).SetCoord(AttachmentPoint1.X(),
- AttachmentPoint1.Y(),
- AttachmentPoint1.Z());
- Vrap(2).SetCoord(ptarr.X(),ptarr.Y(),ptarr.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrap);
-
+ Prs3d_Arrow::Draw(aPresentation,ptarr,dirarr,LA->ArrowAspect()->Angle(),length);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(ptarr);
+
ElCLib::D1(uc2,cer,ptarr,vecarr);
+
ax1.SetLocation(ptarr);
gp_Dir dirarr2(vecarr);
dirarr2.Rotate(ax1, - beta);
- Prs3d_Arrow::Draw(aPresentation,
- ptarr,
- dirarr2,
- LA->ArrowAspect()->Angle(),
- length);
+ Prs3d_Arrow::Draw(aPresentation,ptarr,dirarr2,LA->ArrowAspect()->Angle(),length);
- Vrap(1).SetCoord(AttachmentPoint2.X(),
- AttachmentPoint2.Y(),
- AttachmentPoint2.Z());
- Vrap(2).SetCoord(ptarr.X(),ptarr.Y(),ptarr.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrap);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(ptarr);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
+
//==========================================================================
// function : DsgPrs_AnglePresentation::Add
// purpose : It is possible to choose the symbol of extremities of the face (arrow, point...)
//==========================================================================
void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
- const Handle(Prs3d_Drawer)& aDrawer,
- const Standard_Real theval,
- const TCollection_ExtendedString& aText,
- const gp_Pnt& CenterPoint,
- const gp_Pnt& AttachmentPoint1,
- const gp_Pnt& AttachmentPoint2,
- const gp_Dir& dir1,
- const gp_Dir& dir2,
- const gp_Pnt& OffsetPoint,
- const DsgPrs_ArrowSide ArrowPrs)
+ const Handle(Prs3d_Drawer)& aDrawer,
+ const Standard_Real theval,
+ const TCollection_ExtendedString& aText,
+ const gp_Pnt& CenterPoint,
+ const gp_Pnt& AttachmentPoint1,
+ const gp_Pnt& AttachmentPoint2,
+ const gp_Dir& dir1,
+ const gp_Dir& dir2,
+ const gp_Pnt& OffsetPoint,
+ const DsgPrs_ArrowSide ArrowPrs)
{
char valcar[80];
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- gp_Dir Norm = dir1.Crossed(dir2);
+ gp_Dir Norm = dir1.Crossed(dir2);
if (Abs(theval) > M_PI) Norm.Reverse();
gp_Ax2 ax(CenterPoint,Norm,dir1);
gp_Circ cer(ax,CenterPoint.Distance(OffsetPoint));
gp_Vec vec1(dir1);
vec1 *= cer.Radius();
-#ifdef DEB
- gp_Pnt p1 =
-#endif
- CenterPoint.Translated(vec1);
gp_Vec vec2(dir2);
vec2 *= cer.Radius();
gp_Pnt p2 = CenterPoint.Translated(vec2);
if (uco > ufin) {
if (Abs(theval)<M_PI) {
// test if uco is in the opposite sector
- if (uco > udeb+M_PI && uco < ufin+M_PI){
- udeb = udeb + M_PI;
- ufin = ufin + M_PI;
- uc1 = udeb;
- uc2 = ufin;
+ if (uco > udeb+M_PI && uco < ufin+M_PI) {
+ udeb += M_PI;
+ ufin += M_PI;
+ uc1 = udeb;
+ uc2 = ufin;
}
}
}
if (uco > ufin) {
- if ((uco-uc2) < (uc1-uco+(2*M_PI))) {
+ if ((uco-uc2) < (uc1-uco+(2.*M_PI))) {
ufin = uco;
}
else {
- udeb = uco - 2*M_PI;
+ udeb = uco - 2.*M_PI;
}
}
- Standard_Real alpha = Abs(ufin-udeb);
- Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
- Graphic3d_Array1OfVertex V(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- gp_Pnt ptcur;
- for (Standard_Integer i = 1; i<=nbp; i++) {
- ptcur = ElCLib::Value(udeb+ dteta*(i-1),cer);
- V(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
+ const Standard_Real alpha = Abs(ufin-udeb);
+ const Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
+ const Standard_Real dteta = alpha/(nbp-1);
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp+4,3);
+ aPrims->AddBound(nbp);
+ for (Standard_Integer i = 1; i<=nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(udeb+ dteta*(i-1),cer));
+
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,OffsetPoint);
-// Lines of recall
+ Standard_Real length = LA->ArrowAspect()->Length();
+ if (length < Precision::Confusion()) length = 1.e-04;
+
+ // Lines of recall
gp_Vec vecarr;
gp_Pnt ptarr;
ElCLib::D1(uc1,cer,ptarr,vecarr);
+
gp_Ax1 ax1(ptarr, Norm);
gp_Dir dirarr(-vecarr);
//calculate angle of rotation
- Standard_Real beta(0.);
- Standard_Real length = LA->ArrowAspect()->Length();
- if (length < Precision::Confusion()) length = 1.e-04;
gp_Pnt ptarr2(ptarr.XYZ() + length*dirarr.XYZ());
- Standard_Real parcir = ElCLib::Parameter(cer, ptarr2);
+ const Standard_Real parcir = ElCLib::Parameter(cer, ptarr2);
gp_Pnt ptarr3 = ElCLib::Value(parcir, cer);
gp_Vec v1(ptarr,ptarr2 );
gp_Vec v2(ptarr, ptarr3);
- beta = v1.Angle(v2);
+ const Standard_Real beta = v1.Angle(v2);
dirarr.Rotate(ax1, beta);
- Graphic3d_Array1OfVertex Vrap(1,2);
- Vrap(1).SetCoord(AttachmentPoint1.X(),
- AttachmentPoint1.Y(),
- AttachmentPoint1.Z());
- Vrap(2).SetCoord(ptarr.X(),ptarr.Y(),ptarr.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrap);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(ptarr);
gp_Vec vecarr1;
gp_Pnt ptarr1;
gp_Dir dirarr2(vecarr1);
dirarr2.Rotate(ax1, - beta);
-
- Vrap(1).SetCoord(AttachmentPoint2.X(),
- AttachmentPoint2.Y(),
- AttachmentPoint2.Z());
- Vrap(2).SetCoord(ptarr1.X(),ptarr1.Y(),ptarr1.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrap);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(ptarr1);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
-// One traces the arrows
+ // One traces the arrows
DsgPrs::ComputeSymbol(aPresentation,LA,ptarr,ptarr1,dirarr,dirarr2,ArrowPrs);
}
-
-
//==========================================================================
// function : DsgPrs_AnglePresentation::Add
// purpose :
//==========================================================================
void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
- const Handle(Prs3d_Drawer)& aDrawer,
- const Standard_Real theval,
- const gp_Pnt& CenterPoint,
- const gp_Pnt& AttachmentPoint1,
- const gp_Pnt& AttachmentPoint2,
- const gp_Dir& dir1,
- const gp_Dir& dir2,
- const gp_Pnt& OffsetPoint) {
-
-
+ const Handle(Prs3d_Drawer)& aDrawer,
+ const Standard_Real theval,
+ const gp_Pnt& CenterPoint,
+ const gp_Pnt& AttachmentPoint1,
+ const gp_Pnt& AttachmentPoint2,
+ const gp_Dir& dir1,
+ const gp_Dir& dir2,
+ const gp_Pnt& OffsetPoint)
+{
char valcar[80];
sprintf(valcar,"%5.2f",theval);
+
TCollection_AsciiString valas(valcar);
TCollection_ExtendedString aText(valas);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- gp_Dir Norm = dir1.Crossed(dir2);
+ gp_Dir Norm = dir1.Crossed(dir2);
if (Abs(theval) > M_PI) Norm.Reverse();
gp_Ax2 ax(CenterPoint,Norm,dir1);
gp_Circ cer(ax,CenterPoint.Distance(OffsetPoint));
gp_Vec vec1(dir1);
vec1 *= cer.Radius();
-#ifdef DEB
- gp_Pnt p1 =
-#endif
- CenterPoint.Translated(vec1);
gp_Vec vec2(dir2);
vec2 *= cer.Radius();
gp_Pnt p2 = CenterPoint.Translated(vec2);
if (uco > ufin) {
if (Abs(theval)<M_PI) {
// test if uco is in the opposite sector
- if (uco > udeb+M_PI && uco < ufin+M_PI){
- udeb = udeb + M_PI;
- ufin = ufin + M_PI;
- uc1 = udeb;
- uc2 = ufin;
+ if (uco > udeb+M_PI && uco < ufin+M_PI) {
+ udeb += M_PI;
+ ufin += M_PI;
+ uc1 = udeb;
+ uc2 = ufin;
}
}
}
if (uco > ufin) {
- if ((uco-uc2) < (uc1-uco+(2*M_PI))) {
+ if ((uco-uc2) < (uc1-uco+(2.*M_PI))) {
ufin = uco;
}
else {
- udeb = uco - 2*M_PI;
+ udeb = uco - 2.*M_PI;
}
}
- Standard_Real alpha = Abs(ufin-udeb);
- Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
- Graphic3d_Array1OfVertex V(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- gp_Pnt ptcur;
- for (Standard_Integer i = 1; i<=nbp; i++) {
- ptcur = ElCLib::Value(udeb+ dteta*(i-1),cer);
- V(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
+ const Standard_Real alpha = Abs(ufin-udeb);
+ const Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
+ const Standard_Real dteta = alpha/(nbp-1);
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp+4,3);
+ aPrims->AddBound(nbp);
+ for (Standard_Integer i = 1; i<=nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(udeb+ dteta*(i-1),cer));
+
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,OffsetPoint);
+ Standard_Real length = LA->ArrowAspect()->Length();
+ if (length < Precision::Confusion()) length = 1.e-04;
+
gp_Vec vecarr;
gp_Pnt ptarr;
ElCLib::D1(uc1,cer,ptarr,vecarr);
+
gp_Ax1 ax1(ptarr, Norm);
gp_Dir dirarr(-vecarr);
//calculate the angle of rotation
- Standard_Real beta;
- Standard_Real length = LA->ArrowAspect()->Length();
- if (length < Precision::Confusion()) length = 1.e-04;
gp_Pnt ptarr2(ptarr.XYZ() + length*dirarr.XYZ());
- Standard_Real parcir = ElCLib::Parameter(cer, ptarr2);
+ const Standard_Real parcir = ElCLib::Parameter(cer, ptarr2);
gp_Pnt ptarr3 = ElCLib::Value(parcir, cer);
gp_Vec v1(ptarr,ptarr2 );
gp_Vec v2(ptarr, ptarr3);
- beta = v1.Angle(v2);
+ const Standard_Real beta = v1.Angle(v2);
dirarr.Rotate(ax1, beta);
- Prs3d_Arrow::Draw(aPresentation,
- ptarr,
- dirarr,
- LA->ArrowAspect()->Angle(),
- length);
-
- Graphic3d_Array1OfVertex Vrap(1,2);
- Vrap(1).SetCoord(AttachmentPoint1.X(),
- AttachmentPoint1.Y(),
- AttachmentPoint1.Z());
- Vrap(2).SetCoord(ptarr.X(),ptarr.Y(),ptarr.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrap);
-
+
+ Prs3d_Arrow::Draw(aPresentation,ptarr,dirarr,LA->ArrowAspect()->Angle(),length);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(ptarr);
+
ElCLib::D1(uc2,cer,ptarr,vecarr);
ax1.SetLocation(ptarr);
gp_Dir dirarr2(vecarr);
- dirarr2.Rotate(ax1, - beta);
- Prs3d_Arrow::Draw(aPresentation,
- ptarr,
- dirarr2,
- LA->ArrowAspect()->Angle(),
- length);
+ dirarr2.Rotate(ax1, -beta);
+
+ Prs3d_Arrow::Draw(aPresentation,ptarr,dirarr2,LA->ArrowAspect()->Angle(),length);
- Vrap(1).SetCoord(AttachmentPoint2.X(),
- AttachmentPoint2.Y(),
- AttachmentPoint2.Z());
- Vrap(2).SetCoord(ptarr.X(),ptarr.Y(),ptarr.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrap);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(ptarr);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentation,
- const Handle(Prs3d_Drawer)& aDrawer,
- const Standard_Real theval,
- const gp_Pnt& CenterPoint,
- const gp_Pnt& AttachmentPoint1,
- const gp_Ax1& theAxe,
- const DsgPrs_ArrowSide ArrowSide)
+ const Handle(Prs3d_Drawer)& aDrawer,
+ const Standard_Real theval,
+ const gp_Pnt& CenterPoint,
+ const gp_Pnt& AttachmentPoint1,
+ const gp_Ax1& theAxe,
+ const DsgPrs_ArrowSide ArrowSide)
{
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Ax2 ax(CenterPoint,theAxe.Direction(),dir1);
gp_Circ cer(ax,CenterPoint.Distance(AttachmentPoint1));
- Standard_Integer nbp = Max (4 , Standard_Integer (50. * theval / M_PI));
- Graphic3d_Array1OfVertex V(1,nbp);
- Standard_Real dteta = theval/(nbp-1);
- gp_Pnt ptcur;
- for (Standard_Integer i = 1; i<=nbp; i++) {
- ptcur = ElCLib::Value(dteta*(i-1),cer);
- V(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
+ const Standard_Integer nbp = Max (4 , Standard_Integer (50. * theval / M_PI));
+ const Standard_Real dteta = theval/(nbp-1);
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp);
+ for (Standard_Integer i = 1; i<=nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(dteta*(i-1),cer));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
Standard_Real uc1 = 0.;
Standard_Real uc2 = ElCLib::Parameter(cer,AttachmentPoint1.Rotated(theAxe,theval));
- gp_Vec vecarr;
- gp_Pnt ptarr;
Standard_Real length = LA->ArrowAspect()->Length();
- if (length < Precision::Confusion()) length = 1.e-04;
+ if (length < Precision::Confusion()) length = 1.e-04;
- switch(ArrowSide) {
- case DsgPrs_AS_NONE:
- {
- break;
- }
- case DsgPrs_AS_FIRSTAR:
+ gp_Vec vecarr;
+ gp_Pnt ptarr;
+ switch(ArrowSide)
+ {
+ case DsgPrs_AS_FIRSTAR:
{
ElCLib::D1(uc1,cer,ptarr,vecarr);
- Prs3d_Arrow::Draw(aPresentation,
- ptarr,
- gp_Dir(-vecarr),
- LA->ArrowAspect()->Angle(),
- length);
+ Prs3d_Arrow::Draw(aPresentation,ptarr,gp_Dir(-vecarr),LA->ArrowAspect()->Angle(),length);
break;
}
- case DsgPrs_AS_LASTAR:
+ case DsgPrs_AS_LASTAR:
{
ElCLib::D1(uc2,cer,ptarr,vecarr);
- Prs3d_Arrow::Draw(aPresentation,
- ptarr,
- gp_Dir(vecarr),
- LA->ArrowAspect()->Angle(),
- length);
+ Prs3d_Arrow::Draw(aPresentation,ptarr,gp_Dir(vecarr),LA->ArrowAspect()->Angle(),length);
break;
}
- case DsgPrs_AS_BOTHAR:
+ case DsgPrs_AS_BOTHAR:
{
ElCLib::D1(uc1,cer,ptarr,vecarr);
- Prs3d_Arrow::Draw(aPresentation,
- ptarr,
- gp_Dir(-vecarr),
- LA->ArrowAspect()->Angle(),
- length);
+ Prs3d_Arrow::Draw(aPresentation,ptarr,gp_Dir(-vecarr),LA->ArrowAspect()->Angle(),length);
ElCLib::D1(uc2,cer,ptarr,vecarr);
- Prs3d_Arrow::Draw(aPresentation,
- ptarr,
- gp_Dir(vecarr),
- LA->ArrowAspect()->Angle(),
- length);
+ Prs3d_Arrow::Draw(aPresentation,ptarr,gp_Dir(vecarr),LA->ArrowAspect()->Angle(),length);
break;
}
- default:
- break;
+ default: break;
}
}
-
#include <DsgPrs_Chamf2dPresentation.ixx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
- Prs3d_Root::CurrentGroup(aPresentation)
- ->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex V(1,2);
- V(1).SetCoord(aPntAttach.X(),aPntAttach.Y(),aPntAttach.Z());
-
- V(2).SetCoord(aPntEnd.X(),aPntEnd.Y(),aPntEnd.Z());
-
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(aPntAttach);
+ aPrims->AddVertex(aPntEnd);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
- Prs3d_Arrow::Draw(aPresentation,
- aPntAttach,
- ArrowDir,
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,aPntAttach,ArrowDir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntEnd);
-
}
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
- Prs3d_Root::CurrentGroup(aPresentation)
- ->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex V(1,2);
- V(1).SetCoord(aPntAttach.X(),aPntAttach.Y(),aPntAttach.Z());
-
- V(2).SetCoord(aPntEnd.X(),aPntEnd.Y(),aPntEnd.Z());
-
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(aPntAttach);
+ aPrims->AddVertex(aPntEnd);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntEnd);
gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
-
gp_Dir ArrowDir1 = ArrowDir;
ArrowDir1.Reverse();
DsgPrs::ComputeSymbol(aPresentation,LA,aPntEnd,aPntAttach,ArrowDir1,ArrowDir,ArrowPrs);
-
-
}
#include <DsgPrs_ConcentricPresentation.ixx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_LineAspect.hxx>
//Creation et discretisation du plus gros cercle
gp_Circ Circ(gp_Ax2(aCenter,aNorm), aRadius);
- Standard_Integer nbp = 50;
- Standard_Real dteta = (2 * M_PI)/nbp;
- Graphic3d_Array1OfVertex V(1,nbp+1);
- gp_Pnt ptcur;
- Standard_Real ucur = 0;
+ const Standard_Integer nbp = 50;
+ const Standard_Real dteta = (2. * M_PI)/nbp;
+
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(2*nbp+6,4);
+
+ gp_Pnt pt1 = ElCLib::Value(0., Circ);
+ aPrims->AddBound(nbp+1);
+ aPrims->AddVertex(pt1);
+ Standard_Real ucur = dteta;
Standard_Integer i ;
- for ( i = 1; i<=nbp; i++) {
- ptcur = ElCLib::Value(ucur, Circ);
- V(i).SetCoord(ptcur.X(), ptcur.Y(),ptcur.Z());
- ucur = ucur + dteta;
- }
- V(nbp+1).SetCoord( V(1).X(), V(1).Y(), V(1).Z());
- Prs3d_Root::CurrentGroup(aPresentation)
- ->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ for (i = 2; i<=nbp; i++, ucur += dteta)
+ aPrims->AddVertex(ElCLib::Value(ucur, Circ));
+ aPrims->AddVertex(pt1);
//Creation et discretisation du plus petit cercle
- Circ.SetRadius(aRadius/2);
- ucur = 0;
- for ( i = 1; i<=nbp; i++) {
- ptcur = ElCLib::Value(ucur, Circ);
- V(i).SetCoord(ptcur.X(), ptcur.Y(),ptcur.Z());
- ucur = ucur + dteta;
- }
- V(nbp+1).SetCoord( V(1).X(), V(1).Y(), V(1).Z());
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)
- ->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Circ.SetRadius(0.5*aRadius);
+ pt1 = ElCLib::Value(0., Circ);
+ aPrims->AddBound(nbp+1);
+ aPrims->AddVertex(pt1);
+ ucur = dteta;
+ for (i = 2; i<=nbp; i++, ucur += dteta)
+ aPrims->AddVertex(ElCLib::Value(ucur, Circ));
+ aPrims->AddVertex(pt1);
//Creation de la croix
//1er segment
- gp_Dir vecnorm(aPoint.XYZ() - aCenter.XYZ() );
+ gp_Dir vecnorm(aPoint.XYZ() - aCenter.XYZ());
gp_Vec vec(vecnorm);
vec.Multiply(aRadius);
gp_Pnt p1 = aCenter.Translated(vec);
gp_Pnt p2 = aCenter.Translated(-vec);
-
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->
- SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex VExt(1,2);
- VExt(1).SetCoord(p1.X(), p1.Y(), p1.Z());
- VExt(2).SetCoord(p2.X(), p2.Y(), p2.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VExt);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(p1);
+ aPrims->AddVertex(p2);
//2ieme segment
vec.Cross(aNorm);
vec.Multiply(aRadius);
p1 = aCenter.Translated(vec);
p2 = aCenter.Translated(-vec);
- VExt(1).SetCoord(p1.X(), p1.Y(), p1.Z());
- VExt(2).SetCoord(p2.X(), p2.Y(), p2.Z());
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->
- SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VExt);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(p1);
+ aPrims->AddVertex(p2);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
#include <Prs3d_ArrowAspect.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
const DsgPrs_ArrowSide ArrowPrs,
const Standard_Boolean IsDiamSymbol )
{
-
-
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt ptoncirc = ElCLib::Value (parat, aCircle);
// sideline
-
gp_Pnt center = aCircle.Location();
gp_Vec vecrap (ptoncirc,center);
Standard_Real dist = center.Distance(AttachmentPoint);
Standard_Real aRadius = aCircle.Radius();
- Standard_Boolean inside = Standard_False;
+ Standard_Boolean inside = (dist < aRadius);
gp_Pnt pt1 = AttachmentPoint;
- if (dist < aRadius) {
+ if (inside) {
pt1 = ptoncirc;
dist = aRadius;
- inside = Standard_True;
}
vecrap.Normalize();
vecrap *= (dist+aRadius);
- gp_Pnt OppositePoint = pt1.Translated(vecrap);
-
+ gp_Pnt OppositePoint = pt1.Translated(vecrap);
- Graphic3d_Array1OfVertex V(1,2);
- Quantity_Length X,Y,Z;
- pt1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- OppositePoint.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(pt1);
+ aPrims->AddVertex(OppositePoint);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// value
TCollection_ExtendedString Text = aText;
Prs3d_Text::Draw(aPresentation, LA->TextAspect(), Text, AttachmentPoint);
// arrows
-
gp_Dir arrdir (vecrap);
if (inside) arrdir.Reverse();
-
gp_Vec vecrap2 = vecrap;
gp_Pnt ptoncirc2 = ptoncirc;
gp_Dir arrdir2 = arrdir;
if(lpar > fpar)
return ((para >= fpar) && (para <= lpar));
else { // fpar > lpar
- Standard_Real delta = 2*M_PI-fpar;
+ Standard_Real delta = 2.*M_PI-fpar;
Standard_Real lp, par, fp;
lp = lpar + delta;
par = para + delta;
fp = 0.;
return ((par >= fp) && (par <= lp));
}
-
}
if (para >= (fpar+2*M_PI)) return Standard_True;
if (para <= lpar) return Standard_True;
{
Standard_Real fpara = uFirst;
Standard_Real lpara = uLast;
- while (lpara > 2*M_PI) {
- fpara -= 2*M_PI;
- lpara -= 2*M_PI;
+ while (lpara > 2.*M_PI) {
+ fpara -= 2.*M_PI;
+ lpara -= 2.*M_PI;
}
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
-// Handle(Prs3d_TextAspect) TA = aDrawer->TextAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
-// AspectText3d from Graphic3d
- Standard_Real parEndOfArrow = ElCLib::Parameter(aCircle,AttachmentPoint); //
+ Standard_Real parEndOfArrow = ElCLib::Parameter(aCircle,AttachmentPoint);
gp_Pnt EndOfArrow;
gp_Pnt DrawPosition = AttachmentPoint;// point of attachment
Standard_Boolean otherside = Standard_False;
gp_Lin L1( Center, dir1 );
gp_Lin L2( Center, dir2 );
if(L1.Distance(AttachmentPoint) < L2.Distance(AttachmentPoint))
- {
- EndOfArrow = FirstPoint; //***
- DrawPosition = ElCLib::Value(ElCLib::Parameter( L1, AttachmentPoint ), L1);
- }
+ {
+ EndOfArrow = FirstPoint; //***
+ DrawPosition = ElCLib::Value(ElCLib::Parameter( L1, AttachmentPoint ), L1);
+ }
else
- {
- EndOfArrow = SecondPoint; //***
- DrawPosition = ElCLib::Value(ElCLib::Parameter( L2, AttachmentPoint ), L2);
- }
+ {
+ EndOfArrow = SecondPoint; //***
+ DrawPosition = ElCLib::Value(ElCLib::Parameter( L2, AttachmentPoint ), L2);
+ }
}
-// EndOfArrow = ElCLib::Value(parEndOfArrow, aCircle);
-// DrawPosition = AttachmentPoint;
}
else {
EndOfArrow = ElCLib::Value(parEndOfArrow, aCircle);
DrawPosition = AttachmentPoint;
}
- Graphic3d_Array1OfVertex Vrap(1,2);
-
- Quantity_Length X,Y,Z;
-
- DrawPosition.Coord(X,Y,Z);
- Vrap(1).SetCoord(X,Y,Z);
- EndOfArrow.Coord(X,Y,Z);
- Vrap(2).SetCoord(X,Y,Z);
-
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrap);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(DrawPosition);
+ aPrims->AddVertex(EndOfArrow);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// text
TCollection_ExtendedString Text = aText;
Text = TCollection_ExtendedString("\330 ") + Text;// => \330 | \370?
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),Text,DrawPosition);
-// Add presentation of arrow
+ // Add presentation of arrow
gp_Dir DirOfArrow(gp_Vec(DrawPosition, EndOfArrow).XYZ());
- DsgPrs::ComputeSymbol(aPresentation, LA, EndOfArrow, EndOfArrow, DirOfArrow, DirOfArrow, ArrowPrs);
-
+ DsgPrs::ComputeSymbol(aPresentation, LA, EndOfArrow, EndOfArrow, DirOfArrow, DirOfArrow, ArrowPrs);
}
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_EllipseRadiusPresentation.ixx>
#include <gp_Lin.hxx>
#include <gp_Elips.hxx>
#include <ElCLib.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomAPI_ExtremaCurveCurve.hxx>
#include <Geom_OffsetCurve.hxx>
+
//=======================================================================
//function : Add
//purpose :
const Handle(Prs3d_Drawer)& aDrawer,
const Standard_Real theval,
const TCollection_ExtendedString & aText,
-// const gp_Elips & anEllipse,
const gp_Pnt & aPosition,
const gp_Pnt & anEndOfArrow,
const gp_Pnt & aCenter,
const Standard_Boolean IsMaxRadius,
const DsgPrs_ArrowSide ArrowPrs)
{
-
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Standard_Boolean inside = Standard_False;
-// gp_Pnt EndPoint, EndOfArrow;
- gp_Pnt EndPoint;
- Standard_Real dist = aCenter.Distance( aPosition );
- if( dist > theval ) EndPoint = aPosition;
- else {
- EndPoint = anEndOfArrow;
- inside = Standard_True;
- }
- Graphic3d_Array1OfVertex V(1,2);
- Quantity_Length X,Y,Z;
- aCenter.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- EndPoint.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
- // value
- TCollection_ExtendedString Text;
- if(IsMaxRadius)
- Text = TCollection_ExtendedString("a = ");
- else
- Text = TCollection_ExtendedString("b = ");
- Text += aText;
+ const Standard_Real dist = aCenter.Distance( aPosition );
+ const Standard_Boolean inside = ( dist <= theval );
+ gp_Pnt EndPoint(inside? anEndOfArrow : aPosition);
+
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(aCenter);
+ aPrims->AddVertex(EndPoint);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
+ // value
+ TCollection_ExtendedString Text(IsMaxRadius? "a = " : "b = ");
+ Text += aText;
Prs3d_Text::Draw(aPresentation, LA->TextAspect(), Text, aPosition );
- // arrows
+ // arrows
gp_Dir arrdir( gp_Vec( aCenter, anEndOfArrow));
if (!inside) arrdir.Reverse();
- DsgPrs::ComputeSymbol(aPresentation, LA, anEndOfArrow, anEndOfArrow, arrdir, arrdir, ArrowPrs );
-
+ DsgPrs::ComputeSymbol(aPresentation, LA, anEndOfArrow, anEndOfArrow, arrdir, arrdir, ArrowPrs );
}
//=======================================================================
const Standard_Boolean IsMaxRadius,
const DsgPrs_ArrowSide ArrowPrs)
{
-
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
if(!IsInDomain)
- {
- Standard_Real parFirst;
- Standard_Real uLast = ElCLib::Parameter ( anEllipse, anEndOfArrow );
- Standard_Real Alpha = DsgPrs::DistanceFromApex(anEllipse, anEndOfArrow, uFirst);//length of ellipse arc
- gp_Vec Vapex(aCenter, ElCLib::Value( uLast, anEllipse )) ;
- gp_Vec Vpnt(aCenter, ElCLib::Value( uFirst, anEllipse )) ;
- gp_Dir dir(Vpnt ^ Vapex);
- if(anEllipse.Position().Direction().IsOpposite( dir, Precision::Angular()))
- parFirst = uLast;
- else
- parFirst = uFirst;
- Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
- Graphic3d_Array1OfVertex ApproxArc( 0, NodeNumber-1 );
- Standard_Real delta = Alpha / ( NodeNumber - 1 );
- gp_Pnt CurPnt;
- for (Standard_Integer i = 0 ; i < NodeNumber; i++)
- {
- CurPnt = ElCLib::Value( parFirst, anEllipse );
- ApproxArc(i).SetCoord( CurPnt.X(), CurPnt.Y(), CurPnt.Z() );
- parFirst += delta ;
- }
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( ApproxArc );
- }
+ {
+ const Standard_Real uLast = ElCLib::Parameter ( anEllipse, anEndOfArrow );
+ const Standard_Real Alpha = DsgPrs::DistanceFromApex(anEllipse, anEndOfArrow, uFirst);//length of ellipse arc
+ gp_Vec Vapex(aCenter, ElCLib::Value( uLast, anEllipse )) ;
+ gp_Vec Vpnt(aCenter, ElCLib::Value( uFirst, anEllipse )) ;
+ gp_Dir dir(Vpnt ^ Vapex);
+ Standard_Real parFirst = anEllipse.Position().Direction().IsOpposite( dir, Precision::Angular())? uLast : uFirst;
+ const Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
+ const Standard_Real delta = Alpha / ( NodeNumber - 1 );
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
+ for (Standard_Integer i = 0 ; i < NodeNumber; i++, parFirst += delta)
+ aPrims->AddVertex(ElCLib::Value( parFirst, anEllipse ));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
DsgPrs_EllipseRadiusPresentation::Add(aPresentation, aDrawer, theval, aText,
- aPosition, anEndOfArrow, aCenter, IsMaxRadius, ArrowPrs);
-
+ aPosition, anEndOfArrow, aCenter, IsMaxRadius, ArrowPrs);
}
-
//=======================================================================
//function : Add
//purpose : // for offset curve
const Standard_Boolean IsMaxRadius,
const DsgPrs_ArrowSide ArrowPrs)
{
-
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
if(!IsInDomain)
- {
- Standard_Real parFirst;
- if(!aCurve->IsCN(1)) return ;
- gp_Elips aBEllipse = Handle(Geom_Ellipse)::DownCast(aCurve->BasisCurve ())->Elips();
- Standard_Real Offset = aCurve->Offset();
- aBEllipse.SetMajorRadius(aBEllipse.MajorRadius() + Offset);
- aBEllipse.SetMinorRadius(aBEllipse.MinorRadius() + Offset);
- Standard_Real uLast = ElCLib::Parameter ( aBEllipse, anEndOfArrow );
- Standard_Real Alpha = DsgPrs::DistanceFromApex(aBEllipse, anEndOfArrow, uFirst);//length of ellipse arc
- gp_Pnt p1;
- aCurve->D0(uFirst, p1);
- gp_Vec Vapex(aCenter, anEndOfArrow) ;
- gp_Vec Vpnt (aCenter, p1) ;
- gp_Dir dir(Vpnt ^ Vapex);
- if(aCurve->Direction().IsOpposite( dir, Precision::Angular()))
- parFirst = uLast;
- else
- parFirst = uFirst;
- Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
- Graphic3d_Array1OfVertex ApproxArc( 0, NodeNumber-1 );
- Standard_Real delta = Alpha / ( NodeNumber - 1 );
- gp_Pnt CurPnt;
- for (Standard_Integer i = 0 ; i < NodeNumber; i++)
+ {
+ if(!aCurve->IsCN(1)) return ;
+ gp_Elips aBEllipse = Handle(Geom_Ellipse)::DownCast(aCurve->BasisCurve ())->Elips();
+ const Standard_Real Offset = aCurve->Offset();
+ aBEllipse.SetMajorRadius(aBEllipse.MajorRadius() + Offset);
+ aBEllipse.SetMinorRadius(aBEllipse.MinorRadius() + Offset);
+ const Standard_Real uLast = ElCLib::Parameter ( aBEllipse, anEndOfArrow );
+ const Standard_Real Alpha = DsgPrs::DistanceFromApex(aBEllipse, anEndOfArrow, uFirst);//length of ellipse arc
+ gp_Pnt p1;
+ aCurve->D0(uFirst, p1);
+ gp_Vec Vapex(aCenter, anEndOfArrow) ;
+ gp_Vec Vpnt (aCenter, p1) ;
+ gp_Dir dir(Vpnt ^ Vapex);
+ Standard_Real parFirst = aCurve->Direction().IsOpposite( dir, Precision::Angular())? uLast : uFirst;
+ const Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
+ const Standard_Real delta = Alpha / ( NodeNumber - 1 );
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
+ for (Standard_Integer i = 0 ; i < NodeNumber; i++, parFirst += delta)
{
- aCurve->D0( parFirst, CurPnt );
- ApproxArc(i).SetCoord( CurPnt.X(), CurPnt.Y(), CurPnt.Z() );
- parFirst += delta ;
+ aCurve->D0( parFirst, p1 );
+ aPrims->AddVertex(p1);
}
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( ApproxArc );
- }
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
DsgPrs_EllipseRadiusPresentation::Add(aPresentation, aDrawer, theval, aText,
- aPosition, anEndOfArrow, aCenter, IsMaxRadius, ArrowPrs);
-
+ aPosition, anEndOfArrow, aCenter, IsMaxRadius, ArrowPrs);
}
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_EqualDistancePresentation.ixx>
#include <DsgPrs.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_LineAspect.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Root.hxx>
#include <gp_Dir.hxx>
#include <gce_MakeDir.hxx>
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
- Graphic3d_Array1OfVertex VertexArray( 1, 2 );
- Quantity_Length X,Y,Z;
-
// Line between two middles
gp_Pnt Middle12( (Point1.XYZ() + Point2.XYZ()) * 0.5 ), Middle34( (Point3.XYZ() + Point4.XYZ()) * 0.5 );
- Middle12.Coord( X, Y, Z );
- VertexArray( 1 ).SetCoord( X, Y, Z );
- Middle34.Coord( X, Y, Z );
- VertexArray( 2 ).SetCoord( X, Y, Z );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( VertexArray );
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(Middle12);
+ aPrims->AddVertex(Middle34);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// Add presentation of arrows (points)
gp_Dir aDir( 0, 0, 1 );
- DsgPrs::ComputeSymbol(aPresentation, LA,
- Middle12, Middle34,
- aDir, aDir,
- DsgPrs_AS_BOTHPT );
+ DsgPrs::ComputeSymbol(aPresentation, LA, Middle12, Middle34, aDir, aDir, DsgPrs_AS_BOTHPT );
// ota -- begin --
// Two small lines in the middle of this line
gp_Pnt Middle( (Middle12.XYZ() + Middle34.XYZ()) * 0.5 ), aTextPos;
gp_Vec LineVec, OrtVec;
if (Dist > Precision::Confusion())
- {
- SmallDist = Dist * 0.05; // 1/20.0 part
- if (SmallDist <= Precision::Confusion())
- SmallDist = Dist;
- LineDir = gce_MakeDir( Middle12, Middle34 );
- OrtDir = Plane->Pln().Axis().Direction() ^ LineDir;
- LineVec = gp_Vec( LineDir ) * SmallDist;
- OrtVec = gp_Vec( OrtDir ) * SmallDist;
-
- aTextPos = Middle.Translated( OrtVec );
- }
+ {
+ SmallDist = Dist * 0.05; // 1/20.0 part
+ if (SmallDist <= Precision::Confusion())
+ SmallDist = Dist;
+ LineDir = gce_MakeDir( Middle12, Middle34 );
+ OrtDir = Plane->Pln().Axis().Direction() ^ LineDir;
+ LineVec = gp_Vec( LineDir ) * SmallDist;
+ OrtVec = gp_Vec( OrtDir ) * SmallDist;
+
+ aTextPos = Middle.Translated( OrtVec );
+ }
else
- {
- gp_Vec Vec1( Middle, Point1 );
+ {
+ gp_Vec Vec1( Middle, Point1 );
- if (Vec1.SquareMagnitude() > Precision::SquareConfusion())
+ if (Vec1.SquareMagnitude() > Precision::Confusion()*Precision::Confusion())
{
Standard_Real Angle = gp_Vec( Middle, Point1 ).Angle( gp_Vec( Middle, Point3 ) );
gp_Pnt MidPnt = Point1.Rotated( Plane->Pln().Axis(), Angle*0.5 );
OrtVec = gp_Vec( OrtDir ) * SmallDist;
LineVec = gp_Vec( LineDir ) * SmallDist;
}
- else
+ else
{
SmallDist = 5.0;
OrtVec = gp_Vec( Plane->Pln().XAxis().Direction() ) * SmallDist;
LineVec = gp_Vec( Plane->Pln().YAxis().Direction() ) * SmallDist;
}
- aTextPos = Middle.Translated (OrtVec);
- }
+ aTextPos = Middle.Translated (OrtVec);
+ }
TCollection_ExtendedString aText("==");
Prs3d_Text::Draw(aPresentation,LA->TextAspect(), aText, aTextPos);
}
+
//==================================================================================
//function : AddInterval
//purpose : is used for presentation of interval between two lines or two points,
gp_Pnt& aProj2)
{
const Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
-//set color
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (aPoint1,aDirection);
aProj1 = ElCLib::Value(ElCLib::Parameter(L1, aPosition),L1);
aProj2 = ElCLib::Value(ElCLib::Parameter(L2, aPosition),L2);
- Graphic3d_Array1OfVertex V(1,2);
-
- Quantity_Length X,Y,Z;
-
- aProj1.Coord (X, Y, Z);
- V(1).SetCoord(X, Y, Z);
-
- aPoint1.Coord(X, Y, Z);
- V(2).SetCoord(X, Y, Z);
-
- //add first attached line
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
- //add distance interval
- aProj2.Coord(X, Y, Z);
- V(2).SetCoord(X, Y, Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
-
- //add second attached line
- aPoint2.Coord(X, Y, Z);
- V(1).SetCoord(X, Y, Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(4);
+ aPrims->AddVertex(aPoint1);
+ aPrims->AddVertex(aProj1);
+ aPrims->AddVertex(aProj2);
+ aPrims->AddVertex(aPoint2);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
//add arrows presentation
gp_Dir aDir(aProj2.XYZ() - aProj1.XYZ());
- DsgPrs::ComputeSymbol(aPresentation, LA,
- aProj1, aProj2,
- aDir.Reversed(), aDir,
- anArrowSide);
+ DsgPrs::ComputeSymbol(aPresentation, LA, aProj1, aProj2, aDir.Reversed(), aDir, anArrowSide);
}
+
//========================================================================
// function : AddIntervalBetweenTwoArcs
// purpose : is used for presentation of interval between two arcs. One
const gp_Pnt& aPoint4,
const DsgPrs_ArrowSide anArrowSide)
{
-//it seems to set color
const Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
Standard_Real aPar11, aPar12, aPar21, aPar22;
if(aCirc1.Radius() > Precision::Confusion()){
aPar11 = ElCLib::Parameter (aCirc1, aPoint1);
aPar22 = M_PI;
}
- Graphic3d_Array1OfVertex V(1,2);
- V(1).SetCoord(aPoint2.X(), aPoint2.Y(), aPoint2.Z());
- V(2).SetCoord(aPoint4.X(), aPoint4.Y(), aPoint4.Z());
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( V );
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(aPoint2);
+ aPrims->AddVertex(aPoint4);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
- Standard_Integer aNodeNb;
+ Standard_Integer i, aNodeNb;
Standard_Real aDelta, aCurPar;
- if(aPar12 < aPar11 ) aPar12 +=2*M_PI;
- if (Abs(aPar12 - aPar11) > Precision::Confusion()) {
+ if(aPar12 < aPar11 ) aPar12 += 2.*M_PI;
+ if (Abs(aPar12 - aPar11) > Precision::Confusion())
+ {
aNodeNb = Standard_Integer(Max(Abs(aPar12 - aPar11)*50./M_PI + 0.5, 4.));
- Graphic3d_Array1OfVertex ApproxArc1( 1, aNodeNb+1);
aDelta = (aPar12 - aPar11)/aNodeNb;
aCurPar= aPar11;
- for ( int i = 1; i<= aNodeNb ; aCurPar+= aDelta, i++)
- {
- gp_Pnt CurPnt = ElCLib::Value( aCurPar, aCirc1);
- ApproxArc1(i).SetCoord( CurPnt.X(), CurPnt.Y(), CurPnt.Z() );
- }
- ApproxArc1(aNodeNb+1).SetCoord( aPoint2.X(), aPoint2.Y(), aPoint2.Z() );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( ApproxArc1 );
+ aPrims = new Graphic3d_ArrayOfPolylines(aNodeNb+1);
+ for (i = 1; i<= aNodeNb; aCurPar += aDelta, i++)
+ aPrims->AddVertex(ElCLib::Value( aCurPar, aCirc1));
+ aPrims->AddVertex(aPoint2);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
- if (aPar22 < aPar21) aPar22 += 2*M_PI;
- if ( Abs(aPar22 - aPar21) > Precision::Confusion()){
+ if (aPar22 < aPar21) aPar22 += 2.*M_PI;
+ if ( Abs(aPar22 - aPar21) > Precision::Confusion())
+ {
aNodeNb = Standard_Integer(Max(Abs(aPar22 - aPar21)*50./M_PI + 0.5, 4.));
- Graphic3d_Array1OfVertex ApproxArc2( 1, aNodeNb+1);
aDelta = (aPar22 - aPar21)/aNodeNb;
aCurPar= aPar21;
- for ( int i=1; i<= aNodeNb; aCurPar+= aDelta, i++)
- {
- gp_Pnt CurPnt = ElCLib::Value( aCurPar, aCirc2);
- ApproxArc2(i).SetCoord( CurPnt.X(), CurPnt.Y(), CurPnt.Z() );
- }
- ApproxArc2(aNodeNb+1).SetCoord( aPoint4.X(), aPoint4.Y(), aPoint4.Z() );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( ApproxArc2 );
+
+ aPrims = new Graphic3d_ArrayOfPolylines(aNodeNb+1);
+ for (i = 1; i<= aNodeNb; aCurPar += aDelta, i++)
+ aPrims->AddVertex(ElCLib::Value( aCurPar, aCirc2));
+ aPrims->AddVertex(aPoint4);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
//get the direction of interval
- gp_Dir DirOfArrow;
- if(aPoint4.Distance(aPoint2) > Precision::Confusion()){
+ gp_Dir DirOfArrow;
+ if(aPoint4.Distance(aPoint2) > Precision::Confusion())
+ {
DirOfArrow.SetXYZ(aPoint4.XYZ() - aPoint2.XYZ());
}
- else {
+ else
+ {
//Let's take the radius direction
gp_Pnt aCenter = aCirc1.Location();
if(aPoint4.Distance(aCenter) < Precision::Confusion())
// Add presentation of arrows
DsgPrs::ComputeSymbol( aPresentation, LA, aPoint2, aPoint4, DirOfArrow.Reversed(), DirOfArrow, anArrowSide );
-
}
//-- ota -- end
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_EqualRadiusPresentation.ixx>
#include <DsgPrs.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_LineAspect.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Root.hxx>
#include <gp_Dir.hxx>
#include <gce_MakeDir.hxx>
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
- Graphic3d_Array1OfVertex VertexArray( 1, 2 );
- Quantity_Length X,Y,Z;
-
- // Radius lines
- FirstCenter.Coord( X, Y, Z );
- VertexArray( 1 ).SetCoord( X, Y, Z );
- FirstPoint.Coord( X, Y, Z );
- VertexArray( 2 ).SetCoord( X, Y, Z );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( VertexArray );
-
- SecondCenter.Coord( X, Y, Z );
- VertexArray( 1 ).SetCoord( X, Y, Z );
- SecondPoint.Coord( X, Y, Z );
- VertexArray( 2 ).SetCoord( X, Y, Z );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( VertexArray );
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(4);
+ aPrims->AddVertex(FirstPoint);
+ aPrims->AddVertex(FirstCenter);
+ aPrims->AddVertex(SecondCenter);
+ aPrims->AddVertex(SecondPoint);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// Add presentation of arrows
gp_Dir FirstDir = gce_MakeDir( FirstCenter, FirstPoint ), SecondDir = gce_MakeDir( SecondCenter, SecondPoint );
- DsgPrs::ComputeSymbol( aPresentation, LA,
- FirstCenter, FirstPoint,
- FirstDir.Reversed(), FirstDir,
- DsgPrs_AS_FIRSTPT_LASTAR );
- DsgPrs::ComputeSymbol( aPresentation, LA,
- SecondCenter, SecondPoint,
- SecondDir.Reversed(), SecondDir,
- DsgPrs_AS_FIRSTPT_LASTAR );
+ DsgPrs::ComputeSymbol( aPresentation, LA, FirstCenter, FirstPoint, FirstDir.Reversed(), FirstDir, DsgPrs_AS_FIRSTPT_LASTAR );
+ DsgPrs::ComputeSymbol( aPresentation, LA, SecondCenter, SecondPoint, SecondDir.Reversed(), SecondDir, DsgPrs_AS_FIRSTPT_LASTAR );
- // Line between two centers
- FirstCenter.Coord( X, Y, Z );
- VertexArray( 2 ).SetCoord( X, Y, Z );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( VertexArray );
-
//ota === beging ===
-
gp_Pnt Middle( (FirstCenter.XYZ() + SecondCenter.XYZ()) *0.5 ), aTextPos;
Standard_Real SmallDist;
//Mark of constraint
Standard_Real Dist = FirstCenter.Distance( SecondCenter );
if (Dist > Precision::Confusion())
- {
- SmallDist = Dist * 0.05; // take 1/20 part of length;
- if (SmallDist <= Precision::Confusion())
- SmallDist = Dist;
- gp_Dir LineDir = gce_MakeDir( FirstCenter, SecondCenter );
- gp_Dir OrtDir = Plane->Pln().Axis().Direction() ^ LineDir;
+ {
+ SmallDist = Dist * 0.05; // take 1/20 part of length;
+ if (SmallDist <= Precision::Confusion())
+ SmallDist = Dist;
+ gp_Dir LineDir = gce_MakeDir( FirstCenter, SecondCenter );
+ gp_Dir OrtDir = Plane->Pln().Axis().Direction() ^ LineDir;
- gp_Vec OrtVec = gp_Vec( OrtDir ) * SmallDist;
+ gp_Vec OrtVec = gp_Vec( OrtDir ) * SmallDist;
- //Compute the text position
- aTextPos = Middle.Translated(OrtVec);
- }
+ //Compute the text position
+ aTextPos = Middle.Translated(OrtVec);
+ }
else
- {
- Standard_Real Rad = Max(FirstCenter.Distance( FirstPoint ),
- SecondCenter.Distance(SecondPoint));
+ {
+ Standard_Real Rad = Max(FirstCenter.Distance( FirstPoint ), SecondCenter.Distance(SecondPoint));
- SmallDist = Rad *0.05; // take 1/20 part of length;
- if (SmallDist <= Precision::Confusion())
- SmallDist = Rad;
+ SmallDist = Rad *0.05; // take 1/20 part of length;
+ if (SmallDist <= Precision::Confusion())
+ SmallDist = Rad;
- gp_Vec aVec(SmallDist, SmallDist, SmallDist);
+ gp_Vec aVec(SmallDist, SmallDist, SmallDist);
- //Compute the text position
- aTextPos = FirstCenter.Translated(aVec);
- }
+ //Compute the text position
+ aTextPos = FirstCenter.Translated(aVec);
+ }
//Draw the text
- Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText, aTextPos);
+ Prs3d_Text::Draw(aPresentation, LA->TextAspect(),aText, aTextPos);
//ota === end ===
}
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_FilletRadiusPresentation.ixx>
#include <gp_Lin.hxx>
#include <gp_Dir.hxx>
#include <ElCLib.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
{
char valcar[80];
sprintf(valcar,"%5.2f",theval);
+
Standard_Real FirstParCirc, LastParCirc;
Standard_Boolean SpecCase;
gp_Dir DirOfArrow;
// gp_Pnt NewPosition, EndOfArrow;
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
+
Standard_Real ArrowLength = LA->Arrow1Aspect()->Length();
DsgPrs::ComputeFilletRadiusPresentation( ArrowLength,
theval,
);
// Creating the fillet's arc
if( !SpecCase )
- {
- Standard_Real Alpha = Abs(LastParCirc - FirstParCirc);
- Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
- Graphic3d_Array1OfVertex ApproxArc( 0, NodeNumber-1 );
- Standard_Real delta = Alpha / ( NodeNumber - 1 );
- gp_Pnt CurPnt;
- for (Standard_Integer i = 0 ; i < NodeNumber; i++)
- {
- CurPnt = ElCLib::Value( FirstParCirc, FilletCirc );
- ApproxArc(i).SetCoord( CurPnt.X(), CurPnt.Y(), CurPnt.Z() );
- FirstParCirc += delta ;
- }
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( ApproxArc );
- HasCircle = Standard_True;
- Handle(Geom_Circle) Circle = new Geom_Circle( FilletCirc );
- TrimCurve = new Geom_TrimmedCurve( Circle, FirstParCirc, LastParCirc );
- }
+ {
+ const Standard_Real Alpha = Abs(LastParCirc - FirstParCirc);
+ const Standard_Integer NodeNumber = Max (4 , Standard_Integer (50. * Alpha / M_PI));
+ const Standard_Real delta = Alpha / ( NodeNumber - 1 );
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
+ for (Standard_Integer i = 0 ; i < NodeNumber; i++, FirstParCirc += delta)
+ aPrims->AddVertex(ElCLib::Value( FirstParCirc, FilletCirc ));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
+ HasCircle = Standard_True;
+ Handle(Geom_Circle) Circle = new Geom_Circle( FilletCirc );
+ TrimCurve = new Geom_TrimmedCurve( Circle, FirstParCirc, LastParCirc );
+ }
else // null or PI anle or Radius = 0
- {
- HasCircle = Standard_False;
- }
+ {
+ HasCircle = Standard_False;
+ }
// Line from position to intersection point on fillet's circle (EndOfArrow)
- Graphic3d_Array1OfVertex Vrap(1,2);
- Vrap(1).SetCoord(DrawPosition.X(),
- DrawPosition.Y(),
- DrawPosition.Z());
- Vrap(2).SetCoord( EndOfArrow.X(), EndOfArrow.Y(), EndOfArrow.Z() );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( Vrap );
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(DrawPosition);
+ aPrims->AddVertex(EndOfArrow);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
// Drawing the text
Prs3d_Text::Draw(aPresentation, LA->TextAspect(), aText, DrawPosition);
// Add presentation of arrows
DsgPrs::ComputeSymbol( aPresentation, LA, EndOfArrow, EndOfArrow, DirOfArrow, DirOfArrow, ArrowPrs );
-
}
-
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_FixPresentation.ixx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Quantity_Color.hxx>
-
-
//=======================================================================
//function : Add
//purpose :
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(10);
+
//Trace du segment de raccordement
- Graphic3d_Array1OfVertex V(1,2);
- V(1).SetCoord(aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z());
- V(2).SetCoord(aPntEnd.X(), aPntEnd.Y(), aPntEnd.Z() );
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(aPntAttach);
+ aPrims->AddVertex(aPntEnd);
// trace du symbole 'Fix'
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
-
-
- gp_Vec dirac(aPntAttach, aPntEnd);
- // vecteur directeur du seg. de raccord
+ gp_Vec dirac(aPntAttach, aPntEnd); // vecteur directeur du seg. de raccord
dirac.Normalize();
gp_Vec norac = dirac.Crossed(gp_Vec(aNormPln));
gp_Ax1 ax(aPntEnd, aNormPln);
- norac.Rotate(ax, M_PI/8);
- // vecteur normal au seg. de raccord
+ norac.Rotate(ax, M_PI/8); // vecteur normal au seg. de raccord
norac*=(symbsize/2);
gp_Pnt P1 = aPntEnd.Translated(norac);
gp_Pnt P2 = aPntEnd.Translated(-norac);
- V(1).SetCoord(P1.X(),P1.Y(),P1.Z());
- V(2).SetCoord(P2.X(),P2.Y(),P2.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(P1);
+ aPrims->AddVertex(P2);
// trace des 'dents'
norac*=0.8;
P1 = aPntEnd.Translated(norac);
P2 = aPntEnd.Translated(-norac);
dirac*=(symbsize/2);
- gp_Pnt PF(P1.XYZ());
+ gp_Pnt PF = P1;
gp_Pnt PL = PF.Translated(dirac);
PL.Translate(norac);
- V(1).SetCoord( PF.X(), PF.Y(), PF.Z() );
- V(2).SetCoord( PL.X(), PL.Y(), PL.Z() );
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
- PF.SetXYZ(P2.XYZ());
+ aPrims->AddVertex(PF);
+ aPrims->AddVertex(PL);
+
+ PF = P2;
PL = PF.Translated(dirac);
PL.Translate(norac);
- V(1).SetCoord( PF.X(), PF.Y(), PF.Z() );
- V(2).SetCoord( PL.X(), PL.Y(), PL.Z() );
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
- PF.SetXYZ((P1.XYZ() + P2.XYZ())/2);
+ aPrims->AddVertex(PF);
+ aPrims->AddVertex(PL);
+
+ PF.SetXYZ(0.5*(P1.XYZ() + P2.XYZ()));
PL = PF.Translated(dirac);
PL.Translate(norac);
- V(1).SetCoord( PF.X(), PF.Y(), PF.Z() );
- V(2).SetCoord( PL.X(), PL.Y(), PL.Z() );
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+
+ aPrims->AddVertex(PF);
+ aPrims->AddVertex(PL);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// On ajoute un rond au point d'attache
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAsp);
Graphic3d_Vertex V3d(aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z());
Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d);
-
}
#include <DsgPrs_IdenticPresentation.ixx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex V(1,2);
- V(1).SetCoord(aPntAttach.X(), aPntAttach.Y(), aPntAttach.Z());
- V(2).SetCoord(aPntOffset.X(), aPntOffset.Y(), aPntOffset.Z());
-
- // trait de cote
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(aPntAttach);
+ aPrims->AddVertex(aPntOffset);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// On ajoute un rond au point d'attache
Prs3d_Root::NewGroup(aPresentation);
}
-
void DsgPrs_IdenticPresentation::Add( const Handle(Prs3d_Presentation)& aPresentation,
const Handle(Prs3d_Drawer)& aDrawer,
const TCollection_ExtendedString& aText,
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex V(1,2);
- V(1).SetCoord(aFAttach.X(), aFAttach.Y(), aFAttach.Z());
- V(2).SetCoord(aSAttach.X(), aSAttach.Y(), aSAttach.Z());
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(4);
- // trait de cote
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(aFAttach);
+ aPrims->AddVertex(aSAttach);
// trait joignant aPntOffset
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Vec v1(aFAttach, aSAttach);
gp_Vec v2(aSAttach, aPntOffset);
- V(1).SetCoord(aPntOffset.X(), aPntOffset.Y(), aPntOffset.Z());
- if ( !v1.IsParallel(v2, Precision::Angular())) {
+
+ aPrims->AddVertex(aPntOffset);
+ if ( !v1.IsParallel(v2, Precision::Angular()))
+ {
// on joint aPntOffset a son projete
gp_Lin ll(aFAttach, gp_Dir(v1));
- gp_Pnt ProjPntOffset = ElCLib::Value(ElCLib::Parameter(ll,aPntOffset ), ll);
- V(2).SetCoord(ProjPntOffset.X(), ProjPntOffset.Y(), ProjPntOffset.Z());
+ aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(ll,aPntOffset ), ll));
}
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ else
+ aPrims->AddVertex(aSAttach);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// texte
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntOffset);
}
-
void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresentation,
const Handle(Prs3d_Drawer)& aDrawer,
const TCollection_ExtendedString& aText,
Standard_Real pFAttach = ElCLib::Parameter(CC, aFAttach);
Standard_Real pSAttach = ElCLib::Parameter(CC, aSAttach);
Standard_Real alpha = pSAttach - pFAttach;
- if ( alpha < 0 ) alpha += 2 * M_PI;
- Standard_Integer nb = (Standard_Integer )( 50. * alpha / M_PI);
- Standard_Integer nbp = Max (4 , nb);
- Graphic3d_Array1OfVertex V(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- gp_Pnt ptcur;
- for (Standard_Integer i = 1; i<=nbp; i++)
- {
- ptcur = ElCLib::Value(pFAttach + dteta*(i-1),CC);
- V(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
+ if ( alpha < 0 ) alpha += 2. * M_PI;
+ const Standard_Integer nb = (Standard_Integer )( 50. * alpha / M_PI);
+ const Standard_Integer nbp = Max (4, nb);
+ const Standard_Real dteta = alpha/(nbp-1);
- // trait de cote
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfPolylines) aPrims;
// trait joignant aPntOffset
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex V2(1,2);
- if ( Abs((aPntOffset.Distance(aCenter) - rad )) >= Precision::Confusion() ) {
- gp_Pnt ProjPntOffset = ElCLib::Value(ElCLib::Parameter(CC,aPntOffset ), CC);
-
- V2(1).SetCoord(aPntOffset.X(), aPntOffset.Y(), aPntOffset.Z());
- V2(2).SetCoord(ProjPntOffset.X(), ProjPntOffset.Y(), ProjPntOffset.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V2);
+ if ( Abs((aPntOffset.Distance(aCenter) - rad )) >= Precision::Confusion() )
+ {
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(aPntOffset);
+ aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(CC,aPntOffset ), CC));
+ aPrims->AddBound(nbp);
}
+ else
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp);
+
+ for (Standard_Integer i = 1; i<=nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(pFAttach + dteta*(i-1),CC));
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// texte
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntOffset);
ax.SetLocation(aCenter);
Standard_Real rad = aCenter.Distance(aFAttach);
gp_Circ CC(ax,rad );
- Standard_Real pFAttach = ElCLib::Parameter(CC, aFAttach);
- Standard_Real pSAttach = ElCLib::Parameter(CC, aSAttach);
+ Standard_Real pFAttach = ElCLib::Parameter(CC, aFAttach);
+ Standard_Real pSAttach = ElCLib::Parameter(CC, aSAttach);
Standard_Real alpha = pSAttach - pFAttach;
- if ( alpha < 0 ) alpha += 2 * M_PI;
- Standard_Integer nb = (Standard_Integer )( 50. * alpha / M_PI);
- Standard_Integer nbp = Max (4 , nb);
- Graphic3d_Array1OfVertex V(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- gp_Pnt ptcur;
- for (Standard_Integer i = 1; i<=nbp; i++)
- {
- ptcur = ElCLib::Value(pFAttach + dteta*(i-1),CC);
- V(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
+ if ( alpha < 0 ) alpha += 2. * M_PI;
+ const Standard_Integer nb = (Standard_Integer)( 50. * alpha / M_PI);
+ const Standard_Integer nbp = Max (4, nb);
+ const Standard_Real dteta = alpha/(nbp-1);
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims;
- // trait de cote
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
// trait joignant aPntOffset
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex V2(1,2);
if ( aPntOffset.Distance(aPntOnCirc) >= Precision::Confusion() )
- {
- V2(1).SetCoord(aPntOffset.X(), aPntOffset.Y(), aPntOffset.Z());
- V2(2).SetCoord(aPntOnCirc.X(), aPntOnCirc.Y(), aPntOnCirc.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V2);
- }
+ {
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(aPntOffset);
+ aPrims->AddVertex(aPntOnCirc);
+ aPrims->AddBound(nbp);
+ }
+ else
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp);
+
+ for (Standard_Integer i = 1; i<=nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(pFAttach + dteta*(i-1),CC));
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// texte
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntOffset);
Standard_Real pFAttach = ElCLib::Parameter(anEllipse, aFAttach);
Standard_Real pSAttach = ElCLib::Parameter(anEllipse, aSAttach);
Standard_Real alpha = pSAttach - pFAttach;
- if ( alpha < 0 ) alpha += 2 * M_PI;
- Standard_Integer nb = (Standard_Integer)(50.0*alpha/M_PI);
- Standard_Integer nbp = Max (4 , nb);
- Graphic3d_Array1OfVertex V(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- gp_Pnt ptcur;
- for (Standard_Integer i = 1; i<=nbp; i++)
- {
- ptcur = ElCLib::Value(pFAttach + dteta*(i-1),anEllipse);
- V(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
+ if ( alpha < 0 ) alpha += 2. * M_PI;
+ const Standard_Integer nb = (Standard_Integer)(50.0*alpha/M_PI);
+ const Standard_Integer nbp = Max (4, nb);
+ const Standard_Real dteta = alpha/(nbp-1);
- // trait de cote
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfPolylines) aPrims;
// trait joignant aPntOffset
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex V2(1,2);
-
if ( ! aPntOnElli.IsEqual(aPntOffset, Precision::Confusion()) )
- {
- V2(1).SetCoord(aPntOffset.X(), aPntOffset.Y(), aPntOffset.Z());
- V2(2).SetCoord(aPntOnElli.X(), aPntOnElli.Y(), aPntOnElli.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V2);
- }
+ {
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(aPntOffset);
+ aPrims->AddVertex(aPntOnElli);
+ aPrims->AddBound(nbp);
+ }
+ else
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp);
+
+ for (Standard_Integer i = 1; i<=nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(pFAttach + dteta*(i-1),anEllipse));
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// texte
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntOffset);
#include <ElCLib.hxx>
#include <gce_MakeLin.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
gp_Lin L1 (AttachmentPoint1,aDirection);
gp_Lin L2 (AttachmentPoint2,aDirection);
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1,OffsetPoint),L1);
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2,OffsetPoint),L2);
- gp_Lin L3;
- if (!Proj1.IsEqual(Proj2,Precision::Confusion())) {
- L3 = gce_MakeLin(Proj1,Proj2);
- }
- else {
- L3 = gp_Lin(Proj1,aDirection);
- }
+ gp_Lin L3 = Proj1.IsEqual(Proj2,Precision::Confusion())? gp_Lin(Proj1,aDirection) : gce_MakeLin(Proj1,Proj2);
Standard_Real parmin,parmax,parcur;
parmin = ElCLib::Parameter(L3,Proj1);
parmax = parmin;
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
- Graphic3d_Array1OfVertex V(1,2);
-
- Quantity_Length X,Y,Z;
-
- PointMin.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
-
- PointMax.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
// face processing : 1st group
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
+ aPrims->AddVertex(PointMin);
+ aPrims->AddVertex(PointMax);
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
-
- if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) {
+ if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
outside = Standard_True;
- }
- gp_Dir arrdir = L3.Direction().Reversed();
- if (outside) {
+ gp_Dir arrdir = L3.Direction().Reversed();
+ if (outside)
arrdir.Reverse();
- }
+
// arrow 1 : 2nd group
- Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir, LA->Arrow1Aspect()->Angle(), LA->Arrow1Aspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
// arrow 2 : 3rd group
- Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(),
- LA->Arrow2Aspect()->Angle(),
- LA->Arrow2Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(), LA->Arrow2Aspect()->Angle(), LA->Arrow2Aspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
// text : 4th group
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,offp);
- AttachmentPoint1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Proj1.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
-
- Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
// processing of call 1 : 5th group
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(Proj1);
- AttachmentPoint2.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Proj2.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
-
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
// processing of call 2 : 6th group
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(Proj2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
//==================================================================================
EndOfArrow1,
EndOfArrow2,
DirOfArrow1 );
- Graphic3d_Array1OfVertex VertexArray( 1, 2 );
// Parameters for length's line
gp_Lin LengthLine( OffsetPoint, DirOfArrow1 );
Standard_Real Par2 = ElCLib::Parameter( LengthLine, EndOfArrow2 );
gp_Pnt FirstPoint, LastPoint;
if (Par1 > 0.0 && Par2 > 0.0 || Par1 < 0.0 && Par2 < 0.0)
- {
- FirstPoint = OffsetPoint;
- LastPoint = (Abs( Par1 ) > Abs( Par2 ))? EndOfArrow1 : EndOfArrow2;
- }
+ {
+ FirstPoint = OffsetPoint;
+ LastPoint = (Abs( Par1 ) > Abs( Par2 ))? EndOfArrow1 : EndOfArrow2;
+ }
else
- {
- FirstPoint = EndOfArrow1;
- LastPoint = EndOfArrow2;
- }
+ {
+ FirstPoint = EndOfArrow1;
+ LastPoint = EndOfArrow2;
+ }
// Creating the length's line
- VertexArray(1).SetCoord( FirstPoint.X(), FirstPoint.Y(), FirstPoint.Z() );
- VertexArray(2).SetCoord( LastPoint.X(), LastPoint.Y(), LastPoint.Z() );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( VertexArray );
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
+
+ aPrims->AddVertex(FirstPoint);
+ aPrims->AddVertex(LastPoint);
// Add presentation of arrows
- DsgPrs::ComputeSymbol( aPresentation, LA,
- EndOfArrow1, EndOfArrow2, //EndOfArrow1,
- DirOfArrow1, DirOfArrow1.Reversed(), ArrowPrs );
+ DsgPrs::ComputeSymbol( aPresentation, LA, EndOfArrow1, EndOfArrow2, DirOfArrow1, DirOfArrow1.Reversed(), ArrowPrs );
// Drawing the text
Prs3d_Text::Draw( aPresentation, LA->TextAspect(), aText, OffsetPoint );
// Line from AttachmentPoint1 to end of Arrow1
- VertexArray(1).SetCoord(AttachmentPoint1.X(),
- AttachmentPoint1.Y(),
- AttachmentPoint1.Z());
- VertexArray(2).SetCoord( EndOfArrow1.X(), EndOfArrow1.Y(), EndOfArrow1.Z() );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( VertexArray );
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(EndOfArrow1);
// Line from AttachmentPoint2 to end of Arrow2
- VertexArray(1).SetCoord(AttachmentPoint2.X(),
- AttachmentPoint2.Y(),
- AttachmentPoint2.Z());
- VertexArray(2).SetCoord( EndOfArrow2.X(), EndOfArrow2.Y(), EndOfArrow2.Z() );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( VertexArray );
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(EndOfArrow2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
gp_Lin L2 (AttachmentPoint2,aDirection);
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1,OffsetPoint),L1);
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2,OffsetPoint),L2);
- gp_Lin L3;
- if (!Proj1.IsEqual(Proj2,Precision::Confusion())) {
- L3 = gce_MakeLin(Proj1,Proj2);
- }
- else {
- L3 = gp_Lin(Proj1,aDirection);
- }
+ gp_Lin L3 = Proj1.IsEqual(Proj2,Precision::Confusion())? gp_Lin(Proj1,aDirection) : gce_MakeLin(Proj1,Proj2);
Standard_Real parmin,parmax,parcur;
parmin = ElCLib::Parameter(L3,Proj1);
parmax = parmin;
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
- Graphic3d_Array1OfVertex V(1,2);
-
- Quantity_Length X,Y,Z;
-
- PointMin.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
+ // processing of face
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
- PointMax.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
+ aPrims->AddVertex(PointMin);
+ aPrims->AddVertex(PointMax);
- // processing of face
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
-
- if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) {
+ if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
outside = Standard_True;
- }
- gp_Dir arrdir = L3.Direction().Reversed();
- if (outside) {
+ gp_Dir arrdir = L3.Direction().Reversed();
+ if (outside)
arrdir.Reverse();
- }
-
- AttachmentPoint1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Proj1.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
-
// processing of call 1
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(Proj1);
- AttachmentPoint2.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Proj2.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
-
// processing of call 2
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(Proj2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
-
// text
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,offp);
}
-
//==================================================================================
//function : Add
//purpose : Adds presentation of length dimension between two curvilinear faces
FirstU, deltaU,
FirstV, deltaV );
- Graphic3d_Array1OfVertex VertexArray( 1, 2 );
-
gp_Lin LengthLine( OffsetPoint, DirOfArrow1 );
Standard_Real Par1 = ElCLib::Parameter( LengthLine, AttachmentPoint1 );
Standard_Real Par2 = ElCLib::Parameter( LengthLine, EndOfArrow2 );
gp_Pnt FirstPoint, LastPoint;
if (Par1 > 0.0 && Par2 > 0.0 || Par1 < 0.0 && Par2 < 0.0)
- {
- FirstPoint = OffsetPoint;
- LastPoint = (Abs( Par1 ) > Abs( Par2 ))? AttachmentPoint1 : EndOfArrow2;
- }
+ {
+ FirstPoint = OffsetPoint;
+ LastPoint = (Abs( Par1 ) > Abs( Par2 ))? AttachmentPoint1 : EndOfArrow2;
+ }
else
- {
- FirstPoint = AttachmentPoint1;
- LastPoint = EndOfArrow2;
- }
+ {
+ FirstPoint = AttachmentPoint1;
+ LastPoint = EndOfArrow2;
+ }
// Creating the length's line
- VertexArray(1).SetCoord( FirstPoint.X(), FirstPoint.Y(), FirstPoint.Z() );
- VertexArray(2).SetCoord( LastPoint.X(), LastPoint.Y(), LastPoint.Z() );
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( VertexArray );
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(FirstPoint);
+ aPrims->AddVertex(LastPoint);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// Add presentation of arrows
- DsgPrs::ComputeSymbol( aPresentation, LA,
- AttachmentPoint1, EndOfArrow2,
- DirOfArrow1, DirOfArrow1.Reversed(), ArrowPrs );
+ DsgPrs::ComputeSymbol( aPresentation, LA, AttachmentPoint1, EndOfArrow2, DirOfArrow1, DirOfArrow1.Reversed(), ArrowPrs );
// Drawing the text
Prs3d_Text::Draw( aPresentation, LA->TextAspect(), aText, OffsetPoint );
Alpha = Abs( deltaU );
if (Alpha > Precision::Angular() && Alpha<Precision::Infinite())
- {
- NodeNumber = Max( 4 , Standard_Integer (50. * Alpha / M_PI) );
- Graphic3d_Array1OfVertex ApproxCurve( 1, NodeNumber );
- delta = deltaU / (Standard_Real)( NodeNumber - 1 );
- gp_Pnt CurPnt;
- for (Standard_Integer i = 1; i <= NodeNumber; i++)
- {
- CurPnt = VCurve->Value( FirstU );
- ApproxCurve(i).SetCoord( CurPnt.X(), CurPnt.Y(), CurPnt.Z() );
- FirstU += delta;
- }
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( ApproxCurve );
- }
+ {
+ NodeNumber = Max( 4 , Standard_Integer (50. * Alpha / M_PI) );
+ delta = deltaU / (Standard_Real)( NodeNumber - 1 );
+ aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
+ for (Standard_Integer i = 1; i <= NodeNumber; i++, FirstU += delta)
+ aPrims->AddVertex(VCurve->Value( FirstU ));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
Alpha = Abs( deltaV );
if (Alpha > Precision::Angular() && Alpha<Precision::Infinite())
- {
- NodeNumber = Max( 4 , Standard_Integer (50. * Alpha / M_PI) );
- Graphic3d_Array1OfVertex ApproxCurve( 1, NodeNumber );
- delta = deltaV / (Standard_Real)( NodeNumber - 1 );
- gp_Pnt CurPnt;
- for (Standard_Integer i = 1; i <= NodeNumber; i++)
- {
- CurPnt = UCurve->Value( FirstV );
- ApproxCurve(i).SetCoord( CurPnt.X(), CurPnt.Y(), CurPnt.Z() );
- FirstV += delta;
- }
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( ApproxCurve );
- }
+ {
+ NodeNumber = Max( 4 , Standard_Integer (50. * Alpha / M_PI) );
+ delta = deltaV / (Standard_Real)( NodeNumber - 1 );
+ aPrims = new Graphic3d_ArrayOfPolylines(NodeNumber);
+ for (Standard_Integer i = 1; i <= NodeNumber; i++, FirstV += delta)
+ aPrims->AddVertex(UCurve->Value( FirstV ));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
}
-
-
-
-
//================================
// Function:
// Purpose: Rob 26-mar-96
const gp_Pnt& Pt2,
const DsgPrs_ArrowSide ArrowPrs)
{
- Prs3d_Root::CurrentGroup(aPrs)->BeginPrimitives();
- Graphic3d_Array1OfVertex Vx(1,2);
- Vx(1).SetCoord(Pt1.X(),Pt1.Y(),Pt1.Z());
- Vx(2).SetCoord(Pt2.X(),Pt2.Y(),Pt2.Z());
- Prs3d_Root::CurrentGroup(aPrs)->Polyline(Vx);
-
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(Pt1);
+ aPrims->AddVertex(Pt2);
+ Prs3d_Root::CurrentGroup(aPrs)->AddPrimitiveArray(aPrims);
+
gp_Vec V ;
- switch(ArrowPrs){
- case DsgPrs_AS_NONE:
- break;
- case DsgPrs_AS_LASTAR:
+ switch(ArrowPrs)
+ {
+ case DsgPrs_AS_LASTAR:
Prs3d_Arrow::Draw(aPrs,Pt2,gp_Dir(gp_Vec(Pt1,Pt2)),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
break;
- case DsgPrs_AS_FIRSTAR:
+ case DsgPrs_AS_FIRSTAR:
Prs3d_Arrow::Draw(aPrs,Pt1,gp_Dir(gp_Vec(Pt2,Pt1)),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
break;
- case DsgPrs_AS_BOTHAR:
+ case DsgPrs_AS_BOTHAR:
V = gp_Vec(Pt1,Pt2);
Prs3d_Arrow::Draw(aPrs,Pt2,gp_Dir(V),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
break;
- default:
+ default:
break;
}
- Prs3d_Root::CurrentGroup(aPrs)->EndPrimitives();
-
}
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
#include <DsgPrs_MidPointPresentation.ixx>
#include <Precision.hxx>
#include <ElCLib.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Root.hxx>
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
- Graphic3d_Array1OfVertex V(1,2);
-
- gp_Pnt Ptmp;
gp_Ax2 ax = theAxe;
ax.SetLocation(MidPoint);
gp_Circ aCircleM (ax,rad);
if ( first )
- {
- // center of the symmetry - circle around the MidPoint
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Standard_Real alpha = 2 * M_PI;
- Standard_Integer nbp = 100;
- Graphic3d_Array1OfVertex VC(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- gp_Pnt ptcur;
- for (Standard_Integer i = 1; i <= nbp; i++)
- {
- ptcur = ElCLib::Value(dteta*(i-1),aCircleM);
- VC(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VC);
-
- // segment from mid point to the text position
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- // mid point
- if ( Position.IsEqual(MidPoint,rad) )
- Ptmp = MidPoint;
- else
- Ptmp = ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM);
- V(1).SetCoord(Ptmp.X(),Ptmp.Y(),Ptmp.Z());
- // text position
- V(2).SetCoord(Position.X(),Position.Y(),Position.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
- // texte
- TCollection_ExtendedString aText (" (+)");
- Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,Position);
- }
+ {
+ // center of the symmetry - circle around the MidPoint
+ Prs3d_Root::NewGroup(aPresentation);
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
+ const Standard_Real alpha = 2. * M_PI;
+ const Standard_Integer nbp = 100;
+ const Standard_Real dteta = alpha/(nbp-1);
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
+ aPrims->AddBound(nbp);
+ for (Standard_Integer i = 1; i <= nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(dteta*(i-1),aCircleM));
+
+ // segment from mid point to the text position
+ aPrims->AddBound(2);
+ aPrims->AddVertex(Position.IsEqual(MidPoint,rad)? MidPoint : ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM)); // mid point
+ aPrims->AddVertex(Position); // text position
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
+ // texte
+ TCollection_ExtendedString aText(" (+)");
+ Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,Position);
+ }
if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
+ {
+ if ( !first )
{
- // segment from mid point to the geometry
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- // mid point
- Ptmp = ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM);
- V(1).SetCoord(Ptmp.X(),Ptmp.Y(),Ptmp.Z());
- // attach point to the geometry
- V(2).SetCoord(AttachPoint.X(),AttachPoint.Y(),AttachPoint.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
}
+
+ // segment from mid point to the geometry
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM)); // mid point
+ aPrims->AddVertex(AttachPoint); // attach point to the geometry
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
}
//===================================================================
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
- Graphic3d_Array1OfVertex V(1,2);
-
- gp_Pnt Ptmp;
gp_Ax2 ax = theAxe;
ax.SetLocation(MidPoint);
gp_Circ aCircleM (ax,rad);
- if ( first )
- {
- // center of the symmetry - circle around the MidPoint
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Standard_Real alpha = 2 * M_PI;
- Standard_Integer nbp = 100;
- Graphic3d_Array1OfVertex VC(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- gp_Pnt ptcur;
- for (Standard_Integer i = 1; i <= nbp; i++)
- {
- ptcur = ElCLib::Value(dteta*(i-1),aCircleM);
- VC(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VC);
-
- // segment from mid point to the text position
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- // mid point
- if ( Position.IsEqual(MidPoint,rad) )
- Ptmp = MidPoint;
- else
- Ptmp = ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM);
- V(1).SetCoord(Ptmp.X(),Ptmp.Y(),Ptmp.Z());
- // text position
- V(2).SetCoord(Position.X(),Position.Y(),Position.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
- // texte
- TCollection_ExtendedString aText (" (+)");
- Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,Position);
- }
-
- if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
- {
- // segment from mid point to the geometry
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- // mid point
- Ptmp = ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM);
- V(1).SetCoord(Ptmp.X(),Ptmp.Y(),Ptmp.Z());
- // attach point to the geometry
- V(2).SetCoord(AttachPoint.X(),AttachPoint.Y(),AttachPoint.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
- }
-
// segment on line
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- V(1).SetCoord(Point1.X(),Point1.Y(),Point1.Z());
- V(2).SetCoord(Point2.X(),Point2.Y(),Point2.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(Point1);
+ aPrims->AddVertex(Point2);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
+ if ( first )
+ {
+ // center of the symmetry - circle around the MidPoint
+ const Standard_Real alpha = 2. * M_PI;
+ const Standard_Integer nbp = 100;
+ const Standard_Real dteta = alpha/(nbp-1);
+
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
+ aPrims->AddBound(nbp);
+ for (Standard_Integer i = 1; i <= nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(dteta*(i-1),aCircleM));
+
+ // segment from mid point to the text position
+ aPrims->AddBound(2);
+ aPrims->AddVertex(Position.IsEqual(MidPoint,rad)? MidPoint : ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM)); // mid point
+ aPrims->AddVertex(Position); // text position
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
+ // texte
+ TCollection_ExtendedString aText (" (+)");
+ Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,Position);
+ }
+
+ if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
+ {
+ // mid point
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM));
+ aPrims->AddVertex(AttachPoint); // attach point to the geometry
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
}
//===================================================================
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
- Graphic3d_Array1OfVertex V(1,2);
-
- gp_Pnt Ptmp,ptcur;
gp_Ax2 ax = aCircle.Position();
ax.SetLocation(MidPoint);
gp_Circ aCircleM (ax,rad);
- if ( first )
- {
- // center of the symmetry - circle around the MidPoint
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Standard_Real alpha = 2 * M_PI;
- Standard_Integer nbp = 100;
- Graphic3d_Array1OfVertex VC(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- for (Standard_Integer i = 1; i <= nbp; i++)
- {
- ptcur = ElCLib::Value(dteta*(i-1),aCircleM);
- VC(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VC);
-
- // segment from mid point to the text position
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- // mid point
- if ( Position.IsEqual(MidPoint,rad) )
- Ptmp = MidPoint;
- else
- Ptmp = ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM);
- V(1).SetCoord(Ptmp.X(),Ptmp.Y(),Ptmp.Z());
- // text position
- V(2).SetCoord(Position.X(),Position.Y(),Position.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
- // texte
- TCollection_ExtendedString aText (" (+)");
- Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,Position);
- }
-
- if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
- {
- // segment from mid point to the geometry
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- // mid point
- Ptmp = ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM);
- V(1).SetCoord(Ptmp.X(),Ptmp.Y(),Ptmp.Z());
- // attach point to the geometry
- V(2).SetCoord(AttachPoint.X(),AttachPoint.Y(),AttachPoint.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
- }
-
// segment on circle
- Standard_Real pf = ElCLib::Parameter(aCircle,Point1);
- Standard_Real pl = ElCLib::Parameter(aCircle,Point2);
+ Prs3d_Root::NewGroup(aPresentation);
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
+ const Standard_Real pf = ElCLib::Parameter(aCircle,Point1);
+ const Standard_Real pl = ElCLib::Parameter(aCircle,Point2);
Standard_Real alpha = pl - pf;
- if ( alpha < 0 ) alpha += 2 * M_PI;
- Standard_Integer nb = (Standard_Integer)(50.0*alpha/M_PI);
+ if ( alpha < 0 ) alpha += 2. * M_PI;
+ const Standard_Integer nb = (Standard_Integer)(50.0*alpha/M_PI);
Standard_Integer nbp = Max(4,nb);
- Graphic3d_Array1OfVertex VC1(1,nbp);
Standard_Real dteta = alpha/(nbp-1);
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(nbp);
for (Standard_Integer i = 1; i <= nbp; i++)
- {
- ptcur = ElCLib::Value(pf + dteta*(i-1),aCircle);
- VC1(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VC1);
+ aPrims->AddVertex(ElCLib::Value(pf + dteta*(i-1),aCircle));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
+ if ( first )
+ {
+ // center of the symmetry - circle around the MidPoint
+ alpha = 2. * M_PI;
+ nbp = 100;
+ dteta = alpha/(nbp-1);
+
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
+ aPrims->AddBound(nbp);
+ for (Standard_Integer i = 1; i <= nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(dteta*(i-1),aCircleM));
+
+ // segment from mid point to the text position
+ aPrims->AddBound(2);
+ aPrims->AddVertex(Position.IsEqual(MidPoint,rad)? MidPoint : ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM)); // mid point
+ aPrims->AddVertex(Position); // text position
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
+ // texte
+ TCollection_ExtendedString aText (" (+)");
+ Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,Position);
+ }
+
+ if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
+ {
+ // segment from mid point to the geometry
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM)); // mid point
+ aPrims->AddVertex(AttachPoint); // attach point to the geometry
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
}
//===================================================================
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
- Graphic3d_Array1OfVertex V(1,2);
gp_Pnt Ptmp,ptcur;
ax.SetLocation(MidPoint);
gp_Circ aCircleM (ax,rad);
- if ( first )
- {
- // center of the symmetry - circle around the MidPoint
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Standard_Real alpha = 2 * M_PI;
- Standard_Integer nbp = 100;
- Graphic3d_Array1OfVertex VC(1,nbp);
- Standard_Real dteta = alpha/(nbp-1);
- for (Standard_Integer i = 1; i <= nbp; i++)
- {
- ptcur = ElCLib::Value(dteta*(i-1),aCircleM);
- VC(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VC);
-
- // segment from mid point to the text position
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- // mid point
- if ( Position.IsEqual(MidPoint,rad) )
- Ptmp = MidPoint;
- else
- Ptmp = ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM);
- V(1).SetCoord(Ptmp.X(),Ptmp.Y(),Ptmp.Z());
- // text position
- V(2).SetCoord(Position.X(),Position.Y(),Position.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
- // texte
- TCollection_ExtendedString aText (" (+)");
- Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,Position);
- }
-
- if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
- {
- // segment from mid point to the geometry
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- // mid point
- Ptmp = ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM);
- V(1).SetCoord(Ptmp.X(),Ptmp.Y(),Ptmp.Z());
- // attach point to the geometry
- V(2).SetCoord(AttachPoint.X(),AttachPoint.Y(),AttachPoint.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
- }
-
// segment on ellipse
- Standard_Real pf = ElCLib::Parameter(aCircle,Point1);
- Standard_Real pl = ElCLib::Parameter(aCircle,Point2);
+ Prs3d_Root::NewGroup(aPresentation);
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
+ const Standard_Real pf = ElCLib::Parameter(aCircle,Point1);
+ const Standard_Real pl = ElCLib::Parameter(aCircle,Point2);
Standard_Real alpha = pl - pf;
if ( alpha < 0 ) alpha += 2 * M_PI;
- Standard_Integer nb = (Standard_Integer)(50.0*alpha/M_PI);
+ const Standard_Integer nb = (Standard_Integer)(50.0*alpha/M_PI);
Standard_Integer nbp = Max(4,nb);
- Graphic3d_Array1OfVertex VC1(1,nbp);
Standard_Real dteta = alpha/(nbp-1);
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(nbp);
for (Standard_Integer i = 1; i <= nbp; i++)
- {
- ptcur = ElCLib::Value(pf + dteta*(i-1),aCircle);
- VC1(i).SetCoord(ptcur.X(),ptcur.Y(),ptcur.Z());
- }
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VC1);
+ aPrims->AddVertex(ElCLib::Value(pf + dteta*(i-1),aCircle));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
+ if ( first )
+ {
+ // center of the symmetry - circle around the MidPoint
+ alpha = 2. * M_PI;
+ nbp = 100;
+ dteta = alpha/(nbp-1);
+
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp+2,2);
+ aPrims->AddBound(nbp);
+ for (Standard_Integer i = 1; i <= nbp; i++)
+ aPrims->AddVertex(ElCLib::Value(dteta*(i-1),aCircleM));
+
+ // segment from mid point to the text position
+ aPrims->AddBound(2);
+ aPrims->AddVertex(Position.IsEqual(MidPoint,rad)? MidPoint : ElCLib::Value(ElCLib::Parameter(aCircleM,Position),aCircleM)); // mid point
+ aPrims->AddVertex(Position); // text position
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
+ // texte
+ TCollection_ExtendedString aText (" (+)");
+ Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,Position);
+ }
+
+ if ( !AttachPoint.IsEqual(MidPoint, Precision::Confusion()) )
+ {
+ // segment from mid point to the geometry
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(ElCLib::Value(ElCLib::Parameter(aCircleM,AttachPoint),aCircleM)); // mid point
+ aPrims->AddVertex(AttachPoint); // attach point to the geometry
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
}
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
#include <DsgPrs_OffsetPresentation.ixx>
#include <gp_Lin.hxx>
#include <gce_MakeLin.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
const gp_Pnt& AttachmentPoint2,
const gp_Dir& aDirection,
const gp_Dir& aDirection2,
- const gp_Pnt& OffsetPoint) {
-
-
+ const gp_Pnt& OffsetPoint)
+{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
gp_Lin L1 (AttachmentPoint1,aDirection);
gp_Lin L2 (AttachmentPoint2,aDirection2);
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1,OffsetPoint),L1);
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
- Graphic3d_Array1OfVertex V(1,2);
-
- Quantity_Length X,Y,Z;
-
- PointMin.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
-
- PointMax.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
// trait de cote : 1er groupe
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
+ aPrims->AddVertex(PointMin);
+ aPrims->AddVertex(PointMax);
- if (DimNulle) {
-
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction(),
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
+ Prs3d_Root::NewGroup(aPresentation);
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction().Reversed(),
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
- } else {
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
-
- if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) {
+ if (DimNulle)
+ {
+ Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction(),LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction().Reversed(),LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
+ }
+ else
+ {
+ if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
outside = Standard_True;
- }
gp_Dir arrdir = L3.Direction().Reversed();
-
- if (outside) {
+ if (outside)
arrdir.Reverse();
- }
+
// fleche 1 : 2eme groupe
- Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
-
-
+ Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
+
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
// ball 1 : 3eme groupe
-
Handle(Graphic3d_AspectMarker3d) MarkerAsp = new Graphic3d_AspectMarker3d();
MarkerAsp->SetType(Aspect_TOM_BALL);
MarkerAsp->SetScale(0.8);
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,offp);
}
- AttachmentPoint1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Proj1.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
-
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
// trait de rappel 1 : 5eme groupe
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
- AttachmentPoint2.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Proj2.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(Proj1);
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
// trait de rappel 2 : 6eme groupe
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(Proj2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
void DsgPrs_OffsetPresentation::AddAxes (const Handle(Prs3d_Presentation)& aPresentation,
const gp_Pnt& AttachmentPoint2,
const gp_Dir& aDirection,
const gp_Dir& aDirection2,
- const gp_Pnt& OffsetPoint) {
-
-
-
+ const gp_Pnt& OffsetPoint)
+{
gp_Lin L1 (AttachmentPoint1,aDirection);
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L1,OffsetPoint),L1);
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(AxeAsp);
- Graphic3d_Array1OfVertex V(1,2);
- Quantity_Length X,Y,Z;
-
- AttachmentPoint1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
-
- Proj1.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
// trait d'axe : 1er groupe
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(Proj1);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
Prs3d_Root::NewGroup(aPresentation);
+
Handle(Graphic3d_AspectLine3d) Axe2Asp = new Graphic3d_AspectLine3d (acolor, atype, awidth);
Axe2Asp->SetType ( Aspect_TOL_DOTDASH);
Axe2Asp->SetWidth ( 4.);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(Axe2Asp);
- AttachmentPoint2.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
-
- Proj2.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
// trait d'axe: 2eme groupe
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(Proj2);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// anneau : 3eme et 4eme groupes
-
Graphic3d_Vertex V3d(Proj2.X() ,Proj2.Y(), Proj2.Z());
Prs3d_Root::NewGroup(aPresentation);
Marker2Asp->SetColor(acolor);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(Marker2Asp);
Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d);
-
}
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_ParalPresentation.ixx>
#include <gp_Lin.hxx>
#include <gp_Dir.hxx>
#include <ElCLib.hxx>
#include <gce_MakeLin.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
const gp_Pnt& AttachmentPoint1,
const gp_Pnt& AttachmentPoint2,
const gp_Dir& aDirection,
- const gp_Pnt& OffsetPoint) {
-
-
+ const gp_Pnt& OffsetPoint)
+{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
- Graphic3d_Array1OfVertex V(1,2);
-
- Quantity_Length X,Y,Z;
-
- PointMin.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
-
- PointMax.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
// processing of side : 1st group
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
+ aPrims->AddVertex(PointMin);
+ aPrims->AddVertex(PointMax);
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) {
+ if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
outside = Standard_True;
- }
gp_Dir arrdir = L3.Direction().Reversed();
-
- if (outside) {
+ if (outside)
arrdir.Reverse();
- }
+
// arrow 1 : 2nd group
- Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
// arrow 2 : 3rd group
- Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(),
- LA->Arrow2Aspect()->Angle(),
- LA->Arrow2Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
// text : 4th group
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,offp);
-
- AttachmentPoint1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Proj1.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
// processing of call 1 : 5th group
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(Proj1);
- AttachmentPoint2.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Proj2.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
-
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
// processing of call 2 : 6th group
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(Proj2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
const gp_Pnt& AttachmentPoint2,
const gp_Dir& aDirection,
const gp_Pnt& OffsetPoint,
- const DsgPrs_ArrowSide ArrowPrs){
-
-
+ const DsgPrs_ArrowSide ArrowPrs)
+{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
- Graphic3d_Array1OfVertex V(1,2);
-
- Quantity_Length X,Y,Z;
-
- PointMin.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
-
- PointMax.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
-
// processing of face
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
+ aPrims->AddVertex(PointMin);
+ aPrims->AddVertex(PointMax);
- if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) {
+ if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
outside = Standard_True;
- }
gp_Dir arrdir = L3.Direction().Reversed();
-
- if (outside) {
+ if (outside)
arrdir.Reverse();
- }
-
-
- AttachmentPoint1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Proj1.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
// processing of call 1
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(Proj1);
- AttachmentPoint2.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Proj2.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
+ // processing of call 2
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(Proj2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
- // processing of call 2
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
-
// text
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,offp);
//arrows
DsgPrs::ComputeSymbol(aPresentation,LA,Proj1,Proj2,arrdir,arrdir.Reversed(),ArrowPrs);
-
-
}
-
-
#include <Prs3d_LengthAspect.hxx>
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <StdPrs_Point.hxx>
LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID); // ou DOT ou DOTDASH
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex V1(1,2);
- Graphic3d_Array1OfVertex V2(1,2);
- Quantity_Length X1,Y1,Z1;
- Quantity_Length X2,Y2,Z2;
-
- // 1er segment
- OffsetPoint.Coord(X1,Y1,Z1);
- V1(1).SetCoord(X1,Y1,Z1);
- pAx1.Coord(X2,Y2,Z2);
- V1(2).SetCoord(X2,Y2,Z2); //ou directt dir1.XYZ
-
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V1);
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
-
- // 2e segment
- pAx2.Coord(X2,Y2,Z2);
- V2(1).SetCoord(X1,Y1,Z1);
- V2(2).SetCoord(X2,Y2,Z2);
-
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V2);
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+ // segments
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(6,2);
- // points attache
- Graphic3d_Array1OfVertex V3(1,2);
- if (intOut1) {
- pAx1.Coord(X1,Y1,Z1);
- V3(1).SetCoord(X1,Y1,Z1);
- pnt1.Coord(X2,Y2,Z2);
- V3(2).SetCoord(X2,Y2,Z2);
- LA->LineAspect()->SetTypeOfLine(Aspect_TOL_DOT); // ou DOT ou DOTDASH
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V3);
- }
- if (intOut2) {
- pAx2.Coord(X1,Y1,Z1);
- V3(1).SetCoord(X1,Y1,Z1);
- pnt2.Coord(X2,Y2,Z2);
- V3(2).SetCoord(X2,Y2,Z2);
- LA->LineAspect()->SetTypeOfLine(Aspect_TOL_DOT); // ou DOT ou DOTDASH
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->
- SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V3);
- }
+ aPrims->AddBound(3);
+ aPrims->AddVertex(OffsetPoint);
+ aPrims->AddVertex(pAx1);
+ aPrims->AddVertex(pAx2);
// Symbol
- Graphic3d_Array1OfVertex V4(1,3);
gp_Vec vec1(gce_MakeDir(OffsetPoint,pAx1));
gp_Vec vec2(gce_MakeDir(OffsetPoint,pAx2));
- Standard_Real dist1(OffsetPoint.Distance(pAx1));
- Standard_Real dist2(OffsetPoint.Distance(pAx2));
- vec1 *= dist1;
- vec1 *= .2;
- vec2 *= dist2;
- vec2 *= .2;
+ vec1 *= .2 * OffsetPoint.Distance(pAx1);
+ vec2 *= .2 * OffsetPoint.Distance(pAx2);
gp_Pnt pAx11 = OffsetPoint.Translated(vec1);
gp_Pnt pAx22 = OffsetPoint.Translated(vec2);
gp_Pnt p_symb = pAx22.Translated(vec1);
- pAx11.Coord(X1,Y1,Z1);
- V4(1).SetCoord(X1,Y1,Z1);
- p_symb.Coord(X1,Y1,Z1);
- V4(2).SetCoord(X1,Y1,Z1);
- pAx22.Coord(X1,Y1,Z1);
- V4(3).SetCoord(X1,Y1,Z1);
-
- LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V4);
- Prs3d_Root::NewGroup(aPresentation);
-}
-
+ aPrims->AddBound(3);
+ aPrims->AddVertex(pAx11);
+ aPrims->AddVertex(p_symb);
+ aPrims->AddVertex(pAx22);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ // points attache
+ if (intOut1 || intOut2)
+ {
+ LA->LineAspect()->SetTypeOfLine(Aspect_TOL_DOT); // ou DOT ou DOTDASH
+ Prs3d_Root::NewGroup(aPresentation);
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+ if (intOut1) {
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(pAx1);
+ aPrims->AddVertex(pnt1);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
+ if (intOut2) {
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(pAx2);
+ aPrims->AddVertex(pnt2);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
+ }
+}
#include <gp_Circ.hxx>
#include <ElCLib.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
static Standard_Boolean DsgPrs_InDomain(const Standard_Real fpar,
- const Standard_Real lpar,
- const Standard_Real para)
+ const Standard_Real lpar,
+ const Standard_Real para)
{
- if (fpar >= 0.) {
+ if (fpar >= 0.)
return ((para >= fpar) && (para <= lpar));
- }
- if (para >= (fpar+2*M_PI)) return Standard_True;
+ if (para >= (fpar+2.*M_PI)) return Standard_True;
if (para <= lpar) return Standard_True;
return Standard_False;
}
{
Standard_Real fpara = firstparam;
Standard_Real lpara = lastparam;
- while (lpara > 2*M_PI) {
- fpara -= 2*M_PI;
- lpara -= 2*M_PI;
+ while (lpara > 2.*M_PI) {
+ fpara -= 2.*M_PI;
+ lpara -= 2.*M_PI;
}
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
Standard_Real parat = ElCLib::Parameter(aCircle,AttachmentPoint);
gp_Pnt attpoint = AttachmentPoint;
Standard_Boolean otherside = Standard_False;
if ( !DsgPrs_InDomain(fpara,lpara,parat)) {
Standard_Real otherpar = parat + M_PI;
- if (otherpar > 2*M_PI) otherpar -= 2*M_PI;
+ if (otherpar > 2.*M_PI) otherpar -= 2.*M_PI;
if (DsgPrs_InDomain(fpara,lpara,otherpar)) {
parat = otherpar;
otherside = Standard_True;
}
else {
- Standard_Real ecartpar = Min(Abs(fpara-parat),
- Abs(lpara-parat));
- Standard_Real ecartoth = Min(Abs(fpara-otherpar),
- Abs(lpara-otherpar));
+ const Standard_Real ecartpar = Min(Abs(fpara-parat),Abs(lpara-parat));
+ const Standard_Real ecartoth = Min(Abs(fpara-otherpar),Abs(lpara-otherpar));
if (ecartpar <= ecartoth) {
- if (parat < fpara) {
- parat = fpara;
- }
- else {
- parat = lpara;
- }
+ parat = (parat < fpara)? fpara : lpara;
}
else {
- otherside = Standard_True;
- if (otherpar < fpara) {
- parat = fpara;
- }
- else {
- parat = lpara;
- }
+ otherside = Standard_True;
+ parat = (otherpar < fpara)? fpara : lpara;
}
gp_Pnt ptdir = ElCLib::Value(parat,aCircle);
- gp_Lin lsup(aCircle.Location(),
- gp_Dir(ptdir.XYZ()-aCircle.Location().XYZ()));
- Standard_Real parpos = ElCLib::Parameter(lsup,AttachmentPoint);
+ gp_Lin lsup(aCircle.Location(),gp_Dir(ptdir.XYZ()-aCircle.Location().XYZ()));
+ const Standard_Real parpos = ElCLib::Parameter(lsup,AttachmentPoint);
attpoint = ElCLib::Value(parpos,lsup);
}
}
gp_Pnt firstpoint = attpoint;
gp_Pnt drawtopoint = ptoncirc;
if (drawFromCenter && !otherside) {
- Standard_Real uatt = ElCLib::Parameter(L,attpoint);
- Standard_Real uptc = ElCLib::Parameter(L,ptoncirc);
- if (Abs(uatt) > Abs(uptc)) {
+ const Standard_Real uatt = ElCLib::Parameter(L,attpoint);
+ const Standard_Real uptc = ElCLib::Parameter(L,ptoncirc);
+ if (Abs(uatt) > Abs(uptc))
drawtopoint = aCircle.Location();
- }
- else {
+ else
firstpoint = aCircle.Location();
- }
}
- Graphic3d_Array1OfVertex V(1,2);
-
- Quantity_Length X,Y,Z;
-
- firstpoint.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
-
- drawtopoint.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
-
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(firstpoint);
+ aPrims->AddVertex(drawtopoint);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
gp_Dir arrdir = L.Direction();
- if (reverseArrow) {
+ if (reverseArrow)
arrdir.Reverse();
- }
+
// fleche
- Prs3d_Arrow::Draw(aPresentation,ptoncirc,arrdir,
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,ptoncirc,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
// texte
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,attpoint);
-
}
//=======================================================================
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
- Graphic3d_Array1OfVertex VertexArray( 1, 2 );
- gp_Pnt LineOrigin, LineEnd;
- Quantity_Length X,Y,Z;
-
- DsgPrs::ComputeRadiusLine( Center, EndOfArrow, AttachmentPoint, drawFromCenter,
- LineOrigin, LineEnd);
-//
- LineOrigin.Coord( X, Y, Z );
- VertexArray(1).SetCoord( X, Y, Z );
+ gp_Pnt LineOrigin, LineEnd;
+ DsgPrs::ComputeRadiusLine(Center, EndOfArrow, AttachmentPoint, drawFromCenter, LineOrigin, LineEnd);
- LineEnd.Coord( X, Y, Z );
- VertexArray(2).SetCoord( X, Y, Z );
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(LineOrigin);
+ aPrims->AddVertex(LineEnd);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
- Prs3d_Root::CurrentGroup( aPresentation )->Polyline( VertexArray );
// text
Prs3d_Text::Draw( aPresentation, LA->TextAspect(), aText, AttachmentPoint );
gp_Dir ArrowDir = gce_MakeDir( LineOrigin , LineEnd );
if (reverseArrow)
ArrowDir.Reverse();
- DsgPrs::ComputeSymbol( aPresentation, LA, Center, EndOfArrow, ArrowDir.Reversed(), ArrowDir,
- ArrowPrs, drawFromCenter );
+ DsgPrs::ComputeSymbol( aPresentation, LA, Center, EndOfArrow, ArrowDir.Reversed(), ArrowDir, ArrowPrs, drawFromCenter );
}
-
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_ShadedPlanePresentation.ixx>
#include <Prs3d_Root.hxx>
#include <Prs3d_PlaneAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfPolygons.hxx>
//=======================================================================
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->PlaneAspect()->EdgesAspect()->Aspect());
TheGroup->SetPrimitivesAspect(aDrawer->ShadingAspect()->Aspect());
- Quantity_Length x1,y1,z1,x2,y2,z2,x3,y3,z3;
-
- aPt1.Coord(x1,y1,z1);
- aPt2.Coord(x2,y2,z2);
- aPt3.Coord(x3,y3,z3);
-
- Graphic3d_Array1OfVertex A(1,5);
- A(1).SetCoord(x1,y1,z1);
- A(2).SetCoord(x2,y2,z2);
- A(3).SetCoord(x3,y3,z3);
- A(4).SetCoord(x1,y1,z1);
- A(5)=A(1);
-
- TheGroup->Polygon(A);
+
+ Handle(Graphic3d_ArrayOfPolygons) aPrims = new Graphic3d_ArrayOfPolygons(4);
+ aPrims->AddVertex(aPt1);
+ aPrims->AddVertex(aPt2);
+ aPrims->AddVertex(aPt3);
+ aPrims->AddVertex(aPt1);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_ShapeDirPresentation.ixx>
#include <gp.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools_WireExplorer.hxx>
-//#include <BRepAdaptor_Curve2d.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepClass_Edge.hxx>
#include <BRepBndLib.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Vertex.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_LineAspect.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
-
//=======================================================================
//function : FindPointOnFace
//purpose : internal use
Handle(Geom_Curve) curve = Handle(Geom_Curve)::DownCast(curv0->Copy());
curve->Transform(loc.Transformation());
GeomLProp_CLProps lProps(curve, 1, gp::Resolution());
- if (mode == 0) {
- lProps.SetParameter(last);
- }
- else if (mode == 1) {
- lProps.SetParameter(first);
- }
- if (!lProps.IsTangentDefined()) {
+ lProps.SetParameter((mode == 0)? last : first);
+ if (!lProps.IsTangentDefined())
return Standard_False;
- }
pt = lProps.Value();
lProps.Tangent(dir);
}
pt2d.SetCoord((u1+u2)*0.5, (v1+v2)*0.5);
}
else {
- Standard_Boolean found = FindPointOnFace(TopoDS::Face(shape), pt2d);
- if (!found) {
- return Standard_False;
- }
+ if (!FindPointOnFace(TopoDS::Face(shape), pt2d))
+ return Standard_False;
}
GeomLProp_SLProps lProps(surface, pt2d.X(), pt2d.Y(), 1, gp::Resolution());
- if (!lProps.IsNormalDefined()) {
+ if (!lProps.IsNormalDefined())
return Standard_False;
- }
pt = lProps.Value();
dir = lProps.Normal();
const Standard_Integer mode)
{
- if ((mode != 0) && (mode != 1)) {
+ if ((mode != 0) && (mode != 1))
return;
- }
gp_Dir dir;
gp_Pnt pt;
for (anExp.Init(TopoDS::Wire(shape)); anExp.More(); anExp.Next()) {
const TopoDS_Edge& edge = anExp.Current();
nb++;
- if (nb <=3) {
- BRepBndLib::Add(edge, box);
- }
+ if (nb <=3)
+ BRepBndLib::Add(edge, box);
aList.Append(edge);
}
// mei 19/09/96 extrusion infinie -> taille fixe
if (leng >= 20000.) leng = 50;
- gp_Pnt pt2(pt.X()+leng*dir.X(), pt.Y()+leng*dir.Y(), pt.Z()+leng*dir.Z());
- Graphic3d_Array1OfVertex line(1,2);
- line(1).SetCoord(pt.X(), pt.Y(), pt.Z());
- line(2).SetCoord(pt2.X(), pt2.Y(), pt2.Z());
-
+ gp_Pnt pt2(pt.XYZ()+leng*dir.XYZ());
+
Prs3d_Root::CurrentGroup(prs)->SetPrimitivesAspect(drawer->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(prs)->Polyline(line);
+
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(pt);
+ aPrims->AddVertex(pt2);
+ Prs3d_Root::CurrentGroup(prs)->AddPrimitiveArray(aPrims);
Prs3d_Arrow::Draw(prs, pt2, dir, M_PI/180.*10., leng*0.3);
}
-
-
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_SymmetricPresentation.ixx>
#include <Precision.hxx>
#include <gce_MakeDir.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_Vertex.hxx>
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
gp_Pnt ProjOffsetPoint = ElCLib::Value(ElCLib::Parameter(aAxis,OffsetPoint),aAxis);
gp_Pnt PjAttachPnt1 = ElCLib::Value(ElCLib::Parameter(aAxis,AttachmentPoint1),aAxis);
gp_Dir aDirectionAxis = aAxis.Direction();
-// gp_Lin L1 (AttachmentPoint1,aDirection1);
Standard_Real h = fabs(ProjOffsetPoint.Distance(PjAttachPnt1)/cos(aDirectionAxis.Angle(aDirection1)));
gp_Vec VL1(aDirection1);
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
- Graphic3d_Array1OfVertex V(1,2);
- Graphic3d_Array1OfVertex Vc(1,3);
- Quantity_Length X,Y,Z;
- Standard_Real D1,coeff;
- coeff = .5;
- D1 = aAxis.Distance(AttachmentPoint1);
- gp_Pnt pint,Pj_P1,P1Previous;
- P1Previous.SetX(P1.X());
- P1Previous.SetY(P1.Y());
- P1Previous.SetZ(P1.Z());
+ Quantity_Length X,Y,Z;
+ Standard_Real D1(aAxis.Distance(AttachmentPoint1)),coeff(.5);
+ gp_Pnt pint,Pj_P1,P1Previous = P1;
-/*//=======================================================
+ //=======================================================
// TO AVOID CROSSING
// P1 -=- P2 P2 -=- P1
// \<-->/ |<-->|
// Pattach2 /____\ Pattach1 Pattach2 /______\ Pattach1
// / NO \ / YES \
//=======================================================
-*/
Standard_Boolean Cross = Standard_False;
gp_Vec Attch1_PjAttch1(AttachmentPoint1,PjAttachPnt1);
P1 = P2;
P2 = PntTempo;
}
-/* //===================================
+ //===================================
// FRACTURES OF TRAITS OF CALL
// / \
// / \
// | -=- |
// |<------------->|
//===================================
-*/
+
gp_Vec Vfix;
-// Standard_Real alpha,b,s,d;
Standard_Real alpha,b;
if(aAxis.Distance(P1) > D1*(1 + coeff) && !Cross){
//==== PROCESSING OF FACE ===========
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
Pj_P1 = ElCLib::Value(ElCLib::Parameter(aAxis,P1),aAxis);
gp_Vec Vp(Pj_P1,P1);
Vfix = Vp.Divided(Vp.Magnitude()).Multiplied(D1*(1 + coeff));
- Pj_P1.Translated(Vfix).Coord(X,Y,Z);
- P1.SetCoord(X,Y,Z);
- Pj_P1.Translated(Vfix.Reversed()).Coord(X,Y,Z);
- P2.SetCoord(X,Y,Z);
+ P1 = Pj_P1.Translated(Vfix);
+ P2 = Pj_P1.Translated(Vfix.Reversed());
//=================================
// LISTING AT THE EXTERIOR
PointMin = ElCLib::Value(parmin,L3);
PointMax = ElCLib::Value(parmax,L3);
- PointMin.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- PointMax.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(8,3);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(PointMin);
+ aPrims->AddVertex(PointMax);
//==== PROCESSING OF CALL 1 =====
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- AttachmentPoint1.Coord(X,Y,Z);
- Vc(1).SetCoord(X,Y,Z);
-
alpha = aDirectionAxis.Angle(aDirection1);
b = (coeff*D1)/sin(alpha);
gp_Vec Vpint(AttachmentPoint1,P1Previous);
- AttachmentPoint1.Translated(Vpint.Divided(Vpint.Magnitude()).Multiplied(b)).Coord(X,Y,Z);
- pint.SetCoord(X,Y,Z);
-
- pint.Coord(X,Y,Z);
- Vc(2).SetCoord(X,Y,Z);
- P1.Coord(X,Y,Z);
- Vc(3).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vc);
-
+ pint = AttachmentPoint1.Translated(Vpint.Divided(Vpint.Magnitude()).Multiplied(b));
+
+ aPrims->AddBound(3);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(pint);
+ aPrims->AddVertex(P1);
+
//==== PROCESSING OF CALL 2 =====
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- AttachmentPoint2.Coord(X,Y,Z);
- Vc(1).SetCoord(X,Y,Z);
gp_Pnt Pj_pint = ElCLib::Value(ElCLib::Parameter(aAxis,pint),aAxis);
gp_Vec V_int(pint, Pj_pint);
- gp_Pnt Sym_pint;
- Pj_pint.Translated(V_int).Coord(X,Y,Z);
- Sym_pint.SetCoord(X,Y,Z);
-
- Sym_pint.Coord(X,Y,Z);
- Vc(2).SetCoord(X,Y,Z);
- P2.Coord(X,Y,Z);
- Vc(3).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vc);
+ gp_Pnt Sym_pint = Pj_pint.Translated(V_int);
+
+ aPrims->AddBound(3);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(Sym_pint);
+ aPrims->AddVertex(P2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
-/*//===================================
+ //===================================
// FRACTURES OF PROCESSING OF CALL
// -=-
// |<--------->|
// / \
// / \
//===================================
-*/
else if (aAxis.Distance(P1) < D1*(1 - coeff) || Cross) {
//------ PROCESSING OF FACE ------------
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
Pj_P1 = ElCLib::Value(ElCLib::Parameter(aAxis,P1),aAxis);
gp_Vec VpInf(Pj_P1,P1);
Vfix = VpInf.Divided(VpInf.Magnitude()).Multiplied(D1*(1 - coeff));
PointMin = ElCLib::Value(parmin,L3);
PointMax = ElCLib::Value(parmax,L3);
- PointMin.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- PointMax.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(8,3);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(PointMin);
+ aPrims->AddVertex(PointMax);
//==== PROCESSING OF CALL 1 =====
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- AttachmentPoint1.Coord(X,Y,Z);
- Vc(1).SetCoord(X,Y,Z);
-
alpha = aDirectionAxis.Angle(aDirection1);
b = (coeff*D1)/sin(alpha);
gp_Vec Vpint(AttachmentPoint1,P1Previous);
- AttachmentPoint1.Translated(Vpint.Divided(Vpint.Magnitude()).Multiplied(b)).Coord(X,Y,Z);
- pint.SetCoord(X,Y,Z);
-
- pint.Coord(X,Y,Z);
- Vc(2).SetCoord(X,Y,Z);
- P1.Coord(X,Y,Z);
- Vc(3).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vc);
+ pint = AttachmentPoint1.Translated(Vpint.Divided(Vpint.Magnitude()).Multiplied(b));
+
+ aPrims->AddBound(3);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(pint);
+ aPrims->AddVertex(P1);
//==== PROCESSING OF CALL 2 =====
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- AttachmentPoint2.Coord(X,Y,Z);
- Vc(1).SetCoord(X,Y,Z);
gp_Pnt Pj_pint = ElCLib::Value(ElCLib::Parameter(aAxis,pint),aAxis);
gp_Vec V_int(pint, Pj_pint);
- gp_Pnt Sym_pint;
- Pj_pint.Translated(V_int).Coord(X,Y,Z);
- Sym_pint.SetCoord(X,Y,Z);
-
- Sym_pint.Coord(X,Y,Z);
- Vc(2).SetCoord(X,Y,Z);
- P2.Coord(X,Y,Z);
- Vc(3).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vc);
+ gp_Pnt Sym_pint = Pj_pint.Translated(V_int);
+
+ aPrims->AddBound(3);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(Sym_pint);
+ aPrims->AddVertex(P2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
else {
//==== PROCESSING OF FACE ===========
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- PointMin.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- PointMax.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
+
+ aPrims->AddVertex(PointMin);
+ aPrims->AddVertex(PointMax);
+
//==== PROCESSING OF CALL 1 =====
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- AttachmentPoint1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- P1.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(P1);
//==== PROCESSING OF CALL 2 =====
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- AttachmentPoint2.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- P2.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(P2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
//==== ARROWS ================
gp_Dir arrdir = L3.Direction().Reversed();
if (outside) arrdir.Reverse();
// arrow 1 ----
- Prs3d_Arrow::Draw(aPresentation,P1,arrdir,
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
// arrow 2 ----
- Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),
- LA->Arrow2Aspect()->Angle(),
- LA->Arrow2Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
//-------------------------------------------------------------------------------------
//| SYMBOL OF SYMMETRY |
else {
pm = P1.Translated(Vvar.Multiplied(.5));
}
- //pm = P1.Translated(Vvar.Multiplied(.5));
pOff = OffsetPoint.Translated(vecB);
//Calculate the extremities of the symbol axis
gp_Vec vecAxe = vecA.Multiplied(.7);
- pOff.Translated(vecAxe).Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- pOff.Translated(vecAxe.Reversed()).Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
+
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(13,5);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pOff.Translated(vecAxe));
+ aPrims->AddVertex(pOff.Translated(vecAxe.Reversed()));
//Calculate the extremities of the superior segment of the symbol
gp_Vec vec1 = vecAxe.Multiplied(.6);
vecAxe = Vaxe.Multiplied(vecAxe.Magnitude());
gp_Vec vec2 = vecAxe.Multiplied(.4);
- pOff.Translated(vec1.Added(vec2)).Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- pOff.Translated(vec1.Reversed().Added(vec2)).Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pOff.Translated(vec1.Added(vec2)));
+ aPrims->AddVertex(pOff.Translated(vec1.Reversed().Added(vec2)));
//Calculate the extremities of the inferior segment of the symbol
- pOff.Translated(vec1.Added(vec2.Reversed())).Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- pOff.Translated(vec1.Reversed().Added(vec2.Reversed())).Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
-/*//--------------------------------------------------------------------------------------
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pOff.Translated(vec1.Added(vec2.Reversed())));
+ aPrims->AddVertex(pOff.Translated(vec1.Reversed().Added(vec2.Reversed())));
+
+ //--------------------------------------------------------------------------------------
//| MARKING OF THE SYMMETRY AXIS |
//--------------------------------------------------------------------------------------
// ____
// \/
// /\
// /__\
-*/
- Graphic3d_Array1OfVertex cursor(1,5);
- Standard_Real Dist = (aAxis.Distance(AttachmentPoint1)+
- aAxis.Distance(AttachmentPoint2))/75;
+ Standard_Real Dist = (aAxis.Distance(AttachmentPoint1)+aAxis.Distance(AttachmentPoint2))/75;
gp_Vec vs(aDirectionAxis);
gp_Vec vsym(vs.Divided(vs.Magnitude()).Multiplied(Dist).XYZ());
-
gp_Vec vsymper(vsym.Y(),-vsym.X(),vsym.Z());
+ aPrims->AddBound(5);
gp_Pnt pm1 = pm.Translated(vsym.Added(vsymper));
- cursor(1).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsym.Reversed().Multiplied(2).Added(vsymper.Reversed().Multiplied(2)));
- cursor(2).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsymper.Multiplied(2));
- cursor(3).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsym.Multiplied(2).Added(vsymper.Reversed().Multiplied(2)));
- cursor(4).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsymper.Multiplied(2));
- cursor(5).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
-
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(cursor);
+ aPrims->AddVertex(pm1);
vsym.Multiply(4);
- V(1).SetCoord(pm.Translated(vsym).X(),
- pm.Translated(vsym).Y(),
- pm.Translated(vsym).Z());
- V(2).SetCoord(pm.Translated(vsym.Reversed()).X(),
- pm.Translated(vsym.Reversed()).Y(),
- pm.Translated(vsym.Reversed()).Z());
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pm.Translated(vsym));
+ aPrims->AddVertex(pm.Translated(vsym.Reversed()));
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
//===================================================================
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
gp_Pnt OffsetPnt(OffsetPoint.X(),OffsetPoint.Y(),OffsetPoint.Z());
gp_Pnt Center1 = aCircle1.Location();
gp_Pnt ProjOffsetPoint = ElCLib::Value(ElCLib::Parameter(aAxis,OffsetPnt),aAxis);
gp_Vec Vp(ProjCenter1,Center1);
if (Vp.Magnitude() <= Precision::Confusion()) Vp = gp_Vec(aAxis.Direction())^aCircle1.Position().Direction();
-
Standard_Real Dt,R,h;
Dt = ProjCenter1.Distance(ProjOffsetPoint);
R = aCircle1.Radius();
if (parcur < parmin) parmin = parcur;
if (parcur > parmax) parmax = parcur;
parcur = ElCLib::Parameter(L3,OffsetPnt);
-#ifdef DEB
- gp_Pnt offp =
-#endif
- ElCLib::Value(parcur,L3);
Standard_Boolean outside = Standard_False;
if (parcur < parmin) {
}
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
- Graphic3d_Array1OfVertex V(1,2);
- Quantity_Length X,Y,Z;
-
+
//==== PROCESSING OF FACE ===========
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- PointMin.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- PointMax.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(PointMin);
+ aPrims->AddVertex(PointMax);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
//==== PROCESSING OF CALL 1 =====
Standard_Integer nbp = 10;
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real ParamP1 = ElCLib::Parameter(aCircle1,P1);
Standard_Real ParamPAttach1 = ElCLib::Parameter(aCircle1,AttachmentPoint1);
-// gp_Vec Center1_PAttach1(Center1,AttachmentPoint1);
-// gp_Vec Center1_P1(Center1,P1);
Standard_Real alpha,Dalpha,alphaIter;
alpha = fabs(ParamP1 - ParamPAttach1);
if(ParamP1 < ParamPAttach1){
if(alpha > M_PI){
- alpha = (2*M_PI) - alpha;
+ alpha = (2.*M_PI) - alpha;
nbp = (Standard_Integer ) IntegerPart(alpha/(alpha*.02));
Dalpha = alpha/(nbp - 1);
}
}
else{
if(alpha > M_PI){
- alpha = (2*M_PI) - alpha;
+ alpha = (2.*M_PI) - alpha;
nbp = (Standard_Integer ) IntegerPart(alpha/(alpha*.02));
Dalpha = -alpha/(nbp - 1);
}
}
}
- Graphic3d_Array1OfVertex Vc1(1,nbp);
- AttachmentPoint1.Coord(X,Y,Z);
- Vc1(1).SetCoord(X,Y,Z);
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp);
+ aPrims->AddVertex(AttachmentPoint1);
alphaIter = Dalpha;
gp_Pnt PntIter;
- Standard_Integer i ;
- for( i = 2; i <= nbp; i++){
- PntIter = ElCLib::Value(ParamPAttach1 + alphaIter,aCircle1);
- alphaIter = alphaIter + Dalpha;
- PntIter.Coord(X,Y,Z);
- Vc1(i).SetCoord(X,Y,Z);
-
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vc1);
+ Standard_Integer i;
+ for(i = 2; i <= nbp; i++, alphaIter += Dalpha)
+ aPrims->AddVertex(ElCLib::Value(ParamPAttach1 + alphaIter,aCircle1));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
//==== PROCESSING OF CALL 2 =====
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt Center2 = ProjCenter1.Translated(Vp.Reversed());
-// gp_Vec Center2_PAttach2(Center2,AttachmentPoint2);
-// gp_Vec Center2_P2(Center2,P2);
-
gp_Dir DirC2 = aCircle1.Axis().Direction();
gp_Ax2 AxeC2(Center2,DirC2);
gp_Circ aCircle2(AxeC2,aCircle1.Radius());
}
}
- Graphic3d_Array1OfVertex Vc2(1,nbp);
- AttachmentPoint2.Coord(X,Y,Z);
- Vc2(1).SetCoord(X,Y,Z);
+ aPrims = new Graphic3d_ArrayOfPolylines(nbp);
+ aPrims->AddVertex(AttachmentPoint2);
alphaIter = Dalpha;
- for(i = 2; i <= nbp; i++){
- PntIter = ElCLib::Value(ParamPAttach2 + alphaIter,aCircle2);
- alphaIter = alphaIter + Dalpha;
- PntIter.Coord(X,Y,Z);
- Vc2(i).SetCoord(X,Y,Z);
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vc2);
-
+ for(i = 2; i <= nbp; i++, alphaIter += Dalpha)
+ aPrims->AddVertex(ElCLib::Value(ParamPAttach2 + alphaIter,aCircle2));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
//==== ARROWS ================
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir arrdir = L3.Direction().Reversed();
if (outside) arrdir.Reverse();
// arrow 1 ----
- Prs3d_Arrow::Draw(aPresentation,P1,arrdir,
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
// arrow 2 ----
- Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),
- LA->Arrow2Aspect()->Angle(),
- LA->Arrow2Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
//-------------------------------------------------------------------------------------
//| SYMBOL OF SYMMETRY |
// ------- : Inferior Segment
gp_Vec Vvar(P1,P2);
- gp_Vec vec;
gp_Vec Vtmp = Vvar.Divided(Vvar.Magnitude()).Multiplied(2*(aAxis.Distance(Center1)));
- vec.SetCoord(Vtmp.X(),Vtmp.Y(),Vtmp.Z());
+ gp_Vec vec = Vtmp;
gp_Vec vecA = vec.Multiplied(.1);
gp_Dir DirAxis = aAxis.Direction();
gp_Vec vecB = Vaxe.Multiplied(vecA.Magnitude());
vecB.Multiply(.5);
- //gp_Vec vecB(-vec.Y(),vec.X(),vec.Z());
- //vecB.Multiply(.05);
- gp_Pnt pm,pOff;
- pm = P1.Translated(Vvar.Multiplied(.5));
- pOff = OffsetPnt.Translated(vecB);
+ gp_Pnt pm = P1.Translated(Vvar.Multiplied(.5));
+ gp_Pnt pOff = OffsetPnt.Translated(vecB);
//Calculation of extremas of the axis of the symbol
gp_Vec vecAxe = vecA.Multiplied(.7);
- pOff.Translated(vecAxe).Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- pOff.Translated(vecAxe.Reversed()).Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
+
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+
+ aPrims = new Graphic3d_ArrayOfPolylines(13,5);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pOff.Translated(vecAxe));
+ aPrims->AddVertex(pOff.Translated(vecAxe.Reversed()));
//Calculation of extremas of the superior segment of the symbol
gp_Vec vec1 = vecAxe.Multiplied(.6);
-
vecAxe = Vaxe.Multiplied(vecAxe.Magnitude());
- //vecAxe.SetCoord(-vecAxe.Y(),vecAxe.X(),vecAxe.Z());
-
gp_Vec vec2 = vecAxe.Multiplied(.4);
- pOff.Translated(vec1.Added(vec2)).Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- pOff.Translated(vec1.Reversed().Added(vec2)).Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pOff.Translated(vec1.Added(vec2)));
+ aPrims->AddVertex(pOff.Translated(vec1.Reversed().Added(vec2)));
//Calculation of extremas of the inferior segment of the symbol
- pOff.Translated(vec1.Added(vec2.Reversed())).Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- pOff.Translated(vec1.Reversed().Added(vec2.Reversed())).Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pOff.Translated(vec1.Added(vec2.Reversed())));
+ aPrims->AddVertex(pOff.Translated(vec1.Reversed().Added(vec2.Reversed())));
-/*//--------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------
//| MARKING OF THE AXIS OF SYMMETRY |
//--------------------------------------------------------------------------------------
// ____
// \/
// /\
// /__\
-*/
- Graphic3d_Array1OfVertex cursor(1,5);
- //Standard_Real Dist = aCircle1.Radius()/37;
Standard_Real Dist = aAxis.Distance(Center1)/37;
gp_Dir aDirectionAxis = aAxis.Direction();
gp_Vec vs(aDirectionAxis);
gp_Vec vsym(vs.Divided(vs.Magnitude()).Multiplied(Dist).XYZ());
-
gp_Vec vsymper(vsym.Y(),-vsym.X(),vsym.Z());
+
+ aPrims->AddBound(5);
gp_Pnt pm1 = pm.Translated(vsym.Added(vsymper));
- cursor(1).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsym.Reversed().Multiplied(2).Added(vsymper.Reversed().Multiplied(2)));
- cursor(2).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsymper.Multiplied(2));
- cursor(3).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsym.Multiplied(2).Added(vsymper.Reversed().Multiplied(2)));
- cursor(4).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsymper.Multiplied(2));
- cursor(5).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
-
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(cursor);
+ aPrims->AddVertex(pm1);
vsym.Multiply(4);
- V(1).SetCoord(pm.Translated(vsym).X(),
- pm.Translated(vsym).Y(),
- pm.Translated(vsym).Z());
- V(2).SetCoord(pm.Translated(vsym.Reversed()).X(),
- pm.Translated(vsym.Reversed()).Y(),
- pm.Translated(vsym.Reversed()).Z());
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pm.Translated(vsym));
+ aPrims->AddVertex(pm.Translated(vsym.Reversed()));
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
-
+
//===================================================================
//Function:Add
//Purpose: draws the representation of an axial symmetry between two vertex.
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- if (AttachmentPoint1.IsEqual(AttachmentPoint2,Precision::Confusion())){
+ if (AttachmentPoint1.IsEqual(AttachmentPoint2,Precision::Confusion()))
+ {
//==============================================================
// SYMMETRY WHEN THE REFERENCE POINT IS ON THE AXIS OF SYM.:
//==============================================================
LA->LineAspect()->Aspect()->Values(acolor, atype, awidth);
MarkerAsp->SetColor(acolor);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAsp);
- Graphic3d_Vertex V3d(AttachmentPoint1.X(),
- AttachmentPoint1.Y(),
- AttachmentPoint1.Z());
+ Graphic3d_Vertex V3d(AttachmentPoint1.X(),AttachmentPoint1.Y(),AttachmentPoint1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->Marker(V3d);
//Trace of the linking segment
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex Vrac(1,2);
- Vrac(1).SetCoord(AttachmentPoint1.X(),
- AttachmentPoint1.Y(),
- AttachmentPoint1.Z());
- Vrac(2).SetCoord(OffsetPoint.X(),
- OffsetPoint.Y(),
- OffsetPoint.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrac);
+
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(8);
+
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(OffsetPoint);
//--------------------------------------------------------------------------------------
//| SYMBOL OF SYMMETRY |
gp_Vec uVAO = VAO.Divided(VAO.Magnitude());
gp_Pnt pDaxe = OffsetPoint.Translated(uVAO.Multiplied(3.));
gp_Pnt pFaxe = pDaxe.Translated(uVAO.Multiplied(12.));
- Vrac(1).SetCoord(pDaxe.X(),pDaxe.Y(),pDaxe.Z());
- Vrac(2).SetCoord(pFaxe.X(),pFaxe.Y(),pFaxe.Z());
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrac);
+
+ aPrims->AddVertex(pDaxe);
+ aPrims->AddVertex(pFaxe);
//Calculate extremas of the superior segment of the symbol
gp_Vec nVAO (-uVAO.Y(),uVAO.X(),uVAO.Z());
gp_Pnt sgP11 = pDaxe.Translated(uVAO.Multiplied(2.).Added(nVAO.Multiplied(2.)));
gp_Pnt sgP12 = sgP11.Translated(uVAO.Multiplied(8.));
- Vrac(1).SetCoord(sgP11.X(),sgP11.Y(),sgP11.Z());
- Vrac(2).SetCoord(sgP12.X(),sgP12.Y(),sgP12.Z());
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrac);
+
+ aPrims->AddVertex(sgP11);
+ aPrims->AddVertex(sgP12);
//Calculate extremas of the inferior segment of the symbol
gp_Vec nVAOr = nVAO.Reversed();
gp_Pnt sgP21 = pDaxe.Translated(uVAO.Multiplied(2.).Added(nVAOr.Multiplied(2.)));
gp_Pnt sgP22 = sgP21.Translated(uVAO.Multiplied(8.));
- Vrac(1).SetCoord(sgP21.X(),sgP21.Y(),sgP21.Z());
- Vrac(2).SetCoord(sgP22.X(),sgP22.Y(),sgP22.Z());
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(Vrac);
+
+ aPrims->AddVertex(sgP21);
+ aPrims->AddVertex(sgP22);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
//==============================================================
// OTHER CASES :
//==============================================================
- else{
+ else {
gp_Pnt ProjOffsetPoint = ElCLib::Value(ElCLib::Parameter(aAxis,OffsetPoint),aAxis);
gp_Pnt ProjAttachmentPoint1 = ElCLib::Value(ElCLib::Parameter(aAxis,AttachmentPoint1),aAxis);
gp_Vec PjAtt1_Att1(ProjAttachmentPoint1,AttachmentPoint1);
gp_Pnt P1 = ProjOffsetPoint.Translated(PjAtt1_Att1);
gp_Pnt P2 = ProjOffsetPoint.Translated(PjAtt1_Att1.Reversed());
-
+
gp_Lin L3 = gce_MakeLin(P1,P2);
Standard_Real parmin,parmax,parcur;
parmin = ElCLib::Parameter(L3,P1);
if (parcur < parmin) parmin = parcur;
if (parcur > parmax) parmax = parcur;
parcur = ElCLib::Parameter(L3,OffsetPoint);
-#ifdef DEB
- gp_Pnt offp =
-#endif
- ElCLib::Value(parcur,L3);
Standard_Boolean outside = Standard_False;
if (parcur < parmin) {
}
gp_Pnt PointMin = ElCLib::Value(parmin,L3);
gp_Pnt PointMax = ElCLib::Value(parmax,L3);
- Graphic3d_Array1OfVertex V(1,2);
- Quantity_Length X,Y,Z;
-
+
//==== PROCESSING OF FACE ===========
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- PointMin.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- PointMax.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+
+ Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfSegments(6);
+
+ aPrims->AddVertex(PointMin);
+ aPrims->AddVertex(PointMax);
//==== PROCESSING OF CALL 1 =====
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- AttachmentPoint1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- P1.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(P1);
//==== PROCESSING OF CALL 2 =====
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- AttachmentPoint2.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- P2.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ aPrims->AddVertex(AttachmentPoint2);
+ aPrims->AddVertex(P2);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
//==== ARROWS ================
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
-
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside) arrdir.Reverse();
// arrow 1 ----
- Prs3d_Arrow::Draw(aPresentation,P1,arrdir,
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
// arrow 2 ----
- Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),
- LA->Arrow2Aspect()->Angle(),
- LA->Arrow2Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
//==== POINTS ================
//Marker of localization of attachment points:
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
Handle(Graphic3d_AspectMarker3d) MarkerAspAtt = new Graphic3d_AspectMarker3d();
MarkerAspAtt->SetType(Aspect_TOM_BALL);
MarkerAspAtt->SetScale(0.8);
LA->LineAspect()->Aspect()->Values(color, type, width);
MarkerAspAtt->SetColor(color);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAspAtt);
- Graphic3d_Vertex Vatt1(AttachmentPoint1.X(),
- AttachmentPoint1.Y(),
- AttachmentPoint1.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Marker(Vatt1);
+ Graphic3d_Vertex Vatt1(AttachmentPoint1.X(),AttachmentPoint1.Y(),AttachmentPoint1.Z());
+ Prs3d_Root::CurrentGroup(aPresentation)->Marker(Vatt1);
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(MarkerAspAtt);
- Graphic3d_Vertex Vatt2(AttachmentPoint2.X(),
- AttachmentPoint2.Y(),
- AttachmentPoint2.Z());
- Prs3d_Root::CurrentGroup(aPresentation)->Marker(Vatt2);
+ Graphic3d_Vertex Vatt2(AttachmentPoint2.X(),AttachmentPoint2.Y(),AttachmentPoint2.Z());
+ Prs3d_Root::CurrentGroup(aPresentation)->Marker(Vatt2);
//-------------------------------------------------------------------------------------
//| SYMBOL OF SYMMETRY |
gp_Vec vecB = Vaxe.Multiplied(vecA.Magnitude());
vecB.Multiply(.5);
- //gp_Vec vecB(-vec.Y(),vec.X(),vec.Z());
- //vecB.Multiply(.05);
-
- gp_Pnt pm,pOff;
- pm = P1.Translated(vec.Multiplied(.5));
- pOff = OffsetPoint.Translated(vecB);
+ gp_Pnt pm = P1.Translated(vec.Multiplied(.5));
+ gp_Pnt pOff = OffsetPoint.Translated(vecB);
//Calculate the extremas of the axis of the symbol
gp_Vec vecAxe = vecA.Multiplied(.7);
- pOff.Translated(vecAxe).Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- pOff.Translated(vecAxe.Reversed()).Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
+
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
+
+ aPrims = new Graphic3d_ArrayOfPolylines(13,5);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pOff.Translated(vecAxe));
+ aPrims->AddVertex(pOff.Translated(vecAxe.Reversed()));
+
//Calculate the extremas of the superior segment of the symbol
gp_Vec vec1 = vecAxe.Multiplied(.6);
-
vecAxe = Vaxe.Multiplied(vecAxe.Magnitude());
-
- //vecAxe.SetCoord(-vecAxe.Y(),vecAxe.X(),vecAxe.Z());
gp_Vec vec2 = vecAxe.Multiplied(.4);
-
- pOff.Translated(vec1.Added(vec2)).Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- pOff.Translated(vec1.Reversed().Added(vec2)).Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pOff.Translated(vec1.Added(vec2)));
+ aPrims->AddVertex(pOff.Translated(vec1.Reversed().Added(vec2)));
//Calculate the extremas of the inferior segment of the symbol
- pOff.Translated(vec1.Added(vec2.Reversed())).Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- pOff.Translated(vec1.Reversed().Added(vec2.Reversed())).Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
-/* //--------------------------------------------------------------------------------------
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pOff.Translated(vec1.Added(vec2.Reversed())));
+ aPrims->AddVertex(pOff.Translated(vec1.Reversed().Added(vec2.Reversed())));
+
+ //--------------------------------------------------------------------------------------
//| MARKING OF THE AXIS OF SYMMETRY |
//--------------------------------------------------------------------------------------
// ____
// \/
// /\
// /__\
-*/
- Graphic3d_Array1OfVertex cursor(1,5);
Standard_Real Dist = P1.Distance(P2)/75;
gp_Dir aDirectionAxis = aAxis.Direction();
gp_Vec vs(aDirectionAxis);
gp_Vec vsym(vs.Divided(vs.Magnitude()).Multiplied(Dist).XYZ());
-
gp_Vec vsymper(vsym.Y(),-vsym.X(),vsym.Z());
+
+ aPrims->AddBound(5);
gp_Pnt pm1 = pm.Translated(vsym.Added(vsymper));
- cursor(1).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsym.Reversed().Multiplied(2).Added(vsymper.Reversed().Multiplied(2)));
- cursor(2).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsymper.Multiplied(2));
- cursor(3).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsym.Multiplied(2).Added(vsymper.Reversed().Multiplied(2)));
- cursor(4).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
+ aPrims->AddVertex(pm1);
pm1 = pm1.Translated(vsymper.Multiplied(2));
- cursor(5).SetCoord(pm1.X(),pm1.Y(),pm1.Z());
-
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(cursor);
-
- vsym.Multiply(4);
- V(1).SetCoord(pm.Translated(vsym).X(),
- pm.Translated(vsym).Y(),
- pm.Translated(vsym).Z());
- V(2).SetCoord(pm.Translated(vsym.Reversed()).X(),
- pm.Translated(vsym.Reversed()).Y(),
- pm.Translated(vsym.Reversed()).Z());
-
- Prs3d_Root::NewGroup(aPresentation);
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
- }
-}
-
-
-
-
-
-
+ aPrims->AddVertex(pm1);
+ vsym.Multiply(4);
+ aPrims->AddBound(2);
+ aPrims->AddVertex(pm.Translated(vsym));
+ aPrims->AddVertex(pm.Translated(vsym.Reversed()));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ }
+}
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <DsgPrs_TangentPresentation.ixx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
// Array1OfVertex
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Graphic3d_Array1OfVertex V(1,2);
- Quantity_Length X,Y,Z;
- p1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- p2.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(p1);
+ aPrims->AddVertex(p2);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
// fleche 1 :
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Arrow::Draw(aPresentation,p1,aDirection,
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,p1,aDirection,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
// fleche 2
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
- Prs3d_Arrow::Draw(aPresentation,p2,aDirection.Reversed(),
- LA->Arrow2Aspect()->Angle(),
- LA->Arrow2Aspect()->Length());
+ Prs3d_Arrow::Draw(aPresentation,p2,aDirection.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
}
-
-
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-#define OCC218 // SAV Enable to compute the triedhron color texts and arrows.
-
-
#include <DsgPrs_XYZAxisPresentation.ixx>
#include <Prs3d_Root.hxx>
#include <Prs3d_Arrow.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
//=======================================================================
const gp_Pnt& aPfirst,
const gp_Pnt& aPlast)
{
+ Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
+ G->SetPrimitivesAspect(aLineAspect->Aspect());
-
- Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
-
- Quantity_Length xo,yo,zo,x,y,z;
-
- aPfirst.Coord(xo,yo,zo);
- aPlast.Coord(x,y,z);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(aPfirst);
+ aPrims->AddVertex(aPlast);
+ G->AddPrimitiveArray(aPrims);
- Graphic3d_Array1OfVertex A(1,2);
- A(1).SetCoord(xo,yo,zo);
- A(2).SetCoord(x,y,z);
-
- G->SetPrimitivesAspect(aLineAspect->Aspect());
- G->Polyline(A);
- Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),aDir,M_PI/180.*10.,aVal/10.);
- Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,A(2),1./81.);
+ Prs3d_Arrow::Draw(aPresentation,aPlast,aDir,M_PI/180.*10.,aVal/10.);
+ Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z());
+ Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,a2,1./81.);
}
const gp_Pnt& aPfirst,
const gp_Pnt& aPlast)
{
-#ifdef OCC218
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
-
- Quantity_Length xo,yo,zo,x,y,z;
-
- aPfirst.Coord(xo,yo,zo);
- aPlast.Coord(x,y,z);
-
- Graphic3d_Array1OfVertex A(1,2);
- A(1).SetCoord(xo,yo,zo);
- A(2).SetCoord(x,y,z);
-
G->SetPrimitivesAspect(aLineAspect->Aspect());
- G->Polyline(A);
+
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(aPfirst);
+ aPrims->AddVertex(aPlast);
+ G->AddPrimitiveArray(aPrims);
+
G->SetPrimitivesAspect( anArrowAspect->Aspect() );
- Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),aDir,M_PI/180.*10.,aVal/10.);
+ Prs3d_Arrow::Draw(aPresentation,aPlast,aDir,M_PI/180.*10.,aVal/10.);
+
G->SetPrimitivesAspect(aTextAspect->Aspect());
- Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,A(2),1./81.);
-#endif
+ Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z());
+ Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,a2,1./81.);
}
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
#include <DsgPrs_XYZPlanePresentation.ixx>
#include <Prs3d_Root.hxx>
#include <Prs3d_PlaneAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
//=======================================================================
const gp_Pnt& aPt2,
const gp_Pnt& aPt3)
{
-
-
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->PlaneAspect()->EdgesAspect()->Aspect());
-
- Quantity_Length x1,y1,z1,x2,y2,z2,x3,y3,z3;
-
- aPt1.Coord(x1,y1,z1);
- aPt2.Coord(x2,y2,z2);
- aPt3.Coord(x3,y3,z3);
-
- Graphic3d_Array1OfVertex A(1,4);
- A(1).SetCoord(x1,y1,z1);
- A(2).SetCoord(x2,y2,z2);
- A(3).SetCoord(x3,y3,z3);
- A(4).SetCoord(x1,y1,z1);
-
- TheGroup->Polyline(A);
-
+ Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
+ TheGroup->SetPrimitivesAspect(aDrawer->PlaneAspect()->EdgesAspect()->Aspect());
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(4);
+ aPrims->AddVertex(aPt1);
+ aPrims->AddVertex(aPt2);
+ aPrims->AddVertex(aPt3);
+ aPrims->AddVertex(aPt1);
+ TheGroup->AddPrimitiveArray(aPrims);
}
Graphic3d_Group_1.cxx
Graphic3d_Group_2.cxx
Graphic3d_Group_3.cxx
-Graphic3d_Group_5.cxx
-Graphic3d_Group_7.cxx
Graphic3d_Group_8.cxx
Graphic3d_Group_10.cxx
Graphic3d_Structure.pxx
Graphic3d_Vec2.hxx
Graphic3d_Vec3.hxx
Graphic3d_Vec4.hxx
+Graphic3d_Vertex.hxx
+Graphic3d_Vertex.cxx
TCollection,
TColStd,
+ TColgp,
OSD,
Quantity,
Aspect,
---Purpose: 3d vector
---Category: Classes
- class Vertex;
+ imported Vertex;
---Purpose: 3d vertex
---Category: Classes
- class VertexN;
- ---Purpose: 3d vertex with a normal vector
- ---Category: Classes
-
- class VertexNT;
- ---Purpose: 3d vertex with a normal vector and texture coordinate
- ---Category: Classes
-
- class VertexC;
- ---Purpose: 3d vertex with a colour
- ---Category: Classes
-
- class VertexNC;
- ---Purpose: 3d vertex with a normal and a colour
- ---Category: Classes
-
---------------------
-- Category: Pointers
---------------------
Array2 from TCollection (Vertex from Graphic3d);
---Category: Instantiated classes
- class Array1OfVertexC instantiates
- Array1 from TCollection (VertexC from Graphic3d);
- ---Category: Instantiated classes
-
- class Array2OfVertexC instantiates
- Array2 from TCollection (VertexC from Graphic3d);
- ---Category: Instantiated classes
-
- class Array1OfVertexN instantiates
- Array1 from TCollection (VertexN from Graphic3d);
- ---Category: Instantiated classes
-
- class Array2OfVertexN instantiates
- Array2 from TCollection (VertexN from Graphic3d);
- ---Category: Instantiated classes
-
- class Array1OfVertexNT instantiates
- Array1 from TCollection (VertexNT from Graphic3d);
- ---Category: Instantiated classes
-
- class Array2OfVertexNT instantiates
- Array2 from TCollection (VertexNT from Graphic3d);
- ---Category: Instantiated classes
-
- class Array1OfVertexNC instantiates
- Array1 from TCollection (VertexNC from Graphic3d);
- ---Category: Instantiated classes
-
- class Array2OfVertexNC instantiates
- Array2 from TCollection (VertexNC from Graphic3d);
- ---Category: Instantiated classes
-
class ListOfShortReal instantiates
List from TCollection (ShortReal from Standard);
---Category: Instantiated classes
-- -------------------------------------------------------------------
AddVertex( me:mutable;
- aVertice: Pnt from gp)
+ aVertice: Pnt from gp)
returns Integer from Standard
---Level: Public
---Purpose: Adds a vertice in the array.
-- returns the actual vertex number.
raises OutOfRange from Standard;
-- if the actual vertex number is >= <maxVertexs>
+ ---C++: inline
+
+ AddVertex( me:mutable;
+ X,Y,Z: Real from Standard)
+ returns Integer from Standard
+ ---Level: Public
+ ---Purpose: Adds a vertice in the array.
+ -- returns the actual vertex number.
+ raises OutOfRange from Standard;
+ -- if the actual vertex number is >= <maxVertexs>
+ ---C++: inline
AddVertex( me:mutable;
- X,Y,Z: Real from Standard)
+ X,Y,Z: ShortReal from Standard)
returns Integer from Standard
---Level: Public
---Purpose: Adds a vertice in the array.
raises OutOfRange from Standard;
-- if the actual vertex number is >= <maxVertexs>
- AddVertex( me:mutable;
- aVertice: Pnt from gp;
- aColor: Color from Quantity)
+ AddVertex( me:mutable;
+ aVertice: Pnt from gp;
+ aColor: Color from Quantity)
returns Integer from Standard
---Level: Public
---Purpose: Adds a vertice and vertex color in the vertex array.
AddVertex( me : mutable;
aVertice : Pnt from gp;
aColor : Integer from Standard)
- returns Integer from Standard
+ returns Integer from Standard
---Level: Public
---Purpose: Adds a vertice and vertex color in the vertex array.
-- returns the actual vertex number.
raises OutOfRange from Standard;
-- if the actual vertex number is >= <maxVertexs>
-
AddVertex( me :mutable;
- aVertice : Pnt from gp;
- aNormal : Dir from gp)
- returns Integer from Standard
- ---Level: Public
+ aVertice : Pnt from gp;
+ aNormal : Dir from gp)
+ returns Integer from Standard
+ ---Level: Public
---Purpose: Adds a vertice and vertex normal in the vertex array.
-- returns the actual vertex number.
-- Warning: <aNormal> is ignored when the <hasVNormals>
-- constructor parameter is FALSE.
raises OutOfRange from Standard;
-- if the actual vertex number is >= <maxVertexs>
+ ---C++: inline
AddVertex( me:mutable;
- X,Y,Z: Real from Standard;
- NX,NY,NZ: Real from Standard)
- returns Integer from Standard
- ---Level: Public
+ X,Y,Z: Real from Standard;
+ NX,NY,NZ: Real from Standard)
+ returns Integer from Standard
+ ---Level: Public
---Purpose: Adds a vertice and vertex normal in the vertex array.
-- returns the actual vertex number.
-- Warning: <aNormal> is ignored when the <hasVNormals>
-- constructor parameter is FALSE.
raises OutOfRange from Standard;
-- if the actual vertex number is >= <maxVertexs>
+ ---C++: inline
AddVertex( me:mutable;
- aVertice: Pnt from gp;
- aNormal: Dir from gp;
- aColor: Color from Quantity)
- returns Integer from Standard
- ---Level: Public
+ X,Y,Z: ShortReal from Standard;
+ NX,NY,NZ: ShortReal from Standard)
+ returns Integer from Standard
+ ---Level: Public
+ ---Purpose: Adds a vertice and vertex normal in the vertex array.
+ -- returns the actual vertex number.
+ -- Warning: <aNormal> is ignored when the <hasVNormals>
+ -- constructor parameter is FALSE.
+ raises OutOfRange from Standard;
+ -- if the actual vertex number is >= <maxVertexs>
+
+ AddVertex( me:mutable;
+ aVertice: Pnt from gp;
+ aNormal: Dir from gp;
+ aColor: Color from Quantity)
+ returns Integer from Standard
+ ---Level: Public
---Purpose: Adds a vertice,vertex normal and color in the vertex array.
-- returns the actual vertex number.
-- Warning: <aNormal> is ignored when the <hasVNormals>
aVertice : Pnt from gp;
aNormal : Dir from gp;
aColor : Integer from Standard)
- returns Integer from Standard
+ returns Integer from Standard
---Level: Public
---Purpose: Adds a vertice,vertex normal and color in the vertex array.
-- returns the actual vertex number.
-- use this byte order.
raises OutOfRange from Standard;
-- if the actual vertex number is >= <maxVertexs>
-
AddVertex( me:mutable;
- aVertice: Pnt from gp;
- aTexel: Pnt2d from gp)
- returns Integer from Standard
- ---Level: Public
+ aVertice: Pnt from gp;
+ aTexel: Pnt2d from gp)
+ returns Integer from Standard
+ ---Level: Public
---Purpose: Adds a vertice and vertex texture in the vertex array.
-- returns the actual vertex number.
-- <aTexel> is ignored when the <hasVTexels>
-- constructor parameter is FALSE.
raises OutOfRange from Standard;
-- if the actual vertex number is >= <maxVertexs>
+ ---C++: inline
AddVertex( me:mutable;
- X,Y,Z: Real from Standard;
- TX,TY: Real from Standard)
- returns Integer from Standard
- ---Level: Public
+ X,Y,Z: Real from Standard;
+ TX,TY: Real from Standard)
+ returns Integer from Standard
+ ---Level: Public
---Purpose: Adds a vertice and vertex texture coordinates in the vertex array.
-- returns the actual vertex number.
-- <aTexel> is ignored when the <hasVTexels>
-- constructor parameter is FALSE.
raises OutOfRange from Standard;
-- if the actual vertex number is >= <maxVertexs>
+ ---C++: inline
AddVertex( me:mutable;
- aVertice: Pnt from gp;
- aNormal: Dir from gp;
- aTexel: Pnt2d from gp)
- returns Integer from Standard
- ---Level: Public
+ X,Y,Z: ShortReal from Standard;
+ TX,TY: ShortReal from Standard)
+ returns Integer from Standard
+ ---Level: Public
+ ---Purpose: Adds a vertice and vertex texture coordinates in the vertex array.
+ -- returns the actual vertex number.
+ -- <aTexel> is ignored when the <hasVTexels>
+ -- constructor parameter is FALSE.
+ raises OutOfRange from Standard;
+ -- if the actual vertex number is >= <maxVertexs>
+
+ AddVertex( me:mutable;
+ aVertice: Pnt from gp;
+ aNormal: Dir from gp;
+ aTexel: Pnt2d from gp)
+ returns Integer from Standard
+ ---Level: Public
---Purpose: Adds a vertice,vertex normal and texture in the vertex array.
-- returns the actual vertex number.
-- Warning: <aNormal> is ignored when the <hasVNormals>
-- constructor parameter is FALSE.
raises OutOfRange from Standard;
-- if the actual vertex number is >= <maxVertexs>
+ ---C++: inline
AddVertex( me:mutable;
- X,Y,Z: Real from Standard;
- NX,NY,NZ: Real from Standard;
- TX,TY: Real from Standard)
- returns Integer from Standard
- ---Level: Public
+ X,Y,Z: Real from Standard;
+ NX,NY,NZ: Real from Standard;
+ TX,TY: Real from Standard)
+ returns Integer from Standard
+ ---Level: Public
+ ---Purpose: Adds a vertice,vertex normal and texture in the vertex array.
+ -- returns the actual vertex number.
+ -- Warning: <aNormal> is ignored when the <hasVNormals>
+ -- constructor parameter is FALSE.
+ -- <aTexel> is ignored when the <hasVTexels>
+ -- constructor parameter is FALSE.
+ raises OutOfRange from Standard;
+ -- if the actual vertex number is >= <maxVertexs>
+ ---C++: inline
+
+ AddVertex( me:mutable;
+ X,Y,Z: ShortReal from Standard;
+ NX,NY,NZ: ShortReal from Standard;
+ TX,TY: ShortReal from Standard)
+ returns Integer from Standard
+ ---Level: Public
---Purpose: Adds a vertice,vertex normal and texture in the vertex array.
-- returns the actual vertex number.
-- Warning: <aNormal> is ignored when the <hasVNormals>
-- if the actual Bound number is >= <maxBounds>
AddBound( me:mutable;
- edgeNumber: Integer from Standard;
- aBColor: Color from Quantity)
+ edgeNumber: Integer from Standard;
+ aBColor: Color from Quantity)
returns Integer from Standard
---Level: Public
---Purpose: Adds a bound of length <edgeNumber> and bound color
-- or if the <aBoundIndex> parameter is < 1 or > ItemNumber()
SetVertice( me:mutable;
- anIndex: Integer from Standard;
- aVertice: Pnt from gp)
+ anIndex: Integer from Standard;
+ aVertice: Pnt from gp)
---Level: Public
---Purpose: Change the vertice of rank <anIndex> in the array.
raises OutOfRange from Standard;
-- if the index is <1 or > VertexNumber()
SetVertice( me:mutable;
- anIndex: Integer from Standard;
- X,Y,Z: Real from Standard)
+ anIndex: Integer from Standard;
+ X,Y,Z: ShortReal from Standard)
---Level: Public
---Purpose: Change the vertice of rank <anIndex> in the array.
raises OutOfRange from Standard;
-- Category Miscellaneous
-------------------------------------------------------------------
- Enable( myclass );
- ---Level: Public
- ---Purpose: Enable to use the arrays of primitives
- -- Warning: Updates the current value of the environment symbol
- -- CSF_USE_ARRAY_OF_PRIMITIVES
-
- Disable( myclass );
- ---Level: Public
- ---Purpose: Disable to use the arrays of primitives
- -- Warning: Updates the current value of the environment symbol
- -- CSF_USE_ARRAY_OF_PRIMITIVES
-
- IsEnable( myclass )
- returns Boolean from Standard;
- ---Level: Public
- ---Purpose: Returns TRUE when the arrays are enable to use.
- -- Warning: The initial value can be defined seting the symbol
- -- CSF_USE_ARRAY_OF_PRIMITIVES to "Yes" or "No"
-
IsValid( me:mutable )
returns Boolean from Standard;
---Level: Public
const Standard_Boolean hasVColors,
const Standard_Boolean hasFColors,
const Standard_Boolean hasVTexels,
- const Standard_Boolean hasEdgeInfos
-) : myMaxBounds(0),myMaxVertexs(0),myMaxEdges(0) {
- Standard_Integer size = sizeof(CALL_DEF_PARRAY);
+ const Standard_Boolean hasEdgeInfos )
+: myMaxBounds(0),myMaxVertexs(0),myMaxEdges(0)
+{
+ const Standard_Integer size = sizeof(CALL_DEF_PARRAY);
Standard_Integer format = MVERTICE;
if( hasVNormals ) format |= MVNORMAL;
if( hasVColors ) format |= MVCOLOR;
myPrimitiveArray->num_edges = 0;
}
-void Graphic3d_ArrayOfPrimitives::Destroy ( ){
+void Graphic3d_ArrayOfPrimitives::Destroy ()
+{
if( myPrimitiveArray ) {
if( myPrimitiveArray->vertices ){
Standard::Free( (Standard_Address&)myPrimitiveArray->vertices );
}
}
-void Graphic3d_ArrayOfPrimitives::Enable() {
- ///
-}
-
-void Graphic3d_ArrayOfPrimitives::Disable() {
- ///
-}
-
-Standard_Boolean Graphic3d_ArrayOfPrimitives::IsEnable() {
- return Standard_True;
-}
-
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const gp_Pnt& aVertice) {
- Standard_Real x,y,z;
- aVertice.Coord(x,y,z);
- return AddVertex(x,y,z);
-}
-
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const Standard_Real X, const Standard_Real Y, const Standard_Real Z) {
-
+Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z)
+{
if( !myPrimitiveArray ) return 0;
-
- Standard_Integer index = myPrimitiveArray->num_vertexs + 1;
- if( index > myMaxVertexs ) {
- Standard_OutOfRange::Raise(" TOO many VERTEX");
- }
+ const Standard_Integer index = myPrimitiveArray->num_vertexs + 1;
SetVertice(index,X,Y,Z);
return index;
}
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const gp_Pnt& aVertice,
- const Quantity_Color& aColor) {
- Standard_Real x,y,z;
- aVertice.Coord(x,y,z);
- Standard_Integer index = AddVertex(x,y,z);
+Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(const gp_Pnt& aVertice, const Quantity_Color& aColor)
+{
+ const Standard_Integer index = AddVertex(aVertice);
Standard_Real r,g,b;
aColor.Values(r,g,b,Quantity_TOC_RGB);
SetVertexColor(index,r,g,b);
return index;
}
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const gp_Pnt& aVertice,
- const Standard_Integer aColor) {
- Standard_Real x,y,z;
- aVertice.Coord(x,y,z);
- Standard_Integer index = AddVertex(x,y,z);
+
+Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(const gp_Pnt& aVertice, const Standard_Integer aColor)
+{
+ const Standard_Integer index = AddVertex(aVertice);
SetVertexColor(index,aColor);
return index;
}
-
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const gp_Pnt& aVertice,
- const gp_Dir& aNormal) {
- Standard_Real x,y,z;
- aVertice.Coord(x,y,z);
- Standard_Real nx,ny,nz;
- aNormal.Coord(nx,ny,nz);
- return AddVertex(x,y,z,nx,ny,nz);
-}
-
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
- const Standard_Real NX, const Standard_Real NY, const Standard_Real NZ) {
+Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z,
+ const Standard_ShortReal NX, const Standard_ShortReal NY, const Standard_ShortReal NZ)
+{
if( !myPrimitiveArray ) return 0;
-
- Standard_Integer index = myPrimitiveArray->num_vertexs + 1;
- if( index > myMaxVertexs ) {
- Standard_OutOfRange::Raise(" TOO many VERTEX");
- }
+ const Standard_Integer index = myPrimitiveArray->num_vertexs + 1;
SetVertice(index,X,Y,Z);
SetVertexNormal(index,NX,NY,NZ);
return index;
}
-
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const gp_Pnt& aVertice,
+Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(const gp_Pnt& aVertice,
const gp_Dir& aNormal,
- const Quantity_Color& aColor) {
- Standard_Real x,y,z;
- aVertice.Coord(x,y,z);
- Standard_Real nx,ny,nz;
- aNormal.Coord(nx,ny,nz);
- Standard_Integer index = AddVertex(x,y,z,nx,ny,nz);
+ const Quantity_Color& aColor)
+{
+ const Standard_Integer index = AddVertex(aVertice,aNormal);
Standard_Real r,g,b;
aColor.Values(r,g,b,Quantity_TOC_RGB);
SetVertexColor(index,r,g,b);
return index;
}
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const gp_Pnt& aVertice,
+Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(const gp_Pnt& aVertice,
const gp_Dir& aNormal,
- const Standard_Integer aColor) {
- Standard_Real x,y,z;
- aVertice.Coord(x,y,z);
- Standard_Real nx,ny,nz;
- aNormal.Coord(nx,ny,nz);
- Standard_Integer index = AddVertex(x,y,z,nx,ny,nz);
+ const Standard_Integer aColor)
+{
+ const Standard_Integer index = AddVertex(aVertice,aNormal);
SetVertexColor(index,aColor);
return index;
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const gp_Pnt& aVertice,
- const gp_Pnt2d& aTexel) {
- Standard_Real x,y,z;
- aVertice.Coord(x,y,z);
- Standard_Real tx,ty;
- aTexel.Coord(tx,ty);
- return AddVertex(x,y,z,tx,ty);
-}
-
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
- const Standard_Real TX, const Standard_Real TY) {
+ const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z,
+ const Standard_ShortReal TX, const Standard_ShortReal TY)
+{
if( !myPrimitiveArray ) return 0;
-
- Standard_Integer index = myPrimitiveArray->num_vertexs + 1;
- if( index > myMaxVertexs ) {
- Standard_OutOfRange::Raise(" TOO many VERTEX");
- }
+ const Standard_Integer index = myPrimitiveArray->num_vertexs + 1;
SetVertice(index,X,Y,Z);
SetVertexTexel(index,TX,TY);
return index;
}
Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const gp_Pnt& aVertice,
- const gp_Dir& aNormal,
- const gp_Pnt2d& aTexel) {
- Standard_Real x,y,z;
- aVertice.Coord(x,y,z);
- Standard_Real nx,ny,nz;
- aNormal.Coord(nx,ny,nz);
- Standard_Real tx,ty;
- aTexel.Coord(tx,ty);
- return AddVertex(x,y,z,nx,ny,nz,tx,ty);
-}
-
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
- const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
- const Standard_Real NX, const Standard_Real NY, const Standard_Real NZ,
- const Standard_Real TX, const Standard_Real TY) {
+ const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z,
+ const Standard_ShortReal NX, const Standard_ShortReal NY, const Standard_ShortReal NZ,
+ const Standard_ShortReal TX, const Standard_ShortReal TY)
+{
if( !myPrimitiveArray ) return 0;
-
- Standard_Integer index = myPrimitiveArray->num_vertexs + 1;
- if( index > myMaxVertexs ) {
- Standard_OutOfRange::Raise(" TOO many VERTEX");
- }
+ const Standard_Integer index = myPrimitiveArray->num_vertexs + 1;
SetVertice(index,X,Y,Z);
SetVertexNormal(index,NX,NY,NZ);
SetVertexTexel(index,TX,TY);
return index;
}
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound( const Standard_Integer edgeNumber) {
+Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound( const Standard_Integer edgeNumber)
+{
Standard_Integer index = 0;
if( myPrimitiveArray && myPrimitiveArray->bounds ) {
index = myPrimitiveArray->num_bounds;
return index;
}
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound(
- const Standard_Integer edgeNumber,
- const Quantity_Color& aFColor
-) {
+Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound( const Standard_Integer edgeNumber,
+ const Quantity_Color& aFColor)
+{
Standard_Real r,g,b;
aFColor.Values(r,g,b,Quantity_TOC_RGB);
return AddBound(edgeNumber,r,g,b);
}
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound(
- const Standard_Integer edgeNumber,
+Standard_Integer Graphic3d_ArrayOfPrimitives::AddBound( const Standard_Integer edgeNumber,
const Standard_Real R,
const Standard_Real G,
- const Standard_Real B) {
+ const Standard_Real B)
+{
if( !myPrimitiveArray ) return 0;
-
Standard_Integer index = myPrimitiveArray->num_bounds;
if( index >= myMaxBounds ) {
Standard_OutOfRange::Raise(" TOO many BOUND");
return index;
}
-Standard_Integer Graphic3d_ArrayOfPrimitives::AddEdge(
- const Standard_Integer vertexIndex,
- const Standard_Boolean isVisible) {
+Standard_Integer Graphic3d_ArrayOfPrimitives::AddEdge(const Standard_Integer vertexIndex,
+ const Standard_Boolean isVisible)
+{
if( !myPrimitiveArray ) return 0;
Standard_Integer index = myPrimitiveArray->num_edges;
return index;
}
-Standard_Boolean Graphic3d_ArrayOfPrimitives::Orientate(
- const gp_Dir& aNormal) {
+Standard_Boolean Graphic3d_ArrayOfPrimitives::Orientate(const gp_Dir& aNormal)
+{
return Orientate(1,Max(VertexNumber(),EdgeNumber()),aNormal);
}
-Standard_Boolean Graphic3d_ArrayOfPrimitives::Orientate(
- const Standard_Integer aVertexIndex,
+Standard_Boolean Graphic3d_ArrayOfPrimitives::Orientate(const Standard_Integer aVertexIndex,
const Standard_Integer aVertexNumber,
- const gp_Dir& aNormal) {
+ const gp_Dir& aNormal)
+{
Standard_Boolean somethingHasChange = Standard_False;
if( myPrimitiveArray && (myPrimitiveArray->num_vertexs > 2) ) {
Standard_Integer i,j,k=aVertexNumber,n=aVertexIndex-1;
return somethingHasChange;
}
-Standard_Boolean Graphic3d_ArrayOfPrimitives::Orientate(
- const Standard_Integer aBoundIndex,
- const gp_Dir& aNormal) {
+Standard_Boolean Graphic3d_ArrayOfPrimitives::Orientate(const Standard_Integer aBoundIndex,
+ const gp_Dir& aNormal)
+{
Standard_Boolean somethingHasChange = Standard_False;
if( myPrimitiveArray && myPrimitiveArray->vertices ) {
if( myPrimitiveArray->bounds &&
return somethingHasChange;
}
-void Graphic3d_ArrayOfPrimitives::SetVertice(
- const Standard_Integer anIndex,
- const gp_Pnt& aVertice) {
+void Graphic3d_ArrayOfPrimitives::SetVertice( const Standard_Integer anIndex,
+ const gp_Pnt& aVertice)
+{
Standard_Real x,y,z;
aVertice.Coord(x,y,z);
- SetVertice(anIndex,x,y,z);
+ SetVertice(anIndex,Standard_ShortReal(x),Standard_ShortReal(y),Standard_ShortReal(z));
}
-void Graphic3d_ArrayOfPrimitives::SetVertexColor(
- const Standard_Integer anIndex,
- const Quantity_Color& aColor) {
+void Graphic3d_ArrayOfPrimitives::SetVertexColor( const Standard_Integer anIndex,
+ const Quantity_Color& aColor)
+{
Standard_Real r,g,b;
aColor.Values(r,g,b,Quantity_TOC_RGB);
SetVertexColor(anIndex,r,g,b);
}
-void Graphic3d_ArrayOfPrimitives::SetVertexColor(
- const Standard_Integer anIndex,
- const Standard_Integer aColor) {
-
+void Graphic3d_ArrayOfPrimitives::SetVertexColor( const Standard_Integer anIndex,
+ const Standard_Integer aColor)
+{
if( !myPrimitiveArray ) return;
if( anIndex < 1 || anIndex > myMaxVertexs ) {
Standard_OutOfRange::Raise(" BAD VERTEX index");
}
}
-void Graphic3d_ArrayOfPrimitives::SetVertexNormal(
- const Standard_Integer anIndex,
- const gp_Dir& aNormal) {
+
+void Graphic3d_ArrayOfPrimitives::SetVertexNormal(const Standard_Integer anIndex,
+ const gp_Dir& aNormal)
+{
Standard_Real x,y,z;
aNormal.Coord(x,y,z);
SetVertexNormal(anIndex,x,y,z);
}
-void Graphic3d_ArrayOfPrimitives::SetVertexTexel(
- const Standard_Integer anIndex,
- const gp_Pnt2d& aTexel) {
+void Graphic3d_ArrayOfPrimitives::SetVertexTexel( const Standard_Integer anIndex,
+ const gp_Pnt2d& aTexel)
+{
Standard_Real x,y;
aTexel.Coord(x,y);
SetVertexTexel(anIndex,x,y);
}
-void Graphic3d_ArrayOfPrimitives::SetBoundColor(
- const Standard_Integer anIndex,
- const Quantity_Color& aColor) {
+void Graphic3d_ArrayOfPrimitives::SetBoundColor(const Standard_Integer anIndex,
+ const Quantity_Color& aColor)
+{
Standard_Real r,g,b;
aColor.Values(r,g,b,Quantity_TOC_RGB);
SetBoundColor(anIndex,r,g,b);
}
-Standard_CString Graphic3d_ArrayOfPrimitives::StringType() const {
+Standard_CString Graphic3d_ArrayOfPrimitives::StringType() const
+{
TCollection_AsciiString name("UndefinedArray");
switch( myPrimitiveArray->type ) {
case TelPointsArrayType:
return name.ToCString();
}
-gp_Pnt Graphic3d_ArrayOfPrimitives::Vertice(const Standard_Integer aRank) const {
+gp_Pnt Graphic3d_ArrayOfPrimitives::Vertice(const Standard_Integer aRank) const
+{
Standard_Real x,y,z;
Vertice(aRank,x,y,z);
return gp_Pnt(x,y,z);
}
-Quantity_Color Graphic3d_ArrayOfPrimitives::VertexColor(const Standard_Integer aRank) const {
+Quantity_Color Graphic3d_ArrayOfPrimitives::VertexColor(const Standard_Integer aRank) const
+{
Standard_Real r,g,b;
VertexColor(aRank,r,g,b);
return Quantity_Color(r,g,b,Quantity_TOC_RGB);
}
-gp_Dir Graphic3d_ArrayOfPrimitives::VertexNormal(const Standard_Integer aRank) const {
+gp_Dir Graphic3d_ArrayOfPrimitives::VertexNormal(const Standard_Integer aRank) const
+{
Standard_Real x,y,z;
VertexNormal(aRank,x,y,z);
return gp_Dir(x,y,z);
}
-gp_Pnt2d Graphic3d_ArrayOfPrimitives::VertexTexel(const Standard_Integer aRank) const {
+gp_Pnt2d Graphic3d_ArrayOfPrimitives::VertexTexel(const Standard_Integer aRank) const
+{
Standard_Real x,y;
VertexTexel(aRank,x,y);
return gp_Pnt2d(x,y);
}
-Quantity_Color Graphic3d_ArrayOfPrimitives::BoundColor(const Standard_Integer aRank) const {
+Quantity_Color Graphic3d_ArrayOfPrimitives::BoundColor(const Standard_Integer aRank) const
+{
Standard_Real r,g,b;
BoundColor(aRank,r,g,b);
return Quantity_Color(r,g,b,Quantity_TOC_RGB);
}
-Standard_Integer Graphic3d_ArrayOfPrimitives::ItemNumber() const {
+Standard_Integer Graphic3d_ArrayOfPrimitives::ItemNumber() const
+{
Standard_Integer number=-1;
if( myPrimitiveArray ) switch( myPrimitiveArray->type ) {
case TelPointsArrayType:
return number;
}
-void Graphic3d_ArrayOfPrimitives::ComputeVNormals(
- const Standard_Integer from,
- const Standard_Integer to) {
+void Graphic3d_ArrayOfPrimitives::ComputeVNormals(const Standard_Integer from,
+ const Standard_Integer to)
+{
Standard_Integer next = from+1;
Standard_Integer last = to+1;
gp_Pnt p1,p2,p3;
}
}
-Standard_Boolean Graphic3d_ArrayOfPrimitives::IsValid() {
-
+Standard_Boolean Graphic3d_ArrayOfPrimitives::IsValid()
+{
if( !myPrimitiveArray ) return Standard_False;
Standard_Integer nvertexs = myPrimitiveArray->num_vertexs;
#include <stdio.h>
#include <stdlib.h>
-inline Graphic3d_PrimitiveArray Graphic3d_ArrayOfPrimitives::Array() const {
+#include <gp_Dir.hxx>
+#include <gp_Pnt.hxx>
+inline Graphic3d_PrimitiveArray Graphic3d_ArrayOfPrimitives::Array() const
+{
return myPrimitiveArray;
}
-inline Graphic3d_TypeOfPrimitiveArray Graphic3d_ArrayOfPrimitives::Type() const {
-
+inline Graphic3d_TypeOfPrimitiveArray Graphic3d_ArrayOfPrimitives::Type() const
+{
Graphic3d_TypeOfPrimitiveArray type = Graphic3d_TOPA_UNDEFINED;
if( myPrimitiveArray ) type = (Graphic3d_TypeOfPrimitiveArray) myPrimitiveArray->type;
return type;
}
-inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasVertexNormals() const {
+inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasVertexNormals() const
+{
Standard_Boolean defined = Standard_False;
if( myPrimitiveArray && myPrimitiveArray->vnormals ) defined = Standard_True;
return defined;
}
-inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasVertexColors() const {
+inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasVertexColors() const
+{
Standard_Boolean defined = Standard_False;
if( myPrimitiveArray && myPrimitiveArray->vcolours ) defined = Standard_True;
return defined;
}
-inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasVertexTexels() const {
+inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasVertexTexels() const
+{
Standard_Boolean defined = Standard_False;
if( myPrimitiveArray && myPrimitiveArray->vtexels ) defined = Standard_True;
return defined;
}
-inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasEdgeInfos() const {
+inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasEdgeInfos() const
+{
Standard_Boolean defined = Standard_False;
if( myPrimitiveArray && myPrimitiveArray->edge_vis ) defined = Standard_True;
return defined;
}
-inline Standard_Integer Graphic3d_ArrayOfPrimitives::VertexNumber() const {
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::VertexNumber() const
+{
Standard_Integer number = -1;
if( myPrimitiveArray ) number = myPrimitiveArray->num_vertexs;
return number;
}
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(const gp_Pnt& aVertice)
+{
+ return AddVertex(aVertice.X(),aVertice.Y(),aVertice.Z());
+}
+
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
+ const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
+{
+ return AddVertex(Standard_ShortReal(X),Standard_ShortReal(Y),Standard_ShortReal(Z));
+}
+
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(const gp_Pnt& aVertice, const gp_Dir& aNormal)
+{
+ return AddVertex(aVertice.X(),aVertice.Y(),aVertice.Z(),aNormal.X(),aNormal.Y(),aNormal.Z());
+}
+
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
+ const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
+ const Standard_Real NX, const Standard_Real NY, const Standard_Real NZ)
+{
+ return AddVertex(Standard_ShortReal(X),Standard_ShortReal(Y),Standard_ShortReal(Z),
+ Standard_ShortReal(NX),Standard_ShortReal(NY),Standard_ShortReal(NZ));
+}
+
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(const gp_Pnt& aVertice, const gp_Pnt2d& aTexel)
+{
+ return AddVertex(aVertice.X(),aVertice.Y(),aVertice.Z(),aTexel.X(),aTexel.Y());
+}
+
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
+ const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
+ const Standard_Real TX, const Standard_Real TY)
+{
+ return AddVertex(Standard_ShortReal(X),Standard_ShortReal(Y),Standard_ShortReal(Z),
+ Standard_ShortReal(TX),Standard_ShortReal(TY));
+}
+
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(const gp_Pnt& aVertice, const gp_Dir& aNormal, const gp_Pnt2d& aTexel)
+{
+ return AddVertex(aVertice.X(),aVertice.Y(),aVertice.Z(),aNormal.X(),aNormal.Y(),aNormal.Z(),aTexel.X(),aTexel.Y());
+}
+
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex(
+ const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
+ const Standard_Real NX, const Standard_Real NY, const Standard_Real NZ,
+ const Standard_Real TX, const Standard_Real TY)
+{
+ return AddVertex(Standard_ShortReal(X),Standard_ShortReal(Y),Standard_ShortReal(Z),
+ Standard_ShortReal(NX),Standard_ShortReal(NY),Standard_ShortReal(NZ),
+ Standard_ShortReal(TX),Standard_ShortReal(TY));
+}
+
inline void Graphic3d_ArrayOfPrimitives::SetVertice(
const Standard_Integer anIndex,
- const Standard_Real X, const Standard_Real Y, const Standard_Real Z) {
-
+ const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z)
+{
if( !myPrimitiveArray ) return;
- if( anIndex < 1 || anIndex > myMaxVertexs ) {
+ if( anIndex < 1 || anIndex > myMaxVertexs )
Standard_OutOfRange::Raise(" BAD VERTEX index");
- }
- Standard_Integer index = anIndex-1;
- {
- if( myPrimitiveArray->vertices ) {
- Tfloat *p = myPrimitiveArray->vertices[index].xyz;
- *p++ = Standard_ShortReal(X);
- *p++ = Standard_ShortReal(Y);
- *p = Standard_ShortReal(Z);
- }
+ if( myPrimitiveArray->vertices ) {
+ Tfloat *p = myPrimitiveArray->vertices[anIndex-1].xyz;
+ *p++ = X;
+ *p++ = Y;
+ *p = Z;
}
myPrimitiveArray->num_vertexs = Max(anIndex,myPrimitiveArray->num_vertexs);
}
-
-inline void Graphic3d_ArrayOfPrimitives::SetVertexColor(
- const Standard_Integer anIndex,
+inline void Graphic3d_ArrayOfPrimitives::SetVertexColor(const Standard_Integer anIndex,
const Standard_Real R,
const Standard_Real G,
- const Standard_Real B) {
+ const Standard_Real B)
+{
if( !myPrimitiveArray ) return;
if( anIndex < 1 || anIndex > myMaxVertexs ) {
Standard_OutOfRange::Raise(" BAD VERTEX index");
}
if( myPrimitiveArray->vcolours ) {
- unsigned char red = (unsigned char)(R <= 0. ? 0. : R >= 1. ? 255. : R * 255.);
- unsigned char green = (unsigned char)(G <= 0. ? 0. : G >= 1. ? 255. : G * 255.);
- unsigned char blue = (unsigned char)(B <= 0. ? 0. : B >= 1. ? 255. : B * 255.);
+ unsigned char red = (unsigned int)(R * 255.);
+ unsigned char green = (unsigned int)(G * 255.);
+ unsigned char blue = (unsigned int)(B * 255.);
unsigned char alpha = 0;
Standard_Integer outColor ;
outColor = red;
inline void Graphic3d_ArrayOfPrimitives::SetVertexTexel(
const Standard_Integer anIndex,
- const Standard_Real TX, const Standard_Real TY) {
+ const Standard_Real TX, const Standard_Real TY)
+{
if( !myPrimitiveArray ) return;
if( anIndex < 1 || anIndex > myMaxVertexs ) {
Standard_OutOfRange::Raise(" BAD VERTEX index");
inline void Graphic3d_ArrayOfPrimitives::SetBoundColor(
const Standard_Integer anIndex,
- const Standard_Real R, const Standard_Real G, const Standard_Real B) {
+ const Standard_Real R, const Standard_Real G, const Standard_Real B)
+{
if( !myPrimitiveArray ) return;
if( anIndex < 1 || anIndex > myMaxBounds ) {
Standard_OutOfRange::Raise(" BAD BOUND index");
}
inline void Graphic3d_ArrayOfPrimitives::Vertice(const Standard_Integer anIndex,
- Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const {
+ Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const
+{
X = Y = Z = 0.;
if( !myPrimitiveArray ) return;
if( anIndex < 1 || anIndex > myPrimitiveArray->num_vertexs ) {
}
inline void Graphic3d_ArrayOfPrimitives::VertexColor(const Standard_Integer anIndex,
- Standard_Real& R, Standard_Real& G, Standard_Real& B) const {
+ Standard_Real& R, Standard_Real& G, Standard_Real& B) const
+{
R = G = B = 0;
if( !myPrimitiveArray ) return;
if( anIndex < 1 || anIndex > myPrimitiveArray->num_vertexs ) {
}
}
-
inline void Graphic3d_ArrayOfPrimitives::VertexNormal(const Standard_Integer anIndex,
- Standard_Real& NX, Standard_Real& NY, Standard_Real& NZ) const {
+ Standard_Real& NX, Standard_Real& NY, Standard_Real& NZ) const
+{
NX = NY = NZ = 0.;
if( !myPrimitiveArray ) return;
if( anIndex < 1 || anIndex > myPrimitiveArray->num_vertexs ) {
}
inline void Graphic3d_ArrayOfPrimitives::VertexTexel(const Standard_Integer anIndex,
- Standard_Real& TX, Standard_Real& TY) const {
+ Standard_Real& TX, Standard_Real& TY) const
+{
TX = TY = 0.;
if( !myPrimitiveArray ) return;
if( anIndex < 1 || anIndex > myPrimitiveArray->num_vertexs ) {
}
}
-inline Standard_Integer Graphic3d_ArrayOfPrimitives::EdgeNumber() const {
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::EdgeNumber() const
+{
Standard_Integer number = -1;
if( myPrimitiveArray ) number = myPrimitiveArray->num_edges;
return number;
}
-inline Standard_Integer Graphic3d_ArrayOfPrimitives::Edge(
- const Standard_Integer anIndex ) const {
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::Edge(const Standard_Integer anIndex ) const
+{
Standard_Integer index=0;
if( myPrimitiveArray && myPrimitiveArray->edge_vis &&
(anIndex > 0) && (anIndex <= myPrimitiveArray->num_edges) ) {
return index+1;
}
-inline Standard_Boolean Graphic3d_ArrayOfPrimitives::EdgeIsVisible(
- const Standard_Integer anIndex ) const {
+inline Standard_Boolean Graphic3d_ArrayOfPrimitives::EdgeIsVisible(const Standard_Integer anIndex ) const
+{
Standard_Boolean isVisible = Standard_False;
if( myPrimitiveArray && myPrimitiveArray->edge_vis &&
(anIndex > 0) && (anIndex <= myPrimitiveArray->num_edges) ) {
return isVisible;
}
-inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasBoundColors() const {
+inline Standard_Boolean Graphic3d_ArrayOfPrimitives::HasBoundColors() const
+{
Standard_Boolean defined = Standard_False;
if( myPrimitiveArray && myPrimitiveArray->fcolours ) defined = Standard_True;
return defined;
}
-inline Standard_Integer Graphic3d_ArrayOfPrimitives::BoundNumber() const {
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::BoundNumber() const
+{
Standard_Integer number = -1;
if( myPrimitiveArray ) number = myPrimitiveArray->num_bounds;
return number;
}
-inline Standard_Integer Graphic3d_ArrayOfPrimitives::Bound(const Standard_Integer anIndex) const {
+inline Standard_Integer Graphic3d_ArrayOfPrimitives::Bound(const Standard_Integer anIndex) const
+{
Standard_Integer number=-1;
if( myPrimitiveArray && myPrimitiveArray->bounds &&
(anIndex > 0) && (anIndex <= myPrimitiveArray->num_bounds) ) {
}
inline void Graphic3d_ArrayOfPrimitives::BoundColor(const Standard_Integer anIndex,
- Standard_Real& R, Standard_Real& G, Standard_Real& B) const {
+ Standard_Real& R, Standard_Real& G, Standard_Real& B) const
+{
if( myPrimitiveArray && myPrimitiveArray->fcolours &&
(anIndex > 0) && (anIndex <= myPrimitiveArray->num_bounds) ) {
Tfloat *p = myPrimitiveArray->fcolours[anIndex-1].rgb;
public:
- int LabelBegin;
- int LabelEnd;
void* ptrGroup;
- int StructureEnd;
-
CALL_DEF_CONTEXTLINE ContextLine;
CALL_DEF_CONTEXTFILLAREA ContextFillArea;
CALL_DEF_CONTEXTMARKER ContextMarker;
CALL_DEF_PICKID PickId;
- unsigned IsDeleted : 1;
- unsigned IsOpen : 1;
-
};
const Handle(Standard_Type)& TYPE(Graphic3d_CGroup);
int Priority;
int PreviousPriority;
- int GroupBegin;
- int GroupEnd;
CALL_DEF_CONTEXTLINE ContextLine;
CALL_DEF_CONTEXTFILLAREA ContextFillArea;
Structure from Graphic3d,
TextPath from Graphic3d,
TypeOfComposition from Graphic3d,
- TypeOfPolygon from Graphic3d,
TypeOfPrimitive from Graphic3d,
Vector from Graphic3d,
Array1OfVertex from Graphic3d,
Array2OfVertex from Graphic3d,
Vertex from Graphic3d,
- Array1OfVertexC from Graphic3d,
- Array2OfVertexC from Graphic3d,
- VertexC from Graphic3d,
- Array1OfVertexN from Graphic3d,
- Array2OfVertexN from Graphic3d,
- VertexN from Graphic3d,
- Array1OfVertexNC from Graphic3d,
- Array2OfVertexNC from Graphic3d,
- VertexNC from Graphic3d,
VerticalTextAlignment from Graphic3d,
- VertexNT from Graphic3d,
- Array1OfVertexNT from Graphic3d,
- Array2OfVertexNT from Graphic3d,
PrimitiveArray from Graphic3d,
PtrFrameBuffer from Graphic3d,
HArray1OfByte from TColStd,
is deferred;
---Purpose: call_togl_cleargroup
- CloseGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d )
- is deferred;
- ---Purpose: call_togl_closegroup
-
FaceContextGroup ( me : mutable;
ACGroup : CGroup from Graphic3d;
NoInsert : Integer from Standard )
is deferred;
---Purpose: call_togl_markercontextgroup
- OpenGroup ( me : mutable;
- ACGroup : CGroup from Graphic3d )
- is deferred;
- ---Purpose: call_togl_opengroup
-
RemoveGroup ( me : mutable;
ACGroup : CGroup from Graphic3d )
is deferred;
Marker ( me : mutable;
ACGroup : CGroup from Graphic3d;
- APoint : Vertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
+ APoint : Vertex from Graphic3d )
is deferred;
MarkerSet ( me : mutable;
ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
+ ListVertex : Array1OfVertex from Graphic3d )
is deferred;
- ----------------------------------------
- -- Category: Methods to create Polygon
- -- for Purpose : see Graphic3d_Group.cdl
- ----------------------------------------
-
- Polygon ( me : mutable;
- ACGroup : CGroup from Graphic3d;
- ListVertex : Array1OfVertex from Graphic3d;
- AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX;
- EvalMinMax : Boolean from Standard = Standard_True )
- is deferred;
- ---Purpose: call_togl_polygon
-
----------------------------------------
-- Category: Methods to create Text
-- for Purpose : see Graphic3d_Group.cdl
-- In contrast to Bitmaps, Vector graphics is scalable (so you may got quality benefits on printing to laser printer).
-- Notice however that results may differ a lot and do not contain some elements.
- RemovePrimitiveArray( me : mutable;
- theCGroup : CGroup from Graphic3d;
- thePArray : PrimitiveArray from Graphic3d )
- is deferred;
- ---Purpose: Clear visualization data in graphical driver and
- -- stop displaying the primitives array of the graphical group
- -- <theCGroup>. This method is internal and should be used
- -- by Graphic3d_Group only.
-
AddZLayer( me : mutable;
theCView : CView from Graphic3d;
theLayerId : Integer from Standard )
if (AField) {
cout << "\tstruct id " << ACGroup.Struct->Id << "\n";
- cout << "\tgroup labels " << ACGroup.LabelBegin << ", "
- << ACGroup.LabelEnd << "\n";
+ cout << "\tgroup\n";
cout << flush;
}
GraphicDriver from Graphic3d,
Structure from Graphic3d,
TextPath from Graphic3d,
- TypeOfPolygon from Graphic3d,
Vector from Graphic3d,
Array1OfVertex from Graphic3d,
Array2OfVertex from Graphic3d,
Vertex from Graphic3d,
- Array1OfVertexC from Graphic3d,
- Array2OfVertexC from Graphic3d,
- VertexC from Graphic3d,
- Array1OfVertexN from Graphic3d,
- Array2OfVertexN from Graphic3d,
- VertexN from Graphic3d,
- Array1OfVertexNC from Graphic3d,
- Array2OfVertexNC from Graphic3d,
- VertexNC from Graphic3d,
VerticalTextAlignment from Graphic3d,
- VertexNT from Graphic3d,
- Array1OfVertexNT from Graphic3d,
- Array2OfVertexNT from Graphic3d,
ArrayOfPrimitives from Graphic3d,
ListOfPArray from Graphic3d,
- ListIteratorOfListOfPArray from Graphic3d,
TransModeFlags from Graphic3d,
CBounds from Graphic3d
-- vertices.
---Category: Methods to create Marker
- --------------------------------------
- -- Category: Methods to create Polygon
- --------------------------------------
-
- --------------------------------------------------
- -- Summary of Polygons --
- -- --
- -- They are limited to one boundary. --
- -- --
- -- The boundary should be closed. --
- -- --
- -- They should have at least three vertices. --
- -- --
- -- They should be planar. --
- -- --
- -- They should have a normal. --
- -- --
- -- The boundary is drawn only when the interior --
- -- style is hollow. --
- -- --
- -- The boundary have the following attributes : --
- -- --
- -- Line Type. --
- -- Line Width Scale Factor. --
- -- Line Color. --
- -- --
- -- They have only interior attributes : --
- -- --
- -- Interior Style. --
- -- Interior Color. --
- -- Front Material. --
- -- Back Material. --
- --------------------------------------------------
-
- Polygon ( me : mutable;
- ListVertex : Array1OfVertex from Graphic3d;
- AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX;
- EvalMinMax : Boolean from Standard = Standard_True )
- is static;
- ---Level: Public
- ---Purpose: Links up points to create a face drawn
- -- using the current fill attributes (AspectFillArea3d))
- -- The first and last points are not duplicates.
- ---Category: Methods to create Polygon
-
- PolygonSet ( me : mutable;
- Bounds : Array1OfInteger from TColStd;
- ListVertex : Array1OfVertex from Graphic3d;
- AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX;
- EvalMinMax : Boolean from Standard = Standard_True )
- is static;
- ---Level: Public
- ---Purpose: Links up points to create a set of face drawn
- -- using the current fill attributes (AspectFillArea3d))
- -- The first and last points are not duplicates.
- ---Category: Methods to create Polygon
-
- ---------------------------------------
- -- Category: Methods to create Polyline
- ---------------------------------------
-
- --------------------------------------------
- -- Summary of Polylines --
- -- --
- -- They should have two or more vertices. --
- -- --
- -- They have the following attributes. --
- -- --
- -- Line Type. --
- -- Line Width Scale Factor. --
- -- Line Color. --
- --------------------------------------------
-
- Polyline ( me : mutable;
- APT1 : Vertex from Graphic3d;
- APT2 : Vertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is static;
- ---Level: Public
- ---Purpose: Links up points to create a line drawn
- -- using the current line attributes (AspectLine)
- ---Category: Methods to create Polyline
-
- Polyline ( me : mutable;
- ListVertex : Array1OfVertex from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is static;
- ---Level: Public
- ---Purpose: Links up points to create a line drawn
- -- using the current line attributes (AspectLine)
- ---Category: Methods to create Polyline
-
- Polyline ( me : mutable;
- ListVertex : Array1OfVertexC from Graphic3d;
- EvalMinMax : Boolean from Standard = Standard_True )
- is static;
- ---Level: Public
- ---Purpose: Links up points to create a line drawn
- -- using the current line attributes (AspectLine)
- -- except for the colour which is defined
- -- for each vertex.
- ---Category: Methods to create Polyline
-
-----------------------------------
-- Category: Methods to create Text
-----------------------------------
---Level: Public
---Purpose: Adds an array of primitives for display
- RemovePrimitiveArray( me : mutable;
- aRank : Integer from Standard)
- ---Level: Public
- ---Purpose: Remove the array of primitives of rank <aRank>
- raises OutOfRange from Standard is static;
- -- if <aRank> is < 1 or > ArrayNumber()
-
- RemovePrimitiveArrays( me : mutable);
- ---Level: Public
- ---Purpose: Remove all array of primitives
-
UserDraw ( me : mutable;
AnObject : Address from Standard;
EvalMinMax : Boolean from Standard = Standard_True;
-- Category: Inquire methods
----------------------------
- ArrayNumber( me )
- returns Integer from Standard;
- ---Level: Public
- ---Purpose: Returns the number of primitive array added in this group
-
- InitDefinedArray( me:mutable );
- ---Level: Public
- ---Purpose: Initialize the array list iterator.
-
- NextDefinedArray( me:mutable );
- ---Level: Public
- ---Purpose: Increments the array list iterator.
-
- MoreDefinedArray( me:mutable )
- returns Boolean from Standard;
- ---Level: Public
- ---Purpose: Returns TRUE if more array exists in the list.
-
- DefinedArray( me )
- returns mutable ArrayOfPrimitives from Graphic3d;
- ---Level: Public
- ---Purpose: Returns the current array of primitives according
- -- to the array list iterator value.
-
IsGroupPrimitivesAspectSet ( me;
theAspect : GroupAspect from Graphic3d )
returns Boolean from Standard
-- Category: Private methods
----------------------------
- Labels ( me;
- LB, LE : in out Integer from Standard )
- is static private;
- ---Level: Internal
- ---Purpose: Returns the position of the group in the structure.
- ---Category: Private methods
-
MinMaxCoord ( me;
XMin, YMin, ZMin : out Real from Standard;
XMax, YMax, ZMax : out Real from Standard )
-- contains the associated Structure of the Group <me>.
---Category: Private methods
- -----------------------------
- -- Category: Internal methods
- -----------------------------
-
- BeginPrimitives ( me : mutable )
- is static;
- ---Level: Internal
- ---Category: Internal methods
-
- EndPrimitives ( me : mutable )
- is static;
- ---Level: Internal
- ---Category: Internal methods
-
- --
-
fields
--
MyBounds : CBounds from Graphic3d;
MyListOfPArray : ListOfPArray from Graphic3d;
- MyListOfPArrayIterator : ListIteratorOfListOfPArray from Graphic3d;
MyMarkArray : HArray1OfByte from TColStd;
MyMarkWidth : Integer from Standard;
// This () is the instance of the class, the current groupe
//Handle(Graphic3d_Group) me = Handle(Graphic3d_Group)::DownCast (This ());
-Standard_Integer TheLabelBegin, TheLabelEnd;
+ MyPtrStructure = (void *) AStructure.operator->();
+ MyStructure->Add (this);
- // MyStructure = AStructure;
- MyPtrStructure = (void *) AStructure.operator->();
- MyStructure->GroupLabels (TheLabelBegin, TheLabelEnd);
- MyStructure->Add (this);
+ MyContainsFacet = Standard_False,
+ MyIsEmpty = Standard_True;
- MyContainsFacet = Standard_False,
- MyIsEmpty = Standard_True;
+ MyCGroup.Struct = MyStructure->CStructure();
+ MyCGroup.Struct->Id = int (MyStructure->Identification ());
+ MyCGroup.ptrGroup = NULL;
- MyCGroup.Struct = MyStructure->CStructure();
- MyCGroup.Struct->Id = int (MyStructure->Identification ());
- MyCGroup.IsDeleted = 0;
- MyCGroup.IsOpen = 0;
- MyCGroup.LabelBegin = int (TheLabelBegin);
- MyCGroup.LabelEnd = int (TheLabelEnd);
+ MyCGroup.ContextLine.IsDef = 0,
+ MyCGroup.ContextText.IsDef = 0,
+ MyCGroup.ContextMarker.IsDef = 0,
+ MyCGroup.ContextFillArea.IsDef = 0;
- MyCGroup.StructureEnd = Structure_END;
+ MyCGroup.ContextLine.IsSet = 0,
+ MyCGroup.ContextText.IsSet = 0,
+ MyCGroup.ContextMarker.IsSet = 0,
+ MyCGroup.ContextFillArea.IsSet = 0;
- MyCGroup.ContextLine.IsDef = 0,
- MyCGroup.ContextText.IsDef = 0,
- MyCGroup.ContextMarker.IsDef = 0,
- MyCGroup.ContextFillArea.IsDef = 0;
+ MyCGroup.PickId.IsDef = 0,
+ MyCGroup.PickId.IsSet = 0,
+ MyCGroup.PickId.Value = 0;
- MyCGroup.ContextLine.IsSet = 0,
- MyCGroup.ContextText.IsSet = 0,
- MyCGroup.ContextMarker.IsSet = 0,
- MyCGroup.ContextFillArea.IsSet = 0;
+ Handle(Aspect_GraphicDriver) agd =
+ ((MyStructure->StructureManager ())->GraphicDevice ())->GraphicDriver ();
- MyCGroup.PickId.IsDef = 0,
- MyCGroup.PickId.IsSet = 0,
- MyCGroup.PickId.Value = 0;
+ MyGraphicDriver = *(Handle(Graphic3d_GraphicDriver) *) &agd;
-Handle(Aspect_GraphicDriver) agd =
-((MyStructure->StructureManager ())->GraphicDevice ())->GraphicDriver ();
+ MyGraphicDriver->Group (MyCGroup);
- MyGraphicDriver = *(Handle(Graphic3d_GraphicDriver) *) &agd;
-
- MyGraphicDriver->Group (MyCGroup);
-
- //MyCGroup.TransformPersistenceFlag = Graphic3d_TMF_None;
- //MyCGroup.Struct->TransformPersistenceFlag = Graphic3d_TMF_None;
- MyMarkWidth = 0;
- MyMarkHeight = 0;
- MyMarkArray.Nullify();
+ MyMarkWidth = 0;
+ MyMarkHeight = 0;
+ MyMarkArray.Nullify();
}
// and conditions governing the rights and limitations under the License.
-#define XDESTROY
-
-
-
//-Version
//-Design Declaration des variables specifiques aux groupes
Update ();
}
-void Graphic3d_Group::Destroy () {
-
-#ifdef DESTROY
- cout << "Graphic3d_Group::Destroy ()\n";
-#endif
-
+void Graphic3d_Group::Destroy ()
+{
// tell graphics driver to clear internal resources of the group
if (!IsEmpty () && !MyGraphicDriver.IsNull ())
MyGraphicDriver->ClearGroup (MyCGroup);
}
-void Graphic3d_Group::Remove () {
-
+void Graphic3d_Group::Remove ()
+{
if (IsDeleted ()) return;
- MyCGroup.IsDeleted = 1;
MyGraphicDriver->RemoveGroup (MyCGroup);
MyStructure->Remove (this);
+ MyCGroup.ptrGroup = NULL;
+
Update ();
MyBounds.XMin = ShortRealLast (),
if (MyContainsFacet) MyStructure->GroupsWithFacet (-1);
MyContainsFacet = Standard_False,
MyIsEmpty = Standard_True;
-
}
-
-void Graphic3d_Group::BeginPrimitives () {
-
- if (IsDeleted ()) return;
- if (MyCGroup.IsOpen) return;
-
- MyCGroup.IsOpen = 1;
-
- MyGraphicDriver->OpenGroup (MyCGroup);
-
-}
-
-void Graphic3d_Group::EndPrimitives () {
-
- if (IsDeleted ()) return;
- if (! MyCGroup.IsOpen) return;
-
- MyCGroup.IsOpen = 0;
-
- MyGraphicDriver->CloseGroup (MyCGroup);
-
-}
-
-/*void Graphic3d_Group::SetTransformPersistence( const Graphic3d_TransModeFlags& AFlag )
-{
- //MyCGroup.TransformPersistenceFlag = AFlag;
-}
-
-Graphic3d_TransModeFlags Graphic3d_Group::TransformPersistence() const
-{
- //return MyCGroup.TransformPersistenceFlag;
-}*/
// Min-Max Update
if (EvalMinMax) {
- Standard_Real X, Y, Z;
+ Standard_ShortReal X, Y, Z;
APoint.Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
+ if (X < MyBounds.XMin) MyBounds.XMin = X;
+ if (Y < MyBounds.YMin) MyBounds.YMin = Y;
+ if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
+ if (X > MyBounds.XMax) MyBounds.XMax = X;
+ if (Y > MyBounds.YMax) MyBounds.YMax = Y;
+ if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
}
MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
// Min-Max Update
if (EvalMinMax) {
- Standard_Real X, Y, Z;
+ Standard_ShortReal X, Y, Z;
APoint.Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
+ if (X < MyBounds.XMin) MyBounds.XMin = X;
+ if (Y < MyBounds.YMin) MyBounds.YMin = Y;
+ if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
+ if (X > MyBounds.XMax) MyBounds.XMax = X;
+ if (Y > MyBounds.YMax) MyBounds.YMax = Y;
+ if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
}
MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
// Min-Max Update
if (EvalMinMax) {
- Standard_Real X, Y, Z;
+ Standard_ShortReal X, Y, Z;
APoint.Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
+ if (X < MyBounds.XMin) MyBounds.XMin = X;
+ if (Y < MyBounds.YMin) MyBounds.YMin = Y;
+ if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
+ if (X > MyBounds.XMax) MyBounds.XMax = X;
+ if (Y > MyBounds.YMax) MyBounds.YMax = Y;
+ if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
}
MyGraphicDriver->Text(MyCGroup, AText, APoint, AHeight, AAngle, ATp, AHta, AVta, EvalMinMax);
// Min-Max Update
if (EvalMinMax) {
- Standard_Real X, Y, Z;
+ Standard_ShortReal X, Y, Z;
APoint.Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
+ if (X < MyBounds.XMin) MyBounds.XMin = X;
+ if (Y < MyBounds.YMin) MyBounds.YMin = Y;
+ if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
+ if (X > MyBounds.XMax) MyBounds.XMax = X;
+ if (Y > MyBounds.YMax) MyBounds.YMax = Y;
+ if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
}
MyGraphicDriver->Text (MyCGroup, AText, APoint, AHeight, EvalMinMax);
Update ();
}
-void Graphic3d_Group :: RemovePrimitiveArrays () {
- // clear primitives array's visualization data in graphics driver and remove
- // references to it in driver
- if (!IsEmpty() && !MyGraphicDriver.IsNull())
- {
- for (Graphic3d_ListIteratorOfListOfPArray it (MyListOfPArray);
- it.More(); it.Next())
- MyGraphicDriver->RemovePrimitiveArray (MyCGroup, it.Value()->Array());
- }
-
- // remove references to primitives arrays
- MyListOfPArray.Clear();
-}
-
-Standard_Integer Graphic3d_Group :: ArrayNumber () const {
-
- return MyListOfPArray.Extent();
-}
-
-void Graphic3d_Group :: InitDefinedArray() {
- MyListOfPArrayIterator.Initialize(MyListOfPArray);
-}
-
-void Graphic3d_Group :: NextDefinedArray() {
- MyListOfPArrayIterator.Next();
-}
-
-Standard_Boolean Graphic3d_Group :: MoreDefinedArray() {
- return MyListOfPArrayIterator.More();
-}
-
-Handle(Graphic3d_ArrayOfPrimitives) Graphic3d_Group :: DefinedArray() const {
-
- return MyListOfPArrayIterator.Value();
-}
-
-void Graphic3d_Group :: RemovePrimitiveArray ( const Standard_Integer aRank ) {
-
- if( aRank < 1 || aRank > ArrayNumber() ) {
- Standard_OutOfRange::Raise(" BAD ARRAY index");
- }
- Graphic3d_ListIteratorOfListOfPArray it(MyListOfPArray);
- for( Standard_Integer i=1 ; it.More() ; it.Next(),i++ ) {
- if( aRank == i ) break;
- }
-
- // clear primitives array's visualization data in graphics driver and remove
- // references to it in driver
- if (!IsEmpty() && !MyGraphicDriver.IsNull())
- MyGraphicDriver->RemovePrimitiveArray (MyCGroup, it.Value()->Array());
-
- // remove references to primitives array
- MyListOfPArray.Remove (it);
-}
-
void Graphic3d_Group :: UserDraw ( const Standard_Address AnObject,
const Standard_Boolean EvalMinMax,
const Standard_Boolean ContainsFacet )
Standard_Boolean Graphic3d_Group::IsDeleted () const {
- if ( (MyCGroup.IsDeleted) || (MyStructure->IsDeleted ()) )
- return (Standard_True);
- else
- return (Standard_False);
+ return ( (MyCGroup.ptrGroup == NULL) || (MyStructure->IsDeleted ()) );
}
}
-void Graphic3d_Group::Labels (Standard_Integer& LB, Standard_Integer& LE) const {
-
- LB = Standard_Integer (MyCGroup.LabelBegin);
- LE = Standard_Integer (MyCGroup.LabelEnd);
-
-}
-
void Graphic3d_Group::Update () const {
if (IsDeleted ()) return;
//-Methods, in order
-void Graphic3d_Group::Marker (const Graphic3d_Vertex& APoint, const Standard_Boolean EvalMinMax) {
-
+void Graphic3d_Group::Marker (const Graphic3d_Vertex &APoint, const Standard_Boolean EvalMinMax)
+{
if (IsDeleted ()) return;
MyIsEmpty = Standard_False;
// Min-Max Update
if (EvalMinMax) {
-Standard_Real X, Y, Z;
+ Standard_ShortReal X, Y, Z;
APoint.Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
+ if (X < MyBounds.XMin) MyBounds.XMin = X;
+ if (Y < MyBounds.YMin) MyBounds.YMin = Y;
+ if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
+ if (X > MyBounds.XMax) MyBounds.XMax = X;
+ if (Y > MyBounds.YMax) MyBounds.YMax = Y;
+ if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
}
- MyGraphicDriver->Marker (MyCGroup, APoint, EvalMinMax);
+ MyGraphicDriver->Marker (MyCGroup, APoint);
Update ();
-
}
-void Graphic3d_Group::MarkerSet (const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax) {
-
+void Graphic3d_Group::MarkerSet (const Graphic3d_Array1OfVertex &ListVertex, const Standard_Boolean EvalMinMax)
+{
if (IsDeleted ()) return;
MyIsEmpty = Standard_False;
-Standard_Integer i, j;
-
- i = ListVertex.Length ();
-
// Min-Max Update
if (EvalMinMax) {
-Standard_Real X, Y, Z;
-Standard_Integer Lower = ListVertex.Lower ();
-Standard_Integer Upper = ListVertex.Upper ();
+ Standard_ShortReal X, Y, Z;
+ Standard_Integer i = ListVertex.Lower ();
+ const Standard_Integer Upper = ListVertex.Upper ();
// Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
+ for (; i<=Upper; i++) {
ListVertex (i).Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
+ if (X < MyBounds.XMin) MyBounds.XMin = X;
+ if (Y < MyBounds.YMin) MyBounds.YMin = Y;
+ if (Z < MyBounds.ZMin) MyBounds.ZMin = Z;
+ if (X > MyBounds.XMax) MyBounds.XMax = X;
+ if (Y > MyBounds.YMax) MyBounds.YMax = Y;
+ if (Z > MyBounds.ZMax) MyBounds.ZMax = Z;
}
}
- MyGraphicDriver->MarkerSet (MyCGroup, ListVertex, EvalMinMax);
+ MyGraphicDriver->MarkerSet (MyCGroup, ListVertex);
Update ();
-
}
+++ /dev/null
-// Created by: NW,JPB,CAL
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-// Modified
-// 27/08/97 ; PCT : ajout coordonnee texture
-
-
-//-Version
-
-//-Design Declaration des variables specifiques aux groupes
-// de primitives
-
-//-Warning Un groupe est defini dans une structure
-// Il s'agit de la plus petite entite editable
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_Group.jxx>
-#include <Graphic3d_Group.pxx>
-
-#include <Graphic3d_VertexN.hxx>
-#include <Graphic3d_VertexNT.hxx>
-
-//-Methods, in order
-
-void Graphic3d_Group::Polygon (const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_TypeOfPolygon AType, const Standard_Boolean EvalMinMax) {
-
- if (IsDeleted ()) return;
-
- if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
- MyContainsFacet = Standard_True;
- MyIsEmpty = Standard_False;
-
- // Min-Max Update
- if (EvalMinMax) {
-
- Standard_Real X, Y, Z;
- Standard_Integer i, j;
- Standard_Integer Lower = ListVertex.Lower ();
- Standard_Integer Upper = ListVertex.Upper ();
- // Parcours des sommets
- for (j=0, i=Lower; i<=Upper; i++, j++) {
- ListVertex (i).Coord (X, Y, Z);
- if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X);
- if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y);
- if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z);
- if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X);
- if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y);
- if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z);
- }
- }
-
- MyGraphicDriver->Polygon (MyCGroup, ListVertex, AType, EvalMinMax);
-
- Update ();
-
-}
-
-void Graphic3d_Group::PolygonSet (const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_TypeOfPolygon AType, const Standard_Boolean EvalMinMax) {
-
- if (IsDeleted ()) return;
-
- if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1);
- MyContainsFacet = Standard_True;
- MyIsEmpty = Standard_False;
-
-Standard_Real X, Y, Z;
-
-Standard_Integer i, ii;
-Standard_Integer j;
-Standard_Integer begin_points;
-Standard_Integer end_points;
-Standard_Integer nbpoints;
-Standard_Integer Lower, Upper;
-
- begin_points = ListVertex.Lower ();
- end_points = ListVertex.Upper ();
-
- Lower = Bounds.Lower ();
- Upper = Bounds.Upper ();
-
- // Parcours des facettes
- for (j=Lower; j<=Upper; j++) {
- nbpoints = Bounds.Value (j);
-
- Graphic3d_Array1OfVertex ListOfVertex (0, nbpoints-1);
-
- // Parcours des sommets
- for (i=0, ii=begin_points;
- ((ii<=end_points) && (i<=nbpoints-1)); i++, ii++) {
- ListVertex (ii).Coord (X, Y, Z);
- ListOfVertex (i).SetCoord (X, Y, Z);
- }
-
- Polygon (ListOfVertex, AType, EvalMinMax);
- begin_points += nbpoints;
- }
-
-}
+++ /dev/null
-// Created by: NW,JPB,CAL
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-// 11/97 ; CAL : ajout polyline par 2 points
-
-
-//-Version
-
-//-Design Declaration des variables specifiques aux groupes
-// de primitives
-
-//-Warning Un groupe est defini dans une structure
-// Il s'agit de la plus petite entite editable
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_Group.jxx>
-#include <Graphic3d_Group.pxx>
-
-#include <Graphic3d_ArrayOfPolylines.hxx>
-#include <Graphic3d_VertexC.hxx>
-#include <gp_Pnt.hxx>
-
-void Graphic3d_Group::Polyline (const Graphic3d_Array1OfVertex& theListVertex,
- const Standard_Boolean theToEvalMinMax)
-{
- if (IsDeleted())
- {
- return;
- }
-
- Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines (theListVertex.Length());
-
- Standard_Real aX, aY, aZ;
- Standard_Integer aVertLower = theListVertex.Lower();
- Standard_Integer aVertUpper = theListVertex.Upper();
- for (Standard_Integer aVertIter = aVertLower; aVertIter <= aVertUpper; ++aVertIter)
- {
- const Graphic3d_Vertex& aVert = theListVertex (aVertIter);
- aVert.Coord (aX, aY, aZ);
- aPrims->AddVertex (aX, aY, aZ);
- }
-
- AddPrimitiveArray (aPrims, theToEvalMinMax);
-}
-
-void Graphic3d_Group::Polyline (const Graphic3d_Array1OfVertexC& theListVertex,
- const Standard_Boolean theToEvalMinMax)
-{
- if (IsDeleted())
- {
- return;
- }
-
- Handle(Graphic3d_ArrayOfPrimitives) aPrims
- = new Graphic3d_ArrayOfPolylines (theListVertex.Length(), 0, 0, Standard_True); // color per vertex
-
- Standard_Real aX, aY, aZ;
- Standard_Integer aVertLower = theListVertex.Lower();
- Standard_Integer aVertUpper = theListVertex.Upper();
- for (Standard_Integer aVertIter = aVertLower; aVertIter <= aVertUpper; ++aVertIter)
- {
- const Graphic3d_VertexC& aVert = theListVertex (aVertIter);
- aVert.Coord (aX, aY, aZ);
- aPrims->AddVertex (gp_Pnt (aX, aY, aZ), aVert.Color());
- }
-
- AddPrimitiveArray (aPrims, theToEvalMinMax);
-}
-
-void Graphic3d_Group::Polyline (const Graphic3d_Vertex& thePnt1,
- const Graphic3d_Vertex& thePnt2,
- const Standard_Boolean theToEvalMinMax)
-{
- if (IsDeleted())
- {
- return;
- }
-
- Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines (2);
-
- Standard_Real aX, aY, aZ;
- thePnt1.Coord (aX, aY, aZ);
- aPrims->AddVertex (aX, aY, aZ);
-
- thePnt2.Coord (aX, aY, aZ);
- aPrims->AddVertex (aX, aY, aZ);
-
- AddPrimitiveArray (aPrims, theToEvalMinMax);
-}
Standard_ShortReal aPolyFactor, aPolyUnits;
CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
MyCGroup.ContextFillArea.PolygonOffsetMode = aPolyMode;
- MyCGroup.ContextFillArea.PolygonOffsetFactor = aPolyFactor;
- MyCGroup.ContextFillArea.PolygonOffsetUnits = aPolyUnits;
+ MyCGroup.ContextFillArea.PolygonOffsetFactor = (Standard_ShortReal)aPolyFactor;
+ MyCGroup.ContextFillArea.PolygonOffsetUnits = (Standard_ShortReal)aPolyUnits;
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
int noinsert = 0;
CTXF->SetFrontMaterial (Front);
}
-void Graphic3d_Group::PrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF) const {
-
- GroupPrimitivesAspect (CTXL, CTXT, CTXM, CTXF);
-
+void Graphic3d_Group::PrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF) const
+{
+ GroupPrimitivesAspect (CTXL, CTXT, CTXM, CTXF);
}
TypeOfPrimitive from Graphic3d,
TypeOfStructure from Graphic3d,
Vector from Graphic3d,
- VertexNC from Graphic3d,
Vertex from Graphic3d,
- TransModeFlags from Graphic3d,
+ TransModeFlags from Graphic3d,
Pnt from gp
raises
---Level: Public
---Purpose: Modifies the order of displaying the structure.
-- Values are between 0 and 10.
- -- Structures are drawn according to their display priorities
- -- in ascending order.
+ -- Structures are drawn according to their display priorities
+ -- in ascending order.
-- A structure of priority 10 is displayed the last and appears over the others.
-- The default value is 5.
-- Category: Methods to modify the class definition
---Purpose: Suppress the highlight for the structure <me>.
---Category: Private methods
- GroupLabels ( me : mutable;
- LB, LE : in out Integer from Standard )
- is static private;
- ---Level: Internal
- ---Purpose: Returns the labels for a new group in the structure <me>.
- ---Category: Private methods
-
Identification ( me )
returns Integer from Standard
is static;
-- the associated C structure
MyCStructure : CStructure from Graphic3d;
- -- the group identifier generator
- MyGroupGenId : GenId from Aspect;
-
-- the structures to which the structure is attached
MyAncestors : SequenceOfAddress from TColStd;
//-Constructors
Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManager)& AManager):
-MyGroupGenId (Group_IDMIN, Group_IDMAX),
MyAncestors (),
MyDescendants (),
MyGroups (),
MyCStructure.IsInfinite = 0,
MyCStructure.HLRValidation = 0;
- MyCStructure.GroupBegin = Structure_GROUPBEGIN;
- MyCStructure.GroupEnd = Structure_GROUPEND;
-
MyCStructure.ContextLine.IsDef = 1,
MyCStructure.ContextFillArea.IsDef = 1,
MyCStructure.ContextMarker.IsDef = 1,
// only then remove group references
if (WithDestruction)
- {
- MyGroupGenId.Free();
MyGroups.Clear();
- }
MyStructureManager->Clear (this, WithDestruction);
if (WithDestruction)
{
- /*
- * void Prs3d_Presentation::Clear () {
- * Graphic3d_Structure::Clear ();
- * myCurrentGroup = new Graphic3d_Group (this);
- * }
- */
while (!MyGroups.IsEmpty())
{
Handle(Graphic3d_Group) aGroup = MyGroups.First();
Standard_ShortReal aPolyFactor, aPolyUnits;
CTX->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
MyCStructure.ContextFillArea.PolygonOffsetMode = aPolyMode;
- MyCStructure.ContextFillArea.PolygonOffsetFactor = aPolyFactor;
- MyCStructure.ContextFillArea.PolygonOffsetUnits = aPolyUnits;
+ MyCStructure.ContextFillArea.PolygonOffsetFactor = (Standard_ShortReal)aPolyFactor;
+ MyCStructure.ContextFillArea.PolygonOffsetUnits = (Standard_ShortReal)aPolyUnits;
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
MyGraphicDriver->ContextStructure (MyCStructure);
MyCStructure.ContextText.ColorSubTitle.b = float (Bs);
MyCStructure.ContextText.TextZoomable = ATextZoomable;
MyCStructure.ContextText.TextAngle = float (ATextAngle);
- MyCStructure.ContextText.TextFontAspect = (int)ATextFontAspect;
+ MyCStructure.ContextText.TextFontAspect = int (ATextFontAspect);
MyCStructure.ContextText.IsDef = 1;
}
}
-void Graphic3d_Structure::GroupLabels (Standard_Integer& LB, Standard_Integer& LE) {
-
- LB = MyGroupGenId.Next ();
- LE = MyGroupGenId.Next ();
-
-}
-
Standard_Integer Graphic3d_Structure::Identification () const {
Standard_Integer Result = MyCStructure.Id;
void Graphic3d_Structure::Remove (const Handle(Graphic3d_Group)& AGroup) {
- Standard_Integer index = 0;
- Standard_Integer Length = MyGroups.Length ();
- for (Standard_Integer i=1; i<=Length && index==0; i++)
- if (MyGroups.Value (i) == AGroup) index = i;
-
+ const Standard_Integer Length = MyGroups.Length ();
// Search in Groups
- if (index != 0) {
- Standard_Integer GroupLabelBegin, GroupLabelEnd;
- AGroup->Labels (GroupLabelBegin, GroupLabelEnd);
- MyGroupGenId.Free (GroupLabelBegin);
- MyGroupGenId.Free (GroupLabelEnd);
- MyGroups.Remove (index);
- }
-
+ for (Standard_Integer i=1; i<=Length; i++)
+ if (MyGroups.Value (i) == AGroup)
+ {
+ MyGroups.Remove (i);
+ return;
+ }
}
Handle(Graphic3d_StructureManager) Graphic3d_Structure::StructureManager () const {
(MyGroups.Value (i))->MinMaxValues(Xm, Ym, Zm, XM, YM, ZM);
Graphic3d_Vertex vertex1(Xm, Ym, Zm);
Graphic3d_Vertex vertex2(XM, YM, ZM);
- Standard_Real distance = vertex1.Distance( vertex1,vertex2 );
+ const Standard_Real distance = vertex1.Distance( vertex2 );
if( distance >= 500000.0){
- XMin = XMax = (Xm+ XM)/2.0;
- YMin = YMax = (Ym+ YM)/2.0;
- ZMin = ZMax = (Zm+ ZM)/2.0;
+ XMin = XMax = 0.5*(Xm+ XM);
+ YMin = YMax = 0.5*(Ym+ YM);
+ ZMin = ZMax = 0.5*(Zm+ ZM);
return;
}
}
MyCStructure.ContextText.ColorSubTitle.b = float (Bs);
MyCStructure.ContextText.TextZoomable = ATextZoomable;
MyCStructure.ContextText.TextAngle = float (ATextAngle);
- MyCStructure.ContextText.TextFontAspect = (int)ATextFontAspect;
+ MyCStructure.ContextText.TextFontAspect = int (ATextFontAspect);
Standard_ShortReal aPolyFactor, aPolyUnits;
CTXF->PolygonOffsets(aPolyMode, aPolyFactor, aPolyUnits);
MyCStructure.ContextFillArea.PolygonOffsetMode = aPolyMode;
- MyCStructure.ContextFillArea.PolygonOffsetFactor = aPolyFactor;
- MyCStructure.ContextFillArea.PolygonOffsetUnits = aPolyUnits;
+ MyCStructure.ContextFillArea.PolygonOffsetFactor = (Standard_ShortReal)aPolyFactor;
+ MyCStructure.ContextFillArea.PolygonOffsetUnits = (Standard_ShortReal)aPolyUnits;
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
}
#include <Graphic3d_Group.pxx>
- // check the value of Group_IDMIN (must be > last label value)
- // (today Structure_LABCONNECT)
-#define Structure_GROUPBEGIN Group_IDMIN-2
-#define Structure_GROUPEND Group_IDMIN-1
-#define Structure_END Group_IDMIN-1
-
#define MyStructureManager ((Graphic3d_StructureManager*) MyPtrStructureManager)
#define MyFirstStructureManager ((Graphic3d_StructureManager*) MyFirstPtrStructureManager)
Graphic3d_Vector::Graphic3d_Vector (const Graphic3d_Vertex& APoint1, const Graphic3d_Vertex& APoint2) {
-Standard_Real X1, Y1, Z1;
-Standard_Real X2, Y2, Z2;
+ MyX = APoint2.X() - APoint1.X();
+ MyY = APoint2.Y() - APoint1.Y();
+ MyZ = APoint2.Z() - APoint1.Z();
- APoint1.Coord (X1, Y1, Z1);
- APoint2.Coord (X2, Y2, Z2);
-
- MyX = Standard_ShortReal (X2 - X1);
- MyY = Standard_ShortReal (Y2 - Y1);
- MyZ = Standard_ShortReal (Z2 - Z1);
-
- MyNorme = Standard_ShortReal (Graphic3d_Vector::NormeOf (X2 - X1, Y2 - Y1, Z2 - Z1));
+ MyNorme = Standard_ShortReal (Graphic3d_Vector::NormeOf (MyX, MyY, MyZ));
}
+++ /dev/null
--- Created by: NW,JPB,CAL
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-class Vertex from Graphic3d
-
- ---Purpose: This class allows the creation and update of a
- -- 3D point.
-
- is
-
- Create
- returns Vertex from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point with 0.0, 0.0, 0.0 coordinates.
-
- Create ( APoint : Vertex from Graphic3d )
- returns Vertex from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point with coordinates identical to <APoint>.
- --
- -- It's just a copy, but this simplifies the management
- -- of the constructors of VertexC, VertexN and VertexNC.
-
- Create ( AX, AY ,AZ : Real from Standard )
- returns Vertex from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point with <AX>, <AY> and <AZ> coordinates.
-
- ---------------------------------------------------
- -- Category: Methods to modify the class definition
- ---------------------------------------------------
-
- SetCoord ( me : in out;
- Xnew, Ynew, Znew : Real from Standard )
- is static;
- ---Level: Public
- ---Purpose: Modifies the coordinates of the point <me>.
- ---Category: Methods to modify the class definition
-
- SetXCoord ( me : in out;
- Xnew : Real from Standard )
- is static;
- ---Level: Public
- ---Purpose: Modifies the X coordinate of the point <me>.
- ---Category: Methods to modify the class definition
-
- SetYCoord ( me : in out;
- Ynew : Real from Standard )
- is static;
- ---Level: Public
- ---Purpose: Modifies the Y coordinate of the point <me>.
- ---Category: Methods to modify the class definition
-
- SetZCoord ( me : in out;
- Znew : Real from Standard )
- is static;
- ---Level: Public
- ---Purpose: Modifies the Z coordinate of the point <me>.
- ---Category: Methods to modify the class definition
-
- ----------------------------
- -- Category: Inquire methods
- ----------------------------
-
- Coord ( me;
- AX, AY, AZ : out Real from Standard )
- is static;
- ---Level: Public
- ---Purpose: Returns the coordinates of the point <me>.
- ---Category: Inquire methods
-
- X ( me )
- returns Real from Standard
- is static;
- ---Level: Public
- ---Purpose: Returns the X coordinates of the point <me>.
- ---Category: Inquire methods
-
- Y ( me )
- returns Real from Standard
- is static;
- ---Level: Public
- ---Purpose: Returns the Y coordinate of the point <me>.
- ---Category: Inquire methods
-
- Z ( me )
- returns Real from Standard
- is static;
- ---Level: Public
- ---Purpose: Returns the Z coordinate of the point <me>.
- ---Category: Inquire methods
-
- --------------------------
- -- Category: Class methods
- --------------------------
-
- Distance ( myclass;
- AV1 : Vertex from Graphic3d;
- AV2 : Vertex from Graphic3d )
- returns Real from Standard;
- ---Level: Public
- ---Purpose: Returns the distance between <AV1> and <AV2>.
- ---Category: Class methods
-
---\f
-
-fields
-
---
--- Class : Graphic3d_Vertex
---
--- Purpose : Declaration of variables specific to points
---
--- Reminder : A point is defined by its coordinates
---
---
-
- -- the coordinates of a point
- MyX : ShortReal from Standard;
- MyY : ShortReal from Standard;
- MyZ : ShortReal from Standard;
-
-end Vertex;
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
+#include <Graphic3d_Vertex.hxx>
-
-
-//-Version
-
-//-Design Declaration des variables specifiques aux points
-
-//-Warning Un point est defini par ses coordonnees
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_Vertex.ixx>
-
-//-Aliases
-
-//-Global data definitions
-
-// -- les coordonnees du point
-// MyX : Standard_ShortReal;
-// MyY : Standard_ShortReal;
-// MyZ : Standard_ShortReal;
-
-//-Constructors
-
-//-Destructors
-
-//-Methods, in order
-
-Graphic3d_Vertex::Graphic3d_Vertex ():
-MyX (Standard_ShortReal (0.0)),
-MyY (Standard_ShortReal (0.0)),
-MyZ (Standard_ShortReal (0.0)) {
-}
-
-Graphic3d_Vertex::Graphic3d_Vertex (const Graphic3d_Vertex& P) {
-
- MyX = Standard_ShortReal (P.X ());
- MyY = Standard_ShortReal (P.Y ());
- MyZ = Standard_ShortReal (P.Z ());
-
-}
-
-Graphic3d_Vertex::Graphic3d_Vertex (const Standard_Real AX, const Standard_Real AY, const Standard_Real AZ):
-MyX (Standard_ShortReal (AX)),
-MyY (Standard_ShortReal (AY)),
-MyZ (Standard_ShortReal (AZ)) {
-}
-
-void Graphic3d_Vertex::Coord (Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const {
-
- X = Standard_Real (MyX);
- Y = Standard_Real (MyY);
- Z = Standard_Real (MyZ);
-
-}
-
-Standard_Real Graphic3d_Vertex::X () const {
-
- return Standard_Real (MyX);
-
-}
-
-Standard_Real Graphic3d_Vertex::Y () const {
-
- return Standard_Real (MyY);
-
-}
-
-Standard_Real Graphic3d_Vertex::Z () const {
-
- return Standard_Real (MyZ);
-
-}
-
-void Graphic3d_Vertex::SetCoord (const Standard_Real Xnew, const Standard_Real Ynew, const Standard_Real Znew) {
-
- MyX = Standard_ShortReal (Xnew);
- MyY = Standard_ShortReal (Ynew);
- MyZ = Standard_ShortReal (Znew);
-
-}
-
-void Graphic3d_Vertex::SetXCoord (const Standard_Real Xnew) {
-
- MyX = Standard_ShortReal (Xnew);
-
-}
-
-void Graphic3d_Vertex::SetYCoord (const Standard_Real Ynew) {
-
- MyY = Standard_ShortReal (Ynew);
-
-}
-
-void Graphic3d_Vertex::SetZCoord (const Standard_Real Znew) {
-
- MyZ = Standard_ShortReal (Znew);
-
-}
-
-Standard_Real Graphic3d_Vertex::Distance (const Graphic3d_Vertex& AV1, const Graphic3d_Vertex& AV2) {
-
- return (Sqrt ( (AV1.X () - AV2.X ()) * (AV1.X () - AV2.X ())
- + (AV1.Y () - AV2.Y ()) * (AV1.Y () - AV2.Y ())
- + (AV1.Z () - AV2.Z ()) * (AV1.Z () - AV2.Z ())));
+Standard_ShortReal Graphic3d_Vertex::Distance(const Graphic3d_Vertex& AOther) const
+{
+ return sqrt( (X() - AOther.X()) * (X() - AOther.X())
+ + (Y() - AOther.Y()) * (Y() - AOther.Y())
+ + (Z() - AOther.Z()) * (Z() - AOther.Z()) );
}
--- /dev/null
+// Created on: 2012-06-20
+// Created by: Sergey ZERCHANINOV
+// Copyright (c) 2011-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#ifndef _Graphic3d_Vertex_HeaderFile
+#define _Graphic3d_Vertex_HeaderFile
+
+#include <Standard_Macro.hxx>
+#include <InterfaceGraphic_telem.hxx>
+#include <Standard_ShortReal.hxx>
+#include <Standard_Real.hxx>
+
+//! This class represents a graphical 3D point. <br>
+class Graphic3d_Vertex : public TEL_POINT
+{
+ public:
+ //! Creates a point with 0.0, 0.0, 0.0 coordinates. <br>
+ Graphic3d_Vertex()
+ { SetCoord(0.f,0.f,0.f); }
+ //! Creates a point with coordinates identical to <APoint>. <br>
+ Graphic3d_Vertex(const Graphic3d_Vertex& APoint)
+ { SetCoord(APoint.X(),APoint.Y(),APoint.Z()); }
+ //! Creates a point with <AX>, <AY> and <AZ> coordinates. <br>
+ Graphic3d_Vertex(const Standard_ShortReal AX,const Standard_ShortReal AY,const Standard_ShortReal AZ)
+ { SetCoord(AX,AY,AZ); }
+ //! Creates a point with <AX>, <AY> and <AZ> coordinates. <br>
+ Graphic3d_Vertex(const Standard_Real AX,const Standard_Real AY,const Standard_Real AZ)
+ { SetCoord(AX,AY,AZ); }
+ //! Modifies the coordinates of the point <me>. <br>
+ void SetCoord(const Standard_ShortReal AX,const Standard_ShortReal AY,const Standard_ShortReal AZ)
+ { xyz[0] = AX, xyz[1] = AY, xyz[2] = AZ; }
+ //! Modifies the coordinates of the point <me>. <br>
+ void SetCoord(const Standard_Real AX,const Standard_Real AY,const Standard_Real AZ)
+ { xyz[0] = Standard_ShortReal(AX), xyz[1] = Standard_ShortReal(AY), xyz[2] = Standard_ShortReal(AZ); }
+ //! Returns the coordinates of the point <me>. <br>
+ void Coord(Standard_ShortReal& AX,Standard_ShortReal& AY,Standard_ShortReal& AZ) const
+ { AX = xyz[0], AY = xyz[1], AZ = xyz[2]; }
+ //! Returns the coordinates of the point <me>. <br>
+ void Coord(Standard_Real& AX,Standard_Real& AY,Standard_Real& AZ) const
+ { AX = xyz[0], AY = xyz[1], AZ = xyz[2]; }
+ //! Returns the X coordinates of the point <me>. <br>
+ Standard_ShortReal X() const { return xyz[0]; }
+ //! Returns the Y coordinate of the point <me>. <br>
+ Standard_ShortReal Y() const { return xyz[1]; }
+ //! Returns the Z coordinate of the point <me>. <br>
+ Standard_ShortReal Z() const { return xyz[2]; }
+ //! Returns the distance between <AV1> and <AV2>. <br>
+ Standard_EXPORT Standard_ShortReal Distance(const Graphic3d_Vertex& AOther) const;
+};
+
+#endif
+++ /dev/null
--- Created by: NW,JPB,CAL
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-class VertexC from Graphic3d inherits Vertex from Graphic3d
-
- ---Version:
-
- ---Purpose: This class allows the creation and update of a point
- -- with a colour value.
-
- ---Keywords: Vertex, Color, Coordinate, Point
-
- ---Warning:
- ---References:
-
-uses
-
- Color from Quantity
- ---Purpose: Returns the color of this point.
-is
-
- Create
- returns VertexC from Graphic3d;
- ---Purpose: Constructs an empty point
-
- Create ( AX, AY ,AZ : Real from Standard;
- AColor : Color from Quantity )
- returns VertexC from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point with coordinates <AX>, <AY>, <AZ> and
- -- with colour <AColor>.
-
- Create ( APoint : Vertex from Graphic3d;
- AColor : Color from Quantity )
- returns VertexC from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point situated in <APoint> and
- -- for which the colour is <AColor>.
-
- ---------------------------------------------------
- -- Category: Methods to modify the class definition
- ---------------------------------------------------
-
- SetColor ( me : in out;
- ColorNew : Color from Quantity )
- is static;
- ---Level: Public
- ---Purpose: Modifies the colour of the point <me>.
- ---Category: Methods to modify the class definition
-
- ----------------------------
- -- Category: Inquire methods
- ----------------------------
-
- Color ( me )
- returns Color from Quantity
- is static;
- ---Level: Public
- ---Purpose: Returns the colour of the point <me>.
- ---Category: Inquire methods
-
---\f
-
-fields
-
---
--- Class : Graphic3d_VertexC
---
--- Purpose : Declaration of variables specific to points
---
--- Reminder : a point is defined by its coordinates and its colour
---
-
- -- the colour of a point
- MyColor : Color from Quantity;
-
-end VertexC;
+++ /dev/null
-// Created by: NW,JPB,CAL
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-
-//-Version
-
-//-Design Declaration of variables specific to points
-
-//-Warning A point is defined by its coordinates and color
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_VertexC.ixx>
-
-//-Aliases
-
-//-Global data definitions
-
-// -- point color
-// MyColor : Color;
-
-//-Constructors
-
-//-Destructors
-
-//-Methods, in order
-
-Graphic3d_VertexC::Graphic3d_VertexC () {
-}
-
-// :(AX, AY, AZ) as VertexC inherits Vertex and it is necessary to call
-// constructor of Vertex with AX, AY and AZ to update fields MyX, MyY, MyZ.
-
-Graphic3d_VertexC::Graphic3d_VertexC (const Standard_Real AX, const Standard_Real AY, const Standard_Real AZ, const Quantity_Color& AColor):
-Graphic3d_Vertex (AX, AY, AZ),
-MyColor (AColor) {
-}
-
-// :(APoint) as VertexC inherits Vertex and it is necessary to call
-// constructor of Vertex with APoint to update fields MyX, MyY, MyZ.
-
-Graphic3d_VertexC::Graphic3d_VertexC (const Graphic3d_Vertex& APoint, const Quantity_Color& AColor):
-Graphic3d_Vertex (APoint),
-MyColor (AColor) {
-}
-
-Quantity_Color Graphic3d_VertexC::Color () const {
-
- return (MyColor);
-
-}
-
-void Graphic3d_VertexC::SetColor (const Quantity_Color& ColorNew) {
-
- MyColor = ColorNew;
-
-}
+++ /dev/null
--- Created by: NW,JPB,CAL
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
--- Modified: 03-02-98 : FMN ; Add Flag Normal
-
-class VertexN from Graphic3d inherits Vertex from Graphic3d
-
- ---Version:
-
- ---Purpose: This class allows the creation and update of
- -- a vertex with a 3D normal.
-
- ---Keywords: Vertex, Normal, Coordinate, Point
-
- ---Warning:
- ---References:
-
-uses
-
- Vector from Graphic3d
-
-is
-
- Create
- returns VertexN from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point with 0.0, 0.0, 0.0 coordinates
- -- for which the normal is 0.0, 0.0, 1.0.
-
- Create ( AX, AY, AZ : Real from Standard;
- ANX, ANY, ANZ : Real from Standard;
- FlagNormalise : Boolean from Standard = Standard_True )
- returns VertexN from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point with coordinates <AX>, <AY>, <AZ> and
- -- for which the normal is <ANX>, <ANY>, <ANZ>.
- -- If <FlagNormalise> is True the normal is already normalised
- -- Else the normal is not normalised, the graphic do it.
-
- Create ( APoint : Vertex from Graphic3d;
- AVector : Vector from Graphic3d;
- FlagNormalise : Boolean from Standard = Standard_True )
- returns VertexN from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point in <APoint> for which the normal is <AVector>.
- -- If <FlagNormalise> is True the normal is already normalised
- -- Else the normal is not normalised, the graphic do it.
-
- ---------------------------------------------------
- -- Category: Methods to modify the class definition
- ---------------------------------------------------
-
- SetNormal ( me : in out;
- NXnew, NYnew, NZnew : Real from Standard;
- FlagNormalise : Boolean from Standard = Standard_True )
- is static;
- ---Level: Public
- ---Purpose: Modifies the normal to the point <me>.
- -- If <FlagNormalise> is True the normal is already normalised
- -- Else the normal is not normalised, the graphic do it.
- ---Category: Methods to modify the class definition
-
- ----------------------------
- -- Category: Inquire methods
- ----------------------------
-
- Normal ( me;
- ANX, ANY, ANZ : out Real from Standard )
- is static;
- ---Level: Public
- ---Purpose: Returns the normal to the point <me>.
- ---Category: Inquire methods
-
---\f
-
-fields
-
---
--- Class : Graphic3d_VertexN
---
--- Purpose : Declaration of variables specific to points.
---
--- Reminder : A point is defined by its coordinates and its normal.
-
- -- the normale to the point
- MyDX : ShortReal from Standard;
- MyDY : ShortReal from Standard;
- MyDZ : ShortReal from Standard;
-
-end VertexN;
+++ /dev/null
-// Created by: NW,JPB,CAL
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-// Modified: 03-02-98 : FMN ; Add Flag Normal
-// Modified: 15-09-98 : CAL ; Modification champ definissant la normale
-// pour permettre l'entrelacement des coordonnees dans Optimizer.
-
-
-//-Version
-
-//-Design Declaration des variables specifiques aux points
-
-//-Warning Un point est defini par ses coordonnees et sa normale
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_VertexN.ixx>
-
-//-Aliases
-
-//-Global data definitions
-
-//-Constructors
-
-//-Destructors
-
-//-Methods, in order
-
-Graphic3d_VertexN::Graphic3d_VertexN ():
-Graphic3d_Vertex (0.0, 0.0, 0.0) {
- MyDX = 0.0,
- MyDY = 0.0,
- MyDZ = 1.0;
-}
-
-Graphic3d_VertexN::Graphic3d_VertexN (const Standard_Real AX, const Standard_Real AY, const Standard_Real AZ, const Standard_Real ANX, const Standard_Real ANY, const Standard_Real ANZ, const Standard_Boolean FlagNormalise):
-Graphic3d_Vertex (AX, AY, AZ) {
- MyDX = (Standard_ShortReal ) ANX,
- MyDY = (Standard_ShortReal ) ANY,
- MyDZ = (Standard_ShortReal ) ANZ;
-}
-
-Graphic3d_VertexN::Graphic3d_VertexN (const Graphic3d_Vertex& APoint, const Graphic3d_Vector& AVector, const Standard_Boolean FlagNormalise):
-Graphic3d_Vertex (APoint) {
-Standard_Real ANX, ANY, ANZ;
- AVector.Coord (ANX, ANY, ANZ);
- MyDX = (Standard_ShortReal ) ANX,
- MyDY = (Standard_ShortReal ) ANY,
- MyDZ = (Standard_ShortReal ) ANZ;
-}
-
-void Graphic3d_VertexN::SetNormal (const Standard_Real ANX, const Standard_Real ANY, const Standard_Real ANZ, const Standard_Boolean FlagNormalise) {
- MyDX = (Standard_ShortReal ) ANX,
- MyDY = (Standard_ShortReal ) ANY,
- MyDZ = (Standard_ShortReal ) ANZ;
-}
-
-void Graphic3d_VertexN::Normal (Standard_Real& ANX, Standard_Real& ANY, Standard_Real& ANZ) const {
- ANX = MyDX,
- ANY = MyDY,
- ANZ = MyDZ;
-}
+++ /dev/null
--- Created by: NW,JPB,CAL
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
--- Modified: 03-02-98 : FMN ; Add Flag Normal
-
-class VertexNC from Graphic3d inherits VertexN from Graphic3d
-
- ---Version:
-
- ---Purpose: This class allows the creation of a vertex with
- -- a colour and a 3D normal.
-
- ---Keywords: Vertex, Normal, Color, Coordinate, Point
-
- ---Warning:
- ---References:
-
-uses
-
- Color from Quantity,
-
- Vector from Graphic3d,
- Vertex from Graphic3d
-
-is
-
- Create
- returns VertexNC from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point with coordinates 0.0, 0.0, 0.0
- -- for which the normal is 0.0, 0.0, 1.0 and
- -- the colour is Quantity_NOC_WHITE.
-
- Create ( AX, AY, AZ : Real from Standard;
- ANX, ANY, ANZ : Real from Standard;
- AColor : Color from Quantity;
- FlagNormalise : Boolean from Standard = Standard_True )
- returns VertexNC from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point with coordinates <AX>, <AY>, <AZ>
- -- for which the normal is <ANX>, <ANY>, <ANZ> and
- -- the colour is <AColor>.
- -- If <FlagNormalise> is True the normal is already normalised
- -- Else the normal is not normalised, the graphic do it.
-
- Create ( APoint : Vertex from Graphic3d;
- AVector : Vector from Graphic3d;
- AColor : Color from Quantity;
- FlagNormalise : Boolean from Standard = Standard_True )
- returns VertexNC from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point in <APoint> for which the normal
- -- is <AVector> and the colour is <AColor>.
- -- If <FlagNormalise> is True the normal is already normalised
- -- Else the normal is not normalised, the graphic do it.
-
- ---------------------------------------------------
- -- Category: Methods to modify the class definition
- ---------------------------------------------------
-
- SetColor ( me : in out;
- ColorNew : Color from Quantity )
- is static;
- ---Level: Public
- ---Purpose: Modifies the colour of the point <me>.
- ---Category: Methods to modify the class definition
-
- ----------------------------
- -- Category: Inquire methods
- ----------------------------
-
- Color ( me )
- returns Color from Quantity
- is static;
- ---Level: Public
- ---Purpose: Returns the colour of the point <me>.
- ---Category: Inquire methods
-
---\f
-
-fields
-
---
--- Class : Graphic3d_VertexNC
---
--- Purpose : Declaration of variables specific to points
---
--- Reminder : A point is defined by its coordinates, its normal
--- and its colour.
-
- -- the colour
- MyColor : Color from Quantity;
-
-end VertexNC;
+++ /dev/null
-// Created by: NW,JPB,CAL
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-// Modified: 03-02-98 : FMN ; Add Flag Normal
-
-
-//-Version
-
-//-Design Declaration of variables specific to points
-
-//-Warning A point is defined by its coordinates, normal
-// and color
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_VertexNC.ixx>
-
-//-Aliases
-
-//-Global data definitions
-
-// -- the color
-// MyColor : Color;
-
-//-Constructors
-
-//-Destructors
-
-//-Methods, in order
-
-Graphic3d_VertexNC::Graphic3d_VertexNC ():
-Graphic3d_VertexN (0.0, 0.0, 0.0, 0.0, 0.0, 1.0) {
-
-Quantity_Color AColor (Quantity_NOC_WHITE);
-
- MyColor = AColor;
-
-}
-
-// :(AX, AY, AZ) as VertexNC inherits VertexN and it is necessary to call
-// constructor of VertexN with AX, AY, AZ, ANX, ANY and ANZ to
-// update fields.
-
-Graphic3d_VertexNC::Graphic3d_VertexNC (const Standard_Real AX, const Standard_Real AY, const Standard_Real AZ, const Standard_Real ANX, const Standard_Real ANY, const Standard_Real ANZ, const Quantity_Color& AColor,const Standard_Boolean FlagNormalise):
-Graphic3d_VertexN (AX, AY, AZ, ANX, ANY, ANZ,FlagNormalise),
-MyColor (AColor) {
-}
-
-// :(APoint, AVector) as VertexNC inherits VertexN and it is necessary to call
-// constructor of VertexN with APoint and AVector to
-// update fields.
-
-Graphic3d_VertexNC::Graphic3d_VertexNC (const Graphic3d_Vertex& APoint, const Graphic3d_Vector& AVector, const Quantity_Color& AColor,const Standard_Boolean FlagNormalise):
-Graphic3d_VertexN (APoint, AVector,FlagNormalise),
-MyColor (AColor) {
-}
-
-Quantity_Color Graphic3d_VertexNC::Color () const {
-
- return (MyColor);
-
-}
-
-void Graphic3d_VertexNC::SetColor (const Quantity_Color& ColorNew) {
-
- MyColor = ColorNew;
-
-}
+++ /dev/null
--- Created on: 1997-09-27
--- Created by: PCT
--- Copyright (c) 1997-1999 Matra Datavision
--- Copyright (c) 1999-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
--- Modified: 03-02-98 : FMN ; Add Flag Normal
-
-class VertexNT from Graphic3d inherits VertexN from Graphic3d
-
- ---Version:
-
- ---Purpose: This class allows the creation and update of
- -- a vertex with a 3D normal and texture coordinate.
-
- ---Keywords: Vertex, Normal, Coordinate, Point, Texture
-
- ---Warning:
- ---References:
-
-uses
-
- Vector from Graphic3d,
- Vertex from Graphic3d
-
-is
-
- Create
- returns VertexNT from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point with 0.0, 0.0, 0.0 coordinates
- -- for which the normal is 0.0, 0.0, 1.0.
- -- texture coordinate is 0.0, 0.0.
-
- Create ( AX, AY, AZ : Real from Standard;
- ANX, ANY, ANZ : Real from Standard;
- ATX : Real from Standard;
- ATY : Real from Standard = 0.0;
- FlagNormalise : Boolean from Standard = Standard_True )
- returns VertexNT from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point with coordinates <AX>, <AY>, <AZ> and
- -- for which the normal is <ANX>, <ANY>, <ANZ>,
- -- texture coordinate is <ATX>, <ATY>.
- -- If <FlagNormalise> is True the normal is already normalised
- -- Else the normal is not normalised, the graphic do it.
-
- Create ( APoint : Vertex from Graphic3d;
- AVector : Vector from Graphic3d;
- ATX : Real from Standard;
- ATY : Real from Standard = 0.0;
- FlagNormalise : Boolean from Standard = Standard_True )
- returns VertexNT from Graphic3d;
- ---Level: Public
- ---Purpose: Creates a point in <APoint> for which the normal is <AVector>.
- -- <ATX>, <ATY> are texture coordinate.
- -- If <FlagNormalise> is True the normal is already normalised
- -- Else the normal is not normalised, the graphic do it.
-
- ---------------------------------------------------
- -- Category: Methods to modify the class definition
- ---------------------------------------------------
-
- SetTextureCoordinate( me : in out;
- ATX : Real from Standard;
- ATY : Real from Standard = 0.0)
- is static;
- ---Level: Public
- ---Purpose: Modifies the texture coordinate to the point <me>.
- ---Category: Methods to modify the class definition
-
-
- ----------------------------
- -- Category: Inquire methods
- ----------------------------
-
- TextureCoordinate( me;
- ATX, ATY : out Real from Standard)
- is static;
- ---Level: Public
- ---Purpose: Returns the texture coordinate to the point <me>.
- ---Category: Inquire methods
-
---\f
-
-fields
-
---
--- Class : Graphic3d_VertexNT
---
--- Purpose : Declaration of variables specific to points.
---
--- Reminder : A point is defined by its coordinates and its normal.
-
- -- the texel
- MyTX, MyTY : Real from Standard;
-
-end VertexNT;
+++ /dev/null
-// Created on: 1997-08-27
-// Created by: PCT
-// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-// Modified: 03-02-98 : FMN ; Add Flag Normal
-
-
-//-Version
-
-//-Design Declaration des variables specifiques aux points
-
-//-Warning Un point est defini par ses coordonnees et sa normale et des coordonnees texture
-
-//-References
-
-//-Language C++ 2.0
-
-//-Declarations
-
-// for the class
-#include <Graphic3d_VertexNT.ixx>
-
-//-Aliases
-
-//-Global data definitions
-
-// -- la normale au point
-// MyTX, MyTY : Standard_Real;
-
-//-Constructors
-
-//-Destructors
-
-//-Methods, in order
-
-Graphic3d_VertexNT::Graphic3d_VertexNT ():
-Graphic3d_VertexN (0.0, 0.0, 0.0, 0.0, 0.0, 1.0),
-MyTX(0.0),
-MyTY(0.0) {
-}
-
-Graphic3d_VertexNT::Graphic3d_VertexNT (const Standard_Real AX, const Standard_Real AY, const Standard_Real AZ, const Standard_Real ANX, const Standard_Real ANY, const Standard_Real ANZ,const Standard_Real ATX,const Standard_Real ATY,const Standard_Boolean FlagNormalise):
-Graphic3d_VertexN (0.0, 0.0, 0.0, 0.0, 0.0, 1.0,FlagNormalise),
-MyTX(ATX),
-MyTY(ATY) {
-}
-
-Graphic3d_VertexNT::Graphic3d_VertexNT (const Graphic3d_Vertex& APoint, const Graphic3d_Vector& AVector,const Standard_Real ATX,const Standard_Real ATY,const Standard_Boolean FlagNormalise):
-Graphic3d_VertexN (APoint, AVector,FlagNormalise),
-MyTX(ATX),
-MyTY(ATY) {
-}
-
-void Graphic3d_VertexNT::SetTextureCoordinate(const Standard_Real ATX,const Standard_Real ATY)
-{
- MyTX = ATX;
- MyTY = ATY;
-}
-
-void Graphic3d_VertexNT::TextureCoordinate(Standard_Real& ATX,Standard_Real& ATY) const
-{
- ATX = MyTX;
- ATY = MyTY;
-}
InterfaceGraphic_telem.hxx
InterfaceGraphic_degeneration.hxx
InterfaceGraphic_tgl_all.hxx
-InterfaceGraphic_Cextern.hxx
+++ /dev/null
-// Copyright (c) 1991-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-/*
- * Attention, ce fichier passe par InterfaceGraphic_Cextern.awk.
- * Il faut donc respecter le format de declaration des fonctions.
- * Voir les regles precedees par !
- *
- * <type_retourne> EXPORT call_<nom_fonction> (
- * #ifdef INTERFACEGRAPHIC_PROTOTYPE ! ne pas changer son nom mais facultatif
- * <type_argument> <nom_argument>, ! virgule collee au nom
- * <type_argument> *<nom_pointeur> ! * collee au nom
- * ! une declaration d'argument par ligne
- * #endif ! facultatif
- * ); ! ); ensembles sur une ligne
- * ! et en premiere colonne
- *
- * Merci, CAL
- *
- * Fonctions enlevees le 6/3/97
- *
- * call_togl_light
- * call_togl_plane
- * call_togl_text3
- * call_togl_light_exploration
- * call_togl_build_matrix
- * call_tox_xgrigri
- * call_tox_set_colormap_mapping
- * call_util_osd_getenv
- *
- * 5/08/97 ; PCT : ajout texture mapping
- * 17/09/98 ; FMN/BGN : ajout (S3819) des Ponts d'entree du Triedre.
- * 15/11/99 ; GG PRO603 Add call_togl_redraw_area
- * 24/01/00 ; EUG G003 Add call_togl_degeneratestructure() and
- * call_togl_backfacing() functions.
- * 27/0302 ; GG RIC120302 Add call_togl_begin_display function
- * 16/06/2000 : ATS : G005 : Add function call_togl_parray
- * 23/10/01 ; SAV Add call_togl_depthtest()
- * call_togl_isdepthtest()
- * 25/10/01 ; SAV Add call_togl_gllight()
- * call_togl_isgllight()
- * 23/12/02 ; SAV Added call_togl_create_bg_texture() and
- * call_togl_set_bg_texture_style() to set background image
- * 15/08/05 ; SZV Added call_togl_userdraw()
- *
- */
-
-#ifndef InterfaceGraphic_CexternHeader
-#define InterfaceGraphic_CexternHeader
-
-#if defined (__STDC__) || defined (__cplusplus) || defined (c_plusplus)
-#define INTERFACEGRAPHIC_PROTOTYPE 1
-#endif
-
-#define InterfaceGraphic_True 1
-#define InterfaceGraphic_False 0
-
-#define InterfaceGraphic_Success 1
-#define InterfaceGraphic_Failure 0
-
-#define OCC1188 /* SAV : added methods to set background image */
-
-#include <InterfaceGraphic_X11.hxx>
-#include <InterfaceGraphic_Aspect.hxx>
-#include <InterfaceGraphic_Graphic3d.hxx>
-#include <InterfaceGraphic_Visual3d.hxx>
-
-#include <Graphic3d_CGraduatedTrihedron.hxx>
-
-#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
- from higher API */
-#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
- from higher API */
-
- /* Declarations des subroutines triedron */
-
-void EXPORT call_togl_ztriedron_setup (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float* xcolor,
- float* ycolor,
- float* zcolor,
- float sizeratio,
- float axisdiameter,
- int nbfacettes
-#endif
-);
-
-void EXPORT call_togl_triedron_display (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW * aview,
- int APosition,
- float r,
- float g,
- float b,
- float AScale,
- int asWireframe
-#endif
-);
-
-void EXPORT call_togl_triedron_erase (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_triedron_echo (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int AType
-#endif
-);
-
- /* Declarations des subroutines mode immediat */
-
-int EXPORT call_togl_begin_ajout_mode (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_end_ajout_mode (
-);
-
-int EXPORT call_togl_begin_immediat_mode (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer,
- int doublebuffer,
- int retainmode
-#endif
-);
-
-void EXPORT call_togl_end_immediat_mode (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int synchronize
-#endif
-);
-
-void EXPORT call_togl_clear_immediat_mode (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int aFlush
-#endif
-);
-
-void EXPORT call_togl_transform (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_MATRIX4X4 amatrix,
- int mode
-#endif
-);
-
-void EXPORT call_togl_begin_polyline (
-);
-
-void EXPORT call_togl_end_polyline (
-);
-
-void EXPORT call_togl_begin_polygon (
-);
-
-void EXPORT call_togl_end_polygon (
-);
-
-void EXPORT call_togl_begin_trianglemesh (
-);
-
-void EXPORT call_togl_end_trianglemesh (
-);
-
-void EXPORT call_togl_begin_marker (
-);
-
-void EXPORT call_togl_end_marker (
-);
-
-void EXPORT call_togl_begin_bezier (
-);
-
-void EXPORT call_togl_end_bezier (
-);
-
-void EXPORT call_togl_move (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x,
- float y,
- float z
-#endif
-);
-
-void EXPORT call_togl_movenormal (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x,
- float y,
- float z,
- float nx,
- float ny,
- float nz
-#endif
-);
-
-void EXPORT call_togl_moveweight (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x,
- float y,
- float z,
- float w
-#endif
-);
-
-void EXPORT call_togl_draw (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x,
- float y,
- float z
-#endif
-);
-
-void EXPORT call_togl_drawnormal (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x,
- float y,
- float z,
- float nx,
- float ny,
- float nz
-#endif
-);
-
-void EXPORT call_togl_drawweight (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x,
- float y,
- float z,
- float w
-#endif
-);
-
-void EXPORT call_togl_draw_text (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_TEXT *atext
-#endif
-);
-
-void EXPORT call_togl_draw_structure (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int StructId
-#endif
-);
-
-void EXPORT call_togl_set_linecolor (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float r,
- float g,
- float b
-#endif
-);
-
-void EXPORT call_togl_set_interiorcolor (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float r,
- float g,
- float b
-#endif
-);
-
-void EXPORT call_togl_set_linetype (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- long type
-#endif
-);
-
-void EXPORT call_togl_set_interiortype (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- long type
-#endif
-);
-
-void EXPORT call_togl_set_linewidth (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float width
-#endif
-);
-
-void EXPORT call_togl_set_textcolor (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float r,
- float g,
- float b
-#endif
-);
-
-void EXPORT call_togl_set_textfont (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- char *police,
- float factor,
- float space
-#endif
-);
-
-void EXPORT call_togl_set_markercolor (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float r,
- float g,
- float b
-#endif
-);
-
-void EXPORT call_togl_set_markertype (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- long type,
- float scale
-#endif
-);
-
-void EXPORT call_togl_set_minmax (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x1,
- float y1,
- float z1,
- float x2,
- float y2,
- float z2
-#endif
-);
-
-void EXPORT call_togl_set_rgb (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float r,
- float g,
- float b
-#endif
-);
-
- /* Declarations des subroutines appelees du C++ */
- /* dans les packages Graphic3d et Visual3d */
-
-void EXPORT call_togl_opengroup (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup
-#endif
-);
-
-void EXPORT call_togl_closegroup (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup
-#endif
-);
-
-void EXPORT call_togl_cleargroup (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup
-#endif
-);
-
-void EXPORT call_togl_linecontextgroup (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- int noinsert
-#endif
-);
-
-void EXPORT call_togl_facecontextgroup (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- int noinsert
-#endif
-);
-
-void EXPORT call_togl_markercontextgroup (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- int noinsert
-#endif
-);
-
-void EXPORT call_togl_textcontextgroup (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- int noinsert
-#endif
-);
-
-void EXPORT call_togl_group (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup
-#endif
-);
-
-void EXPORT call_togl_marker (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_MARKER *amarker
-#endif
-);
-
-void EXPORT call_togl_marker_set (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTMARKERS *almarkers
-#endif
-);
-
-void EXPORT call_togl_polyline (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTPOINTS *alpoints
-#endif
-);
-
-void EXPORT call_togl_polygon (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_FACET *afacet
-#endif
-);
-
-void EXPORT call_togl_polygon_holes (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTFACETS *alfacets
-#endif
-);
-
-void EXPORT call_togl_polygon_indices (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTPOINTS *alpoints,
- CALL_DEF_LISTEDGES *aledges,
- CALL_DEF_LISTINTEGERS *albounds
-#endif
-);
-
-void EXPORT call_togl_pickid (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup
-#endif
-);
-
-void EXPORT call_togl_quadrangle (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_QUAD *aquad
-#endif
-);
-
-void EXPORT call_togl_removegroup (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup
-#endif
-);
-
-void EXPORT call_togl_text (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_TEXT *atext
-#endif
-);
-
-void EXPORT call_togl_triangle (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_TRIKE *atrike
-#endif
-);
-
-void EXPORT call_togl_bezier (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTPOINTS *alpoints
-#endif
-);
-
-void EXPORT call_togl_bezier_weight (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_LISTPOINTS *alpoints,
- CALL_DEF_LISTREALS *alweights
-#endif
-);
-
-void EXPORT call_togl_blink (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *astructure,
- int create
-#endif
-);
-
-void EXPORT call_togl_boundarybox (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *astructure,
- int create
-#endif
-);
-
-void EXPORT call_togl_clearstructure (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *astructure
-#endif
-);
-
-void EXPORT call_togl_contextstructure (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *astructure
-#endif
-);
-
-void EXPORT call_togl_highlightcolor (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *astructure,
- CALL_DEF_COLOR *acolor,
- int create
-#endif
-);
-
-void EXPORT call_togl_namesetstructure (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *astructure
-#endif
-);
-
-void EXPORT call_togl_removestructure (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *astructure
-#endif
-);
-
-void EXPORT call_togl_structure (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *astructure
-#endif
-);
-
-void EXPORT call_togl_transformstructure (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *astructure
-#endif
-);
-
-void EXPORT call_togl_degeneratestructure (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *astructure
-#endif
-);
-
-void EXPORT call_togl_connect (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *afather,
- CALL_DEF_STRUCTURE *ason
-#endif
-);
-
-void EXPORT call_togl_disconnect (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_STRUCTURE *afather,
- CALL_DEF_STRUCTURE *ason
-#endif
-);
-
-int EXPORT call_togl_begin_animation (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_end_animation (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-int EXPORT call_togl_begin (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- char *adisplay
-#endif
-);
-
-/*RIC120302*/
-int EXPORT call_togl_begin_display (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- void *pdisplay
-#endif
-);
-/*RIC120302*/
-
-void EXPORT call_togl_end (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
-#endif
-);
-
-void EXPORT call_togl_structure_exploration (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- long Id,
- long LabelBegin,
- long LabelEnd
-#endif
-);
-
-void EXPORT call_togl_element_exploration (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- long Id,
- long elem_num,
- long *type,
- CALL_DEF_POINT *pt,
- CALL_DEF_NORMAL *npt,
- CALL_DEF_COLOR *cpt,
- CALL_DEF_NORMAL *nfa
-#endif
-);
-
-void EXPORT call_togl_element_type (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- long Id,
- long elem_num,
- long *type
-#endif
-);
-
-void EXPORT call_togl_activateview (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_antialiasing (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int tag
-#endif
-);
-
-void EXPORT call_togl_background (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_gradient_background
-(
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int ws, int type,
- tel_colour color1,
- tel_colour color2
-#endif
-);
-
-void EXPORT call_togl_set_gradient_type
-(
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int ws, int type
-#endif
-);
-
-int EXPORT call_togl_project_raster (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int wsid,
- float x,
- float y,
- float z,
- int *ixr,
- int *iyr
-#endif
-);
-
-int EXPORT call_togl_unproject_raster (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int wsid,
- int xm,
- int ym,
- int xM,
- int yM,
- int ixr,
- int iyr,
- float *x,
- float *y,
- float *z
-#endif
-);
-
-int EXPORT call_togl_unproject_raster_with_ray (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int wsid,
- int xm,
- int ym,
- int xM,
- int yM,
- int ixr,
- int iyr,
- float *x,
- float *y,
- float *z,
- float *dx,
- float *dy,
- float *dz
-#endif
-);
-
-void EXPORT call_togl_cliplimit (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int wait
-#endif
-);
-
-void EXPORT call_togl_deactivateview (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_depthcueing (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int tag
-#endif
-);
-
-void EXPORT call_togl_displaystructure (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int StructId,
- int Priority
-#endif
-);
-
-void EXPORT call_togl_erasestructure (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int ViewId,
- int StructId
-#endif
-);
-
-void EXPORT call_togl_init_pick (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
-#endif
-);
-
-void EXPORT call_togl_pick (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_PICK *apick
-#endif
-);
-
-void EXPORT call_togl_ratio_window (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_redraw (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer
-#endif
-);
-
-void EXPORT call_togl_redraw_area (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer,
- int x, int y, int width, int height
-#endif
-);
-
-void EXPORT call_togl_removeview (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_setlight (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_setplane (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_setvisualisation (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_transparency (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int WsId,
- int ViewId,
- int Activity
-#endif
-);
-
-void EXPORT call_togl_update (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer
-#endif
-);
-
-int EXPORT call_togl_view (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-int EXPORT call_togl_viewmapping (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int wait
-#endif
-);
-
-int EXPORT call_togl_vieworientation (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int wait
-#endif
-);
-
-int EXPORT call_togl_inquiretexture (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
-#endif
-);
-
-int EXPORT call_togl_inquirelight (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
-#endif
-);
-
-int EXPORT call_togl_inquireplane (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
-#endif
-);
-
-int EXPORT call_togl_inquireview (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
-#endif
-);
-
-int EXPORT call_togl_inquiremat (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- CALL_DEF_MATRIX4X4 ori_matrix,
- CALL_DEF_MATRIX4X4 map_matrix
-#endif
-);
-
-void EXPORT call_togl_view_exploration (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- long Id
-#endif
-);
-
-#ifdef OCC1188
-int EXPORT call_togl_create_texture (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int Type,
- unsigned int Width,
- unsigned int Height,
- unsigned char *Data,
- char *FileName
-#endif
-);
-
-void EXPORT call_togl_create_bg_texture (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int width,
- int height,
- unsigned char *data,
- int style
-#endif
-);
-#endif /* OCC1188 */
-
-void EXPORT call_togl_set_bg_texture_style(
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW* aview,
- int style
-#endif
-);
-
-void EXPORT call_togl_destroy_texture (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int TexId
-#endif
-);
-
-void EXPORT call_togl_modify_texture (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- int TexId,
- CALL_DEF_INIT_TEXTURE *init_tex
-#endif
-);
-
-void EXPORT call_togl_environment (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
- /* Declarations des subroutines layer mode */
-
-void EXPORT call_togl_layer2d (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_LAYER *alayer
-#endif
-);
-
-void EXPORT call_togl_removelayer2d (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_LAYER *alayer
-#endif
-);
-
-void EXPORT call_togl_begin_layer2d (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_LAYER *alayer
-#endif
-);
-
-void EXPORT call_togl_end_layer2d (
-);
-
-void EXPORT call_togl_clear_layer2d (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_LAYER *alayer
-#endif
-);
-
-void EXPORT call_togl_begin_polyline2d (
-);
-
-void EXPORT call_togl_end_polyline2d (
-);
-
-void EXPORT call_togl_begin_polygon2d (
-);
-
-void EXPORT call_togl_end_polygon2d (
-);
-
-void EXPORT call_togl_move2d (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x,
- float y
-#endif
-);
-
-void EXPORT call_togl_draw2d (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x,
- float y
-#endif
-);
-
-void EXPORT call_togl_edge2d (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x,
- float y
-#endif
-);
-
-void EXPORT call_togl_rectangle2d (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float x,
- float y,
- float w,
- float h
-#endif
-);
-
-void EXPORT call_togl_set_color (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float r,
- float g,
- float b
-#endif
-);
-
-void EXPORT call_togl_set_transparency (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float a
-#endif
-);
-
-void EXPORT call_togl_unset_transparency (
-);
-
-void EXPORT call_togl_set_line_attributes (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- long type,
- float width
-#endif
-);
-
-void EXPORT call_togl_set_text_attributes (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- char* font,
- long type,
- float r,
- float g,
- float b
-#endif
-);
-
-void EXPORT call_togl_text2d (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- char *s,
- float x,
- float y,
- float height
-#endif
-);
-
-void EXPORT call_togl_textsize2d (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- char *s,
- float height,
- float *width,
- float *ascent,
- float *descent
-#endif
-);
-
-void EXPORT call_togl_backfacing (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW*
-#endif /* INTERFACEGRAPHIC_PROTOTYPE */
- );
-
-/* *** group of parray functions *** */
-
-void EXPORT call_togl_parray (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_PARRAY* parray
-#endif
-);
-
-void EXPORT call_togl_userdraw (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_GROUP *agroup,
- CALL_DEF_USERDRAW *anobject
-#endif
-);
-
-/* ------------------------- */
-void EXPORT call_togl_print (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- CALL_DEF_LAYER *anunderlayer,
- CALL_DEF_LAYER *anoverlayer,
- const Aspect_Drawable hPrintDC,
- const int background,
- const char* filename
-#endif
-);
-
-
-#ifdef BUC61044
-void EXPORT call_togl_depthtest (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int dFlag
-#endif
-);
-
-int EXPORT call_togl_isdepthtest (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-#endif
-
-#ifdef BUC61045
-void EXPORT call_togl_gllight (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview,
- int dFlag
-#endif
-);
-
-int EXPORT call_togl_isgllight (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- CALL_DEF_VIEW *aview
-#endif
-);
-
-void EXPORT call_togl_graduatedtrihedron_display (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- /* View id */
- CALL_DEF_VIEW* aview,
- /* Graduated trihedron data */
- const Graphic3d_CGraduatedTrihedron &cubic
-#endif
-);
-
-void EXPORT call_togl_graduatedtrihedron_erase (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- /* View id */
- CALL_DEF_VIEW* aview
-#endif
-);
-
-void EXPORT call_togl_graduatedtrihedron_minmaxvalues (
-#ifdef INTERFACEGRAPHIC_PROTOTYPE
- float xmin,
- float ymin,
- float zmin,
- float xmax,
- float ymax,
- float zmax
-#endif
-);
-
-#endif
-
-#endif /* InterfaceGraphic_CexternHeader */
typedef TEL_TEXTURE_COORD* tel_texture_coord;
-struct TEL_POINT
+class TEL_POINT
{
- float xyz[3];
+ public:
+ float xyz[3];
DEFINE_STANDARD_ALLOC
};
typedef TEL_POINT* tel_point;
// and conditions governing the rights and limitations under the License.
-#define _POLYGONES_
-// if define _POLYGONES_ ColorPrsBuilder use ArrayOfPolygons for drawing faces
-
#include <MeshVS_ElementalColorPrsBuilder.ixx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_ArrayOfPolygons.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
-#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_Root.hxx>
if ( IsPolyG )
{
aGGroup->SetPrimitivesAspect ( anAsp );
- aGGroup->BeginPrimitives();
aGGroup->AddPrimitiveArray ( aPolyGArr );
- aGGroup->EndPrimitives();
}
if ( IsPolyL )
{
anAsp->SetEdgeOff();
aLGroup->SetPrimitivesAspect ( anAsp );
aLGroup->SetPrimitivesAspect ( anLAsp );
- aLGroup->BeginPrimitives();
aLGroup->AddPrimitiveArray ( aPolyLArr );
- aLGroup->EndPrimitives();
if (anEdgeOn)
anAsp->SetEdgeOn();
else
if ( aSize<=0 )
continue;
-#ifdef _POLYGONES_
Handle (Graphic3d_ArrayOfPolygons) aPolyArr = new Graphic3d_ArrayOfPolygons
( aMaxFaceNodes*aSize, aSize, 0, IsReflect );
-#endif
MeshVS_TwoColors aTC = aColIter2.Key();
Quantity_Color aMyIntColor, aMyBackColor;
anAsp->SetEdgeOff();
aGroup2->SetPrimitivesAspect ( anAsp );
- aGroup2->BeginPrimitives();
for( it.Reset(); it.More(); it.Next() )
{
Standard_Boolean hasNormals = /*IsReflect &&*/
aSource->GetNormalsByElement( aKey, IsMeshSmoothShading, aMaxFaceNodes, aNormals );
-#ifdef _POLYGONES_
aPolyArr->AddBound ( NbNodes );
-#else
- Graphic3d_Array1OfVertex aVertArr ( 1, NbNodes );
-#endif
for ( i=1; i<=NbNodes; i++ )
{
-#ifdef _POLYGONES_
if ( IsReflect )
{
hasNormals ? aPolyArr->AddVertex ( aCoords(3 * i - 2),
aPolyArr->AddVertex ( aCoords(3*i-2),
aCoords(3*i-1),
aCoords(3*i ) );
-#else
- if ( IsReflect )
- {
- aVertArr (i) = hasNormals ? Graphic3d_VertexN( aCoords(3 * i - 2),
- aCoords(3 * i - 1),
- aCoords(3 * i ),
- aNormals->Value(3 * i - 2),
- aNormals->Value(3 * i - 1),
- aNormals->Value(3 * i ),
- Standard_False ) :
- Graphic3d_VertexN( aCoords(3 * i - 2),
- aCoords(3 * i - 1),
- aCoords(3 * i ),
- 0.,
- 0.,
- 1.,
- Standard_False );
-
- }
- else
- Graphic3d_Vertex ( aCoords(3 * i - 2),
- aCoords(3 * i - 1),
- aCoords(3 * i ) );
-#endif
}
-
-
-#ifndef _POLYGONES_
- aGroup2->Polygon ( aVertArr );
-#endif
}
}
}
-#ifdef _POLYGONES_
aGroup2->AddPrimitiveArray ( aPolyArr );
-#endif
- aGroup2->EndPrimitives();
}
}
#include <Graphic3d_Group.hxx>
#include <TColStd_ListIteratorOfListOfReal.hxx>
#include <Prs3d_Root.hxx>
-#include <Graphic3d_Vertex.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
#include <SelectMgr_SelectableObject.hxx>
#include <PrsMgr_PresentationManager.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_ArrayOfPolygons.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_Group.hxx>
Prs3d_Root::NewGroup ( Prs );
Handle (Graphic3d_Group) aNodeGroup = Prs3d_Root::CurrentGroup ( Prs );
aNodeGroup->SetPrimitivesAspect ( aNodeMark );
-
- aNodeGroup->BeginPrimitives();
aNodeGroup->MarkerSet ( aNodePoints );
- aNodeGroup->EndPrimitives();
}
}
// add shading presentation
if ( ( IsShading || IsShrink ) && !HasSelectFlag )
AddVolumePrs ( aTopo, aCoords, NbNodes, aVolumes, IsReflect, IsShrink, HasSelectFlag, aShrinkCoef );
-
- /*
- Handle( Graphic3d_ArrayOfPrimitives ) anArr = aVolumes;
- if( IsWireFrame || HasSelectFlag )
- anArr = aPolylines;
-
- AddVolumePrs ( aTopo, aCoords, NbNodes, anArr, IsReflect, IsShrink, HasSelectFlag, aShrinkCoef );
- */
}
break;
case MeshVS_ET_Link:
{
aHilightGroup->SetPrimitivesAspect ( aBeam );
- aHilightGroup->Polyline ( Graphic3d_Vertex ( aCoords(1), aCoords(2), aCoords(3) ),
- Graphic3d_Vertex ( aCoords(4), aCoords(5), aCoords(6) ) );
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(aCoords(1),aCoords(2),aCoords(3));
+ aPrims->AddVertex(aCoords(4),aCoords(5),aCoords(6));
+ aHilightGroup->AddPrimitiveArray(aPrims);
}
break;
case MeshVS_ET_Face:
if ( NbNodes > 0 )
{
- Standard_Real X, Y, Z;
aHilightGroup->SetPrimitivesAspect ( aFill );
- Graphic3d_Array1OfVertex aVArr ( 1, NbNodes );
-
+ Handle(Graphic3d_ArrayOfPolygons) aPrims = new Graphic3d_ArrayOfPolygons(NbNodes);
for ( Standard_Integer k=1; k<=NbNodes; k++)
- {
- X = aCoords(3*k-2);
- Y = aCoords(3*k-1);
- Z = aCoords(3*k);
- aVArr.SetValue ( k, Graphic3d_Vertex ( X, Y, Z ) );
- }
- aHilightGroup->Polygon ( aVArr );
+ aPrims->AddVertex(aCoords(3*k-2),aCoords(3*k-1),aCoords(3*k));
+ aHilightGroup->AddPrimitiveArray(aPrims);
}
break;
if( aSource->Get3DGeom( ID, NbNodes, aTopo ) )
{
- Standard_Integer low = aTopo->Lower(), up = aTopo->Upper(), i, j, m, ind;
- for( i=low; i<=up; i++ )
+ const Standard_Integer up = aTopo->Upper();
+ const Standard_Integer lo = aTopo->Lower();
+ Standard_Integer nbnodes = 0, i, j;
+ for( i=lo; i<=up; i++ )
+ nbnodes += aTopo->Value( i ).Length();
+
+ Handle(Graphic3d_ArrayOfPolygons) aPrims = new Graphic3d_ArrayOfPolygons(nbnodes,aTopo->Length());
+ for( i=lo; i<=up; i++ )
{
const TColStd_SequenceOfInteger& aSeq = aTopo->Value( i );
- m = aSeq.Length();
- Graphic3d_Array1OfVertex aVArr( 1, m );
+ const Standard_Integer m = aSeq.Length();
+ aPrims->AddBound(m);
for( j=1; j<=m; j++ )
{
- ind = aSeq.Value( j );
- aVArr.SetValue( j, Graphic3d_Vertex( aCoords( 3*ind+1 ),
- aCoords( 3*ind+2 ),
- aCoords( 3*ind+3 ) ) );
+ const Standard_Integer ind = 3*aSeq.Value( j );
+ aPrims->AddVertex(aCoords(ind+1),aCoords(ind+2),aCoords(ind+3));
}
- aHilightGroup->Polygon ( aVArr );
}
+ aHilightGroup->AddPrimitiveArray(aPrims);
}
}
break;
if( IsFacePolygons )
{
aGroup->SetPrimitivesAspect ( theFillAsp );
- aGroup->BeginPrimitives ();
aGroup->AddPrimitiveArray ( thePolygons );
- aGroup->EndPrimitives ();
}
if( IsVolumePolygons )
aCullFillAsp->SuppressBackFace();
aGroup->SetPrimitivesAspect ( aCullFillAsp );
- aGroup->BeginPrimitives ();
aGroup->AddPrimitiveArray ( theVolumesInShad );
- aGroup->EndPrimitives ();
}
}
aLGroup->SetPrimitivesAspect ( new Graphic3d_AspectLine3d
( anEdgeColor, Aspect_TOL_SOLID, aWidth ) );
}
- aLGroup->BeginPrimitives ();
aLGroup->AddPrimitiveArray ( theLines );
- aLGroup->EndPrimitives ();
theFillAsp->SetEdgeOn();
}
if ( !IsSelected )
aBeamGroup->SetPrimitivesAspect ( theFillAsp );
aBeamGroup->SetPrimitivesAspect ( theLineAsp );
-
- aBeamGroup->BeginPrimitives();
aBeamGroup->AddPrimitiveArray ( theLinkLines );
- aBeamGroup->EndPrimitives();
theFillAsp->SetEdgeOn();
}
if( IsFacePolygons )
{
aGroup->SetPrimitivesAspect ( theFillAsp );
- aGroup->BeginPrimitives ();
aGroup->AddPrimitiveArray ( thePolygons );
- aGroup->EndPrimitives ();
}
if( IsVolumePolygons )
aCullFillAsp->SuppressBackFace();
aGroup->SetPrimitivesAspect ( aCullFillAsp );
- aGroup->BeginPrimitives ();
aGroup->AddPrimitiveArray ( theVolumesInShad );
- aGroup->EndPrimitives ();
}
}
}
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_ArrayOfPolygons.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
-#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_TextureParams.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Graphic3d_TypeOfTextureMode.hxx>
#include <Standard_DefineHandle.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
-#include <Graphic3d_Array1OfVertexNT.hxx>
#include <AIS_Drawer.hxx>
#include <Quantity_Array1OfColor.hxx>
#include <Aspect_SequenceOfColor.hxx>
Handle(Graphic3d_Group) aGroup1 = Prs3d_Root::CurrentGroup ( Prs );
aGroup1->SetPrimitivesAspect( anAsp );
- aGroup1->BeginPrimitives();
aGroup1->AddPrimitiveArray( aCPolyArr );
- aGroup1->EndPrimitives();
if (aShowEdges)
{
anAsp->SetTextureMapOff();
aGroup2->SetPrimitivesAspect( anAsp );
aGroup2->SetPrimitivesAspect( anLAsp );
- aGroup2->BeginPrimitives();
aGroup2->AddPrimitiveArray( aPolyL );
- aGroup2->EndPrimitives();
anAsp->SetEdgeOn();
}
}
aTextGroup->SetPrimitivesAspect( aTextAspect );
aTextGroup->SetPrimitivesAspect( anAspectMarker3d );
- aTextGroup->BeginPrimitives();
-
MeshVS_Buffer aCoordsBuf (3*aMaxFaceNodes*sizeof(Standard_Real));
TColStd_Array1OfReal aCoords (aCoordsBuf, 1, 3*aMaxFaceNodes);
Standard_Integer NbNodes;
}
}
- aTextGroup->EndPrimitives();
-
if (!aCustomElements.IsEmpty())
CustomBuild ( Prs, aCustomElements, IDsToExclude, theDisplayMode );
}
new Graphic3d_AspectLine3d ( aColor, Aspect_TOL_SOLID, 1.5 );
aVGroup->SetPrimitivesAspect( aLinAspect );
-
- aVGroup->BeginPrimitives();
aVGroup->AddPrimitiveArray( aLineArray );
- aVGroup->EndPrimitives();
+
if ( !myIsSimplePrs )
{
Graphic3d_MaterialAspect aMatAspect;
1., aMatAspect, aMatAspect );
aVGroup->SetPrimitivesAspect( aFillAspect );
-
- aVGroup->BeginPrimitives();
aVGroup->AddPrimitiveArray( aTriangleArray );
- aVGroup->EndPrimitives();
}
else
{
new Graphic3d_AspectLine3d ( aColor, Aspect_TOL_SOLID, mySimpleWidthPrm * 1.5 );
aVGroup->SetPrimitivesAspect( anArrowLinAspect );
-
- aVGroup->BeginPrimitives();
aVGroup->AddPrimitiveArray( aArrowLineArray );
- aVGroup->EndPrimitives();
}
if( !aCustomElements.IsEmpty() )
#include <Graphic3d_CGroup.hxx>
#include <Graphic3d_TypeOfPrimitive.hxx>
#include <Graphic3d_CPick.hxx>
-#include <Graphic3d_TypeOfPolygon.hxx>
#include <Graphic3d_TextPath.hxx>
#include <Graphic3d_HorizontalTextAlignment.hxx>
#include <Graphic3d_VerticalTextAlignment.hxx>
#include <Graphic3d_SortType.hxx>
#include <Graphic3d_PtrFrameBuffer.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
-#include <Graphic3d_Array1OfVertexN.hxx>
-#include <Graphic3d_Array1OfVertexNT.hxx>
-#include <Graphic3d_Array1OfVertexC.hxx>
-#include <Graphic3d_Array1OfVertexNC.hxx>
#include <Graphic3d_Array2OfVertex.hxx>
-#include <Graphic3d_Array2OfVertexN.hxx>
-#include <Graphic3d_Array2OfVertexNT.hxx>
#include <Graphic3d_BufferType.hxx>
#include <NCollection_DataMap.hxx>
class TColStd_Array1OfReal;
class TColStd_Array2OfReal;
class TColStd_HArray1OfByte;
-class Graphic3d_VertexNC;
class Graphic3d_Vector;
class Quantity_Color;
class Graphic3d_Vertex;
public: // Methods for graphical groups
Standard_EXPORT void ClearGroup (const Graphic3d_CGroup& ACGroup);
- Standard_EXPORT void CloseGroup (const Graphic3d_CGroup& ACGroup);
Standard_EXPORT void FaceContextGroup (const Graphic3d_CGroup& theCGroup,
const Standard_Integer theNoInsert);
Standard_EXPORT void Group (Graphic3d_CGroup& theCGroup);
const Standard_Integer theMarkWidth,
const Standard_Integer theMarkHeight,
const Handle(TColStd_HArray1OfByte)& theTexture);
- Standard_EXPORT void OpenGroup (const Graphic3d_CGroup& theCGroup);
Standard_EXPORT void RemoveGroup (const Graphic3d_CGroup& theCGroup);
Standard_EXPORT void TextContextGroup (const Graphic3d_CGroup& theCGroup,
const Standard_Integer theNoInsert);
Standard_EXPORT void ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
Standard_EXPORT void ViewOrientation (const Graphic3d_CView& ACView,const Standard_Boolean AWait);
Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
- Standard_EXPORT void Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint, const Standard_Boolean EvalMinMax = Standard_True);
- Standard_EXPORT void MarkerSet (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True);
- Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True);
+ Standard_EXPORT void Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint);
+ Standard_EXPORT void MarkerSet (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex);
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
//! Clear visualization data in graphical driver and stop <br>
//! displaying the primitives array of the graphical group <theCGroup>. <br>
//! This method is internal and should be used by Graphic3d_Group only. <br>
- Standard_EXPORT void RemovePrimitiveArray(const Graphic3d_CGroup& theCGroup,const Graphic3d_PrimitiveArray& thePArray);
Standard_EXPORT Standard_Integer InquirePlaneLimit();
Standard_EXPORT Standard_ShortReal DefaultTextHeight() const;
Standard_EXPORT void FBOGetDimensions(const Graphic3d_CView& view,const Graphic3d_PtrFrameBuffer fboPtr,Standard_Integer& width,Standard_Integer& height,Standard_Integer& widthMax,Standard_Integer& heightMax);
InvalidateAllWorkspaces();
}
-void OpenGl_GraphicDriver::CloseGroup (const Graphic3d_CGroup& )
-{
- // Do nothing
-}
-
void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& theCGroup,
const Standard_Integer theNoInsert)
{
}
}
-void OpenGl_GraphicDriver::OpenGroup (const Graphic3d_CGroup& )
-{
- // Do nothing
-}
-
void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup)
{
OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure;
((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelMarkerSet, amarkerset );
}
-void OpenGl_GraphicDriver::Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint, const Standard_Boolean )
+void OpenGl_GraphicDriver::Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex &APoint)
{
if (!ACGroup.ptrGroup)
return;
}
void OpenGl_GraphicDriver::MarkerSet (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& ListVertex,
- const Standard_Boolean )
+ const Graphic3d_Array1OfVertex& ListVertex)
{
if (!ACGroup.ptrGroup)
return;
-// Created on: 2011-10-20
-// Created by: Sergey ZERCHANINOV
-// Copyright (c) 2011-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-#include <OpenGl_GraphicDriver.hxx>
-
-#include <OpenGl_Group.hxx>
-#include <OpenGl_Polygon.hxx>
-
-void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ACGroup,
- const Graphic3d_Array1OfVertex& AListVertex,
- const Graphic3d_TypeOfPolygon AType,
- const Standard_Boolean )
-{
- if (ACGroup.ptrGroup)
- {
- OpenGl_Polygon *apolygon = new OpenGl_Polygon( AListVertex, AType );
- ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolygon, apolygon );
- }
-}
}
}
-//=======================================================================
-//function : RemovePrimitiveArray
-//purpose : Purpose: Clear visualization data in graphical driver and
-// stop displaying the primitives array of the graphical group
-// <theCGroup>. This method is internal and should be used by
-// Graphic3d_Group only.
-//=======================================================================
-
-void OpenGl_GraphicDriver::RemovePrimitiveArray (const Graphic3d_CGroup& theCGroup,
- const Graphic3d_PrimitiveArray& thePArray)
-{
- if (theCGroup.ptrGroup && thePArray)
- {
- ((OpenGl_Group* )theCGroup.ptrGroup)->RemovePrimitiveArray (GetSharedContext(), thePArray);
- }
-}
-
void OpenGl_GraphicDriver::UserDraw (const Graphic3d_CGroup& theCGroup,
const Graphic3d_CUserDraw& theUserDraw)
{
/*----------------------------------------------------------------------*/
-void OpenGl_Group::RemovePrimitiveArray (const Handle(OpenGl_Context)& theGlCtx,
- CALL_DEF_PARRAY* thePArray)
-{
- OpenGl_ElementNode *prevnode = NULL, *node = myFirst;
- while (node != NULL)
- {
- if (node->type == TelParray)
- {
- CALL_DEF_PARRAY* aCurPArray = ((const OpenGl_PrimitiveArray* )node->elem)->PArray();
-
- // validate for correct pointer
- if (aCurPArray->num_bounds == thePArray->num_bounds &&
- aCurPArray->num_edges == thePArray->num_edges &&
- aCurPArray->num_vertexs == thePArray->num_vertexs &&
- aCurPArray->type == thePArray->type)
- {
- (prevnode ? prevnode->next : myFirst) = node->next;
- if (!myFirst) myLast = NULL;
- OpenGl_Element::Destroy (theGlCtx, node->elem);
- delete node;
- break;
- }
- }
- prevnode = node;
- node = node->next;
- }
-}
-
-/*----------------------------------------------------------------------*/
-
void OpenGl_Group::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
{
// Is rendering in ADD or IMMEDIATE mode?
void AddElement (const TelType, OpenGl_Element * );
- void RemovePrimitiveArray (const Handle(OpenGl_Context)& theGlCtx,
- CALL_DEF_PARRAY* thePArray);
-
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theGlCtx);
#include <OpenGl_Element.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
-#include <Graphic3d_Array1OfVertexC.hxx>
class OpenGl_Polyline : public OpenGl_Element
{
if (myString) delete[] myString;
myString = wstr;
- Standard_Real X, Y, Z;
- APoint.Coord(X, Y, Z);
- myAttachPnt.xyz[0] = float (X);
- myAttachPnt.xyz[1] = float (Y);
- myAttachPnt.xyz[2] = float (Z);
+ myAttachPnt.xyz[0] = APoint.X();
+ myAttachPnt.xyz[1] = APoint.Y();
+ myAttachPnt.xyz[2] = APoint.Z();
myParam.Height = int (AHeight);
#ifndef OPENGL_TSM_H
#define OPENGL_TSM_H
-#define OCC1188 /* SAV 23/12/02 Added structure to control background texture
-+ enum to control texture fill method
-*/
+// OCC1188 SAV 23/12/02 Added structure to control background texture enum to control texture fill method
typedef enum
{
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Text.hxx>
void Prs3d_AnglePresentation::Draw (
const gp_Pnt& AttachmentPoint1,
const gp_Pnt& AttachmentPoint2,
const gp_Pnt& AttachmentPoint3,
- const gp_Pnt& OffsetPoint) {
+ const gp_Pnt& OffsetPoint)
+{
+ Handle(Prs3d_AngleAspect) AA = aDrawer->AngleAspect();
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(AA->LineAspect()->Aspect());
-
- Handle(Prs3d_AngleAspect) AA = aDrawer->AngleAspect();
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(AA->LineAspect()->Aspect());
gp_Vec V1 (AttachmentPoint1,AttachmentPoint2);
gp_Vec V2 (AttachmentPoint1,AttachmentPoint3);
- Standard_Real alpha = V1.Angle(V2);
- Standard_Real ray = AttachmentPoint1.Distance(OffsetPoint);
-
+ const Standard_Real alpha = V1.Angle(V2);
+ const Standard_Real ray = AttachmentPoint1.Distance(OffsetPoint);
gp_Dir I (V1);
- gp_Dir K = I.Crossed(gp_Dir(V2));
+ gp_Dir K = I.Crossed(gp_Dir(V2));
gp_Dir J = K.Crossed(I);
-//
- Standard_Real xc,yc,zc;
- AttachmentPoint1.Coord(xc,yc,zc);
- Graphic3d_Array1OfVertex V(1,2);
- Standard_Real x1,y1,z1,x2,y2,z2;
- AttachmentPoint2.Coord(x1,y1,z1);
- AttachmentPoint3.Coord(x2,y2,z2);
- Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
- Standard_Real dteta = alpha/(nbp-1);
- Standard_Real x,y,z;
+
+ const Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
+ const Standard_Real dteta = alpha/(nbp-1);
gp_Vec u;
- for (Standard_Integer i = 1; i<=nbp; i++) {
- u = (gp_Vec(I) * Cos ( (i-1) * dteta)
- + gp_Vec(J) * Sin ( (i-1) * dteta)) * ray ;
- u.Coord(x,y,z);
- if(i == 1) {
- V(1).SetCoord( xc + x, yc + y, zc + z);
- V(2).SetCoord( x1,y1,z1);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);}
- else {
- V(2).SetCoord( xc + x, yc + y, zc + z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
- if( i == nbp ) {
- Standard_Real a1,b1,c1,a2,b2,c2;
- V(1).Coord(a1,b1,c1); gp_Pnt pt1(a1,b1,c1);
- V(2).Coord(a2,b2,c2); gp_Pnt pt2(a2,b2,c2);
- gp_Dir dir( gp_Vec(pt1 , pt2) );
- Prs3d_Arrow::Draw(aPresentation,pt2,dir,AA->ArrowAspect()->Angle(),
- AA->ArrowAspect()->Length());
- }
- V(1)=V(2);
- }
- }
- V(2).SetCoord(x2,y2,z2);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
- u = (gp_Vec(I) * Cos ( alpha/2.)
- + gp_Vec(J) * Sin ( alpha/2.)) * ray ;
- u.Coord(x,y,z);
- Prs3d_Text::Draw(aPresentation,AA->TextAspect(),aText,
- gp_Pnt(xc+x,yc+y,zc+z));
-}
+ gp_Pnt p1, p2;
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp+2);
+ aPrims->AddVertex(AttachmentPoint2);
+ for (Standard_Integer i = 1; i<=nbp; i++)
+ {
+ u = (gp_Vec(I) * Cos ( (i-1) * dteta)
+ + gp_Vec(J) * Sin ( (i-1) * dteta)) * ray ;
+ p2 = AttachmentPoint1.Translated(u);
+ aPrims->AddVertex(p2);
+ if( i == nbp ) {
+ gp_Dir dir( gp_Vec(p1,p2) );
+ Prs3d_Arrow::Draw(aPresentation,p2,dir,AA->ArrowAspect()->Angle(),AA->ArrowAspect()->Length());
+ }
+ p1 = p2;
+ }
+ aPrims->AddVertex(AttachmentPoint3);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ u = (gp_Vec(I) * Cos (0.5*alpha)
+ + gp_Vec(J) * Sin (0.5*alpha)) * ray ;
+ Prs3d_Text::Draw(aPresentation,AA->TextAspect(),aText,AttachmentPoint1.Translated(u));
+}
#include <Prs3d_Arrow.ixx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
//=======================================================================
//function : Draw
void Prs3d_Arrow::Draw(const Handle(Prs3d_Presentation)& aPresentation,
const gp_Pnt& aLocation,
- const gp_Dir& aDirection,
+ const gp_Dir& aDirection,
const Quantity_PlaneAngle anAngle,
- const Quantity_Length aLength) {
-
+ const Quantity_Length aLength)
+{
Quantity_Length dx,dy,dz; aDirection.Coord(dx,dy,dz);
//
// Point of the arrow:
Quantity_Length Norme = sqrt ( xi*xi + yi*yi + zi*zi );
xi = xi / Norme; yi = yi / Norme; zi = zi/Norme;
- Quantity_Length xj = dy * zi - dz * yi;
- Quantity_Length yj = dz * xi - dx * zi;
- Quantity_Length zj = dx * yi - dy * xi;
+ const Quantity_Length xj = dy * zi - dz * yi;
+ const Quantity_Length yj = dz * xi - dx * zi;
+ const Quantity_Length zj = dx * yi - dy * xi;
- Standard_Integer NbPoints = 15;
+ const Standard_Integer NbPoints = 15;
- Graphic3d_Array1OfVertex VN(1,NbPoints+1);
- Graphic3d_Array1OfVertex V2(1,2);
- V2(1).SetCoord(xo,yo,zo);
+ Handle(Graphic3d_ArrayOfSegments) aPrims1 = new Graphic3d_ArrayOfSegments(2*NbPoints);
+ Handle(Graphic3d_ArrayOfPolylines) aPrims2 = new Graphic3d_ArrayOfPolylines(NbPoints+1);
- Quantity_Length x,y,z;
- Standard_Real cosinus,sinus, Tg=tan(anAngle);
+ gp_Pnt p1;
+ const Standard_Real Tg=tan(anAngle);
- for (Standard_Integer i = 1 ; i <= NbPoints ; i++) {
+ for (Standard_Integer i = 1; i <= NbPoints ; i++)
+ {
+ const Standard_Real cosinus = cos ( 2 * M_PI / NbPoints * (i-1) );
+ const Standard_Real sinus = sin ( 2 * M_PI / NbPoints * (i-1) );
- cosinus = cos ( 2 * M_PI / NbPoints * (i-1) );
- sinus = sin ( 2 * M_PI / NbPoints * (i-1) );
+ const gp_Pnt pp(xc + (cosinus * xi + sinus * xj) * aLength * Tg,
+ yc + (cosinus * yi + sinus * yj) * aLength * Tg,
+ zc + (cosinus * zi + sinus * zj) * aLength * Tg);
- x = xc + (cosinus * xi + sinus * xj) * aLength * Tg;
- y = yc + (cosinus * yi + sinus * yj) * aLength * Tg;
- z = zc + (cosinus * zi + sinus * zj) * aLength * Tg;
-
- VN(i).SetCoord(x,y,z);
- if(i==1) VN(NbPoints+1).SetCoord(x,y,z);
- V2(2).SetCoord(x,y,z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V2);
+ aPrims1->AddVertex(aLocation);
+ aPrims1->AddVertex(pp);
+ if(i==1) p1 = pp;
+ aPrims2->AddVertex(pp);
}
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VN);
+ aPrims2->AddVertex(p1);
+
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims1);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims2);
}
//=======================================================================
const gp_Pnt& /*aLocation*/,
const gp_Dir& /*aDirection*/,
const Quantity_PlaneAngle /*anAngle*/,
- const Quantity_Length /*aLength*/)
+ const Quantity_Length /*aLength*/)
{
}
#include <Prs3d_DatumAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
void Prs3d_Datum::Add( const Handle(Prs3d_Presentation)& aPresentation,
const anyDatum& aDatum,
- const Handle(Prs3d_Drawer)& aDrawer ) {
-
+ const Handle(Prs3d_Drawer)& aDrawer )
+{
Handle(Prs3d_DatumAspect) DA = aDrawer->DatumAspect();
-
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
Quantity_Color Col; Aspect_TypeOfLine Tol; Standard_Real W;
DA->FirstAxisAspect()->Aspect()->Values(Col,Tol,W);
- Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d
- (Aspect_TOM_BALL,Col,.1);
+ Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d(Aspect_TOM_BALL,Col,.1);
gp_Ax2 Axis = DatumTool::Ax2(aDatum);
gp_Pnt Orig = Axis.Location();
// Trace d'une petite sphere au debut du vecteur:
//
- Quantity_Length xo,yo,zo,x,y,z;
-
+ Quantity_Length xo,yo,zo;
Orig.Coord(xo,yo,zo);
G->SetPrimitivesAspect(Asp);
G->Marker(Graphic3d_Vertex (xo,yo,zo));
-
- Graphic3d_Array1OfVertex A(1,2);
- A(1).SetCoord(xo,yo,zo);
-
Quantity_Length DS;
-
-#ifdef IMP120100
Quantity_Length arrowAngle = aDrawer->ArrowAspect()->Angle();
Quantity_Length textHeight = aDrawer->TextAspect()->Height();
-#endif
- if (DA->DrawFirstAndSecondAxis()) {
- oX.Coord(x,y,z);
+ Handle(Graphic3d_ArrayOfSegments) aPrims;
+ if (DA->DrawFirstAndSecondAxis())
+ {
DS = DA->FirstAxisLength();
- x = xo + x*DS; y = yo + y*DS; z = zo + z*DS;
- A(2).SetCoord(x,y,z);
+ const gp_Pnt p1(Orig.XYZ() + oX.XYZ()*DS);
+
G->SetPrimitivesAspect(DA->FirstAxisAspect()->Aspect());
- G->Polyline(A);
-#ifdef IMP120100
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(Orig);
+ aPrims->AddVertex(p1);
+ G->AddPrimitiveArray(aPrims);
+
G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
- Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oX,arrowAngle,DS/10.);
+ Prs3d_Arrow::Draw(aPresentation,p1,oX,arrowAngle,DS/10.);
G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
- G->Text(Standard_CString("X"),A(2),16.);
-#else
- Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oX,M_PI/180.*10.,DS/10.);
- Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("X"),A(2),1./81.);
-#endif
-}
- if (DA->DrawFirstAndSecondAxis()) {
- oY.Coord(x,y,z);
+ Graphic3d_Vertex v1(p1.X(),p1.Y(),p1.Z());
+ G->Text(Standard_CString("X"),v1,16.);
+
DS = DA->SecondAxisLength();
- x = xo + x*DS; y = yo + y*DS; z = zo + z*DS;
- A(2).SetCoord(x,y,z);
+ const gp_Pnt p2(Orig.XYZ() + oY.XYZ()*DS);
+
G->SetPrimitivesAspect(DA->SecondAxisAspect()->Aspect());
- G->Polyline(A);
-#ifdef IMP120100
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(Orig);
+ aPrims->AddVertex(p2);
+ G->AddPrimitiveArray(aPrims);
+
G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
- Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oY,arrowAngle,DS/10.);
+ Prs3d_Arrow::Draw(aPresentation,p2,oY,arrowAngle,DS/10.);
G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
- G->Text(Standard_CString("Y"),A(2),16.);
-#else
- Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oY,M_PI/180.*10.,DS/10.);
- Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("Y"),A(2),1./81.);
-#endif
-}
- if (DA->DrawThirdAxis()) {
- oZ.Coord(x,y,z);
+ Graphic3d_Vertex v2(p2.X(),p2.Y(),p2.Z());
+ G->Text(Standard_CString("Y"),v2,16.);
+ }
+ if (DA->DrawThirdAxis())
+ {
DS = DA->ThirdAxisLength();
- x = xo + x*DS; y = yo + y*DS; z = zo + z*DS;
- A(2).SetCoord(x,y,z);
+ const gp_Pnt p3(Orig.XYZ() + oZ.XYZ()*DS);
+
G->SetPrimitivesAspect(DA->ThirdAxisAspect()->Aspect());
- G->Polyline(A);
-#ifdef IMP120100
+ aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(Orig);
+ aPrims->AddVertex(p3);
+ G->AddPrimitiveArray(aPrims);
+
G->SetPrimitivesAspect(aDrawer->ArrowAspect()->Aspect());
- Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oZ,arrowAngle,DS/10.);
+ Prs3d_Arrow::Draw(aPresentation,p3,oZ,arrowAngle,DS/10.);
G->SetPrimitivesAspect(aDrawer->TextAspect()->Aspect());
- G->Text(Standard_CString("Z"),A(2),16.);
-#else
- Prs3d_Root::CurrentGroup(aPresentation)->Text(Standard_CString("Z"),A(2),1./81.);
- Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x,y,z),oZ,M_PI/180.*10.,DS/10.);
-#endif
-}
+ Graphic3d_Vertex v3(p3.X(),p3.Y(),p3.Z());
+ G->Text(Standard_CString("Z"),v3,16.);
+ }
}
aGroup->SetPrimitivesAspect(aDrawer->SeenLineAspect()->Aspect());
- aGroup->BeginPrimitives();
Standard_Real anAngle = aDrawer->DeviationAngle();
TColgp_SequenceOfPnt Points;
for (i=1;i<=NbEdge;i++){
CurvePresentation::Add(aPresentation,TheCurve,U1,U2,def, Points, anAngle);
}
}
- aGroup->EndPrimitives();
- if(aDrawer->DrawHiddenLine()){
+ if(aDrawer->DrawHiddenLine())
+ {
aGroup->SetPrimitivesAspect(aDrawer->HiddenLineAspect()->Aspect());
- aGroup->BeginPrimitives();
for (i=1;i<=NbEdge;i++){
for(Tool.InitHidden(i);Tool.MoreHidden();Tool.NextHidden()){
Tool.Hidden(TheCurve,U1,U2);
CurvePresentation::Add(aPresentation,TheCurve,U1,U2,def, Points, anAngle);
}
}
- aGroup->EndPrimitives();
}
}
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Text.hxx>
void Prs3d_LengthPresentation::Draw (
const TCollection_ExtendedString& aText,
const gp_Pnt& AttachmentPoint1,
const gp_Pnt& AttachmentPoint2,
- const gp_Pnt& OffsetPoint) {
-
-
+ const gp_Pnt& OffsetPoint)
+{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
+
gp_Dir D (gp_Vec(AttachmentPoint1,AttachmentPoint2));
gp_Lin L (OffsetPoint,D);
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L,AttachmentPoint1),L);
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L,AttachmentPoint2),L);
- Graphic3d_Array1OfVertex V(1,2);
- Quantity_Length X,Y,Z;
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(4);
+ aPrims->AddVertex(AttachmentPoint1);
+ aPrims->AddVertex(Proj1);
+ aPrims->AddVertex(Proj2);
+ aPrims->AddVertex(AttachmentPoint2);
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+ Quantity_Length X,Y,Z;
Proj1.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
-
- AttachmentPoint1.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
+ if (LA->DrawFirstArrow())
+ Prs3d_Arrow::Draw(aPresentation,Proj1,D.Reversed(),LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
-
- Proj2.Coord(X,Y,Z);
- V(2).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
- AttachmentPoint2.Coord(X,Y,Z);
- V(1).SetCoord(X,Y,Z);
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(V);
-
- Proj1.Coord(X,Y,Z);
- if (LA->DrawFirstArrow()) {
- Prs3d_Arrow::Draw(aPresentation,Proj1,D.Reversed(),
- LA->Arrow1Aspect()->Angle(),
- LA->Arrow1Aspect()->Length());
- }
Quantity_Length X2,Y2,Z2;
Proj2.Coord(X2,Y2,Z2);
- if (LA->DrawSecondArrow()) {
- Prs3d_Arrow::Draw(aPresentation,Proj2,D,
- LA->Arrow2Aspect()->Angle(),
- LA->Arrow2Aspect()->Length());
- }
-
- gp_Pnt p;
- p.SetCoord( (X+X2)/2. , (Y+Y2)/2. , (Z+Z2)/2.);
+ if (LA->DrawSecondArrow())
+ Prs3d_Arrow::Draw(aPresentation,Proj2,D,LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
+ gp_Pnt p( .5*(X+X2), .5*(Y+Y2), .5*(Z+Z2) );
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,p);
}
-
-
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d.hxx>
-static void DrawLine (const anyLine& aLine,
- const Handle(Graphic3d_Group)& aGroup) {
-
- Standard_Integer Count=0;
+static void DrawLine (const anyLine& aLine, const Handle(Graphic3d_Group)& aGroup)
+{
Quantity_Length x,y,z;
- Standard_Integer Lower = LineTool::Lower(aLine);
- Standard_Integer Upper = LineTool::Upper(aLine);
-
- Graphic3d_Array1OfVertex VertexArray(1,Upper-Lower+1);
+ Standard_Integer i = LineTool::Lower(aLine);
+ const Standard_Integer Upper = LineTool::Upper(aLine);
- for (Standard_Integer i=Lower;i<=Upper;i++){
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(Upper-i+1);
+ for (; i <= Upper; i++) {
LineTool::Coord(aLine,i,x,y,z);
- VertexArray(++Count).SetCoord(x,y,z);
+ aPrims->AddVertex((Standard_ShortReal)x,(Standard_ShortReal)y,(Standard_ShortReal)z);
}
- aGroup->Polyline(VertexArray);
+ aGroup->AddPrimitiveArray(aPrims);
}
void Prs3d_Line::Add (const Handle (Prs3d_Presentation)& aPresentation,
const anyLine& aLine,
- const Handle (Prs3d_Drawer)& aDrawer){
-
-// Prs3d_Root::NewGroup(aPresentation);
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->LineAspect()->Aspect());
DrawLine(aLine,TheGroup);
}
}
}
-void Prs3d_Line::Add (const Handle (Prs3d_Presentation)& aPresentation,
- const anyLine& aLine){
-
+void Prs3d_Line::Add (const Handle (Prs3d_Presentation)& aPresentation, const anyLine& aLine)
+{
DrawLine (aLine,Prs3d_Root::CurrentGroup(aPresentation));
-
}
Standard_Integer Prs3d_Line::Pick
const Quantity_Length aDistance,
const anyLine& aLine,
const Handle (Prs3d_Drawer)& aDrawer,
- const Prs3d_TypeOfLinePicking TypeOfPicking){
-
-
- Standard_Integer Lower = LineTool::Lower(aLine);
- Standard_Integer Upper = LineTool::Upper(aLine);
+ const Prs3d_TypeOfLinePicking TypeOfPicking)
+{
+ Standard_Integer i = LineTool::Lower(aLine);
+ const Standard_Integer Upper = LineTool::Upper(aLine);
Standard_Integer num = 0;
Quantity_Length X1,Y1,Z1,X2,Y2,Z2,dist;
Standard_Real DistMin = RealLast();
- for (Standard_Integer i=Lower;i<=Upper;i++){
+ for (; i <= Upper; i++)
+ {
LineTool::Coord(aLine,i,X2,Y2,Z2);
switch (TypeOfPicking) {
- case Prs3d_TOLP_Point: {
- dist = Abs(X-X2)+Abs(Y-Y2)+ Abs(Z-Z2);
- if(dist < aDistance) {
- if (dist < DistMin) {
- DistMin = dist;
- num = i;
- }
+ case Prs3d_TOLP_Point: {
+ dist = Abs(X-X2)+Abs(Y-Y2)+ Abs(Z-Z2);
+ if(dist < aDistance) {
+ if (dist < DistMin) {
+ DistMin = dist;
+ num = i;
+ }
+ }
+ break;
}
- }
- break;
- case Prs3d_TOLP_Segment: {
- if (i > 1) {
- if (Prs3d::MatchSegment
- (X,Y,Z,aDistance,gp_Pnt(X1,Y1,Z1),gp_Pnt(X2,Y2,Z2),dist)){
- if(dist < aDistance) {
- if (dist < DistMin) {
- DistMin = dist;
- num = i;
- }
- }
- }
+ case Prs3d_TOLP_Segment: {
+ if (i > 1) {
+ if (Prs3d::MatchSegment(X,Y,Z,aDistance,gp_Pnt(X1,Y1,Z1),gp_Pnt(X2,Y2,Z2),dist)) {
+ if(dist < aDistance) {
+ if (dist < DistMin) {
+ DistMin = dist;
+ num = i;
+ }
+ }
+ }
+ }
+ X1=X2;Y1=Y2;Z1=Z2;
+ break;
}
- X1=X2;Y1=Y2;Z1=Z2;
- }
- break;
}
}
- return num;
+ return num;
}
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_PointAspect.hxx>
static void DrawPoint (const anyPoint& aPoint,
- const Handle(Graphic3d_Group) aGroup) {
-
+ const Handle(Graphic3d_Group) aGroup)
+{
Quantity_Length x,y,z;
PointTool::Coord(aPoint,x,y,z);
Graphic3d_Vertex Vertex(x,y,z);
void Prs3d_Point::Add (const Handle (Prs3d_Presentation)& aPresentation,
const anyPoint& aPoint,
- const Handle (Prs3d_Drawer)& aDrawer){
-
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->PointAspect()->Aspect());
DrawPoint(aPoint,TheGroup);
}
-void Prs3d_Point::Add (const Handle (Prs3d_Presentation)& aPresentation,
- const anyPoint& aPoint){
-
+void Prs3d_Point::Add (const Handle (Prs3d_Presentation)& aPresentation, const anyPoint& aPoint)
+{
DrawPoint(aPoint,Prs3d_Root::CurrentGroup(aPresentation));
}
const Quantity_Length X,
const Quantity_Length Y,
const Quantity_Length Z,
- const Quantity_Length aDistance) {
-
+ const Quantity_Length aDistance)
+{
Quantity_Length x,y,z;
PointTool::Coord(aPoint,x,y,z);
return Sqrt( (X-x)*(X-x) + (Y-y)*(Y-y) + (Z-z)*(Z-z) ) <= aDistance;
#include <Prs3d_LineAspect.hxx>
#include <gp_Vec.hxx>
#include <gp_Pnt.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
void Prs3d_Vector::Add(const Handle(Prs3d_Presentation)& aPresentation,
{
gp_Pnt Pnt = VectorTool::Location(aVector);
gp_Vec Vec = VectorTool::Vec(aVector);
- Quantity_Length x1,y1,z1,dx,dy,dz;
- Pnt.Coord(x1,y1,z1);
- Vec.Coord(dx,dy,dz);
+ gp_Pnt Pnt2 = Pnt.Translated(Vec);
Handle(Graphic3d_Group) G = Prs3d_Root::CurrentGroup(aPresentation);
G->SetPrimitivesAspect(aDrawer->VectorAspect()->Aspect());
Quantity_Color Col; Aspect_TypeOfLine Tol; Standard_Real W;
aDrawer->VectorAspect()->Aspect()->Values(Col,Tol,W);
- Graphic3d_Array1OfVertex A(1,2);
//
// Trace d'une petite sphere au debut du vecteur:
//
- Graphic3d_Vertex VTX;
- VTX.SetCoord(x1,y1,z1);
- Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d
- (Aspect_TOM_BALL,Col,1.);
+ Quantity_Length x1,y1,z1;
+ Pnt.Coord(x1,y1,z1);
+ Graphic3d_Vertex VTX(x1,y1,z1);
+ Handle(Graphic3d_AspectMarker3d) Asp = new Graphic3d_AspectMarker3d(Aspect_TOM_BALL,Col,1.);
G->SetPrimitivesAspect(Asp);
G->Marker(VTX);
- A(1).SetCoord(x1,y1,z1);
- A(2).SetCoord(x1+dx,y1+dy,z1+dz);
- G->Polyline(A);
- Prs3d_Arrow::Draw(aPresentation,gp_Pnt(x1+dx,y1+dy,z1+dz),gp_Dir(Vec),
- M_PI/180.*10.,Sqrt(dx*dx+dy*dy+dz*dz)/10.);
-
-}
-
-
-
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(Pnt);
+ aPrims->AddVertex(Pnt2);
+ G->AddPrimitiveArray(aPrims);
+ Prs3d_Arrow::Draw(aPresentation,Pnt2,gp_Dir(Vec),M_PI/180.*10.,Vec.Magnitude()/10.);
+}
// and conditions governing the rights and limitations under the License.
#include <Hatch_Hatcher.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_Group.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <GCPnts_UniformDeflection.hxx>
#include <Adaptor3d_IsoCurve.hxx>
-#ifdef DEBUG
-#include <OSD_Timer.hxx>
-extern OSD_Timer RestrictedFaceTimer1,RestrictedFaceTimer2,RestrictedFaceTimer3,RestrictedFaceTimer4;
-#endif
-
-
//=========================================================================
// function: Add
const Handle(Prs3d_Drawer)& aDrawer,
Prs3d_NListOfSequenceOfPnt& Curves)
{
-
-#ifdef DEBUG
- RestrictedFaceTimer1.Start();
-#endif
-
RestrictionTool ToolRst (aFace);
Standard_Real aLimit = aDrawer->MaximalParameterValue();
}
}
-#ifdef DEBUG
- RestrictedFaceTimer1.Stop();
-
- RestrictedFaceTimer2.Start();
-#endif
-
// load the isos
Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
Standard_Boolean UClosed = aFace->IsUClosed();
}
}
-#ifdef DEBUG
- RestrictedFaceTimer2.Stop();
- RestrictedFaceTimer3.Start();
-#endif
-
// trim the isos
gp_Pnt2d P1,P2;
Standard_Real U1, U2;
}
}
-#ifdef DEBUG
- RestrictedFaceTimer3.Stop();
- RestrictedFaceTimer4.Start();
-#endif
-
// draw the isos
-
Adaptor3d_IsoCurve anIso;
anIso.Load(aFace);
Standard_Integer NumberOfLines = isobuild.NbLines();
DrawFaceIso::Add(aPresentation,anIso,Deflection, aLimit);
}
}
-#ifdef DEBUG
- RestrictedFaceTimer4.Stop();
-#endif
-
}
void Prs3d_WFDeflectionRestrictedFace::Add
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer){
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
-
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
- TheGroup->BeginPrimitives();
-
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Prs3d_WFDeflectionRestrictedFace::Add (
aPresentation,
aFace,
Standard_True,
Standard_True,
- Deflection,
- finu,
- finv,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
aDrawer);
-
- TheGroup->EndPrimitives();
}
void Prs3d_WFDeflectionRestrictedFace::AddUIso
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Prs3d_WFDeflectionRestrictedFace::Add (
aPresentation,
aFace,
Standard_True,
Standard_False,
- Deflection,
- finu,
- finv,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
aDrawer);
}
void Prs3d_WFDeflectionRestrictedFace::AddVIso
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
- Prs3d_WFDeflectionRestrictedFace::Add (
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
+ Prs3d_WFDeflectionRestrictedFace::Add (
aPresentation,
aFace,
Standard_False,
Standard_True,
- Deflection,
- finu,
- finv,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
aDrawer);
}
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer){
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
return Prs3d_WFDeflectionRestrictedFace::Match (
X,Y,Z,aDistance,
- aFace,
- aDrawer,
- Standard_True,
- Standard_True,
- Deflection,
- finu,
- finv);
+ aFace,
+ aDrawer,
+ Standard_True,
+ Standard_True,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number());
}
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
Standard_Integer finu = aDrawer->UIsoAspect()->Number();
Standard_Integer finv = aDrawer->VIsoAspect()->Number();
return Prs3d_WFDeflectionRestrictedFace::Match (
X,Y,Z,aDistance,
- aFace,
- aDrawer,
- Standard_True,
- Standard_False,
- Deflection,
- finu,
- finv);
+ aFace,
+ aDrawer,
+ Standard_True,
+ Standard_False,
+ Deflection,
+ finu,
+ finv);
}
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
return Prs3d_WFDeflectionRestrictedFace::Match (
X,Y,Z,aDistance,
- aFace,
- aDrawer,
- Standard_False,
- Standard_True,
- Deflection,
- finu,
- finv);
+ aFace,
+ aDrawer,
+ Standard_False,
+ Standard_True,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number());
}
-
-
// and conditions governing the rights and limitations under the License.
-
-#ifdef DEBUG
-#include <OSD_Timer.hxx>
-extern OSD_Timer RestrictedFaceTimer1,RestrictedFaceTimer2,RestrictedFaceTimer3,RestrictedFaceTimer4;
-#endif
-
#include <Hatch_Hatcher.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
-#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_Group.hxx>
#include <gp_Pnt.hxx>
#include <Prs3d_IsoAspect.hxx>
const Handle(Prs3d_Drawer)& aDrawer,
Prs3d_NListOfSequenceOfPnt& Curves)
{
- Standard_Boolean isPA = Graphic3d_ArrayOfPrimitives::IsEnable();
Standard_Real aLimit = aDrawer->MaximalParameterValue();
Standard_Integer nbPoints = aDrawer->Discretisation();
-#ifdef DEBUG
- RestrictedFaceTimer1.Start();
-#endif
-
RestrictionTool ToolRst (aFace);
// compute bounds of the restriction
VMax = aFace->Surface().LastVParameter();
}
-#ifdef DEBUG
- RestrictedFaceTimer1.Stop();
-
- RestrictedFaceTimer2.Start();
-#endif
-
// load the isos
Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
Standard_Boolean UClosed = aFace->IsUClosed();
}
}
-#ifdef DEBUG
- RestrictedFaceTimer2.Stop();
- RestrictedFaceTimer3.Start();
-#endif
-
// trim the isos
Standard_Real U1, U2, U, DU;
}
}
-#ifdef DEBUG
- RestrictedFaceTimer3.Stop();
- RestrictedFaceTimer4.Start();
-#endif
-
// draw the isos
-
-
Adaptor3d_IsoCurve anIso;
anIso.Load(aFace);
Handle(Geom_Curve) BC;
BC = GB->VIso(Coord);
//Note that the isos are the part of the shape, it will be displayed after a computation the whole shape
//NbPoints = 30 - default parameter for computation of such curves
- DrawFaceIso::Add(aPresentation,GeomAdaptor_Curve(BC), b1, b2, aDeflection, Pnts, 30, !isPA);
+ DrawFaceIso::Add(aPresentation,GeomAdaptor_Curve(BC), b1, b2, aDeflection, Pnts, 30, Standard_False);
Curves.Append(Pnts);
}
else {
anIso.Load(GeomAbs_IsoU,Coord,b1,b2);
else
anIso.Load(GeomAbs_IsoV,Coord,b1,b2);
- DrawFaceIso::Add(aPresentation,anIso, aDeflection, aDrawer, Pnts, !isPA);
+ DrawFaceIso::Add(aPresentation,anIso, aDeflection, aDrawer, Pnts, Standard_False);
Curves.Append(Pnts);
}
}
}
-#ifdef DEBUG
- RestrictedFaceTimer4.Stop();
-#endif
}
}
}
-
- return Standard_False;
+ return Standard_False;
}
-
//=========================================================================
// function: Add
// purpose
void Prs3d_WFRestrictedFace::Add
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer){
-
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
- Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
-
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
- TheGroup->BeginPrimitives();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Prs3d_NListOfSequenceOfPnt Curves;
Prs3d_WFRestrictedFace::Add (
aPresentation,
aFace,
Standard_True,
Standard_True,
- aDeflection,
- finu,
- finv,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
aDrawer,
Curves);
-
- TheGroup->EndPrimitives();
}
void Prs3d_WFRestrictedFace::AddUIso
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
- Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Prs3d_NListOfSequenceOfPnt Curves;
Prs3d_WFRestrictedFace::Add (
aPresentation,
aFace,
Standard_True,
Standard_False,
- aDeflection,
- finu,
- finv,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
aDrawer,
Curves);
}
void Prs3d_WFRestrictedFace::AddVIso
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
- Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Prs3d_NListOfSequenceOfPnt Curves;
Prs3d_WFRestrictedFace::Add (
aPresentation,
aFace,
Standard_False,
Standard_True,
- aDeflection,
- finu,
- finv,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
aDrawer,
Curves);
}
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer){
-
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
- Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
return Prs3d_WFRestrictedFace::Match (
X,Y,Z,aDistance,
- aFace,
- Standard_True,
- Standard_True,
- aDeflection,
- finu,
- finv,
- aDrawer);
+ aFace,
+ Standard_True,
+ Standard_True,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
+ aDrawer);
}
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
- Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
return Prs3d_WFRestrictedFace::Match (
X,Y,Z,aDistance,
- aFace,
- Standard_True,
- Standard_False,
- aDeflection,
- finu,
- finv,
- aDrawer);
+ aFace,
+ Standard_True,
+ Standard_False,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
+ aDrawer);
}
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
- Quantity_Length aDeflection = aDrawer->MaximalChordialDeviation();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
return Prs3d_WFRestrictedFace::Match (
X,Y,Z,aDistance,
- aFace,
- Standard_False,
- Standard_True,
- aDeflection,
- finu,
- finv,
- aDrawer);
+ aFace,
+ Standard_False,
+ Standard_True,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
+ aDrawer);
}
#include <BRepAdaptor_HSurface.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Poly_Connect.hxx>
#include <Prs3d_NListOfSequenceOfPnt.hxx>
#include <Prs3d_NListIteratorOfListOfSequenceOfPnt.hxx>
-#ifdef DEB_MESH
-#include <OSD_Timer.hxx>
-extern OSD_Timer RestrictedFaceTimer1,RestrictedFaceTimer2,RestrictedFaceTimer3,RestrictedFaceTimer4;
-extern OSD_Timer ShapeTimer;
-extern OSD_Timer FaceExplorerTimer, CurveExplorerTimer;
-extern OSD_Timer UIsoTimer,VIsoTimer,WireTimer,FreeBoundaryTimer,UnFreeBoundaryTimer;
-#endif
-
static Standard_Boolean IsSame(const Handle(Graphic3d_AspectLine3d)& UAspect,
const Handle(Graphic3d_AspectLine3d)& VAspect)
{
static Standard_Boolean AddPolygon(const TopoDS_Edge& E,
- Handle(Graphic3d_Group)& TheGroup,
- const Standard_Real deflection,
- const Handle (Prs3d_Drawer)& ,
- TColgp_SequenceOfPnt& Pnts)
+ Handle(Graphic3d_Group)& TheGroup,
+ const Standard_Real deflection,
+ const Handle (Prs3d_Drawer)& ,
+ TColgp_SequenceOfPnt& Pnts)
{
TopLoc_Location l;
- gp_Pnt P;
- Standard_Boolean result = Standard_False;
- Standard_Boolean IsPrimArray = Graphic3d_ArrayOfPrimitives::IsEnable();
- Standard_Boolean OK;
Standard_Real fi, la;
-
- Handle(Poly_Polygon3D) Polyg;
Handle(Geom_Curve) CC3d = BRep_Tool::Curve(E, fi, la);
-
- Polyg = BRep_Tool::Polygon3D(E, l);
- if (!Polyg.IsNull()) {
- OK = Polyg->Deflection() <= deflection;
- OK = OK || (CC3d.IsNull());
+ Handle(Poly_Polygon3D) Polyg = BRep_Tool::Polygon3D(E, l);
- if (OK) {
- result = Standard_True;
+ if (!Polyg.IsNull()) {
+ if ((Polyg->Deflection() <= deflection) || CC3d.IsNull()) {
const TColgp_Array1OfPnt& Points = Polyg->Nodes();
- Graphic3d_Array1OfVertex V(1, Points.Length());
- Standard_Integer po, ii = 1;
+ Standard_Integer po = Points.Lower();
if (l.IsIdentity()) {
- for (po = Points.Lower(); po <= Points.Upper(); po++) {
- P = Points.Value(po);
- V(ii).SetCoord(P.X(), P.Y(), P.Z());
- Pnts.Append(P);
- ii++;
- }
+ for (; po <= Points.Upper(); po++)
+ Pnts.Append(Points.Value(po));
}
else {
- for (po = Points.Lower(); po <= Points.Upper(); po++) {
- P = Points.Value(po).Transformed(l);
- V(ii).SetCoord(P.X(), P.Y(), P.Z());
- Pnts.Append(P);
- ii++;
- }
+ for (; po <= Points.Upper(); po++)
+ Pnts.Append(Points.Value(po).Transformed(l));
}
- if(!IsPrimArray)
- TheGroup->Polyline(V);
- return result;
+ return Standard_True;
}
}
Handle(Poly_PolygonOnTriangulation) HIndices;
BRep_Tool::PolygonOnTriangulation(E, HIndices, Tr, l);
if (!HIndices.IsNull()) {
-
- OK = HIndices->Deflection() <= deflection;
- OK = OK || (CC3d.IsNull());
-
- if (OK) {
- result = Standard_True;
+ if ((HIndices->Deflection() <= deflection) || CC3d.IsNull()) {
const TColStd_Array1OfInteger& Indices = HIndices->Nodes();
const TColgp_Array1OfPnt& Nodes = Tr->Nodes();
- Graphic3d_Array1OfVertex V(1, Indices.Length());
- Standard_Integer po, ii = 1;
+ Standard_Integer po = Indices.Lower();
if (l.IsIdentity()) {
- for (po = Indices.Lower(); po <= Indices.Upper(); po++) {
- P = Nodes(Indices(po));
- V(ii).SetCoord(P.X(), P.Y(), P.Z());
- Pnts.Append(P);
- ii++;
- }
+ for (; po <= Indices.Upper(); po++)
+ Pnts.Append(Nodes(Indices(po)));
}
else {
- for (po = Indices.Lower(); po <= Indices.Upper(); po++) {
- P = Nodes(Indices(po)).Transformed(l);
- V(ii).SetCoord(P.X(), P.Y(), P.Z());
- Pnts.Append(P);
- ii++;
- }
+ for (; po <= Indices.Upper(); po++)
+ Pnts.Append(Nodes(Indices(po)).Transformed(l));
}
- if(!IsPrimArray)
- TheGroup->Polyline(V);
- return result;
+ return Standard_True;
}
}
- return result;
+ return Standard_False;
}
-
-
-
-
//=========================================================================
// function: Add
// purpose
{
if (aShape.IsNull()) return;
- Standard_Boolean isPrimArrayEnabled = Graphic3d_ArrayOfPrimitives::IsEnable();
-#ifdef DEB_MESH
- RestrictedFaceTimer1.Reset();
- RestrictedFaceTimer2.Reset();
- RestrictedFaceTimer3.Reset();
- RestrictedFaceTimer4.Reset();
-#endif
-
-#ifdef DEB_MESH
- ShapeTimer.Start();
-#endif
Prs3d_ShapeTool Tool(aShape);
TopTools_ListOfShape LFree, LUnFree, LWire;
for (Tool.InitCurve();Tool.MoreCurve();Tool.NextCurve())
default: LUnFree.Append(E);
}
}
-#ifdef DEB_MESH
- ShapeTimer.Stop();
-#endif
-
-#ifdef DEB_MESH
- RestrictedFaceTimer1.Start();
-#endif
Standard_Real aDeflection;
if (aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE)
else
aDeflection = aDrawer->MaximalChordialDeviation();
-#ifdef DEB_MESH
- RestrictedFaceTimer1.Stop();
-#endif
-
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
Prs3d_NListOfSequenceOfPnt UIsoCurves;
{
const Standard_Integer isoU = aDrawer->UIsoAspect()->Number();
const Standard_Integer isoV = aDrawer->VIsoAspect()->Number();
-#ifdef DEB_MESH
- UIsoTimer.Start();
-#endif
if (isoU || isoV)
{
- if(!isPrimArrayEnabled) {
- TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
- TheGroup->BeginPrimitives();
- }
BRepAdaptor_Surface S;
for (Tool.InitFace();Tool.MoreFace();Tool.NextFace())
{
}
catch (Standard_Failure)
{
-#ifdef DEB_MESH
- const TopoDS_Face& FF = S.Face();
- cout <<"probleme pour les isos de la face "<< (void*) &(*(FF).TShape()) << endl;
-#endif
}
}
}
}
- if(!isPrimArrayEnabled)
- TheGroup->EndPrimitives();
}
-#ifdef DEB_MESH
- UIsoTimer.Stop();
-#endif
}
else
{
const Standard_Integer isoU = aDrawer->UIsoAspect()->Number();
const Standard_Integer isoV = aDrawer->VIsoAspect()->Number();
-#ifdef DEB_MESH
- UIsoTimer.Start();
-#endif
if (isoU)
{
- if(!isPrimArrayEnabled) {
- TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
- TheGroup->BeginPrimitives();
- }
BRepAdaptor_Surface S;
for (Tool.InitFace();Tool.MoreFace();Tool.NextFace())
{
}
}
}
- if(!isPrimArrayEnabled)
- TheGroup->EndPrimitives();
}
-#ifdef DEB_MESH
- UIsoTimer.Stop();
- VIsoTimer.Start();
-#endif
if (isoV)
{
- if(!isPrimArrayEnabled) {
- TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
- TheGroup->BeginPrimitives();
- }
BRepAdaptor_Surface S;
for (Tool.InitFace();Tool.MoreFace();Tool.NextFace())
{
}
}
}
- if (!isPrimArrayEnabled) TheGroup->EndPrimitives();
}
-#ifdef DEB_MESH
- VIsoTimer.Stop();
-#endif
}
Standard_Integer nbVertices = 0, nbBounds = 0;
- if(isPrimArrayEnabled) {
- if(UIsoCurves.Size() > 0) {
- nbBounds = UIsoCurves.Size();
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(UIsoCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
- Handle(Graphic3d_ArrayOfPolylines) UIsoArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for( It.Init(UIsoCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- UIsoArray->AddBound(Pnts.Length());
- for(int i=1; i<=Pnts.Length(); i++)
- UIsoArray->AddVertex(Pnts.Value(i));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
- TheGroup->BeginPrimitives();
- TheGroup->AddPrimitiveArray(UIsoArray);
- TheGroup->EndPrimitives();
- }
+ if(UIsoCurves.Size() > 0) {
+ nbBounds = UIsoCurves.Size();
+ Prs3d_NListIteratorOfListOfSequenceOfPnt It;
+ for( It.Init(UIsoCurves); It.More(); It.Next())
+ nbVertices += It.Value().Length();
+ Handle(Graphic3d_ArrayOfPolylines) UIsoArray =
+ new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
+ for( It.Init(UIsoCurves); It.More(); It.Next()) {
+ TColgp_SequenceOfPnt Pnts;
+ Pnts.Assign(It.Value());
+ UIsoArray->AddBound(Pnts.Length());
+ for(int i=1; i<=Pnts.Length(); i++)
+ UIsoArray->AddVertex(Pnts.Value(i));
+ }
+ Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
+ TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
+ TheGroup->AddPrimitiveArray(UIsoArray);
+ }
- if(VIsoCurves.Size() > 0) {
- nbBounds = VIsoCurves.Size();
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(VIsoCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
- Handle(Graphic3d_ArrayOfPolylines) VIsoArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for( It.Init(VIsoCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- VIsoArray->AddBound(Pnts.Length());
- for(int i=1; i<=Pnts.Length(); i++)
- VIsoArray->AddVertex(Pnts.Value(i));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
- TheGroup->BeginPrimitives();
- TheGroup->AddPrimitiveArray(VIsoArray);
- TheGroup->EndPrimitives();
+ if(VIsoCurves.Size() > 0) {
+ nbBounds = VIsoCurves.Size();
+ Prs3d_NListIteratorOfListOfSequenceOfPnt It;
+ for( It.Init(VIsoCurves); It.More(); It.Next())
+ nbVertices += It.Value().Length();
+ Handle(Graphic3d_ArrayOfPolylines) VIsoArray =
+ new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
+ for( It.Init(VIsoCurves); It.More(); It.Next()) {
+ TColgp_SequenceOfPnt Pnts;
+ Pnts.Assign(It.Value());
+ VIsoArray->AddBound(Pnts.Length());
+ for(int i=1; i<=Pnts.Length(); i++)
+ VIsoArray->AddVertex(Pnts.Value(i));
}
+ Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
+ TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
+ TheGroup->AddPrimitiveArray(VIsoArray);
}
-#ifdef DEB_MESH
- WireTimer.Start();
-#endif
- if(!isPrimArrayEnabled) {
- TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
- TheGroup->BeginPrimitives();
- }
gp_Pnt P;
TopLoc_Location l;
Graphic3d_Vertex V1, V2;
gp_Pnt P2 = Nodes(Free(2*i)).Transformed(l);
SurfPnts.Append(P1);
SurfPnts.Append(P2);
- if(!isPrimArrayEnabled) {
- V1.SetCoord(P1.X(), P1.Y(), P1.Z());
- V2.SetCoord(P2.X(), P2.Y(), P2.Z());
- TheGroup->Polyline(V1, V2);
- }
}
}
if(DispTriangles) {
gp_Pnt P2 = Nodes(Internal(2*i)).Transformed(l);
SurfPnts.Append(P1);
SurfPnts.Append(P2);
- if(!isPrimArrayEnabled) {
- V1.SetCoord(P1.X(), P1.Y(), P1.Z());
- V2.SetCoord(P2.X(), P2.Y(), P2.Z());
- TheGroup->Polyline(V1, V2);
- }
}
}
}
}
}
- if(!isPrimArrayEnabled)
- TheGroup->EndPrimitives();
- if(isPrimArrayEnabled && SurfPnts.Length()>0){
+ if(SurfPnts.Length()>0){
nbVertices = SurfPnts.Length();
nbBounds = (Standard_Integer)nbVertices / 2;
Handle(Graphic3d_ArrayOfPolylines) SurfArray =
SurfArray->AddVertex(SurfPnts.Value(i+1));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- if(DispTriangles && Tool.HasSurface()) {
+ if(DispTriangles && Tool.HasSurface())
TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
- }
- else {
+ else
TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
- }
- TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(SurfArray);
- TheGroup->EndPrimitives();
}
TopTools_ListIteratorOfListOfShape It;
{
// Wire (without any neighbour)
TheGroup->SetPrimitivesAspect(aDrawer->WireAspect()->Aspect());
- TheGroup->BeginPrimitives();
for (It.Initialize(LWire); It.More(); It.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(It.Value());
try
if (!AddPolygon(E, TheGroup, aDeflection, aDrawer, Pnts)) {
if (BRep_Tool::IsGeometric(E)) {
BRepAdaptor_Curve C(E);
- CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, !isPrimArrayEnabled);
+ CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, Standard_False);
WireCurves.Append(Pnts);
}
}
#endif
}
}
- TheGroup->EndPrimitives();
}
-#ifdef DEB_MESH
- WireTimer.Stop();
- FreeBoundaryTimer.Start();
-#endif
-
if (aDrawer->FreeBoundaryDraw())
{
// Free boundaries;
- if(!isPrimArrayEnabled) {
- TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
- TheGroup->BeginPrimitives();
- }
for (It.Initialize(LFree); It.More(); It.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(It.Value());
if (!BRep_Tool::Degenerated(E)) {
if (!AddPolygon(E, TheGroup, aDeflection, aDrawer, Pnts)) {
if (BRep_Tool::IsGeometric(E)) {
BRepAdaptor_Curve C(E);
- CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, !isPrimArrayEnabled);
+ CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, Standard_False);
FreeCurves.Append(Pnts);
}
}
}
}
}
- if(!isPrimArrayEnabled)
- TheGroup->EndPrimitives();
}
-#ifdef DEB_MESH
- FreeBoundaryTimer.Stop();
- UnFreeBoundaryTimer.Start();
-#endif
-
if (aDrawer->UnFreeBoundaryDraw()) {
// Unfree boundaries;
- if(!isPrimArrayEnabled) {
- TheGroup->SetPrimitivesAspect(aDrawer->UnFreeBoundaryAspect()->Aspect());
- TheGroup->BeginPrimitives();
- }
for (It.Initialize(LUnFree); It.More(); It.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(It.Value());
try
if (!AddPolygon(E, TheGroup, aDeflection, aDrawer, Pnts)) {
if (BRep_Tool::IsGeometric(E)) {
BRepAdaptor_Curve C(E);
- CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, !isPrimArrayEnabled);
+ CurvePresentation::Add(aPresentation, C, aDeflection, aDrawer, Pnts, Standard_False);
UnFreeCurves.Append(Pnts);
}
}
#endif
}
}
- if(!isPrimArrayEnabled)
- TheGroup->EndPrimitives();
}
- if(isPrimArrayEnabled) {
- if(WireCurves.Size() > 0) {
- nbBounds = WireCurves.Size();
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(WireCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
- Handle(Graphic3d_ArrayOfPolylines) WireArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for( It.Init(WireCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- WireArray->AddBound(Pnts.Length());
- for(i=1; i<=Pnts.Length(); i++)
- WireArray->AddVertex(Pnts.Value(i));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->WireAspect()->Aspect());
- TheGroup->BeginPrimitives();
- TheGroup->AddPrimitiveArray(WireArray);
- TheGroup->EndPrimitives();
- }
- if(FreeCurves.Size() > 0) {
- nbBounds = FreeCurves.Size();
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(FreeCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
- Handle(Graphic3d_ArrayOfPolylines) FreeArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for( It.Init(FreeCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- FreeArray->AddBound(Pnts.Length());
- for(i=1; i<=Pnts.Length(); i++)
- FreeArray->AddVertex(Pnts.Value(i));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
- TheGroup->BeginPrimitives();
- TheGroup->AddPrimitiveArray(FreeArray);
- TheGroup->EndPrimitives();
- }
- if(UnFreeCurves.Size() > 0) {
- nbBounds = UnFreeCurves.Size();
- Prs3d_NListIteratorOfListOfSequenceOfPnt It;
- for( It.Init(UnFreeCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
- Handle(Graphic3d_ArrayOfPolylines) UnFreeArray =
- new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
- for( It.Init(UnFreeCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- UnFreeArray->AddBound(Pnts.Length());
- for(i=1; i<=Pnts.Length(); i++)
- UnFreeArray->AddVertex(Pnts.Value(i));
- }
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
- TheGroup->SetPrimitivesAspect(aDrawer->UnFreeBoundaryAspect()->Aspect());
- TheGroup->BeginPrimitives();
- TheGroup->AddPrimitiveArray(UnFreeArray);
- TheGroup->EndPrimitives();
- }
+ if(WireCurves.Size() > 0) {
+ nbBounds = WireCurves.Size();
+ Prs3d_NListIteratorOfListOfSequenceOfPnt It;
+ for( It.Init(WireCurves); It.More(); It.Next())
+ nbVertices += It.Value().Length();
+ Handle(Graphic3d_ArrayOfPolylines) WireArray =
+ new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
+ for( It.Init(WireCurves); It.More(); It.Next()) {
+ TColgp_SequenceOfPnt Pnts;
+ Pnts.Assign(It.Value());
+ WireArray->AddBound(Pnts.Length());
+ for(i=1; i<=Pnts.Length(); i++)
+ WireArray->AddVertex(Pnts.Value(i));
+ }
+ Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
+ TheGroup->SetPrimitivesAspect(aDrawer->WireAspect()->Aspect());
+ TheGroup->AddPrimitiveArray(WireArray);
}
- // Points
- Standard_Boolean theFirst = Standard_True;
- for(Tool.InitVertex();Tool.MoreVertex();Tool.NextVertex()){
- if(theFirst){
- theFirst = Standard_False;
- if(!isPrimArrayEnabled) {
- TheGroup->SetPrimitivesAspect(aDrawer->PointAspect()->Aspect());
- TheGroup->BeginPrimitives();
- }
- }
- TopoDS_Vertex V = Tool.GetVertex();
- if(!isPrimArrayEnabled)
- PointPresentation::Add(aPresentation,V);
- ShapePoints.Append(BRep_Tool::Pnt(V));
+ if(FreeCurves.Size() > 0) {
+ nbBounds = FreeCurves.Size();
+ Prs3d_NListIteratorOfListOfSequenceOfPnt It;
+ for( It.Init(FreeCurves); It.More(); It.Next())
+ nbVertices += It.Value().Length();
+ Handle(Graphic3d_ArrayOfPolylines) FreeArray =
+ new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
+ for( It.Init(FreeCurves); It.More(); It.Next()) {
+ TColgp_SequenceOfPnt Pnts;
+ Pnts.Assign(It.Value());
+ FreeArray->AddBound(Pnts.Length());
+ for(i=1; i<=Pnts.Length(); i++)
+ FreeArray->AddVertex(Pnts.Value(i));
+ }
+ Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
+ TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
+ TheGroup->AddPrimitiveArray(FreeArray);
+ }
+ if(UnFreeCurves.Size() > 0) {
+ nbBounds = UnFreeCurves.Size();
+ Prs3d_NListIteratorOfListOfSequenceOfPnt It;
+ for( It.Init(UnFreeCurves); It.More(); It.Next())
+ nbVertices += It.Value().Length();
+ Handle(Graphic3d_ArrayOfPolylines) UnFreeArray =
+ new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
+ for( It.Init(UnFreeCurves); It.More(); It.Next()) {
+ TColgp_SequenceOfPnt Pnts;
+ Pnts.Assign(It.Value());
+ UnFreeArray->AddBound(Pnts.Length());
+ for(i=1; i<=Pnts.Length(); i++)
+ UnFreeArray->AddVertex(Pnts.Value(i));
+ }
+ Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
+ TheGroup->SetPrimitivesAspect(aDrawer->UnFreeBoundaryAspect()->Aspect());
+ TheGroup->AddPrimitiveArray(UnFreeArray);
}
- if (!theFirst) TheGroup->EndPrimitives();
+
+ // Points
+ for(Tool.InitVertex();Tool.MoreVertex();Tool.NextVertex())
+ ShapePoints.Append(BRep_Tool::Pnt(Tool.GetVertex()));
nbVertices = ShapePoints.Length();
- if(isPrimArrayEnabled && nbVertices > 0) {
+ if(nbVertices > 0) {
Graphic3d_Array1OfVertex PointArray(1, nbVertices);
for(i=1; i<=nbVertices; i++)
PointArray.SetValue(i, Graphic3d_Vertex(ShapePoints.Value(i).X(), ShapePoints.Value(i).Y(), ShapePoints.Value(i).Z()));
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->PointAspect()->Aspect());
- TheGroup->BeginPrimitives();
TheGroup->MarkerSet(PointArray);
- TheGroup->EndPrimitives();
}
-
-#ifdef DEB_MESH
- UnFreeBoundaryTimer.Stop();
-// cout << "Restrictions Min Max computation " ;
-// RestrictedFaceTimer1.Show();
-// cout << "Iso loading " ;
-// RestrictedFaceTimer2.Show();
-// cout << "Iso hatching " ;
-// RestrictedFaceTimer3.Show();
-// cout << "Iso drawing " ;
-// RestrictedFaceTimer4.Show();
-#endif
}
break;
}
- aGroup->BeginPrimitives();
aGroup->AddPrimitiveArray (aPrims);
- aGroup->EndPrimitives();
}
void QABugs_PresentableObject::ComputeSelection(const Handle(SelectMgr_Selection)& ,
#include <StdPrs_Curve.ixx>
-#include <Graphic3d_ArrayOfPrimitives.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <TColgp_SequenceOfPnt.hxx>
-static Standard_Integer myN = -1;
-static Standard_Boolean first = Standard_True;
-
//==================================================================
// function: FindLimits
// purpose:
//==================================================================
static void FindLimits(const Adaptor3d_Curve& aCurve,
- const Standard_Real aLimit,
- Standard_Real& First,
- Standard_Real& Last)
+ const Standard_Real aLimit,
+ Standard_Real& First,
+ Standard_Real& Last)
{
First = aCurve.FirstParameter();
Last = aCurve.LastParameter();
Standard_Real delta = 1;
if (firstInf && lastInf) {
do {
- delta *= 2;
- First = - delta;
- Last = delta;
- aCurve.D0(First,P1);
- aCurve.D0(Last,P2);
+ delta *= 2;
+ First = - delta;
+ Last = delta;
+ aCurve.D0(First,P1);
+ aCurve.D0(Last,P2);
} while (P1.Distance(P2) < aLimit);
}
else if (firstInf) {
aCurve.D0(Last,P2);
do {
- delta *= 2;
- First = Last - delta;
- aCurve.D0(First,P1);
+ delta *= 2;
+ First = Last - delta;
+ aCurve.D0(First,P1);
} while (P1.Distance(P2) < aLimit);
}
else if (lastInf) {
aCurve.D0(First,P1);
do {
- delta *= 2;
- Last = First + delta;
- aCurve.D0(Last,P2);
+ delta *= 2;
+ Last = First + delta;
+ aCurve.D0(Last,P2);
} while (P1.Distance(P2) < aLimit);
}
}
}
-
//==================================================================
// function: DrawCurve
// purpose:
//==================================================================
-static void DrawCurve (const Adaptor3d_Curve& aCurve,
+static void DrawCurve (const Adaptor3d_Curve& aCurve,
const Handle(Graphic3d_Group) aGroup,
- const Standard_Integer NbP,
+ const Standard_Integer NbP,
const Standard_Real U1,
const Standard_Real U2,
- TColgp_SequenceOfPnt& Points,
- const Standard_Boolean drawCurve)
+ TColgp_SequenceOfPnt& Points,
+ const Standard_Boolean drawCurve)
{
Standard_Integer nbintervals = 1;
-
+
if (aCurve.GetType() == GeomAbs_BSplineCurve) {
nbintervals = aCurve.NbKnots() - 1;
nbintervals = Max(1, nbintervals/3);
}
- Standard_Boolean isPrimArrayEnabled = Graphic3d_ArrayOfPrimitives::IsEnable() && !drawCurve;
- switch (aCurve.GetType()) {
- case GeomAbs_Line:
+ switch (aCurve.GetType())
+ {
+ case GeomAbs_Line:
{
-#ifdef OCC64
- Graphic3d_Array1OfVertex VertexArray(1, 3);
- gp_Pnt p = aCurve.Value(U1);
- Points.Append(p);
- VertexArray(1).SetCoord(p.X(), p.Y(), p.Z());
- p = aCurve.Value(0.5 * (U1 + U2));
- Points.Append(p);
- VertexArray(2).SetCoord(p.X(), p.Y(), p.Z());
- p = aCurve.Value(U2);
- Points.Append(p);
- VertexArray(3).SetCoord(p.X(), p.Y(), p.Z());
- if(!isPrimArrayEnabled)
- aGroup->Polyline(VertexArray);
-#else
- static Graphic3d_Array1OfVertex VertexLine(1,2);
- gp_Pnt p = aCurve.Value(U1);
- Points.Append(p);
- VertexLine(1).SetCoord(p.X(), p.Y(), p.Z());
- p = aCurve.Value(U2);
- Points.Append(p);
- VertexLine(2).SetCoord(p.X(), p.Y(), p.Z());
- if(!isPrimArrayEnabled)
- aGroup->Polyline(VertexLine);
-#endif
- }
+ gp_Pnt p1 = aCurve.Value(U1);
+ gp_Pnt p2 = aCurve.Value(U2);
+ Points.Append(p1);
+ Points.Append(p2);
+ if(drawCurve)
+ {
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(p1);
+ aPrims->AddVertex(p2);
+ aGroup->AddPrimitiveArray(aPrims);
+ }
+ }
break;
- default:
+ default:
{
- Standard_Real U;
- Standard_Integer N = Max(2, NbP*nbintervals);
- Standard_Real DU = (U2-U1) / (N-1);
+ const Standard_Integer N = Max(2, NbP*nbintervals);
+ const Standard_Real DU = (U2-U1) / (N-1);
gp_Pnt p;
- if (first) {
- myN = N;
- first = Standard_False;
- }
- if (myN == N) {
-
- static Graphic3d_Array1OfVertex VertexArray(1, N);
-
- for (Standard_Integer i = 1; i <= N;i++) {
- U = U1 + (i-1)*DU;
- p = aCurve.Value(U);
- Points.Append(p);
- VertexArray(i).SetCoord(p.X(), p.Y(), p.Z());
- }
- if(!isPrimArrayEnabled)
- aGroup->Polyline(VertexArray);
- }
- else {
- Graphic3d_Array1OfVertex VertexArray2(1, N);
-
- for (Standard_Integer i = 1; i <= N;i++) {
- U = U1 + (i-1)*DU;
- p = aCurve.Value(U);
- Points.Append(p);
- VertexArray2(i).SetCoord(p.X(), p.Y(), p.Z());
- }
- if(!isPrimArrayEnabled)
- aGroup->Polyline(VertexArray2);
+ Handle(Graphic3d_ArrayOfPolylines) aPrims;
+ if(drawCurve)
+ aPrims = new Graphic3d_ArrayOfPolylines(N);
+
+ for (Standard_Integer i = 1; i <= N;i++) {
+ p = aCurve.Value(U1 + (i-1)*DU);
+ Points.Append(p);
+ if(drawCurve)
+ aPrims->AddVertex(p);
}
+ if(drawCurve)
+ aGroup->AddPrimitiveArray(aPrims);
}
}
}
-
//==================================================================
// function: MatchCurve
// purpose:
const Quantity_Length Z,
const Quantity_Length aDistance,
const Adaptor3d_Curve& aCurve,
- const Quantity_Length TheDeflection,
+ const Quantity_Length TheDeflection,
const Standard_Integer NbP,
- const Standard_Real U1,
- const Standard_Real U2)
+ const Standard_Real U1,
+ const Standard_Real U2)
{
Quantity_Length retdist;
- switch (aCurve.GetType()) {
- case GeomAbs_Line:
+ switch (aCurve.GetType())
+ {
+ case GeomAbs_Line:
{
- static Graphic3d_Array1OfVertex VertexArray(1,2);
- gp_Pnt p1 = aCurve.Value(U1);
- if ( Abs(X-p1.X()) + Abs(Y-p1.Y()) + Abs(Z-p1.Z()) <= aDistance)
- return Standard_True;
- gp_Pnt p2 = aCurve.Value(U2);
- if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
- return Standard_True;
- return Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist);
- }
- break;
- case GeomAbs_Circle:
- {Standard_Real Radius = aCurve.Circle().Radius();
- Standard_Real DU = Sqrt(8.0 * TheDeflection / Radius);
- Standard_Real Er = Abs( U2 - U1) / DU;
- Standard_Integer N = Max(2, (Standard_Integer)IntegerPart(Er));
- gp_Pnt p1,p2;
- if ( N > 0) {
- Standard_Real U;
- for (Standard_Integer Index = 1; Index <= N+1; Index++) {
- U = U1 + (Index - 1) * DU;
- p2 = aCurve.Value(U);
- if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
- return Standard_True;
-
- if (Index>1) {
- if (Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist))
- return Standard_True;
- }
- p1=p2;
-
- }
- }
- return Standard_False;
- }
- break;
- default:
+ gp_Pnt p1 = aCurve.Value(U1);
+ if ( Abs(X-p1.X()) + Abs(Y-p1.Y()) + Abs(Z-p1.Z()) <= aDistance)
+ return Standard_True;
+ gp_Pnt p2 = aCurve.Value(U2);
+ if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
+ return Standard_True;
+ return Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist);
+ }
+ case GeomAbs_Circle:
+ {
+ const Standard_Real Radius = aCurve.Circle().Radius();
+ const Standard_Real DU = Sqrt(8.0 * TheDeflection / Radius);
+ const Standard_Real Er = Abs( U2 - U1) / DU;
+ const Standard_Integer N = Max(2, (Standard_Integer)IntegerPart(Er));
+ if ( N > 0) {
+ gp_Pnt p1,p2;
+ for (Standard_Integer Index = 1; Index <= N+1; Index++) {
+ p2 = aCurve.Value(U1 + (Index - 1) * DU);
+ if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
+ return Standard_True;
+
+ if (Index>1) {
+ if (Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist))
+ return Standard_True;
+ }
+ p1=p2;
+ }
+ }
+ break;
+ }
+ default:
{
+ const Standard_Real DU = (U2-U1) / (NbP-1);
gp_Pnt p1,p2;
- Standard_Real U;
- Standard_Real DU = (U2-U1) / (NbP-1);
-
- for (Standard_Integer i=1;i<=NbP;i++) {
- U = U1 + (i-1)*DU;
- p2 = aCurve.Value(U);
- if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
- return Standard_True;
- if (i>1) {
- if (Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist))
- return Standard_True;
- }
- p1=p2;
+ for (Standard_Integer i=1;i<=NbP;i++) {
+ p2 = aCurve.Value(U1 + (i-1)*DU);
+ if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
+ return Standard_True;
+ if (i>1) {
+ if (Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist))
+ return Standard_True;
+ }
+ p1=p2;
}
- return Standard_False;
}
- return Standard_False;
}
return Standard_False;
}
// purpose:
//==================================================================
void StdPrs_Curve::Add (const Handle (Prs3d_Presentation)& aPresentation,
- const Adaptor3d_Curve& aCurve,
- const Handle (Prs3d_Drawer)& aDrawer,
- const Standard_Boolean drawCurve) {
-
- Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect
- (aDrawer->LineAspect()->Aspect());
+ const Adaptor3d_Curve& aCurve,
+ const Handle (Prs3d_Drawer)& aDrawer,
+ const Standard_Boolean drawCurve)
+{
+ Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->LineAspect()->Aspect());
- Standard_Integer NbPoints = aDrawer->Discretisation();
Standard_Real V1, V2;
FindLimits(aCurve, aDrawer->MaximalParameterValue(), V1, V2);
+ const Standard_Integer NbPoints = aDrawer->Discretisation();
TColgp_SequenceOfPnt Pnts;
- DrawCurve(aCurve,
- Prs3d_Root::CurrentGroup(aPresentation),
- NbPoints,
- V1 , V2, Pnts, drawCurve);
+ DrawCurve(aCurve,Prs3d_Root::CurrentGroup(aPresentation),NbPoints,V1,V2,Pnts,drawCurve);
if (aDrawer->LineArrowDraw()) {
gp_Pnt Location;
gp_Vec Direction;
aCurve.D1(aCurve.LastParameter(),Location,Direction);
- Prs3d_Arrow::Draw (aPresentation,
- Location,
- gp_Dir(Direction),
- aDrawer->ArrowAspect()->Angle(),
- aDrawer->ArrowAspect()->Length());
+ Prs3d_Arrow::Draw (aPresentation,Location,gp_Dir(Direction),
+ aDrawer->ArrowAspect()->Angle(),
+ aDrawer->ArrowAspect()->Length());
}
}
// purpose:
//==================================================================
void StdPrs_Curve::Add (const Handle (Prs3d_Presentation)& aPresentation,
- const Adaptor3d_Curve& aCurve,
- const Quantity_Length aDeflection,
- const Handle(Prs3d_Drawer)& aDrawer,
- TColgp_SequenceOfPnt& Points,
- const Standard_Boolean drawCurve)
+ const Adaptor3d_Curve& aCurve,
+ const Quantity_Length aDeflection,
+ const Handle(Prs3d_Drawer)& aDrawer,
+ TColgp_SequenceOfPnt& Points,
+ const Standard_Boolean drawCurve)
{
-
- Standard_Integer NbPoints = aDrawer->Discretisation();
- Standard_Real aLimit = aDrawer->MaximalParameterValue();
Standard_Real V1, V2;
- FindLimits(aCurve, aLimit, V1, V2);
+ FindLimits(aCurve, aDrawer->MaximalParameterValue(), V1, V2);
- DrawCurve(aCurve,
- Prs3d_Root::CurrentGroup(aPresentation),
- NbPoints,
- V1 , V2, Points, drawCurve);
+ const Standard_Integer NbPoints = aDrawer->Discretisation();
+ DrawCurve(aCurve,Prs3d_Root::CurrentGroup(aPresentation),NbPoints,V1,V2,Points,drawCurve);
}
+
//==================================================================
// function: Add
// purpose:
//==================================================================
void StdPrs_Curve::Add (const Handle (Prs3d_Presentation)& aPresentation,
- const Adaptor3d_Curve& aCurve,
- const Standard_Real U1,
- const Standard_Real U2,
- const Quantity_Length aDeflection,
- TColgp_SequenceOfPnt& Points,
- const Standard_Integer NbPoints,
- const Standard_Boolean drawCurve) {
-
- DrawCurve(aCurve,
- Prs3d_Root::CurrentGroup(aPresentation),
- NbPoints,
- U1 , U2, Points, drawCurve);
+ const Adaptor3d_Curve& aCurve,
+ const Standard_Real U1,
+ const Standard_Real U2,
+ const Quantity_Length aDeflection,
+ TColgp_SequenceOfPnt& Points,
+ const Standard_Integer NbPoints,
+ const Standard_Boolean drawCurve)
+{
+ DrawCurve(aCurve,Prs3d_Root::CurrentGroup(aPresentation),NbPoints,U1,U2,Points,drawCurve);
}
-
//==================================================================
// function: Add
// purpose:
//==================================================================
void StdPrs_Curve::Add (const Handle (Prs3d_Presentation)& aPresentation,
- const Adaptor3d_Curve& aCurve,
- const Standard_Real U1,
- const Standard_Real U2,
- const Handle (Prs3d_Drawer)& aDrawer,
- const Standard_Boolean drawCurve) {
-
+ const Adaptor3d_Curve& aCurve,
+ const Standard_Real U1,
+ const Standard_Real U2,
+ const Handle (Prs3d_Drawer)& aDrawer,
+ const Standard_Boolean drawCurve)
+{
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->LineAspect()->Aspect());
- Standard_Integer NbPoints = aDrawer->Discretisation();
Standard_Real V1 = U1;
Standard_Real V2 = U2;
if (Precision::IsNegativeInfinite(V1)) V1 = -aDrawer->MaximalParameterValue();
if (Precision::IsPositiveInfinite(V2)) V2 = aDrawer->MaximalParameterValue();
+ const Standard_Integer NbPoints = aDrawer->Discretisation();
TColgp_SequenceOfPnt Pnts;
- DrawCurve(aCurve,
- Prs3d_Root::CurrentGroup(aPresentation),
- NbPoints,
- V1 , V2, Pnts, drawCurve);
+ DrawCurve(aCurve,Prs3d_Root::CurrentGroup(aPresentation),NbPoints,V1,V2,Pnts,drawCurve);
if (aDrawer->LineArrowDraw()) {
gp_Pnt Location;
gp_Vec Direction;
aCurve.D1(aCurve.LastParameter(),Location,Direction);
- Prs3d_Arrow::Draw (aPresentation,
- Location,
- gp_Dir(Direction),
- aDrawer->ArrowAspect()->Angle(),
- aDrawer->ArrowAspect()->Length());
+ Prs3d_Arrow::Draw (aPresentation,Location,gp_Dir(Direction),
+ aDrawer->ArrowAspect()->Angle(),
+ aDrawer->ArrowAspect()->Length());
}
}
const Quantity_Length Y,
const Quantity_Length Z,
const Quantity_Length aDistance,
- const Adaptor3d_Curve& aCurve,
+ const Adaptor3d_Curve& aCurve,
const Handle (Prs3d_Drawer)& aDrawer)
{
- Standard_Integer NbPoints = aDrawer->Discretisation();
Standard_Real V1, V2;
FindLimits(aCurve, aDrawer->MaximalParameterValue(), V1, V2);
+ const Standard_Integer NbPoints = aDrawer->Discretisation();
return MatchCurve(X,Y,Z,aDistance,aCurve,
- aDrawer->MaximalChordialDeviation(), NbPoints,
- V1 , V2);
+ aDrawer->MaximalChordialDeviation(),NbPoints,V1,V2);
}
+
//==================================================================
// function: Match
// purpose:
const Adaptor3d_Curve& aCurve,
const Quantity_Length aDeflection,
const Standard_Real aLimit,
- const Standard_Integer NbPoints) {
-
+ const Standard_Integer NbPoints)
+{
Standard_Real V1, V2;
FindLimits(aCurve, aLimit, V1, V2);
return MatchCurve(X,Y,Z,aDistance,aCurve,
- aDeflection, NbPoints,
- V1 , V2);
-
+ aDeflection,NbPoints,V1,V2);
}
-
//==================================================================
// function: Match
// purpose:
const Adaptor3d_Curve& aCurve,
const Standard_Real U1,
const Standard_Real U2,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Standard_Real V1 = U1;
Standard_Real V2 = U2;
if (Precision::IsPositiveInfinite(V2)) V2 = aDrawer->MaximalParameterValue();
return MatchCurve(X,Y,Z,aDistance,aCurve,
- aDrawer->MaximalChordialDeviation(),
- aDrawer->Discretisation(),
- V1 , V2);
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->Discretisation(),V1,V2);
}
const Quantity_Length aDeflection,
const Standard_Integer aNbPoints)
{
- return MatchCurve(X,Y,Z,aDistance,aCurve,
- aDeflection, aNbPoints,
- U1 , U2);
+ return MatchCurve(X,Y,Z,aDistance,aCurve,aDeflection,aNbPoints,U1,U2);
}
-
is
-
-
Add(myclass; aPresentation: Presentation from Prs3d;
- aCurve : in out Curve from Adaptor3d;
+ aCurve : in out Curve from Adaptor3d;
aDrawer : Drawer from Prs3d;
- drawCurve : Boolean from Standard = Standard_True);
+ drawCurve : Boolean from Standard = Standard_True);
---Purpose: adds to the presentation aPresentation the drawing of the curve
-- aCurve with respect to the maximal chordial deviation defined
-- it is used if the curve is a part of some shape and PrimitiveArray
-- visualization approach is activated (it is activated by default).
-
-
Add(myclass; aPresentation: Presentation from Prs3d;
- aCurve : in out Curve from Adaptor3d;
+ aCurve : in out Curve from Adaptor3d;
U1, U2 : Real from Standard;
aDrawer : Drawer from Prs3d;
- drawCurve : Boolean from Standard = Standard_True);
+ drawCurve : Boolean from Standard = Standard_True);
---Purpose: adds to the presentation aPresentation the drawing of the curve
-- aCurve with respect to the maximal chordial deviation defined
-- it is used if the curve is a part of some shape and PrimitiveArray
-- visualization approach is activated (it is activated by default).
-
-
-
Add(myclass; aPresentation: Presentation from Prs3d;
- aCurve : in out Curve from Adaptor3d;
+ aCurve : in out Curve from Adaptor3d;
aDeflection : Real from Standard;
aLimit : Real from Standard;
anAngle : Real from Standard = 0.2;
- drawCurve : Boolean from Standard = Standard_True);
+ drawCurve : Boolean from Standard = Standard_True);
---Purpose: adds to the presentation aPresentation the drawing of the curve
-- aCurve with respect to the maximal chordial deviation aDeflection.
-- it is used if the curve is a part of some shape and PrimitiveArray
-- visualization approach is activated (it is activated by default).
-
Add(myclass; aPresentation: Presentation from Prs3d;
- aCurve : in out Curve from Adaptor3d;
+ aCurve : in out Curve from Adaptor3d;
aDeflection : Real from Standard;
aDrawer : Drawer from Prs3d;
Points : out SequenceOfPnt from TColgp;
- drawCurve : Boolean from Standard = Standard_True);
+ drawCurve : Boolean from Standard = Standard_True);
---Purpose: adds to the presentation aPresentation the drawing of the curve
-- aCurve with respect to the maximal chordial deviation aDeflection.
-- The aspect is the current aspect
- -- Points give a sequence of curve points.
+ -- Points give a sequence of curve points.
-- If drawCurve equals Standard_False the curve will not be displayed,
-- it is used if the curve is a part of some shape and PrimitiveArray
-- visualization approach is activated (it is activated by default).
-
-
-
Add(myclass; aPresentation: Presentation from Prs3d;
- aCurve : in out Curve from Adaptor3d;
+ aCurve : in out Curve from Adaptor3d;
U1, U2 : Real from Standard;
aDeflection : Real from Standard;
- Points : out SequenceOfPnt from TColgp;
+ Points : out SequenceOfPnt from TColgp;
anAngle : Real from Standard = 0.2;
- drawCurve : Boolean from Standard = Standard_True);
+ drawCurve : Boolean from Standard = Standard_True);
---Purpose: adds to the presentation aPresentation the drawing of the curve
-- aCurve with respect to the maximal chordial deviation aDeflection.
-- The aspect is the current aspect
-- The drawing will be limited between the points of parameter U1 and U2.
- -- Points give a sequence of curve points.
+ -- Points give a sequence of curve points.
-- If drawCurve equals Standard_False the curve will not be displayed,
-- it is used if the curve is a part of some shape and PrimitiveArray
-- visualization approach is activated (it is activated by default).
-
Match(myclass; X, Y, Z : Length from Quantity;
aDistance : Length from Quantity;
aCurve : Curve from Adaptor3d;
-- chordial deviation defined by the drawer aDrawer is less then aDistance.
-
-
Match(myclass; X, Y, Z : Length from Quantity;
aDistance: Length from Quantity;
aCurve : Curve from Adaptor3d;
-- then aDistance. The drawing is considered between the points
-- of parameter U1 and U2;
-
-
Match(myclass; X,Y,Z : Length from Quantity;
aDistance : Length from Quantity;
aCurve : Curve from Adaptor3d;
-- aDeflection is less then aDistance.
-
-
Match(myclass; X, Y, Z : Length from Quantity;
aDistance : Length from Quantity;
aCurve : Curve from Adaptor3d;
-- aDeflection is less then aDistance. The drawing is considered
-- between the points of parameter U1 and U2;
-
-
end DeflectionCurve from StdPrs;
-
-
-
#include <StdPrs_DeflectionCurve.ixx>
-#include <Graphic3d_ArrayOfPrimitives.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Arrow.hxx>
// purpose:
//==================================================================
static Standard_Real GetDeflection(const Adaptor3d_Curve& aCurve,
- const Standard_Real U1,
- const Standard_Real U2,
- const Handle(Prs3d_Drawer)& aDrawer) {
- Standard_Real TheDeflection;
- Aspect_TypeOfDeflection TOD = aDrawer->TypeOfDeflection();
- if (TOD == Aspect_TOD_RELATIVE) {
-// On calcule la fleche en fonction des min max globaux de la piece:
- Bnd_Box Total;
- BndLib_Add3dCurve::Add(aCurve, U1, U2, 0.,Total);
- Standard_Real m = RealFirst();
- Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
- Total.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );
- m = RealLast();
- if ( ! (Total.IsOpenXmin() || Total.IsOpenXmax() ))
- m = Abs (aXmax-aXmin);
- if ( ! (Total.IsOpenYmin() || Total.IsOpenYmax() ))
- m = Max ( m , Abs (aYmax-aYmin));
- if ( ! (Total.IsOpenZmin() || Total.IsOpenZmax() ))
- m = Max ( m , Abs (aZmax-aZmin));
+ const Standard_Real U1,
+ const Standard_Real U2,
+ const Handle(Prs3d_Drawer)& aDrawer)
+{
+ Standard_Real TheDeflection;
+
+ if (aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE)
+ {
+ // On calcule la fleche en fonction des min max globaux de la piece:
+ Bnd_Box Total;
+ BndLib_Add3dCurve::Add(aCurve, U1, U2, 0.,Total);
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ Total.Get( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );
+ Standard_Real m = RealLast();
+ if ( ! (Total.IsOpenXmin() || Total.IsOpenXmax() ))
+ m = Abs (aXmax-aXmin);
+ if ( ! (Total.IsOpenYmin() || Total.IsOpenYmax() ))
+ m = Max ( m , Abs (aYmax-aYmin));
+ if ( ! (Total.IsOpenZmin() || Total.IsOpenZmax() ))
+ m = Max ( m , Abs (aZmax-aZmin));
- m = Min ( m , aDrawer->MaximalParameterValue());
- m = Max(m, Precision::Confusion());
+ m = Min ( m , aDrawer->MaximalParameterValue());
+ m = Max(m, Precision::Confusion());
- TheDeflection = m * aDrawer->DeviationCoefficient();
- }
- else
- TheDeflection = aDrawer->MaximalChordialDeviation();
-
- return TheDeflection;
+ TheDeflection = m * aDrawer->DeviationCoefficient();
}
+ else
+ TheDeflection = aDrawer->MaximalChordialDeviation();
+
+ return TheDeflection;
+}
//==================================================================
// function: FindLimits
// purpose:
//==================================================================
-static Standard_Boolean FindLimits(const Adaptor3d_Curve& aCurve,
- const Standard_Real aLimit,
- Standard_Real& First,
- Standard_Real& Last)
+static Standard_Boolean FindLimits(const Adaptor3d_Curve& aCurve,
+ const Standard_Real aLimit,
+ Standard_Real& First,
+ Standard_Real& Last)
{
First = aCurve.FirstParameter();
Last = aCurve.LastParameter();
Standard_Integer count = 0;
if (firstInf && lastInf) {
do {
- if (count++ == 100000) return Standard_False;
- delta *= 2;
- First = - delta;
- Last = delta;
- aCurve.D0(First,P1);
- aCurve.D0(Last,P2);
+ if (count++ == 100000) return Standard_False;
+ delta *= 2;
+ First = - delta;
+ Last = delta;
+ aCurve.D0(First,P1);
+ aCurve.D0(Last,P2);
} while (P1.Distance(P2) < aLimit);
}
else if (firstInf) {
aCurve.D0(Last,P2);
do {
- if (count++ == 100000) return Standard_False;
- delta *= 2;
- First = Last - delta;
- aCurve.D0(First,P1);
+ if (count++ == 100000) return Standard_False;
+ delta *= 2;
+ First = Last - delta;
+ aCurve.D0(First,P1);
} while (P1.Distance(P2) < aLimit);
}
else if (lastInf) {
aCurve.D0(First,P1);
do {
- if (count++ == 100000) return Standard_False;
- delta *= 2;
- Last = First + delta;
- aCurve.D0(Last,P2);
+ if (count++ == 100000) return Standard_False;
+ delta *= 2;
+ Last = First + delta;
+ aCurve.D0(Last,P2);
} while (P1.Distance(P2) < aLimit);
}
}
}
-
-
//==================================================================
// function: DrawCurve
// purpose:
//==================================================================
-static void DrawCurve (Adaptor3d_Curve& aCurve,
+static void DrawCurve (Adaptor3d_Curve& aCurve,
const Handle(Graphic3d_Group) aGroup,
const Quantity_Length TheDeflection,
- const Standard_Real anAngle,
+ const Standard_Real anAngle,
const Standard_Real U1,
const Standard_Real U2,
- TColgp_SequenceOfPnt& Points,
- const Standard_Boolean drawCurve)
+ TColgp_SequenceOfPnt& Points,
+ const Standard_Boolean drawCurve)
{
- Standard_Boolean isPrimArrayEnabled = Graphic3d_ArrayOfPrimitives::IsEnable() && !drawCurve;
-
- switch (aCurve.GetType()) {
- case GeomAbs_Line:
+ switch (aCurve.GetType())
+ {
+ case GeomAbs_Line:
{
-#ifdef OCC64
- Graphic3d_Array1OfVertex VertexArray(1, 3);
- gp_Pnt p = aCurve.Value(U1);
- Points.Append(p);
- VertexArray(1).SetCoord(p.X(), p.Y(), p.Z());
- p = aCurve.Value(0.5 * (U1 + U2));
- Points.Append(p);
- VertexArray(2).SetCoord(p.X(), p.Y(), p.Z());
- p = aCurve.Value(U2);
- Points.Append(p);
- VertexArray(3).SetCoord(p.X(), p.Y(), p.Z());
- if(!isPrimArrayEnabled)
- aGroup->Polyline(VertexArray);
-#else
- static Graphic3d_Array1OfVertex VertexArray(1,2);
- gp_Pnt p = aCurve.Value(U1);
- Points.Append(p);
- VertexArray(1).SetCoord(p.X(), p.Y(), p.Z());
- p = aCurve.Value(U2);
- Points.Append(p);
- VertexArray(2).SetCoord(p.X(), p.Y(), p.Z());
- if(!isPrimArrayEnabled)
- aGroup->Polyline(VertexArray);
-#endif
- }
- break;
- default:
+ gp_Pnt p1 = aCurve.Value(U1);
+ gp_Pnt p2 = aCurve.Value(U2);
+ Points.Append(p1);
+ Points.Append(p2);
+ if(drawCurve)
+ {
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(p1);
+ aPrims->AddVertex(p2);
+ aGroup->AddPrimitiveArray(aPrims);
+ }
+ break;
+ }
+ default:
{
- Standard_Integer nbinter = aCurve.NbIntervals(GeomAbs_C1);
- Standard_Integer i, j;
+ const Standard_Integer nbinter = aCurve.NbIntervals(GeomAbs_C1);
TColStd_Array1OfReal T(1, nbinter+1);
aCurve.Intervals(T, GeomAbs_C1);
+
Standard_Real theU1, theU2;
- Standard_Integer NumberOfPoints;
+ Standard_Integer NumberOfPoints, i, j;
TColgp_SequenceOfPnt SeqP;
for (j = 1; j <= nbinter; j++) {
- theU1 = T(j); theU2 = T(j+1);
- if (theU2 > U1 && theU1 < U2) {
- theU1 = Max(theU1, U1);
- theU2 = Min(theU2, U2);
-
- GCPnts_TangentialDeflection Algo(aCurve, theU1, theU2, anAngle, TheDeflection);
- NumberOfPoints = Algo.NbPoints();
+ theU1 = T(j); theU2 = T(j+1);
+ if (theU2 > U1 && theU1 < U2) {
+ theU1 = Max(theU1, U1);
+ theU2 = Min(theU2, U2);
- if (NumberOfPoints > 0) {
- for (i=1;i<NumberOfPoints;i++) {
- SeqP.Append(Algo.Value(i));
- }
- if (j == nbinter) {
- SeqP.Append(Algo.Value(NumberOfPoints));
- }
- }
- }
+ GCPnts_TangentialDeflection Algo(aCurve, theU1, theU2, anAngle, TheDeflection);
+ NumberOfPoints = Algo.NbPoints();
+
+ if (NumberOfPoints > 0) {
+ for (i=1;i<NumberOfPoints;i++) {
+ SeqP.Append(Algo.Value(i));
+ }
+ if (j == nbinter) {
+ SeqP.Append(Algo.Value(NumberOfPoints));
+ }
+ }
+ }
}
- Graphic3d_Array1OfVertex VertexArray(1, SeqP.Length());
+ Handle(Graphic3d_ArrayOfPolylines) aPrims;
+ if(drawCurve)
+ aPrims = new Graphic3d_ArrayOfPolylines(SeqP.Length());
- Standard_Integer totalpoints = 1;
for (i = 1; i <= SeqP.Length(); i++) {
- const gp_Pnt& p = SeqP.Value(i);
- Points.Append(p);
- VertexArray(totalpoints++).SetCoord(p.X(), p.Y(), p.Z());
+ const gp_Pnt& p = SeqP.Value(i);
+ Points.Append(p);
+ if(drawCurve)
+ aPrims->AddVertex(p);
}
- if(!isPrimArrayEnabled)
- aGroup->Polyline(VertexArray);
+ if(drawCurve)
+ aGroup->AddPrimitiveArray(aPrims);
}
}
-
}
const Quantity_Length Z,
const Quantity_Length aDistance,
const Adaptor3d_Curve& aCurve,
- const Quantity_Length TheDeflection,
+ const Quantity_Length TheDeflection,
const Standard_Real anAngle,
- const Standard_Real U1,
- const Standard_Real U2)
+ const Standard_Real U1,
+ const Standard_Real U2)
{
Quantity_Length retdist;
- switch (aCurve.GetType()) {
- case GeomAbs_Line:
+ switch (aCurve.GetType())
+ {
+ case GeomAbs_Line:
{
- static Graphic3d_Array1OfVertex VertexArray(1,2);
- gp_Pnt p1 = aCurve.Value(U1);
- if ( Abs(X-p1.X()) + Abs(Y-p1.Y()) + Abs(Z-p1.Z()) <= aDistance)
- return Standard_True;
- gp_Pnt p2 = aCurve.Value(U2);
- if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
- return Standard_True;
- return Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist);
- }
- break;
- case GeomAbs_Circle:
+ gp_Pnt p1 = aCurve.Value(U1);
+ if ( Abs(X-p1.X()) + Abs(Y-p1.Y()) + Abs(Z-p1.Z()) <= aDistance)
+ return Standard_True;
+ gp_Pnt p2 = aCurve.Value(U2);
+ if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
+ return Standard_True;
+ return Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist);
+ }
+ case GeomAbs_Circle:
{
- Standard_Real Radius = aCurve.Circle().Radius();
+ const Standard_Real Radius = aCurve.Circle().Radius();
if (!Precision::IsInfinite(Radius)) {
- Standard_Real DU = Sqrt(8.0 * TheDeflection / Radius);
- Standard_Real Er = Abs( U2 - U1) / DU;
- Standard_Integer N = Max(2, (Standard_Integer)IntegerPart(Er));
- gp_Pnt p1,p2;
- if ( N > 0) {
- Standard_Real U;
- for (Standard_Integer Index = 1; Index <= N+1; Index++) {
- U = U1 + (Index - 1) * DU;
- p2 = aCurve.Value(U);
- if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
- return Standard_True;
-
- if (Index>1) {
- if (Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist))
- return Standard_True;
- }
- p1=p2;
-
- }
- }
+ const Standard_Real DU = Sqrt(8.0 * TheDeflection / Radius);
+ const Standard_Real Er = Abs( U2 - U1) / DU;
+ const Standard_Integer N = Max(2, (Standard_Integer)IntegerPart(Er));
+ if ( N > 0) {
+ gp_Pnt p1,p2;
+ for (Standard_Integer Index = 1; Index <= N+1; Index++) {
+ p2 = aCurve.Value(U1 + (Index - 1) * DU);
+ if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
+ return Standard_True;
+
+ if (Index>1) {
+ if (Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist))
+ return Standard_True;
+ }
+ p1=p2;
+ }
+ }
}
- return Standard_False;
- }
- break;
- default:
+ break;
+ }
+ default:
{
GCPnts_TangentialDeflection Algo(aCurve,U1, U2, anAngle, TheDeflection);
- gp_Pnt p1,p2;
- Standard_Integer NumberOfPoints = Algo.NbPoints();
+ const Standard_Integer NumberOfPoints = Algo.NbPoints();
if (NumberOfPoints > 0) {
- for (Standard_Integer i=1;i<=NumberOfPoints;i++) {
- p2 = Algo.Value(i);
- if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
- return Standard_True;
- if (i>1) {
- if (Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist))
- return Standard_True;
- }
- p1=p2;
- }
+ gp_Pnt p1,p2;
+ for (Standard_Integer i=1;i<=NumberOfPoints;i++) {
+ p2 = Algo.Value(i);
+ if ( Abs(X-p2.X()) + Abs(Y-p2.Y()) + Abs(Z-p2.Z()) <= aDistance)
+ return Standard_True;
+ if (i>1) {
+ if (Prs3d::MatchSegment(X,Y,Z,aDistance,p1,p2,retdist))
+ return Standard_True;
+ }
+ p1=p2;
+ }
}
- return Standard_False;
}
}
return Standard_False;
// purpose:
//==================================================================
void StdPrs_DeflectionCurve::Add (const Handle (Prs3d_Presentation)& aPresentation,
- Adaptor3d_Curve& aCurve,
- const Handle (Prs3d_Drawer)& aDrawer,
- const Standard_Boolean drawCurve) {
-
+ Adaptor3d_Curve& aCurve,
+ const Handle (Prs3d_Drawer)& aDrawer,
+ const Standard_Boolean drawCurve)
+{
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->LineAspect()->Aspect());
- Standard_Real V1, V2, angle = aDrawer->DeviationAngle();
- Standard_Boolean OK = FindLimits(aCurve, aDrawer->MaximalParameterValue(), V1, V2);
-
- TColgp_SequenceOfPnt Points;
- if (OK) {
+ Standard_Real V1, V2;
+ if (FindLimits(aCurve, aDrawer->MaximalParameterValue(), V1, V2))
+ {
+ TColgp_SequenceOfPnt Points;
DrawCurve(aCurve,
- Prs3d_Root::CurrentGroup(aPresentation),
- GetDeflection(aCurve, V1, V2, aDrawer),
- angle,
- V1 , V2, Points, drawCurve);
-
+ Prs3d_Root::CurrentGroup(aPresentation),
+ GetDeflection(aCurve, V1, V2, aDrawer),
+ aDrawer->DeviationAngle(),
+ V1, V2, Points, drawCurve);
+
if (aDrawer->LineArrowDraw()) {
gp_Pnt Location;
gp_Vec Direction;
aCurve.D1(V2, Location,Direction);
Prs3d_Arrow::Draw (aPresentation,
- Location,
- gp_Dir(Direction),
- aDrawer->ArrowAspect()->Angle(),
- aDrawer->ArrowAspect()->Length());
+ Location,
+ gp_Dir(Direction),
+ aDrawer->ArrowAspect()->Angle(),
+ aDrawer->ArrowAspect()->Length());
}
}
}
// purpose:
//==================================================================
void StdPrs_DeflectionCurve::Add (const Handle (Prs3d_Presentation)& aPresentation,
- Adaptor3d_Curve& aCurve,
- const Standard_Real U1,
- const Standard_Real U2,
- const Handle (Prs3d_Drawer)& aDrawer,
- const Standard_Boolean drawCurve) {
-
+ Adaptor3d_Curve& aCurve,
+ const Standard_Real U1,
+ const Standard_Real U2,
+ const Handle (Prs3d_Drawer)& aDrawer,
+ const Standard_Boolean drawCurve)
+{
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->LineAspect()->Aspect());
Standard_Real V1 = U1;
Standard_Real V2 = U2;
-
if (Precision::IsNegativeInfinite(V1)) V1 = -aDrawer->MaximalParameterValue();
if (Precision::IsPositiveInfinite(V2)) V2 = aDrawer->MaximalParameterValue();
- Standard_Real angle = aDrawer->DeviationAngle();
TColgp_SequenceOfPnt Points;
DrawCurve(aCurve,
- Prs3d_Root::CurrentGroup(aPresentation),
- GetDeflection(aCurve, V1, V2, aDrawer),
- angle,
- V1 , V2, Points, drawCurve);
+ Prs3d_Root::CurrentGroup(aPresentation),
+ GetDeflection(aCurve, V1, V2, aDrawer),
+ aDrawer->DeviationAngle(),
+ V1 , V2, Points, drawCurve);
if (aDrawer->LineArrowDraw()) {
gp_Pnt Location;
gp_Vec Direction;
aCurve.D1(V2, Location,Direction);
Prs3d_Arrow::Draw (aPresentation,
- Location,
- gp_Dir(Direction),
- aDrawer->ArrowAspect()->Angle(),
- aDrawer->ArrowAspect()->Length());
+ Location,
+ gp_Dir(Direction),
+ aDrawer->ArrowAspect()->Angle(),
+ aDrawer->ArrowAspect()->Length());
}
}
// purpose:
//==================================================================
void StdPrs_DeflectionCurve::Add (const Handle (Prs3d_Presentation)& aPresentation,
- Adaptor3d_Curve& aCurve,
- const Standard_Real U1,
- const Standard_Real U2,
- const Standard_Real aDeflection,
- TColgp_SequenceOfPnt& Points,
- const Standard_Real anAngle,
- const Standard_Boolean drawCurve)
+ Adaptor3d_Curve& aCurve,
+ const Standard_Real U1,
+ const Standard_Real U2,
+ const Standard_Real aDeflection,
+ TColgp_SequenceOfPnt& Points,
+ const Standard_Real anAngle,
+ const Standard_Boolean drawCurve)
{
DrawCurve(aCurve, Prs3d_Root::CurrentGroup(aPresentation),
aDeflection, anAngle, U1, U2, Points, drawCurve);
}
-
//==================================================================
// function: Add
// purpose:
//==================================================================
void StdPrs_DeflectionCurve::Add (const Handle (Prs3d_Presentation)& aPresentation,
- Adaptor3d_Curve& aCurve,
- const Standard_Real aDeflection,
- const Standard_Real aLimit,
- const Standard_Real anAngle,
- const Standard_Boolean drawCurve)
+ Adaptor3d_Curve& aCurve,
+ const Standard_Real aDeflection,
+ const Standard_Real aLimit,
+ const Standard_Real anAngle,
+ const Standard_Boolean drawCurve)
{
Standard_Real V1, V2;
- Standard_Boolean OK = FindLimits(aCurve, aLimit, V1, V2);
-
- TColgp_SequenceOfPnt Points;
- if (OK) DrawCurve(aCurve, Prs3d_Root::CurrentGroup(aPresentation),
- aDeflection, anAngle, V1, V2, Points, drawCurve);
+ if (FindLimits(aCurve, aLimit, V1, V2))
+ {
+ TColgp_SequenceOfPnt Points;
+ DrawCurve(aCurve, Prs3d_Root::CurrentGroup(aPresentation),
+ aDeflection, anAngle, V1, V2, Points, drawCurve);
+ }
}
// purpose:
//================================================================================
void StdPrs_DeflectionCurve::Add (const Handle (Prs3d_Presentation)& aPresentation,
- Adaptor3d_Curve& aCurve,
- const Standard_Real aDeflection,
- const Handle(Prs3d_Drawer)& aDrawer,
- TColgp_SequenceOfPnt& Points,
- const Standard_Boolean drawCurve)
+ Adaptor3d_Curve& aCurve,
+ const Standard_Real aDeflection,
+ const Handle(Prs3d_Drawer)& aDrawer,
+ TColgp_SequenceOfPnt& Points,
+ const Standard_Boolean drawCurve)
{
- Standard_Real aLimit = aDrawer->MaximalParameterValue();
Standard_Real V1, V2;
- Standard_Boolean OK = FindLimits(aCurve, aLimit, V1, V2);
-
- if (OK) DrawCurve(aCurve, Prs3d_Root::CurrentGroup(aPresentation),
- aDeflection, aDrawer->DeviationAngle(), V1, V2, Points, drawCurve);
+ if (FindLimits(aCurve, aDrawer->MaximalParameterValue(), V1, V2))
+ DrawCurve(aCurve, Prs3d_Root::CurrentGroup(aPresentation),
+ aDeflection, aDrawer->DeviationAngle(), V1, V2, Points, drawCurve);
}
const Handle (Prs3d_Drawer)& aDrawer)
{
Standard_Real V1, V2;
- Standard_Boolean OK = FindLimits(aCurve, aDrawer->MaximalParameterValue(), V1, V2);
- if (OK) {
+ if (FindLimits(aCurve, aDrawer->MaximalParameterValue(), V1, V2))
+ {
return MatchCurve(X,Y,Z,aDistance,aCurve,
- GetDeflection(aCurve, V1, V2, aDrawer),
- aDrawer->DeviationAngle(),
- V1 , V2);
- }
- else {
- return Standard_False;
+ GetDeflection(aCurve, V1, V2, aDrawer),
+ aDrawer->DeviationAngle(),
+ V1, V2);
}
+ return Standard_False;
}
-
-
//==================================================================
// function: Match
// purpose:
const Handle (Prs3d_Drawer)& aDrawer)
{
Standard_Real V1 = U1;
- Standard_Real V2 = U2;
+ Standard_Real V2 = U2;
if (Precision::IsNegativeInfinite(V1)) V1 = -aDrawer->MaximalParameterValue();
if (Precision::IsPositiveInfinite(V2)) V2 = aDrawer->MaximalParameterValue();
return MatchCurve(X,Y,Z,aDistance,aCurve,
- GetDeflection(aCurve, V1, V2, aDrawer),
- aDrawer->DeviationAngle(), V1 , V2);
+ GetDeflection(aCurve, V1, V2, aDrawer),
+ aDrawer->DeviationAngle(), V1, V2);
}
-
//==================================================================
// function: Match
// purpose:
//==================================================================
Standard_Boolean StdPrs_DeflectionCurve::Match
(const Quantity_Length X,
- const Quantity_Length Y,
- const Quantity_Length Z,
- const Quantity_Length aDistance,
- const Adaptor3d_Curve& aCurve,
- const Standard_Real U1,
- const Standard_Real U2,
- const Standard_Real aDeflection,
- const Standard_Real anAngle) {
-
-
+ const Quantity_Length Y,
+ const Quantity_Length Z,
+ const Quantity_Length aDistance,
+ const Adaptor3d_Curve& aCurve,
+ const Standard_Real U1,
+ const Standard_Real U2,
+ const Standard_Real aDeflection,
+ const Standard_Real anAngle)
+{
return MatchCurve(X,Y,Z,aDistance,aCurve,aDeflection,anAngle,U1,U2);
-
}
//==================================================================
const Adaptor3d_Curve& aCurve,
const Standard_Real aDeflection,
const Standard_Real aLimit,
- const Standard_Real anAngle) {
-
+ const Standard_Real anAngle)
+{
Standard_Real V1, V2;
- Standard_Boolean OK = FindLimits(aCurve, aLimit, V1, V2);
-
- if (OK) {
- return MatchCurve(X,Y,Z,aDistance,aCurve,
- aDeflection,
- anAngle,
- V1 , V2);
- }
- else {
- return Standard_False;
+ if (FindLimits(aCurve, aLimit, V1, V2))
+ {
+ return MatchCurve(X,Y,Z,aDistance,aCurve,aDeflection,anAngle,V1,V2);
}
-
+ return Standard_False;
}
-
-
-
-
-
#include <TopAbs.hxx>
#include <TopExp_Explorer.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
-#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_LineAspect.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
TopExp_Explorer ex;
- Standard_Boolean isPrimArrayEnabled = Graphic3d_ArrayOfPrimitives::IsEnable();
-
// find vertices not under ancestors.
TopAbs_ShapeEnum E = aShape.ShapeType();
if (E == TopAbs_COMPOUND) {
}
}
- Graphic3d_Array1OfVertex Vertex(1,2);
TColgp_SequenceOfPnt HiddenPnts;
TColgp_SequenceOfPnt SeenPnts;
- Standard_Boolean rel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
- Standard_Real def;
- if (rel) def = aDrawer->HLRDeviationCoefficient();
- else def = aDrawer->MaximalChordialDeviation();
+ const Standard_Boolean rel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE;
+ Standard_Real def = rel? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation();
BRepMesh_IncrementalMesh mesh(aShape, def, rel, aDrawer->HLRAngle());
Handle(HLRBRep_PolyAlgo) hider = new HLRBRep_PolyAlgo(aShape);
hider->Projector(aProjector->Projector());
hider->Angle(aDrawer->HLRAngle());
hider->Update();
- //Standard_Integer i;
Standard_Real sta,end,dx,dy,dz;
Standard_ShortReal tolsta, tolend;
- //gp_Pnt PSta, PEnd;
HLRAlgo_EdgeStatus status;
HLRAlgo_EdgeIterator It;
Standard_Boolean reg1,regn,outl, intl;
HLRBRep_ListOfBPoint BiPntVis, BiPntHid;
- for (hider->InitHide(); hider->MoreHide(); hider->NextHide()) {
+ for (hider->InitHide(); hider->MoreHide(); hider->NextHide())
+ {
hider->Hide(Coordinates, status, S, reg1, regn, outl, intl);
dx = PntX2 - PntX1;
dy = PntY2 - PntY1;
dz = PntZ2 - PntZ1;
- for (It.InitVisible(status); It.MoreVisible(); It.NextVisible()) {
+ for (It.InitVisible(status); It.MoreVisible(); It.NextVisible())
+ {
It.Visible(sta,tolsta,end,tolend);
BiPntVis.Append
- (HLRBRep_BiPoint
- (PntX1 + sta * dx,PntY1 + sta * dy,PntZ1 + sta * dz,
- PntX1 + end * dx,PntY1 + end * dy,PntZ1 + end * dz,
- S,reg1,regn,outl,intl));
+ (HLRBRep_BiPoint
+ (PntX1 + sta * dx,PntY1 + sta * dy,PntZ1 + sta * dz,
+ PntX1 + end * dx,PntY1 + end * dy,PntZ1 + end * dz,
+ S,reg1,regn,outl,intl));
}
- for (It.InitHidden(status); It.MoreHidden(); It.NextHidden()) {
+ for (It.InitHidden(status); It.MoreHidden(); It.NextHidden())
+ {
It.Hidden(sta,tolsta,end,tolend);
BiPntHid.Append
- (HLRBRep_BiPoint
- (PntX1 + sta * dx,PntY1 + sta * dy,PntZ1 + sta * dz,
- PntX1 + end * dx,PntY1 + end * dy,PntZ1 + end * dz,
- S,reg1,regn,outl,intl));
+ (HLRBRep_BiPoint
+ (PntX1 + sta * dx,PntY1 + sta * dy,PntZ1 + sta * dz,
+ PntX1 + end * dx,PntY1 + end * dy,PntZ1 + end * dz,
+ S,reg1,regn,outl,intl));
}
}
-
// storage in the group:
-
HLRBRep_ListIteratorOfListOfBPoint ItB;
if (aDrawer->DrawHiddenLine()) {
- if(!isPrimArrayEnabled) {
- aGroup->SetPrimitivesAspect(aDrawer->HiddenLineAspect()->Aspect());
- aGroup->BeginPrimitives();
- }
for (ItB.Initialize(BiPntHid); ItB.More(); ItB.Next()) {
const HLRBRep_BiPoint& BP = ItB.Value();
if (!BP.RgNLine() || BP.OutLine()) {
- const gp_Pnt& P1 = BP.P1();
- const gp_Pnt& P2 = BP.P2();
- HiddenPnts.Append(P1);
- HiddenPnts.Append(P2);
- Vertex(1).SetCoord(P1.X(), P1.Y(), P1.Z());
- Vertex(2).SetCoord(P2.X(), P2.Y(), P2.Z());
- if(!isPrimArrayEnabled)
- aGroup->Polyline(Vertex);
+ HiddenPnts.Append(BP.P1());
+ HiddenPnts.Append(BP.P2());
}
}
- if(!isPrimArrayEnabled)
- aGroup->EndPrimitives();
}
- if(!isPrimArrayEnabled) {
- aGroup->SetPrimitivesAspect(aDrawer->SeenLineAspect()->Aspect());
- aGroup->BeginPrimitives();
- }
for (ItB.Initialize(BiPntVis); ItB.More(); ItB.Next()) {
const HLRBRep_BiPoint& BP = ItB.Value();
if (!BP.RgNLine() || BP.OutLine()) {
- const gp_Pnt& P1 = BP.P1();
- const gp_Pnt& P2 = BP.P2();
- SeenPnts.Append(P1);
- SeenPnts.Append(P2);
- Vertex(1).SetCoord(P1.X(), P1.Y(), P1.Z());
- Vertex(2).SetCoord(P2.X(), P2.Y(), P2.Z());
- if(!isPrimArrayEnabled)
- aGroup->Polyline(Vertex);
+ SeenPnts.Append(BP.P1());
+ SeenPnts.Append(BP.P2());
}
}
- if(!isPrimArrayEnabled)
- aGroup->EndPrimitives();
- if(isPrimArrayEnabled) {
- Standard_Integer nbVertices = HiddenPnts.Length();
- if(nbVertices > 0) {
- Handle(Graphic3d_ArrayOfPolylines) HiddenArray = new Graphic3d_ArrayOfPolylines(nbVertices, (Standard_Integer)nbVertices/2);
- for(int i=1; i<=nbVertices; i+=2) {
- HiddenArray->AddBound(2);
- HiddenArray->AddVertex(HiddenPnts.Value(i));
- HiddenArray->AddVertex(HiddenPnts.Value(i+1));
- }
- aGroup->SetPrimitivesAspect(aDrawer->HiddenLineAspect()->Aspect());
- aGroup->BeginPrimitives();
- aGroup->AddPrimitiveArray(HiddenArray);
- aGroup->EndPrimitives();
+
+ Standard_Integer nbVertices = HiddenPnts.Length();
+ if(nbVertices > 0) {
+ Handle(Graphic3d_ArrayOfPolylines) HiddenArray = new Graphic3d_ArrayOfPolylines(nbVertices, (Standard_Integer)nbVertices/2);
+ for(int i=1; i<=nbVertices; i+=2) {
+ HiddenArray->AddBound(2);
+ HiddenArray->AddVertex(HiddenPnts.Value(i));
+ HiddenArray->AddVertex(HiddenPnts.Value(i+1));
}
- nbVertices = SeenPnts.Length();
- if(nbVertices > 0) {
- Handle(Graphic3d_ArrayOfPolylines) SeenArray = new Graphic3d_ArrayOfPolylines(nbVertices, (Standard_Integer)nbVertices/2);
- for(int i=1; i<=nbVertices; i+=2) {
- SeenArray->AddBound(2);
- SeenArray->AddVertex(SeenPnts.Value(i));
- SeenArray->AddVertex(SeenPnts.Value(i+1));
- }
- aGroup->SetPrimitivesAspect(aDrawer->SeenLineAspect()->Aspect());
- aGroup->BeginPrimitives();
- aGroup->AddPrimitiveArray(SeenArray);
- aGroup->EndPrimitives();
+ aGroup->SetPrimitivesAspect(aDrawer->HiddenLineAspect()->Aspect());
+ aGroup->AddPrimitiveArray(HiddenArray);
+ }
+ nbVertices = SeenPnts.Length();
+ if(nbVertices > 0) {
+ Handle(Graphic3d_ArrayOfPolylines) SeenArray = new Graphic3d_ArrayOfPolylines(nbVertices, (Standard_Integer)nbVertices/2);
+ for(int i=1; i<=nbVertices; i+=2) {
+ SeenArray->AddBound(2);
+ SeenArray->AddVertex(SeenPnts.Value(i));
+ SeenArray->AddVertex(SeenPnts.Value(i+1));
}
+ aGroup->SetPrimitivesAspect(aDrawer->SeenLineAspect()->Aspect());
+ aGroup->AddPrimitiveArray(SeenArray);
}
}
-
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <StdPrs_Plane.ixx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_Arrow.hxx>
void StdPrs_Plane::Add (const Handle (Prs3d_Presentation)& aPresentation,
- const Adaptor3d_Surface& aPlane,
- const Handle (Prs3d_Drawer)& aDrawer)
+ const Adaptor3d_Surface& aPlane,
+ const Handle (Prs3d_Drawer)& aDrawer)
{
// Prs3d_Root::NewGroup(aPresentation);
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.;
+ Xmax = 0.5*Standard_Real(theaspect->PlaneXLength());
+ Ymax = 0.5*Standard_Real(theaspect->PlaneYLength());
if (theaspect->DisplayEdges()) {
- static Graphic3d_Array1OfVertex EdgesArray(1,5);
TheGroup->SetPrimitivesAspect(theaspect->EdgesAspect()->Aspect());
- thegeom->D0(-Xmax,Ymax,p1);
- EdgesArray(1).SetCoord(p1.X(),p1.Y(),p1.Z());
- EdgesArray(5).SetCoord(p1.X(),p1.Y(),p1.Z());
- thegeom->D0(Xmax,Ymax,p1);
- EdgesArray(2).SetCoord(p1.X(),p1.Y(),p1.Z());
- thegeom->D0(Xmax,-Ymax,p1);
- EdgesArray(3).SetCoord(p1.X(),p1.Y(),p1.Z());
- thegeom->D0(-Xmax,-Ymax,p1);
- EdgesArray(4).SetCoord(p1.X(),p1.Y(),p1.Z());
- TheGroup->Polyline(EdgesArray);
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(5);
+ p1 = thegeom->Value(-Xmax,Ymax);
+ aPrims->AddVertex(p1);
+ aPrims->AddVertex(thegeom->Value( Xmax, Ymax));
+ aPrims->AddVertex(thegeom->Value( Xmax,-Ymax));
+ aPrims->AddVertex(thegeom->Value(-Xmax,-Ymax));
+ aPrims->AddVertex(p1);
+ TheGroup->AddPrimitiveArray(aPrims);
}
if (theaspect->DisplayIso()) {
- static Graphic3d_Array1OfVertex IsoArray(1,2);
TheGroup->SetPrimitivesAspect(theaspect->IsoAspect()->Aspect());
- Standard_Real dist = theaspect->IsoDistance();
+ const Standard_Real dist = theaspect->IsoDistance();
+ const Standard_Integer nbx = Standard_Integer(Abs(2.*Xmax) / dist) - 1;
+ const Standard_Integer nby = Standard_Integer(Abs(2.*Ymax) / dist) - 1;
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2*(nbx+nby));
+ Standard_Integer i;
Standard_Real cur = -Xmax+dist;
- while (cur+dist/2. <= Xmax) {
- thegeom->D0(cur,Ymax,p1);
- IsoArray(1).SetCoord(p1.X(),p1.Y(),p1.Z());
- thegeom->D0(cur,-Ymax,p1);
- IsoArray(2).SetCoord(p1.X(),p1.Y(),p1.Z());
- TheGroup->Polyline(IsoArray);
- cur += dist;
+ for (i = 0; i < nbx; i++, cur += dist) {
+ aPrims->AddVertex(thegeom->Value(cur, Ymax));
+ aPrims->AddVertex(thegeom->Value(cur,-Ymax));
}
cur = -Ymax+dist;
- while (cur+dist/2. < Ymax) {
- thegeom->D0(Xmax,cur,p1);
- IsoArray(1).SetCoord(p1.X(),p1.Y(),p1.Z());
- thegeom->D0(-Xmax,cur,p1);
- IsoArray(2).SetCoord(p1.X(),p1.Y(),p1.Z());
- TheGroup->Polyline(IsoArray);
- cur += dist;
+ for (i = 0; i < nby; i++, cur += dist) {
+ aPrims->AddVertex(thegeom->Value( Xmax,cur));
+ aPrims->AddVertex(thegeom->Value(-Xmax,cur));
}
+ TheGroup->AddPrimitiveArray(aPrims);
}
gp_Dir norm = thegeom->Pln().Axis().Direction();
Quantity_PlaneAngle ang = theaspect->ArrowsAngle();
gp_Vec trans(norm);
trans.Scale(Standard_Real(siz));
+
TheGroup->SetPrimitivesAspect(theaspect->ArrowAspect()->Aspect());
- Graphic3d_Array1OfVertex ArrowArray(1,2);
if (theaspect->DisplayCenterArrow()) {
loc = thegeom->Location();
p1 = loc.Translated(trans);
- ArrowArray(1).SetCoord(loc.X(),loc.Y(),loc.Z());
- ArrowArray(2).SetCoord(p1.X(),p1.Y(),p1.Z());
- TheGroup->Polyline(ArrowArray);
- Prs3d_Arrow::Draw(aPresentation,
- p1,
- norm,
- ang,
- len);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(loc);
+ aPrims->AddVertex(p1);
+ TheGroup->AddPrimitiveArray(aPrims);
+ Prs3d_Arrow::Draw(aPresentation,p1,norm,ang,len);
}
if (theaspect->DisplayEdgesArrows()) {
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(8);
+ //
thegeom->D0(-Xmax,-Ymax,loc);
p1 = loc.Translated(trans);
- ArrowArray(1).SetCoord(loc.X(),loc.Y(),loc.Z());
- ArrowArray(2).SetCoord(p1.X(),p1.Y(),p1.Z());
- TheGroup->Polyline(ArrowArray);
- Prs3d_Arrow::Draw(aPresentation,
- p1,
- norm,
- ang,
- len);
+ aPrims->AddVertex(loc);
+ aPrims->AddVertex(p1);
+ Prs3d_Arrow::Draw(aPresentation,p1,norm,ang,len);
+ //
thegeom->D0(-Xmax,Ymax,loc);
p1 = loc.Translated(trans);
- ArrowArray(1).SetCoord(loc.X(),loc.Y(),loc.Z());
- ArrowArray(2).SetCoord(p1.X(),p1.Y(),p1.Z());
- TheGroup->Polyline(ArrowArray);
- Prs3d_Arrow::Draw(aPresentation,
- p1,
- norm,
- ang,
- len);
+ aPrims->AddVertex(loc);
+ aPrims->AddVertex(p1);
+ Prs3d_Arrow::Draw(aPresentation,p1,norm,ang,len);
+ //
thegeom->D0(Xmax,Ymax,loc);
p1 = loc.Translated(trans);
- ArrowArray(1).SetCoord(loc.X(),loc.Y(),loc.Z());
- ArrowArray(2).SetCoord(p1.X(),p1.Y(),p1.Z());
- TheGroup->Polyline(ArrowArray);
- Prs3d_Arrow::Draw(aPresentation,
- p1,
- norm,
- ang,
- len);
+ aPrims->AddVertex(loc);
+ aPrims->AddVertex(p1);
+ Prs3d_Arrow::Draw(aPresentation,p1,norm,ang,len);
+ //
thegeom->D0(Xmax,-Ymax,loc);
p1 = loc.Translated(trans);
- ArrowArray(1).SetCoord(loc.X(),loc.Y(),loc.Z());
- ArrowArray(2).SetCoord(p1.X(),p1.Y(),p1.Z());
- TheGroup->Polyline(ArrowArray);
- Prs3d_Arrow::Draw(aPresentation,
- p1,
- norm,
- ang,
- len);
+ aPrims->AddVertex(loc);
+ aPrims->AddVertex(p1);
+ Prs3d_Arrow::Draw(aPresentation,p1,norm,ang,len);
+ //
+ TheGroup->AddPrimitiveArray(aPrims);
}
-
}
Standard_Boolean StdPrs_Plane::Match
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <StdPrs_PoleCurve.ixx>
-#include <Graphic3d_Array1OfVertex.hxx>
+
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Arrow.hxx>
GeomAbs_CurveType CType = aCurve.GetType();
if (CType == GeomAbs_BezierCurve || CType == GeomAbs_BSplineCurve) {
- Standard_Real x,y,z;
Standard_Integer i, Nb;
if (CType == GeomAbs_BezierCurve) {
Handle(Geom_BezierCurve) Bz = aCurve.Bezier();
Nb = Bz->NbPoles();
- Graphic3d_Array1OfVertex VertexArray(1, Nb);
- for (i = 1; i <= Nb; i++) {
- (Bz->Pole(i)).Coord(x,y,z);
- VertexArray(i).SetCoord(x,y,z);
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VertexArray);
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(Nb);
+ for (i = 1; i <= Nb; i++)
+ aPrims->AddVertex(Bz->Pole(i));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
else if (CType == GeomAbs_BSplineCurve) {
Handle(Geom_BSplineCurve) Bs = aCurve.BSpline();
Nb = Bs->NbPoles();
- Graphic3d_Array1OfVertex VertexArray(1, Nb);
- for (i = 1; i <= Nb; i++) {
- (Bs->Pole(i)).Coord(x,y,z);
- VertexArray(i).SetCoord(x,y,z);
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VertexArray);
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(Nb);
+ for (i = 1; i <= Nb; i++)
+ aPrims->AddVertex(Bs->Pole(i));
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
}
}
}
}
- Prs3d_Root::CurrentGroup (thePresentation)->BeginPrimitives();
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPArray);
- Prs3d_Root::CurrentGroup (thePresentation)->EndPrimitives();
}
return Standard_True;
}
Handle(Graphic3d_Group) aPrsGrp = Prs3d_Root::NewGroup (thePresentation);
aPrsGrp->SetGroupPrimitivesAspect (aBoundaryAspect);
- aPrsGrp->BeginPrimitives ();
aPrsGrp->AddPrimitiveArray (aSegments);
- aPrsGrp->EndPrimitives ();
}
};
gp_Pnt P1, P2;
gp_Vec D1U, D1V, D1, D2;
- Prs3d_Root::CurrentGroup (thePrs)->BeginPrimitives();
for (Standard_Integer NU = 1; NU <= aNBUintv; ++NU)
{
for (Standard_Integer NV = 1; NV <= aNBVintv; ++NV)
}
Prs3d_Root::CurrentGroup (thePrs)->AddPrimitiveArray (aPArray);
}
- Prs3d_Root::CurrentGroup (thePrs)->EndPrimitives();
}
}
#include <StdPrs_WFDeflectionRestrictedFace.ixx>
#include <Hatch_Hatcher.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
-#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Graphic3d_Group.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
FFaceTimer1.Start();
#endif
- Standard_Boolean isPA = Graphic3d_ArrayOfPrimitives::IsEnable();
-
StdPrs_ToolRFace ToolRst (aFace);
Standard_Real UF, UL, VF, VL;
UF = aFace->FirstUParameter();
FindLimits(GC, aLimit,b1, b2);
if (b2-b1>Precision::Confusion()) {
TColgp_SequenceOfPnt Points;
- StdPrs_DeflectionCurve::Add(aPresentation, GC, b1, b2, Deflection, Points, anAngle, !isPA);
+ StdPrs_DeflectionCurve::Add(aPresentation, GC, b1, b2, Deflection, Points, anAngle, Standard_False);
Curves.Append(Points);
}
}
FindLimits(anIso, aLimit,b1, b2);
if (b2-b1>Precision::Confusion()) {
TColgp_SequenceOfPnt Points;
- StdPrs_DeflectionCurve::Add(aPresentation, anIso, b1, b2, Deflection, Points, anAngle, !isPA);
+ StdPrs_DeflectionCurve::Add(aPresentation, anIso, b1, b2, Deflection, Points, anAngle, Standard_False);
Curves.Append(Points);
}
}
void StdPrs_WFDeflectionRestrictedFace::Add
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer){
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
-
- Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
- TheGroup->BeginPrimitives();
-
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Prs3d_NListOfSequenceOfPnt Curves;
StdPrs_WFDeflectionRestrictedFace::Add (aPresentation,
aFace,
Standard_True,
Standard_True,
- Deflection,
- finu,
- finv,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
aDrawer,
Curves);
-
- TheGroup->EndPrimitives();
}
void StdPrs_WFDeflectionRestrictedFace::AddUIso
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Prs3d_NListOfSequenceOfPnt Curves;
StdPrs_WFDeflectionRestrictedFace::Add (
aPresentation,
aFace,
Standard_True,
Standard_False,
- Deflection,
- finu,
- finv,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
aDrawer,
Curves);
}
void StdPrs_WFDeflectionRestrictedFace::AddVIso
(const Handle (Prs3d_Presentation)& aPresentation,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
Prs3d_NListOfSequenceOfPnt Curves;
StdPrs_WFDeflectionRestrictedFace::Add (
aPresentation,
aFace,
Standard_False,
Standard_True,
- Deflection,
- finu,
- finv,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number(),
aDrawer,
Curves);
}
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer){
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
return StdPrs_WFDeflectionRestrictedFace::Match (
X,Y,Z,aDistance,
- aFace,
- aDrawer,
- Standard_True,
- Standard_True,
- Deflection,
- finu,
- finv);
+ aFace,
+ aDrawer,
+ Standard_True,
+ Standard_True,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number());
}
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
return StdPrs_WFDeflectionRestrictedFace::Match (
X,Y,Z,aDistance,
- aFace,
- aDrawer,
- Standard_True,
- Standard_False,
- Deflection,
- finu,
- finv);
+ aFace,
+ aDrawer,
+ Standard_True,
+ Standard_False,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number());
}
const Quantity_Length Z,
const Quantity_Length aDistance,
const Handle(BRepAdaptor_HSurface)& aFace,
- const Handle (Prs3d_Drawer)& aDrawer) {
-
- Quantity_Length Deflection = aDrawer->MaximalChordialDeviation();
- Standard_Integer finu = aDrawer->UIsoAspect()->Number();
- Standard_Integer finv = aDrawer->VIsoAspect()->Number();
+ const Handle (Prs3d_Drawer)& aDrawer)
+{
return StdPrs_WFDeflectionRestrictedFace::Match (
X,Y,Z,aDistance,
- aFace,
- aDrawer,
- Standard_False,
- Standard_True,
- Deflection,
- finu,
- finv);
+ aFace,
+ aDrawer,
+ Standard_False,
+ Standard_True,
+ aDrawer->MaximalChordialDeviation(),
+ aDrawer->UIsoAspect()->Number(),
+ aDrawer->VIsoAspect()->Number());
}
-
-
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
-
#include <StdPrs_WFPoleSurface.ixx>
+
#include <Graphic3d_Group.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <Prs3d_IsoAspect.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
static void AddPoles(const Handle (Prs3d_Presentation)& aPresentation,
- const TColgp_Array2OfPnt& A,
- const Handle (Prs3d_Drawer)& aDrawer)
+ const TColgp_Array2OfPnt& A,
+ const Handle (Prs3d_Drawer)& aDrawer)
{
Standard_Integer i,j;
- Standard_Real x,y,z;
- Standard_Integer n = A.ColLength();
- Standard_Integer m = A.RowLength();
-
+ const Standard_Integer n = A.ColLength();
+ const Standard_Integer m = A.RowLength();
+
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
-
- Graphic3d_Array1OfVertex VertexArray1(1,m);
-
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(n*m,n);
for (i=1; i<=n; i++){
- for (j=1; j<=m; j++) {
- A(i,j).Coord(x,y,z);
- VertexArray1(j).SetCoord(x,y,z);
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VertexArray1);
+ aPrims->AddBound(m);
+ for (j=1; j<=m; j++)
+ aPrims->AddVertex(A(i,j));
}
-
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
+
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
-
- Graphic3d_Array1OfVertex VertexArray2(1,n);
+ aPrims = new Graphic3d_ArrayOfPolylines(n*m,m);
for (j=1; j<=m; j++){
- for (i=1; i<=n; i++) {
- A(i,j).Coord(x,y,z);
- VertexArray2(i).SetCoord(x,y,z);
- }
- Prs3d_Root::CurrentGroup(aPresentation)->Polyline(VertexArray2);
+ aPrims->AddBound(n);
+ for (i=1; i<=n; i++)
+ aPrims->AddVertex(A(i,j));
}
+ Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
}
Standard_Real U1, U2, V1, V2;
Standard_Real MaxP = aDrawer->MaximalParameterValue();
- Standard_Boolean isPA = Graphic3d_ArrayOfPrimitives::IsEnable();
-
FindLimits(aSurface, MaxP, U1, U2, V1, V2);
Prs3d_NListOfSequenceOfPnt freeCurves;
if ( !UClosed )
{
anIso.Load(GeomAbs_IsoU,U1,V1,V2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, !isPA);
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
freeCurves.Append(Pnts);
Pnts.Clear();
anIso.Load(GeomAbs_IsoU,U2,V1,V2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, !isPA);
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
freeCurves.Append(Pnts);
Pnts.Clear();
}
if ( !VClosed )
{
anIso.Load(GeomAbs_IsoV,V1,U1,U2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, !isPA);
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
freeCurves.Append(Pnts);
Pnts.Clear();
anIso.Load(GeomAbs_IsoV,V2,U1,U2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, !isPA);
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
freeCurves.Append(Pnts);
Pnts.Clear();
}
Standard_Real du= UClosed ? (U2-U1)/fin : (U2-U1)/(1+fin);
for (Standard_Integer i=1; i<=fin;i++){
anIso.Load(GeomAbs_IsoU,U1+du*i,V1,V2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, !isPA);
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
UIsoCurves.Append(Pnts);
Pnts.Clear();
}
Standard_Real dv= VClosed ?(V2-V1)/fin : (V2-V1)/(1+fin);
for (Standard_Integer i=1; i<=fin;i++){
anIso.Load(GeomAbs_IsoV,V1+dv*i,U1,U2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, !isPA);
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
VIsoCurves.Append(Pnts);
Pnts.Clear();
}
}
- if(!Graphic3d_ArrayOfPrimitives::IsEnable())
- return;
Standard_Integer nbVertices = 0, nbBounds = 0;
//Draw surface via primitive array
if(UIsoCurves.Size() > 0) {
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
- TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(UIsoArray);
- TheGroup->EndPrimitives();
}
if(VIsoCurves.Size() > 0) {
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
- TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(VIsoArray);
- TheGroup->EndPrimitives();
}
if(freeCurves.Size() > 0) {
nbBounds = freeCurves.Size();
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());
- TheGroup->BeginPrimitives();
TheGroup->AddPrimitiveArray(freeArray);
- TheGroup->EndPrimitives();
}
}
#include <Select3D_SensitiveFace.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_Structure.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <V3d_PerspectiveView.hxx>
#include <V3d_Plane.hxx>
#include <Select3D_SensitiveEntity.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
#include <SelectBasics_ListOfBox2d.hxx>
#include <Visual3d_TransientManager.hxx>
#include <OSD_Environment.hxx>
#include <V3d.hxx>
#include <V3d_View.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+
static Standard_Integer StdSel_NumberOfFreeEdges (const Handle(Poly_Triangulation)& Trg)
{
// Purpose : Selection using a polyline
//==================================================
-void StdSelect_ViewerSelector3d
-::Pick(const TColgp_Array1OfPnt2d& aPolyline,
- const Handle(V3d_View)& aView)
+void StdSelect_ViewerSelector3d::Pick(const TColgp_Array1OfPnt2d& aPolyline, const Handle(V3d_View)& aView)
{
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
Standard_Integer i;
// Convert pixel
- Handle(TColgp_HArray1OfPnt2d) P2d =
- new TColgp_HArray1OfPnt2d(1,NbPix);
+ Handle(TColgp_HArray1OfPnt2d) P2d = new TColgp_HArray1OfPnt2d(1,NbPix);
for (i = 1; i <= NbPix; ++i)
{
// Purpose : display the activated areas...
//==================================================
-void StdSelect_ViewerSelector3d::
-DisplayAreas(const Handle(V3d_View)& aView)
+void StdSelect_ViewerSelector3d::DisplayAreas(const Handle(V3d_View)& aView)
{
if (myupdatetol && SensitivityMode() == StdSelect_SM_WINDOW)
{
SetSensitivity (aView->Convert (mypixtol));
- myupdatetol = Standard_False;
+ myupdatetol = Standard_False;
}
UpdateProj(aView);
UpdateSort(); // Updates the activated areas
if(mystruct.IsNull())
- {
mystruct = new Graphic3d_Structure(aView->Viewer()->Viewer());
- }
+
if(myareagroup.IsNull())
- {
myareagroup = new Graphic3d_Group(mystruct);
- }
SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive It(myentities);
Handle(Select3D_Projector) prj = StdSelect::GetProjector(aView);
prj->SetView(aView);
-
- Graphic3d_Array1OfVertex Av1 (1,5);
-
Standard_Real xmin,ymin,xmax,ymax;
gp_Pnt Pbid;
SelectBasics_ListOfBox2d BoxList;
- myareagroup->BeginPrimitives();
+ TColgp_SequenceOfPnt aSeqLines;
for (; It.More(); It.Next())
{
It.Value()->Areas(BoxList);
Pbid.SetCoord (xmin - mytolerance, ymin - mytolerance, 0.0);
prj->Transform (Pbid, prj->InvertedTransformation());
- Av1.SetValue (1, Graphic3d_Vertex (Pbid.X(), Pbid.Y(), Pbid.Z()));
+ aSeqLines.Append(Pbid);
Pbid.SetCoord (xmax + mytolerance, ymin - mytolerance, 0.0);
prj->Transform (Pbid, prj->InvertedTransformation());
- Av1.SetValue (2, Graphic3d_Vertex (Pbid.X(), Pbid.Y(), Pbid.Z()));
+ aSeqLines.Append(Pbid);
Pbid.SetCoord (xmax + mytolerance, ymax + mytolerance, 0.0);
prj->Transform (Pbid, prj->InvertedTransformation());
- Av1.SetValue (3, Graphic3d_Vertex (Pbid.X(), Pbid.Y(), Pbid.Z()));
+ aSeqLines.Append(Pbid);
Pbid.SetCoord (xmin - mytolerance, ymax + mytolerance, 0.0);
prj->Transform (Pbid, prj->InvertedTransformation());
- Av1.SetValue (4,Graphic3d_Vertex (Pbid.X(), Pbid.Y(), Pbid.Z()));
-
- Pbid.SetCoord (xmin - mytolerance, ymin - mytolerance, 0.0);
- prj->Transform (Pbid, prj->InvertedTransformation());
- Av1.SetValue (5, Graphic3d_Vertex (Pbid.X(), Pbid.Y(), Pbid.Z()));
+ aSeqLines.Append(Pbid);
+ }
+ }
- myareagroup->Polyline (Av1);
+ if (aSeqLines.Length())
+ {
+ Standard_Integer n, np;
+ const Standard_Integer nbl = aSeqLines.Length() / 4;
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(5*nbl,nbl);
+ for (np = 1, n=0; n<nbl; n++) {
+ aPrims->AddBound(5);
+ const gp_Pnt &p1 = aSeqLines(np++);
+ aPrims->AddVertex(p1);
+ aPrims->AddVertex(aSeqLines(np++));
+ aPrims->AddVertex(aSeqLines(np++));
+ aPrims->AddVertex(aSeqLines(np++));
+ aPrims->AddVertex(p1);
}
+ myareagroup->AddPrimitiveArray(aPrims);
}
- myareagroup->EndPrimitives();
- myareagroup->SetGroupPrimitivesAspect (new
- Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
+ myareagroup->SetGroupPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
myareagroup->Structure()->SetDisplayPriority(10);
myareagroup->Structure()->Display();
// Purpose :
//==================================================
-void StdSelect_ViewerSelector3d::
-ClearAreas(const Handle(V3d_View)& aView)
+void StdSelect_ViewerSelector3d::ClearAreas(const Handle(V3d_View)& aView)
{
if(myareagroup.IsNull()) return;
myareagroup->Clear();
// 10 1. if pers 0. else
//==================================================
-Standard_Boolean StdSelect_ViewerSelector3d::
-UpdateProj(const Handle(V3d_View)& aView)
+Standard_Boolean StdSelect_ViewerSelector3d::UpdateProj(const Handle(V3d_View)& aView)
{
myprevcoeff[ 9] = 0.0;
myprevcoeff[10] = 0.0;
// Remplissage de la structure...
SelectMgr_DataMapIteratorOfDataMapOfSelectionActivation It(myselections);
- // Standard_Integer isel (0);
- mysensgroup->BeginPrimitives();
for (; It.More(); It.Next())
{
if (It.Value()==0)
ComputeSensitivePrs(Sel);
}
}
- mysensgroup->EndPrimitives();
mysensgroup->Structure()->SetDisplayPriority(10);
mystruct->Display();
if(ClearOthers) mysensgroup->Clear();
- mysensgroup->BeginPrimitives();
-
ComputeSensitivePrs(Sel);
- mysensgroup->EndPrimitives();
mystruct->SetDisplayPriority(10);
mystruct->Display();
if(aViou->TransientManagerBeginDraw())
{
if (mystruct.IsNull())
mystruct = new Graphic3d_Structure (aViou->Viewer()->Viewer());
+
if (mysensgroup.IsNull())
{
myareagroup = new Graphic3d_Group (mystruct);
- myareagroup->SetGroupPrimitivesAspect (
- new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
+ myareagroup->SetGroupPrimitivesAspect(new Graphic3d_AspectLine3d (Quantity_NOC_AQUAMARINE1, Aspect_TOL_DASH, 1.0));
}
if(ClearOthers) myareagroup->Clear();
- myareagroup->BeginPrimitives();
ComputeAreasPrs(Sel);
- myareagroup->EndPrimitives();
mystruct->SetDisplayPriority(10);
mystruct->Display();
//purpose :
//=======================================================================
-void StdSelect_ViewerSelector3d::
-ComputeSensitivePrs(const Handle(SelectMgr_Selection)& Sel)
+void StdSelect_ViewerSelector3d::ComputeSensitivePrs(const Handle(SelectMgr_Selection)& Sel)
{
+ TColgp_SequenceOfPnt aSeqLines, aSeqFree;
+ TColStd_SequenceOfInteger aSeqBnds;
+
for(Sel->Init();Sel->More();Sel->Next())
{
- Handle(Select3D_SensitiveEntity) Ent =
- Handle(Select3D_SensitiveEntity)::DownCast(Sel->Sensitive());
- Standard_Boolean hasloc = (Ent.IsNull()) ? Standard_False:
- (Ent->HasLocation()? Standard_True:Standard_False);
+ Handle(Select3D_SensitiveEntity) Ent = Handle(Select3D_SensitiveEntity)::DownCast(Sel->Sensitive());
+ const Standard_Boolean hasloc = (Ent.IsNull()? Standard_False : Ent->HasLocation());
TopLoc_Location theloc;
if(hasloc)
const Bnd_Box& B = Handle(Select3D_SensitiveBox)::DownCast (Ent)->Box();
Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
B.Get (xmin, ymin, zmin, xmax, ymax, zmax);
+ Standard_Integer i;
gp_Pnt theboxpoint[8] =
{
gp_Pnt(xmin,ymin,zmin),
};
if(hasloc)
{
- for (Standard_Integer ii = 0; ii <= 7; ii++)
- theboxpoint[ii].Transform (theloc.Transformation());
+ for (i = 0; i <= 7; i++)
+ theboxpoint[i].Transform (theloc.Transformation());
}
- Graphic3d_Array1OfVertex Vtx (1, 5);
- Standard_Integer ip;
- for (ip = 0; ip < 4; ip++)
- {
- Vtx.SetValue (ip + 1, Graphic3d_Vertex (theboxpoint[ip].X(),
- theboxpoint[ip].Y(),
- theboxpoint[ip].Z()));
- }
- mysensgroup->Polyline (Vtx);
- for (ip = 0; ip < 4; ip++)
- {
- Vtx.SetValue (ip + 1, Graphic3d_Vertex (theboxpoint[ip + 4].X(),
- theboxpoint[ip + 4].Y(),
- theboxpoint[ip + 4].Z()));
- }
- mysensgroup->Polyline (Vtx);
+ aSeqBnds.Append(5);
+ for (i = 0; i < 4; i++)
+ aSeqLines.Append(theboxpoint[i]);
+ aSeqLines.Append(theboxpoint[0]);
+
+ aSeqBnds.Append(5);
+ for (i = 4; i < 8; i++)
+ aSeqLines.Append(theboxpoint[i]);
+ aSeqLines.Append(theboxpoint[4]);
- Graphic3d_Array1OfVertex Vtx2 (1, 2);
- for (ip = 0; ip < 4; ip++)
+ for (i = 0; i < 4; i++)
{
- Vtx2.SetValue (1, Graphic3d_Vertex (theboxpoint[ip].X(),
- theboxpoint[ip].Y(),
- theboxpoint[ip].Z()));
-
- Vtx2.SetValue (2, Graphic3d_Vertex (theboxpoint[ip + 4].X(),
- theboxpoint[ip + 4].Y(),
- theboxpoint[ip + 4].Z()));
- mysensgroup->Polyline (Vtx2);
+ aSeqBnds.Append(2);
+ aSeqLines.Append(theboxpoint[i]);
+ aSeqLines.Append(theboxpoint[i+4]);
}
}
//==============
aFace->Points3D(TheHPts);
const TColgp_Array1OfPnt& ThePts = TheHPts->Array1();
- Graphic3d_Array1OfVertex Vtx (ThePts.Lower(), ThePts.Upper());
-
+ aSeqBnds.Append(ThePts.Length());
for (Standard_Integer I = ThePts.Lower(); I <= ThePts.Upper(); I++)
{
if (hasloc)
- {
- const gp_Pnt& curP = ThePts (I);
- gp_Pnt ptrans = curP.Transformed (theloc.Transformation()).XYZ();
- Vtx.SetValue (I, Graphic3d_Vertex (ptrans.X(), ptrans.Y(), ptrans.Z()));
- }
+ aSeqLines.Append(ThePts(I).Transformed (theloc.Transformation()));
else
- {
- Vtx.SetValue (I, Graphic3d_Vertex (ThePts (I).X(), ThePts (I).Y(), ThePts (I).Z()));
- }
+ aSeqLines.Append(ThePts(I));
}
- mysensgroup->Polyline (Vtx);
}
//==============
// Curve
aCurve->Points3D(TheHPts);
const TColgp_Array1OfPnt& ThePts = TheHPts->Array1();
- Graphic3d_Array1OfVertex Vtx (ThePts.Lower(), ThePts.Upper());
+ aSeqBnds.Append(ThePts.Length());
for (Standard_Integer I = ThePts.Lower(); I <= ThePts.Upper(); I++)
{
if (hasloc)
- {
- gp_Pnt ptrans (ThePts (I).Transformed (theloc.Transformation()).XYZ());
- Vtx.SetValue (I, Graphic3d_Vertex (ptrans.X(), ptrans.Y(), ptrans.Z()));
- }
+ aSeqLines.Append(ThePts(I).Transformed (theloc.Transformation()));
else
- {
- Vtx.SetValue (I, Graphic3d_Vertex (ThePts (I).X(), ThePts (I).Y(), ThePts (I).Z()));
- }
+ aSeqLines.Append(ThePts(I));
}
- mysensgroup->Polyline (Vtx);
}
//==============
// Wire
//=============
else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveWire))
{
- Handle(Select3D_SensitiveWire) aWire = Handle(Select3D_SensitiveWire)::DownCast(Ent);
- Select3D_SensitiveEntitySequence EntitySeq;
- aWire->GetEdges (EntitySeq);
+ Handle(Select3D_SensitiveWire) aWire = Handle(Select3D_SensitiveWire)::DownCast(Ent);
+ Select3D_SensitiveEntitySequence EntitySeq;
+ aWire->GetEdges (EntitySeq);
for (int i = 1; i <= EntitySeq.Length(); i++)
{
//Segment
if (SubEnt->DynamicType()==STANDARD_TYPE(Select3D_SensitiveSegment))
{
- Graphic3d_Array1OfVertex Vtx (1, 2);
gp_Pnt P1 (Handle(Select3D_SensitiveSegment)::DownCast(SubEnt)->StartPoint().XYZ());
gp_Pnt P2 (Handle(Select3D_SensitiveSegment)::DownCast(SubEnt)->EndPoint().XYZ());
if (hasloc)
P1.Transform(theloc.Transformation());
P2.Transform(theloc.Transformation());
}
- Vtx.SetValue (1, Graphic3d_Vertex (P1.X(), P1.Y(), P1.Z()));
- Vtx.SetValue (2, Graphic3d_Vertex (P2.X(), P2.Y(), P2.Z()));
- mysensgroup->Polyline (Vtx);
+ aSeqBnds.Append(2);
+ aSeqLines.Append(P1);
+ aSeqLines.Append(P2);
}
//circle
Standard_Integer II = Lo;
while (II <= Up - 2)
{
- Graphic3d_Array1OfVertex Vtx (1, 4);
gp_Pnt ThePts[3] =
{
gp_Pnt (C->GetPoint3d (II).XYZ()),
ThePts[jj].Transform (theloc.Transformation());
}
- Vtx.SetValue (1, Graphic3d_Vertex (ThePts[0].X(), ThePts[0].Y(), ThePts[0].Z()));
- Vtx.SetValue (2, Graphic3d_Vertex (ThePts[1].X(), ThePts[1].Y(), ThePts[1].Z()));
- Vtx.SetValue (3, Graphic3d_Vertex (ThePts[2].X(), ThePts[2].Y(), ThePts[2].Z()));
- Vtx.SetValue (4, Graphic3d_Vertex (ThePts[0].X(), ThePts[0].Y(), ThePts[0].Z()));
-
- mysensgroup->Polyline (Vtx);
+ aSeqBnds.Append(4);
+ aSeqLines.Append(ThePts[0]);
+ aSeqLines.Append(ThePts[1]);
+ aSeqLines.Append(ThePts[2]);
+ aSeqLines.Append(ThePts[0]);
}
}
Handle(TColgp_HArray1OfPnt) TheHPts;
aCurve->Points3D (TheHPts);
const TColgp_Array1OfPnt& ThePts = TheHPts->Array1();
- Graphic3d_Array1OfVertex Vtx (ThePts.Lower(), ThePts.Upper());
+
+ aSeqBnds.Append(ThePts.Length());
for (Standard_Integer I = ThePts.Lower(); I <= ThePts.Upper(); I++)
{
if (hasloc)
- {
- gp_Pnt ptrans (ThePts (I).Transformed (theloc.Transformation()).XYZ());
- Vtx.SetValue (I, Graphic3d_Vertex (ptrans.X(), ptrans.Y(), ptrans.Z()));
- }
+ aSeqLines.Append(ThePts(I).Transformed (theloc.Transformation()));
else
- {
- Vtx.SetValue (I, Graphic3d_Vertex (ThePts (I).X(), ThePts (I).Y(), ThePts (I).Z()));
- }
+ aSeqLines.Append(ThePts(I));
}
- mysensgroup->Polyline (Vtx);
}
}
}
//=============
else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveSegment))
{
- Graphic3d_Array1OfVertex Vtx (1,2);
gp_Pnt P1 (Handle(Select3D_SensitiveSegment)::DownCast(Ent)->StartPoint().XYZ());
gp_Pnt P2 (Handle(Select3D_SensitiveSegment)::DownCast(Ent)->EndPoint().XYZ());
if (hasloc)
P1.Transform (theloc.Transformation());
P2.Transform (theloc.Transformation());
}
- Vtx.SetValue (1, Graphic3d_Vertex (P1.X(), P1.Y(), P1.Z()));
- Vtx.SetValue (2, Graphic3d_Vertex (P2.X(), P2.Y(), P2.Z()));
- mysensgroup->Polyline (Vtx);
+ aSeqBnds.Append(2);
+ aSeqLines.Append(P1);
+ aSeqLines.Append(P2);
}
//==============
// Circle
Standard_Integer II = Lo;
while (II <= Up - 2)
{
- Graphic3d_Array1OfVertex Vtx (1,4);
gp_Pnt ThePts[3] =
{
gp_Pnt (C->GetPoint3d (II).XYZ()),
ThePts[jj].Transform (theloc.Transformation());
}
- Vtx.SetValue (1, Graphic3d_Vertex (ThePts[0].X(), ThePts[0].Y(), ThePts[0].Z()));
- Vtx.SetValue (2, Graphic3d_Vertex (ThePts[1].X(), ThePts[1].Y(), ThePts[1].Z()));
- Vtx.SetValue (3, Graphic3d_Vertex (ThePts[2].X(), ThePts[2].Y(), ThePts[2].Z()));
- Vtx.SetValue (4, Graphic3d_Vertex (ThePts[0].X(), ThePts[0].Y(), ThePts[0].Z()));
-
- mysensgroup->Polyline (Vtx);
+ aSeqBnds.Append(4);
+ aSeqLines.Append(ThePts[0]);
+ aSeqLines.Append(ThePts[1]);
+ aSeqLines.Append(ThePts[2]);
+ aSeqLines.Append(ThePts[0]);
}
}
//==============
const Poly_Array1OfTriangle& triangles = PT->Triangles();
const TColgp_Array1OfPnt& Nodes = PT->Nodes();
- // gp_Pnt P1, P2, P3;
Standard_Integer n[3];
- Graphic3d_Array1OfVertex AV (1, 4);
TopLoc_Location iloc, bidloc;
if ((*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->HasInitLocation())
gp_XYZ V2 (P2.XYZ());
gp_XYZ V3 (P3.XYZ());
gp_XYZ CDG (P1.XYZ()); CDG += (P2.XYZ()); CDG += (P3.XYZ()); CDG /= 3.0;
-
V1 -= CDG; V2 -= CDG; V3 -= CDG;
-
V1 *= 0.9; V2 *= 0.9; V3 *= 0.9;
V1 += CDG; V2 += CDG; V3 += CDG;
- AV.SetValue (1, Graphic3d_Vertex (V1.X(), V1.Y(), V1.Z()));
- AV.SetValue (2, Graphic3d_Vertex (V2.X(), V2.Y(), V2.Z()));
- AV.SetValue (3, Graphic3d_Vertex (V3.X(), V3.Y(), V3.Z()));
- AV.SetValue (4, Graphic3d_Vertex (V1.X(), V1.Y(), V1.Z()));
- mysensgroup->Polyline (AV);
+
+ aSeqBnds.Append(4);
+ aSeqLines.Append(gp_Pnt(V1));
+ aSeqLines.Append(gp_Pnt(V2));
+ aSeqLines.Append(gp_Pnt(V3));
+ aSeqLines.Append(gp_Pnt(V1));
}
// recherche des bords libres...
}
}
}
- Standard_Integer Node1, Node2;
- mysensgroup->SetPrimitivesAspect (
- new Graphic3d_AspectLine3d (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 2.0));
for (Standard_Integer ifri = 1; ifri <= FreeE.Length(); ifri += 2)
{
- Node1 = FreeE (ifri);
- Node2 = FreeE (ifri + 1);
- Graphic3d_Array1OfVertex FE (1, 2);
- gp_Pnt pe1 (Nodes (Node1).Transformed (iloc)), pe2 (Nodes (Node2).Transformed (iloc));
- FE.SetValue (1,Graphic3d_Vertex (pe1.X(), pe1.Y(), pe1.Z()));
- FE.SetValue (2,Graphic3d_Vertex (pe2.X(), pe2.Y(), pe2.Z()));
- mysensgroup->Polyline (FE);
+ gp_Pnt pe1 (Nodes (FreeE (ifri)).Transformed (iloc)), pe2 (Nodes (FreeE (ifri + 1)).Transformed (iloc));
+ aSeqFree.Append(pe1);
+ aSeqFree.Append(pe2);
}
-
- mysensgroup->SetPrimitivesAspect (
- new Graphic3d_AspectLine3d (Quantity_NOC_GRAY40, Aspect_TOL_SOLID, 2.0));
}
else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveTriangle))
{
Handle(Select3D_SensitiveTriangle) Str = Handle(Select3D_SensitiveTriangle)::DownCast(Ent);
- gp_Pnt P1, P2, P3, CDG;
- Graphic3d_Array1OfVertex AV (1, 4);
+ gp_Pnt P1, P2, P3;
Str->Points3D (P1, P2, P3);
- CDG = Str->Center3D();
+ gp_Pnt CDG = Str->Center3D();
gp_XYZ V1 (P1.XYZ()); V1 -= (CDG.XYZ());
gp_XYZ V2 (P2.XYZ()); V2 -= (CDG.XYZ());
gp_XYZ V3 (P3.XYZ()); V3 -= (CDG.XYZ());
-
V1 *= 0.9; V2 *= 0.9; V3 *= 0.9;
V1 += CDG.XYZ(); V2 += CDG.XYZ(); V3 += CDG.XYZ();
- AV.SetValue (1, Graphic3d_Vertex (V1.X(), V1.Y(), V1.Z()));
- AV.SetValue (2, Graphic3d_Vertex (V2.X(), V2.Y(), V2.Z()));
- AV.SetValue (3, Graphic3d_Vertex (V3.X(), V3.Y(), V3.Z()));
- AV.SetValue (4, Graphic3d_Vertex (V1.X(), V1.Y(), V1.Z()));
- mysensgroup->Polyline (AV);
+
+ aSeqBnds.Append(4);
+ aSeqLines.Append(gp_Pnt(V1));
+ aSeqLines.Append(gp_Pnt(V2));
+ aSeqLines.Append(gp_Pnt(V3));
+ aSeqLines.Append(gp_Pnt(V1));
}
}
+
+ Standard_Integer i;
+
+ if (aSeqLines.Length())
+ {
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(aSeqLines.Length(),aSeqBnds.Length());
+ for (i = 1; i <= aSeqLines.Length(); i++)
+ aPrims->AddVertex(aSeqLines(i));
+ for (i = 1; i <= aSeqBnds.Length(); i++)
+ aPrims->AddBound(aSeqBnds(i));
+ myareagroup->AddPrimitiveArray(aPrims);
+ }
+
+ if (aSeqFree.Length())
+ {
+ mysensgroup->SetPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 2.0));
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(aSeqFree.Length(),aSeqFree.Length()/2);
+ for (i = 1; i <= aSeqFree.Length(); i++)
+ {
+ aPrims->AddBound(2);
+ aPrims->AddVertex(aSeqLines(i++));
+ aPrims->AddVertex(aSeqLines(i));
+ }
+ mysensgroup->AddPrimitiveArray(aPrims);
+ mysensgroup->SetPrimitivesAspect (new Graphic3d_AspectLine3d (Quantity_NOC_GRAY40, Aspect_TOL_SOLID, 2.0));
+ }
}
//=======================================================================
//purpose :
//=======================================================================
-void StdSelect_ViewerSelector3d::
-ComputeAreasPrs (const Handle(SelectMgr_Selection)& Sel)
+void StdSelect_ViewerSelector3d::ComputeAreasPrs (const Handle(SelectMgr_Selection)& Sel)
{
- // Select3D_Projector myprj = StdSelect::GetProjector (aView);
- Graphic3d_Array1OfVertex Av1 (1, 5);
Standard_Real xmin, ymin, xmax, ymax;
gp_Pnt Pbid;
SelectBasics_ListOfBox2d BoxList;
+ TColgp_SequenceOfPnt aSeqLines;
for (Sel->Init(); Sel->More(); Sel->Next())
{
Sel->Sensitive()->Areas (BoxList);
Pbid.SetCoord (xmin - mytolerance, ymin - mytolerance, 0.0);
myprj->Transform (Pbid, myprj->InvertedTransformation());
- Av1.SetValue (1, Graphic3d_Vertex (Pbid.X(), Pbid.Y(), Pbid.Z()));
+ aSeqLines.Append(Pbid);
Pbid.SetCoord (xmax + mytolerance, ymin - mytolerance, 0.0);
myprj->Transform (Pbid, myprj->InvertedTransformation());
- Av1.SetValue (2, Graphic3d_Vertex (Pbid.X(), Pbid.Y(), Pbid.Z()));
+ aSeqLines.Append(Pbid);
Pbid.SetCoord (xmax + mytolerance, ymax + mytolerance, 0.0);
myprj->Transform (Pbid, myprj->InvertedTransformation());
- Av1.SetValue (3, Graphic3d_Vertex (Pbid.X(), Pbid.Y(), Pbid.Z()));
+ aSeqLines.Append(Pbid);
Pbid.SetCoord (xmin - mytolerance, ymax + mytolerance, 0.0);
myprj->Transform (Pbid, myprj->InvertedTransformation());
- Av1.SetValue (4, Graphic3d_Vertex (Pbid.X(), Pbid.Y(), Pbid.Z()));
-
- Pbid.SetCoord (xmin - mytolerance, ymin - mytolerance, 0.0);
- myprj->Transform (Pbid, myprj->InvertedTransformation());
- Av1.SetValue (5, Graphic3d_Vertex (Pbid.X(), Pbid.Y(), Pbid.Z()));
+ aSeqLines.Append(Pbid);
+ }
+ }
- myareagroup->Polyline (Av1);
+ if (aSeqLines.Length())
+ {
+ Standard_Integer n, np;
+ const Standard_Integer nbl = aSeqLines.Length() / 4;
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(5*nbl,nbl);
+ for (np = 1, n=0; n<nbl; n++) {
+ aPrims->AddBound(5);
+ const gp_Pnt &p1 = aSeqLines(np++);
+ aPrims->AddVertex(p1);
+ aPrims->AddVertex(aSeqLines(np++));
+ aPrims->AddVertex(aSeqLines(np++));
+ aPrims->AddVertex(aSeqLines(np++));
+ aPrims->AddVertex(p1);
}
+ myareagroup->AddPrimitiveArray(aPrims);
}
}
#include <Quantity_NameOfColor.hxx>
#include <Aspect_Grid.hxx>
#include <Aspect_Window.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_AspectLine3d.hxx>
return Vec ;
}
-void V3d::ArrowOfRadius(const Handle(Graphic3d_Group)& garrow,const Standard_Real X0,const Standard_Real Y0,const Standard_Real Z0,const Standard_Real Dx,const Standard_Real Dy,const Standard_Real Dz,const Standard_Real Alpha,const Standard_Real Lng) {
-
-Standard_Real Xc,Yc,Zc,Xi,Yi,Zi,Xj,Yj,Zj;
-Standard_Real Xn,Yn,Zn,X,Y,Z,Norme;
-Standard_Integer NbPoints = 10, i;
-Graphic3d_Array1OfVertex VN(1,NbPoints+1);
-Graphic3d_Array1OfVertex V2(1,2);
+void V3d::ArrowOfRadius(const Handle(Graphic3d_Group)& garrow,const Standard_Real X0,const Standard_Real Y0,const Standard_Real Z0,const Standard_Real Dx,const Standard_Real Dy,const Standard_Real Dz,const Standard_Real Alpha,const Standard_Real Lng)
+{
+ Standard_Real Xc,Yc,Zc,Xi,Yi,Zi,Xj,Yj,Zj;
+ Standard_Real Xn,Yn,Zn,X,Y,Z,X1,Y1,Z1,Norme;
+ const Standard_Integer NbPoints = 10;
// Centre du cercle base de la fleche :
- Xc = X0 - Dx * Lng;
- Yc = Y0 - Dy * Lng;
- Zc = Z0 - Dz * Lng;
+ Xc = X0 - Dx * Lng;
+ Yc = Y0 - Dy * Lng;
+ Zc = Z0 - Dz * Lng;
// Construction d'un repere i,j pour le cercle:
- Xn=0., Yn=0., Zn=0.;
-
- if ( Abs(Dx) <= Abs(Dy) && Abs(Dx) <= Abs(Dz)) Xn=1.;
- else if ( Abs(Dy) <= Abs(Dz) && Abs(Dy) <= Abs(Dx)) Yn=1.;
- else Zn=1.;
- Xi = Dy * Zn - Dz * Yn;
- Yi = Dz * Xn - Dx * Zn;
- Zi = Dx * Yn - Dy * Xn;
-
- Norme = Sqrt ( Xi*Xi + Yi*Yi + Zi*Zi );
- Xi= Xi / Norme; Yi = Yi / Norme; Zi = Zi/Norme;
-
- Xj = Dy * Zi - Dz * Yi;
- Yj = Dz * Xi - Dx * Zi;
- Zj = Dx * Yi - Dy * Xi;
-
- V2(1).SetCoord(X0,Y0,Z0);
-
- Standard_Real cosinus,sinus, Tg=Tan(Alpha);
-
- for (i = 1 ; i <= NbPoints ; i++) {
-
- cosinus = Cos ( 2 * M_PI / NbPoints * (i-1) );
- sinus = Sin ( 2 * M_PI / NbPoints * (i-1) );
-
- X = Xc + (cosinus * Xi + sinus * Xj) * Lng * Tg;
- Y = Yc + (cosinus * Yi + sinus * Yj) * Lng * Tg;
- Z = Zc + (cosinus * Zi + sinus * Zj) * Lng * Tg;
+ Xn=0., Yn=0., Zn=0.;
+
+ if ( Abs(Dx) <= Abs(Dy) && Abs(Dx) <= Abs(Dz)) Xn=1.;
+ else if ( Abs(Dy) <= Abs(Dz) && Abs(Dy) <= Abs(Dx)) Yn=1.;
+ else Zn=1.;
+ Xi = Dy * Zn - Dz * Yn;
+ Yi = Dz * Xn - Dx * Zn;
+ Zi = Dx * Yn - Dy * Xn;
+
+ Norme = Sqrt ( Xi*Xi + Yi*Yi + Zi*Zi );
+ Xi= Xi / Norme; Yi = Yi / Norme; Zi = Zi/Norme;
+
+ Xj = Dy * Zi - Dz * Yi;
+ Yj = Dz * Xi - Dx * Zi;
+ Zj = Dx * Yi - Dy * Xi;
+
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(3*NbPoints,NbPoints);
+
+ Standard_Integer i;
+ const Standard_Real Tg = Tan(Alpha);
+ for (i = 1; i <= NbPoints; i++)
+ {
+ const Standard_Real cosinus = Cos ( 2. * M_PI / NbPoints * (i-1) );
+ const Standard_Real sinus = Sin ( 2. * M_PI / NbPoints * (i-1) );
+
+ X = Xc + (cosinus * Xi + sinus * Xj) * Lng * Tg;
+ Y = Yc + (cosinus * Yi + sinus * Yj) * Lng * Tg;
+ Z = Zc + (cosinus * Zi + sinus * Zj) * Lng * Tg;
+
+ if(i==1) { X1=X, Y1=Y, Z1=Z; }
+ else aPrims->AddVertex(X,Y,Z);
+ aPrims->AddBound(3);
+ aPrims->AddVertex(X0,Y0,Z0);
+ aPrims->AddVertex(X,Y,Z);
+ }
+ aPrims->AddVertex(X1,Y1,Z1);
- VN(i).SetCoord(X,Y,Z);
- if(i==1) VN(NbPoints+1).SetCoord(X,Y,Z);
- V2(2).SetCoord(X,Y,Z);
- garrow->Polyline(V2);
- }
- garrow->Polyline(VN);
+ garrow->AddPrimitiveArray(aPrims);
}
-void V3d::CircleInPlane(const Handle(Graphic3d_Group)& gcircle,const Standard_Real X0,const Standard_Real Y0,const Standard_Real Z0,const Standard_Real DX,const Standard_Real DY,const Standard_Real DZ,const Standard_Real Rayon) {
-
-Standard_Real VX,VY,VZ,X,Y,Z,Xn,Yn,Zn,Xi,Yi,Zi,Xj,Yj,Zj,Norme;
-Standard_Integer NFACES = 30 , i;
-Standard_Real Alpha = 0. ;
-Standard_Real Dalpha = 2. * M_PI / NFACES ;
-Graphic3d_Array1OfVertex Points(0,NFACES);
+void V3d::CircleInPlane(const Handle(Graphic3d_Group)& gcircle,const Standard_Real X0,const Standard_Real Y0,const Standard_Real Z0,const Standard_Real DX,const Standard_Real DY,const Standard_Real DZ,const Standard_Real Rayon)
+{
+ Standard_Real Norme = Sqrt ( DX*DX + DY*DY + DZ*DZ );
+ if ( Norme >= 0.0001 )
+ {
+ Standard_Real VX,VY,VZ,X,Y,Z,Xn,Yn,Zn,Xi,Yi,Zi,Xj,Yj,Zj;
- Norme = Sqrt ( DX*DX + DY*DY + DZ*DZ );
- if ( Norme >= 0.0001 ) {
- VX= DX/Norme; VY = DY/Norme; VZ = DZ/Norme;
+ VX= DX/Norme; VY = DY/Norme; VZ = DZ/Norme;
//Construction of marker i,j for the circle:
- Xn=0., Yn=0., Zn=0.;
- if ( Abs(VX) <= Abs(VY) && Abs(VX) <= Abs(VZ)) Xn=1.;
- else if ( Abs(VY) <= Abs(VZ) && Abs(VY) <= Abs(VX)) Yn=1.;
- else Zn=1.;
- Xi = VY * Zn - VZ * Yn;
- Yi = VZ * Xn - VX * Zn;
- Zi = VX * Yn - VY * Xn;
-
- Norme = Sqrt ( Xi*Xi + Yi*Yi + Zi*Zi );
- Xi= Xi / Norme; Yi = Yi / Norme; Zi = Zi/Norme;
-
- Xj = VY * Zi - VZ * Yi;
- Yj = VZ * Xi - VX * Zi;
- Zj = VX * Yi - VY * Xi;
-
- for (i = 0 ; i <= NFACES ; i++) {
- X = X0 + (Cos(Alpha) * Xi + Sin(Alpha) * Xj) * Rayon;
- Y = Y0 + (Cos(Alpha) * Yi + Sin(Alpha) * Yj) * Rayon;
- Z = Z0 + (Cos(Alpha) * Zi + Sin(Alpha) * Zj) * Rayon;
- Alpha +=Dalpha;
- Points(i).SetCoord(X,Y,Z);
- }
-
- gcircle->Polyline(Points);
- }
+ Xn=0., Yn=0., Zn=0.;
+ if ( Abs(VX) <= Abs(VY) && Abs(VX) <= Abs(VZ)) Xn=1.;
+ else if ( Abs(VY) <= Abs(VZ) && Abs(VY) <= Abs(VX)) Yn=1.;
+ else Zn=1.;
+ Xi = VY * Zn - VZ * Yn;
+ Yi = VZ * Xn - VX * Zn;
+ Zi = VX * Yn - VY * Xn;
+
+ Norme = Sqrt ( Xi*Xi + Yi*Yi + Zi*Zi );
+ Xi= Xi / Norme; Yi = Yi / Norme; Zi = Zi/Norme;
+
+ Xj = VY * Zi - VZ * Yi;
+ Yj = VZ * Xi - VX * Zi;
+ Zj = VX * Yi - VY * Xi;
+
+ const Standard_Integer NFACES = 30;
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NFACES+1);
+
+ Standard_Integer i = 0;
+ Standard_Real Alpha = 0.;
+ const Standard_Real Dalpha = 2. * M_PI / NFACES;
+ for (; i <= NFACES; i++, Alpha += Dalpha)
+ {
+ const Standard_Real cosinus = Cos(Alpha);
+ const Standard_Real sinus = Sin(Alpha);
+
+ X = X0 + (cosinus * Xi + sinus * Xj) * Rayon;
+ Y = Y0 + (cosinus * Yi + sinus * Yj) * Rayon;
+ Z = Z0 + (cosinus * Zi + sinus * Zj) * Rayon;
+
+ aPrims->AddVertex(X,Y,Z);
+ }
+ gcircle->AddPrimitiveArray(aPrims);
+ }
}
aNextView->Viewer()->SetViewOn(aNextView);
}
-void V3d::DrawSphere(const Handle(V3d_Viewer)& aViewer,const Quantity_Length ray) {
- Standard_Boolean inf = ray < 0;
- Standard_Real aRadius = Abs(ray);
+void V3d::DrawSphere(const Handle(V3d_Viewer)& aViewer,const Quantity_Length ray)
+{
+ const Standard_Boolean inf = ray < 0;
+ const Standard_Real aRadius = Standard_ShortReal(Abs(ray));
Handle(Graphic3d_Structure) Struct = new Graphic3d_Structure(aViewer->Viewer()) ;
Handle(Graphic3d_Group) Group = new Graphic3d_Group(Struct) ;
Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d() ;
LineAttrib->SetColor(Quantity_Color(Quantity_NOC_YELLOW));
Struct->SetPrimitivesAspect(LineAttrib) ;
-
- Standard_Integer NFACES = 30;
- Graphic3d_Array1OfVertex Points(0,NFACES) ;
- Standard_Real R,X,Y,Z ;
- Standard_Real Beta = 0. ;
- Standard_Real Alpha = 0. ;
- Standard_Real Dbeta = 2. * M_PI / NFACES ;
- Standard_Real Dalpha = 2. * M_PI / NFACES ;
+
+ const Standard_Integer NFACES = 30;
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(NFACES*(NFACES+1),NFACES);
+
+ const Standard_Real Dbeta = 2. * M_PI / NFACES;
+ const Standard_Real Dalpha = 2. * M_PI / NFACES;
+ Standard_ShortReal X,Y,Z,X0,Y0,Z0;
+ Standard_Real R, Alpha, Beta = 0.;
Standard_Integer i,j ;
- for( j=0 ; j<NFACES/2 ; j++ ) {
- Alpha = 0. ;
- R = aRadius*sin(Beta) ;
- Z = aRadius*cos(Beta) ;
- Beta += Dbeta ;
- for( i=0 ; i<NFACES ; i++ ) {
- X = R*cos(Alpha) ;
- Y = R*sin(Alpha) ;
- Alpha += Dalpha ;
- Points(i).SetCoord(X,Y,Z);
+ for( j=0; j<NFACES/2 ; j++, Beta += Dbeta ) {
+ aPrims->AddBound(NFACES+1);
+ R = aRadius*sin(Beta);
+ Z = Standard_ShortReal(aRadius*cos(Beta));
+ for( i=0, Alpha = 0.; i<NFACES; i++, Alpha += Dalpha ) {
+ X = Standard_ShortReal(R*cos(Alpha));
+ Y = Standard_ShortReal(R*sin(Alpha));
+ aPrims->AddVertex(X,Y,Z);
+ if (i==0) { X0=X, Y0=Y, Z0=Z; }
}
- Points(0).Coord(X,Y,Z) ;
- Points(NFACES).SetCoord(X,Y,Z) ;
- Group->Polyline(Points) ;
+ aPrims->AddVertex(X0,Y0,Z0);
}
- for( j=0 ; j<NFACES/2 ; j++ ) {
- Alpha = 0. ;
- R = aRadius*sin(Beta) ;
- Y = aRadius*cos(Beta) ;
+ for( j=0; j<NFACES/2 ; j++, Beta += Dbeta ) {
+ aPrims->AddBound(NFACES+1);
+ R = aRadius*sin(Beta);
+ Y = Standard_ShortReal(aRadius*cos(Beta));
Beta += Dbeta ;
- for( i=0 ; i<NFACES ; i++ ) {
- X = R*cos(Alpha) ;
- Z = R*sin(Alpha) ;
- Alpha += Dalpha ;
- Points(i).SetCoord(X,Y,Z);
+ for( i=0, Alpha = 0.; i<NFACES; i++, Alpha += Dalpha ) {
+ X = Standard_ShortReal(R*cos(Alpha));
+ Z = Standard_ShortReal(R*sin(Alpha));
+ aPrims->AddVertex(X,Y,Z);
+ if (i==0) { X0=X, Y0=Y, Z0=Z; }
}
- Points(0).Coord(X,Y,Z) ;
- Points(NFACES).SetCoord(X,Y,Z) ;
- Group->Polyline(Points) ;
+ aPrims->AddVertex(X0,Y0,Z0);
}
- if(inf) Struct->SetInfiniteState(Standard_True);
+ Group->AddPrimitiveArray(aPrims);
+ if(inf) Struct->SetInfiniteState(Standard_True);
Struct->Display();
aViewer->Update();
}
+
void V3d::SetPlane(const Handle(V3d_Viewer)& aViewer,
const Standard_Real x1,
const Standard_Real y1,
fields
myStructure : Structure from Graphic3d;
- myGroup1, myGroup2 : Group from Graphic3d;
- myCurViewPlane : Ax3 from gp;
--- myColor, myTenthColor : Color from Quantity;
--- myCurColor1, myCurColor2: Color from Quantity;
+ myGroup : Group from Graphic3d;
+ myCurViewPlane : Ax3 from gp;
myViewer : ViewerPointer from V3d;
myCurAreDefined : Boolean from Standard;
myCurDrawMode : GridDrawMode from Aspect;
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Visual3d_ViewManager.hxx>
#include <V3d_Viewer.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
/*----------------------------------------------------------------------*/
/*
* Constant
*/
-#define NO_TRACE_MINMAX
-#define NO_TRACE_MAKE
-#define NO_TRACE_VALUES
-
#define DIVISION 8
#define MYMINMAX 25.
#define MYFACTOR 50.
/*----------------------------------------------------------------------*/
-V3d_CircularGrid::V3d_CircularGrid (const V3d_ViewerPointer& aViewer, const Quantity_Color& aColor, const Quantity_Color& aTenthColor):
- Aspect_CircularGrid (1.,8),
- myStructure (new Graphic3d_Structure (aViewer->Viewer ())),
- myGroup1 (new Graphic3d_Group (myStructure)),
- myGroup2 (new Graphic3d_Group (myStructure)),
-// myColor (aColor),
-// myTenthColor (aTenthColor),
- myViewer (aViewer),
- myCurAreDefined (Standard_False)
+V3d_CircularGrid::V3d_CircularGrid (const V3d_ViewerPointer& aViewer, const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
+: Aspect_CircularGrid (1.,8),
+ myStructure (new Graphic3d_Structure (aViewer->Viewer ())),
+ myGroup (new Graphic3d_Group (myStructure)),
+ myViewer (aViewer),
+ myCurAreDefined (Standard_False)
{
- myColor = aColor;
- myTenthColor = aTenthColor;
+ myColor = aColor;
+ myTenthColor = aTenthColor;
- myStructure->SetInfiniteState (Standard_True);
+ myStructure->SetInfiniteState (Standard_True);
-Standard_Real step = 10.;
-#ifdef IMP200100
-Standard_Real size = myViewer->DefaultViewSize()/2.;
- SetGraphicValues (size, step/MYFACTOR);
-#else
- SetGraphicValues (25., step/MYFACTOR);
-#endif
- SetRadiusStep (step);
+ const Standard_Real step = 10.;
+ const Standard_Real size = 0.5*myViewer->DefaultViewSize();
+ SetGraphicValues (size, step/MYFACTOR);
+ SetRadiusStep (step);
}
-void V3d_CircularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor) {
- if( myColor != aColor || myTenthColor != aTenthColor ) {
- myColor = aColor;
- myTenthColor = aTenthColor;
- myCurAreDefined = Standard_False;
- UpdateDisplay();
- }
+void V3d_CircularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
+{
+ if( myColor != aColor || myTenthColor != aTenthColor ) {
+ myColor = aColor;
+ myTenthColor = aTenthColor;
+ myCurAreDefined = Standard_False;
+ UpdateDisplay();
+ }
}
-void V3d_CircularGrid::Display () {
- myStructure->Display (1);
+void V3d_CircularGrid::Display ()
+{
+ myStructure->Display (1);
}
-void V3d_CircularGrid::Erase () const {
- myStructure->Erase ();
+void V3d_CircularGrid::Erase () const
+{
+ myStructure->Erase ();
}
-Standard_Boolean V3d_CircularGrid::IsDisplayed () const {
- return myStructure->IsDisplayed ();
+Standard_Boolean V3d_CircularGrid::IsDisplayed () const
+{
+ return myStructure->IsDisplayed ();
}
-void V3d_CircularGrid::UpdateDisplay () {
-#ifdef TRACE_MINMAX
- cout << "V3d_CircularGrid::UpdateDisplay ()\n";
-#endif
-
-gp_Ax3 ThePlane;
- ThePlane = myViewer->PrivilegedPlane ();
-
-Standard_Boolean MakeTransform = Standard_False;
-Standard_Real xl, yl, zl;
-Standard_Real xdx, xdy, xdz;
-Standard_Real ydx, ydy, ydz;
-Standard_Real dx, dy, dz;
- ThePlane.Location ().Coord (xl, yl, zl);
- ThePlane.XDirection ().Coord (xdx, xdy, xdz);
- ThePlane.YDirection ().Coord (ydx, ydy, ydz);
- ThePlane.Direction ().Coord (dx, dy, dz);
- if (! myCurAreDefined)
- MakeTransform = Standard_True;
- else {
- if (RotationAngle () != myCurAngle
- || XOrigin () != myCurXo || YOrigin () != myCurYo)
- MakeTransform = Standard_True;
- if (! MakeTransform) {
-Standard_Real curxl, curyl, curzl;
-Standard_Real curxdx, curxdy, curxdz;
-Standard_Real curydx, curydy, curydz;
-Standard_Real curdx, curdy, curdz;
- myCurViewPlane.Location ().Coord (curxl, curyl, curzl);
- myCurViewPlane.XDirection ().Coord (curxdx, curxdy, curxdz);
- myCurViewPlane.YDirection ().Coord (curydx, curydy, curydz);
- myCurViewPlane.Direction ().Coord (curdx, curdy, curdz);
- if (xl != curxl || yl != curyl || zl != curzl
- || xdx != curxdx || xdy != curxdy || xdz != curxdz
- || ydx != curydx || ydy != curydy || ydz != curydz
- || dx != curdx || dy != curdy || dz != curdz)
- MakeTransform = Standard_True;
- }
- }
-
- if (MakeTransform) {
-#ifdef TRACE_MAKE
- cout << "MakeTransform" << endl;
-#endif
-Standard_Real CosAlpha = Cos (RotationAngle ());
-Standard_Real SinAlpha = Sin (RotationAngle ());
-TColStd_Array2OfReal Trsf (1, 4, 1, 4);
- Trsf (4, 4) = 1.0;
- Trsf (4, 1) = Trsf (4, 2) = Trsf (4, 3) = 0.0;
- // Translation
- Trsf (1, 4) = xl,
- Trsf (2, 4) = yl,
- Trsf (3, 4) = zl;
- // Transformation change of marker
- Trsf (1, 1) = xdx,
- Trsf (2, 1) = xdy,
- Trsf (3, 1) = xdz,
- Trsf (1, 2) = ydx,
- Trsf (2, 2) = ydy,
- Trsf (3, 2) = ydz,
- Trsf (1, 3) = dx,
- Trsf (2, 3) = dy,
- Trsf (3, 3) = dz;
- myStructure->SetTransform (Trsf, Graphic3d_TOC_REPLACE);
-
- // Translation of the origin
- Trsf (1, 4) = -XOrigin (),
- Trsf (2, 4) = -YOrigin (),
- Trsf (3, 4) = 0.0;
- // Rotation Alpha around axis -Z
- Trsf (1, 1) = CosAlpha,
- Trsf (2, 1) = -SinAlpha,
- Trsf (3, 1) = 0.0,
- Trsf (1, 2) = SinAlpha,
- Trsf (2, 2) = CosAlpha,
- Trsf (3, 2) = 0.0,
- Trsf (1, 3) = 0.0,
- Trsf (2, 3) = 0.0,
- Trsf (3, 3) = 1.0;
- myStructure->SetTransform (Trsf,Graphic3d_TOC_POSTCONCATENATE);
-
-
-#ifdef TRACE_VALUES
-Standard_Integer i, j;
-TColStd_Array2OfReal TheMatrix (1, 4, 1, 4);
- myStructure->Transform (TheMatrix);
-
- for (i=1; i<=4; i++) {
- for (j=1; j<=4; j++)
- cout << TheMatrix (i, j) << "\t";
- cout << endl;
- }
-#endif
-
- myCurAngle = RotationAngle ();
- myCurXo = XOrigin (), myCurYo = YOrigin ();
- myCurViewPlane = ThePlane;
- }
-
- switch (DrawMode ()) {
- default:
- case Aspect_GDM_Points:
- if (! myCurAreDefined || myCurAreDefined &&
- myCurDrawMode == Aspect_GDM_Lines)
- myGroup2->Clear ();
- DefinePoints ();
- myCurDrawMode = Aspect_GDM_Points;
- break;
- case Aspect_GDM_Lines:
- DefineLines ();
- myCurDrawMode = Aspect_GDM_Lines;
- break;
+void V3d_CircularGrid::UpdateDisplay ()
+{
+ gp_Ax3 ThePlane = myViewer->PrivilegedPlane();
+
+ Standard_Real xl, yl, zl;
+ Standard_Real xdx, xdy, xdz;
+ Standard_Real ydx, ydy, ydz;
+ Standard_Real dx, dy, dz;
+ ThePlane.Location ().Coord (xl, yl, zl);
+ ThePlane.XDirection ().Coord (xdx, xdy, xdz);
+ ThePlane.YDirection ().Coord (ydx, ydy, ydz);
+ ThePlane.Direction ().Coord (dx, dy, dz);
+
+ Standard_Boolean MakeTransform = !myCurAreDefined;
+ if (!MakeTransform)
+ {
+ MakeTransform = (RotationAngle() != myCurAngle || XOrigin() != myCurXo || YOrigin() != myCurYo);
+ if (!MakeTransform)
+ {
+ Standard_Real curxl, curyl, curzl;
+ Standard_Real curxdx, curxdy, curxdz;
+ Standard_Real curydx, curydy, curydz;
+ Standard_Real curdx, curdy, curdz;
+ myCurViewPlane.Location ().Coord (curxl, curyl, curzl);
+ myCurViewPlane.XDirection ().Coord (curxdx, curxdy, curxdz);
+ myCurViewPlane.YDirection ().Coord (curydx, curydy, curydz);
+ myCurViewPlane.Direction ().Coord (curdx, curdy, curdz);
+ if (xl != curxl || yl != curyl || zl != curzl ||
+ xdx != curxdx || xdy != curxdy || xdz != curxdz ||
+ ydx != curydx || ydy != curydy || ydz != curydz ||
+ dx != curdx || dy != curdy || dz != curdz)
+ MakeTransform = Standard_True;
+ }
+ }
+
+ if (MakeTransform)
+ {
+ const Standard_Real CosAlpha = Cos (RotationAngle ());
+ const Standard_Real SinAlpha = Sin (RotationAngle ());
+ TColStd_Array2OfReal Trsf (1, 4, 1, 4);
+ Trsf (4, 4) = 1.0;
+ Trsf (4, 1) = Trsf (4, 2) = Trsf (4, 3) = 0.0;
+ // Translation
+ Trsf (1, 4) = xl,
+ Trsf (2, 4) = yl,
+ Trsf (3, 4) = zl;
+ // Transformation change of marker
+ Trsf (1, 1) = xdx,
+ Trsf (2, 1) = xdy,
+ Trsf (3, 1) = xdz,
+ Trsf (1, 2) = ydx,
+ Trsf (2, 2) = ydy,
+ Trsf (3, 2) = ydz,
+ Trsf (1, 3) = dx,
+ Trsf (2, 3) = dy,
+ Trsf (3, 3) = dz;
+ myStructure->SetTransform (Trsf, Graphic3d_TOC_REPLACE);
+
+ // Translation of the origin
+ Trsf (1, 4) = -XOrigin (),
+ Trsf (2, 4) = -YOrigin (),
+ Trsf (3, 4) = 0.0;
+ // Rotation Alpha around axis -Z
+ Trsf (1, 1) = CosAlpha,
+ Trsf (2, 1) = -SinAlpha,
+ Trsf (3, 1) = 0.0,
+ Trsf (1, 2) = SinAlpha,
+ Trsf (2, 2) = CosAlpha,
+ Trsf (3, 2) = 0.0,
+ Trsf (1, 3) = 0.0,
+ Trsf (2, 3) = 0.0,
+ Trsf (3, 3) = 1.0;
+ myStructure->SetTransform (Trsf,Graphic3d_TOC_POSTCONCATENATE);
+
+ myCurAngle = RotationAngle ();
+ myCurXo = XOrigin (), myCurYo = YOrigin ();
+ myCurViewPlane = ThePlane;
+ }
+
+ switch (DrawMode())
+ {
+ default:
+ //case Aspect_GDM_Points:
+ DefinePoints ();
+ myCurDrawMode = Aspect_GDM_Points;
+ break;
+ case Aspect_GDM_Lines:
+ DefineLines ();
+ myCurDrawMode = Aspect_GDM_Lines;
+ break;
#ifdef IMP210100
- case Aspect_GDM_None:
- myCurDrawMode = Aspect_GDM_None;
- break;
-#endif
- }
- myCurAreDefined = Standard_True;
-
-#ifdef TRACE_VALUES
-Standard_Real a11, a12, a13, a21, a22, a23, a31, a32, a33;
- ThePlane.XDirection ().Coord (a11, a12, a13);
- ThePlane.YDirection ().Coord (a21, a22, a23);
- ThePlane.Direction ().Coord (a31, a32, a33);
-cout << "Test Plane XDirection " << a11 << ", " << a12 << ", " << a13 << endl;
-cout << "Test Plane YDirection " << a21 << ", " << a22 << ", " << a23 << endl;
-cout << "Test Plane Direction " << a31 << ", " << a32 << ", " << a33 << endl;
+ case Aspect_GDM_None:
+ myCurDrawMode = Aspect_GDM_None;
+ break;
#endif
+ }
+ myCurAreDefined = Standard_True;
}
-void V3d_CircularGrid::DefineLines () {
-
-Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d ();
- LineAttrib->SetColor (myColor);
- LineAttrib->SetType (Aspect_TOL_SOLID);
- LineAttrib->SetWidth (1.0);
-
-Standard_Real r;
-Standard_Real aStep = RadiusStep ();
-Standard_Real aDivision = DivisionNumber ();
-Standard_Real alpha = M_PI / aDivision;
-
-Standard_Integer Division = (Standard_Integer )( (aDivision >= DIVISION ? aDivision : DIVISION));
-Graphic3d_Array1OfVertex Cercle (0, 2*Division);
-Standard_Real xl, yl, zl = myOffSet;
-
-Standard_Integer i;
-
-Graphic3d_Vertex P1, P2;
-
-Standard_Boolean MakeDiametres = Standard_False;
- if (! myCurAreDefined || myCurDrawMode == Aspect_GDM_Points)
- MakeDiametres = Standard_True;
- else {
- if (aDivision != myCurDivi)
- MakeDiametres = Standard_True;
- }
-
- if (MakeDiametres) {
-#ifdef TRACE_MAKE
- cout << "MakeDiametres" << endl;
-#endif
- // diametres
- myGroup1->Clear ();
-#ifdef IMP300300
- LineAttrib->SetColor (myTenthColor);
-#endif
- myGroup1->SetGroupPrimitivesAspect (LineAttrib);
- myGroup1->BeginPrimitives ();
- P1.SetCoord (0.0, 0.0, -zl);
- for (i=1; i<=2*aDivision; i++) {
- xl = Cos (alpha*i)*myRadius;
- yl = Sin (alpha*i)*myRadius;
- P2.SetCoord (xl, yl, -zl);
- myGroup1->Polyline (P1, P2, Standard_False);
- }
- myGroup1->EndPrimitives ();
- myGroup1->SetMinMaxValues
- (-myRadius, -myRadius, 0.0, myRadius, myRadius, 0.0);
- }
-
-Standard_Boolean MakeCercles = Standard_False;
- if (! myCurAreDefined || myCurDrawMode == Aspect_GDM_Points)
- MakeCercles = Standard_True;
- else {
- if (aStep != myCurStep || aDivision != myCurDivi)
- MakeCercles = Standard_True;
- }
-
- if (MakeCercles) {
-#ifdef TRACE_MAKE
- cout << "MakeCercles" << endl;
-#endif
- // circles
-#ifdef IMP300300
- Standard_Integer nblines = 0;
-#endif
- myGroup2->Clear ();
-#ifndef IMP300300
- myGroup2->SetGroupPrimitivesAspect (LineAttrib);
-#endif
- myGroup2->BeginPrimitives ();
- alpha = M_PI / Division;
- for (r=aStep; r<=myRadius; r+=aStep) {
- for (i=0; i<=2*Division; i++) {
- xl = Cos (alpha*i)*r;
- yl = Sin (alpha*i)*r;
- Cercle (i).SetCoord (xl, yl, -zl);
- }
-#ifdef IMP300300
- if (Modulus (nblines, 10) != 0) {
- myGroup2->Polyline (Cercle, Standard_False);
- } else {
- LineAttrib->SetColor (myTenthColor);
- myGroup2->SetPrimitivesAspect (LineAttrib);
- myGroup2->Polyline (Cercle, Standard_False);
- LineAttrib->SetColor (myColor);
- myGroup2->SetPrimitivesAspect (LineAttrib);
- }
- nblines++;
-#else
- myGroup2->Polyline (Cercle, Standard_False);
-#endif
- }
- myGroup2->EndPrimitives ();
- myGroup2->SetMinMaxValues
- (-myRadius, -myRadius, 0.0, myRadius, myRadius, 0.0);
- }
- myCurStep = aStep, myCurDivi = (Standard_Integer ) aDivision;
+void V3d_CircularGrid::DefineLines ()
+{
+ const Standard_Real aStep = RadiusStep ();
+ const Standard_Real aDivision = DivisionNumber ();
+ const Standard_Boolean toUpdate = !myCurAreDefined
+ || myCurDrawMode != Aspect_GDM_Lines
+ || aDivision != myCurDivi
+ || aStep != myCurStep;
+ if (!toUpdate)
+ {
+ return;
+ }
+
+ myGroup->Clear ();
+
+ Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d ();
+ LineAttrib->SetColor (myColor);
+ LineAttrib->SetType (Aspect_TOL_SOLID);
+ LineAttrib->SetWidth (1.0);
+
+ const Standard_Integer Division = (Standard_Integer )( (aDivision >= DIVISION ? aDivision : DIVISION));
+
+ Standard_Integer nbpnts = 2 * Division;
+ // diametres
+ Standard_Real alpha = M_PI / aDivision;
+ LineAttrib->SetColor (myTenthColor);
+ myGroup->SetGroupPrimitivesAspect (LineAttrib);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2*nbpnts);
+ const gp_Pnt p0(0., 0., -myOffSet);
+ for (Standard_Integer i=1; i<=nbpnts; i++) {
+ aPrims->AddVertex(p0);
+ aPrims->AddVertex(Cos(alpha*i)*myRadius, Sin(alpha*i)*myRadius, -myOffSet);
+ }
+ myGroup->AddPrimitiveArray(aPrims, Standard_False);
+
+ // circles
+ nbpnts = 2 * Division + 1;
+ alpha = M_PI / Division;
+ Standard_Integer nblines = 0;
+ TColgp_SequenceOfPnt aSeqLines, aSeqTenth;
+ for (Standard_Real r=aStep; r<=myRadius; r+=aStep, nblines++) {
+ const Standard_Boolean isTenth = (Modulus(nblines, 10) == 0);
+ for (Standard_Integer i=0; i<nbpnts; i++) {
+ const gp_Pnt pt(Cos(alpha*i)*r,Sin(alpha*i)*r,-myOffSet);
+ (isTenth? aSeqTenth : aSeqLines).Append(pt);
+ }
+ }
+ if (aSeqTenth.Length())
+ {
+ LineAttrib->SetColor (myTenthColor);
+ myGroup->SetGroupPrimitivesAspect (LineAttrib);
+ Standard_Integer n, np;
+ const Standard_Integer nbl = aSeqTenth.Length() / nbpnts;
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(aSeqTenth.Length(),nbl);
+ for (np = 1, n=0; n<nbl; n++) {
+ aPrims->AddBound(nbpnts);
+ for (Standard_Integer i=0; i<nbpnts; i++, np++)
+ aPrims->AddVertex(aSeqTenth(np));
+ }
+ myGroup->AddPrimitiveArray(aPrims, Standard_False);
+ }
+ if (aSeqLines.Length())
+ {
+ LineAttrib->SetColor (myColor);
+ myGroup->SetPrimitivesAspect (LineAttrib);
+ Standard_Integer n, np;
+ const Standard_Integer nbl = aSeqLines.Length() / nbpnts;
+ Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(aSeqLines.Length(),nbl);
+ for (np = 1, n=0; n<nbl; n++) {
+ aPrims->AddBound(nbpnts);
+ for (Standard_Integer i=0; i<nbpnts; i++, np++)
+ aPrims->AddVertex(aSeqLines(np));
+ }
+ myGroup->AddPrimitiveArray(aPrims, Standard_False);
+ }
+
+ myGroup->SetMinMaxValues(-myRadius, -myRadius, 0.0, myRadius, myRadius, 0.0);
+ myCurStep = aStep, myCurDivi = (Standard_Integer ) aDivision;
}
-void V3d_CircularGrid::DefinePoints () {
-
-Handle(Graphic3d_AspectMarker3d) MarkerAttrib = new Graphic3d_AspectMarker3d ();
- MarkerAttrib->SetColor (myColor);
- MarkerAttrib->SetType (Aspect_TOM_POINT);
- MarkerAttrib->SetScale (3.);
-
-Standard_Real r;
-Standard_Real aStep = RadiusStep ();
-Standard_Real aDivision = DivisionNumber ();
-Standard_Real alpha = M_PI / aDivision;
-
-Graphic3d_Array1OfVertex Cercle (0,(Standard_Integer )(2*aDivision));
-Standard_Real xl, yl, zl = myOffSet;
-
-Standard_Integer i;
-
-Graphic3d_Vertex Point (0.0, 0.0, -zl);
-
-Standard_Boolean MakeDiametres = Standard_False;
- if (! myCurAreDefined || myCurDrawMode == Aspect_GDM_Lines)
- MakeDiametres = Standard_True;
- else {
- if (aDivision != myCurDivi || aStep != myCurStep)
- MakeDiametres = Standard_True;
- }
-
- if (MakeDiametres) {
-#ifdef TRACE_MAKE
- cout << "MakeDiametres" << endl;
-#endif
- // diameters
- myGroup1->Clear ();
- myGroup1->SetGroupPrimitivesAspect (MarkerAttrib);
- myGroup1->BeginPrimitives ();
- myGroup1->Marker (Point, Standard_False);
- for (r=aStep; r<=myRadius; r+=aStep) {
- for (i=0; i<=2*aDivision; i++) {
- xl = Cos (alpha*i)*r;
- yl = Sin (alpha*i)*r;
- Cercle (i).SetCoord (xl, yl, -zl);
- }
- myGroup1->MarkerSet (Cercle, Standard_False);
- }
- myGroup1->EndPrimitives ();
- myGroup1->SetMinMaxValues
- (-myRadius, -myRadius, 0.0, myRadius, myRadius, 0.0);
- }
- myCurStep = aStep, myCurDivi = (Standard_Integer ) aDivision;
+void V3d_CircularGrid::DefinePoints ()
+{
+ const Standard_Real aStep = RadiusStep();
+ const Standard_Real aDivision = DivisionNumber();
+ const Standard_Boolean toUpdate = !myCurAreDefined
+ || myCurDrawMode != Aspect_GDM_Points
+ || aDivision != myCurDivi
+ || aStep != myCurStep;
+ if (!toUpdate)
+ {
+ return;
+ }
+
+ myGroup->Clear ();
+
+ Handle(Graphic3d_AspectMarker3d) MarkerAttrib = new Graphic3d_AspectMarker3d ();
+ MarkerAttrib->SetColor (myColor);
+ MarkerAttrib->SetType (Aspect_TOM_POINT);
+ MarkerAttrib->SetScale (3.);
+
+ const Standard_Integer nbpnts = Standard_Integer (2*aDivision);
+ Standard_Real r, alpha = M_PI / aDivision;
+
+ // diameters
+ TColgp_SequenceOfPnt aSeqPnts;
+ aSeqPnts.Append(gp_Pnt(0.0, 0.0, -myOffSet));
+ for (r=aStep; r<=myRadius; r+=aStep) {
+ for (Standard_Integer i=0; i<nbpnts; i++)
+ aSeqPnts.Append(gp_Pnt(Cos(alpha*i)*r, Sin(alpha*i)*r, -myOffSet));
+ }
+ myGroup->SetGroupPrimitivesAspect (MarkerAttrib);
+ if (aSeqPnts.Length())
+ {
+ Standard_Real X,Y,Z;
+ const Standard_Integer nbv = aSeqPnts.Length();
+ Graphic3d_Array1OfVertex Cercle (1,nbv);
+ for (Standard_Integer i=1; i<=nbv; i++)
+ {
+ aSeqPnts(i).Coord(X,Y,Z);
+ Cercle(i).SetCoord(X,Y,Z);
+ }
+ myGroup->MarkerSet (Cercle, Standard_False);
+ }
+ myGroup->SetMinMaxValues(-myRadius, -myRadius, 0.0, myRadius, myRadius, 0.0);
+
+ myCurStep = aStep, myCurDivi = (Standard_Integer ) aDivision;
}
-void V3d_CircularGrid::GraphicValues (Standard_Real& theRadius, Standard_Real& theOffSet) const {
-
- theRadius = myRadius;
- theOffSet = myOffSet;
+void V3d_CircularGrid::GraphicValues (Standard_Real& theRadius, Standard_Real& theOffSet) const
+{
+ theRadius = myRadius;
+ theOffSet = myOffSet;
}
-void V3d_CircularGrid::SetGraphicValues (const Standard_Real theRadius, const Standard_Real theOffSet) {
-
-#ifdef TRACE_MINMAX
- cout << "theRadius " << theRadius << " theOffSet " << theOffSet << endl;
-#endif
- if (! myCurAreDefined) {
- myRadius = theRadius;
- myOffSet = theOffSet;
- }
- if (myRadius != theRadius) {
- myRadius = theRadius;
- myCurAreDefined = Standard_False;
- }
- if (myOffSet != theOffSet) {
- myOffSet = theOffSet;
- myCurAreDefined = Standard_False;
- }
-#ifdef IMP200300
- if( !myCurAreDefined ) UpdateDisplay();
-#endif
+void V3d_CircularGrid::SetGraphicValues (const Standard_Real theRadius, const Standard_Real theOffSet)
+{
+ if (! myCurAreDefined) {
+ myRadius = theRadius;
+ myOffSet = theOffSet;
+ }
+ if (myRadius != theRadius) {
+ myRadius = theRadius;
+ myCurAreDefined = Standard_False;
+ }
+ if (myOffSet != theOffSet) {
+ myOffSet = theOffSet;
+ myCurAreDefined = Standard_False;
+ }
+ if( !myCurAreDefined ) UpdateDisplay();
}
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
MyDisplayPosition.Coord(Xp,Yp,Zp) ;
}
-void V3d_DirectionalLight::Symbol (const Handle(Graphic3d_Group)& gsymbol, const Handle(V3d_View)& aView) const {
-
+void V3d_DirectionalLight::Symbol (const Handle(Graphic3d_Group)& gsymbol, const Handle(V3d_View)& aView) const
+{
Standard_Real Xi,Yi,Zi,Xf,Yf,Zf,Rayon,PXT,PYT,X,Y,Z,XT,YT,ZT;
Standard_Real A,B,C,Dist,Beta,CosBeta,SinBeta,Coef,X1,Y1,Z1;
Standard_Real DX,DY,DZ,VX,VY,VZ;
Standard_Integer IXP,IYP,j;
TColStd_Array2OfReal MatRot(0,2,0,2);
- Graphic3d_Array1OfVertex Line(0,1);
aView->Proj(VX,VY,VZ);
this->DisplayPosition(Xi,Yi,Zi);
Rayon = this->Radius();
this->Direction(DX,DY,DZ);
X = Xi + DX*Rayon/10.; Y = Yi + DY*Rayon/10.; Z = Zi + DZ*Rayon/10.;
- Line(0).SetCoord(Xi,Yi,Zi);
- Line(1).SetCoord(X,Y,Z);
- gsymbol->Polyline(Line);
+
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(Standard_ShortReal(Xi),Standard_ShortReal(Yi),Standard_ShortReal(Zi));
+ aPrims->AddVertex(Standard_ShortReal(X),Standard_ShortReal(Y),Standard_ShortReal(Z));
+ gsymbol->AddPrimitiveArray(aPrims);
+
V3d::ArrowOfRadius(gsymbol, X, Y, Z, DX, DY, DZ, M_PI / 15., Rayon / 20.);
}
#include <Viewer_BadValue.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfQuadrangles.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <gp_Pln.hxx>
//-Constructors
-V3d_Plane::V3d_Plane(const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D) {
-
+V3d_Plane::V3d_Plane(const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D)
+{
Viewer_BadValue_Raise_if( sqrt(A*A + B*B + C*C) <= 0., "V3d_Plane::V3d_Plane, bad plane coefficients");
MyPlane = new Visual3d_ClipPlane(A,B,C,D) ;
//-Methods, in order
-void V3d_Plane::SetPlane( const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D) {
-
+void V3d_Plane::SetPlane(const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D)
+{
Viewer_BadValue_Raise_if( sqrt(A*A + B*B + C*C) <= 0., "V3d_Plane::SetPlane, bad plane coefficients");
MyPlane->SetPlane(A,B,C,D) ;
-
- if( IsDisplayed() ) {
+ if( IsDisplayed() )
Update();
- }
}
void V3d_Plane::Display(const Handle(V3d_View)& aView,
- const Quantity_Color& aColor) {
- Handle(V3d_Viewer) theViewer = aView->Viewer();
- if (!MyGraphicStructure.IsNull()) {
- MyGraphicStructure->Clear();
- }
- Standard_Real size = theViewer->DefaultViewSize();
- Standard_Real offset = size/10000.;
- MyGraphicStructure = new Graphic3d_Structure(theViewer->Viewer());
- Handle(Graphic3d_Group) group = new Graphic3d_Group(MyGraphicStructure);
- Handle(Graphic3d_AspectFillArea3d) aspect =
- new Graphic3d_AspectFillArea3d();
- Graphic3d_MaterialAspect plastic(Graphic3d_NOM_PLASTIC);
- plastic.SetColor(aColor);
- plastic.SetTransparency(0.5);
- aView->SetTransparency(Standard_True);
- aspect->SetFrontMaterial(plastic);
-// aspect->SetInteriorStyle (Aspect_IS_SOLID);
- aspect->SetInteriorStyle (Aspect_IS_HATCH);
- aspect->SetHatchStyle (Aspect_HS_GRID_DIAGONAL_WIDE);
- MyGraphicStructure->SetPrimitivesAspect(aspect);
- Graphic3d_Array1OfVertex p(1,4);
- p(1).SetCoord(-size/2.,-size/2.,offset);
- p(2).SetCoord(-size/2., size/2.,offset);
- p(3).SetCoord( size/2., size/2.,offset);
- p(4).SetCoord( size/2.,-size/2.,offset);
- group->Polygon(p);
- MyGraphicStructure->Display(0);
- Update();
+ const Quantity_Color& aColor)
+{
+ Handle(V3d_Viewer) theViewer = aView->Viewer();
+ if (!MyGraphicStructure.IsNull())
+ MyGraphicStructure->Clear();
+
+ MyGraphicStructure = new Graphic3d_Structure(theViewer->Viewer());
+ Handle(Graphic3d_Group) group = new Graphic3d_Group(MyGraphicStructure);
+ Handle(Graphic3d_AspectFillArea3d) aspect = new Graphic3d_AspectFillArea3d();
+ Graphic3d_MaterialAspect plastic(Graphic3d_NOM_PLASTIC);
+ plastic.SetColor(aColor);
+ plastic.SetTransparency(0.5);
+ aView->SetTransparency(Standard_True);
+ aspect->SetFrontMaterial(plastic);
+ aspect->SetInteriorStyle (Aspect_IS_HATCH);
+ aspect->SetHatchStyle (Aspect_HS_GRID_DIAGONAL_WIDE);
+ MyGraphicStructure->SetPrimitivesAspect(aspect);
+
+ const Standard_ShortReal size = (Standard_ShortReal)(0.5*theViewer->DefaultViewSize());
+ const Standard_ShortReal offset = size/5000.F;
+
+ Handle(Graphic3d_ArrayOfQuadrangles) aPrims = new Graphic3d_ArrayOfQuadrangles(4);
+ aPrims->AddVertex(-size,-size,offset);
+ aPrims->AddVertex(-size, size,offset);
+ aPrims->AddVertex( size, size,offset);
+ aPrims->AddVertex( size,-size,offset);
+ group->AddPrimitiveArray(aPrims);
+
+ MyGraphicStructure->Display(0);
+ Update();
}
-void V3d_Plane::Erase() {
+void V3d_Plane::Erase()
+{
if (!MyGraphicStructure.IsNull()) MyGraphicStructure->Erase();
}
-void V3d_Plane::Plane(Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D)const {
-
+void V3d_Plane::Plane(Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D) const
+{
MyPlane->Plane(A,B,C,D) ;
}
-Handle(Visual3d_ClipPlane) V3d_Plane::Plane()const {
-
- return MyPlane ;
+Handle(Visual3d_ClipPlane) V3d_Plane::Plane()const
+{
+ return MyPlane;
}
-Standard_Boolean V3d_Plane::IsDisplayed() const {
-
+Standard_Boolean V3d_Plane::IsDisplayed() const
+{
if( MyGraphicStructure.IsNull() ) return Standard_False;
return MyGraphicStructure->IsDisplayed();
}
-void V3d_Plane::Update() {
-
+void V3d_Plane::Update()
+{
if( !MyGraphicStructure.IsNull() ) {
TColStd_Array2OfReal matrix(1,4,1,4);
Standard_Real A,B,C,D;
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
}
void V3d_PositionLight::Display( const Handle(V3d_View)& aView,
- const V3d_TypeOfRepresentation TPres ) {
-
- Graphic3d_Array1OfVertex PRadius(0,1);
+ const V3d_TypeOfRepresentation TPres )
+{
Graphic3d_Vertex PText ;
Standard_Real X,Y,Z,Rayon;
Standard_Real X0,Y0,Z0,VX,VY,VZ;
// Creation of a structure snopick of non-markable elements (target, meridian and
// parallel).
+ Pres = TPres;
+ Handle(V3d_Viewer) TheViewer = aView->Viewer();
+ UpdSov = TheViewer->UpdateMode();
+ TheViewer->SetUpdateMode(V3d_WAIT);
+ if (!MyGraphicStructure.IsNull()) {
+ MyGraphicStructure->Disconnect(MyGraphicStructure1);
+ MyGraphicStructure->Clear();
+ MyGraphicStructure1->Clear();
+ if (Pres == V3d_SAMELAST) Pres = MyTypeOfRepresentation;
+ }
+ else {
+ if (Pres == V3d_SAMELAST) Pres = V3d_SIMPLE;
+ Handle(Graphic3d_Structure) slight = new Graphic3d_Structure(TheViewer->Viewer());
+ MyGraphicStructure = slight;
+ Handle(Graphic3d_Structure) snopick = new Graphic3d_Structure(TheViewer->Viewer());
+ MyGraphicStructure1 = snopick;
+ }
- Pres = TPres;
- Handle(V3d_Viewer) TheViewer = aView->Viewer();
- UpdSov = TheViewer->UpdateMode();
- TheViewer->SetUpdateMode(V3d_WAIT);
- if (!MyGraphicStructure.IsNull()) {
- MyGraphicStructure->Disconnect(MyGraphicStructure1);
- MyGraphicStructure->Clear();
- MyGraphicStructure1->Clear();
- if (Pres == V3d_SAMELAST) Pres = MyTypeOfRepresentation;
- }
- else {
- if (Pres == V3d_SAMELAST) Pres = V3d_SIMPLE;
- Handle(Graphic3d_Structure) slight = new Graphic3d_Structure(TheViewer->Viewer());
- MyGraphicStructure = slight;
- Handle(Graphic3d_Structure) snopick = new Graphic3d_Structure(TheViewer->Viewer());
- MyGraphicStructure1 = snopick;
- }
+ Handle(Graphic3d_Group) gradius;
+ Handle(Graphic3d_Group) gExtArrow;
+ Handle(Graphic3d_Group) gIntArrow;
-
- Handle(Graphic3d_Group) gradius;
- Handle(Graphic3d_Group) gExtArrow;
- Handle(Graphic3d_Group) gIntArrow;
-
- if (MyType != V3d_DIRECTIONAL) {
- if (Pres == V3d_COMPLETE) {
- gradius = new Graphic3d_Group(MyGraphicStructure);
- gExtArrow = new Graphic3d_Group(MyGraphicStructure);
- gIntArrow = new Graphic3d_Group(MyGraphicStructure);
- }
- }
+ if (MyType != V3d_DIRECTIONAL) {
+ if (Pres == V3d_COMPLETE) {
+ gradius = new Graphic3d_Group(MyGraphicStructure);
+ gExtArrow = new Graphic3d_Group(MyGraphicStructure);
+ gIntArrow = new Graphic3d_Group(MyGraphicStructure);
+ }
+ }
Handle(Graphic3d_Group) glight = new Graphic3d_Group(MyGraphicStructure);
Handle(Graphic3d_Group) gsphere;
if (Pres == V3d_COMPLETE || Pres == V3d_PARTIAL) gsphere = new Graphic3d_Group(MyGraphicStructure);
aView->Proj(VX,VY,VZ);
V3d::CircleInPlane(gsphere,X0,Y0,Z0,VX,VY,VZ,Rayon);
-
- if (MyType != V3d_DIRECTIONAL) {
+ if (MyType != V3d_DIRECTIONAL) {
//Display of the radius of the sphere (line + text)
- if (Pres == V3d_COMPLETE) {
- PRadius(0).SetCoord(X0,Y0,Z0);
- this->Position(X,Y,Z);
- PRadius(1).SetCoord(X,Y,Z);
- gnopick->Polyline(PRadius);
- V3d::ArrowOfRadius(gExtArrow,X-(X-X0)/10.,
- Y-(Y-Y0)/10.,
- Z-(Z-Z0)/10.,X-X0,Y-Y0,Z-Z0,M_PI/15.,Rayon/20.);
- V3d::ArrowOfRadius(gIntArrow,X0,Y0,Z0,X0-X,Y0-Y,Z0-Z,M_PI/15.,Rayon/20.);
- TCollection_AsciiString ValOfRadius(Rayon);
- PText.SetCoord( (X0+X)/2., (Y0+Y)/2. , (Z0+Z)/2. );
- gradius->Text(ValOfRadius.ToCString(),PText,0.01);
- }
- }
-
+ if (Pres == V3d_COMPLETE) {
+ this->Position(X,Y,Z);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(X0,Y0,Z0);
+ aPrims->AddVertex(X,Y,Z);
+ gnopick->AddPrimitiveArray(aPrims);
+ V3d::ArrowOfRadius(gExtArrow,X-.1*(X-X0),Y-.1*(Y-Y0),Z-.1*(Z-Z0),X-X0,Y-Y0,Z-Z0,M_PI/15.,Rayon/20.);
+ V3d::ArrowOfRadius(gIntArrow,X0,Y0,Z0,X0-X,Y0-Y,Z0-Z,M_PI/15.,Rayon/20.);
+ TCollection_AsciiString ValOfRadius(Rayon);
+ PText.SetCoord( .5*(X0+X), .5*(Y0+Y), .5*(Z0+Z) );
+ gradius->Text(ValOfRadius.ToCString(),PText,0.01);
+ }
+ }
// Display of the meridian
Quantity_Color Col2(Quantity_NOC_GREEN);
- Handle(Graphic3d_AspectLine3d) Asp2 = new Graphic3d_AspectLine3d
- (Col2,Aspect_TOL_SOLID,1.);
+ Handle(Graphic3d_AspectLine3d) Asp2 = new Graphic3d_AspectLine3d(Col2,Aspect_TOL_SOLID,1.);
gnopick->SetPrimitivesAspect(Asp2);
// Definition of the axis of circle
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
void V3d_PositionalLight::Display( const Handle(V3d_View)& aView,
- const V3d_TypeOfRepresentation TPres ) {
-
- Graphic3d_Array1OfVertex PRadius(0,1);
+ const V3d_TypeOfRepresentation TPres )
+{
Graphic3d_Vertex PText ;
Standard_Real X,Y,Z,Rayon;
Standard_Real X0,Y0,Z0,VX,VY,VZ;
// Creation of a structure snopick of non-markable elements (target, meridian and
// parallel).
- Pres = TPres;
- Handle(V3d_Viewer) TheViewer = aView->Viewer();
- UpdSov = TheViewer->UpdateMode();
- TheViewer->SetUpdateMode(V3d_WAIT);
- if (!MyGraphicStructure.IsNull()) {
- MyGraphicStructure->Disconnect(MyGraphicStructure1);
- MyGraphicStructure->Clear();
- MyGraphicStructure1->Clear();
- if (Pres == V3d_SAMELAST) Pres = MyTypeOfRepresentation;
- }
- else {
- if (Pres == V3d_SAMELAST) Pres = V3d_SIMPLE;
- Handle(Graphic3d_Structure) slight = new Graphic3d_Structure(TheViewer->Viewer());
- MyGraphicStructure = slight;
- Handle(Graphic3d_Structure) snopick = new Graphic3d_Structure(TheViewer->Viewer());
- MyGraphicStructure1 = snopick;
- }
-
+ Pres = TPres;
+ Handle(V3d_Viewer) TheViewer = aView->Viewer();
+ UpdSov = TheViewer->UpdateMode();
+ TheViewer->SetUpdateMode(V3d_WAIT);
+ if (!MyGraphicStructure.IsNull()) {
+ MyGraphicStructure->Disconnect(MyGraphicStructure1);
+ MyGraphicStructure->Clear();
+ MyGraphicStructure1->Clear();
+ if (Pres == V3d_SAMELAST) Pres = MyTypeOfRepresentation;
+ }
+ else {
+ if (Pres == V3d_SAMELAST) Pres = V3d_SIMPLE;
+ Handle(Graphic3d_Structure) slight = new Graphic3d_Structure(TheViewer->Viewer());
+ MyGraphicStructure = slight;
+ Handle(Graphic3d_Structure) snopick = new Graphic3d_Structure(TheViewer->Viewer());
+ MyGraphicStructure1 = snopick;
+ }
+
Handle(Graphic3d_Group) gradius;
Handle(Graphic3d_Group) gExtArrow;
Handle(Graphic3d_Group) gIntArrow;
// Display of the radius of the sphere (line + text)
if (Pres == V3d_COMPLETE) {
- PRadius(0).SetCoord(X0,Y0,Z0);
this->Position(X,Y,Z);
- PRadius(1).SetCoord(X,Y,Z);
- gnopick->Polyline(PRadius);
- V3d::ArrowOfRadius(gExtArrow,X-(X-X0)/10.,
- Y-(Y-Y0)/10.,
- Z-(Z-Z0) / 10., X-X0, Y-Y0, Z-Z0, M_PI / 15., Rayon / 20.);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(X0,Y0,Z0);
+ aPrims->AddVertex(X,Y,Z);
+ gnopick->AddPrimitiveArray(aPrims);
+ V3d::ArrowOfRadius(gExtArrow,X-.1*(X-X0),Y-.1*(Y-Y0),Z-.1*(Z-Z0),X-X0,Y-Y0,Z-Z0,M_PI/15.,Rayon/20.);
V3d::ArrowOfRadius(gIntArrow, X0, Y0, Z0, X0-X, Y0-Y, Z0-Z, M_PI / 15., Rayon / 20.);
TCollection_AsciiString ValOfRadius(Rayon);
- PText.SetCoord( (X0+X)/2., (Y0+Y)/2. , (Z0+Z)/2. );
+ PText.SetCoord( 0.5*(X0+X), 0.5*(Y0+Y), 0.5*(Z0+Z) );
gradius->Text(ValOfRadius.ToCString(),PText,0.01);
}
// Display of the meridian
Quantity_Color Col2(Quantity_NOC_GREEN);
- Handle(Graphic3d_AspectLine3d) Asp2 = new Graphic3d_AspectLine3d
- (Col2,Aspect_TOL_SOLID,1.);
+ Handle(Graphic3d_AspectLine3d) Asp2 = new Graphic3d_AspectLine3d(Col2,Aspect_TOL_SOLID,1.);
gnopick->SetPrimitivesAspect(Asp2);
// Definition of the axis of circle
VZ = DXRef*DYini - DYRef*DXini;
V3d::CircleInPlane(gnopick,X0,Y0,Z0,VX,VY,VZ,Rayon);
-
}
MyGraphicStructure->Connect(MyGraphicStructure1,Graphic3d_TOC_DESCENDANT);
fields
myStructure : Structure from Graphic3d;
- myGroup1, myGroup2 : Group from Graphic3d;
- myCurViewPlane : Ax3 from gp;
--- myColor, myTenthColor : Color from Quantity;
--- myCurColor1, myCurColor2: Color from Quantity;
+ myGroup : Group from Graphic3d;
+ myCurViewPlane : Ax3 from gp;
myViewer : ViewerPointer from V3d;
- myCurAreDefined : Boolean from Standard;
- myCurDrawMode : GridDrawMode from Aspect;
+ myCurAreDefined : Boolean from Standard;
+ myCurDrawMode : GridDrawMode from Aspect;
myCurXo, myCurYo : Real from Standard;
myCurAngle : Real from Standard;
myCurXStep, myCurYStep : Real from Standard;
myXSize, myYSize : Real from Standard;
myOffSet : Real from Standard;
- -- Debug
- -- myStructureGridPlane : Structure from Graphic3d;
- -- myStructureViewPlane : Structure from Graphic3d;
- -- myGroupGridPlane : Group from Graphic3d;
- -- myGroupViewPlane : Group from Graphic3d;
- -- myGridPlane : Ax3 from gp;
-
end RectangularGrid from V3d;
#include <Graphic3d_Array1OfVertex.hxx>
#include <Visual3d_ViewManager.hxx>
#include <V3d_Viewer.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
/*----------------------------------------------------------------------*/
/*
* Constant
*/
-#define NO_TRACE_MINMAX
-#define NO_TRACE_MAKE
-#define NO_TRACE_VALUES
-#define NO_TRACE_PLANE
-
#define MYMINMAX 25.
#define MYFACTOR 50.
/*----------------------------------------------------------------------*/
-V3d_RectangularGrid::V3d_RectangularGrid (const V3d_ViewerPointer& aViewer, const Quantity_Color& aColor, const Quantity_Color& aTenthColor):
- Aspect_RectangularGrid (1.,1.),
- myStructure (new Graphic3d_Structure (aViewer->Viewer ())),
- myGroup1 (new Graphic3d_Group (myStructure)),
- myGroup2 (new Graphic3d_Group (myStructure)),
- myViewer (aViewer),
- myCurAreDefined (Standard_False)
-#ifdef TRACE_PLANE
- ,myStructureGridPlane (new Graphic3d_Structure (aViewer->Viewer ())),
- myStructureViewPlane (new Graphic3d_Structure (aViewer->Viewer ())),
- myGroupGridPlane (new Graphic3d_Group (myStructureGridPlane)),
- myGroupViewPlane (new Graphic3d_Group (myStructureViewPlane)),
- myGridPlane (gp_Ax3 (gp_Pnt (0.,0.,0), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.)))
-#endif
+V3d_RectangularGrid::V3d_RectangularGrid (const V3d_ViewerPointer& aViewer, const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
+: Aspect_RectangularGrid (1.,1.),
+ myStructure (new Graphic3d_Structure (aViewer->Viewer ())),
+ myGroup (new Graphic3d_Group (myStructure)),
+ myViewer (aViewer),
+ myCurAreDefined (Standard_False)
{
- myColor = aColor;
- myTenthColor = aTenthColor;
+ myColor = aColor;
+ myTenthColor = aTenthColor;
- myStructure->SetInfiniteState (Standard_True);
-#ifdef TRACE_PLANE
- myStructureGridPlane->SetInfiniteState (Standard_True);
- myStructureViewPlane->SetInfiniteState (Standard_True);
-#endif
+ myStructure->SetInfiniteState (Standard_True);
-#ifdef IMP200100
- Standard_Real step = 10.;
- Standard_Real gstep = step/MYFACTOR;
- Standard_Real size = myViewer->DefaultViewSize()/2.;
-#else
- Standard_Real step = 10.;
- Standard_Real gstep = step/MYFACTOR;
- Standard_Real size = MYMINMAX;
-#endif
- SetGraphicValues (size, size, gstep);
- SetXStep (step);
- SetYStep (step);
+ const Standard_Real step = 10.;
+ const Standard_Real gstep = step/MYFACTOR;
+ const Standard_Real size = 0.5*myViewer->DefaultViewSize();
+ SetGraphicValues (size, size, gstep);
+ SetXStep (step);
+ SetYStep (step);
}
-void V3d_RectangularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor) {
- if( myColor != aColor || myTenthColor != aTenthColor ) {
- myColor = aColor;
- myTenthColor = aTenthColor;
- myCurAreDefined = Standard_False;
- UpdateDisplay();
- }
+void V3d_RectangularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
+{
+ if( myColor != aColor || myTenthColor != aTenthColor ) {
+ myColor = aColor;
+ myTenthColor = aTenthColor;
+ myCurAreDefined = Standard_False;
+ UpdateDisplay();
+ }
}
-void V3d_RectangularGrid::Display () {
- myStructure->Display (1);
-#ifdef TRACE_PLANE
- myStructureGridPlane->Display (1);
- myStructureViewPlane->Display (1);
-#endif
+void V3d_RectangularGrid::Display ()
+{
+ myStructure->Display (1);
}
-void V3d_RectangularGrid::Erase () const {
- myStructure->Erase ();
-#ifdef TRACE_PLANE
- myStructureGridPlane->Erase ();
- myStructureViewPlane->Erase ();
-#endif
+void V3d_RectangularGrid::Erase () const
+{
+ myStructure->Erase ();
}
-Standard_Boolean V3d_RectangularGrid::IsDisplayed () const {
- return myStructure->IsDisplayed ();
+Standard_Boolean V3d_RectangularGrid::IsDisplayed () const
+{
+ return myStructure->IsDisplayed ();
}
-void V3d_RectangularGrid::UpdateDisplay () {
-#ifdef TRACE_MINMAX
- cout << "V3d_RectangularGrid::UpdateDisplay ()" << endl;
-#endif
-
-gp_Ax3 ThePlane;
- ThePlane = myViewer->PrivilegedPlane ();
-
-Standard_Boolean MakeTransform = Standard_False;
-Standard_Real xl, yl, zl;
-Standard_Real xdx, xdy, xdz;
-Standard_Real ydx, ydy, ydz;
-Standard_Real dx, dy, dz;
- ThePlane.Location ().Coord (xl, yl, zl);
- ThePlane.XDirection ().Coord (xdx, xdy, xdz);
- ThePlane.YDirection ().Coord (ydx, ydy, ydz);
- ThePlane.Direction ().Coord (dx, dy, dz);
- if (! myCurAreDefined)
- MakeTransform = Standard_True;
- else {
- if (RotationAngle () != myCurAngle
- || XOrigin () != myCurXo || YOrigin () != myCurYo)
- MakeTransform = Standard_True;
- if (! MakeTransform) {
-Standard_Real curxl, curyl, curzl;
-Standard_Real curxdx, curxdy, curxdz;
-Standard_Real curydx, curydy, curydz;
-Standard_Real curdx, curdy, curdz;
- myCurViewPlane.Location ().Coord (curxl, curyl, curzl);
- myCurViewPlane.XDirection ().Coord (curxdx, curxdy, curxdz);
- myCurViewPlane.YDirection ().Coord (curydx, curydy, curydz);
- myCurViewPlane.Direction ().Coord (curdx, curdy, curdz);
- if (xl != curxl || yl != curyl || zl != curzl
- || xdx != curxdx || xdy != curxdy || xdz != curxdz
- || ydx != curydx || ydy != curydy || ydz != curydz
- || dx != curdx || dy != curdy || dz != curdz)
- MakeTransform = Standard_True;
- }
- }
-
- if (MakeTransform) {
-#ifdef TRACE_MAKE
- cout << "MakeTransform" << endl;
-#endif
-Standard_Real CosAlpha = Cos (RotationAngle ());
-Standard_Real SinAlpha = Sin (RotationAngle ());
-TColStd_Array2OfReal Trsf (1, 4, 1, 4);
- Trsf (4, 4) = 1.0;
- Trsf (4, 1) = Trsf (4, 2) = Trsf (4, 3) = 0.0;
- // Translation
- Trsf (1, 4) = xl,
- Trsf (2, 4) = yl,
- Trsf (3, 4) = zl;
- // Transformation of change of marker
- Trsf (1, 1) = xdx,
- Trsf (2, 1) = xdy,
- Trsf (3, 1) = xdz,
- Trsf (1, 2) = ydx,
- Trsf (2, 2) = ydy,
- Trsf (3, 2) = ydz,
- Trsf (1, 3) = dx,
- Trsf (2, 3) = dy,
- Trsf (3, 3) = dz;
- myStructure->SetTransform (Trsf, Graphic3d_TOC_REPLACE);
-
- // Translation of the origin
- Trsf (1, 4) = -XOrigin (),
- Trsf (2, 4) = -YOrigin (),
- Trsf (3, 4) = 0.0;
- // Rotation Alpha around axis -Z
- Trsf (1, 1) = CosAlpha,
- Trsf (2, 1) = -SinAlpha,
- Trsf (3, 1) = 0.0,
- Trsf (1, 2) = SinAlpha,
- Trsf (2, 2) = CosAlpha,
- Trsf (3, 2) = 0.0,
- Trsf (1, 3) = 0.0,
- Trsf (2, 3) = 0.0,
- Trsf (3, 3) = 1.0;
- myStructure->SetTransform (Trsf,Graphic3d_TOC_POSTCONCATENATE);
-
-
-#ifdef TRACE_VALUES
-Standard_Integer i, j;
-TColStd_Array2OfReal TheMatrix (1, 4, 1, 4);
- myStructure->Transform (TheMatrix);
-
- for (i=1; i<=4; i++) {
- for (j=1; j<=4; j++)
- cout << TheMatrix (i, j) << "\t";
- cout << endl;
- }
-#endif
-
- myCurAngle = RotationAngle ();
- myCurXo = XOrigin (), myCurYo = YOrigin ();
- myCurViewPlane = ThePlane;
- }
-
- switch (DrawMode ()) {
- default:
- case Aspect_GDM_Points:
-#ifdef IMP210100
- if (! myCurAreDefined ||
- (myCurDrawMode == Aspect_GDM_Lines) )
-#else
- if (! myCurAreDefined || myCurAreDefined &&
- myCurDrawMode == Aspect_GDM_Lines)
-#endif
- myGroup2->Clear ();
- DefinePoints ();
- myCurDrawMode = Aspect_GDM_Points;
- break;
- case Aspect_GDM_Lines:
- DefineLines ();
- myCurDrawMode = Aspect_GDM_Lines;
- break;
+void V3d_RectangularGrid::UpdateDisplay ()
+{
+ gp_Ax3 ThePlane = myViewer->PrivilegedPlane ();
+
+ Standard_Boolean MakeTransform = Standard_False;
+ Standard_Real xl, yl, zl;
+ Standard_Real xdx, xdy, xdz;
+ Standard_Real ydx, ydy, ydz;
+ Standard_Real dx, dy, dz;
+ ThePlane.Location ().Coord (xl, yl, zl);
+ ThePlane.XDirection ().Coord (xdx, xdy, xdz);
+ ThePlane.YDirection ().Coord (ydx, ydy, ydz);
+ ThePlane.Direction ().Coord (dx, dy, dz);
+ if (! myCurAreDefined)
+ MakeTransform = Standard_True;
+ else {
+ if (RotationAngle() != myCurAngle || XOrigin() != myCurXo || YOrigin() != myCurYo)
+ MakeTransform = Standard_True;
+ if (! MakeTransform) {
+ Standard_Real curxl, curyl, curzl;
+ Standard_Real curxdx, curxdy, curxdz;
+ Standard_Real curydx, curydy, curydz;
+ Standard_Real curdx, curdy, curdz;
+ myCurViewPlane.Location ().Coord (curxl, curyl, curzl);
+ myCurViewPlane.XDirection ().Coord (curxdx, curxdy, curxdz);
+ myCurViewPlane.YDirection ().Coord (curydx, curydy, curydz);
+ myCurViewPlane.Direction ().Coord (curdx, curdy, curdz);
+ if (xl != curxl || yl != curyl || zl != curzl ||
+ xdx != curxdx || xdy != curxdy || xdz != curxdz ||
+ ydx != curydx || ydy != curydy || ydz != curydz ||
+ dx != curdx || dy != curdy || dz != curdz)
+ MakeTransform = Standard_True;
+ }
+ }
+
+ if (MakeTransform) {
+ const Standard_Real CosAlpha = Cos (RotationAngle ());
+ const Standard_Real SinAlpha = Sin (RotationAngle ());
+ TColStd_Array2OfReal Trsf (1, 4, 1, 4);
+ Trsf (4, 4) = 1.0;
+ Trsf (4, 1) = Trsf (4, 2) = Trsf (4, 3) = 0.0;
+ // Translation
+ Trsf (1, 4) = xl,
+ Trsf (2, 4) = yl,
+ Trsf (3, 4) = zl;
+ // Transformation of change of marker
+ Trsf (1, 1) = xdx,
+ Trsf (2, 1) = xdy,
+ Trsf (3, 1) = xdz,
+ Trsf (1, 2) = ydx,
+ Trsf (2, 2) = ydy,
+ Trsf (3, 2) = ydz,
+ Trsf (1, 3) = dx,
+ Trsf (2, 3) = dy,
+ Trsf (3, 3) = dz;
+ myStructure->SetTransform (Trsf, Graphic3d_TOC_REPLACE);
+
+ // Translation of the origin
+ Trsf (1, 4) = -XOrigin (),
+ Trsf (2, 4) = -YOrigin (),
+ Trsf (3, 4) = 0.0;
+ // Rotation Alpha around axis -Z
+ Trsf (1, 1) = CosAlpha,
+ Trsf (2, 1) = -SinAlpha,
+ Trsf (3, 1) = 0.0,
+ Trsf (1, 2) = SinAlpha,
+ Trsf (2, 2) = CosAlpha,
+ Trsf (3, 2) = 0.0,
+ Trsf (1, 3) = 0.0,
+ Trsf (2, 3) = 0.0,
+ Trsf (3, 3) = 1.0;
+ myStructure->SetTransform (Trsf,Graphic3d_TOC_POSTCONCATENATE);
+
+ myCurAngle = RotationAngle ();
+ myCurXo = XOrigin (), myCurYo = YOrigin ();
+ myCurViewPlane = ThePlane;
+ }
+
+ switch (DrawMode ())
+ {
+ default:
+ //case Aspect_GDM_Points:
+ DefinePoints ();
+ myCurDrawMode = Aspect_GDM_Points;
+ break;
+ case Aspect_GDM_Lines:
+ DefineLines ();
+ myCurDrawMode = Aspect_GDM_Lines;
+ break;
#ifdef IMP210100
- case Aspect_GDM_None:
- myCurDrawMode = Aspect_GDM_None;
- break;
+ case Aspect_GDM_None:
+ myCurDrawMode = Aspect_GDM_None;
+ break;
#endif
}
myCurAreDefined = Standard_True;
-
-#ifdef TRACE_PLANE
-Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d ();
-Handle(Graphic3d_AspectText3d) TextAttrib = new Graphic3d_AspectText3d ();
-Graphic3d_Array1OfVertex Points (0, 1);
-Standard_Real ay, by, cy;
-
- myGroupViewPlane->Clear ();
-
- LineAttrib->SetColor (Quantity_Color (Quantity_NOC_GREEN));
- myGroupViewPlane->SetGroupPrimitivesAspect (LineAttrib);
-
- TextAttrib->SetColor (Quantity_Color(Quantity_NOC_GREEN));
- myGroupViewPlane->SetGroupPrimitivesAspect (TextAttrib);
-
- ThePlane.Location ().Coord (xl, yl, zl);
- Points (0).SetCoord (xl, yl, zl);
-
- myGroupViewPlane->BeginPrimitives ();
- myGroupViewPlane->Text ("VIEWER PLANE", Points (0), 1./81.);
-
- myViewer->PrivilegedPlane ().XDirection ().Coord (ay, by, cy);
- Points (1).SetCoord
- (xl + XStep ()*ay, yl + XStep ()*by, zl + XStep ()*cy);
- myGroupViewPlane->Polyline (Points);
- myGroupViewPlane->Text ("X", Points (1), 1./81.);
-
- myViewer->PrivilegedPlane ().YDirection ().Coord (ay, by, cy);
- Points (1).SetCoord
- (xl + XStep ()*ay, yl + XStep ()*by, zl + XStep ()*cy);
- myGroupViewPlane->Polyline (Points);
- myGroupViewPlane->Text ("Y", Points (1), 1./81.);
-
- myViewer->PrivilegedPlane ().Direction ().Coord (ay, by, cy);
- Points (1).SetCoord
- (xl + XStep ()*ay, yl + XStep ()*by, zl + XStep ()*cy);
- myGroupViewPlane->Polyline (Points);
- myGroupViewPlane->Text ("Z", Points (1), 1./81.);
- myGroupViewPlane->EndPrimitives ();
-
-#ifdef TRACE_VALUES
-Standard_Real xangle, yangle, angle;
-Standard_Real a11, a12, a13, a21, a22, a23, a31, a32, a33;
- xangle = ThePlane.XDirection ().Angle (myGridPlane.XDirection ());
- yangle = ThePlane.YDirection ().Angle (myGridPlane.YDirection ());
- angle = ThePlane.Direction ().Angle (myGridPlane.Direction ());
-cout << "Angle entre Directions " << angle << endl;
-cout << "Angle entre XDirections " << xangle << endl;
-cout << "Angle entre YDirections " << yangle << endl;
- ThePlane.XDirection ().Coord (a11, a12, a13);
- ThePlane.YDirection ().Coord (a21, a22, a23);
- ThePlane.Direction ().Coord (a31, a32, a33);
-cout << "Test Plane XDirection " << a11 << ", " << a12 << ", " << a13 << endl;
-cout << "Test Plane YDirection " << a21 << ", " << a22 << ", " << a23 << endl;
-cout << "Test Plane Direction " << a31 << ", " << a32 << ", " << a33 << endl;
-#endif
-
- myGroupGridPlane->Clear ();
-
- LineAttrib->SetColor (Quantity_Color (Quantity_NOC_RED));
- myGroupGridPlane->SetGroupPrimitivesAspect (LineAttrib);
-
- TextAttrib->SetColor (Quantity_Color(Quantity_NOC_RED));
- myGroupGridPlane->SetGroupPrimitivesAspect (TextAttrib);
-
- myGridPlane.Location ().Coord (xl, yl, zl);
- Points (0).SetCoord (xl, yl, zl);
-
- myGroupGridPlane->BeginPrimitives ();
- myGroupGridPlane->Text ("GRID PLANE", Points (0), 1./81.);
-
- myGridPlane.XDirection ().Coord (ay, by, cy);
- Points (1).SetCoord
- (xl + XStep ()*ay, yl + XStep ()*by, zl + XStep ()*cy);
- myGroupGridPlane->Polyline (Points);
- myGroupGridPlane->Text ("X", Points (1), 1./81.);
-
- myGridPlane.YDirection ().Coord (ay, by, cy);
- Points (1).SetCoord
- (xl + XStep ()*ay, yl + XStep ()*by, zl + XStep ()*cy);
- myGroupGridPlane->Polyline (Points);
- myGroupGridPlane->Text ("Y", Points (1), 1./81.);
-
- myGridPlane.Direction ().Coord (ay, by, cy);
- Points (1).SetCoord
- (xl + XStep ()*ay, yl + XStep ()*by, zl + XStep ()*cy);
- myGroupGridPlane->Polyline (Points);
- myGroupGridPlane->Text ("Z", Points (1), 1./81.);
- myGroupGridPlane->EndPrimitives ();
-#endif
}
-void V3d_RectangularGrid::DefineLines () {
-
-Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d ();
- LineAttrib->SetColor (myColor);
- LineAttrib->SetType (Aspect_TOL_SOLID);
- LineAttrib->SetWidth (1.0);
-
-Standard_Real aXStep = XStep ();
-Standard_Real aYStep = YStep ();
-Standard_Integer nblines, p;
-Standard_Real xl, yl, zl = myOffSet;
-
-Graphic3d_Vertex P1, P2;
-
-Standard_Boolean MakeVerticales = Standard_False;
- if (! myCurAreDefined || myCurDrawMode == Aspect_GDM_Points)
- MakeVerticales = Standard_True;
- else {
- if (aXStep != myCurXStep)
- MakeVerticales = Standard_True;
- }
-
- if (MakeVerticales) {
-#ifdef TRACE_MAKE
- cout << "MakeVerticales" << endl;
-#endif
- // verticals
- myGroup1->Clear ();
- LineAttrib->SetColor (myTenthColor);
- myGroup1->SetGroupPrimitivesAspect (LineAttrib);
- myGroup1->BeginPrimitives ();
- P1.SetCoord (0.0, -myYSize, -zl);
- P2.SetCoord (0.0, myYSize, -zl);
- myGroup1->Polyline (P1, P2, Standard_False);
- nblines = 1; // start with a dark grey line
- LineAttrib->SetColor (myColor);
- myGroup1->SetPrimitivesAspect (LineAttrib);
- for (xl = aXStep; xl < myXSize; xl += aXStep) {
- P1.SetCoord (xl, -myYSize, -zl);
- P2.SetCoord (xl, myYSize, -zl);
- p = Modulus (nblines, 10);
- if (p != 0) {
- myGroup1->Polyline (P1, P2, Standard_False);
- P1.SetCoord (-xl, -myYSize, -zl);
- P2.SetCoord (-xl, myYSize, -zl);
- myGroup1->Polyline (P1, P2, Standard_False);
- }
- else {
- LineAttrib->SetColor (myTenthColor);
- myGroup1->SetPrimitivesAspect (LineAttrib);
- myGroup1->Polyline (P1, P2, Standard_False);
- P1.SetCoord (-xl, -myYSize, -zl);
- P2.SetCoord (-xl, myYSize, -zl);
- myGroup1->Polyline (P1, P2, Standard_False);
- LineAttrib->SetColor (myColor);
- myGroup1->SetPrimitivesAspect (LineAttrib);
- }
- nblines ++;
- }
- myGroup1->EndPrimitives ();
- myGroup1->SetMinMaxValues
- (-myXSize, -myYSize, 0.0, myXSize, myYSize, 0.0);
- }
-
-Standard_Boolean MakeHorizontales = Standard_False;
- if (! myCurAreDefined || myCurDrawMode == Aspect_GDM_Points)
- MakeHorizontales = Standard_True;
- else {
- if (aYStep != myCurYStep)
- MakeHorizontales = Standard_True;
- }
-
- if (MakeHorizontales) {
-#ifdef TRACE_MAKE
- cout << "MakeHorizontales" << endl;
-#endif
- // horizontals
- myGroup2->Clear ();
- LineAttrib->SetColor (myTenthColor);
- myGroup2->SetGroupPrimitivesAspect (LineAttrib);
- myGroup2->BeginPrimitives ();
- P1.SetCoord (-myXSize, 0., -zl);
- P2.SetCoord (myXSize, 0., -zl);
- myGroup2->Polyline (P1, P2, Standard_False);
- nblines = 1; // start with a dark grey line
- LineAttrib->SetColor (myColor);
- myGroup2->SetPrimitivesAspect (LineAttrib);
- for (yl = aYStep; yl < myYSize; yl += aYStep) {
- P1.SetCoord (-myXSize, yl, -zl);
- P2.SetCoord (myXSize, yl, -zl);
- p = Modulus (nblines, 10);
- if (p != 0) {
- myGroup2->Polyline (P1, P2, Standard_False);
- P1.SetCoord (-myXSize, -yl, -zl);
- P2.SetCoord (myXSize, -yl, -zl);
- myGroup2->Polyline (P1, P2, Standard_False);
- }
- else {
- LineAttrib->SetColor (myTenthColor);
- myGroup2->SetPrimitivesAspect (LineAttrib);
- myGroup2->Polyline (P1, P2, Standard_False);
- P1.SetCoord (-myXSize, -yl, -zl);
- P2.SetCoord (myXSize, -yl, -zl);
- myGroup2->Polyline (P1, P2, Standard_False);
- LineAttrib->SetColor (myColor);
- myGroup2->SetPrimitivesAspect (LineAttrib);
- }
- nblines ++;
- }
- myGroup2->EndPrimitives ();
- myGroup2->SetMinMaxValues
- (-myXSize, -myYSize, 0.0, myXSize, myYSize, 0.0);
- }
- myCurXStep = aXStep, myCurYStep = aYStep;
+void V3d_RectangularGrid::DefineLines ()
+{
+ const Standard_Real aXStep = XStep();
+ const Standard_Real aYStep = YStep();
+ const Standard_Boolean toUpdate = !myCurAreDefined
+ || myCurDrawMode != Aspect_GDM_Lines
+ || aXStep != myCurXStep
+ || aYStep != myCurYStep;
+ if (!toUpdate)
+ {
+ return;
+ }
+
+ myGroup->Clear();
+
+ Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d ();
+ LineAttrib->SetColor (myColor);
+ LineAttrib->SetType (Aspect_TOL_SOLID);
+ LineAttrib->SetWidth (1.0);
+
+ Standard_Integer nblines;
+ Standard_Real xl, yl, zl = myOffSet;
+
+ TColgp_SequenceOfPnt aSeqLines, aSeqTenth;
+
+ // verticals
+ aSeqTenth.Append(gp_Pnt(0., -myYSize, -zl));
+ aSeqTenth.Append(gp_Pnt(0., myYSize, -zl));
+ for (nblines = 1, xl = aXStep; xl < myXSize; xl += aXStep, nblines++)
+ {
+ TColgp_SequenceOfPnt &aSeq = (Modulus(nblines, 10) != 0)? aSeqLines : aSeqTenth;
+ aSeq.Append(gp_Pnt( xl, -myYSize, -zl));
+ aSeq.Append(gp_Pnt( xl, myYSize, -zl));
+ aSeq.Append(gp_Pnt(-xl, -myYSize, -zl));
+ aSeq.Append(gp_Pnt(-xl, myYSize, -zl));
+ }
+
+ // horizontals
+ aSeqTenth.Append(gp_Pnt(-myXSize, 0., -zl));
+ aSeqTenth.Append(gp_Pnt( myXSize, 0., -zl));
+ for (nblines = 1, yl = aYStep; yl < myYSize; yl += aYStep, nblines++)
+ {
+ TColgp_SequenceOfPnt &aSeq = (Modulus(nblines, 10) != 0)? aSeqLines : aSeqTenth;
+ aSeq.Append(gp_Pnt(-myXSize, yl, -zl));
+ aSeq.Append(gp_Pnt( myXSize, yl, -zl));
+ aSeq.Append(gp_Pnt(-myXSize, -yl, -zl));
+ aSeq.Append(gp_Pnt( myXSize, -yl, -zl));
+ }
+
+ if (aSeqLines.Length())
+ {
+ LineAttrib->SetColor (myColor);
+ myGroup->SetPrimitivesAspect (LineAttrib);
+ const Standard_Integer nbv = aSeqLines.Length();
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(nbv);
+ Standard_Integer n = 1;
+ while (n<=nbv)
+ aPrims->AddVertex(aSeqLines(n++));
+ myGroup->AddPrimitiveArray(aPrims, Standard_False);
+ }
+ if (aSeqTenth.Length())
+ {
+ LineAttrib->SetColor (myTenthColor);
+ myGroup->SetPrimitivesAspect (LineAttrib);
+ const Standard_Integer nbv = aSeqTenth.Length();
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(nbv);
+ Standard_Integer n = 1;
+ while (n<=nbv)
+ aPrims->AddVertex(aSeqTenth(n++));
+ myGroup->AddPrimitiveArray(aPrims, Standard_False);
+ }
+
+ myGroup->SetMinMaxValues(-myXSize, -myYSize, 0.0, myXSize, myYSize, 0.0);
+ myCurXStep = aXStep, myCurYStep = aYStep;
}
-void V3d_RectangularGrid::DefinePoints () {
-
-Handle(Graphic3d_AspectMarker3d) MarkerAttrib = new Graphic3d_AspectMarker3d ();
- MarkerAttrib->SetColor (myColor);
- MarkerAttrib->SetType (Aspect_TOM_POINT);
- MarkerAttrib->SetScale (3.);
-
-Standard_Real aXStep = XStep ();
-Standard_Real aYStep = YStep ();
-Standard_Integer i, nbpoints;
- nbpoints = Standard_Integer (myYSize/aYStep);
- nbpoints = 4 * nbpoints + 2;
-
-Graphic3d_Array1OfVertex Vertical (1, nbpoints);
-Standard_Real xl, yl, zl = myOffSet;
-
-Standard_Boolean MakeHorizontales = Standard_False;
- if (! myCurAreDefined || myCurDrawMode == Aspect_GDM_Lines)
- MakeHorizontales = Standard_True;
- else {
- if (aXStep != myCurXStep || aYStep != myCurYStep)
- MakeHorizontales = Standard_True;
- }
-
- if (MakeHorizontales) {
-#ifdef TRACE_MAKE
- cout << "MakeHorizontales" << endl;
-#endif
- // horizontals
- myGroup1->Clear ();
- myGroup1->SetGroupPrimitivesAspect (MarkerAttrib);
- myGroup1->BeginPrimitives ();
- for (xl = 0.0; xl <= myXSize; xl += aXStep) {
- i = 1;
- Vertical (i++).SetCoord (xl, 0.0, -zl);
- Vertical (i++).SetCoord (-xl, 0.0, -zl);
- for (yl = aYStep; yl <= myYSize; yl += aYStep) {
- if (i<=nbpoints) Vertical (i++).SetCoord (xl, yl, -zl);
- if (i<=nbpoints) Vertical (i++).SetCoord (xl, -yl, -zl);
- if (i<=nbpoints) Vertical (i++).SetCoord (-xl, yl, -zl);
- if (i<=nbpoints) Vertical (i++).SetCoord (-xl, -yl, -zl);
- }
- myGroup1->MarkerSet (Vertical, Standard_False);
- }
- myGroup1->EndPrimitives ();
- myGroup1->SetMinMaxValues
- (-myXSize, -myYSize, 0.0, myXSize, myYSize, 0.0);
- }
- myCurXStep = aXStep, myCurYStep = aYStep;
+void V3d_RectangularGrid::DefinePoints ()
+{
+ const Standard_Real aXStep = XStep();
+ const Standard_Real aYStep = YStep();
+ const Standard_Boolean toUpdate = !myCurAreDefined
+ || myCurDrawMode != Aspect_GDM_Points
+ || aXStep != myCurXStep
+ || aYStep != myCurYStep;
+ if (!toUpdate)
+ {
+ return;
+ }
+
+ myGroup->Clear ();
+
+ Handle(Graphic3d_AspectMarker3d) MarkerAttrib = new Graphic3d_AspectMarker3d ();
+ MarkerAttrib->SetColor (myColor);
+ MarkerAttrib->SetType (Aspect_TOM_POINT);
+ MarkerAttrib->SetScale (3.);
+
+ // horizontals
+ Standard_Real xl, yl;
+ TColgp_SequenceOfPnt aSeqPnts;
+ for (xl = 0.0; xl <= myXSize; xl += aXStep) {
+ aSeqPnts.Append(gp_Pnt( xl, 0.0, -myOffSet));
+ aSeqPnts.Append(gp_Pnt(-xl, 0.0, -myOffSet));
+ for (yl = aYStep; yl <= myYSize; yl += aYStep) {
+ aSeqPnts.Append(gp_Pnt( xl, yl, -myOffSet));
+ aSeqPnts.Append(gp_Pnt( xl, -yl, -myOffSet));
+ aSeqPnts.Append(gp_Pnt(-xl, yl, -myOffSet));
+ aSeqPnts.Append(gp_Pnt(-xl, -yl, -myOffSet));
+ }
+ }
+ if (aSeqPnts.Length())
+ {
+ Standard_Integer i;
+ Standard_Real X,Y,Z;
+ const Standard_Integer nbv = aSeqPnts.Length();
+ Graphic3d_Array1OfVertex Vertical (1,nbv);
+ for (i=1; i<=nbv; i++)
+ {
+ aSeqPnts(i).Coord(X,Y,Z);
+ Vertical(i).SetCoord(X,Y,Z);
+ }
+ myGroup->SetGroupPrimitivesAspect (MarkerAttrib);
+ myGroup->MarkerSet (Vertical, Standard_False);
+ }
+
+ myGroup->SetMinMaxValues(-myXSize, -myYSize, 0.0, myXSize, myYSize, 0.0);
+ myCurXStep = aXStep, myCurYStep = aYStep;
}
-void V3d_RectangularGrid::GraphicValues (Standard_Real& theXSize, Standard_Real& theYSize, Standard_Real& theOffSet) const {
-
- theXSize = myXSize;
- theYSize = myYSize;
- theOffSet = myOffSet;
+void V3d_RectangularGrid::GraphicValues (Standard_Real& theXSize, Standard_Real& theYSize, Standard_Real& theOffSet) const
+{
+ theXSize = myXSize;
+ theYSize = myYSize;
+ theOffSet = myOffSet;
}
-void V3d_RectangularGrid::SetGraphicValues (const Standard_Real theXSize, const Standard_Real theYSize, const Standard_Real theOffSet) {
-
-#ifdef TRACE_MINMAX
- cout << "theXSize " << theXSize << " theYSize " << theYSize
- << " theOffSet " << theOffSet << endl;
-#endif
- if (! myCurAreDefined) {
- myXSize = theXSize;
- myYSize = theYSize;
- myOffSet = theOffSet;
- }
- if (myXSize != theXSize) {
- myXSize = theXSize;
- myCurAreDefined = Standard_False;
- }
- if (myYSize != theYSize) {
- myYSize = theYSize;
- myCurAreDefined = Standard_False;
- }
- if (myOffSet != theOffSet) {
- myOffSet = theOffSet;
- myCurAreDefined = Standard_False;
- }
-#ifdef IMP200300
- if( !myCurAreDefined ) UpdateDisplay();
-#endif
+void V3d_RectangularGrid::SetGraphicValues (const Standard_Real theXSize, const Standard_Real theYSize, const Standard_Real theOffSet)
+{
+ if (! myCurAreDefined) {
+ myXSize = theXSize;
+ myYSize = theYSize;
+ myOffSet = theOffSet;
+ }
+ if (myXSize != theXSize) {
+ myXSize = theXSize;
+ myCurAreDefined = Standard_False;
+ }
+ if (myYSize != theYSize) {
+ myYSize = theYSize;
+ myCurAreDefined = Standard_False;
+ }
+ if (myOffSet != theOffSet) {
+ myOffSet = theOffSet;
+ myCurAreDefined = Standard_False;
+ }
+ if( !myCurAreDefined ) UpdateDisplay();
}
#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
MyLight->Values(C,P,D,CN,A1,A2,AN) ;
}
-Standard_Real V3d_SpotLight::Concentration()const {
-
+Standard_Real V3d_SpotLight::Concentration()const
+{
Quantity_Color C ;
Graphic3d_Vector D ;
Graphic3d_Vertex P ;
return CN ;
}
-Standard_Real V3d_SpotLight::Angle()const {
-
+Standard_Real V3d_SpotLight::Angle()const
+{
Quantity_Color C ;
Graphic3d_Vector D ;
Graphic3d_Vertex P ;
}
void V3d_SpotLight::Symbol (const Handle(Graphic3d_Group)& gsymbol,
-// const Handle(V3d_View)& aView) const {
- const Handle(V3d_View)& ) const {
-
- Standard_Real X,Y,Z,Rayon;
+ const Handle(V3d_View)& ) const
+{
+ Standard_Real X,Y,Z;
Standard_Real DX,DY,DZ;
-
this->Position(X,Y,Z);
this->Direction(DX,DY,DZ);
- Rayon = this->Radius();
- V3d::ArrowOfRadius(gsymbol,X,Y,Z,-DX,-DY,-DZ,M_PI/8.,Rayon/15.);
+
+ V3d::ArrowOfRadius(gsymbol,X,Y,Z,-DX,-DY,-DZ,M_PI/8.,this->Radius()/15.);
}
void V3d_SpotLight::Display( const Handle(V3d_View)& aView,
- const V3d_TypeOfRepresentation TPres) {
-
- Graphic3d_Array1OfVertex PRadius(0,1);
+ const V3d_TypeOfRepresentation TPres)
+{
Graphic3d_Vertex PText ;
Standard_Real X,Y,Z,Rayon;
Standard_Real X0,Y0,Z0,VX,VY,VZ;
// Creation of a structure snopick of non-markable elements (target, meridian and
// parallel).//
- Pres = TPres;
- Handle(V3d_Viewer) TheViewer = aView->Viewer();
- UpdSov = TheViewer->UpdateMode();
- TheViewer->SetUpdateMode(V3d_WAIT);
- if (!MyGraphicStructure.IsNull()) {
- MyGraphicStructure->Disconnect(MyGraphicStructure1);
- MyGraphicStructure->Clear();
- MyGraphicStructure1->Clear();
- if (Pres == V3d_SAMELAST) Pres = MyTypeOfRepresentation;
- }
- else {
- if (Pres == V3d_SAMELAST) Pres = V3d_SIMPLE;
- Handle(Graphic3d_Structure) slight = new Graphic3d_Structure(TheViewer->Viewer());
- MyGraphicStructure = slight;
- Handle(Graphic3d_Structure) snopick = new Graphic3d_Structure(TheViewer->Viewer());
- MyGraphicStructure1 = snopick;
- }
-
+ Pres = TPres;
+ Handle(V3d_Viewer) TheViewer = aView->Viewer();
+ UpdSov = TheViewer->UpdateMode();
+ TheViewer->SetUpdateMode(V3d_WAIT);
+ if (!MyGraphicStructure.IsNull()) {
+ MyGraphicStructure->Disconnect(MyGraphicStructure1);
+ MyGraphicStructure->Clear();
+ MyGraphicStructure1->Clear();
+ if (Pres == V3d_SAMELAST) Pres = MyTypeOfRepresentation;
+ }
+ else {
+ if (Pres == V3d_SAMELAST) Pres = V3d_SIMPLE;
+ Handle(Graphic3d_Structure) slight = new Graphic3d_Structure(TheViewer->Viewer());
+ MyGraphicStructure = slight;
+ Handle(Graphic3d_Structure) snopick = new Graphic3d_Structure(TheViewer->Viewer());
+ MyGraphicStructure1 = snopick;
+ }
+
Handle(Graphic3d_Group) gradius;
Handle(Graphic3d_Group) gExtArrow;
Handle(Graphic3d_Group) gIntArrow;
// Display of the radius of the sphere (line + text)
if (Pres == V3d_COMPLETE) {
- PRadius(0).SetCoord(X0,Y0,Z0);
this->Position(X,Y,Z);
- PRadius(1).SetCoord(X,Y,Z);
- gnopick->Polyline(PRadius);
- V3d::ArrowOfRadius(gExtArrow,X-(X-X0)/10.,
- Y-(Y-Y0)/10.,
- Z-(Z-Z0) / 10., X-X0, Y-Y0, Z-Z0, M_PI / 15., Rayon / 20.);
- V3d::ArrowOfRadius(gIntArrow, X0, Y0, Z0, X0-X, Y0-Y, Z0-Z, M_PI / 15., Rayon / 20.);
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
+ aPrims->AddVertex(X0,Y0,Z0);
+ aPrims->AddVertex(X,Y,Z);
+ gnopick->AddPrimitiveArray(aPrims);
+ V3d::ArrowOfRadius(gExtArrow,X-.1*(X-X0),Y-.1*(Y-Y0),Z-.1*(Z-Z0),X-X0,Y-Y0,Z-Z0,M_PI/15.,Rayon/20.);
+ V3d::ArrowOfRadius(gIntArrow,X0,Y0,Z0,X0-X,Y0-Y,Z0-Z,M_PI/15.,Rayon/20.);
TCollection_AsciiString ValOfRadius(Rayon);
- PText.SetCoord( (X0+X)/2., (Y0+Y)/2. , (Z0+Z)/2. );
+ PText.SetCoord( .5*(X0+X), .5*(Y0+Y), .5*(Z0+Z) );
gradius->Text(ValOfRadius.ToCString(),PText,0.01);
}
// Display of the meridian
Quantity_Color Col2(Quantity_NOC_GREEN);
- Handle(Graphic3d_AspectLine3d) Asp2 = new Graphic3d_AspectLine3d
- (Col2,Aspect_TOL_SOLID,1.);
+ Handle(Graphic3d_AspectLine3d) Asp2 = new Graphic3d_AspectLine3d(Col2,Aspect_TOL_SOLID,1.);
gnopick->SetPrimitivesAspect(Asp2);
// Definition of the axis of the circle
VZ = DXRef*DYini - DYRef*DXini;
V3d::CircleInPlane(gnopick,X0,Y0,Z0,VX,VY,VZ,Rayon);
-
}
MyGraphicStructure->Connect(MyGraphicStructure1,Graphic3d_TOC_DESCENDANT);
************************************************************************/
-#define GER61351 //GG_15/12/99 Add SetBackgroundColor()
-// and BackgroundColor() methods
+//GER61351 //GG_15/12/99 Add SetBackgroundColor() and BackgroundColor() methods
#define IMP240100 //GG
#define Zmargin 1.
#define DEUXPI (2. * M_PI)
-// in case of NO_TRACE_ECHO and NO_TRACE_POINTS, in V3d_View_4.cxx and in
-// V3d_View.cxx, change MyGridEchoStructure and MyGridEchoGroup in cdl
-#define NO_TRACE_ECHO
-#define NO_TRACE_POINTS
-
/*----------------------------------------------------------------------*/
/*
* Local data definitions
SwitchSetFront(Standard_False),
MyTrsf (1, 4, 1, 4), // S3892
MyProjModel(V3d_TPM_SCREEN)
-#if defined(TRACE_POINTS)
-,MyGridEchoStructure (new Graphic3d_Structure (VM->Viewer ())), // S3892
-MyGridEchoGroup (new Graphic3d_Group (MyGridEchoStructure)) // S3892
-#endif
{
-
myImmediateUpdate = Standard_False;
MyView = new Visual3d_View(MyViewer->Viewer());
// S3892
#ifndef IMP240100
-#if defined(TRACE_POINTS)
- Handle(Graphic3d_AspectMarker3d) MarkerAttrib = new Graphic3d_AspectMarker3d ();
- MarkerAttrib->SetColor (Quantity_Color (Quantity_NOC_GRAY90));
- MarkerAttrib->SetScale (3.0);
- MarkerAttrib->SetType (Aspect_TOM_STAR);
- MyGridEchoStructure->SetPrimitivesAspect (MarkerAttrib);
-#endif
#endif //IMP240100
#ifdef G003
#ifdef IMP210200
MyTransparencyFlag = Standard_False;
#endif
-
}
/*----------------------------------------------------------------------*/
SwitchSetFront(Standard_False),
MyTrsf (1, 4, 1, 4), // S3892
MyProjModel(V3d_TPM_SCREEN)
-#if defined(TRACE_POINTS)
-,MyGridEchoStructure (new Graphic3d_Structure (VM->Viewer ())), // S3892
-MyGridEchoGroup (new Graphic3d_Group (MyGridEchoStructure)) // S3892
-#endif
{
-
Handle(Visual3d_View) FromView = V->View() ;
myImmediateUpdate = Standard_False;
Init();
myImmediateUpdate = Standard_True;
- // S3892
-#ifndef IMP240100
-#if defined(TRACE_ECHO)
- Handle(Graphic3d_AspectMarker3d) MarkerAttrib = new Graphic3d_AspectMarker3d ();
- MarkerAttrib->SetColor (Quantity_Color (Quantity_NOC_GRAY90));
- MarkerAttrib->SetScale (3.0);
- MarkerAttrib->SetType (Aspect_TOM_STAR);
- MyGridEchoStructure->SetPrimitivesAspect (MarkerAttrib);
-#endif
-#endif //IMP240100
-
#ifdef G003
MyAnimationFlags = 0;
#endif
-
}
/*----------------------------------------------------------------------*/
const Standard_Integer x2,
const Standard_Integer y2)
{
-
if( !MyView->IsDefined() ) {
Standard_Real a,b,c,d;
aPreviousView->Convert(x1,y1,a,b);
MyView->Redraw() ;
SetViewMappingDefault();
}
-
}
/*----------------------------------------------------------------------*/
void V3d_View::SetWindow(const Handle(Aspect_Window)& TheWindow)
{
-
Standard_MultiplyDefined_Raise_if( MyView->IsDefined(),
"V3d_View::SetWindow, window of view already defined");
MyView->SetViewOrientation(MyViewOrientation) ;
MyView->SetBackground(MyBackground) ;
MyViewer->SetViewOn(this) ;
-#ifdef TRACE_POINTS
- MyGridEchoStructure->SetInfiniteState (Standard_True); // S3892
- MyGridEchoStructure->Display (); // S3892
-#endif
MyView->Redraw() ;
-
}
// RIC120302
const Aspect_GraphicCallbackProc& aDisplayCB,
const Standard_Address aClientData)
{
-
Standard_MultiplyDefined_Raise_if( MyView->IsDefined(),
"V3d_View::SetWindow, "
"window of view already defined");
MyView->SetBackground(MyBackground) ;
MyViewer->SetViewOn(this) ;
MyView->Redraw() ;
-
}
// RIC120302
/*----------------------------------------------------------------------*/
-void V3d_View::Update() const {
+void V3d_View::Update() const
+{
if( MyView->IsDefined() ) MyView->Update() ;
}
/*----------------------------------------------------------------------*/
-void V3d_View::Redraw() const {
+void V3d_View::Redraw() const
+{
if( MyView->IsDefined() ) MyView->Redraw() ;
}
+
/*----------------------------------------------------------------------*/
void V3d_View::Redraw(const Standard_Integer xc,const Standard_Integer yc,
/*----------------------------------------------------------------------*/
-Standard_Boolean V3d_View::IsEmpty() const {
-
+Standard_Boolean V3d_View::IsEmpty() const
+{
Standard_Boolean TheStatus = Standard_True ;
if( MyView->IsDefined() ) {
Standard_Integer Nstruct = MyView->NumberOfDisplayedStructures() ;
if( Nstruct > 0 ) TheStatus = Standard_False ;
}
return (TheStatus) ;
-
}
/*----------------------------------------------------------------------*/
-void V3d_View::UpdateLights() const {
+void V3d_View::UpdateLights() const
+{
MyView->SetContext(MyViewContext);
Update();
}
/*----------------------------------------------------------------------*/
-void V3d_View::DoMapping() {
+void V3d_View::DoMapping()
+{
if( MyView->IsDefined() ) {
(MyView->Window())->DoMapping() ;
}
/*----------------------------------------------------------------------*/
-void V3d_View::MustBeResized() {
-
+void V3d_View::MustBeResized()
+{
if ( !MyLayerMgr.IsNull() )
MyLayerMgr->Resized();
MyViewMapping = MyView->ViewMapping();
MyView->Redraw();
}
-
}
/*----------------------------------------------------------------------*/
Standard_Real V3 = Max( Min( v3, 1.0 ), 0.0 );
Quantity_Color C( V1, V2, V3, Type );
-#ifdef GER61351
SetBackgroundColor( C );
-#else
- MyBackground.SetColor( C );
- if ( MyView->IsDefined() )
- MyView->SetBackground( MyBackground );
- if ( !MyLayerMgr.IsNull() )
- MyLayerMgr->Resized();
-#endif
}
-#ifdef GER61351
/*----------------------------------------------------------------------*/
void V3d_View::SetBackgroundColor(const Quantity_Color &Color)
if ( !MyLayerMgr.IsNull() )
MyLayerMgr->Resized();
}
-#endif
/*----------------------------------------------------------------------*/
void V3d_View::SetBackgroundColor(const Quantity_NameOfColor Name)
{
Quantity_Color C( Name );
-#ifdef GER61351
SetBackgroundColor( C );
-#else
- MyBackground.SetColor( C );
- if ( MyView->IsDefined() )
- MyView->SetBackground( MyBackground );
- if ( !MyColorScale.IsNull() )
- MyColorScale->Resized();
-#endif
}
/*----------------------------------------------------------------------*/
const Aspect_GradientFillMethod FillStyle,
const Standard_Boolean status)
{
-
MyGradientBackground.SetColors(Color1, Color2, FillStyle);
if ( MyView->IsDefined() )
MyView->SetGradientBackground( MyGradientBackground, status );
-
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
-void V3d_View::SetAxis(const Standard_Real X, const Standard_Real Y, const Standard_Real Z, const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz) {
-
+void V3d_View::SetAxis(const Standard_Real X, const Standard_Real Y, const Standard_Real Z, const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz)
+{
Standard_Real D,Nx = Vx,Ny = Vy,Nz = Vz ;
D = Sqrt( Vx*Vx + Vy*Vy + Vz*Vz ) ;
MyDefaultViewPoint.SetCoord(X,Y,Z) ;
MyDefaultViewAxis.SetCoord(Nx,Ny,Nz) ;
MyDefaultViewAxis.Normalize() ;
-
}
/*----------------------------------------------------------------------*/
-void V3d_View::SetShadingModel(const V3d_TypeOfShadingModel Model) {
-
+void V3d_View::SetShadingModel(const V3d_TypeOfShadingModel Model)
+{
MyViewContext.SetModel((Visual3d_TypeOfModel) Model) ;
MyView->SetContext(MyViewContext) ;
-
}
/*----------------------------------------------------------------------*/
-void V3d_View::SetSurfaceDetail(const V3d_TypeOfSurfaceDetail Model) {
-
+void V3d_View::SetSurfaceDetail(const V3d_TypeOfSurfaceDetail Model)
+{
MyViewContext.SetSurfaceDetail((Visual3d_TypeOfSurfaceDetail) Model) ;
MyView->SetContext(MyViewContext) ;
-
}
/*----------------------------------------------------------------------*/
-void V3d_View::SetTextureEnv(const Handle(Graphic3d_TextureEnv)& ATexture) {
-
+void V3d_View::SetTextureEnv(const Handle(Graphic3d_TextureEnv)& ATexture)
+{
MyViewContext.SetTextureEnv(ATexture) ;
MyView->SetContext(MyViewContext) ;
-
}
/*----------------------------------------------------------------------*/
-void V3d_View::SetVisualization(const V3d_TypeOfVisualization Mode) {
-
+void V3d_View::SetVisualization(const V3d_TypeOfVisualization Mode)
+{
MyViewContext.SetVisualization((Visual3d_TypeOfVisualization) Mode);
MyView->SetContext(MyViewContext) ;
-
}
/*----------------------------------------------------------------------*/
-void V3d_View::SetFront() {
-
+void V3d_View::SetFront()
+{
gp_Ax3 a = MyViewer->PrivilegedPlane();
Standard_Real xo,yo,zo,vx,vy,vz,xu,yu,zu;
MyView->SetViewOrientation(MyViewOrientation) ;
ImmediateUpdate();
-
}
/*----------------------------------------------------------------------*/
-void V3d_View::Rotate(const Standard_Real ax, const Standard_Real ay, const Standard_Real az, const Standard_Boolean Start) {
-
+void V3d_View::Rotate(const Standard_Real ax, const Standard_Real ay, const Standard_Real az, const Standard_Boolean Start)
+{
Standard_Real Ax = ax ;
Standard_Real Ay = ay ;
Standard_Real Az = az ;
SetZSize(0.) ;
#endif
ImmediateUpdate();
-
}
/*----------------------------------------------------------------------*/
void V3d_View::Rotate(const Standard_Real ax, const Standard_Real ay, const Standard_Real az,
const Standard_Real X, const Standard_Real Y, const Standard_Real Z, const Standard_Boolean Start)
{
-
Standard_Real Ax = ax ;
Standard_Real Ay = ay ;
Standard_Real Az = az ;
SetZSize(0.) ;
#endif
ImmediateUpdate();
-
}
/*----------------------------------------------------------------------*/
-void V3d_View::Rotate(const V3d_TypeOfAxe Axe, const Standard_Real angle, const Standard_Boolean Start) {
-
+void V3d_View::Rotate(const V3d_TypeOfAxe Axe, const Standard_Real angle, const Standard_Boolean Start)
+{
switch (Axe) {
case V3d_X :
Rotate(angle,0.,0.,Start);
Rotate(0.,0.,angle,Start);
break ;
}
-
}
/*----------------------------------------------------------------------*/
void V3d_View::Rotate(const V3d_TypeOfAxe Axe, const Standard_Real angle,
const Standard_Real X, const Standard_Real Y, const Standard_Real Z, const Standard_Boolean Start)
{
-
Standard_Real Angle = angle ;
Graphic3d_Vector Vpn,Vup ;
Graphic3d_Vertex Vrp ;
SetZSize(0.) ;
#endif
ImmediateUpdate();
-
}
/*----------------------------------------------------------------------*/
-void V3d_View::Rotate(const Standard_Real angle, const Standard_Boolean Start) {
-
+void V3d_View::Rotate(const Standard_Real angle, const Standard_Boolean Start)
+{
Standard_Real Angle = angle ;
Graphic3d_Vector Vpn,Vup ;
TColStd_Array2OfReal Matrix(0,3,0,3) ;
SetZSize(0.) ;
#endif
ImmediateUpdate();
-
}
/*----------------------------------------------------------------------*/
void V3d_View::Turn(const Standard_Real ax, const Standard_Real ay, const Standard_Real az, const Standard_Boolean Start)
{
-
Standard_Real Ax = ax ;
Standard_Real Ay = ay ;
Standard_Real Az = az ;
}
#endif
ImmediateUpdate();
-
}
/*----------------------------------------------------------------------*/
void V3d_View::Turn(const V3d_TypeOfAxe Axe, const Standard_Real angle, const Standard_Boolean Start)
{
-
switch (Axe) {
case V3d_X :
Turn(angle,0.,0.,Start);
}
}
-void V3d_View::Turn(const Standard_Real angle, const Standard_Boolean Start) {
+void V3d_View::Turn(const Standard_Real angle, const Standard_Boolean Start)
+{
Standard_Real Angle = angle ;
Graphic3d_Vertex Vrp,Eye ;
Graphic3d_Vector Vpn,Vup ;
}
#endif
ImmediateUpdate();
-
}
-void V3d_View::SetTwist(const Standard_Real angle) {
-
+void V3d_View::SetTwist(const Standard_Real angle)
+{
Standard_Real Angle = angle ;
TColStd_Array2OfReal Matrix(0,3,0,3) ;
Standard_Boolean TheStatus ;
MyViewOrientation.SetViewReferenceUp(MyViewReferenceUp) ;
MyView->SetViewOrientation(MyViewOrientation) ;
ImmediateUpdate();
-
}
#ifdef IMP240100
void V3d_View::SetProjModel( const V3d_TypeOfProjectionModel aModel )
{
-
MyProjModel = aModel;
-
}
-V3d_TypeOfProjectionModel V3d_View::ProjModel() const {
-
+V3d_TypeOfProjectionModel V3d_View::ProjModel() const
+{
return MyProjModel;
-
}
#endif
-void V3d_View::SetEye(const Standard_Real X,const Standard_Real Y,const Standard_Real Z) {
-
+void V3d_View::SetEye(const Standard_Real X,const Standard_Real Y,const Standard_Real Z)
+{
Standard_Real Angle,Xat,Yat,Zat,Xrp,Yrp,Zrp,Xpn,Ypn,Zpn ;
Angle = Twist() ;
MyProjReferencePoint = MyViewMapping.ProjectionReferencePoint() ;
#endif
myImmediateUpdate = update;
ImmediateUpdate();
-
}
-void V3d_View::SetDepth(const Standard_Real Depth) {
-
+void V3d_View::SetDepth(const Standard_Real Depth)
+{
Standard_Real Xrp,Yrp,Zrp ;
#ifdef IMP250200
Viewer_BadValue_Raise_if( Depth == 0. ,"V3d_View::SetDepth, bad depth");
Viewer_BadValue_Raise_if( Depth <= 0. ,"V3d_View::SetDepth, bad depth");
#endif
-#ifdef DEB
- Standard_Real twist =
-#endif
- Twist();
MyViewReferencePoint = MyViewOrientation.ViewReferencePoint() ;
MyViewReferencePlane = MyViewOrientation.ViewReferencePlane() ;
MyProjReferencePoint = MyViewMapping.ProjectionReferencePoint() ;
#endif
ImmediateUpdate();
-
}
void V3d_View::SetProj( const Standard_Real Vx,const Standard_Real Vy, const Standard_Real Vz )
{
-
Standard_Real Angle ;
Viewer_BadValue_Raise_if( Sqrt(Vx*Vx + Vy*Vy + Vz*Vz) <= 0.,
#endif
myImmediateUpdate = update;
ImmediateUpdate();
-
}
-void V3d_View::SetProj( const V3d_TypeOfOrientation Orientation ) {
-
+void V3d_View::SetProj( const V3d_TypeOfOrientation Orientation )
+{
MyViewReferencePlane = V3d::GetProjAxis(Orientation) ;
MyViewOrientation.SetViewReferencePlane(MyViewReferencePlane) ;
// MSV 14.03.2007: reset ViewReferencePoint to debug LH3D14955
- MyViewOrientation.SetViewReferencePoint(Graphic3d_Vertex(0,0,0));
+ MyViewOrientation.SetViewReferencePoint(Graphic3d_Vertex (0.0f, 0.0f, 0.0f));
Standard_Real Xpn=0;
Standard_Real Ypn=0;
Standard_Real Zpn=0;
SetZSize(0.) ;
#endif
ImmediateUpdate();
-
}
-void V3d_View::SetAt(const Standard_Real X,const Standard_Real Y,const Standard_Real Z) {
-
+void V3d_View::SetAt(const Standard_Real X,const Standard_Real Y,const Standard_Real Z)
+{
Standard_Real Angle,Xrp,Yrp,Zrp,Xpn,Ypn,Zpn,Xat,Yat,Zat ;
Standard_Real Xeye,Yeye,Zeye ;
#endif
myImmediateUpdate = update;
ImmediateUpdate();
-
}
-void V3d_View::SetUp(const Standard_Real Vx,const Standard_Real Vy,const Standard_Real Vz) {
-
+void V3d_View::SetUp(const Standard_Real Vx,const Standard_Real Vy,const Standard_Real Vz)
+{
Standard_Boolean TheStatus ;
Viewer_BadValue_Raise_if( Sqrt(Vx*Vx + Vy*Vy + Vz*Vz) <= 0. ,
"V3d_View::SetUp, nullUp vector");
MyViewOrientation.SetViewReferenceUp(MyViewReferenceUp) ;
MyView->SetViewOrientation(MyViewOrientation) ;
ImmediateUpdate();
-
}
-void V3d_View::SetUp( const V3d_TypeOfOrientation Orientation ) {
-
+void V3d_View::SetUp( const V3d_TypeOfOrientation Orientation )
+{
Standard_Boolean TheStatus ;
MyViewReferenceUp = V3d::GetProjAxis(Orientation) ;
MyViewOrientation.SetViewReferenceUp(MyViewReferenceUp) ;
MyView->SetViewOrientation(MyViewOrientation) ;
ImmediateUpdate();
-
}
void V3d_View::SetViewOrientation(const Visual3d_ViewOrientation& VO)
ImmediateUpdate();
}
-void V3d_View::SetViewOrientationDefault() {
-
+void V3d_View::SetViewOrientationDefault()
+{
MyView->SetViewOrientation(MyViewOrientation) ;
MyView->SetViewOrientationDefault() ;
ImmediateUpdate();
}
-void V3d_View::ResetViewOrientation() {
-
+void V3d_View::ResetViewOrientation()
+{
MyView->ViewOrientationReset() ;
MyViewOrientation = MyView->ViewOrientation() ;
ImmediateUpdate();
}
-void V3d_View::Reset( const Standard_Boolean update ) {
-
+void V3d_View::Reset( const Standard_Boolean update )
+{
MyView->ViewOrientationReset() ;
MyViewOrientation = MyView->ViewOrientation() ;
MyView->ViewMappingReset();
#else
ImmediateUpdate();
#endif
-
}
void V3d_View::Panning(const Standard_Real Dx, const Standard_Real Dy, const Quantity_Factor aZoomFactor, const Standard_Boolean Start)
{
-
Standard_Real Umin,Vmin,Umax,Vmax,Xrp,Yrp,Zrp,Dxv,Dyv ;
Viewer_BadValue_Raise_if( aZoomFactor <= 0.,"V3d_View::Panning, bad zoom factor");
}
MyView->SetViewMapping(MyViewMapping) ;
ImmediateUpdate();
-
}
-void V3d_View::SetCenter(const Standard_Integer X, const Standard_Integer Y) {
+
+void V3d_View::SetCenter(const Standard_Integer X, const Standard_Integer Y)
+{
Standard_Real x,y;
Convert(X,Y,x,y);
SetCenter(x,y);
}
-void V3d_View::SetCenter(const Standard_Real Xc, const Standard_Real Yc){
-
+void V3d_View::SetCenter(const Standard_Real Xc, const Standard_Real Yc)
+{
Standard_Real Umin,Vmin,Umax,Vmax,Xrp,Yrp,Zrp ;
MyProjReferencePoint = MyViewMapping.ProjectionReferencePoint() ;
}
MyView->SetViewMapping(MyViewMapping) ;
ImmediateUpdate();
-
}
void V3d_View::SetSize(const Standard_Real Size)
{
-
Standard_Real Umin,Vmin,Umax,Vmax,Rap ;
Viewer_BadValue_Raise_if( Size <= 0.,
MyViewMapping.SetWindowLimit(Umin,Vmin,Umax,Vmax) ;
MyView->SetViewMapping(MyViewMapping) ;
ImmediateUpdate();
-
}
void V3d_View::SetZSize(const Standard_Real Size)
{
-
Standard_Real Zmax = Size/2.;
#ifdef IMP020300
MyView->SetViewMapping(MyViewMapping) ;
if( MyViewContext.FrontZClippingIsOn() ||
- MyViewContext.BackZClippingIsOn() ) {
- MyViewContext.SetZClippingFrontPlane(Front) ;
- MyViewContext.SetZClippingBackPlane(Back) ;
- MyView->SetContext(MyViewContext) ;
- }
-
+ MyViewContext.BackZClippingIsOn() )
+ {
+ MyViewContext.SetZClippingFrontPlane(Front) ;
+ MyViewContext.SetZClippingBackPlane(Back) ;
+ MyView->SetContext(MyViewContext) ;
+ }
}
void V3d_View::SetZoom(const Standard_Real Coef,const Standard_Boolean Start)
{
-
Standard_Real Umin,Vmin,Umax,Vmax,Dxv,Dyv ;
Viewer_BadValue_Raise_if( Coef <= 0.,"V3d_View::SetZoom, bad coefficient");
ImmediateUpdate();
}
-void V3d_View::SetScale( const Standard_Real Coef ) {
+void V3d_View::SetScale( const Standard_Real Coef )
+{
Standard_Real Umin,Vmin,Umax,Vmax,Xrp,Yrp,Dxv,Dyv ;
Visual3d_ViewMapping VMD = MyView->ViewMappingDefault() ;
MyViewMapping.SetWindowLimit(Umin,Vmin,Umax,Vmax) ;
MyView->SetViewMapping(MyViewMapping) ;
ImmediateUpdate();
-
}
-void V3d_View::SetAxialScale( const Standard_Real Sx, const Standard_Real Sy, const Standard_Real Sz ) {
-
+void V3d_View::SetAxialScale( const Standard_Real Sx, const Standard_Real Sy, const Standard_Real Sz )
+{
Standard_Real Xmin,Ymin,Zmin,Xmax,Ymax,Zmax,U,V,W ;
Standard_Real Umin,Vmin,Wmin,Umax,Vmax,Wmax ;
Viewer_BadValue_Raise_if( Sx <= 0. || Sy <= 0. || Sz <= 0.,"V3d_View::SetAxialScale, bad coefficient");
if( Wmax > 0. ) {
SetZSize(2.*Wmax + Wmax) ;
}
-
}
void V3d_View::FitAll(const Standard_Real Coef, const Standard_Boolean FitZ,
#endif
}
-void V3d_View::ZFitAll(const Standard_Real Coef) {
-
+void V3d_View::ZFitAll(const Standard_Real Coef)
+{
Standard_Real Xmin,Ymin,Zmin,Xmax,Ymax,Zmax,U,V,W ;
Standard_Real Umin,Vmin,Wmin,Umax,Vmax,Wmax ;
// CAL 6/11/98
ImmediateUpdate();
}
-void V3d_View::FitAll(const Standard_Real Xmin, const Standard_Real Ymin, const Standard_Real Xmax, const Standard_Real Ymax) {
+void V3d_View::FitAll(const Standard_Real Xmin, const Standard_Real Ymin, const Standard_Real Xmax, const Standard_Real Ymax)
+{
FitAll(MyWindow,Xmin,Ymin,Xmax,Ymax);
#ifndef IMP020300
ImmediateUpdate();
#endif
}
-void V3d_View::WindowFitAll(const Standard_Integer Xmin, const Standard_Integer Ymin, const Standard_Integer Xmax, const Standard_Integer Ymax) {
+void V3d_View::WindowFitAll(const Standard_Integer Xmin, const Standard_Integer Ymin, const Standard_Integer Xmax, const Standard_Integer Ymax)
+{
WindowFit(Xmin,Ymin,Xmax,Ymax);
-
}
-void V3d_View::WindowFit(const Standard_Integer Xmin, const Standard_Integer Ymin, const Standard_Integer Xmax, const Standard_Integer Ymax) {
+
+void V3d_View::WindowFit(const Standard_Integer Xmin, const Standard_Integer Ymin, const Standard_Integer Xmax, const Standard_Integer Ymax)
+{
Standard_Real x1,y1,x2,y2;
Convert(Xmin,Ymin,x1,y1);
Convert(Xmax,Ymax,x2,y2);
ImmediateUpdate();
}
-void V3d_View::SetViewMappingDefault() {
+void V3d_View::SetViewMappingDefault()
+{
MyView->SetViewMapping(MyViewMapping) ;
MyView->SetViewMappingDefault();
ImmediateUpdate();
}
-void V3d_View::ResetViewMapping() {
-
+void V3d_View::ResetViewMapping()
+{
MyView->ViewMappingReset();
MyViewMapping = MyView->ViewMapping() ;
#ifdef IMP020300
#endif
}
-Standard_Real V3d_View::Convert(const Standard_Integer Vp) const {
+Standard_Real V3d_View::Convert(const Standard_Integer Vp) const
+{
Standard_Real Umin,Umax,Vmin,Vmax,Dxv,Vv ;
Standard_Integer Dxw,Dyw ;
return Vv ;
}
-void V3d_View::Convert(const Standard_Integer Xp, const Standard_Integer Yp, Standard_Real& Xv, Standard_Real& Yv) const {
+void V3d_View::Convert(const Standard_Integer Xp, const Standard_Integer Yp, Standard_Real& Xv, Standard_Real& Yv) const
+{
Standard_Real Umin,Umax,Vmin,Vmax,Dxv,Dyv ;
Standard_Integer Dxw,Dyw ;
Yp = Dyw - RealToInt (Dyw*(Yv - Vmin)/Dyv);
}
-void V3d_View::Convert(const Standard_Integer Xp, const Standard_Integer Yp, Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const {
-
+void V3d_View::Convert(const Standard_Integer Xp, const Standard_Integer Yp, Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const
+{
Graphic3d_Vertex Vrp ;
Vrp = (MyViewer->Viewer())->ConvertCoord(MyWindow,Xp,Yp) ;
Vrp.Coord(X,Y,Z) ;
}
#ifdef IMP240100
-void V3d_View::ConvertToGrid(const Standard_Integer Xp, const Standard_Integer Yp, Standard_Real& Xg, Standard_Real& Yg, Standard_Real& Zg) const {
-
+void V3d_View::ConvertToGrid(const Standard_Integer Xp, const Standard_Integer Yp, Standard_Real& Xg, Standard_Real& Yg, Standard_Real& Zg) const
+{
Graphic3d_Vertex Vrp ;
Vrp = (MyViewer->Viewer())->ConvertCoord(MyWindow,Xp,Yp) ;
if( MyViewer->Grid()->IsActive() ) {
Vrp.Coord(Xg,Yg,Zg) ;
}
-void V3d_View::ConvertToGrid(const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Real& Xg, Standard_Real& Yg, Standard_Real& Zg) const {
-
+void V3d_View::ConvertToGrid(const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Real& Xg, Standard_Real& Yg, Standard_Real& Zg) const
+{
if( MyViewer->Grid()->IsActive() ) {
Graphic3d_Vertex Vrp(X,Y,Z) ;
Graphic3d_Vertex NewVrp = Compute(Vrp) ;
#endif
#ifndef IMP240100
-void V3d_View::PixToRef(const Standard_Integer Xp, const Standard_Integer Yp, Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const {
-
+void V3d_View::PixToRef(const Standard_Integer Xp, const Standard_Integer Yp, Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const
+{
Graphic3d_Vertex Vrp ;
Vrp = (MyViewer->Viewer())->ConvertCoord(MyWindow,Xp,Yp) ;
Vrp.Coord(X,Y,Z) ;
#endif
#ifdef IMP240100
-void V3d_View::Convert(const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Integer& Xp, Standard_Integer& Yp) const {
+void V3d_View::Convert(const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Integer& Xp, Standard_Integer& Yp) const
#else
-void V3d_View::RefToPix(const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Integer& Xp, Standard_Integer& Yp) const {
+void V3d_View::RefToPix(const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Integer& Xp, Standard_Integer& Yp) const
#endif
-
+{
Graphic3d_Vertex Vrp(X,Y,Z) ;
(MyViewer->Viewer())->ConvertCoord(MyWindow,Vrp,Xp,Yp) ;
}
}
}
-void V3d_View::BackgroundColor(const Quantity_TypeOfColor Type,Standard_Real& V1, Standard_Real& V2, Standard_Real& V3)const {
-
-#ifdef GER61351
+void V3d_View::BackgroundColor(const Quantity_TypeOfColor Type,Standard_Real& V1, Standard_Real& V2, Standard_Real& V3) const
+{
Quantity_Color C = BackgroundColor() ;
-#else
- Quantity_Color C ;
- C = MyBackground.Color() ;
-#endif
C.Values(V1,V2,V3,Type) ;
}
-#ifdef GER61351
-Quantity_Color V3d_View::BackgroundColor() const {
-
+Quantity_Color V3d_View::BackgroundColor() const
+{
return MyBackground.Color() ;
}
-#endif
-void V3d_View::GradientBackgroundColors(Quantity_Color& Color1,Quantity_Color& Color2) const{
+void V3d_View::GradientBackgroundColors(Quantity_Color& Color1,Quantity_Color& Color2) const
+{
MyGradientBackground.Colors(Color1, Color2);
}
-Aspect_GradientBackground V3d_View::GradientBackground() const {
+Aspect_GradientBackground V3d_View::GradientBackground() const
+{
return MyGradientBackground;
}
-Standard_Real V3d_View::Scale()const {
+Standard_Real V3d_View::Scale() const
+{
Standard_Real Umin,Vmin,Umax,Vmax,Dxv ;
Visual3d_ViewMapping VMD = MyView->ViewMappingDefault() ;
Standard_Real S = 0. ;
return S ;
}
-void V3d_View::AxialScale(Standard_Real& Sx, Standard_Real& Sy, Standard_Real& Sz)const {
+void V3d_View::AxialScale(Standard_Real& Sx, Standard_Real& Sy, Standard_Real& Sz) const
+{
MyViewOrientation.AxialScale( Sx, Sy, Sz );
}
-void V3d_View::Center(Standard_Real& Xc, Standard_Real& Yc) const {
-
+void V3d_View::Center(Standard_Real& Xc, Standard_Real& Yc) const
+{
Standard_Real Umin,Vmin,Umax,Vmax ;
MyViewMapping.WindowLimit(Umin,Vmin,Umax,Vmax) ;
Yc = (Vmin + Vmax)/2. ;
}
-void V3d_View::Size(Standard_Real& Width, Standard_Real& Height) const {
-
+void V3d_View::Size(Standard_Real& Width, Standard_Real& Height) const
+{
Standard_Real Umin,Vmin,Umax,Vmax ;
MyViewMapping.WindowLimit(Umin,Vmin,Umax,Vmax) ;
Height = Vmax - Vmin ;
}
-Standard_Real V3d_View::ZSize() const {
-
+Standard_Real V3d_View::ZSize() const
+{
Standard_Real Wmin,Wmax,Depth ;
Wmax = MyViewMapping.FrontPlaneDistance() ;
return (Depth) ;
}
-Standard_Integer V3d_View::MinMax(Standard_Real& Umin, Standard_Real& Vmin, Standard_Real& Umax, Standard_Real& Vmax) const {
-
+Standard_Integer V3d_View::MinMax(Standard_Real& Umin, Standard_Real& Vmin, Standard_Real& Umax, Standard_Real& Vmax) const
+{
Standard_Real Wmin,Wmax,U,V,W ;
Standard_Real Xmin,Ymin,Zmin,Xmax,Ymax,Zmax ;
// CAL 6/11/98
return Nstruct ;
}
-Standard_Integer V3d_View::MinMax(Standard_Real& Xmin, Standard_Real& Ymin, Standard_Real& Zmin, Standard_Real& Xmax, Standard_Real& Ymax, Standard_Real& Zmax) const {
+Standard_Integer V3d_View::MinMax(Standard_Real& Xmin, Standard_Real& Ymin, Standard_Real& Zmin, Standard_Real& Xmax, Standard_Real& Ymax, Standard_Real& Zmax) const
+{
// CAL 6/11/98
// Standard_Integer Nstruct = (MyView->DisplayedStructures())->Extent() ;
Standard_Integer Nstruct = MyView->NumberOfDisplayedStructures() ;
return Nstruct ;
}
-Standard_Integer V3d_View::Gravity(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const {
-
+Standard_Integer V3d_View::Gravity(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const
+{
Standard_Real Xmin,Ymin,Zmin,Xmax,Ymax,Zmax,U,V,W ;
Standard_Real Umin,Vmin,Umax,Vmax ;
Standard_Integer Nstruct,Npoint ;
return Nstruct ;
}
-void V3d_View::Eye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const {
+void V3d_View::Eye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const
+{
Graphic3d_Vertex Prp ;
Graphic3d_Vector Vpn ;
Standard_Real Xrp,Yrp,Zrp,Xpn,Ypn,Zpn,Xat,Yat,Zat ;
X = Zrp*Xpn + Xat; Y = Zrp*Ypn + Yat; Z = Zrp*Zpn + Zat;
}
-void V3d_View::FocalReferencePoint(Standard_Real& X, Standard_Real& Y,Standard_Real& Z) const {
-
+void V3d_View::FocalReferencePoint(Standard_Real& X, Standard_Real& Y,Standard_Real& Z) const
+{
Graphic3d_Vertex PRP,VRPoint;
Graphic3d_Vector VRPlane;
Standard_Real FPD,Xprp,Yprp,Zprp;
else Eye(X,Y,Z);
}
-void V3d_View::ProjReferenceAxe(const Standard_Integer Xpix, const Standard_Integer Ypix, Standard_Real& XP, Standard_Real& YP, Standard_Real& ZP, Standard_Real& VX, Standard_Real& VY, Standard_Real& VZ) const {
-
+void V3d_View::ProjReferenceAxe(const Standard_Integer Xpix, const Standard_Integer Ypix, Standard_Real& XP, Standard_Real& YP, Standard_Real& ZP, Standard_Real& VX, Standard_Real& VY, Standard_Real& VZ) const
+{
Standard_Real Xo,Yo,Zo;
Convert(Xpix,Ypix,XP,YP,ZP);
}
}
-
-Standard_Real V3d_View::Depth() const {
+Standard_Real V3d_View::Depth() const
+{
Graphic3d_Vertex Prp ;
Standard_Real Xrp,Yrp,Zrp ;
return Zrp ;
}
-void V3d_View::Proj(Standard_Real& Dx, Standard_Real& Dy, Standard_Real& Dz) const {
+void V3d_View::Proj(Standard_Real& Dx, Standard_Real& Dy, Standard_Real& Dz) const
+{
Graphic3d_Vector Vpn ;
Vpn = MyViewOrientation.ViewReferencePlane() ;
Vpn.Coord(Dx,Dy,Dz) ;
}
-void V3d_View::At(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const {
+void V3d_View::At(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const
+{
Graphic3d_Vertex Vrp ;
Vrp = MyViewOrientation.ViewReferencePoint() ;
Vrp.Coord(X,Y,Z) ;
}
-void V3d_View::Up(Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const {
+void V3d_View::Up(Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz) const
+{
Graphic3d_Vector Vup ;
Vup = MyViewOrientation.ViewReferenceUp() ;
Vup.Coord(Vx,Vy,Vz) ;
}
-Standard_Real V3d_View::Twist()const {
+Standard_Real V3d_View::Twist() const
+{
Standard_Real Xup,Yup,Zup,Xpn,Ypn,Zpn,X0,Y0,Z0 ;
Standard_Real pvx,pvy,pvz,pvn,sca,angle ;
Graphic3d_Vector Vpn,Vup,Xaxis,Yaxis,Zaxis ;
return angle ;
}
-V3d_TypeOfShadingModel V3d_View::ShadingModel()const {
+V3d_TypeOfShadingModel V3d_View::ShadingModel() const
+{
V3d_TypeOfShadingModel SM = (V3d_TypeOfShadingModel)MyViewContext.Model() ;
return SM ;
}
-V3d_TypeOfSurfaceDetail V3d_View::SurfaceDetail()const {
+V3d_TypeOfSurfaceDetail V3d_View::SurfaceDetail() const
+{
V3d_TypeOfSurfaceDetail SM = (V3d_TypeOfSurfaceDetail)MyViewContext.SurfaceDetail() ;
return SM ;
}
-
-Handle_Graphic3d_TextureEnv V3d_View::TextureEnv() const {
+Handle_Graphic3d_TextureEnv V3d_View::TextureEnv() const
+{
Handle(Graphic3d_TextureEnv) SM = MyViewContext.TextureEnv() ;
return SM ;
}
-V3d_TypeOfVisualization V3d_View::Visualization()const {
+V3d_TypeOfVisualization V3d_View::Visualization() const
+{
V3d_TypeOfVisualization V =
(V3d_TypeOfVisualization)MyViewContext.Visualization() ;
return V ;
}
-Standard_Boolean V3d_View::Antialiasing()const {
+Standard_Boolean V3d_View::Antialiasing() const
+{
Standard_Boolean A = MyViewContext.AliasingIsOn() ;
return A ;
}
-Handle(V3d_Viewer) V3d_View::Viewer() const {
+Handle(V3d_Viewer) V3d_View::Viewer() const
+{
return MyViewer ;
}
-Standard_Boolean V3d_View::IfWindow() const {
+Standard_Boolean V3d_View::IfWindow() const
+{
Standard_Boolean TheStatus = MyView->IsDefined() ;
return TheStatus ;
}
-Handle(Aspect_Window) V3d_View::Window() const {
+Handle(Aspect_Window) V3d_View::Window() const
+{
return MyWindow;
}
-V3d_TypeOfView V3d_View::Type() const {
-
+V3d_TypeOfView V3d_View::Type() const
+{
return (MyType) ;
}
-void V3d_View::SetFocale( const Standard_Real focale ) {
-
+void V3d_View::SetFocale( const Standard_Real focale )
+{
Standard_TypeMismatch_Raise_if (MyType != V3d_PERSPECTIVE,
"the view is not a perspective view");
Standard_Real Xrp,Yrp,Zrp,ViewPlane,FrontPlane ;
ImmediateUpdate();
}
-Standard_Real V3d_View::Focale( ) const {
+Standard_Real V3d_View::Focale( ) const
+{
Standard_Real Xrp,Yrp,Zrp,ViewPlane,FrontPlane ;
Standard_Real focale = 0.0 ;
Graphic3d_Vertex Prp ;
return MyViewOrientation;
}
-Standard_Boolean V3d_View::ScreenAxis( const Graphic3d_Vector &Vpn, const Graphic3d_Vector &Vup, Graphic3d_Vector &Xaxe, Graphic3d_Vector &Yaxe, Graphic3d_Vector &Zaxe) {
+Standard_Boolean V3d_View::ScreenAxis( const Graphic3d_Vector &Vpn, const Graphic3d_Vector &Vup, Graphic3d_Vector &Xaxe, Graphic3d_Vector &Yaxe, Graphic3d_Vector &Zaxe)
+{
Standard_Real Xpn,Ypn,Zpn,Xup,Yup,Zup ;
Standard_Real dx1,dy1,dz1,dx2,dy2,dz2,xx,yy,zz ;
return Standard_True ;
}
-void V3d_View::InitMatrix( TColStd_Array2OfReal& Matrix ) {
+void V3d_View::InitMatrix( TColStd_Array2OfReal& Matrix )
+{
Standard_Integer LR = Matrix.LowerRow() ;
Standard_Integer UR = Matrix.UpperRow() ;
Standard_Integer LC = Matrix.LowerCol() ;
for( I=LR,J=LC ; I<=UR ; I++,J++ ) Matrix(I,J) = 1. ;
}
-Standard_Boolean V3d_View::Multiply (const TColStd_Array2OfReal& Left, const TColStd_Array2OfReal& Right, TColStd_Array2OfReal& Matrix) {
-
+Standard_Boolean V3d_View::Multiply (const TColStd_Array2OfReal& Left, const TColStd_Array2OfReal& Right, TColStd_Array2OfReal& Matrix)
+{
Standard_Integer llr = Left.LowerRow ();
Standard_Integer llc = Left.LowerCol ();
Standard_Integer luc = Left.UpperCol ();
/*----------------------------------------------------------------------*/
-void V3d_View::RotAxis( const Graphic3d_Vertex &Vrp, const Graphic3d_Vector &Axe, const Standard_Real angle, TColStd_Array2OfReal& Matrix ) {
+void V3d_View::RotAxis( const Graphic3d_Vertex &Vrp, const Graphic3d_Vector &Axe, const Standard_Real angle, TColStd_Array2OfReal& Matrix )
+{
Standard_Real Xrp,Yrp,Zrp,Xaxe,Yaxe,Zaxe ;
Standard_Real sina,cosa,cos1m,terms1,terms2,terms3 ;
Standard_Real termc12,termc13,termc23,vcal ;
/*----------------------------------------------------------------------*/
-Graphic3d_Vertex V3d_View::TrsPoint( const Graphic3d_Vertex &P, const TColStd_Array2OfReal &Matrix ) {
+Graphic3d_Vertex V3d_View::TrsPoint( const Graphic3d_Vertex &P, const TColStd_Array2OfReal &Matrix )
+{
Graphic3d_Vertex PP ;
Standard_Real X,Y,Z,XX,YY,ZZ ;
return PP ;
}
-Graphic3d_Vector V3d_View::TrsPoint( const Graphic3d_Vector& V, const TColStd_Array2OfReal& Matrix ) {
+Graphic3d_Vector V3d_View::TrsPoint( const Graphic3d_Vector& V, const TColStd_Array2OfReal& Matrix )
+{
Graphic3d_Vector VV ;
Standard_Real X,Y,Z,XX,YY,ZZ ;
return VV ;
}
-
-void V3d_View::Pan(const Standard_Integer Dx, const Standard_Integer Dy,const Quantity_Factor aZoomFactor) {
-
+void V3d_View::Pan(const Standard_Integer Dx, const Standard_Integer Dy,const Quantity_Factor aZoomFactor)
+{
Panning(Convert(Dx),Convert(Dy),aZoomFactor,Standard_True);
-
}
void V3d_View::Zoom (const Standard_Integer X1,
#endif
}
-Standard_Boolean V3d_View::AnimationModeIsOn () const {
+Standard_Boolean V3d_View::AnimationModeIsOn () const
+{
return MyView->AnimationModeIsOn();
}
const Standard_Boolean aDegenerationFlag
)
{
-
if ( anAnimationFlag )
MyAnimationFlags |= V3d_FLAG_ANIMATION;
else
Standard_Boolean V3d_View::AnimationMode( Standard_Boolean& isDegenerate ) const
{
-
isDegenerate = MyAnimationFlags & V3d_FLAG_DEGENERATION;
return MyAnimationFlags & V3d_FLAG_ANIMATION;
}
#endif
-void V3d_View::SetDegenerateModeOn() {
+void V3d_View::SetDegenerateModeOn()
+{
#ifdef G003
SetComputedMode(Standard_False);
#else
#ifdef G003
void V3d_View :: SetComputedMode ( const Standard_Boolean aMode )
{
-
if( aMode ) {
if( myComputedMode ) {
MyView -> SetComputedMode ( Standard_True );
MyView -> SetComputedMode ( Standard_False );
Update ();
}
-
-} // end V3d_View :: SetComputedMode
+}
Standard_Boolean V3d_View :: ComputedMode () const
{
-
return MyView -> ComputedMode ();
+}
-} // end V3d_View :: ComputedMode
-
-void V3d_View :: SetBackFacingModel (
- const V3d_TypeOfBackfacingModel aModel)
+void V3d_View :: SetBackFacingModel (const V3d_TypeOfBackfacingModel aModel)
{
-
MyView -> SetBackFacingModel ( Visual3d_TypeOfBackfacingModel(aModel) );
Redraw();
-} // end V3d_View :: SetBackFacingModel
-
-V3d_TypeOfBackfacingModel V3d_View :: BackFacingModel () const {
+}
+V3d_TypeOfBackfacingModel V3d_View :: BackFacingModel () const
+{
return V3d_TypeOfBackfacingModel(MyView -> BackFacingModel ());
-
-} // end V3d_View :: BackFacingModel
+}
#endif
-Standard_Boolean V3d_View::TransientManagerBeginDraw(const Standard_Boolean DoubleBuffer,const Standard_Boolean RetainMode) const {
+Standard_Boolean V3d_View::TransientManagerBeginDraw(const Standard_Boolean DoubleBuffer,const Standard_Boolean RetainMode) const
+{
return Visual3d_TransientManager::BeginDraw(MyView,DoubleBuffer,RetainMode);
}
-void V3d_View::TransientManagerClearDraw() const {
+void V3d_View::TransientManagerClearDraw() const
+{
Visual3d_TransientManager::ClearDraw(MyView);
}
-Standard_Boolean V3d_View::TransientManagerBeginAddDraw() const {
+Standard_Boolean V3d_View::TransientManagerBeginAddDraw() const
+{
return Visual3d_TransientManager::BeginAddDraw(MyView);
}
-void V3d_View::Init() {
+void V3d_View::Init()
+{
myComputedMode = MyViewer->ComputedMode();
#ifdef G003
if( !myComputedMode || !MyViewer->DefaultComputedMode() ) {
if ( env_walkthrow.Value () != "" ) MyProjModel = V3d_TPM_WALKTHROUGH;
else MyProjModel = V3d_TPM_SCREEN;
#endif
-
}
-void V3d_View::SetPlotter(const Handle(Graphic3d_Plotter)& aPlotter) {
+void V3d_View::SetPlotter(const Handle(Graphic3d_Plotter)& aPlotter)
+{
MyPlotter = aPlotter;
}
void V3d_View::Plot()
{
-
Viewer_BadValue_Raise_if( !MyPlotter.IsNull(), "view has no plotter");
-
MyView->Plot(MyPlotter);
}
Standard_Real V3d_View::Tumble (const Standard_Integer NbImages, const Standard_Boolean AnimationMode)
{
-
FullTimer.Reset ();
FullTimer.Start ();
<< endl;
return NbImages/CPUtime;
-
}
#define SCREENCOPY_FILENAME "screencopy3d.gif"
* Constant
*/
-// in case NO_TRACE_ECHO and NO_TRACE_POINTS, in V3d_View_4.cxx and
-// V3d_View.cxx, suspend MyGridEchoStructure and MyGridEchoGroup in cdl
-#define TRACE_ECHO
-#define NO_TRACE_VALUES
-#define NO_TRACE_POINTS
-
#define MYEPSILON1 0.0001 // Comparison with 0.0
#define MYEPSILON2 M_PI / 180. // Delta between 2 angles
-#ifdef TRACE_POINTS
-#include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_AspectText3d.hxx>
-#endif
-
-#ifdef TRACE_VALUES
-#include <Visual3d_ViewOrientation.hxx>
-#endif
-
-#if defined TRACE_VALUES || defined TRACE_POINTS
-static char *CAR [26] = {"a", "b", "c", "d", "e", "f", "g", "h",
- "i", "j", "k", "l", "m", "n", "o", "p",
- "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
-#endif
-
/*----------------------------------------------------------------------*/
-void V3d_View::SetGrid (const gp_Ax3& aPlane, const Handle(Aspect_Grid)& aGrid) {
-
+void V3d_View::SetGrid (const gp_Ax3& aPlane, const Handle(Aspect_Grid)& aGrid)
+{
MyPlane = aPlane;
MyGrid = aGrid;
-#ifdef TRACE_VALUES
- if (MyGrid->IsKind (STANDARD_TYPE (Aspect_RectangularGrid))) {
- cout << "Aspect_RectangularGrid" << endl;
-Handle(Aspect_RectangularGrid) theGrid = *(Handle(Aspect_RectangularGrid) *) &MyGrid;
- cout << "\tOrigine : " << theGrid->XOrigin () << ", "
- << theGrid->YOrigin () << endl;
- cout << "\tAngle : " << theGrid->RotationAngle () << endl;
- cout << "\tSteps : " << theGrid->XStep () << ", "
- << theGrid->YStep () << endl;
- }
- else {
- cout << "Aspect_CircularGrid" << endl;
-Handle(Aspect_CircularGrid) theGrid = *(Handle(Aspect_CircularGrid) *) &MyGrid;
- cout << "\tOrigine : " << theGrid->XOrigin () << ", "
- << theGrid->YOrigin () << endl;
- cout << "\tAngle : " << theGrid->RotationAngle () << endl;
- cout << "\tRadiusStep, Division : " << theGrid->RadiusStep ()
- << ", " << theGrid->DivisionNumber () << endl;
- }
-
-#endif
-
-Standard_Real xl, yl, zl;
-Standard_Real xdx, xdy, xdz;
-Standard_Real ydx, ydy, ydz;
-Standard_Real dx, dy, dz;
+ Standard_Real xl, yl, zl;
+ Standard_Real xdx, xdy, xdz;
+ Standard_Real ydx, ydy, ydz;
+ Standard_Real dx, dy, dz;
aPlane.Location ().Coord (xl, yl, zl);
aPlane.XDirection ().Coord (xdx, xdy, xdz);
aPlane.YDirection ().Coord (ydx, ydy, ydz);
aPlane.Direction ().Coord (dx, dy, dz);
-#ifdef TRACE_VALUES
-cout << "Grid Plane " << xl << ", " << yl << ", " << zl << endl;
-cout << "\tLocation " << xl << ", " << yl << ", " << zl << endl;
-cout << "\tDirection " << dx << ", " << dy << ", " << dz << endl;
-cout << "\tXDirection " << xdx << ", " << xdy << ", " << xdz << endl;
-cout << "\tYDirection " << ydx << ", " << ydy << ", " << ydz << endl;
-#endif
-
-Standard_Real CosAlpha = Cos (MyGrid->RotationAngle ());
-Standard_Real SinAlpha = Sin (MyGrid->RotationAngle ());
+ Standard_Real CosAlpha = Cos (MyGrid->RotationAngle ());
+ Standard_Real SinAlpha = Sin (MyGrid->RotationAngle ());
-TColStd_Array2OfReal Trsf1 (1, 4, 1, 4);
+ TColStd_Array2OfReal Trsf1 (1, 4, 1, 4);
Trsf1 (4, 4) = 1.0;
Trsf1 (4, 1) = Trsf1 (4, 2) = Trsf1 (4, 3) = 0.0;
// Translation
Trsf1 (2, 3) = dy,
Trsf1 (3, 3) = dz;
-TColStd_Array2OfReal Trsf2 (1, 4, 1, 4);
+ TColStd_Array2OfReal Trsf2 (1, 4, 1, 4);
Trsf2 (4, 4) = 1.0;
Trsf2 (4, 1) = Trsf2 (4, 2) = Trsf2 (4, 3) = 0.0;
// Translation of the origin
Trsf2 (2, 3) = 0.0,
Trsf2 (3, 3) = 1.0;
-Standard_Real valuetrsf;
-Standard_Real valueoldtrsf;
-Standard_Real valuenewtrsf;
-Standard_Integer i, j, k;
+ Standard_Real valuetrsf;
+ Standard_Real valueoldtrsf;
+ Standard_Real valuenewtrsf;
+ Standard_Integer i, j, k;
// Calculation of the product of matrices
for (i=1; i<=4; i++)
for (j=1; j<=4; j++) {
MyTrsf (i, j) = valuenewtrsf;
}
}
-
}
-void V3d_View::SetGridActivity (const Standard_Boolean AFlag) {
-
+void V3d_View::SetGridActivity (const Standard_Boolean AFlag)
+{
if (AFlag) MyGrid->Activate ();
else MyGrid->Deactivate ();
-
}
-void V3d_View::SetGridGraphicValues (const Handle(Aspect_Grid)&
-#ifdef TRACE_VALUES
- aGrid
-#endif
- ) {
-
-#ifdef TRACE_VALUES
-Standard_Real XSize, YSize, Radius, OffSet;
- if (aGrid->IsKind (STANDARD_TYPE (V3d_RectangularGrid))) {
- cout << "V3d_RectangularGrid" << endl;
-Handle(V3d_RectangularGrid) theGrid = *(Handle(V3d_RectangularGrid) *) &aGrid;
- theGrid->GraphicValues (XSize, YSize, OffSet);
- cout << "\tSizes : " << XSize << ", " << YSize << endl;
- cout << "\tOffSet : " << OffSet << endl;
- }
- else {
- cout << "V3d_CircularGrid" << endl;
-Handle(V3d_CircularGrid) theGrid = *(Handle(V3d_CircularGrid) *) &aGrid;
- theGrid->GraphicValues (Radius, OffSet);
- cout << "\tRadius : " << Radius << endl;
- cout << "\tOffSet : " << OffSet << endl;
- }
-#endif
-
+void V3d_View::SetGridGraphicValues (const Handle(Aspect_Grid)& )
+{
}
-Graphic3d_Vertex V3d_View::Compute (const Graphic3d_Vertex & AVertex) const {
-
-Graphic3d_Vertex CurPoint, NewPoint;
-Standard_Real X1, Y1, Z1, X2, Y2, Z2;
-Standard_Real XPp, YPp;
+Graphic3d_Vertex V3d_View::Compute (const Graphic3d_Vertex & AVertex) const
+{
+ Graphic3d_Vertex CurPoint, NewPoint;
+ Standard_Real X1, Y1, Z1, X2, Y2, Z2;
+ Standard_Real XPp, YPp;
MyView->ViewOrientation ().ViewReferencePlane ().Coord (X1, Y1, Z1);
MyPlane.Direction ().Coord (X2, Y2, Z2);
-gp_Dir VPN (X1, Y1, Z1);
-gp_Dir GPN (X2, Y2, Z2);
-
-#ifdef TRACE_VALUES
- cout << "View Plane : " << X1 << ", " << Y1 << ", " << Z1 << endl;
- cout << "Grid Plane " << X2 << ", " << Y2 << ", " << Z2 << endl;
- cout << "Angle VPN GPN : " << VPN.Angle (GPN) << endl;
-#endif
+ gp_Dir VPN (X1, Y1, Z1);
+ gp_Dir GPN (X2, Y2, Z2);
AVertex.Coord (X1, Y1, Z1);
Project (X1, Y1, Z1, XPp, YPp);
-#ifdef TRACE_VALUES
- cout << "AVertex : " << X1 << ", " << Y1 << ", " << Z1 << endl;
-#endif
-
// Casw when the plane of the grid and the plane of the view
// are perpendicular to MYEPSILON2 close radians
if (Abs (VPN.Angle (GPN) - M_PI / 2.) < MYEPSILON2) {
NewPoint.SetCoord (X1, Y1, Z1);
-#ifdef TRACE_POINTS
- TextAttrib->SetColor (Quantity_Color (Quantity_NOC_RED));
- MyGridEchoGroup->SetPrimitivesAspect (TextAttrib);
- MyGridEchoGroup->Text ("Q", NewPoint, 1./81.);
- MyGridEchoGroup->Polyline (AVertex, NewPoint);
- Update ();
-#endif
#ifdef IMP240100
MyViewer->ShowGridEcho(this,NewPoint);
-#else
-#ifdef TRACE_ECHO
-char *trace_echo = NULL;
- trace_echo = (char *)(getenv ("CSF_GraphicEcho"));
- if (trace_echo) {
- MyGridEchoGroup->Clear ();
- MyGridEchoGroup->Marker (NewPoint);
- Visual3d_TransientManager::BeginDraw
- (MyView, Standard_False, Standard_False);
- Visual3d_TransientManager::DrawStructure (MyGridEchoStructure);
- Visual3d_TransientManager::EndDraw (Standard_True);
- }
-#endif
#endif //IMP240100
return NewPoint;
}
-#ifdef TRACE_POINTS
-Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d ();
-Handle(Graphic3d_AspectText3d) TextAttrib = new Graphic3d_AspectText3d ();
-
- MyGridEchoGroup->Clear ();
-
- LineAttrib->SetColor (Quantity_Color (Quantity_NOC_RED));
- MyGridEchoGroup->SetGroupPrimitivesAspect (LineAttrib);
-
- TextAttrib->SetColor (Quantity_Color (Quantity_NOC_RED));
- MyGridEchoGroup->SetGroupPrimitivesAspect (TextAttrib);
-
- MyGridEchoGroup->Text ("P", AVertex, 1./81.);
- CurPoint.SetCoord (AVertex.X (), AVertex.Y (), AVertex.Z ());
-
- TextAttrib->SetColor (Quantity_Color (Quantity_NOC_GREEN));
- MyGridEchoGroup->SetPrimitivesAspect (TextAttrib);
-#endif
-
-Standard_Boolean IsRectangular =
+ Standard_Boolean IsRectangular =
MyGrid->IsKind (STANDARD_TYPE (Aspect_RectangularGrid));
-Graphic3d_Vertex P1;
+ Graphic3d_Vertex P1;
-Standard_Real XO = 0.0, YO = 0.0;
-Standard_Real XOp, YOp;
-Standard_Real XAp, YAp;
-Standard_Real XBp, YBp;
+ Standard_Real XO = 0.0, YO = 0.0;
+ Standard_Real XOp, YOp;
+ Standard_Real XAp, YAp;
+ Standard_Real XBp, YBp;
X1 = XO, Y1 = YO, Z1 = 0.0;
// MyTrsf * Point to return to the plane of 3D grid
Project (X2, Y2, Z2, XOp, YOp);
XPp = XPp - XOp, YPp = YPp - YOp;
-#ifdef TRACE_POINTS
- MyGridEchoGroup->Text ("O", CurPoint, 1./81.);
-#endif
-
-#ifdef TRACE_VALUES
- cout << "Projection de P : " << XPp << ", " << YPp << endl;
- cout << "Projection de O : " << XOp << ", " << YOp << endl;
-#endif
-
- if (IsRectangular) {
-Standard_Real XS, YS;
-Handle(Aspect_RectangularGrid) theGrid =
+ if (IsRectangular) {
+ Standard_Real XS, YS;
+ Handle(Aspect_RectangularGrid) theGrid =
*(Handle(Aspect_RectangularGrid) *) &MyGrid;
XS = theGrid->XStep (), YS = theGrid->YStep ();
Project (X2, Y2, Z2, XAp, YAp);
XAp = XAp - XOp, YAp = YAp - YOp;
-#ifdef TRACE_POINTS
- MyGridEchoGroup->Text ("A", CurPoint, 1./81.);
-#endif
-
X1 = XO, Y1 = YO + YS, Z1 = 0.0;
// MyTrsf * Point to return to the plane of 3D grid
P1.SetCoord (X1, Y1, Z1);
Project (X2, Y2, Z2, XBp, YBp);
XBp = XBp - XOp, YBp = YBp - YOp;
-#ifdef TRACE_POINTS
- MyGridEchoGroup->Text ("B", CurPoint, 1./81.);
-#endif
-
-#ifdef TRACE_VALUES
- cout << "Projection de A : " << XAp << ", " << YAp << endl;
- cout << "Projection de B : " << XBp << ", " << YBp << endl;
-#endif
-
-Standard_Real Determin = XAp*YBp - XBp*YAp;
+ Standard_Real Determin = XAp*YBp - XBp*YAp;
Z1 = 0.0;
if (Abs (Determin) > MYEPSILON1) {
Y1 = (Y1 > 0. ?
Standard_Real (Standard_Integer (Abs (Y1)+0.5)) * YS :
- Standard_Real (Standard_Integer (Abs (Y1)+0.5)) * YS);
-#ifdef TRACE_VALUES
- cout << "Chosen point : " << X1 << ", " << Y1 << endl;
-#endif
// MyTrsf * Point to return to the plane of 3D grid
P1.SetCoord (X1, Y1, Z1);
CurPoint = V3d_View::TrsPoint (P1, MyTrsf);
CurPoint.Coord (X2, Y2, Z2);
}
else {
-cout << "*****************" << endl;
-cout << "Zero Determinant!" << endl;
-cout << "*****************" << endl;
-#ifdef TRACE_VALUES
- cout << "Zero Determinant !" << endl;
-#endif
+ //cout << "*****************" << endl;
+ //cout << "Zero Determinant!" << endl;
+ //cout << "*****************" << endl;
AVertex.Coord (X2, Y2, Z2);
CurPoint.SetCoord (X2, Y2, Z2);
}
} // IsRectangular
- else {
-Standard_Real RS;
-Standard_Integer DN;
-Standard_Real Alpha;
-Handle(Aspect_CircularGrid) theGrid =
+ else {
+ Standard_Real RS;
+ Standard_Integer DN;
+ Standard_Real Alpha;
+ Handle(Aspect_CircularGrid) theGrid =
*(Handle(Aspect_CircularGrid) *) &MyGrid;
RS = theGrid->RadiusStep ();
DN = theGrid->DivisionNumber ();
Alpha = M_PI / Standard_Real (DN);
-Standard_Real DistOP = Sqrt (XPp*XPp + YPp*YPp);
+ Standard_Real DistOP = Sqrt (XPp*XPp + YPp*YPp);
-Standard_Integer i, ICur=0;
-Standard_Real Angle, AngleCur;
-Standard_Real XCurp=0, YCurp=0;
-gp_Dir2d OP (XPp, YPp);
+ Standard_Integer i, ICur=0;
+ Standard_Real Angle, AngleCur;
+ Standard_Real XCurp=0, YCurp=0;
+ gp_Dir2d OP (XPp, YPp);
AngleCur = 2 * M_PI;
for (i=1; i<=DN*2; i++) {
X1 = XO + Cos (Alpha * i) * RS,
ICur = i;
AngleCur = Angle;
XCurp = XAp, YCurp = YAp;
-#ifdef TRACE_VALUES
- cout << "Angle between OP and O" << CAR [i-1]
- << " : " << Angle << endl;
-#endif
}
-#ifdef TRACE_POINTS
- MyGridEchoGroup->Text (CAR [i-1], CurPoint, 1./81.);
-#endif
} // for (i=1; i<=DN*2; i++)
-Standard_Real DistOCur = Sqrt (XCurp*XCurp + YCurp*YCurp);
+ Standard_Real DistOCur = Sqrt (XCurp*XCurp + YCurp*YCurp);
// Determination of the circle of the grid closest to P
-Standard_Integer N = Standard_Integer (DistOP / DistOCur + 0.5);
-Standard_Real Radius = N * RS;
-#ifdef TRACE_VALUES
- cout << "Circle : " << N << " Radius : " << Radius << endl;
-#endif
+ Standard_Integer N = Standard_Integer (DistOP / DistOCur + 0.5);
+ Standard_Real Radius = N * RS;
X1 = Cos (Alpha * ICur) * Radius,
Y1 = Sin (Alpha * ICur) * Radius,
Z1 = 0.0;
-#ifdef TRACE_VALUES
- cout << "Chosen Point : " << X1 << ", " << Y1 << endl;
-#endif
// MyTrsf * Point to return to the plane of 3D grid
P1.SetCoord (X1, Y1, Z1);
CurPoint = V3d_View::TrsPoint (P1, MyTrsf);
NewPoint.SetCoord (CurPoint.X (), CurPoint.Y (), CurPoint.Z ());
-#ifdef TRACE_POINTS
- TextAttrib->SetColor (Quantity_Color (Quantity_NOC_RED));
- MyGridEchoGroup->SetPrimitivesAspect (TextAttrib);
- MyGridEchoGroup->Text ("Q", NewPoint, 1./81.);
- MyGridEchoGroup->Polyline (AVertex, NewPoint);
- Update ();
-#endif
#ifdef IMP240100
MyViewer->ShowGridEcho(this,NewPoint);
-#else
-#ifdef TRACE_ECHO
-char *trace_echo = NULL;
- trace_echo = (char *)(getenv ("CSF_GraphicEcho"));
- if (trace_echo) {
- MyGridEchoGroup->Clear ();
- MyGridEchoGroup->Marker (NewPoint);
- Visual3d_TransientManager::BeginDraw
- (MyView, Standard_False, Standard_False);
- Visual3d_TransientManager::DrawStructure (MyGridEchoStructure);
- Visual3d_TransientManager::EndDraw (Standard_True);
- }
-#endif
#endif //IMP240100
return NewPoint;
}
}
void V3d_View::TriedronDisplay (const Aspect_TypeOfTriedronPosition APosition,
- const Quantity_NameOfColor AColor, const Standard_Real AScale, const V3d_TypeOfVisualization AMode ) {
-
+ const Quantity_NameOfColor AColor, const Standard_Real AScale, const V3d_TypeOfVisualization AMode )
+{
MyView->TriedronDisplay (APosition, AColor, AScale, (AMode == V3d_WIREFRAME));
}
-void V3d_View::TriedronErase ( ) {
-
+void V3d_View::TriedronErase ( )
+{
MyView->TriedronErase ( );
}
-void V3d_View::TriedronEcho (const Aspect_TypeOfTriedronEcho AType ) {
-
+void V3d_View::TriedronEcho (const Aspect_TypeOfTriedronEcho AType )
+{
MyView->TriedronEcho (AType);
}
*/
#include <V3d_View.jxx>
-#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
- from higher API */
-#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
- from higher API */
+//BUC61044 25/10/01 SAV ; added functionality to control gl depth testing from higher API
+//BUC61045 25/10/01 SAV ; added functionality to control gl lighting from higher API
void V3d_View::EnableDepthTest( const Standard_Boolean enable ) const
{
-#ifdef BUC61044
MyView->EnableDepthTest( enable );
-#endif
}
Standard_Boolean V3d_View::IsDepthTestEnabled() const
{
-#ifdef BUC61044
return MyView->IsDepthTestEnabled();
-#else
- return Standard_True;
-#endif
}
void V3d_View::EnableGLLight( const Standard_Boolean enable ) const
{
-#ifdef BUC61045
MyView->EnableGLLight( enable );
-#endif
}
Standard_Boolean V3d_View::IsGLLightEnabled() const
{
-#ifdef BUC61045
return MyView->IsGLLightEnabled();
-#else
- return Standard_True;
-#endif
}
void V3d_View::SetLayerMgr(const Handle(V3d_LayerMgr)& aMgr)
************************************************************************/
-#define GER61351 //GG_15/12/99 Adds SetDefaultBackgroundColor()
-// and DefaultBackgroundColor() methods
+//GER61351 //GG_15/12/99 Adds SetDefaultBackgroundColor() and DefaultBackgroundColor() methods
#define IMP240100 //GG
// Initalize grid echo fields
if( V3 < 0. ) V3 = 0. ; else if( V3 > 1. ) V3 = 1. ;
Quantity_Color C(V1,V2,V3,Type) ;
-#ifdef GER61351
SetDefaultBackgroundColor(C);
-#else
- MyBackground.SetColor(C) ;
-#endif
}
-void V3d_Viewer::SetDefaultBackgroundColor(const Quantity_NameOfColor Name) {
-
+void V3d_Viewer::SetDefaultBackgroundColor(const Quantity_NameOfColor Name)
+{
Quantity_Color C(Name) ;
-#ifdef GER61351
SetDefaultBackgroundColor(C);
-#else
- MyBackground.SetColor(C) ;
-#endif
}
-#ifdef GER61351
-void V3d_Viewer::SetDefaultBackgroundColor(const Quantity_Color &Color) {
-
+void V3d_Viewer::SetDefaultBackgroundColor(const Quantity_Color &Color)
+{
MyBackground.SetColor(Color) ;
}
-#endif
void V3d_Viewer::SetDefaultBgGradientColors( const Quantity_NameOfColor Name1,
const Quantity_NameOfColor Name2,
MyViewer->SetUpdateMode((Aspect_TypeOfUpdate)Mode) ;
}
-void V3d_Viewer::DefaultBackgroundColor(const Quantity_TypeOfColor Type,Standard_Real &V1,Standard_Real &V2,Standard_Real &V3) const {
-
-#ifdef GER61351
+void V3d_Viewer::DefaultBackgroundColor(const Quantity_TypeOfColor Type,Standard_Real &V1,Standard_Real &V2,Standard_Real &V3) const
+{
Quantity_Color C = DefaultBackgroundColor();
-#else
- Quantity_Color C = MyBackground.Color() ;
-#endif
C.Values(V1,V2,V3,Type) ;
}
-#ifdef GER61351
-Quantity_Color V3d_Viewer::DefaultBackgroundColor() const {
+Quantity_Color V3d_Viewer::DefaultBackgroundColor() const
+{
return MyBackground.Color() ;
}
-#endif
-void V3d_Viewer::DefaultBgGradientColors(Quantity_Color& Color1,Quantity_Color& Color2) const{
+void V3d_Viewer::DefaultBgGradientColors(Quantity_Color& Color1,Quantity_Color& Color2) const
+{
MyGradientBackground.Colors(Color1,Color2);
}
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_Group.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
/*----------------------------------------------------------------------*/
/*
/*----------------------------------------------------------------------*/
-void V3d_Viewer::SetPrivilegedPlane(const gp_Ax3& aPlane) {
+void V3d_Viewer::SetPrivilegedPlane(const gp_Ax3& aPlane)
+{
myPrivilegedPlane = aPlane;
-#ifdef IMP240300
Grid()->SetDrawMode(Grid()->DrawMode());
- for (InitActiveViews (); MoreActiveViews (); NextActiveViews ()) {
+ for (InitActiveViews (); MoreActiveViews (); NextActiveViews ())
ActiveView ()->SetGrid (myPrivilegedPlane, Grid ());
- }
-#endif
- if(myDisplayPlane) {
- Standard_Real s = myDisplayPlaneLength;
- DisplayPrivilegedPlane(Standard_True,s);
-#ifdef IMP240300
- } else {
- Update();
-#else
+ if(myDisplayPlane)
+ DisplayPrivilegedPlane(Standard_True,myDisplayPlaneLength);
+ else
Update();
-#endif
- }
}
/*----------------------------------------------------------------------*/
-gp_Ax3 V3d_Viewer::PrivilegedPlane() const {
+
+gp_Ax3 V3d_Viewer::PrivilegedPlane() const
+{
return myPrivilegedPlane;
-
}
/*----------------------------------------------------------------------*/
-void V3d_Viewer::DisplayPrivilegedPlane(const Standard_Boolean OnOff, const Quantity_Length aSize) {
- Standard_Boolean Change = myDisplayPlane != OnOff;
+void V3d_Viewer::DisplayPrivilegedPlane(const Standard_Boolean OnOff, const Quantity_Length aSize)
+{
+ Standard_Boolean Change = (myDisplayPlane != OnOff);
myDisplayPlane = OnOff;
myDisplayPlaneLength = aSize;
- if(myDisplayPlane) {
+ if(myDisplayPlane)
+ {
if(myPlaneStructure.IsNull()) {
myPlaneStructure = new Graphic3d_Structure(MyViewer);
myPlaneStructure->SetInfiniteState(Standard_True);
}
else
myPlaneStructure->Clear();
-
-// Handle(Graphic3d_Structure) thePlaneStructure = new Graphic3d_Structure(MyViewer);
- Handle(Graphic3d_Group) Group = new Graphic3d_Group(myPlaneStructure) ;
+
+ Handle(Graphic3d_Group) Group = new Graphic3d_Group(myPlaneStructure);
Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d() ;
LineAttrib->SetColor(Quantity_Color(Quantity_NOC_GRAY60));
Handle(Graphic3d_AspectText3d) TextAttrib = new Graphic3d_AspectText3d();
TextAttrib->SetColor(Quantity_Color(Quantity_NOC_ROYALBLUE1));
Group->SetPrimitivesAspect(TextAttrib);
+
+ Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(6);
+
+ const gp_Pnt &p0 = myPrivilegedPlane.Location();
+
+ const gp_Pnt pX(p0.XYZ() + myDisplayPlaneLength*myPrivilegedPlane.XDirection().XYZ());
+ aPrims->AddVertex(p0);
+ aPrims->AddVertex(pX);
+ Group->Text(XLetter.ToCString(),Graphic3d_Vertex(pX.X(),pX.Y(),pX.Z()),1./81.);
+
+ const gp_Pnt pY(p0.XYZ() + myDisplayPlaneLength*myPrivilegedPlane.YDirection().XYZ());
+ aPrims->AddVertex(p0);
+ aPrims->AddVertex(pY);
+ Group->Text(YLetter.ToCString(),Graphic3d_Vertex(pY.X(),pY.Y(),pY.Z()),1./81.);
- Graphic3d_Array1OfVertex Points(0,1) ;
- Standard_Real xl,yl,zl;
- myPrivilegedPlane.Location().Coord(xl,yl,zl);
- Points(0).SetCoord(xl,yl,zl);
-
- Standard_Real ay,by,cy;
-
- myPrivilegedPlane.XDirection().Coord(ay,by,cy);
- Points(1).SetCoord(xl+myDisplayPlaneLength*ay,
- yl+myDisplayPlaneLength*by,
- zl+myDisplayPlaneLength*cy);
- Group->Polyline(Points);
- Group->Text(XLetter.ToCString(),Points(1),1./81.);
-
- myPrivilegedPlane.YDirection().Coord(ay,by,cy);
- Points(1).SetCoord(xl+myDisplayPlaneLength*ay,
- yl+myDisplayPlaneLength*by,
- zl+myDisplayPlaneLength*cy);
- Group->Polyline(Points);
- Group->Text(YLetter.ToCString(),Points(1),1./81.);
-
- myPrivilegedPlane.Direction().Coord(ay,by,cy);
- Points(1).SetCoord(xl+myDisplayPlaneLength*ay,
- yl+myDisplayPlaneLength*by,
- zl+myDisplayPlaneLength*cy);
- Group->Polyline(Points);
- Group->Text(ZLetter.ToCString(),Points(1),1./81.);
-#ifdef IMP240300
- myPlaneStructure->Display();
- } else {
+ const gp_Pnt pZ(p0.XYZ() + myDisplayPlaneLength*myPrivilegedPlane.Direction().XYZ());
+ aPrims->AddVertex(p0);
+ aPrims->AddVertex(pZ);
+ Group->Text(ZLetter.ToCString(),Graphic3d_Vertex(pZ.X(),pZ.Y(),pZ.Z()),1./81.);
+
+ Group->AddPrimitiveArray(aPrims);
+
+ myPlaneStructure->Display();
+ }
+ else
+ {
if( !myPlaneStructure.IsNull() ) myPlaneStructure->Erase();
-#endif
}
if(Change) Update();
}
}
static Graphic3d_Vertex lastVertex;
- if( Graphic3d_Vertex::Distance(aVertex,lastVertex) != 0.0 ) {
+ if( aVertex.Distance(lastVertex) != 0.0 ) {
lastVertex = aVertex;
myGridEchoGroup->Clear();
#ifdef OCC281
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic2d_GraphicObject.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_StructureManager.hxx>
#include <Graphic3d_VerticalTextAlignment.hxx>
Graphic3d_Vertex vertices_text;
vertices_text.SetCoord(aPosition.X(),aPosition.Y(),aPosition.Y());
TheGroup->SetPrimitivesAspect(aspect);
- TheGroup->BeginPrimitives();
TheGroup->Text(aText,vertices_text,aHeight,Standard_True);
- TheGroup->EndPrimitives();
*/
};
#include <gp_Pnt.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Graphic3d_ArrayOfPrimitives.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Poly_Array1OfTriangle.hxx>
#include <Poly_Triangle.hxx>
const Standard_Integer aMode)
{
aPresentation->Clear();
-
- Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPresentation);
- aGroup->BeginPrimitives ();
- aGroup->AddPrimitiveArray (myArray);
- aGroup->EndPrimitives ();
+ Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (myArray);
}
static bool CheckInputCommand (const TCollection_AsciiString theCommand,
#define RIC120302 //GG Add a NEW SetWindow method which enable
// to connect a graphic widget and context to OGL.
-#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing
- from higher API */
-#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting
- from higher API */
+//BUC61044 25/10/01 SAV ; added functionality to control gl depth testing from higher API
+//BUC61045 25/10/01 SAV ; added functionality to control gl lighting from higher API
-#define OCC1188 //SAV Added methods to set background image
+//OCC1188 SAV Added methods to set background image
/*----------------------------------------------------------------------*/
/*
const Aspect_FillMethod FillStyle,
const Standard_Boolean update )
{
-#ifdef OCC1188
if ( IsDeleted() )
return;
if ( !IsDefined() )
Update();
else if ( MyViewManager->UpdateMode() == Aspect_TOU_ASAP )
Update();
-#endif
}
void Visual3d_View::SetBgImageStyle( const Aspect_FillMethod FillStyle,
const Standard_Boolean update )
{
-#ifdef OCC1188
if ( IsDeleted() )
return;
if ( !IsDefined() )
Update();
else if ( MyViewManager->UpdateMode() == Aspect_TOU_ASAP )
Update();
-#endif
}
Aspect_Background Visual3d_View::Background () const {
void Visual3d_View::EnableDepthTest( const Standard_Boolean enable ) const
{
-#ifdef BUC61044
MyGraphicDriver->SetDepthTestEnabled( MyCView, enable );
-#endif
}
Standard_Boolean Visual3d_View::IsDepthTestEnabled() const
{
-#ifdef BUC61044
return MyGraphicDriver->IsDepthTestEnabled( MyCView );
-#else
- return Standard_True;
-#endif
}
void Visual3d_View::ReadDepths(const Standard_Integer x,
void Visual3d_View::EnableGLLight( const Standard_Boolean enable ) const
{
-#ifdef BUC61045
MyGraphicDriver->SetGLLightEnabled( MyCView, enable );
-#endif
}
Standard_Boolean Visual3d_View::IsGLLightEnabled() const
{
-#ifdef BUC61045
return MyGraphicDriver->IsGLLightEnabled( MyCView );
-#else
- return Standard_True;
-#endif
}
Standard_Boolean Visual3d_View::Export (const Standard_CString theFileName,
#include <StdPrs_ShadedShape.hxx>
#include <StdPrs_WFShape.hxx>
#include <AIS_Drawer.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
#include <Graphic3d_Group.hxx>
#include <Quantity_Color.hxx>
#include <Aspect_TypeOfLine.hxx>
set format PGF
-set size 21886
+set size 20398