1 -- Created on: 1996-12-11
2 -- Created by: Robert COUBLANC
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
25 ---Purpose: Application Interactive Services provide the means to
26 -- create links between an application GUI viewer and
27 -- the packages which are used to manage selection
28 -- and presentation. The tools AIS defined in order to
29 -- do this include different sorts of entities: both the
30 -- selectable viewable objects themselves and the
31 -- context and attribute managers to define their
32 -- selection and display.
33 -- To orient the user as he works in a modeling
34 -- environment, views and selections must be
35 -- comprehensible. There must be several different sorts
36 -- of selectable and viewable object defined. These must
37 -- also be interactive, that is, connecting graphic
38 -- representation and the underlying reference
39 -- geometry. These entities are called Interactive
40 -- Objects, and are divided into four types:
45 -- The Datum groups together the construction elements
46 -- such as lines, circles, points, trihedra, plane trihedra,
48 -- The Relation is made up of constraints on one or
49 -- more interactive shapes and the corresponding
50 -- reference geometry. For example, you might want to
51 -- constrain two edges in a parallel relation. This
52 -- contraint is considered as an object in its own right,
53 -- and is shown as a sensitive primitive. This takes the
54 -- graphic form of a perpendicular arrow marked with
55 -- the || symbol and lying between the two edges.
56 -- The Object type includes topological shapes, and
57 -- connections between shapes.
58 -- None, in order not to eliminate the object, tells the
59 -- application to look further until it finds an object
60 -- definition in its generation which is accepted.
61 -- Inside these categories, you have the possibility
62 -- of an additional characterization by means of a
63 -- signature. The signature provides an index to the
64 -- further characterization. By default, the Interactive
65 -- Object has a None type and a signature of 0
66 -- (equivalent to None.) If you want to give a particular
67 -- type and signature to your interactive object, you must
68 -- redefine the two virtual methods: Type and Signature.
69 -- In the C++ inheritance structure of the package, each
70 -- class representing a specific Interactive Object
71 -- inherits AIS_InteractiveObject. Among these
72 -- inheriting classes, AIS_Relation functions as the
73 -- abstract mother class for tinheriting classes defining
74 -- display of specific relational constraints and types of
75 -- dimension. Some of these include:
76 -- - display of constraints based on relations of
77 -- symmetry, tangency, parallelism and concentricity
78 -- - display of dimensions for angles, offsets,
79 -- diameters, radii and chamfers.
80 -- No viewer can show everything at once with any
81 -- coherence or clarity. Views must be managed
82 -- carefully both sequentially and at any given instant.
83 -- Another function of the view is that of a context to
84 -- carry out design in. The design changes are applied
85 -- to the objects in the view and then extended to the
86 -- underlying reference geometry by a solver. To make
87 -- sense of this complicated visual data, several display
88 -- and selection tools are required. To facilitate
89 -- management, each object and each construction
90 -- element has a selection priority. There are also
91 -- means to modify the default priority.
92 -- To define an environment of dynamic detection, you
93 -- can use standard filter classes or create your own. A
94 -- filter questions the owner of the sensitive primitive in
95 -- local context to determine if it has the the desired
96 -- qualities. If it answers positively, it is kept. If not, it is rejected.
97 -- The standard filters supplied in AIS include:
98 -- AIS_AttributeFilter
99 -- AIS_SignatureFilter
101 -- Only the type filter can be used in the default
102 -- operating mode, the neutral point. The others can
103 -- only be used in open local contexts.
104 -- Neutral point and local context constitute the two
105 -- operating modes of the central entity which pilots
106 -- visualizations and selections, the Interactive Context.
107 -- It is linked to a main viewer and if you like, a trash bin
109 -- The neutral point, which is the default mode, allows
110 -- you to easily visualize and select interactive objects
111 -- which have been loaded into the context. Opening
112 -- local contexts allows you to prepare and use a
113 -- temporary selection environment without disturbing
114 -- the neutral point. A set of functions allows you to
115 -- choose the interactive objects which you want to act
116 -- on, the selection modes which you want to activate,
117 -- and the temporary visualizations which you will
118 -- execute. When the operation is finished, you close the
119 -- current local context and return to the state in which
120 -- you were before opening it (neutral point or previous
122 -- An interactive object can have a certain number of
123 -- graphic attributes which are specific to it, such as
124 -- visualization mode, color, and material. By the same
125 -- token, the interactive context has a set of graphic
126 -- attributes, the Drawer which is valid by default for the
127 -- objects it controls. When an interactive object is
128 -- visualized, the required graphic attributes are first
129 -- taken from the object's own Drawer if one exists, or
130 -- from the context drawer for the others.
161 enumeration DisplayMode is WireFrame, Shaded, QuickHLR, ExactHLR;
163 -- Sets display modes other than neutral point ones,
164 -- for interactive objects. The possibilities include:
168 enumeration ConnectStatus is
173 ---Purpose: Gives the status of connection of an Interactive
174 -- Object. This will be one of the following:
178 -- - Both connection and transformation
179 -- This enumeration is used in
180 -- AIS_ConnectedInteractive. Transform indicates
181 -- that the Interactive Object reference geometry has
182 -- changed location relative to the reference geometry.
184 enumeration TypeOfIso is
188 ---Purpose: Declares the type of isoparameter displayed.
190 enumeration DisplayStatus is
197 -- To give the display status of an Interactive Object.
198 -- This will be one of the following:
199 -- - DS_Displayed: the Interactive Object is
200 -- displayed in the main viewer;
201 -- - DS_Erased: the Interactive Object is erased in the collector;
202 -- - DS_FullErased: the Interactive Object is erased
203 -- but not in the collector;
204 -- - DS_Temporary: the Interactive Object is temporarily displayed;
205 -- - DS_None: the Interactive Object is nowhere displayed.
207 enumeration SelectStatus is
213 enumeration StatusOfPick is
221 enumeration StatusOfDetection is
229 end StatusOfDetection;
231 enumeration KindOfDimension is
246 ---Purpose: Declares the kinds of dimensions needed in the
247 -- display of Interactive Objects.
249 enumeration KindOfInteractive is
255 --- Purpose: Declares the type of Interactive Object.
256 -- This is one of the following:
261 -- The Datum is the construction element. These include
262 -- points, lines, axes and planes. The object brings
263 -- together topological shapes. The Relation includes
264 -- dimensions and constraints. When the object is of an
265 -- unknown type, the None type is declared.
267 enumeration ClearMode is
274 ---Purpose: Declares which entities in an opened local context
275 -- are to be cleared of mode settings. Temporary
276 -- graphic presentations such as those for sub-shapes,
277 -- for example, are only created for the selection
278 -- process. By means of these enumerations, they can
279 -- be cleared from local context.
281 enumeration KindOfUnit is
290 ---Purpose: Declares the type of Interactive Object unit.
292 enumeration TypeOfAxis is TOAX_Unknown,TOAX_XAxis,TOAX_YAxis,TOAX_ZAxis;
293 ---Purpose: Declares the type of axis.
295 enumeration TypeOfPlane is TOPL_Unknown,TOPL_XYPlane,TOPL_XZPlane,TOPL_YZPlane;
296 ---Purpose: Declares the type of plane.
297 enumeration TypeOfDist is TOD_Unknown,TOD_Horizontal,TOD_Vertical;
298 ---Purpose: To declare the type of distance.
300 enumeration TypeOfAttribute is
317 enumeration StandardDatum is SD_None,SD_Point,SD_Axis,SD_Trihedron,SD_PlaneTrihedron,SD_Line,SD_Circle,SD_Plane;
318 --- Purpose: Declares the type of standard datum of an Interactive Object.
320 -- New ------------------------------------------------
322 enumeration KindOfSurface is KOS_Plane, KOS_Cylinder, KOS_Cone, KOS_Sphere, KOS_Torus,
323 KOS_Revolution, KOS_Extrusion, KOS_OtherSurface;
324 -------------------------------------------------------
332 class InteractiveContext;
338 private class LocalStatus;
340 private class GlobalStatus;
342 deferred class InteractiveObject;
344 ---Category: VARIOUS STANDARD INTERACTIVE OBJECTS
345 -- each type of Datum has a given signature.
346 -- the other interactive objects don't
347 -- implement this signature.
348 -- Mainly used for selection with Filters...
351 class Point; --signature 1
352 class Axis; --signature 2
353 class Trihedron; --signature 3
354 class PlaneTrihedron; --signature 4
355 class Line; --signature 5
356 class Circle; --signature 6
357 class Plane; --signature 7
360 ---Category: Object of type Shape
361 class Shape; --signature 0
362 class ConnectedShape; --signature 1
363 class MultipleConnectedShape; --signature 2
367 ---Category: General Objects
368 class ConnectedInteractive; --signature 0
369 class MultipleConnectedInteractive; --signature 1
371 ---Category: DIMENSIONS AND RELATIONS
373 class DimensionOwner;
375 deferred class Relation;
376 deferred class EllipseRadiusDimension;
377 class MaxRadiusDimension;
378 class MinRadiusDimension;
379 class LengthDimension;
380 class AngleDimension;
381 class RadiusDimension;
382 class DiameterDimension;
383 class Chamf2dDimension;
384 class Chamf3dDimension;
385 class OffsetDimension;
387 class PerpendicularRelation;
388 class ParallelRelation;
389 class TangentRelation;
390 class ConcentricRelation;
391 class IdenticRelation;
392 class SymmetricRelation; -- axial symmetry
393 class MidPointRelation; -- equal distance from point
394 class EqualRadiusRelation;
395 class EqualDistanceRelation;
402 class SignatureFilter;
403 class ExclusionFilter;
404 class AttributeFilter;
405 class C0RegularityFilter;
408 pointer PToContext to InteractiveContext from AIS;
416 ---Category: The Collections
419 class ListOfInteractive instantiates List from TCollection
420 (InteractiveObject from AIS);
422 class SequenceOfInteractive instantiates Sequence from TCollection
423 (InteractiveObject from AIS);
425 class SequenceOfDimension instantiates Sequence from TCollection
428 class MapOfInteractive instantiates Map from TCollection
429 (InteractiveObject from AIS,MapTransientHasher from TColStd);
432 class DataMapofIntegerListOfinteractive instantiates DataMap from
433 TCollection(Integer from Standard, ListOfInteractive from AIS,MapIntegerHasher from TColStd);
434 -- for further management of layers
436 private class DataMapOfIOStatus instantiates DataMap from
437 TCollection(InteractiveObject from AIS,GlobalStatus from AIS,MapTransientHasher from TColStd);
438 -- Management of interactiveObjects Status...
440 class IndexedDataMapOfOwnerPrs instantiates IndexedDataMap from TCollection
441 (EntityOwner from SelectMgr,Presentation from Prs3d ,MapTransientHasher from TColStd);
442 -- for dynamic selection management in local context...
444 -- san: 18/04/2003 AIS_Selection class optimization
445 -- agv: 04/05/2003 Replace NCollection_List for CDL list
446 imported NListTransient;
447 imported NListIteratorOfListTransient;
448 imported NDataMapOfTransientIteratorOfListTransient;
449 -- service map for AIS_Selection class optimized logic
451 private class DataMapOfILC instantiates DataMap from TCollection
452 (Integer from Standard, LocalContext from AIS, MapIntegerHasher from TColStd);
454 private class DataMapOfSelStat instantiates DataMap from TCollection
455 (SelectableObject from SelectMgr,LocalStatus from AIS,MapTransientHasher from TColStd);
456 -- to tell if an object is sensitive to Standard Modes Of Selection....
458 -- Methods for dimensions
460 Nearest( aShape : Shape from TopoDS;
461 aPoint : Pnt from gp )
464 -- Returns the nearest point in a shape. This is used by
465 -- several classes in calculation of dimensions.
467 Farest( aShape : Shape from TopoDS;
468 aPoint : Pnt from gp )
471 ComputeGeometry(anEdge : Edge from TopoDS;
472 aCurve : out Curve from Geom;
473 FirstPnt : out Pnt from gp;
474 LastPnt : out Pnt from gp)
475 ---Purpose: Used by 2d Relation only
476 -- Computes the 3d geometry of <anEdge> in the current WorkingPlane
477 -- and the extremities if any
479 returns Boolean from Standard;
481 ComputeGeometry(anEdge : Edge from TopoDS;
482 aCurve : out Curve from Geom;
483 FirstPnt : out Pnt from gp;
484 LastPnt : out Pnt from gp;
485 extCurve : out Curve from Geom;
486 isinfinite: out Boolean from Standard;
487 isOnPlane : out Boolean from Standard;
488 aPlane : Plane from Geom)
489 ---Purpose: Used by 2d Relation only
490 -- Computes the 3d geometry of <anEdge> in the current WorkingPlane
491 -- and the extremities if any.
492 -- If <aCurve> is not in the current plane, <extCurve> contains
493 -- the not projected curve associated to <anEdge>.
494 -- If <anEdge> is infinite, <isinfinite> = true and the 2
495 -- parameters <FirstPnt> and <LastPnt> have no signification.
497 returns Boolean from Standard;
499 ComputeGeometry (anEdge1 : Edge from TopoDS;
500 anEdge2 : Edge from TopoDS;
501 aCurve1 : out Curve from Geom;
502 aCurve2 : out Curve from Geom;
503 FirstPnt1 : out Pnt from gp;
504 LastPnt1 : out Pnt from gp;
505 FirstPnt2 : out Pnt from gp;
506 LastPnt2 : out Pnt from gp;
507 aPlane : Plane from Geom)
508 ---Purpose: Used by 2d Relation only
509 -- Computes the 3d geometry of <anEdge> in the current WorkingPlane
510 -- and the extremities if any
512 returns Boolean from Standard;
515 ComputeGeometry (anEdge1 : Edge from TopoDS;
516 anEdge2 : Edge from TopoDS;
517 indexExt : out Integer from Standard;
518 aCurve1 : out Curve from Geom;
519 aCurve2 : out Curve from Geom;
520 FirstPnt1 : out Pnt from gp;
521 LastPnt1 : out Pnt from gp;
522 FirstPnt2 : out Pnt from gp;
523 LastPnt2 : out Pnt from gp;
524 ExtCurve : out Curve from Geom;
525 isinfinite1 : out Boolean from Standard;
526 isinfinite2 : out Boolean from Standard;
527 aPlane : Plane from Geom)
529 ---Purpose: Used by 2d Relation only Computes the 3d geometry
530 -- of<anEdge1> and <anEdge2> in the current Plane and the
531 -- extremities if any. Return in ExtCurve the 3d curve
532 -- (not projected in the plane) of the first edge if
533 -- <indexExt> =1 or of the 2nd edge if <indexExt> = 2. If
534 -- <indexExt> = 0, ExtCurve is Null. if there is an edge
535 -- external to the plane, <isinfinite> is true if this
536 -- edge is infinite. So, the extremities of it are not
537 -- significant. Return TRUE if ok
538 returns Boolean from Standard;
540 ComputeGeomCurve (aCurve : in out Curve from Geom;
541 first1 : Real from Standard;
542 last1 : Real from Standard;
543 FirstPnt1 : out Pnt from gp;
544 LastPnt1 : out Pnt from gp;
545 aPlane : Plane from Geom;
546 isOnPlane: out Boolean from Standard)
548 ---Purpose: Checks if aCurve belongs to aPlane; if not, projects aCurve in aPlane
549 -- and returns aCurve;
551 returns Boolean from Standard;
553 ComputeGeometry(aVertex : Vertex from TopoDS;
554 point : out Pnt from gp;
555 aPlane : Plane from Geom;
556 isOnPlane: out Boolean from Standard)
557 returns Boolean from Standard;
560 GetPlaneFromFace( aFace : Face from TopoDS;
561 aPlane : out Pln from gp;
562 aSurf : out Surface from Geom;
563 aSurfType : out KindOfSurface from AIS;
564 Offset : out Real from Standard )
565 returns Boolean from Standard;
566 ---Purpose: Tryes to get Plane from Face. Returns Surface of Face
567 -- in aSurf. Returns Standard_True and Plane of Face in
568 -- aPlane in following cases:
569 -- Face is Plane, Offset of Plane,
570 -- Extrusion of Line and Offset of Extrusion of Line
571 -- Returns pure type of Surface which can be:
572 -- Plane, Cylinder, Cone, Sphere, Torus,
573 -- SurfaceOfRevolution, SurfaceOfExtrusion
575 InitFaceLength( aFace : Face from TopoDS;
576 aPlane : out Pln from gp;
577 aSurface : out Surface from Geom;
578 aSurfaceType : out KindOfSurface from AIS;
579 anOffset : out Real from Standard );
581 ComputeLengthBetweenPlanarFaces( FirstFace : Face from TopoDS;
582 SecondFace : Face from TopoDS;
583 Plane1 : Pln from gp;
584 Plane2 : Pln from gp;
585 Value : out Real from Standard;
586 FirstAttach : out Pnt from gp ;
587 SecondAttach : out Pnt from gp ;
588 DirAttach : out Dir from gp ;
589 AutomaticPos : Boolean from Standard;
590 Position : in out Pnt from gp);
592 ComputeLengthBetweenCurvilinearFaces( FirstFace : Face from TopoDS;
593 SecondFace : Face from TopoDS;
594 FirstSurf : in out Surface from Geom;
595 SecondSurf : in out Surface from Geom;
596 AutomaticPos : Boolean from Standard;
597 Value : out Real from Standard;
598 Position : out Pnt from gp;
599 FirstAttach : out Pnt from gp;
600 SecondAttach : out Pnt from gp;
601 DirAttach : out Dir from gp );
603 ComputeAngleBetweenPlanarFaces( FirstFace : Face from TopoDS;
604 SecondFace : Face from TopoDS;
605 Surf2 : Surface from Geom;
607 Value : Real from Standard;
608 AutomaticPos : Boolean from Standard;
609 Position : out Pnt from gp;
610 Center : out Pnt from gp;
611 FirstAttach : out Pnt from gp;
612 SecondAttach : out Pnt from gp;
613 FirstDir : out Dir from gp;
614 SecondDir : out Dir from gp);
615 ---Purpose: Computes geometric parameters for planar faces for
616 -- Angular dimensions
618 ComputeAngleBetweenCurvilinearFaces( FirstFace : Face from TopoDS;
619 SecondFace : Face from TopoDS;
620 FirstSurf : Surface from Geom;
621 SecondSurf : Surface from Geom;
622 FirstSurfType : KindOfSurface from AIS;
623 SecondSurfType : KindOfSurface from AIS;
625 Value : Real from Standard;
626 AutomaticPos : Boolean from Standard;
627 Position : out Pnt from gp;
628 Center : out Pnt from gp;
629 FirstAttach : out Pnt from gp;
630 SecondAttach : out Pnt from gp;
631 FirstDir : out Dir from gp;
632 SecondDir : out Dir from gp;
633 Plane : out Plane from Geom );
634 ---Purpose: Computes geometric parameters for curvilinear faces for
635 -- Angular dimensions
637 ProjectPointOnPlane( aPoint : Pnt from gp; aPlane : Pln from gp )
640 ProjectPointOnLine( aPoint : Pnt from gp; aLine : Lin from gp )
643 TranslatePointToBound( aPoint : Pnt from gp; aDir : Dir from gp; aBndBox: Box from Bnd )
646 InDomain( aFirstPar : Real from Standard;
647 aLastPar : Real from Standard;
648 anAttachPar : Real from Standard)
649 returns Boolean from Standard;
650 ---Purpose: returns True if point with anAttachPar is
653 NearestApex(elips : Elips from gp;
656 fpara : Real from Standard ;
657 lpara : Real from Standard ;
658 IsInDomain : out Boolean from Standard)
660 ---Purpose: computes nearest to ellipse arc apex
662 DistanceFromApex(elips : Elips from gp;
664 par : Real from Standard )
665 returns Real from Standard;
666 ---Purpose: computes length of ellipse arc in parametric units
669 ComputeProjEdgePresentation(aPres : mutable Presentation from Prs3d;
670 aDrawer : mutable Drawer from AIS;
671 anEdge : Edge from TopoDS;
672 ProjCurve: Curve from Geom;
673 FirstP : Pnt from gp;
675 aColor : NameOfColor from Quantity = Quantity_NOC_PURPLE;
676 aWidth : Real from Standard = 2;
677 aProjTOL : TypeOfLine from Aspect = Aspect_TOL_DASH;
678 aCallTOL : TypeOfLine from Aspect = Aspect_TOL_DOT);
680 ComputeProjVertexPresentation(aPres : mutable Presentation from Prs3d;
681 aDrawer : mutable Drawer from AIS;
682 aVertex : Vertex from TopoDS;
683 ProjPoint: Pnt from gp;
684 aColor : NameOfColor from Quantity = Quantity_NOC_PURPLE;
685 aWidth : Real from Standard = 2;
686 aProjTOM : TypeOfMarker from Aspect = Aspect_TOM_PLUS;
687 aCallTOL : TypeOfLine from Aspect = Aspect_TOL_DOT);