2 -- Created: Wed Dec 11 11:16:37 1996
3 -- Author: Robert COUBLANC
4 -- <rob@robox.paris1.matra-dtv.fr>
5 ---Copyright: Matra Datavision 1996
10 ---Purpose: Application Interactive Services provide the means to
11 -- create links between an application GUI viewer and
12 -- the packages which are used to manage selection
13 -- and presentation. The tools AIS defined in order to
14 -- do this include different sorts of entities: both the
15 -- selectable viewable objects themselves and the
16 -- context and attribute managers to define their
17 -- selection and display.
18 -- To orient the user as he works in a modeling
19 -- environment, views and selections must be
20 -- comprehensible. There must be several different sorts
21 -- of selectable and viewable object defined. These must
22 -- also be interactive, that is, connecting graphic
23 -- representation and the underlying reference
24 -- geometry. These entities are called Interactive
25 -- Objects, and are divided into four types:
30 -- The Datum groups together the construction elements
31 -- such as lines, circles, points, trihedra, plane trihedra,
33 -- The Relation is made up of constraints on one or
34 -- more interactive shapes and the corresponding
35 -- reference geometry. For example, you might want to
36 -- constrain two edges in a parallel relation. This
37 -- contraint is considered as an object in its own right,
38 -- and is shown as a sensitive primitive. This takes the
39 -- graphic form of a perpendicular arrow marked with
40 -- the || symbol and lying between the two edges.
41 -- The Object type includes topological shapes, and
42 -- connections between shapes.
43 -- None, in order not to eliminate the object, tells the
44 -- application to look further until it finds an object
45 -- definition in its generation which is accepted.
46 -- Inside these categories, you have the possibility
47 -- of an additional characterization by means of a
48 -- signature. The signature provides an index to the
49 -- further characterization. By default, the Interactive
50 -- Object has a None type and a signature of 0
51 -- (equivalent to None.) If you want to give a particular
52 -- type and signature to your interactive object, you must
53 -- redefine the two virtual methods: Type and Signature.
54 -- In the C++ inheritance structure of the package, each
55 -- class representing a specific Interactive Object
56 -- inherits AIS_InteractiveObject. Among these
57 -- inheriting classes, AIS_Relation functions as the
58 -- abstract mother class for tinheriting classes defining
59 -- display of specific relational constraints and types of
60 -- dimension. Some of these include:
61 -- - display of constraints based on relations of
62 -- symmetry, tangency, parallelism and concentricity
63 -- - display of dimensions for angles, offsets,
64 -- diameters, radii and chamfers.
65 -- No viewer can show everything at once with any
66 -- coherence or clarity. Views must be managed
67 -- carefully both sequentially and at any given instant.
68 -- Another function of the view is that of a context to
69 -- carry out design in. The design changes are applied
70 -- to the objects in the view and then extended to the
71 -- underlying reference geometry by a solver. To make
72 -- sense of this complicated visual data, several display
73 -- and selection tools are required. To facilitate
74 -- management, each object and each construction
75 -- element has a selection priority. There are also
76 -- means to modify the default priority.
77 -- To define an environment of dynamic detection, you
78 -- can use standard filter classes or create your own. A
79 -- filter questions the owner of the sensitive primitive in
80 -- local context to determine if it has the the desired
81 -- qualities. If it answers positively, it is kept. If not, it is rejected.
82 -- The standard filters supplied in AIS include:
83 -- AIS_AttributeFilter
84 -- AIS_SignatureFilter
86 -- Only the type filter can be used in the default
87 -- operating mode, the neutral point. The others can
88 -- only be used in open local contexts.
89 -- Neutral point and local context constitute the two
90 -- operating modes of the central entity which pilots
91 -- visualizations and selections, the Interactive Context.
92 -- It is linked to a main viewer and if you like, a trash bin
94 -- The neutral point, which is the default mode, allows
95 -- you to easily visualize and select interactive objects
96 -- which have been loaded into the context. Opening
97 -- local contexts allows you to prepare and use a
98 -- temporary selection environment without disturbing
99 -- the neutral point. A set of functions allows you to
100 -- choose the interactive objects which you want to act
101 -- on, the selection modes which you want to activate,
102 -- and the temporary visualizations which you will
103 -- execute. When the operation is finished, you close the
104 -- current local context and return to the state in which
105 -- you were before opening it (neutral point or previous
107 -- An interactive object can have a certain number of
108 -- graphic attributes which are specific to it, such as
109 -- visualization mode, color, and material. By the same
110 -- token, the interactive context has a set of graphic
111 -- attributes, the Drawer which is valid by default for the
112 -- objects it controls. When an interactive object is
113 -- visualized, the required graphic attributes are first
114 -- taken from the object's own Drawer if one exists, or
115 -- from the context drawer for the others.
146 enumeration DisplayMode is WireFrame, Shaded, QuickHLR, ExactHLR;
148 -- Sets display modes other than neutral point ones,
149 -- for interactive objects. The possibilities include:
153 enumeration ConnectStatus is
158 ---Purpose: Gives the status of connection of an Interactive
159 -- Object. This will be one of the following:
163 -- - Both connection and transformation
164 -- This enumeration is used in
165 -- AIS_ConnectedInteractive. Transform indicates
166 -- that the Interactive Object reference geometry has
167 -- changed location relative to the reference geometry.
169 enumeration TypeOfIso is
173 ---Purpose: Declares the type of isoparameter displayed.
175 enumeration DisplayStatus is
182 -- To give the display status of an Interactive Object.
183 -- This will be one of the following:
184 -- - DS_Displayed: the Interactive Object is
185 -- displayed in the main viewer;
186 -- - DS_Erased: the Interactive Object is erased in the collector;
187 -- - DS_FullErased: the Interactive Object is erased
188 -- but not in the collector;
189 -- - DS_Temporary: the Interactive Object is temporarily displayed;
190 -- - DS_None: the Interactive Object is nowhere displayed.
192 enumeration SelectStatus is
198 enumeration StatusOfPick is
206 enumeration StatusOfDetection is
214 end StatusOfDetection;
216 enumeration KindOfDimension is
231 ---Purpose: Declares the kinds of dimensions needed in the
232 -- display of Interactive Objects.
234 enumeration KindOfInteractive is
240 --- Purpose: Declares the type of Interactive Object.
241 -- This is one of the following:
246 -- The Datum is the construction element. These include
247 -- points, lines, axes and planes. The object brings
248 -- together topological shapes. The Relation includes
249 -- dimensions and constraints. When the object is of an
250 -- unknown type, the None type is declared.
252 enumeration ClearMode is
259 ---Purpose: Declares which entities in an opened local context
260 -- are to be cleared of mode settings. Temporary
261 -- graphic presentations such as those for sub-shapes,
262 -- for example, are only created for the selection
263 -- process. By means of these enumerations, they can
264 -- be cleared from local context.
266 enumeration KindOfUnit is
275 ---Purpose: Declares the type of Interactive Object unit.
277 enumeration TypeOfAxis is TOAX_Unknown,TOAX_XAxis,TOAX_YAxis,TOAX_ZAxis;
278 ---Purpose: Declares the type of axis.
280 enumeration TypeOfPlane is TOPL_Unknown,TOPL_XYPlane,TOPL_XZPlane,TOPL_YZPlane;
281 ---Purpose: Declares the type of plane.
282 enumeration TypeOfDist is TOD_Unknown,TOD_Horizontal,TOD_Vertical;
283 ---Purpose: To declare the type of distance.
285 enumeration TypeOfAttribute is
302 enumeration StandardDatum is SD_None,SD_Point,SD_Axis,SD_Trihedron,SD_PlaneTrihedron,SD_Line,SD_Circle,SD_Plane;
303 --- Purpose: Declares the type of standard datum of an Interactive Object.
305 -- New ------------------------------------------------
307 enumeration KindOfSurface is KOS_Plane, KOS_Cylinder, KOS_Cone, KOS_Sphere, KOS_Torus,
308 KOS_Revolution, KOS_Extrusion, KOS_OtherSurface;
309 -------------------------------------------------------
317 class InteractiveContext;
323 private class LocalStatus;
325 private class GlobalStatus;
327 deferred class InteractiveObject;
329 ---Category: VARIOUS STANDARD INTERACTIVE OBJECTS
330 -- each type of Datum has a given signature.
331 -- the other interactive objects don't
332 -- implement this signature.
333 -- Mainly used for selection with Filters...
336 class Point; --signature 1
337 class Axis; --signature 2
338 class Trihedron; --signature 3
339 class PlaneTrihedron; --signature 4
340 class Line; --signature 5
341 class Circle; --signature 6
342 class Plane; --signature 7
345 ---Category: Object of type Shape
346 class Shape; --signature 0
347 class ConnectedShape; --signature 1
348 class MultipleConnectedShape; --signature 2
352 ---Category: General Objects
353 class ConnectedInteractive; --signature 0
354 class MultipleConnectedInteractive; --signature 1
356 ---Category: DIMENSIONS AND RELATIONS
358 class DimensionOwner;
360 deferred class Relation;
361 deferred class EllipseRadiusDimension;
362 class MaxRadiusDimension;
363 class MinRadiusDimension;
364 class LengthDimension;
365 class AngleDimension;
366 class RadiusDimension;
367 class DiameterDimension;
368 class Chamf2dDimension;
369 class Chamf3dDimension;
370 class OffsetDimension;
372 class PerpendicularRelation;
373 class ParallelRelation;
374 class TangentRelation;
375 class ConcentricRelation;
376 class IdenticRelation;
377 class SymmetricRelation; -- axial symmetry
378 class MidPointRelation; -- equal distance from point
379 class EqualRadiusRelation;
380 class EqualDistanceRelation;
387 class SignatureFilter;
388 class ExclusionFilter;
389 class AttributeFilter;
390 class C0RegularityFilter;
393 pointer PToContext to InteractiveContext from AIS;
401 ---Category: The Collections
404 class ListOfInteractive instantiates List from TCollection
405 (InteractiveObject from AIS);
407 class SequenceOfInteractive instantiates Sequence from TCollection
408 (InteractiveObject from AIS);
410 class SequenceOfDimension instantiates Sequence from TCollection
413 class MapOfInteractive instantiates Map from TCollection
414 (InteractiveObject from AIS,MapTransientHasher from TColStd);
417 class DataMapofIntegerListOfinteractive instantiates DataMap from
418 TCollection(Integer from Standard, ListOfInteractive from AIS,MapIntegerHasher from TColStd);
419 -- for further management of layers
421 private class DataMapOfIOStatus instantiates DataMap from
422 TCollection(InteractiveObject from AIS,GlobalStatus from AIS,MapTransientHasher from TColStd);
423 -- Management of interactiveObjects Status...
425 class IndexedDataMapOfOwnerPrs instantiates IndexedDataMap from TCollection
426 (EntityOwner from SelectMgr,Presentation from Prs3d ,MapTransientHasher from TColStd);
427 -- for dynamic selection management in local context...
429 -- san: 18/04/2003 AIS_Selection class optimization
430 -- agv: 04/05/2003 Replace NCollection_List for CDL list
431 imported NListTransient;
432 imported NListIteratorOfListTransient;
433 imported NDataMapOfTransientIteratorOfListTransient;
434 -- service map for AIS_Selection class optimized logic
436 private class DataMapOfILC instantiates DataMap from TCollection
437 (Integer from Standard, LocalContext from AIS, MapIntegerHasher from TColStd);
439 private class DataMapOfSelStat instantiates DataMap from TCollection
440 (SelectableObject from SelectMgr,LocalStatus from AIS,MapTransientHasher from TColStd);
441 -- to tell if an object is sensitive to Standard Modes Of Selection....
443 -- Methods for dimensions
445 Nearest( aShape : Shape from TopoDS;
446 aPoint : Pnt from gp )
449 -- Returns the nearest point in a shape. This is used by
450 -- several classes in calculation of dimensions.
452 Farest( aShape : Shape from TopoDS;
453 aPoint : Pnt from gp )
456 ComputeGeometry(anEdge : Edge from TopoDS;
457 aCurve : out Curve from Geom;
458 FirstPnt : out Pnt from gp;
459 LastPnt : out Pnt from gp)
460 ---Purpose: Used by 2d Relation only
461 -- Computes the 3d geometry of <anEdge> in the current WorkingPlane
462 -- and the extremities if any
464 returns Boolean from Standard;
466 ComputeGeometry(anEdge : Edge from TopoDS;
467 aCurve : out Curve from Geom;
468 FirstPnt : out Pnt from gp;
469 LastPnt : out Pnt from gp;
470 extCurve : out Curve from Geom;
471 isinfinite: out Boolean from Standard;
472 isOnPlane : out Boolean from Standard;
473 aPlane : Plane from Geom)
474 ---Purpose: Used by 2d Relation only
475 -- Computes the 3d geometry of <anEdge> in the current WorkingPlane
476 -- and the extremities if any.
477 -- If <aCurve> is not in the current plane, <extCurve> contains
478 -- the not projected curve associated to <anEdge>.
479 -- If <anEdge> is infinite, <isinfinite> = true and the 2
480 -- parameters <FirstPnt> and <LastPnt> have no signification.
482 returns Boolean from Standard;
484 ComputeGeometry (anEdge1 : Edge from TopoDS;
485 anEdge2 : Edge from TopoDS;
486 aCurve1 : out Curve from Geom;
487 aCurve2 : out Curve from Geom;
488 FirstPnt1 : out Pnt from gp;
489 LastPnt1 : out Pnt from gp;
490 FirstPnt2 : out Pnt from gp;
491 LastPnt2 : out Pnt from gp;
492 aPlane : Plane from Geom)
493 ---Purpose: Used by 2d Relation only
494 -- Computes the 3d geometry of <anEdge> in the current WorkingPlane
495 -- and the extremities if any
497 returns Boolean from Standard;
500 ComputeGeometry (anEdge1 : Edge from TopoDS;
501 anEdge2 : Edge from TopoDS;
502 indexExt : out Integer from Standard;
503 aCurve1 : out Curve from Geom;
504 aCurve2 : out Curve from Geom;
505 FirstPnt1 : out Pnt from gp;
506 LastPnt1 : out Pnt from gp;
507 FirstPnt2 : out Pnt from gp;
508 LastPnt2 : out Pnt from gp;
509 ExtCurve : out Curve from Geom;
510 isinfinite1 : out Boolean from Standard;
511 isinfinite2 : out Boolean from Standard;
512 aPlane : Plane from Geom)
514 ---Purpose: Used by 2d Relation only Computes the 3d geometry
515 -- of<anEdge1> and <anEdge2> in the current Plane and the
516 -- extremities if any. Return in ExtCurve the 3d curve
517 -- (not projected in the plane) of the first edge if
518 -- <indexExt> =1 or of the 2nd edge if <indexExt> = 2. If
519 -- <indexExt> = 0, ExtCurve is Null. if there is an edge
520 -- external to the plane, <isinfinite> is true if this
521 -- edge is infinite. So, the extremities of it are not
522 -- significant. Return TRUE if ok
523 returns Boolean from Standard;
525 ComputeGeomCurve (aCurve : in out Curve from Geom;
526 first1 : Real from Standard;
527 last1 : Real from Standard;
528 FirstPnt1 : out Pnt from gp;
529 LastPnt1 : out Pnt from gp;
530 aPlane : Plane from Geom;
531 isOnPlane: out Boolean from Standard)
533 ---Purpose: Checks if aCurve belongs to aPlane; if not, projects aCurve in aPlane
534 -- and returns aCurve;
536 returns Boolean from Standard;
538 ComputeGeometry(aVertex : Vertex from TopoDS;
539 point : out Pnt from gp;
540 aPlane : Plane from Geom;
541 isOnPlane: out Boolean from Standard)
542 returns Boolean from Standard;
545 GetPlaneFromFace( aFace : Face from TopoDS;
546 aPlane : out Pln from gp;
547 aSurf : out Surface from Geom;
548 aSurfType : out KindOfSurface from AIS;
549 Offset : out Real from Standard )
550 returns Boolean from Standard;
551 ---Purpose: Tryes to get Plane from Face. Returns Surface of Face
552 -- in aSurf. Returns Standard_True and Plane of Face in
553 -- aPlane in following cases:
554 -- Face is Plane, Offset of Plane,
555 -- Extrusion of Line and Offset of Extrusion of Line
556 -- Returns pure type of Surface which can be:
557 -- Plane, Cylinder, Cone, Sphere, Torus,
558 -- SurfaceOfRevolution, SurfaceOfExtrusion
560 InitFaceLength( aFace : Face from TopoDS;
561 aPlane : out Pln from gp;
562 aSurface : out Surface from Geom;
563 aSurfaceType : out KindOfSurface from AIS;
564 anOffset : out Real from Standard );
566 ComputeLengthBetweenPlanarFaces( FirstFace : Face from TopoDS;
567 SecondFace : Face from TopoDS;
568 Plane1 : Pln from gp;
569 Plane2 : Pln from gp;
570 Value : out Real from Standard;
571 FirstAttach : out Pnt from gp ;
572 SecondAttach : out Pnt from gp ;
573 DirAttach : out Dir from gp ;
574 AutomaticPos : Boolean from Standard;
575 Position : in out Pnt from gp);
577 ComputeLengthBetweenCurvilinearFaces( FirstFace : Face from TopoDS;
578 SecondFace : Face from TopoDS;
579 FirstSurf : in out Surface from Geom;
580 SecondSurf : in out Surface from Geom;
581 AutomaticPos : Boolean from Standard;
582 Value : out Real from Standard;
583 Position : out Pnt from gp;
584 FirstAttach : out Pnt from gp;
585 SecondAttach : out Pnt from gp;
586 DirAttach : out Dir from gp );
588 ComputeAngleBetweenPlanarFaces( FirstFace : Face from TopoDS;
589 SecondFace : Face from TopoDS;
590 Surf2 : Surface from Geom;
592 Value : Real from Standard;
593 AutomaticPos : Boolean from Standard;
594 Position : out Pnt from gp;
595 Center : out Pnt from gp;
596 FirstAttach : out Pnt from gp;
597 SecondAttach : out Pnt from gp;
598 FirstDir : out Dir from gp;
599 SecondDir : out Dir from gp);
600 ---Purpose: Computes geometric parameters for planar faces for
601 -- Angular dimensions
603 ComputeAngleBetweenCurvilinearFaces( FirstFace : Face from TopoDS;
604 SecondFace : Face from TopoDS;
605 FirstSurf : Surface from Geom;
606 SecondSurf : Surface from Geom;
607 FirstSurfType : KindOfSurface from AIS;
608 SecondSurfType : KindOfSurface from AIS;
610 Value : Real from Standard;
611 AutomaticPos : Boolean from Standard;
612 Position : out Pnt from gp;
613 Center : out Pnt from gp;
614 FirstAttach : out Pnt from gp;
615 SecondAttach : out Pnt from gp;
616 FirstDir : out Dir from gp;
617 SecondDir : out Dir from gp;
618 Plane : out Plane from Geom );
619 ---Purpose: Computes geometric parameters for curvilinear faces for
620 -- Angular dimensions
622 ProjectPointOnPlane( aPoint : Pnt from gp; aPlane : Pln from gp )
625 ProjectPointOnLine( aPoint : Pnt from gp; aLine : Lin from gp )
628 TranslatePointToBound( aPoint : Pnt from gp; aDir : Dir from gp; aBndBox: Box from Bnd )
631 InDomain( aFirstPar : Real from Standard;
632 aLastPar : Real from Standard;
633 anAttachPar : Real from Standard)
634 returns Boolean from Standard;
635 ---Purpose: returns True if point with anAttachPar is
638 NearestApex(elips : Elips from gp;
641 fpara : Real from Standard ;
642 lpara : Real from Standard ;
643 IsInDomain : out Boolean from Standard)
645 ---Purpose: computes nearest to ellipse arc apex
647 DistanceFromApex(elips : Elips from gp;
649 par : Real from Standard )
650 returns Real from Standard;
651 ---Purpose: computes length of ellipse arc in parametric units
654 ComputeProjEdgePresentation(aPres : mutable Presentation from Prs3d;
655 aDrawer : mutable Drawer from AIS;
656 anEdge : Edge from TopoDS;
657 ProjCurve: Curve from Geom;
658 FirstP : Pnt from gp;
660 aColor : NameOfColor from Quantity = Quantity_NOC_PURPLE;
661 aWidth : Real from Standard = 2;
662 aProjTOL : TypeOfLine from Aspect = Aspect_TOL_DASH;
663 aCallTOL : TypeOfLine from Aspect = Aspect_TOL_DOT);
665 ComputeProjVertexPresentation(aPres : mutable Presentation from Prs3d;
666 aDrawer : mutable Drawer from AIS;
667 aVertex : Vertex from TopoDS;
668 ProjPoint: Pnt from gp;
669 aColor : NameOfColor from Quantity = Quantity_NOC_PURPLE;
670 aWidth : Real from Standard = 2;
671 aProjTOM : TypeOfMarker from Aspect = Aspect_TOM_PLUS;
672 aCallTOL : TypeOfLine from Aspect = Aspect_TOL_DOT);