| 1 | -- Created on: 1994-05-30 |
| 2 | -- Created by: Christian CAILLET |
| 3 | -- Copyright (c) 1994-1999 Matra Datavision |
| 4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
| 5 | -- |
| 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. |
| 10 | -- |
| 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. |
| 13 | -- |
| 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. |
| 20 | |
| 21 | |
| 22 | |
| 23 | class SelectPointed from IFSelect inherits SelectBase |
| 24 | |
| 25 | ---Purpose : This type of Selection is intended to describe a direct |
| 26 | -- selection without an explicit criterium, for instance the |
| 27 | -- result of picking viewed entities on a graphic screen |
| 28 | -- |
| 29 | -- It can also be used to provide a list as internal alternate |
| 30 | -- input : this use implies to clear the list once queried |
| 31 | |
| 32 | uses AsciiString from TCollection, SequenceOfTransient, HSequenceOfTransient, |
| 33 | EntityIterator, Graph, CopyControl, |
| 34 | Transformer |
| 35 | |
| 36 | raises InterfaceError |
| 37 | |
| 38 | is |
| 39 | |
| 40 | Create returns mutable SelectPointed; |
| 41 | ---Purpose : Creates a SelectPointed |
| 42 | |
| 43 | Clear (me : mutable); |
| 44 | ---Purpose : Clears the list of selected items |
| 45 | -- Also says the list is unset |
| 46 | -- All Add* methods and SetList say the list is set |
| 47 | |
| 48 | IsSet (me) returns Boolean; |
| 49 | ---Purpose : Tells if the list has been set. Even if empty |
| 50 | |
| 51 | SetEntity (me : mutable; item : any Transient); |
| 52 | ---Purpose : As SetList but with only one entity |
| 53 | -- If <ent> is Null, the list is said as being set but is empty |
| 54 | |
| 55 | SetList (me : mutable; list : HSequenceOfTransient); |
| 56 | ---Purpose : Sets a given list to define the list of selected items |
| 57 | -- <list> can be empty or null : in this case, the list is said |
| 58 | -- as being set, but it is empty |
| 59 | -- |
| 60 | -- To use it as an alternate input, one shot : |
| 61 | -- - SetList or SetEntity to define the input list |
| 62 | -- - RootResult to get it |
| 63 | -- - then Clear to drop it |
| 64 | |
| 65 | Add (me : mutable; item : any Transient) returns Boolean; |
| 66 | ---Purpose : Adds an item. Returns True if Done, False if <item> is already |
| 67 | -- in the selected list |
| 68 | |
| 69 | Remove (me : mutable; item : any Transient) returns Boolean; |
| 70 | ---Purpose : Removes an item. Returns True if Done, False if <item> was not |
| 71 | -- in the selected list |
| 72 | |
| 73 | Toggle (me : mutable; item : any Transient) returns Boolean; |
| 74 | ---Purpose : Toggles status of an item : adds it if not pointed or removes |
| 75 | -- it if already pointed. Returns the new status (Pointed or not) |
| 76 | |
| 77 | AddList (me : mutable; list : HSequenceOfTransient) returns Boolean; |
| 78 | ---Purpose : Adds all the items defined in a list. Returns True if at least |
| 79 | -- one item has been added, False else |
| 80 | |
| 81 | RemoveList (me : mutable; list : HSequenceOfTransient) returns Boolean; |
| 82 | ---Purpose : Removes all the items defined in a list. Returns True if at |
| 83 | -- least one item has been removed, False else |
| 84 | |
| 85 | ToggleList (me : mutable; list : HSequenceOfTransient) returns Boolean; |
| 86 | ---Purpose : Toggles status of all the items defined in a list : adds it if |
| 87 | -- not pointed or removes it if already pointed. |
| 88 | |
| 89 | Rank (me; item : any Transient) returns Integer; |
| 90 | ---Purpose : Returns the rank of an item in the selected list, or 0. |
| 91 | |
| 92 | NbItems (me) returns Integer; |
| 93 | ---Purpose : Returns the count of selected items |
| 94 | |
| 95 | Item (me; num : Integer) returns any Transient; |
| 96 | ---Purpose : Returns an item given its rank, or a Null Handle |
| 97 | |
| 98 | Update (me : mutable; control : CopyControl); |
| 99 | ---Purpose : Rebuilds the selected list. Any selected entity which has a |
| 100 | -- bound result is replaced by this result, else it is removed. |
| 101 | |
| 102 | Update (me : mutable; trf : Transformer); |
| 103 | ---Purpose : Rebuilds the selected list, by querying a Transformer |
| 104 | -- (same principle as from a CopyControl) |
| 105 | |
| 106 | -- Services to provide -- |
| 107 | |
| 108 | RootResult (me; G : Graph) returns EntityIterator |
| 109 | raises InterfaceError; |
| 110 | ---Purpose : Returns the list of selected items. Only the selected entities |
| 111 | -- which are present in the graph are given (this result assures |
| 112 | -- uniqueness). |
| 113 | |
| 114 | Label (me) returns AsciiString from TCollection; |
| 115 | ---Purpose : Returns a text which identifies the type of selection made. |
| 116 | -- It is "Pointed Entities" |
| 117 | |
| 118 | fields |
| 119 | |
| 120 | theset : Boolean; |
| 121 | theitems : SequenceOfTransient; |
| 122 | |
| 123 | end SelectPointed; |