1 -- Created on: 1996-12-11
2 -- Created by: Robert COUBLANC
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
19 ---Purpose: Application Interactive Services provide the means to
20 -- create links between an application GUI viewer and
21 -- the packages which are used to manage selection
22 -- and presentation. The tools AIS defined in order to
23 -- do this include different sorts of entities: both the
24 -- selectable viewable objects themselves and the
25 -- context and attribute managers to define their
26 -- selection and display.
27 -- To orient the user as he works in a modeling
28 -- environment, views and selections must be
29 -- comprehensible. There must be several different sorts
30 -- of selectable and viewable object defined. These must
31 -- also be interactive, that is, connecting graphic
32 -- representation and the underlying reference
33 -- geometry. These entities are called Interactive
34 -- Objects, and are divided into four types:
39 -- The Datum groups together the construction elements
40 -- such as lines, circles, points, trihedra, plane trihedra,
42 -- The Relation is made up of constraints on one or
43 -- more interactive shapes and the corresponding
44 -- reference geometry. For example, you might want to
45 -- constrain two edges in a parallel relation. This
46 -- contraint is considered as an object in its own right,
47 -- and is shown as a sensitive primitive. This takes the
48 -- graphic form of a perpendicular arrow marked with
49 -- the || symbol and lying between the two edges.
50 -- The Object type includes topological shapes, and
51 -- connections between shapes.
52 -- None, in order not to eliminate the object, tells the
53 -- application to look further until it finds an object
54 -- definition in its generation which is accepted.
55 -- Inside these categories, you have the possibility
56 -- of an additional characterization by means of a
57 -- signature. The signature provides an index to the
58 -- further characterization. By default, the Interactive
59 -- Object has a None type and a signature of 0
60 -- (equivalent to None.) If you want to give a particular
61 -- type and signature to your interactive object, you must
62 -- redefine the two virtual methods: Type and Signature.
63 -- In the C++ inheritance structure of the package, each
64 -- class representing a specific Interactive Object
65 -- inherits AIS_InteractiveObject. Among these
66 -- inheriting classes, AIS_Relation functions as the
67 -- abstract mother class for tinheriting classes defining
68 -- display of specific relational constraints and types of
69 -- dimension. Some of these include:
70 -- - display of constraints based on relations of
71 -- symmetry, tangency, parallelism and concentricity
72 -- - display of dimensions for angles, offsets,
73 -- diameters, radii and chamfers.
74 -- No viewer can show everything at once with any
75 -- coherence or clarity. Views must be managed
76 -- carefully both sequentially and at any given instant.
77 -- Another function of the view is that of a context to
78 -- carry out design in. The design changes are applied
79 -- to the objects in the view and then extended to the
80 -- underlying reference geometry by a solver. To make
81 -- sense of this complicated visual data, several display
82 -- and selection tools are required. To facilitate
83 -- management, each object and each construction
84 -- element has a selection priority. There are also
85 -- means to modify the default priority.
86 -- To define an environment of dynamic detection, you
87 -- can use standard filter classes or create your own. A
88 -- filter questions the owner of the sensitive primitive in
89 -- local context to determine if it has the the desired
90 -- qualities. If it answers positively, it is kept. If not, it is rejected.
91 -- The standard filters supplied in AIS include:
92 -- AIS_AttributeFilter
93 -- AIS_SignatureFilter
95 -- Only the type filter can be used in the default
96 -- operating mode, the neutral point. The others can
97 -- only be used in open local contexts.
98 -- Neutral point and local context constitute the two
99 -- operating modes of the central entity which pilots
100 -- visualizations and selections, the Interactive Context.
101 -- It is linked to a main viewer and if you like, a trash bin
103 -- The neutral point, which is the default mode, allows
104 -- you to easily visualize and select interactive objects
105 -- which have been loaded into the context. Opening
106 -- local contexts allows you to prepare and use a
107 -- temporary selection environment without disturbing
108 -- the neutral point. A set of functions allows you to
109 -- choose the interactive objects which you want to act
110 -- on, the selection modes which you want to activate,
111 -- and the temporary visualizations which you will
112 -- execute. When the operation is finished, you close the
113 -- current local context and return to the state in which
114 -- you were before opening it (neutral point or previous
116 -- An interactive object can have a certain number of
117 -- graphic attributes which are specific to it, such as
118 -- visualization mode, color, and material. By the same
119 -- token, the interactive context has a set of graphic
120 -- attributes, the Drawer which is valid by default for the
121 -- objects it controls. When an interactive object is
122 -- visualized, the required graphic attributes are first
123 -- taken from the object's own Drawer if one exists, or
124 -- from the context drawer for the others.
155 enumeration DisplayMode is WireFrame, Shaded;
157 -- Sets display modes other than neutral point ones,
158 -- for interactive objects. The possibilities include:
162 enumeration ConnectStatus is
167 ---Purpose: Gives the status of connection of an Interactive
168 -- Object. This will be one of the following:
172 -- - Both connection and transformation
173 -- This enumeration is used in
174 -- AIS_ConnectedInteractive. Transform indicates
175 -- that the Interactive Object reference geometry has
176 -- changed location relative to the reference geometry.
178 enumeration TypeOfIso is
182 ---Purpose: Declares the type of isoparameter displayed.
184 enumeration DisplayStatus is
190 -- To give the display status of an Interactive Object.
191 -- This will be one of the following:
192 -- - DS_Displayed: the Interactive Object is
193 -- displayed in the main viewer;
194 -- - DS_Erased: the Interactive Object is hidden in main viewer;
195 -- - DS_Temporary: the Interactive Object is temporarily displayed;
196 -- - DS_None: the Interactive Object is nowhere displayed.
198 enumeration SelectStatus is
204 enumeration StatusOfPick is
212 enumeration StatusOfDetection is
220 end StatusOfDetection;
222 enumeration KindOfDimension is
237 ---Purpose: Declares the kinds of dimensions needed in the
238 -- display of Interactive Objects.
240 enumeration KindOfInteractive is
247 --- Purpose: Declares the type of Interactive Object.
248 -- This is one of the following:
254 -- The Datum is the construction element. These include
255 -- points, lines, axes and planes. The object brings
256 -- together topological shapes. The Relation includes
257 -- dimensions and constraints. The Dimension includes
258 -- length, radius, diameter and angle dimensions.
259 -- When the object is of an unknown type, the None
262 enumeration ClearMode is
269 ---Purpose: Declares which entities in an opened local context
270 -- are to be cleared of mode settings. Temporary
271 -- graphic presentations such as those for sub-shapes,
272 -- for example, are only created for the selection
273 -- process. By means of these enumerations, they can
274 -- be cleared from local context.
276 enumeration KindOfUnit is
285 ---Purpose: Declares the type of Interactive Object unit.
287 enumeration TypeOfAxis is TOAX_Unknown,TOAX_XAxis,TOAX_YAxis,TOAX_ZAxis;
288 ---Purpose: Declares the type of axis.
290 enumeration TypeOfPlane is TOPL_Unknown,TOPL_XYPlane,TOPL_XZPlane,TOPL_YZPlane;
291 ---Purpose: Declares the type of plane.
292 enumeration TypeOfDist is TOD_Unknown,TOD_Horizontal,TOD_Vertical;
293 ---Purpose: To declare the type of distance.
295 enumeration TypeOfAttribute is
312 enumeration StandardDatum is SD_None,SD_Point,SD_Axis,SD_Trihedron,SD_PlaneTrihedron,SD_Line,SD_Circle,SD_Plane;
313 --- Purpose: Declares the type of standard datum of an Interactive Object.
315 enumeration KindOfSurface is KOS_Plane, KOS_Cylinder, KOS_Cone, KOS_Sphere, KOS_Torus,
316 KOS_Revolution, KOS_Extrusion, KOS_OtherSurface;
318 -- Enumerations for dimensions management --
320 enumeration DisplaySpecialSymbol is DSS_No, DSS_Before, DSS_After;
321 ---Purpose: Specifies dimension special symbol display options
323 enumeration DimensionSelectionMode is DSM_All, DSM_Line, DSM_Text;
324 ---Purpose: Specifies dimension selection modes.
328 imported ColoredShape;
329 imported TexturedShape;
333 class InteractiveContext;
339 private class LocalStatus;
341 private class GlobalStatus;
343 deferred class InteractiveObject;
345 ---Category: VARIOUS STANDARD INTERACTIVE OBJECTS
346 -- each type of Datum has a given signature.
347 -- the other interactive objects don't
348 -- implement this signature.
349 -- Mainly used for selection with Filters...
352 class Point; --signature 1
353 class Axis; --signature 2
354 class Trihedron; --signature 3
355 class PlaneTrihedron; --signature 4
356 class Line; --signature 5
357 class Circle; --signature 6
358 class Plane; --signature 7
361 ---Category: Object of type Shape
362 class Shape; --signature 0
365 ---Category: General Objects
366 class ConnectedInteractive; --signature 0
367 class MultipleConnectedInteractive; --signature 1
369 ---Category: DIMENSIONS AND RELATIONS
371 class DimensionOwner;
373 deferred class Relation;
374 deferred class EllipseRadiusDimension;
375 class MaxRadiusDimension;
376 class MinRadiusDimension;
377 imported LengthDimension;
378 imported AngleDimension;
379 imported RadiusDimension;
380 imported DiameterDimension;
381 class Chamf2dDimension;
382 class Chamf3dDimension;
383 class OffsetDimension;
385 class PerpendicularRelation;
386 class ParallelRelation;
387 class TangentRelation;
388 class ConcentricRelation;
389 class IdenticRelation;
390 class SymmetricRelation; -- axial symmetry
391 class MidPointRelation; -- equal distance from point
392 class EqualRadiusRelation;
393 class EqualDistanceRelation;
400 class SignatureFilter;
401 class ExclusionFilter;
402 class AttributeFilter;
403 class C0RegularityFilter;
406 pointer PToContext to InteractiveContext from AIS;
414 ---Category: The Collections
417 class ListOfInteractive instantiates List from TCollection
418 (InteractiveObject from AIS);
420 class SequenceOfInteractive instantiates Sequence from TCollection
421 (InteractiveObject from AIS);
423 class SequenceOfDimension instantiates Sequence from TCollection
426 class MapOfInteractive instantiates Map from TCollection
427 (InteractiveObject from AIS,MapTransientHasher from TColStd);
430 class DataMapofIntegerListOfinteractive instantiates DataMap from
431 TCollection(Integer from Standard, ListOfInteractive from AIS,MapIntegerHasher from TColStd);
432 -- for further management of layers
434 private class DataMapOfIOStatus instantiates DataMap from
435 TCollection(InteractiveObject from AIS,GlobalStatus from AIS,MapTransientHasher from TColStd);
436 -- Management of interactiveObjects Status...
438 class IndexedDataMapOfOwnerPrs instantiates IndexedDataMap from TCollection
439 (EntityOwner from SelectMgr,Presentation from Prs3d ,MapTransientHasher from TColStd);
440 -- for dynamic selection management in local context...
442 -- san: 18/04/2003 AIS_Selection class optimization
443 -- agv: 04/05/2003 Replace NCollection_List for CDL list
444 imported NListTransient;
445 imported NListIteratorOfListTransient;
446 imported NDataMapOfTransientIteratorOfListTransient;
447 -- service map for AIS_Selection class optimized logic
449 private class DataMapOfILC instantiates DataMap from TCollection
450 (Integer from Standard, LocalContext from AIS, MapIntegerHasher from TColStd);
452 private class DataMapOfSelStat instantiates DataMap from TCollection
453 (SelectableObject from SelectMgr,LocalStatus from AIS,MapTransientHasher from TColStd);
454 -- to tell if an object is sensitive to Standard Modes Of Selection....
456 -- Methods for dimensions
458 Nearest( aShape : Shape from TopoDS;
459 aPoint : Pnt from gp )
462 -- Returns the nearest point in a shape. This is used by
463 -- several classes in calculation of dimensions.
465 Nearest (theLine : Lin from gp;
466 thePoint : Pnt from gp)
469 -- @return the nearest point on the line.
471 Nearest (theCurve : Curve from Geom;
472 thePoint : Pnt from gp;
473 theFirstPoint : Pnt from gp;
474 theLastPoint : Pnt from gp;
475 theNearestPoint : out Pnt from gp)
476 returns Boolean from Standard;
478 -- For the given point finds nearest point on the curve,
479 -- @return TRUE if found point is belongs to the curve
480 -- and FALSE otherwise.
482 Farest( aShape : Shape from TopoDS;
483 aPoint : Pnt from gp )
486 ComputeGeometry (theEdge : Edge from TopoDS;
487 theCurve : out Curve from Geom;
488 theFirstPnt : out Pnt from gp;
489 theLastPnt : out Pnt from gp)
490 ---Purpose: Used by 2d Relation only
491 -- Computes the 3d geometry of <anEdge> in the current WorkingPlane
492 -- and the extremities if any
493 -- Return TRUE if ok.
494 returns Boolean from Standard;
496 ComputeGeometry (theEdge : Edge from TopoDS;
497 theCurve : out Curve from Geom;
498 theFirstPnt : out Pnt from gp;
499 theLastPnt : out Pnt from gp;
500 theIsInfinite : out Boolean from Standard)
501 ---Purpose: Used by dimensions only.
502 -- Computes the 3d geometry of <anEdge>.
503 -- Return TRUE if ok.
504 returns Boolean from Standard;
506 ComputeGeometry (theEdge : Edge from TopoDS;
507 theCurve : out Curve from Geom;
508 theFirstPnt : out Pnt from gp;
509 theLastPnt : out Pnt from gp;
510 theExtCurve : out Curve from Geom;
511 theIsInfinite : out Boolean from Standard;
512 theIsOnPlane : out Boolean from Standard;
513 thePlane : Plane from Geom)
514 ---Purpose: Used by 2d Relation only
515 -- Computes the 3d geometry of <anEdge> in the current WorkingPlane
516 -- and the extremities if any.
517 -- If <aCurve> is not in the current plane, <extCurve> contains
518 -- the not projected curve associated to <anEdge>.
519 -- If <anEdge> is infinite, <isinfinite> = true and the 2
520 -- parameters <FirstPnt> and <LastPnt> have no signification.
521 -- Return TRUE if ok.
522 returns Boolean from Standard;
524 ComputeGeometry (theFirstEdge : Edge from TopoDS;
525 theSecondEdge : Edge from TopoDS;
526 theFirstCurve : out Curve from Geom;
527 theSecondCurve : out Curve from Geom;
528 theFirstPnt1 : out Pnt from gp;
529 theLastPnt1 : out Pnt from gp;
530 theFirstPnt2 : out Pnt from gp;
531 theLastPnt2 : out Pnt from gp;
532 thePlane : Plane from Geom)
533 ---Purpose: Used by 2d Relation only
534 -- Computes the 3d geometry of <anEdge> in the current WorkingPlane
535 -- and the extremities if any
536 -- Return TRUE if ok.
537 returns Boolean from Standard;
539 ComputeGeometry (theFirstEdge : Edge from TopoDS;
540 theSecondEdge : Edge from TopoDS;
541 theFirstCurve : out Curve from Geom;
542 theSecondCurve : out Curve from Geom;
543 theFirstPnt1 : out Pnt from gp;
544 theLastPnt1 : out Pnt from gp;
545 theFirstPnt2 : out Pnt from gp;
546 theLastPnt2 : out Pnt from gp;
547 theIsinfinite1 : out Boolean from Standard;
548 theIsinfinite2 : out Boolean from Standard)
549 ---Purpose: Used by dimensions only.Computes the 3d geometry
550 -- of<anEdge1> and <anEdge2> and checks if they are infinite.
551 returns Boolean from Standard;
553 ComputeGeometry (theFirstEdge : Edge from TopoDS;
554 theSecondEdge : Edge from TopoDS;
555 theExtIndex : out Integer from Standard;
556 theFirstCurve : out Curve from Geom;
557 theSecondCurve : out Curve from Geom;
558 theFirstPnt1 : out Pnt from gp;
559 theLastPnt1 : out Pnt from gp;
560 theFirstPnt2 : out Pnt from gp;
561 theLastPnt2 : out Pnt from gp;
562 theExtCurve : out Curve from Geom;
563 theIsinfinite1 : out Boolean from Standard;
564 theIsinfinite2 : out Boolean from Standard;
565 thePlane : Plane from Geom)
566 ---Purpose: Used by 2d Relation only Computes the 3d geometry
567 -- of<anEdge1> and <anEdge2> in the current Plane and the
568 -- extremities if any. Return in ExtCurve the 3d curve
569 -- (not projected in the plane) of the first edge if
570 -- <indexExt> =1 or of the 2nd edge if <indexExt> = 2. If
571 -- <indexExt> = 0, ExtCurve is Null. if there is an edge
572 -- external to the plane, <isinfinite> is true if this
573 -- edge is infinite. So, the extremities of it are not
574 -- significant. Return TRUE if ok
575 returns Boolean from Standard;
577 ComputeGeomCurve (aCurve : in out Curve from Geom;
578 first1 : Real from Standard;
579 last1 : Real from Standard;
580 FirstPnt1 : out Pnt from gp;
581 LastPnt1 : out Pnt from gp;
582 aPlane : Plane from Geom;
583 isOnPlane: out Boolean from Standard)
584 ---Purpose: Checks if aCurve belongs to aPlane; if not, projects aCurve in aPlane
585 -- and returns aCurve;
587 returns Boolean from Standard;
589 ComputeGeometry (aVertex : Vertex from TopoDS;
590 point : out Pnt from gp;
591 aPlane : Plane from Geom;
592 isOnPlane: out Boolean from Standard)
593 returns Boolean from Standard;
595 GetPlaneFromFace (aFace : Face from TopoDS;
596 aPlane : out Pln from gp;
597 aSurf : out Surface from Geom;
598 aSurfType : out KindOfSurface from AIS;
599 Offset : out Real from Standard)
600 returns Boolean from Standard;
601 ---Purpose: Tryes to get Plane from Face. Returns Surface of Face
602 -- in aSurf. Returns Standard_True and Plane of Face in
603 -- aPlane in following cases:
604 -- Face is Plane, Offset of Plane,
605 -- Extrusion of Line and Offset of Extrusion of Line
606 -- Returns pure type of Surface which can be:
607 -- Plane, Cylinder, Cone, Sphere, Torus,
608 -- SurfaceOfRevolution, SurfaceOfExtrusion
610 InitFaceLength (aFace : Face from TopoDS;
611 aPlane : out Pln from gp;
612 aSurface : out Surface from Geom;
613 aSurfaceType : out KindOfSurface from AIS;
614 anOffset : out Real from Standard );
616 InitLengthBetweenCurvilinearFaces (theFirstFace : Face from TopoDS;
617 theSecondFace : Face from TopoDS;
618 theFirstSurf : in out Surface from Geom;
619 theSecondSurf : in out Surface from Geom;
620 theFirstAttach : out Pnt from gp;
621 theSecondAttach : out Pnt from gp;
622 theDirOnPlane : out Dir from gp);
623 ---Purpose: Finds attachment points on two curvilinear faces for length dimension.
624 -- @param thePlaneDir [in] the direction on the dimension plane to
625 -- compute the plane automatically. It will not be taken into account if
626 -- plane is defined by user.
628 InitAngleBetweenPlanarFaces (theFirstFace : Face from TopoDS;
629 theSecondFace : Face from TopoDS;
630 theCenter : out Pnt from gp;
631 theFirstAttach : out Pnt from gp;
632 theSecondAttach : out Pnt from gp;
633 theIsFirstPointSet : Boolean from Standard = Standard_False)
634 returns Boolean from Standard;
635 ---Purpose: Finds three points for the angle dimension between
638 InitAngleBetweenCurvilinearFaces (theFirstFace : Face from TopoDS;
639 theSecondFace : Face from TopoDS;
640 theFirstSurfType : KindOfSurface from AIS;
641 theSecondSurfType : KindOfSurface from AIS;
642 theCenter : out Pnt from gp;
643 theFirstAttach : out Pnt from gp;
644 theSecondAttach : out Pnt from gp;
645 theIsFirstPointSet : Boolean from Standard = Standard_False)
646 returns Boolean from Standard;
647 ---Purpose: Finds three points for the angle dimension between
648 -- two curvilinear surfaces.
650 ProjectPointOnPlane( aPoint : Pnt from gp; aPlane : Pln from gp )
653 ProjectPointOnLine( aPoint : Pnt from gp; aLine : Lin from gp )
656 TranslatePointToBound( aPoint : Pnt from gp; aDir : Dir from gp; aBndBox: Box from Bnd )
659 InDomain( aFirstPar : Real from Standard;
660 aLastPar : Real from Standard;
661 anAttachPar : Real from Standard)
662 returns Boolean from Standard;
663 ---Purpose: returns True if point with anAttachPar is
666 NearestApex(elips : Elips from gp;
669 fpara : Real from Standard ;
670 lpara : Real from Standard ;
671 IsInDomain : out Boolean from Standard)
673 ---Purpose: computes nearest to ellipse arc apex
675 DistanceFromApex(elips : Elips from gp;
677 par : Real from Standard )
678 returns Real from Standard;
679 ---Purpose: computes length of ellipse arc in parametric units
682 ComputeProjEdgePresentation(aPres : Presentation from Prs3d;
683 aDrawer : Drawer from AIS;
684 anEdge : Edge from TopoDS;
685 ProjCurve: Curve from Geom;
686 FirstP : Pnt from gp;
688 aColor : NameOfColor from Quantity = Quantity_NOC_PURPLE;
689 aWidth : Real from Standard = 2;
690 aProjTOL : TypeOfLine from Aspect = Aspect_TOL_DASH;
691 aCallTOL : TypeOfLine from Aspect = Aspect_TOL_DOT);
693 ComputeProjVertexPresentation(aPres : Presentation from Prs3d;
694 aDrawer : Drawer from AIS;
695 aVertex : Vertex from TopoDS;
696 ProjPoint: Pnt from gp;
697 aColor : NameOfColor from Quantity = Quantity_NOC_PURPLE;
698 aWidth : Real from Standard = 2;
699 aProjTOM : TypeOfMarker from Aspect = Aspect_TOM_PLUS;
700 aCallTOL : TypeOfLine from Aspect = Aspect_TOL_DOT);