mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Compare commits
7 Commits
deg_curve_
...
NewGEOM_2.
Author | SHA1 | Date | |
---|---|---|---|
|
87e6cca9a7 | ||
|
9d2f9eb5c3 | ||
|
d057720d07 | ||
|
84eea67f81 | ||
|
9d84c361f5 | ||
|
d486ae29c5 | ||
|
7c49995584 |
@@ -2354,13 +2354,32 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
myMainPM->Erase (theIObj, -1);
|
||||
|
||||
// Object removes from Detected sequence
|
||||
for (Standard_Integer aDetIter = myDetectedSeq.Lower(); aDetIter <= myDetectedSeq.Upper(); ++aDetIter)
|
||||
Standard_Integer aDetIter = myDetectedSeq.Lower();
|
||||
while (aDetIter <= myDetectedSeq.Upper())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj = DetectedCurrentObject();
|
||||
Handle(SelectMgr_EntityOwner) aPicked = myMainSel->Picked (myDetectedSeq (aDetIter));
|
||||
Handle(AIS_InteractiveObject) anObj;
|
||||
if (!aPicked.IsNull())
|
||||
{
|
||||
anObj = Handle(AIS_InteractiveObject)::DownCast (aPicked->Selectable());
|
||||
}
|
||||
|
||||
if (!anObj.IsNull()
|
||||
&& anObj != theIObj)
|
||||
&& anObj == theIObj)
|
||||
{
|
||||
myDetectedSeq.Remove (aDetIter);
|
||||
if (myCurDetected == aDetIter)
|
||||
{
|
||||
myCurDetected = Min (myDetectedSeq.Upper(), aDetIter);
|
||||
}
|
||||
if (myCurHighlighted == aDetIter)
|
||||
{
|
||||
myCurHighlighted = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aDetIter++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2382,6 +2401,7 @@ void AIS_InteractiveContext::ClearGlobal (const Handle(AIS_InteractiveObject)& t
|
||||
|| myLastPicked->IsSameSelectable(theIObj))
|
||||
{
|
||||
myLastinMain.Nullify();
|
||||
myLastPicked.Nullify();
|
||||
myMainPM->ClearImmediateDraw();
|
||||
}
|
||||
}
|
||||
|
@@ -1205,6 +1205,9 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
if (theOwner.IsNull() || !theOwner->HasSelectable())
|
||||
return;
|
||||
|
||||
if (!myFilters->IsOk(theOwner) && !theOwner->IsSelected())
|
||||
return;
|
||||
|
||||
AIS_SelectStatus aSelStat = mySelection->Select (theOwner);
|
||||
|
||||
Standard_Integer aState = aSelStat == AIS_SS_Added ? 1 : 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -17,18 +17,31 @@
|
||||
#ifndef _AIS_Trihedron_HeaderFile
|
||||
#define _AIS_Trihedron_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
#include <Prs3d_DatumMode.hxx>
|
||||
#include <Prs3d_DatumParts.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
|
||||
class Geom_Axis2Placement;
|
||||
class AIS_InteractiveObject;
|
||||
class AIS_Axis;
|
||||
@@ -46,26 +59,24 @@ class AIS_Trihedron;
|
||||
DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject)
|
||||
|
||||
//! Create a selectable trihedron
|
||||
//! there are 4 modes of selection :
|
||||
//! mode = 0 to select trihedron ,priority = 1
|
||||
//! mode = 1 to select its origin ,priority = 5
|
||||
//! mode = 2 to select its axis ,priority = 3
|
||||
//! mode = 3 to select its planes ,priority = 2
|
||||
//! a trihedron has 1 origin, 3 axes and 3 planes.
|
||||
//! The trihedron includes 1 origin, 3 axes and 3 labels.
|
||||
//! Default text of labels are "X", "Y", "Z".
|
||||
//! Color of origin and any axis, color of arrows and labels may be changed.
|
||||
//! Visual presentation might be shown in two, shading and wireframe modes(wireframe by default)
|
||||
//! There are 4 modes of selection :
|
||||
//! mode = 0 to select trihedron, priority = 1
|
||||
//! mode = 1 to select its origin, priority = 5
|
||||
//! mode = 2 to select its axis, priority = 3
|
||||
//! mode = 3 to select its planes, priority = 2
|
||||
//! Warning
|
||||
//! For the presentation of trihedra, the default unit of
|
||||
//! length is the millimeter, and the default value for the
|
||||
//! representation of axes is 10. To modify these
|
||||
//! For the presentation of trihedron, the default unit of
|
||||
//! length is the millimetre, and the default value for the
|
||||
//! representation of the axes is 100. If you modify these
|
||||
//! dimensions, you must temporarily recover the Drawer.
|
||||
//! From inside it, you take the aspect in which the values
|
||||
//! for length are stocked. For trihedra, this is FirstAxisLength from
|
||||
//! Prs3d_DatumAspect(). Change the
|
||||
//! for length are stocked. For trihedron, this is
|
||||
//! Prs3d_Drawer_LineAspect. You change the
|
||||
//! values inside this Aspect and recalculate the presentation.
|
||||
//! If you want to use extended selection modes, different than 0,
|
||||
//! you should take care of removing of the shapes from the interactive
|
||||
//! context that has been computed for selection; it might be necessary
|
||||
//! when you change selection mode. You can use methods Axis, Point,
|
||||
//! Plane to retrieve the shapes.
|
||||
class AIS_Trihedron : public AIS_InteractiveObject
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject)
|
||||
@@ -75,18 +86,24 @@ public:
|
||||
//! Initializes a trihedron entity.
|
||||
Standard_EXPORT AIS_Trihedron(const Handle(Geom_Axis2Placement)& aComponent);
|
||||
|
||||
//! Sets Shading or Wireframe display mode, triangle or segment graphic group is used relatively.
|
||||
Standard_EXPORT void SetDatumDisplayMode(const Prs3d_DatumMode& theMode) { myDisplayMode = theMode; }
|
||||
|
||||
//! Returns datum display mode.
|
||||
Standard_EXPORT Prs3d_DatumMode DatumDisplayMode() const { return myDisplayMode; }
|
||||
|
||||
//! Returns the right-handed coordinate system set in SetComponent.
|
||||
const Handle(Geom_Axis2Placement)& Component() const;
|
||||
|
||||
Standard_EXPORT const Handle(Geom_Axis2Placement)& Component() const { return myComponent; }
|
||||
|
||||
//! Constructs the right-handed coordinate system aComponent.
|
||||
Standard_EXPORT void SetComponent (const Handle(Geom_Axis2Placement)& aComponent);
|
||||
|
||||
Standard_EXPORT void SetComponent (const Handle(Geom_Axis2Placement)& theComponent);
|
||||
|
||||
//! Returns true if the trihedron object has a size other
|
||||
//! than the default size of 10 mm. along each axis.
|
||||
Standard_Boolean HasOwnSize() const;
|
||||
|
||||
//! than the default size of 100 mm. along each axis.
|
||||
Standard_Boolean HasOwnSize() const;
|
||||
|
||||
//! Sets the size aValue for the trihedron object.
|
||||
//! The default value is 10 mm.
|
||||
//! The default value is 100 mm.
|
||||
Standard_EXPORT void SetSize (const Standard_Real aValue);
|
||||
|
||||
//! Removes any non-default settings for size of this
|
||||
@@ -95,43 +112,9 @@ public:
|
||||
|
||||
Standard_EXPORT Standard_Real Size() const;
|
||||
|
||||
//! Returns the "XAxis".
|
||||
Standard_EXPORT Handle(AIS_Axis) XAxis() const;
|
||||
|
||||
//! Returns the "YAxis".
|
||||
Standard_EXPORT Handle(AIS_Axis) YAxis() const;
|
||||
|
||||
//! Returns the main Axis.
|
||||
Standard_EXPORT Handle(AIS_Axis) Axis() const;
|
||||
|
||||
//! Returns the origine.
|
||||
Standard_EXPORT Handle(AIS_Point) Position() const;
|
||||
|
||||
//! Returns the "XYPlane".
|
||||
Standard_EXPORT Handle(AIS_Plane) XYPlane() const;
|
||||
|
||||
//! Returns the "XZPlane".
|
||||
Standard_EXPORT Handle(AIS_Plane) XZPlane() const;
|
||||
|
||||
//! Returns the "YZPlane".
|
||||
Standard_EXPORT Handle(AIS_Plane) YZPlane() const;
|
||||
|
||||
//! connection to <aCtx> default drawer implies a recomputation
|
||||
//! of SubObjects values.
|
||||
Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& aCtx) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the display mode selected, aMode, is
|
||||
//! valid for trihedron datums.
|
||||
Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
|
||||
|
||||
//! Computes the presentation according to a point of view
|
||||
//! given by <aProjector>.
|
||||
//! To be Used when the associated degenerated Presentations
|
||||
//! have been transformed by <aTrsf> which is not a Pure
|
||||
//! Translation. The HLR Prs can't be deducted automatically
|
||||
//! WARNING :<aTrsf> must be applied
|
||||
//! to the object to display before computation !!!
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
//! Returns index 3, selection of the planes XOY, YOZ, XOZ.
|
||||
Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE;
|
||||
@@ -139,63 +122,154 @@ public:
|
||||
//! Indicates that the type of Interactive Object is datum.
|
||||
Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE;
|
||||
|
||||
//! Sets the color aColor for this trihedron object.
|
||||
Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void SetTextColor (const Quantity_NameOfColor aColor);
|
||||
//! Sets the color theColor for this trihedron object, it changes color of axes.
|
||||
Standard_EXPORT void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE;
|
||||
|
||||
//! Sets the color theColor for this trihedron object, it changes color of axes.
|
||||
Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
|
||||
|
||||
//! Sets color of label of trihedron axes.
|
||||
Standard_EXPORT void SetTextColor (const Quantity_NameOfColor theColor);
|
||||
|
||||
//! Sets color of label of trihedron axes.
|
||||
Standard_EXPORT void SetTextColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Returns true if trihedron has own text color
|
||||
Standard_EXPORT Standard_Boolean HasTextColor() const;
|
||||
|
||||
Standard_EXPORT Quantity_NameOfColor TextColor() const;
|
||||
|
||||
Standard_EXPORT void SetArrowColor (const Quantity_NameOfColor aColor);
|
||||
//! Returns trihedron text color
|
||||
Standard_EXPORT Quantity_Color TextColor() const;
|
||||
|
||||
//! Sets color of arrow of trihedron axes. Used only in wireframe mode
|
||||
Standard_EXPORT void SetArrowColor (const Quantity_NameOfColor theColor);
|
||||
|
||||
//! Sets color of arrow of trihedron axes. Used only in wireframe mode
|
||||
Standard_EXPORT void SetArrowColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Returns true if trihedron has own arrow color
|
||||
Standard_EXPORT Standard_Boolean HasArrowColor() const;
|
||||
|
||||
Standard_EXPORT Quantity_NameOfColor ArrowColor() const;
|
||||
|
||||
//! Returns the four extremities of the trihedron from the
|
||||
//! array of points, TheExtrem.
|
||||
Standard_EXPORT void ExtremityPoints (TColgp_Array1OfPnt& TheExtrem) const;
|
||||
//! Returns trihedron arrow color
|
||||
Standard_EXPORT Quantity_Color ArrowColor() const;
|
||||
|
||||
//! Removes the settings for color.
|
||||
Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
|
||||
|
||||
//! Removes the non-default settings for width set in SetWidth.
|
||||
Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
|
||||
//! Sets color of datum part: origin or some of trihedron axes.
|
||||
//! If presentation is shading mode, this color is set for both sides of facing model
|
||||
Standard_EXPORT void SetColor (const Prs3d_DatumParts& thePart,
|
||||
const Quantity_Color& theColor);
|
||||
|
||||
//! Returns color of datum part: origin or some of trihedron axes.
|
||||
Standard_EXPORT Quantity_Color Color (const Prs3d_DatumParts& thePart);
|
||||
|
||||
//! Sets color of origin.
|
||||
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||
Standard_EXPORT void SetOriginColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Sets color of x-axis.
|
||||
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||
Standard_EXPORT void SetXAxisColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Sets color of y-axis.
|
||||
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||
Standard_EXPORT void SetYAxisColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Sets color of z-axis.
|
||||
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
|
||||
Standard_EXPORT void SetAxisColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Sets priority of selection for owner of the given type
|
||||
Standard_EXPORT void SetSelectionPriority(const Prs3d_DatumParts& thePart, const Standard_Integer thePriority)
|
||||
{
|
||||
mySelectionPriority.Bind(thePart, thePriority);
|
||||
}
|
||||
|
||||
//! Sets priority of selection for owner of the given type
|
||||
Standard_EXPORT Standard_Integer SelectionPriority(const Prs3d_DatumParts& thePart)
|
||||
{
|
||||
return mySelectionPriority.Find(thePart);
|
||||
}
|
||||
|
||||
//! Sets text label for trihedron axis. Parameter thePart should be XAxis, YAxis or ZAxis
|
||||
Standard_EXPORT void SetLabel(const Prs3d_DatumParts& thePart, const TCollection_ExtendedString& thePriority)
|
||||
{
|
||||
myLabel.Bind(thePart, thePriority);
|
||||
}
|
||||
|
||||
//! Returns text of axis. Parameter thePart should be XAxis, YAxis or ZAxis
|
||||
Standard_EXPORT const TCollection_ExtendedString& Label(const Prs3d_DatumParts& thePart)
|
||||
{
|
||||
return myLabel.Find(thePart);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
|
||||
Standard_EXPORT virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE;
|
||||
|
||||
//! Method which clear all selected owners belonging
|
||||
//! to this selectable object ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
|
||||
|
||||
//! Method which draws selected owners ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const SelectMgr_SequenceOfOwner& theOwners) Standard_OVERRIDE;
|
||||
|
||||
//! Method which hilight an owner belonging to
|
||||
//! this selectable object ( for fast presentation draw ).
|
||||
Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT virtual void setLocalTransformation (const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE;
|
||||
//! Compute trihedron presentation.
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
//! This compute is unavailable for trihedron presentation.
|
||||
void Compute (const Handle(Prs3d_Projector)& , const Handle(Prs3d_Presentation)& ) Standard_OVERRIDE {}
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void LoadSubObjects();
|
||||
//! This compute is unavailable for trihedron presentation.
|
||||
Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& theProjector,
|
||||
const Handle(Geom_Transformation)& theTrsf,
|
||||
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE;
|
||||
|
||||
//! Compute selection.
|
||||
Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Computes presentation for display mode equal 1.
|
||||
Standard_EXPORT void ComputePresentation (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs);
|
||||
|
||||
Standard_EXPORT void LoadRecomputable (const Standard_Integer TheMode);
|
||||
|
||||
//! Created a sensitive entity for the datum part that will be used in selection owner creation
|
||||
Handle(SelectBasics_SensitiveEntity) CreateSensitiveEntity(const Prs3d_DatumParts& thePart,
|
||||
const Handle(SelectBasics_EntityOwner)& theOwner) const;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Geom_Axis2Placement) myComponent;
|
||||
Handle(AIS_InteractiveObject) myShapes[7];
|
||||
Standard_Boolean myHasOwnSize;
|
||||
Standard_Boolean myHasOwnTextColor;
|
||||
Quantity_NameOfColor myOwnTextColor;
|
||||
Standard_Boolean myHasOwnArrowColor;
|
||||
Quantity_NameOfColor myOwnArrowColor;
|
||||
|
||||
Prs3d_DatumMode myDisplayMode;
|
||||
Handle(Geom_Axis2Placement) myComponent;
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, Standard_Integer> mySelectionPriority;
|
||||
NCollection_DataMap<Prs3d_DatumParts, TCollection_ExtendedString> myLabel;
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_Group)> myPartToGroup;
|
||||
NCollection_List<Prs3d_DatumParts> mySelectedParts;
|
||||
|
||||
Handle(Prs3d_PointAspect) myPointAspect;
|
||||
|
||||
Handle(Prs3d_ShadingAspect) myHighlightAspect; // internal container to set group selected
|
||||
Handle(Prs3d_LineAspect) myHighlightLineAspect; // internal container to set group selected
|
||||
Handle(Prs3d_PointAspect) myHighlightPointAspect; // internal container to set group selected
|
||||
};
|
||||
|
||||
|
||||
#include <AIS_Trihedron.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _AIS_Trihedron_HeaderFile
|
||||
|
66
src/AIS/AIS_TrihedronOwner.cxx
Normal file
66
src/AIS/AIS_TrihedronOwner.cxx
Normal file
@@ -0,0 +1,66 @@
|
||||
// Created by: Ilya SEVRIKOV
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <AIS_TrihedronOwner.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT (AIS_TrihedronOwner, SelectMgr_EntityOwner)
|
||||
|
||||
AIS_TrihedronOwner::AIS_TrihedronOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||
const Prs3d_DatumParts thePart,
|
||||
const Standard_Integer thePriority)
|
||||
: SelectMgr_EntityOwner (theSelObject, thePriority),
|
||||
myDatumPart (thePart)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightWithColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_TrihedronOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||
const Standard_Integer /*theMode*/)
|
||||
{
|
||||
Selectable()->HilightOwnerWithColor (thePM, theStyle, this);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsHilighted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_TrihedronOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode) const
|
||||
{
|
||||
if (!HasSelectable())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return thePM->IsHighlighted (Selectable(), theMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Unhilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_TrihedronOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (!HasSelectable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
thePM->Unhighlight (Selectable());
|
||||
}
|
56
src/AIS/AIS_TrihedronOwner.hxx
Normal file
56
src/AIS/AIS_TrihedronOwner.hxx
Normal file
@@ -0,0 +1,56 @@
|
||||
// Created by: Ilya SEVRIKOV
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _AIS_TrihedronOwner_HeaderFile
|
||||
#define _AIS_TrihedronOwner_HeaderFile
|
||||
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
#include <Prs3d_DatumParts.hxx>
|
||||
|
||||
//! Entity owner for selection management of AIS_Trihedron object.
|
||||
class AIS_TrihedronOwner : public SelectMgr_EntityOwner
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(AIS_TrihedronOwner, SelectMgr_EntityOwner)
|
||||
public:
|
||||
|
||||
//! Creates an owner of AIS_Trihedron object.
|
||||
Standard_EXPORT AIS_TrihedronOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||
const Prs3d_DatumParts theDatumPart,
|
||||
const Standard_Integer thePriority);
|
||||
|
||||
Standard_EXPORT const Prs3d_DatumParts& DatumPart() const { return myDatumPart; }
|
||||
|
||||
//! Highlights selectable object's presentation.
|
||||
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
//! Returns true if the presentation manager thePM
|
||||
//! highlights selections corresponding to the selection mode aMode.
|
||||
Standard_EXPORT Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode) const Standard_OVERRIDE;
|
||||
|
||||
//! Removes highlighting from the owner of a detected
|
||||
//! selectable object in the presentation manager thePM.
|
||||
Standard_EXPORT virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
Prs3d_DatumParts myDatumPart; //! Part of datum selected
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (AIS_TrihedronOwner, SelectMgr_EntityOwner)
|
||||
|
||||
#endif // _AIS_TrihedronOwner_HeaderFile
|
@@ -179,6 +179,8 @@ AIS_Triangulation.hxx
|
||||
AIS_Trihedron.cxx
|
||||
AIS_Trihedron.hxx
|
||||
AIS_Trihedron.lxx
|
||||
AIS_TrihedronOwner.cxx
|
||||
AIS_TrihedronOwner.hxx
|
||||
AIS_TypeFilter.cxx
|
||||
AIS_TypeFilter.hxx
|
||||
AIS_TypeOfAngle.hxx
|
||||
|
@@ -175,7 +175,6 @@ Standard_Boolean BinMNaming_NamedShapeDriver::Paste
|
||||
theSource >> aNbShapes;
|
||||
TDF_Label aLabel = theTarget->Label ();
|
||||
TNaming_Builder aBuilder (aLabel);
|
||||
if (aNbShapes == 0) return Standard_False;
|
||||
Standard_Integer aVer;
|
||||
Standard_Boolean ok = theSource >> aVer;
|
||||
if(!ok) return Standard_False;
|
||||
@@ -188,39 +187,49 @@ Standard_Boolean BinMNaming_NamedShapeDriver::Paste
|
||||
|
||||
BinTools_ShapeSet& aShapeSet = (BinTools_ShapeSet&) myShapeSet;
|
||||
|
||||
for (Standard_Integer i = 1; i <= aNbShapes; i++) {
|
||||
NCollection_List<TopoDS_Shape> anOldShapes, aNewShapes;
|
||||
for (Standard_Integer i = 1; i <= aNbShapes; i++)
|
||||
{
|
||||
TopoDS_Shape anOldShape, aNewShape;
|
||||
|
||||
if ( anEvol != TNaming_PRIMITIVE )
|
||||
if(TranslateFrom(theSource, anOldShape, aShapeSet)) return Standard_False;
|
||||
|
||||
if (anEvol != TNaming_DELETE)
|
||||
if(TranslateFrom(theSource, aNewShape, aShapeSet)) return Standard_False;
|
||||
if (anEvol != TNaming_PRIMITIVE)
|
||||
if (TranslateFrom (theSource, anOldShape, aShapeSet)) return Standard_False;
|
||||
|
||||
switch (anEvol) {
|
||||
case TNaming_PRIMITIVE :
|
||||
aBuilder.Generated(aNewShape);
|
||||
break;
|
||||
case TNaming_GENERATED :
|
||||
aBuilder.Generated(anOldShape, aNewShape);
|
||||
break;
|
||||
case TNaming_MODIFY :
|
||||
aBuilder.Modify(anOldShape, aNewShape);
|
||||
break;
|
||||
case TNaming_DELETE :
|
||||
aBuilder.Delete (anOldShape);
|
||||
break;
|
||||
case TNaming_SELECTED :
|
||||
aBuilder.Select(aNewShape, anOldShape);
|
||||
break;
|
||||
case TNaming_REPLACE :
|
||||
aBuilder.Modify(anOldShape, aNewShape); // for compatibility aBuilder.Replace(anOldShape, aNewShape);
|
||||
break;
|
||||
default :
|
||||
Standard_DomainError::Raise("TNaming_Evolution:: Evolution Unknown");
|
||||
if (anEvol != TNaming_DELETE)
|
||||
if (TranslateFrom (theSource, aNewShape, aShapeSet)) return Standard_False;
|
||||
|
||||
// Here we add shapes in reverse order because TNaming_Builder also adds them in reverse order.
|
||||
anOldShapes.Prepend (anOldShape);
|
||||
aNewShapes.Prepend (aNewShape);
|
||||
}
|
||||
|
||||
for (NCollection_List<TopoDS_Shape>::Iterator anOldIt (anOldShapes), aNewIt (aNewShapes);
|
||||
anOldIt.More() && aNewIt.More();
|
||||
anOldIt.Next(), aNewIt.Next())
|
||||
{
|
||||
switch (anEvol)
|
||||
{
|
||||
case TNaming_PRIMITIVE:
|
||||
aBuilder.Generated (aNewIt.Value ());
|
||||
break;
|
||||
case TNaming_GENERATED:
|
||||
aBuilder.Generated (anOldIt.Value(), aNewIt.Value());
|
||||
break;
|
||||
case TNaming_MODIFY:
|
||||
aBuilder.Modify (anOldIt.Value(), aNewIt.Value());
|
||||
break;
|
||||
case TNaming_DELETE:
|
||||
aBuilder.Delete (anOldIt.Value());
|
||||
break;
|
||||
case TNaming_SELECTED:
|
||||
aBuilder.Select (aNewIt.Value(), anOldIt.Value());
|
||||
break;
|
||||
case TNaming_REPLACE:
|
||||
aBuilder.Modify (anOldIt.Value(), aNewIt.Value()); // for compatibility aBuilder.Replace(anOldShape, aNewShape);
|
||||
break;
|
||||
default:
|
||||
Standard_DomainError::Raise("TNaming_Evolution:: Evolution Unknown");
|
||||
}
|
||||
anOldShape.Nullify();
|
||||
aNewShape.Nullify();
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -241,8 +250,6 @@ void BinMNaming_NamedShapeDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
for (TNaming_Iterator SItr (aSAtt); SItr.More (); SItr.Next ()) NbShapes++;
|
||||
//--------------------------------------------------------------
|
||||
|
||||
if (NbShapes == 0) return;
|
||||
|
||||
BinTools_ShapeSet& aShapeSet = (BinTools_ShapeSet&) myShapeSet;
|
||||
TNaming_Evolution anEvol = aSAtt->Evolution();
|
||||
|
||||
@@ -311,4 +318,3 @@ void BinMNaming_NamedShapeDriver::ReadShapeSection (Standard_IStream& theIS)
|
||||
else
|
||||
theIS.seekg(aPos); // no shape section is present, try to return to initial point
|
||||
}
|
||||
|
||||
|
@@ -3697,7 +3697,7 @@ static Standard_Integer DDataStd_SetRefArray (Draw_Interpretor& di,
|
||||
|
||||
Handle(TDataStd_ReferenceArray) A = TDataStd_ReferenceArray::Set(label, From, To);
|
||||
|
||||
if (nb > 6) {
|
||||
if (nb >= 6) {
|
||||
j = 5;
|
||||
for(Standard_Integer i = From; i<=To; i++) {
|
||||
TDF_Label aRefLabel;
|
||||
|
@@ -8,6 +8,10 @@ Prs3d_BasicAspect.cxx
|
||||
Prs3d_BasicAspect.hxx
|
||||
Prs3d_DatumAspect.cxx
|
||||
Prs3d_DatumAspect.hxx
|
||||
Prs3d_DatumAttribute.hxx
|
||||
Prs3d_DatumAxes.hxx
|
||||
Prs3d_DatumMode.hxx
|
||||
Prs3d_DatumParts.hxx
|
||||
Prs3d_DimensionArrowOrientation.hxx
|
||||
Prs3d_DimensionAspect.cxx
|
||||
Prs3d_DimensionAspect.hxx
|
||||
|
@@ -31,20 +31,38 @@
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_Arrow::Draw(const Handle(Graphic3d_Group)& theGroup,
|
||||
const gp_Pnt& aLocation,
|
||||
const gp_Dir& aDirection,
|
||||
const Quantity_PlaneAngle anAngle,
|
||||
const Quantity_Length aLength)
|
||||
const gp_Pnt& theLocation,
|
||||
const gp_Dir& theDirection,
|
||||
const Quantity_PlaneAngle theAngle,
|
||||
const Quantity_Length theLength)
|
||||
{
|
||||
Quantity_Length dx,dy,dz; aDirection.Coord(dx,dy,dz);
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimitives = Prs3d_Arrow::DrawSegments(theLocation,
|
||||
theDirection, theAngle, theLength, 15);
|
||||
theGroup->AddPrimitiveArray (aPrimitives);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DrawSegments
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Graphic3d_ArrayOfSegments) Prs3d_Arrow::DrawSegments (const gp_Pnt& theLocation,
|
||||
const gp_Dir& theDirection,
|
||||
const Quantity_PlaneAngle theAngle,
|
||||
const Quantity_Length theLength,
|
||||
const int theNumberOfSegments)
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfSegments) aSegments = new Graphic3d_ArrayOfSegments(theNumberOfSegments+1,
|
||||
2*(2*theNumberOfSegments));
|
||||
|
||||
Quantity_Length dx,dy,dz; theDirection.Coord(dx,dy,dz);
|
||||
//
|
||||
// Point of the arrow:
|
||||
Quantity_Length xo,yo,zo; aLocation.Coord(xo,yo,zo);
|
||||
Quantity_Length xo,yo,zo; theLocation.Coord(xo,yo,zo);
|
||||
|
||||
// Center of the base circle of the arrow:
|
||||
Quantity_Length xc = xo - dx * aLength;
|
||||
Quantity_Length yc = yo - dy * aLength;
|
||||
Quantity_Length zc = zo - dz * aLength;
|
||||
Quantity_Length xc = xo - dx * theLength;
|
||||
Quantity_Length yc = yo - dy * theLength;
|
||||
Quantity_Length zc = zo - dz * theLength;
|
||||
|
||||
// Construction of i,j mark for the circle:
|
||||
Quantity_Length xn=0., yn=0., zn=0.;
|
||||
@@ -63,32 +81,43 @@ void Prs3d_Arrow::Draw(const Handle(Graphic3d_Group)& theGroup,
|
||||
const Quantity_Length yj = dz * xi - dx * zi;
|
||||
const Quantity_Length zj = dx * yi - dy * xi;
|
||||
|
||||
const Standard_Integer NbPoints = 15;
|
||||
const Standard_Integer NbPoints = theNumberOfSegments;
|
||||
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrims1 = new Graphic3d_ArrayOfSegments(2*NbPoints);
|
||||
Handle(Graphic3d_ArrayOfPolylines) aPrims2 = new Graphic3d_ArrayOfPolylines(NbPoints+1);
|
||||
aSegments->AddVertex(theLocation);
|
||||
|
||||
gp_Pnt p1;
|
||||
const Standard_Real Tg=tan(anAngle);
|
||||
const Standard_Real Tg=tan(theAngle);
|
||||
|
||||
for (Standard_Integer i = 1; i <= NbPoints ; i++)
|
||||
{
|
||||
const Standard_Real cosinus = cos ( 2 * M_PI / NbPoints * (i-1) );
|
||||
const Standard_Real cosinus = cos ( 2 * M_PI / NbPoints * (i-1) );
|
||||
const Standard_Real 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);
|
||||
const gp_Pnt pp(xc + (cosinus * xi + sinus * xj) * theLength * Tg,
|
||||
yc + (cosinus * yi + sinus * yj) * theLength * Tg,
|
||||
zc + (cosinus * zi + sinus * zj) * theLength * Tg);
|
||||
|
||||
aPrims1->AddVertex(aLocation);
|
||||
aPrims1->AddVertex(pp);
|
||||
if(i==1) p1 = pp;
|
||||
aPrims2->AddVertex(pp);
|
||||
aSegments->AddVertex(pp);
|
||||
}
|
||||
aPrims2->AddVertex(p1);
|
||||
|
||||
theGroup->AddPrimitiveArray (aPrims1);
|
||||
theGroup->AddPrimitiveArray (aPrims2);
|
||||
int aNbVertices = NbPoints + 1;
|
||||
int aFirstContourVertex = 2;
|
||||
int anEdgeCount = 0;
|
||||
for (Standard_Integer i = aFirstContourVertex; i <= aNbVertices ; i++) {
|
||||
aSegments->AddEdge(1); // location vertex
|
||||
aSegments->AddEdge(i);
|
||||
anEdgeCount++;
|
||||
}
|
||||
aSegments->AddEdge(aNbVertices);
|
||||
aSegments->AddEdge(aFirstContourVertex);
|
||||
anEdgeCount++;
|
||||
|
||||
for (Standard_Integer i = aFirstContourVertex; i <= aNbVertices-1 ; i++) {
|
||||
aSegments->AddEdge(i);
|
||||
aSegments->AddEdge(i+1);
|
||||
anEdgeCount++;
|
||||
}
|
||||
return aSegments;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Prs3d_Root.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Quantity_PlaneAngle.hxx>
|
||||
#include <Quantity_Length.hxx>
|
||||
|
||||
@@ -46,6 +47,18 @@ public:
|
||||
const Standard_Real theConeLength,
|
||||
const Standard_Integer theNbFacettes);
|
||||
|
||||
//! Defines the representation of the arrow as a container of segments.
|
||||
//! @param theLocation location of the arrow tip
|
||||
//! @param theDirection direction of the arrow
|
||||
//! @param theAngle angle of opening of the arrow head
|
||||
//! @param theLength length of the arrow (from the tip)
|
||||
//! @param theNumberOfSegments count of points on polyline where location is connected
|
||||
Standard_EXPORT static Handle(Graphic3d_ArrayOfSegments) DrawSegments (const gp_Pnt& theLocation,
|
||||
const gp_Dir& theDirection,
|
||||
const Quantity_PlaneAngle theAngle,
|
||||
const Quantity_Length theLength,
|
||||
const int theNumberOfSegments);
|
||||
|
||||
//! Defines the representation of the arrow.
|
||||
//! Note that this method does NOT assign any presentation aspects to the primitives group!
|
||||
//! @param theGroup presentation group to add primitives
|
||||
|
@@ -12,105 +12,248 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Prs3d_ToolSphere.hxx>
|
||||
#include <Prs3d_Arrow.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DatumAspect,Prs3d_BasicAspect)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||
|
||||
#define PATCH_TO_OCCT_710
|
||||
|
||||
// =======================================================================
|
||||
// function : Prs3d_DatumAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Prs3d_DatumAspect::Prs3d_DatumAspect()
|
||||
: myDrawFirstAndSecondAxis (Standard_True),
|
||||
myDrawThirdAxis (Standard_True),
|
||||
myToDrawLabels (Standard_True),
|
||||
myFirstAxisLength (10.0),
|
||||
mySecondAxisLength (10.0),
|
||||
myThirdAxisLength (10.0)
|
||||
: myAxes (Prs3d_DA_XYZAxis),
|
||||
myToDrawLabels (Standard_True)
|
||||
{
|
||||
myFirstAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
|
||||
mySecondAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
|
||||
myThirdAxisAspect = new Prs3d_LineAspect (Quantity_NOC_PEACHPUFF,Aspect_TOL_SOLID, 1.0);
|
||||
myAttributes.Bind(Prs3d_DA_XAxisLength, 10.0);
|
||||
myAttributes.Bind(Prs3d_DA_YAxisLength, 10.0);
|
||||
myAttributes.Bind(Prs3d_DA_ZAxisLength, 10.0);
|
||||
myAttributes.Bind(Prs3d_DP_ShadingTubeRadiusPercent, 0.02);
|
||||
myAttributes.Bind(Prs3d_DP_ShadingConeRadiusPercent, 0.04);
|
||||
myAttributes.Bind(Prs3d_DP_ShadingConeLengthPercent, 0.1);
|
||||
myAttributes.Bind(Prs3d_DP_ShadingOriginRadiusPercent, 0.015);
|
||||
myAttributes.Bind(Prs3d_DP_ShadingNumberOfFacettes, 12.);
|
||||
|
||||
myDefaultColors.Bind(Prs3d_DP_Origin, Quantity_Color(Quantity_NOC_BLUE1));
|
||||
myDefaultColors.Bind(Prs3d_DP_XAxis, Quantity_Color(Quantity_NOC_RED));
|
||||
myDefaultColors.Bind(Prs3d_DP_YAxis, Quantity_Color(Quantity_NOC_GREEN));
|
||||
myDefaultColors.Bind(Prs3d_DP_ZAxis, Quantity_Color(Quantity_NOC_BLUE1));
|
||||
|
||||
Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID;
|
||||
Standard_Real aWidth = 1.0;
|
||||
for (int i = Prs3d_DP_Origin; i <= Prs3d_DP_XOZAxis; i++)
|
||||
{
|
||||
Prs3d_DatumParts aPart = (Prs3d_DatumParts)i;
|
||||
Quantity_Color aDefaultColor;
|
||||
if (!myDefaultColors.Find(aPart, aDefaultColor))
|
||||
aDefaultColor = Quantity_NOC_PEACHPUFF;
|
||||
if (aPart != Prs3d_DP_Origin) // origin point is used only in shading mode
|
||||
myLineAspects.Bind(aPart, new Prs3d_LineAspect (aDefaultColor, aLineType, aWidth));
|
||||
Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect();
|
||||
aShadingAspect->SetColor(aDefaultColor);
|
||||
myShadedAspects.Bind(aPart, aShadingAspect);
|
||||
}
|
||||
myTextAspect = new Prs3d_TextAspect ();
|
||||
#ifdef PATCH_TO_OCCT_710
|
||||
myPointAspect = new Prs3d_PointAspect(Aspect_TOM_POINT/*Aspect_TOM_EMPTY*/,
|
||||
#else
|
||||
myPointAspect = new Prs3d_PointAspect(Aspect_TOM_EMPTY,
|
||||
#endif
|
||||
myDefaultColors.Find(Prs3d_DP_Origin), 1.0);
|
||||
myArrowAspect = new Prs3d_ArrowAspect();
|
||||
}
|
||||
|
||||
Handle(Prs3d_LineAspect) Prs3d_DatumAspect::FirstAxisAspect() const {
|
||||
|
||||
return myFirstAxisAspect;
|
||||
}
|
||||
|
||||
Handle(Prs3d_LineAspect) Prs3d_DatumAspect::SecondAxisAspect() const {
|
||||
|
||||
return mySecondAxisAspect;
|
||||
}
|
||||
|
||||
Handle(Prs3d_LineAspect) Prs3d_DatumAspect::ThirdAxisAspect() const {
|
||||
|
||||
return myThirdAxisAspect;
|
||||
|
||||
}
|
||||
Standard_Boolean Prs3d_DatumAspect::DrawFirstAndSecondAxis () const {
|
||||
|
||||
return myDrawFirstAndSecondAxis;
|
||||
|
||||
}
|
||||
|
||||
void Prs3d_DatumAspect::SetDrawFirstAndSecondAxis (const Standard_Boolean draw)
|
||||
Handle(Graphic3d_ArrayOfPrimitives) Prs3d_DatumAspect::ArrayOfPrimitives(
|
||||
const Prs3d_DatumParts& theDatumPart) const
|
||||
{
|
||||
myDrawFirstAndSecondAxis = draw;
|
||||
Handle(Graphic3d_ArrayOfPrimitives) anArray;
|
||||
myPrimitives.Find(theDatumPart, anArray);
|
||||
return anArray;
|
||||
}
|
||||
|
||||
Standard_Boolean Prs3d_DatumAspect::DrawThirdAxis () const {
|
||||
|
||||
return myDrawThirdAxis;
|
||||
|
||||
}
|
||||
|
||||
void Prs3d_DatumAspect::SetDrawThirdAxis (const Standard_Boolean draw)
|
||||
void Prs3d_DatumAspect::UpdatePrimitives(const Prs3d_DatumMode& theMode, const gp_Pnt& theOrigin,
|
||||
const gp_Dir& theXDirection,
|
||||
const gp_Dir& theYDirection, const gp_Dir& theZDirection)
|
||||
{
|
||||
myDrawThirdAxis = draw;
|
||||
myPrimitives.Clear();
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, gp_Dir> anAxisDirs;
|
||||
anAxisDirs.Bind(Prs3d_DP_XAxis, theXDirection);
|
||||
anAxisDirs.Bind(Prs3d_DP_YAxis, theYDirection);
|
||||
anAxisDirs.Bind(Prs3d_DP_ZAxis, theZDirection);
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, gp_Pnt> anAxisPoints;
|
||||
gp_XYZ anXYZOrigin = theOrigin.XYZ();
|
||||
for (int i = Prs3d_DP_XAxis; i <= Prs3d_DP_ZAxis; i++)
|
||||
{
|
||||
Prs3d_DatumParts aPart = (Prs3d_DatumParts)i;
|
||||
anAxisPoints.Bind(aPart, gp_Pnt(anXYZOrigin + anAxisDirs.Find(aPart).XYZ()*AxisLength(aPart)));
|
||||
}
|
||||
|
||||
if (theMode == Prs3d_DM_WireFrame)
|
||||
{
|
||||
// origin
|
||||
Prs3d_DatumParts aPart = Prs3d_DP_Origin;
|
||||
if (DrawDatumPart(aPart))
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPoints(1);
|
||||
aPrims->AddVertex(theOrigin);
|
||||
myPrimitives.Bind(aPart, aPrims);
|
||||
}
|
||||
// axes
|
||||
for (int i = Prs3d_DP_XAxis; i <= Prs3d_DP_ZAxis; i++)
|
||||
{
|
||||
Prs3d_DatumParts aPart = (Prs3d_DatumParts)i;
|
||||
if (DrawDatumPart(aPart))
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfSegments(2);
|
||||
aPrims->AddVertex(theOrigin);
|
||||
aPrims->AddVertex(anAxisPoints.Find(aPart));
|
||||
myPrimitives.Bind(aPart, aPrims);
|
||||
}
|
||||
|
||||
Prs3d_DatumParts anArrowPart = ArrowPartForAxis(aPart);
|
||||
if (DrawDatumPart(anArrowPart))
|
||||
{
|
||||
myPrimitives.Bind(anArrowPart,
|
||||
Prs3d_Arrow::DrawSegments(anAxisPoints.Find(aPart), anAxisDirs.Find(aPart),
|
||||
ArrowAspect()->Angle(),
|
||||
AxisLength(aPart)*Attribute(Prs3d_DP_ShadingConeLengthPercent),
|
||||
(Standard_Integer)Attribute(Prs3d_DP_ShadingNumberOfFacettes)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // shading mode
|
||||
// origin
|
||||
Prs3d_DatumParts aPart = Prs3d_DP_Origin;
|
||||
if (DrawDatumPart(aPart))
|
||||
{
|
||||
Standard_Real aSphereRadius = AxisLength(Prs3d_DP_XAxis)*
|
||||
Attribute(Prs3d_DP_ShadingOriginRadiusPercent);
|
||||
Standard_Integer aNbOfFacettes = (Standard_Integer)Attribute(Prs3d_DP_ShadingNumberOfFacettes);
|
||||
gp_Trsf aSphereTransform;
|
||||
aSphereTransform.SetTranslationPart(gp_Vec(gp_Pnt(0.0, 0.0, 0.0), theOrigin));
|
||||
myPrimitives.Bind(aPart, Prs3d_ToolSphere::Create(aSphereRadius, aNbOfFacettes,
|
||||
aNbOfFacettes, aSphereTransform));
|
||||
}
|
||||
// axes
|
||||
{
|
||||
Standard_Integer aNbOfFacettes =
|
||||
(Standard_Integer)Attribute(Prs3d_DP_ShadingNumberOfFacettes);
|
||||
Standard_Real aTubeRadiusPercent = Attribute(Prs3d_DP_ShadingTubeRadiusPercent);
|
||||
Standard_Real aConeLengthPercent = Attribute(Prs3d_DP_ShadingConeLengthPercent);
|
||||
Standard_Real aConeRadiusPercent = Attribute(Prs3d_DP_ShadingConeRadiusPercent);
|
||||
for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis;
|
||||
++anAxisIter)
|
||||
{
|
||||
Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter;
|
||||
Prs3d_DatumParts anArrowPart = ArrowPartForAxis(aPart);
|
||||
bool aDrawArrow = DrawDatumPart(anArrowPart);
|
||||
Standard_Real anAxisLength = AxisLength(aPart);
|
||||
gp_Ax1 anAxis (theOrigin, anAxisDirs.Find(aPart));
|
||||
|
||||
if (DrawDatumPart(aPart))
|
||||
// draw cylinder
|
||||
myPrimitives.Bind(aPart, Prs3d_Arrow::DrawShaded (anAxis, anAxisLength*aTubeRadiusPercent,
|
||||
aDrawArrow ? anAxisLength - anAxisLength*aConeLengthPercent: anAxisLength,
|
||||
0.0, 0.0, aNbOfFacettes));
|
||||
|
||||
// draw arrow
|
||||
if (aDrawArrow)
|
||||
myPrimitives.Bind(anArrowPart, Prs3d_Arrow::DrawShaded (anAxis,
|
||||
0.0, anAxisLength, anAxisLength*aConeRadiusPercent,
|
||||
anAxisLength*aConeLengthPercent, aNbOfFacettes));
|
||||
}
|
||||
}
|
||||
}
|
||||
// planes
|
||||
for (Standard_Integer aPlaneIter = Prs3d_DP_XOYAxis; aPlaneIter <= Prs3d_DP_XOZAxis;
|
||||
++aPlaneIter)
|
||||
{
|
||||
Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPlaneIter;
|
||||
if (!DrawDatumPart(aPart))
|
||||
continue;
|
||||
|
||||
Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(4);
|
||||
aPrims->AddVertex(theOrigin);
|
||||
|
||||
Prs3d_DatumParts aPart1, aPart2;
|
||||
switch (aPart) {
|
||||
case Prs3d_DP_XOYAxis: { aPart1 = Prs3d_DP_XAxis; aPart2 = Prs3d_DP_YAxis; } break;
|
||||
case Prs3d_DP_YOZAxis: { aPart1 = Prs3d_DP_YAxis; aPart2 = Prs3d_DP_ZAxis; } break;
|
||||
case Prs3d_DP_XOZAxis: { aPart1 = Prs3d_DP_XAxis; aPart2 = Prs3d_DP_ZAxis; } break;
|
||||
default: break;
|
||||
}
|
||||
aPrims->AddVertex(anAxisPoints.Find(aPart1));
|
||||
aPrims->AddVertex(anAxisPoints.Find(aPart2));
|
||||
|
||||
aPrims->AddVertex(theOrigin);
|
||||
myPrimitives.Bind(aPart, aPrims);
|
||||
}
|
||||
}
|
||||
|
||||
void Prs3d_DatumAspect::SetAxisLength (const Quantity_Length L1,
|
||||
const Quantity_Length L2,
|
||||
const Quantity_Length L3) {
|
||||
|
||||
myFirstAxisLength = L1;
|
||||
mySecondAxisLength = L2;
|
||||
myThirdAxisLength = L3;
|
||||
}
|
||||
|
||||
|
||||
Quantity_Length Prs3d_DatumAspect::FirstAxisLength () const {
|
||||
|
||||
return myFirstAxisLength;
|
||||
|
||||
}
|
||||
|
||||
Quantity_Length Prs3d_DatumAspect::SecondAxisLength () const {
|
||||
|
||||
return mySecondAxisLength;
|
||||
|
||||
}
|
||||
|
||||
Quantity_Length Prs3d_DatumAspect::ThirdAxisLength () const {
|
||||
|
||||
return myThirdAxisLength;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetToDrawLabels
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_DatumAspect::SetToDrawLabels (const Standard_Boolean theToDraw)
|
||||
void Prs3d_DatumAspect::SetDrawFirstAndSecondAxis (const Standard_Boolean theToDraw)
|
||||
{
|
||||
myToDrawLabels = theToDraw;
|
||||
if (theToDraw)
|
||||
myAxes = Prs3d_DatumAxes(myAxes | Prs3d_DA_XAxis | Prs3d_DA_YAxis);
|
||||
else
|
||||
myAxes = Prs3d_DatumAxes(myAxes & !Prs3d_DA_XAxis & !Prs3d_DA_YAxis);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ToDrawLabels
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Prs3d_DatumAspect::ToDrawLabels() const
|
||||
void Prs3d_DatumAspect::SetDrawThirdAxis (const Standard_Boolean theToDraw)
|
||||
{
|
||||
return myToDrawLabels;
|
||||
if (theToDraw)
|
||||
myAxes = Prs3d_DatumAxes(myAxes | Prs3d_DA_ZAxis);
|
||||
else
|
||||
myAxes = Prs3d_DatumAxes(myAxes & !Prs3d_DA_ZAxis);
|
||||
}
|
||||
|
||||
bool Prs3d_DatumAspect::DrawDatumPart(const Prs3d_DatumParts& thePart) const
|
||||
{
|
||||
switch (thePart)
|
||||
{
|
||||
case Prs3d_DP_Origin: return true;
|
||||
case Prs3d_DP_XAxis:
|
||||
case Prs3d_DP_XArrow: return (myAxes & Prs3d_DA_XAxis) != 0;
|
||||
case Prs3d_DP_YAxis:
|
||||
case Prs3d_DP_YArrow: return (myAxes & Prs3d_DA_YAxis) != 0;
|
||||
case Prs3d_DP_ZAxis:
|
||||
case Prs3d_DP_ZArrow: return (myAxes & Prs3d_DA_ZAxis) != 0;
|
||||
case Prs3d_DP_XOYAxis: return DrawDatumPart(Prs3d_DP_XAxis) && DrawDatumPart(Prs3d_DP_YAxis);
|
||||
case Prs3d_DP_YOZAxis: return DrawDatumPart(Prs3d_DP_YAxis) && DrawDatumPart(Prs3d_DP_ZAxis);
|
||||
case Prs3d_DP_XOZAxis: return DrawDatumPart(Prs3d_DP_XAxis) && DrawDatumPart(Prs3d_DP_ZAxis);
|
||||
default: break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Quantity_Length Prs3d_DatumAspect::AxisLength(const Prs3d_DatumParts& thePart) const
|
||||
{
|
||||
switch (thePart)
|
||||
{
|
||||
case Prs3d_DP_XAxis: return (Quantity_Length)myAttributes.Find(Prs3d_DA_XAxisLength);
|
||||
case Prs3d_DP_YAxis: return (Quantity_Length)myAttributes.Find(Prs3d_DA_YAxisLength);
|
||||
case Prs3d_DP_ZAxis: return (Quantity_Length)myAttributes.Find(Prs3d_DA_ZAxisLength);
|
||||
default: break;
|
||||
}
|
||||
return Quantity_Length(0);
|
||||
}
|
||||
|
||||
Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis(const Prs3d_DatumParts& thePart) const
|
||||
{
|
||||
switch (thePart)
|
||||
{
|
||||
case Prs3d_DP_XAxis: return Prs3d_DP_XArrow;
|
||||
case Prs3d_DP_YAxis: return Prs3d_DP_YArrow;
|
||||
case Prs3d_DP_ZAxis: return Prs3d_DP_ZArrow;
|
||||
default: break;
|
||||
}
|
||||
return Prs3d_DP_None;
|
||||
}
|
||||
|
@@ -17,87 +17,173 @@
|
||||
#ifndef _Prs3d_DatumAspect_HeaderFile
|
||||
#define _Prs3d_DatumAspect_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPrimitives.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Quantity_Length.hxx>
|
||||
#include <Prs3d_BasicAspect.hxx>
|
||||
#include <Prs3d_DatumAttribute.hxx>
|
||||
#include <Prs3d_DatumParts.hxx>
|
||||
#include <Prs3d_DatumMode.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_DatumAxes.hxx>
|
||||
|
||||
#include <Quantity_Length.hxx>
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class Prs3d_LineAspect;
|
||||
|
||||
|
||||
class Prs3d_DatumAspect;
|
||||
DEFINE_STANDARD_HANDLE(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
//! A framework to define the display of datums.
|
||||
class Prs3d_DatumAspect : public Prs3d_BasicAspect
|
||||
{
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||
public:
|
||||
|
||||
//! An empty framework to define the display of datums.
|
||||
Standard_EXPORT Prs3d_DatumAspect();
|
||||
|
||||
|
||||
//! Returns the right-handed coordinate system set in SetComponent.
|
||||
Standard_EXPORT const Handle(Prs3d_LineAspect)& LineAspect(const Prs3d_DatumParts& thePart) const
|
||||
{
|
||||
return myLineAspects.Find(thePart);
|
||||
}
|
||||
|
||||
//! Returns the right-handed coordinate system set in SetComponent.
|
||||
Standard_EXPORT const Handle(Prs3d_ShadingAspect)& ShadingAspect(const Prs3d_DatumParts& thePart) const
|
||||
{
|
||||
return myShadedAspects.Find(thePart);
|
||||
}
|
||||
|
||||
//! Returns the right-handed coordinate system set in SetComponent.
|
||||
Standard_EXPORT const Handle(Prs3d_TextAspect)& TextAspect() const
|
||||
{
|
||||
return myTextAspect;
|
||||
}
|
||||
|
||||
//! Returns the point aspect of origin wireframe presentation
|
||||
Standard_EXPORT const Handle(Prs3d_PointAspect)& PointAspect() const
|
||||
{
|
||||
return myPointAspect;
|
||||
}
|
||||
|
||||
//! Returns the arrow aspect of presentation
|
||||
Standard_EXPORT const Handle(Prs3d_ArrowAspect)& ArrowAspect() const
|
||||
{
|
||||
return myArrowAspect;
|
||||
}
|
||||
|
||||
//! Returns primitives.
|
||||
Standard_EXPORT Handle(Graphic3d_ArrayOfPrimitives) ArrayOfPrimitives(const Prs3d_DatumParts& thePart) const;
|
||||
|
||||
//! Updates graphic groups for the current datum mode
|
||||
//! Parameters of datum position and orientation
|
||||
Standard_EXPORT void UpdatePrimitives(const Prs3d_DatumMode& theMode, const gp_Pnt& theOrigin,
|
||||
const gp_Dir& theXDirection, const gp_Dir& theYDirection,
|
||||
const gp_Dir& theZDirection);
|
||||
|
||||
//! Returns the attributes for display of the first axis.
|
||||
Standard_EXPORT Handle(Prs3d_LineAspect) FirstAxisAspect() const;
|
||||
Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
|
||||
const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myLineAspects.Find(Prs3d_DP_XAxis); }
|
||||
|
||||
//! Returns the attributes for display of the second axis.
|
||||
Standard_EXPORT Handle(Prs3d_LineAspect) SecondAxisAspect() const;
|
||||
Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
|
||||
const Handle(Prs3d_LineAspect)& SecondAxisAspect() const { return myLineAspects.Find(Prs3d_DP_YAxis); }
|
||||
|
||||
//! Returns the attributes for display of the third axis.
|
||||
Standard_EXPORT Handle(Prs3d_LineAspect) ThirdAxisAspect() const;
|
||||
Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
|
||||
const Handle(Prs3d_LineAspect)& ThirdAxisAspect() const { return myLineAspects.Find(Prs3d_DP_ZAxis); }
|
||||
|
||||
//! Sets the DrawFirstAndSecondAxis attributes to active.
|
||||
Standard_EXPORT void SetDrawFirstAndSecondAxis (const Standard_Boolean draw);
|
||||
Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead")
|
||||
Standard_EXPORT void SetDrawFirstAndSecondAxis (const Standard_Boolean theToDraw);
|
||||
|
||||
//! Returns true if the first and second axes can be drawn.
|
||||
Standard_EXPORT Standard_Boolean DrawFirstAndSecondAxis() const;
|
||||
|
||||
Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead")
|
||||
Standard_Boolean DrawFirstAndSecondAxis() const { return (myAxes & Prs3d_DA_XAxis & Prs3d_DA_YAxis) != 0; }
|
||||
|
||||
//! Sets the DrawThirdAxis attributes to active.
|
||||
Standard_EXPORT void SetDrawThirdAxis (const Standard_Boolean draw);
|
||||
Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead")
|
||||
Standard_EXPORT void SetDrawThirdAxis (const Standard_Boolean theToDraw);
|
||||
|
||||
//! Returns true if the third axis can be drawn.
|
||||
Standard_EXPORT Standard_Boolean DrawThirdAxis() const;
|
||||
|
||||
//! Sets the lengths L1, L2 and L3 of the three axes.
|
||||
Standard_EXPORT void SetAxisLength (const Standard_Real L1, const Standard_Real L2, const Standard_Real L3);
|
||||
|
||||
Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead")
|
||||
Standard_Boolean DrawThirdAxis() const { return (myAxes & Prs3d_DA_ZAxis) != 0; }
|
||||
|
||||
//! Returns true if the given part is used in axes of aspect
|
||||
Standard_EXPORT Standard_Boolean DrawDatumPart(const Prs3d_DatumParts& thePart) const;
|
||||
|
||||
//! Sets the axes used in the datum aspect
|
||||
void SetDrawDatumAxes(const Prs3d_DatumAxes& theType) { myAxes = theType; }
|
||||
|
||||
//! Returns axes used in the datum aspect
|
||||
Prs3d_DatumAxes DatumAxes() const { return myAxes; }
|
||||
|
||||
//! Sets the attribute of the datum type
|
||||
void SetAttribute(const Prs3d_DatumAttribute& theType, const Standard_Real& theValue)
|
||||
{
|
||||
myAttributes.Bind(theType, theValue);
|
||||
}
|
||||
|
||||
//! Returns the attribute of the datum type
|
||||
Standard_Real Attribute(const Prs3d_DatumAttribute& theType) const
|
||||
{
|
||||
return myAttributes.Find(theType);
|
||||
}
|
||||
|
||||
//! Sets the lengths of the three axes.
|
||||
void SetAxisLength (const Standard_Real theL1, const Standard_Real theL2, const Standard_Real theL3)
|
||||
{
|
||||
myAttributes.Bind(Prs3d_DA_XAxisLength, theL1);
|
||||
myAttributes.Bind(Prs3d_DA_YAxisLength, theL2);
|
||||
myAttributes.Bind(Prs3d_DA_ZAxisLength, theL3);
|
||||
}
|
||||
|
||||
//! Returns the length of the displayed first axis.
|
||||
Standard_EXPORT Quantity_Length FirstAxisLength() const;
|
||||
|
||||
Quantity_Length AxisLength(const Prs3d_DatumParts& thePart) const;
|
||||
|
||||
//! Returns the length of the displayed first axis.
|
||||
Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
|
||||
Quantity_Length FirstAxisLength() const { return (Quantity_Length)myAttributes.Find(Prs3d_DA_XAxisLength); }
|
||||
|
||||
//! Returns the length of the displayed second axis.
|
||||
Standard_EXPORT Quantity_Length SecondAxisLength() const;
|
||||
Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
|
||||
Quantity_Length SecondAxisLength() const { return (Quantity_Length)myAttributes.Find(Prs3d_DA_YAxisLength); }
|
||||
|
||||
//! Returns the length of the displayed third axis.
|
||||
Standard_EXPORT Quantity_Length ThirdAxisLength() const;
|
||||
Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
|
||||
Quantity_Length ThirdAxisLength() const { return (Quantity_Length)myAttributes.Find(Prs3d_DA_ZAxisLength); }
|
||||
|
||||
//! Sets option to draw or not to draw text labels for axes
|
||||
Standard_EXPORT void SetToDrawLabels (const Standard_Boolean theToDraw);
|
||||
void SetToDrawLabels (const Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; }
|
||||
|
||||
//! @return true if axes labels are drawn
|
||||
Standard_EXPORT Standard_Boolean ToDrawLabels() const;
|
||||
Standard_Boolean ToDrawLabels() const { return myToDrawLabels; }
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Prs3d_DatumAspect,Prs3d_BasicAspect)
|
||||
//! Returns type of arrow for a type of axis
|
||||
Prs3d_DatumParts ArrowPartForAxis(const Prs3d_DatumParts& thePart) const;
|
||||
|
||||
private:
|
||||
|
||||
Handle(Prs3d_LineAspect) myFirstAxisAspect;
|
||||
Handle(Prs3d_LineAspect) mySecondAxisAspect;
|
||||
Handle(Prs3d_LineAspect) myThirdAxisAspect;
|
||||
Standard_Boolean myDrawFirstAndSecondAxis;
|
||||
Standard_Boolean myDrawThirdAxis;
|
||||
Prs3d_DatumAxes myAxes;
|
||||
Standard_Boolean myToDrawLabels;
|
||||
Quantity_Length myFirstAxisLength;
|
||||
Quantity_Length mySecondAxisLength;
|
||||
Quantity_Length myThirdAxisLength;
|
||||
NCollection_DataMap<Prs3d_DatumAttribute, Standard_Real> myAttributes;
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Graphic3d_ArrayOfPrimitives)> myPrimitives;
|
||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_ShadingAspect)> myShadedAspects;
|
||||
NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_LineAspect)> myLineAspects;
|
||||
|
||||
NCollection_DataMap<Prs3d_DatumParts, Quantity_Color> myDefaultColors;
|
||||
|
||||
Handle(Prs3d_TextAspect) myTextAspect;
|
||||
Handle(Prs3d_PointAspect) myPointAspect;
|
||||
Handle(Prs3d_ArrowAspect) myArrowAspect;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||
|
||||
#endif // _Prs3d_DatumAspect_HeaderFile
|
||||
|
30
src/Prs3d/Prs3d_DatumAttribute.hxx
Normal file
30
src/Prs3d/Prs3d_DatumAttribute.hxx
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Prs3d_DatumAttribute_HeaderFile
|
||||
#define _Prs3d_DatumAttribute_HeaderFile
|
||||
|
||||
//! Enumeration defining a part of datum aspect, see Prs3d_Datum.
|
||||
enum Prs3d_DatumAttribute
|
||||
{
|
||||
Prs3d_DA_XAxisLength = 0,
|
||||
Prs3d_DA_YAxisLength,
|
||||
Prs3d_DA_ZAxisLength,
|
||||
Prs3d_DP_ShadingTubeRadiusPercent,
|
||||
Prs3d_DP_ShadingConeRadiusPercent,
|
||||
Prs3d_DP_ShadingConeLengthPercent,
|
||||
Prs3d_DP_ShadingOriginRadiusPercent,
|
||||
Prs3d_DP_ShadingNumberOfFacettes
|
||||
};
|
||||
|
||||
#endif // _Prs3d_DatumAttribute_HeaderFile
|
34
src/Prs3d/Prs3d_DatumAxes.hxx
Normal file
34
src/Prs3d/Prs3d_DatumAxes.hxx
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Prs3d_DatumAxes_HeaderFile
|
||||
#define _Prs3d_DatumAxes_HeaderFile
|
||||
|
||||
//! Enumeration defining an axes used in datum aspect, see Prs3d_Datum.
|
||||
enum Prs3d_DatumAxes
|
||||
{
|
||||
Prs3d_DA_XAxis = 0x00000001, //!< X axis of the datum
|
||||
Prs3d_DA_YAxis = 0x00000002, //!< Y axis of the datum
|
||||
Prs3d_DA_ZAxis = 0x00000004, //!< Z axis of the datum
|
||||
Prs3d_DA_XYAxis = Prs3d_DA_XAxis
|
||||
| Prs3d_DA_YAxis, //!< XOY 2D axes
|
||||
Prs3d_DA_YZAxis = Prs3d_DA_YAxis
|
||||
| Prs3d_DA_ZAxis, //!< YOZ 2D axes
|
||||
Prs3d_DA_XZAxis = Prs3d_DA_XAxis
|
||||
| Prs3d_DA_ZAxis, //!< XOZ 2D axes
|
||||
Prs3d_DA_XYZAxis = Prs3d_DA_XAxis
|
||||
| Prs3d_DA_YAxis
|
||||
| Prs3d_DA_ZAxis //!< XYZ 3D axes
|
||||
};
|
||||
|
||||
#endif // _Prs3d_DatumParts_HeaderFile
|
24
src/Prs3d/Prs3d_DatumMode.hxx
Normal file
24
src/Prs3d/Prs3d_DatumMode.hxx
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Prs3d_DatumMode_HeaderFile
|
||||
#define _Prs3d_DatumMode_HeaderFile
|
||||
|
||||
//! Enumeration defining a mode of datum graphic presentation, see Prs3d_Datum.
|
||||
enum Prs3d_DatumMode
|
||||
{
|
||||
Prs3d_DM_WireFrame = 0,
|
||||
Prs3d_DM_Shaded
|
||||
};
|
||||
|
||||
#endif // _Prs3d_DatumMode_HeaderFile
|
33
src/Prs3d/Prs3d_DatumParts.hxx
Normal file
33
src/Prs3d/Prs3d_DatumParts.hxx
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2016 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Prs3d_DatumParts_HeaderFile
|
||||
#define _Prs3d_DatumParts_HeaderFile
|
||||
|
||||
//! Enumeration defining a part of datum aspect, see Prs3d_Datum.
|
||||
enum Prs3d_DatumParts
|
||||
{
|
||||
Prs3d_DP_Origin = 0,
|
||||
Prs3d_DP_XAxis,
|
||||
Prs3d_DP_YAxis,
|
||||
Prs3d_DP_ZAxis,
|
||||
Prs3d_DP_XArrow,
|
||||
Prs3d_DP_YArrow,
|
||||
Prs3d_DP_ZArrow,
|
||||
Prs3d_DP_XOYAxis,
|
||||
Prs3d_DP_YOZAxis,
|
||||
Prs3d_DP_XOZAxis,
|
||||
Prs3d_DP_None
|
||||
};
|
||||
|
||||
#endif // _Prs3d_DatumParts_HeaderFile
|
@@ -5331,6 +5331,41 @@ static Standard_Integer OCC27893 (Draw_Interpretor& /*theDI*/, Standard_Integer
|
||||
return 0;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
//function : OCC28310
|
||||
//purpose : Tests validness of iterator in AIS_InteractiveContext after
|
||||
// an removing object from it
|
||||
//========================================================================
|
||||
static Standard_Integer OCC28310 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgc*/, const char** theArgv)
|
||||
{
|
||||
const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
|
||||
if (aCtx.IsNull())
|
||||
{
|
||||
std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Shape aBox = BRepPrimAPI_MakeBox (10.0, 10.0, 10.0).Shape();
|
||||
Handle(AIS_InteractiveObject) aBoxObj = new AIS_Shape (aBox);
|
||||
aCtx->Display (aBoxObj, AIS_Shaded, 0, Standard_False);
|
||||
ViewerTest::CurrentView()->FitAll();
|
||||
aCtx->MoveTo (200, 200, ViewerTest::CurrentView());
|
||||
aCtx->Select();
|
||||
|
||||
aCtx->Remove (aBoxObj, Standard_True);
|
||||
// nullify the object explicitly to simulate situation in project,
|
||||
// when ::Remove is called from another method and the object is destroyed
|
||||
// before ::DetectedInteractive is called
|
||||
aBoxObj.Nullify();
|
||||
|
||||
for (aCtx->InitDetected(); aCtx->MoreDetected(); aCtx->NextDetected())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anObj = aCtx->DetectedInteractive();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
//function : Commands_19
|
||||
//purpose :
|
||||
@@ -5467,5 +5502,8 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
||||
theCommands.Add ("OCC27893",
|
||||
"OCC27893: Creates a box and selects it via AIS_InteractiveContext API",
|
||||
__FILE__, OCC27893, group);
|
||||
theCommands.Add("OCC28310",
|
||||
"OCC28310: Tests validness of iterator in AIS_InteractiveContext after an removing object from it",
|
||||
__FILE__, OCC28310, group);
|
||||
return;
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@
|
||||
static Standard_Integer BuildNamedShape (Draw_Interpretor& di,
|
||||
Standard_Integer nb,
|
||||
const char** arg) {
|
||||
if (nb > 4) {
|
||||
if (nb >= 4) {
|
||||
TDF_Label aLabel;
|
||||
if (!QADNaming::Entry(arg, aLabel)) return 1;
|
||||
char anEvolution = arg[3][0];
|
||||
@@ -73,7 +73,7 @@ static Standard_Integer BuildNamedShape (Draw_Interpretor& di,
|
||||
// OnlyModif = Draw::Atoi(arg[3]);
|
||||
// }
|
||||
} else {
|
||||
di<<"Usage: BuildName df entry evolution(P[RIMITIVE] G[ENERATED] M[ODIFY] D[ELETE] R[EPLACE] S[ELECTED]) shape1 [shape2 ...]\n";
|
||||
di<<"Usage: BuildName df entry evolution(P[RIMITIVE] G[ENERATED] M[ODIFY] D[ELETE] R[EPLACE] S[ELECTED]) [shape1 shape2 ...]\n";
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -89,6 +89,6 @@ void QADNaming::BuilderCommands(Draw_Interpretor& theCommands)
|
||||
const char* g = "Naming builder commands";
|
||||
|
||||
theCommands.Add("BuildNamedShape",
|
||||
"BuildNamedShape df entry evolution(P[RIMITIVE] G[ENERATED] M[ODIFY] D[ELETE] R[EPLACE] S[ELECTED]) shape1 [shape2 ...]",
|
||||
"BuildNamedShape df entry evolution(P[RIMITIVE] G[ENERATED] M[ODIFY] D[ELETE] R[EPLACE] S[ELECTED]) [shape1 shape2 ...]",
|
||||
__FILE__,BuildNamedShape,g);
|
||||
}
|
||||
|
@@ -85,7 +85,7 @@ static int VTrihedronOrigins(Draw_Interpretor& di,
|
||||
}
|
||||
|
||||
//get axis
|
||||
Handle(AIS_Axis) XAxis = aTrih->XAxis();
|
||||
/*Handle(AIS_Axis) XAxis = aTrih->XAxis();
|
||||
Handle(AIS_Axis) YAxis = aTrih->YAxis();
|
||||
Handle(AIS_Axis) ZAxis = aTrih->Axis();
|
||||
|
||||
@@ -110,7 +110,7 @@ static int VTrihedronOrigins(Draw_Interpretor& di,
|
||||
TheAISContext()->Display(XLine);
|
||||
TheAISContext()->Display(YLine);
|
||||
TheAISContext()->Display(ZLine);
|
||||
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -121,7 +121,7 @@ Standard_Boolean XmlMNaming_NamedShapeDriver::Paste
|
||||
Standard_Integer upper = NewPShapes.Upper();
|
||||
if (OldPShapes.Upper() > upper) upper = OldPShapes.Upper();
|
||||
|
||||
for (Standard_Integer i = lower; i <= upper; i++)
|
||||
for (Standard_Integer i = upper; i >= lower; --i)
|
||||
{
|
||||
const XmlMNaming_Shape1 aNewPShape = NewPShapes.Value(i);
|
||||
const XmlMNaming_Shape1 anOldPShape = OldPShapes.Value(i);
|
||||
|
@@ -1,3 +1,5 @@
|
||||
puts "REQUIRED All: XmlDriver warning: failure reading attribute TDataStd_RealArray"
|
||||
|
||||
puts "================"
|
||||
puts "OCC2269"
|
||||
puts "================"
|
||||
|
56
tests/bugs/caf/bug28425
Normal file
56
tests/bugs/caf/bug28425
Normal file
@@ -0,0 +1,56 @@
|
||||
puts "==========="
|
||||
puts "OCC28425"
|
||||
puts "==========="
|
||||
puts ""
|
||||
############################################################
|
||||
# Open/save NamedShape changes order of shapes
|
||||
############################################################
|
||||
|
||||
pload QAcommands
|
||||
|
||||
vertex v 1 2 3
|
||||
box b 10 20 30
|
||||
|
||||
# Test bin document
|
||||
NewDocument D1 BinOcaf
|
||||
BuildNamedShape D1 0:1 PRIMITIVE v b
|
||||
GetNewShapes D1 0:1 s
|
||||
set info [whatis s_1]
|
||||
if { [regexp "SOLID" $info] != 1 } {
|
||||
puts "Error: first shape should be solid"
|
||||
} else {
|
||||
puts "OK: order of shapes is correct"
|
||||
}
|
||||
SaveAs D1 test.cbf
|
||||
Close D1
|
||||
Open test.cbf D2
|
||||
GetNewShapes D2 0:1 s
|
||||
set info [whatis s_1]
|
||||
if { [regexp "SOLID" $info] != 1 } {
|
||||
puts "Error: first shape should be solid"
|
||||
} else {
|
||||
puts "OK: order of shapes is correct"
|
||||
}
|
||||
Close D2
|
||||
|
||||
# Test xml document
|
||||
NewDocument D1 XmlOcaf
|
||||
BuildNamedShape D1 0:1 PRIMITIVE v b
|
||||
GetNewShapes D1 0:1 s
|
||||
set info [whatis s_1]
|
||||
if { [regexp "SOLID" $info] != 1 } {
|
||||
puts "Error: first shape should be solid"
|
||||
} else {
|
||||
puts "OK: order of shapes is correct"
|
||||
}
|
||||
SaveAs D1 test.xml
|
||||
Close D1
|
||||
Open test.xml D2
|
||||
GetNewShapes D2 0:1 s
|
||||
set info [whatis s_1]
|
||||
if { [regexp "SOLID" $info] != 1 } {
|
||||
puts "Error: first shape should be solid"
|
||||
} else {
|
||||
puts "OK: order of shapes is correct"
|
||||
}
|
||||
Close D2
|
19
tests/bugs/caf/bug28428
Normal file
19
tests/bugs/caf/bug28428
Normal file
@@ -0,0 +1,19 @@
|
||||
puts "==========="
|
||||
puts "OCC28428"
|
||||
puts "==========="
|
||||
puts ""
|
||||
########################################################################
|
||||
# BinMNaming_NamedShapeDriver fails if there are no nodes in NamedShape
|
||||
########################################################################
|
||||
|
||||
pload QAcommands
|
||||
|
||||
NewDocument D1 BinOcaf
|
||||
# Create TNaming_Builder on a label without putthing shapes
|
||||
BuildNamedShape D1 0:1 P
|
||||
SaveAs D1 $imagedir/bug28428_new.cbf
|
||||
Close D1
|
||||
# This produced a NamedShape driver failure with catching by general driver
|
||||
# and output a failure message (catched by parse.rules)
|
||||
Open $imagedir/bug28428_new.cbf D2
|
||||
Close D2
|
@@ -1,3 +1,4 @@
|
||||
FAILED /\bFaulty\b/ bad shape
|
||||
FAILED /failure reading attribute/ attribute failure
|
||||
SKIPPED /Error: unsupported locale specification/ locale is unavailable on tested system
|
||||
OK /Relative error of mass computation/ message from vprops
|
||||
OK /Relative error of mass computation/ message from vprops
|
||||
|
14
tests/bugs/vis/bug28310
Normal file
14
tests/bugs/vis/bug28310
Normal file
@@ -0,0 +1,14 @@
|
||||
puts "==========="
|
||||
puts "OCC28310"
|
||||
puts "==========="
|
||||
puts ""
|
||||
##########################################################################
|
||||
# Visualization - crash on iteration through detected interactive objects
|
||||
##########################################################################
|
||||
|
||||
pload VISUALIZATION QAcommands
|
||||
|
||||
vinit
|
||||
|
||||
# Sequence of C++ commands crashes the application
|
||||
OCC28310
|
Reference in New Issue
Block a user