mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-18 07:57:31 +08:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
39
samples/java/src/ISession/ISession_Curve.cxx
Executable file
39
samples/java/src/ISession/ISession_Curve.cxx
Executable file
@@ -0,0 +1,39 @@
|
||||
#include <ISession_Curve.ixx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <StdPrs_PoleCurve.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <StdPrs_Curve.hxx>
|
||||
|
||||
|
||||
|
||||
ISession_Curve::ISession_Curve(const Handle(Geom_Curve)& aCurve)
|
||||
:AIS_InteractiveObject(),myCurve(aCurve)
|
||||
{
|
||||
}
|
||||
|
||||
void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& ,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode)
|
||||
{
|
||||
GeomAdaptor_Curve anAdaptorCurve(myCurve);
|
||||
Handle(AIS_Drawer) aDrawer = new AIS_Drawer();
|
||||
aDrawer->LineAspect()->SetColor(Quantity_NOC_RED);
|
||||
|
||||
switch (aMode)
|
||||
{
|
||||
case 1 :
|
||||
StdPrs_PoleCurve::Add(aPresentation, anAdaptorCurve,aDrawer);
|
||||
case 0 :
|
||||
StdPrs_Curve::Add( aPresentation, anAdaptorCurve ,myDrawer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ISession_Curve::Compute(const Handle(Prs3d_Projector)& ,const Handle(Prs3d_Presentation)& )
|
||||
{
|
||||
}
|
||||
|
||||
void ISession_Curve::ComputeSelection(const Handle(SelectMgr_Selection)& ,const Standard_Integer )
|
||||
{
|
||||
}
|
||||
|
||||
90
samples/java/src/ISession/ISession_Direction.cxx
Executable file
90
samples/java/src/ISession/ISession_Direction.cxx
Executable file
@@ -0,0 +1,90 @@
|
||||
#include <ISession_Direction.ixx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <DsgPrs_LengthPresentation.hxx>
|
||||
#include <DsgPrs.hxx>
|
||||
#include <Graphic2d_SetOfSegments.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
|
||||
ISession_Direction::ISession_Direction()
|
||||
{
|
||||
}
|
||||
|
||||
ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Dir& aDir,const Standard_Real aLength,const Standard_Real anArrowLength)
|
||||
:myPnt(aPnt),myDir(aDir),myLength(aLength),myArrowLength(anArrowLength)
|
||||
{
|
||||
}
|
||||
|
||||
ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Vec& aVec,const Standard_Real aLength)
|
||||
:myPnt(aPnt),myDir(aVec),myArrowLength(aLength)
|
||||
{
|
||||
myLength = aVec.Magnitude();
|
||||
}
|
||||
|
||||
ISession_Direction::ISession_Direction(const gp_Pnt2d& aPnt2d,const gp_Dir2d& aDir2d,const Standard_Real aLength)
|
||||
:myPnt(gp_Pnt(aPnt2d.X(),aPnt2d.Y(),0)),myDir(gp_Dir(aDir2d.X(),aDir2d.Y(),0)),myLength(aLength)
|
||||
{
|
||||
}
|
||||
|
||||
ISession_Direction::ISession_Direction(const gp_Pnt2d& aPnt2d,const gp_Vec2d& aVec2d)
|
||||
:myPnt(gp_Pnt(aPnt2d.X(),aPnt2d.Y(),0)),myDir(gp_Dir(aVec2d.X(),aVec2d.Y(),0))
|
||||
{
|
||||
myLength = aVec2d.Magnitude();
|
||||
}
|
||||
|
||||
void ISession_Direction::SetText(const TCollection_ExtendedString& aText)
|
||||
{
|
||||
myText = aText;
|
||||
}
|
||||
|
||||
void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager3d)& ,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer )
|
||||
{
|
||||
Handle(Prs3d_ArrowAspect) anArrowAspect = myDrawer->ArrowAspect();
|
||||
anArrowAspect->SetLength(myArrowLength);
|
||||
myDrawer->SetArrowAspect(anArrowAspect);
|
||||
|
||||
gp_Pnt LastPoint = myPnt;
|
||||
LastPoint.Translate (myLength*gp_Vec(myDir));
|
||||
|
||||
if (myText.Length() == 0)
|
||||
DsgPrs_LengthPresentation::Add(aPresentation,myDrawer,myPnt,LastPoint,DsgPrs_AS_LASTAR);
|
||||
else
|
||||
{
|
||||
gp_Pnt OffsetPoint = myPnt;
|
||||
OffsetPoint.Translate ((myLength) *gp_Vec(myDir));
|
||||
DsgPrs_LengthPresentation::Add(aPresentation,myDrawer,myText,myPnt,LastPoint, -myDir, OffsetPoint, DsgPrs_AS_LASTAR);
|
||||
}
|
||||
}
|
||||
|
||||
void ISession_Direction::Compute(const Handle(Prs3d_Projector)& ,const Handle(Prs3d_Presentation)& )
|
||||
{
|
||||
}
|
||||
|
||||
void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager2d)& ,const Handle(Graphic2d_GraphicObject)& aGrObj,const Standard_Integer )
|
||||
{
|
||||
Handle(Graphic2d_SetOfSegments) segment;
|
||||
segment = new Graphic2d_SetOfSegments(aGrObj);
|
||||
|
||||
segment->Add(myPnt.X(),
|
||||
myPnt.Y(),
|
||||
myPnt.X()+myLength*myDir.X(),
|
||||
myPnt.Y()+myLength*myDir.Y());
|
||||
|
||||
gp_Dir2d aFirstDir = gp_Dir2d(myDir.X(),myDir.Y()).Rotated (200*PI180);
|
||||
segment->Add(myPnt.X()+myLength*myDir.X(),
|
||||
myPnt.Y()+myLength*myDir.Y(),
|
||||
myPnt.X()+myLength*myDir.X()+ myLength*aFirstDir.X()/5,
|
||||
myPnt.Y()+myLength*myDir.Y()+ myLength*aFirstDir.Y()/5);
|
||||
|
||||
gp_Dir2d aSecondDir = gp_Dir2d(myDir.X(),myDir.Y()).Rotated (-200*PI180);
|
||||
segment->Add(myPnt.X()+myLength*myDir.X(),
|
||||
myPnt.Y()+myLength*myDir.Y(),
|
||||
myPnt.X()+myLength*myDir.X()+ myLength*aSecondDir.X()/5,
|
||||
myPnt.Y()+myLength*myDir.Y()+ myLength*aSecondDir.Y()/5);
|
||||
}
|
||||
|
||||
void ISession_Direction::ComputeSelection(const Handle(SelectMgr_Selection)& ,const Standard_Integer )
|
||||
{
|
||||
}
|
||||
|
||||
45
samples/java/src/ISession/ISession_Point.cxx
Executable file
45
samples/java/src/ISession/ISession_Point.cxx
Executable file
@@ -0,0 +1,45 @@
|
||||
#include <ISession_Point.ixx>
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
#include <StdPrs_Point.hxx>
|
||||
#include <Graphic2d_CircleMarker.hxx>
|
||||
|
||||
|
||||
ISession_Point::ISession_Point()
|
||||
{
|
||||
}
|
||||
|
||||
ISession_Point::ISession_Point(const Standard_Real X,const Standard_Real Y,const Standard_Real Z)
|
||||
:myPoint(gp_Pnt(X,Y,Z))
|
||||
{
|
||||
}
|
||||
|
||||
ISession_Point::ISession_Point(const gp_Pnt2d& aPoint,const Standard_Real Elevation)
|
||||
:myPoint(gp_Pnt(aPoint.X(),aPoint.Y(),Elevation))
|
||||
{
|
||||
}
|
||||
|
||||
ISession_Point::ISession_Point(const gp_Pnt& aPoint)
|
||||
:myPoint(aPoint)
|
||||
{
|
||||
}
|
||||
|
||||
void ISession_Point::Compute(const Handle(PrsMgr_PresentationManager3d)& ,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer )
|
||||
{
|
||||
Handle(Geom_CartesianPoint) aGeomPoint = new Geom_CartesianPoint(myPoint);
|
||||
StdPrs_Point::Add(aPresentation,aGeomPoint,myDrawer);
|
||||
}
|
||||
|
||||
void ISession_Point::Compute(const Handle(Prs3d_Projector)& ,const Handle(Prs3d_Presentation)& )
|
||||
{
|
||||
}
|
||||
|
||||
void ISession_Point::Compute(const Handle(PrsMgr_PresentationManager2d)& ,const Handle(Graphic2d_GraphicObject)& aGrObj,const Standard_Integer )
|
||||
{
|
||||
Handle(Graphic2d_CircleMarker) aCircleMarker;
|
||||
aCircleMarker = new Graphic2d_CircleMarker(aGrObj,myPoint.X(),myPoint.Y(),0,0,1);
|
||||
}
|
||||
|
||||
void ISession_Point::ComputeSelection(const Handle(SelectMgr_Selection)& ,const Standard_Integer )
|
||||
{
|
||||
}
|
||||
|
||||
49
samples/java/src/ISession/ISession_Surface.cxx
Executable file
49
samples/java/src/ISession/ISession_Surface.cxx
Executable file
@@ -0,0 +1,49 @@
|
||||
#include <ISession_Surface.ixx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <StdPrs_ShadedSurface.hxx>
|
||||
#include <StdPrs_WFPoleSurface.hxx>
|
||||
#include <StdPrs_WFSurface.hxx>
|
||||
|
||||
|
||||
ISession_Surface::ISession_Surface()
|
||||
{
|
||||
}
|
||||
|
||||
ISession_Surface::ISession_Surface(const Handle(Geom_Surface)& aSurface)
|
||||
:AIS_InteractiveObject(),mySurface(aSurface)
|
||||
{
|
||||
}
|
||||
|
||||
void ISession_Surface::Compute(const Handle(PrsMgr_PresentationManager3d)& ,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode)
|
||||
{
|
||||
GeomAdaptor_Surface anAdaptorSurface(mySurface);
|
||||
Handle(GeomAdaptor_HSurface) anAdaptorHSurface = new GeomAdaptor_HSurface(mySurface);
|
||||
|
||||
Handle(AIS_Drawer) aDrawer = new AIS_Drawer();
|
||||
aDrawer->LineAspect()->SetColor(Quantity_NOC_YELLOW3);
|
||||
|
||||
switch (aMode)
|
||||
{
|
||||
case 2:
|
||||
StdPrs_ShadedSurface::Add(aPresentation,anAdaptorSurface,myDrawer);
|
||||
break;
|
||||
case 1 :
|
||||
StdPrs_WFPoleSurface::Add(aPresentation,anAdaptorSurface,aDrawer);
|
||||
case 0 :
|
||||
StdPrs_WFSurface::Add(aPresentation,anAdaptorHSurface,myDrawer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ISession_Surface::Compute(const Handle(Prs3d_Projector)& ,const Handle(Prs3d_Presentation)& )
|
||||
{
|
||||
}
|
||||
|
||||
void ISession_Surface::ComputeSelection(const Handle(SelectMgr_Selection)& ,const Standard_Integer )
|
||||
{
|
||||
}
|
||||
|
||||
56
samples/java/src/ISession/ISession_Text.cxx
Executable file
56
samples/java/src/ISession/ISession_Text.cxx
Executable file
@@ -0,0 +1,56 @@
|
||||
#include <ISession_Text.ixx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <Graphic2d_Text.hxx>
|
||||
|
||||
|
||||
|
||||
ISession_Text::ISession_Text()
|
||||
{
|
||||
}
|
||||
|
||||
ISession_Text::ISession_Text(const TCollection_AsciiString& aText,const Standard_Real anX,const Standard_Real anY,const Standard_Real aZ,const Aspect_TypeOfText aType,const Quantity_PlaneAngle anAngle,const Standard_Real aSlant,const Standard_Integer aColorIndex,const Standard_Integer aFontIndex,const Quantity_Factor aScale)
|
||||
: AIS_InteractiveObject(),MyText(aText),MyX(anX),MyY(anY),MyZ(aZ),
|
||||
MyTypeOfText(aType),MyAngle(anAngle),MySlant(aSlant),
|
||||
MyColorIndex(aColorIndex),MyFontIndex(aFontIndex),
|
||||
MyScale(aScale),MyWidth(0),MyHeight(0)
|
||||
{
|
||||
}
|
||||
|
||||
ISession_Text::ISession_Text(const TCollection_AsciiString& aText,const gp_Pnt& aPoint,const Aspect_TypeOfText aType,const Quantity_PlaneAngle anAngle,const Standard_Real aSlant,const Standard_Integer aColorIndex,const Standard_Integer aFontIndex,const Quantity_Factor aScale)
|
||||
:AIS_InteractiveObject(),MyText(aText),MyX(aPoint.X()),MyY(aPoint.Y()),MyZ(aPoint.Z()),
|
||||
MyTypeOfText(aType),MyAngle(anAngle),MySlant(aSlant),
|
||||
MyColorIndex(aColorIndex),MyFontIndex(aFontIndex),
|
||||
MyScale(aScale),MyWidth(0),MyHeight(0)
|
||||
{
|
||||
}
|
||||
|
||||
void ISession_Text::Compute(const Handle(PrsMgr_PresentationManager3d)& ,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer )
|
||||
{
|
||||
Prs3d_Text::Draw(aPresentation,myDrawer,MyText,gp_Pnt(MyX,MyY,MyZ));
|
||||
}
|
||||
|
||||
void ISession_Text::Compute(const Handle(Prs3d_Projector)& ,const Handle(Prs3d_Presentation)& )
|
||||
{
|
||||
}
|
||||
|
||||
void ISession_Text::Compute(const Handle(PrsMgr_PresentationManager2d)& ,const Handle(Graphic2d_GraphicObject)& aGrObj,const Standard_Integer )
|
||||
{
|
||||
Handle(Graphic2d_Text) text;
|
||||
text = new Graphic2d_Text(aGrObj, MyText, MyX, MyY, MyAngle, MyTypeOfText, MyScale);
|
||||
text->SetFontIndex(MyFontIndex);
|
||||
|
||||
text->SetColorIndex(MyColorIndex);
|
||||
|
||||
text->SetSlant(MySlant);
|
||||
text->SetUnderline(Standard_False);
|
||||
text->SetZoomable(Standard_True);
|
||||
aGrObj->Display();
|
||||
Quantity_Length anXoffset,anYoffset;
|
||||
text->TextSize(MyWidth, MyHeight,anXoffset,anYoffset);
|
||||
}
|
||||
|
||||
void ISession_Text::ComputeSelection(const Handle(SelectMgr_Selection)& ,const Standard_Integer )
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user