Test for 0022778: Bug in BRepMesh
[occt.git] / src / XSControl / XSControl_Controller.cxx
CommitLineData
b311480e 1// Copyright (c) 1999-2012 OPEN CASCADE SAS
2//
3// The content of this file is subject to the Open CASCADE Technology Public
4// License Version 6.5 (the "License"). You may not use the content of this file
5// except in compliance with the License. Please obtain a copy of the License
6// at http://www.opencascade.org and read it completely before using this file.
7//
8// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10//
11// The Original Code and all software distributed under the License is
12// distributed on an "AS IS" basis, without warranty of any kind, and the
13// Initial Developer hereby disclaims all such warranties, including without
14// limitation, any warranties of merchantability, fitness for a particular
15// purpose or non-infringement. Please see the License for the specific terms
16// and conditions governing the rights and limitations under the License.
17
7fd59977 18#include <XSControl_Controller.ixx>
19#include <IFSelect_GeneralModifier.hxx>
20#include <Dico_IteratorOfDictionaryOfTransient.hxx>
21#include <Dico_IteratorOfDictionaryOfInteger.hxx>
22#include <TColStd_IndexedMapOfTransient.hxx>
23#include <IFSelect_Option.hxx>
24
25#include <IFSelect_SelectModelEntities.hxx>
26#include <IFSelect_SelectModelRoots.hxx>
27#include <IFSelect_SelectPointed.hxx>
28#include <IFSelect_SelectSharing.hxx>
29#include <IFSelect_SelectShared.hxx>
30#include <IFSelect_GraphCounter.hxx>
31#include <XSControl_SelectForTransfer.hxx>
32#include <XSControl_ConnectedShapes.hxx>
33#include <XSControl_SignTransferStatus.hxx>
34#include <XSControl_TransferReader.hxx>
35#include <XSControl_WorkSession.hxx>
36
37#include <IFSelect_SignType.hxx>
38#include <IFSelect_SignCounter.hxx>
39#include <IFSelect_SignCategory.hxx>
40#include <IFSelect_SignValidity.hxx>
41#include <IFSelect_SignAncestor.hxx>
42
43#include <IFSelect_DispPerOne.hxx>
44#include <IFSelect_DispPerCount.hxx>
45#include <IFSelect_DispPerFiles.hxx>
46#include <IFSelect_DispPerSignature.hxx>
47#include <IFSelect_IntParam.hxx>
48
49// ParamEditor
50#include <TColStd_HSequenceOfHAsciiString.hxx>
51#include <Interface_Static.hxx>
52#include <IFSelect_ParamEditor.hxx>
53#include <IFSelect_EditForm.hxx>
54#include <IFSelect_SelectModelRoots.hxx>
55
56// Transferts
57#include <Transfer_Binder.hxx>
58#include <Transfer_SimpleBinderOfTransient.hxx>
59#include <Transfer_TransientMapper.hxx>
60#include <TransferBRep_ShapeMapper.hxx>
61
62#include <Standard_DomainError.hxx>
63#include <TCollection_HAsciiString.hxx>
64#include <Interface_Macros.hxx>
65#include <Message_Messenger.hxx>
66#include <Message.hxx>
67
68static Handle(Dico_DictionaryOfTransient)& listadapt()
69{
70 static Handle(Dico_DictionaryOfTransient) listad;
71 if (listad.IsNull()) listad = new Dico_DictionaryOfTransient;
72 return listad;
73}
74
75static TColStd_IndexedMapOfTransient& mapadapt()
76{
77 static TColStd_IndexedMapOfTransient mapad;
78 return mapad;
79}
80
81
82 XSControl_Controller::XSControl_Controller
83 (const Standard_CString longname, const Standard_CString shortname)
84 : theShortName (shortname) , theLongName (longname)
85{
86 theAdaptorApplied.Clear();
87 theAdaptorHooks = new TColStd_HSequenceOfHAsciiString();
88
89 // Parametres Standard
90
91 Interface_Static::Standards();
92// TraceStatic ("read.stdsameparameter.mode",5);
93 TraceStatic ("read.precision.mode" , 5);
94 TraceStatic ("read.precision.val" , 5);
95 TraceStatic ("write.precision.mode" , 6);
96 TraceStatic ("write.precision.val" , 6);
97
98 // Initialisation du Profile
99
100 theProfile = new IFSelect_Profile;
101
102/* essai option sur parametre
103 Handle(IFSelect_Option) optrdprec = new IFSelect_Option
104 (Interface_Static::Static ("read.precision.mode"),"readprecision.mode");
105 optrdprec->AddBasic("default","File");
106 optrdprec->AddBasic("Session");
107 optrdprec->Switch ("default");
108 theProfile->AddOption (optrdprec);
109*/
110
111// Handle(IFSelect_Option) optproto = new IFSelect_Option
112// (STANDARD_TYPE(Interface_Protocol),"protocol");
113// theProfile->AddOption (optproto);
114
115 Handle(IFSelect_Option) optsign = new IFSelect_Option
116 (STANDARD_TYPE(IFSelect_Signature),"sign-type");
117 optsign->Add ("default",theSignType);
118 theProfile->AddOption (optsign);
119
120// Handle(IFSelect_Option) optwlib = new IFSelect_Option
121// (STANDARD_TYPE(IFSelect_WorkLibrary),"access");
122// theProfile->AddOption (optwlib);
123
124 Handle(IFSelect_Option) optactrd = new IFSelect_Option
125 (STANDARD_TYPE(Transfer_ActorOfTransientProcess),"tr-read");
126 theProfile->AddOption (optactrd);
127
128 Handle(IFSelect_Option) optactwr = new IFSelect_Option
129 (STANDARD_TYPE(Transfer_ActorOfFinderProcess),"tr-write");
130 theProfile->AddOption (optactwr);
131
132// Definition de la config de base : suite a la customisation
133}
134
135 void XSControl_Controller::SetNames
136 (const Standard_CString longname, const Standard_CString shortname)
137{
138 if (longname && longname[0] != '\0') {
139 theLongName.Clear(); theLongName.AssignCat (longname);
140 }
141 if (shortname && shortname[0] != '\0') {
142 theShortName.Clear(); theShortName.AssignCat (shortname);
143 }
144}
145
146 void XSControl_Controller::AutoRecord () const
147{
148 Record (Name(Standard_True));
149 Record (Name(Standard_False));
150}
151
152 void XSControl_Controller::Record (const Standard_CString name) const
153{
154 Standard_Boolean deja;
155 Handle(Standard_Transient)& newadapt = listadapt()->NewItem (name,deja);
156 if (deja) {
157 Handle(Standard_Transient) thisadapt = this;
158 if (newadapt->IsKind(thisadapt->DynamicType()))
159 {
160 }
161 else if (thisadapt->IsKind(newadapt->DynamicType()))
162 {
163 newadapt = this;
164 if (mapadapt().FindIndex(newadapt) == 0) mapadapt().Add(newadapt);
165 }
166 else
167 if (thisadapt != newadapt) Standard_DomainError::Raise
168 ("XSControl_Controller : Record");
169 }
170 else {
171 newadapt = this;
172 if (mapadapt().FindIndex(newadapt) == 0) mapadapt().Add(newadapt);
173 }
174}
175
176 Handle(XSControl_Controller) XSControl_Controller::Recorded
177 (const Standard_CString name)
178{
179 Handle(XSControl_Controller) recorded;
180 if (!listadapt()->GetItem (name,recorded)) recorded.Nullify();
181 return recorded;
182}
183
184 Handle(TColStd_HSequenceOfHAsciiString) XSControl_Controller::ListRecorded
185 (const Standard_Integer mode)
186{
187 Handle(TColStd_HSequenceOfHAsciiString) list = new TColStd_HSequenceOfHAsciiString();
188 if (mode == 0) {
189 Dico_IteratorOfDictionaryOfTransient iter (listadapt());
190 for (; iter.More(); iter.Next()) {
191 Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString
192 (iter.Name());
193 list->Append(name);
194 }
195 } else {
196 Standard_Integer i, nb = mapadapt().Extent();
197 for (i = 1; i <= nb; i ++) {
198 DeclareAndCast(XSControl_Controller,ctl,mapadapt().FindKey(i));
199 if (ctl.IsNull()) continue;
200 Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString
201 (ctl->Name( (mode < 0) ));
202 list->Append(name);
203 }
204 }
205 return list;
206}
207
208 Standard_CString XSControl_Controller::Name (const Standard_Boolean rsc) const
209 { return (rsc ? theShortName.ToCString() : theLongName.ToCString()); }
210
211// #### PROFILE ####
212
213 Handle(IFSelect_Profile) XSControl_Controller::Profile () const
214 { return theProfile; }
215
216 void XSControl_Controller::DefineProfile
217 (const Standard_CString confname)
218{
219 if (!theProfile->HasConf(confname)) theProfile->AddConf (confname);
220 theProfile->SetFromCurrent (confname);
221}
222
223 Standard_Boolean XSControl_Controller::SetProfile
224 (const Standard_CString confname)
225{
226 if (!theProfile->SetCurrent (confname)) return Standard_False;
227
228// theProfile->Value("protocol",theAdaptorProtocol);
229 theProfile->Value("sign-type",theSignType);
230// theProfile->Value("access",theAdaptorLibrary);
231 theProfile->Value("tr-read",theAdaptorRead);
232 theProfile->Value("tr-write",theAdaptorWrite);
233
234 return SettingProfile (confname);
235}
236
237 Standard_Boolean XSControl_Controller::SettingProfile
238 (const Standard_CString )
239 { return Standard_True; }
240
241 Standard_Boolean XSControl_Controller::ApplyProfile
242 (const Handle(XSControl_WorkSession)& WS, const Standard_CString confname)
243{
244 if (!SetProfile (confname)) return Standard_False;
245
246// Typed Values : toutes
247
248 theProfile->SetTypedValues();
249
250// SignType
251 Handle(IFSelect_Signature) signtype;
252 theProfile->Value ("sign-type",signtype);
253 WS->SetSignType (signtype);
254
255// ActorRead
256
257 Handle(Transfer_ActorOfTransientProcess) actrd;
258 theProfile->Value ("tr-read",actrd);
259 WS->TransferReader()->SetActor (actrd);
260
261// ActorWrite : dans le Controller meme
262
263 Handle(Transfer_ActorOfFinderProcess) actwr;
264 theProfile->Value ("tr-write",actwr);
265 theAdaptorWrite = actwr;
266
267 return ApplyingProfile (WS,confname);
268}
269
270 Standard_Boolean XSControl_Controller::ApplyingProfile
271 (const Handle(XSControl_WorkSession)& , const Standard_CString )
272 { return Standard_True; }
273
274// #### DEFINITION ####
275
276 Handle(Interface_Protocol) XSControl_Controller::Protocol () const
277 { return theAdaptorProtocol; }
278
279 Handle(IFSelect_Signature) XSControl_Controller::SignType () const
280 { return theSignType; }
281
282 Handle(IFSelect_WorkLibrary) XSControl_Controller::WorkLibrary () const
283 { return theAdaptorLibrary; }
284
285 Handle(Transfer_ActorOfFinderProcess) XSControl_Controller::ActorWrite () const
286 { return theAdaptorWrite; }
287
288 void XSControl_Controller::UpdateStatics
289 (const Standard_Integer, const Standard_CString ) const
290 { } // a redefinir si besoin
291
292// ###########################
293// Help du Transfer : controle de valeur + help
294
295 void XSControl_Controller::SetModeWrite
296 (const Standard_Integer modemin, const Standard_Integer modemax,
297 const Standard_Boolean )
298{
299 if (modemin > modemax) { theModeWriteShapeN.Nullify(); return; }
300 theModeWriteShapeN = new Interface_HArray1OfHAsciiString (modemin,modemax);
301}
302
303 void XSControl_Controller::SetModeWriteHelp
304 (const Standard_Integer modetrans, const Standard_CString help,
305 const Standard_Boolean )
306{
307 if (theModeWriteShapeN.IsNull()) return;
308 if (modetrans < theModeWriteShapeN->Lower() ||
309 modetrans > theModeWriteShapeN->Upper()) return;
310 Handle(TCollection_HAsciiString) hl = new TCollection_HAsciiString (help);
311 theModeWriteShapeN->SetValue (modetrans,hl);
312}
313
314 Standard_Boolean XSControl_Controller::ModeWriteBounds
315 (Standard_Integer& modemin, Standard_Integer& modemax,
316 const Standard_Boolean ) const
317{
318 modemin = modemax = 0;
319 if (theModeWriteShapeN.IsNull()) return Standard_False;
320 modemin = theModeWriteShapeN->Lower();
321 modemax = theModeWriteShapeN->Upper();
322 return Standard_True;
323}
324
325 Standard_Boolean XSControl_Controller::IsModeWrite
326 (const Standard_Integer modetrans, const Standard_Boolean ) const
327{
328 if (theModeWriteShapeN.IsNull()) return Standard_True;
329 if (modetrans < theModeWriteShapeN->Lower()) return Standard_False;
330 if (modetrans > theModeWriteShapeN->Upper()) return Standard_False;
331 return Standard_True;
332}
333
334 Standard_CString XSControl_Controller::ModeWriteHelp
335 (const Standard_Integer modetrans, const Standard_Boolean ) const
336{
337 if (theModeWriteShapeN.IsNull()) return "";
338 if (modetrans < theModeWriteShapeN->Lower()) return "";
339 if (modetrans > theModeWriteShapeN->Upper()) return "";
340 Handle(TCollection_HAsciiString) str = theModeWriteShapeN->Value(modetrans);
341 if (str.IsNull()) return "";
342 return str->ToCString();
343}
344
345
346// ###########################
347// Transfer : on fait ce qu il faut par defaut (avec ActorWrite)
348// peut etre redefini ...
349
350 Standard_Boolean XSControl_Controller::RecognizeWriteTransient
351 (const Handle(Standard_Transient)& obj,
352 const Standard_Integer modetrans) const
353{
354 if (theAdaptorWrite.IsNull()) return Standard_False;
355 theAdaptorWrite->ModeTrans() = modetrans;
356 return theAdaptorWrite->Recognize (new Transfer_TransientMapper(obj));
357}
358
359// Fonction interne
360
361static IFSelect_ReturnStatus TransferFinder
362 (const Handle(Transfer_ActorOfFinderProcess)& actor,
363 const Handle(Transfer_Finder)& mapper,
364 const Handle(Transfer_FinderProcess)& FP,
365 const Handle(Interface_InterfaceModel)& model,
366 const Standard_Integer modetrans)
367{
368 if (actor.IsNull()) return IFSelect_RetError;
369 if (model.IsNull()) return IFSelect_RetError;
370 actor->ModeTrans() = modetrans;
371 FP->SetModel (model);
372 FP->SetActor (actor);
373 FP->Transfer (mapper);
374
375 IFSelect_ReturnStatus stat = IFSelect_RetFail;
376 Handle(Transfer_Binder) binder = FP->Find (mapper);
377 Handle(Transfer_SimpleBinderOfTransient) bindtr;
378 while (!binder.IsNull()) {
379 bindtr = Handle(Transfer_SimpleBinderOfTransient)::DownCast (binder);
380 if (!bindtr.IsNull()) {
381 Handle(Standard_Transient) ent = bindtr->Result();
382 if (!ent.IsNull()) {
383 stat = IFSelect_RetDone;
384 model->AddWithRefs (ent);
385 }
386 }
387 binder = binder->NextResult();
388 }
389 return stat;
390}
391
392
393 IFSelect_ReturnStatus XSControl_Controller::TransferWriteTransient
394 (const Handle(Standard_Transient)& obj,
395 const Handle(Transfer_FinderProcess)& FP,
396 const Handle(Interface_InterfaceModel)& model,
397 const Standard_Integer modetrans) const
398{
399 if (obj.IsNull()) return IFSelect_RetVoid;
400 return TransferFinder
401 (theAdaptorWrite,new Transfer_TransientMapper(obj), FP,model,modetrans);
402}
403
404 Standard_Boolean XSControl_Controller::RecognizeWriteShape
405 (const TopoDS_Shape& shape,
406 const Standard_Integer modetrans) const
407{
408 if (theAdaptorWrite.IsNull()) return Standard_False;
409 theAdaptorWrite->ModeTrans() = modetrans;
410 return theAdaptorWrite->Recognize (new TransferBRep_ShapeMapper(shape));
411}
412
413 IFSelect_ReturnStatus XSControl_Controller::TransferWriteShape
414 (const TopoDS_Shape& shape,
415 const Handle(Transfer_FinderProcess)& FP,
416 const Handle(Interface_InterfaceModel)& model,
417 const Standard_Integer modetrans) const
418{
419 if (shape.IsNull()) return IFSelect_RetVoid;
420
421 IFSelect_ReturnStatus theReturnStat = TransferFinder
422 (theAdaptorWrite,new TransferBRep_ShapeMapper(shape), FP,model,modetrans);
423 return theReturnStat;
424}
425
426// ###########################
427// File Cluster : quand un ensemble de donnees n est pas envoye d un coup mais
428// en plusieurs petits paquets ...
429// D abord, on detecte la chose et on prepare un contexte de resolution
430// specifique du cas a traiter. Null Handle si rien a faire (par defaut)
431// Ensuite on resoud
432// Les formules par defaut ne font rien (redefinissables)
433
434 Handle(Standard_Transient) XSControl_Controller::ClusterContext
435 (const Handle(XSControl_WorkSession)& ) const
436 { Handle(Standard_Transient) nulctx; return nulctx; }
437
438 Interface_CheckIterator XSControl_Controller::ResolveCluster
439 (const Handle(XSControl_WorkSession)& , const Handle(Standard_Transient)& ) const
440 { Interface_CheckIterator nulist; return nulist; }
441
442
443// ###########################
444// ControlItems : si ActorWrite etc... ne suffisent meme plus, on peut en
445// rajouter, Controller ne fait alors que les accueillir
446
447 void XSControl_Controller::AddControlItem
448 (const Handle(Standard_Transient)& item, const Standard_CString name)
449{
450 if (item.IsNull() || name[0] == '\0') return;
451 if (theItems.IsNull()) theItems = new Dico_DictionaryOfTransient;
452 theItems->SetItem (name,item);
453}
454
455 Handle(Standard_Transient) XSControl_Controller::ControlItem
456 (const Standard_CString name) const
457{
458 Handle(Standard_Transient) item;
459 if (theItems.IsNull()) return item;
460 theItems->GetItem (name,item);
461 return item;
462}
463
464// ###########################
465// Cutomisation ! On enregistre des Items pour une WorkSession
466// (annule et remplace)
467// Ensuite, on les remet en place a la demande
468
469 void XSControl_Controller::TraceStatic
470 (const Standard_CString name, const Standard_Integer use)
471{
472 Handle(Interface_Static) val = Interface_Static::Static(name);
473 if (val.IsNull()) return;
474 theParams.Append (val);
475 theParamUses.Append(use);
476}
477
478 void XSControl_Controller::AddSessionItem
479 (const Handle(Standard_Transient)& item, const Standard_CString name,
480 const Standard_CString setapplied)
481{
482 if (item.IsNull() || name[0] == '\0') return;
483 if (theAdaptorSession.IsNull()) theAdaptorSession =
484 new Dico_DictionaryOfTransient;
485 theAdaptorSession->SetItem (name,item);
486 if (!setapplied || setapplied[0] == '\0') return;
487 if (item->IsKind(STANDARD_TYPE(IFSelect_GeneralModifier))) {
488// cout<<" -- Xstep Controller : SetApplied n0."<<theAdaptorApplied.Length()+1
489// <<" Name:"<<name<<endl;
490 theAdaptorApplied.Append(item);
491 Handle(TCollection_HAsciiString) hook = new TCollection_HAsciiString(setapplied);
492 theAdaptorHooks->Append (hook);
493 }
494}
495
496 Handle(Standard_Transient) XSControl_Controller::SessionItem
497 (const Standard_CString name) const
498{
499 Handle(Standard_Transient) item;
500 if (theAdaptorSession.IsNull()) return item;
501 theAdaptorSession->GetItem (name,item);
502 return item;
503}
504
505 Standard_Boolean XSControl_Controller::IsApplied
506 (const Handle(Standard_Transient)& item) const
507{
508 if (item.IsNull()) return Standard_False;
509 for (Standard_Integer i = theAdaptorApplied.Length(); i >= 1; i --)
510 if (item == theAdaptorApplied.Value(i)) return Standard_True;
511 return Standard_False;
512}
513
514 void XSControl_Controller::Customise
515 ( Handle(XSControl_WorkSession)& WS)
516{
517 WS->SetParams (theParams,theParamUses);
518
519
520// General
521 if(!theAdaptorSession.IsNull()) {
522 Dico_IteratorOfDictionaryOfTransient iter(theAdaptorSession);
523 for (iter.Start(); iter.More(); iter.Next()) {
524 WS->AddNamedItem (iter.Name().ToCString() , iter.Value());
525 }
526 }
527 Customising(WS);
528// Applied Modifiers
529 Standard_Integer i, nb = theAdaptorApplied.Length();
530 for (i = 1; i <= nb; i ++) {
531 Handle(Standard_Transient) anitem = theAdaptorApplied.Value(i);
532 Handle(TCollection_HAsciiString) name = WS->Name(anitem);
533// Handle(Message_Messenger) sout = Message::DefaultMessenger();
534// sout<<" -- Customise applied n0."<<i<<" type:"<<anitem->DynamicType()->Name();
535// if (name.IsNull()) sout<<" no name"<<endl;
536// else sout<<" name:"<<name->ToCString()<<endl;
537 WS->SetAppliedModifier
538 (GetCasted(IFSelect_GeneralModifier,theAdaptorApplied.Value(i)),
539 WS->ShareOut() );
540 }
541
542// Editeurs de Parametres
543// Ici car les constructeurs specifiques des controlleurs ont pu creer des
544// Parametres : attendre donc ici
545
546 Handle(TColStd_HSequenceOfHAsciiString) listat = Interface_Static::Items();
547 Handle(IFSelect_ParamEditor) paramed =
548 IFSelect_ParamEditor::StaticEditor (listat,"All Static Parameters");
549 WS->AddNamedItem ("xst-static-params-edit",paramed);
550 Handle(IFSelect_EditForm) paramform = paramed->Form(Standard_False);
551 WS->AddNamedItem ("xst-static-params",paramform);
552
553// Norm Specific
554 //Customising (WS);
555
556// Loading Options of the Profile
557
558// Available Signatures
559 Handle(IFSelect_Option) optsign = theProfile->Option ("sign-type");
560// Handle(TColStd_HSequenceOfHAsciiString) signs =
561// WS->ItemNames (STANDARD_TYPE(IFSelect_Signature));
562// Standard_Integer isign, nbsign = (signs.IsNull() ? 0 : signs->Length());
563// for (isign = 1; isign <= nbsign; isign ++) {
564// Handle(TCollection_HAsciiString) signame = signs->Value(isign);
565// Handle(Standard_Transient) asign = WS->NamedItem (signame);
566// optsign->Add (signame->ToCString(),asign);
567// }
568 optsign->Add ("default",theSignType); // defaut specifique
569 optsign->Switch ("default"); // garder courante la definition par defaut !
570
571// Actor Read
572 Handle(IFSelect_Option) optacrd = theProfile->Option ("tr-read");
573 optacrd->Add ("default",theAdaptorRead);
574 optacrd->Switch ("default");
575
576// Actor Write
577 Handle(IFSelect_Option) optacwr = theProfile->Option ("tr-write");
578 optacwr->Add ("default",theAdaptorWrite);
579 optacwr->Switch ("default");
580
581// Basic configuration
582
583 theProfile->AddConf ("Base");
584 theProfile->AddSwitch ("Base","sign-type","default");
585 theProfile->AddSwitch ("Base","tr-read","default");
586 theProfile->AddSwitch ("Base","tr-write","default");
587 theProfile->SetCurrent ("Base");
588}
589
590 void XSControl_Controller::Customising
591 ( Handle(XSControl_WorkSession)& WS)
592{
593 //ndle(IFSelect_SelectModelRoots) slr = new IFSelect_SelectModelRoots;
594 ///WS->AddNamedItem ("xst-model-roots",slr);
595 if(!WS->NamedItem("xst-model-all").IsNull()) return;
596 Handle(IFSelect_SelectModelEntities) sle = new IFSelect_SelectModelEntities;
597 WS->AddNamedItem ("xst-model-all",sle);
598 Handle(IFSelect_SelectModelRoots) slr;
599 slr = new IFSelect_SelectModelRoots;
600 WS->AddNamedItem ("xst-model-roots",slr);
601 if(strcasecmp(WS->SelectedNorm(),"STEP")) {
602 Handle(XSControl_SelectForTransfer) st1 = new XSControl_SelectForTransfer;
603 st1->SetInput (slr);
604 st1->SetReader (WS->TransferReader());
605 WS->AddNamedItem ("xst-transferrable-roots",st1);
606
607 }
608 //else slr = Handle(IFSelect_SelectModelRoots)::DownCast(WS->NamedItem("xst-model-roots"));
609 Handle(XSControl_SelectForTransfer) st2 = new XSControl_SelectForTransfer;
610 st2->SetInput (sle);
611 st2->SetReader (WS->TransferReader());
612 WS->AddNamedItem ("xst-transferrable-all",st2);
613
614 Handle(XSControl_SignTransferStatus) strs = new XSControl_SignTransferStatus;
615 strs->SetReader (WS->TransferReader());
616 WS->AddNamedItem ("xst-transfer-status",strs);
617
618 Handle(XSControl_ConnectedShapes) scs = new XSControl_ConnectedShapes;
619 scs->SetReader (WS->TransferReader());
620 WS->AddNamedItem ("xst-connected-faces",scs);
621
622 Handle(IFSelect_SignType) stp = new IFSelect_SignType (Standard_False);
623 WS->AddNamedItem ("xst-long-type",stp);
624 Handle(IFSelect_SignType) stc = new IFSelect_SignType (Standard_True);
625 WS->AddNamedItem ("xst-type",stc);
626 Handle(IFSelect_SignAncestor) sta = new IFSelect_SignAncestor;
627 WS->AddNamedItem ("xst-ancestor-type",sta);
628 Handle(IFSelect_SignCounter) tc1 =
629 new IFSelect_SignCounter(stp,Standard_False,Standard_True);
630 WS->AddNamedItem ("xst-types",tc1);
631 Handle(IFSelect_SignCategory) sca = new IFSelect_SignCategory;
632 WS->AddNamedItem ("xst-category",sca);
633 Handle(IFSelect_SignValidity) sva = new IFSelect_SignValidity;
634 WS->AddNamedItem ("xst-validity",sva);
635
636 Handle(IFSelect_DispPerOne) dispone = new IFSelect_DispPerOne;
637 dispone->SetFinalSelection(slr);
638 WS->AddNamedItem ("xst-disp-one",dispone);
639 Handle(IFSelect_DispPerCount) dispcount = new IFSelect_DispPerCount;
640 Handle(IFSelect_IntParam) intcount = new IFSelect_IntParam;
641 intcount->SetValue(5);
642 dispcount->SetCount(intcount);
643 dispcount->SetFinalSelection(slr);
644 WS->AddNamedItem ("xst-disp-count",dispcount);
645 Handle(IFSelect_DispPerFiles) dispfiles = new IFSelect_DispPerFiles;
646 Handle(IFSelect_IntParam) intfiles = new IFSelect_IntParam;
647 intfiles->SetValue(10);
648 dispfiles->SetCount(intfiles);
649 dispfiles->SetFinalSelection(slr);
650 WS->AddNamedItem ("xst-disp-files",dispfiles);
651 Handle(IFSelect_DispPerSignature) dispsign = new IFSelect_DispPerSignature;
652 dispsign->SetSignCounter(new IFSelect_SignCounter(stc));
653 dispsign->SetFinalSelection(slr);
654 WS->AddNamedItem ("xst-disp-sign",dispsign);
655
656// Pas utilisables directement mais bien utiles quand meme
657 WS->AddNamedItem ("xst-pointed",new IFSelect_SelectPointed);
658 WS->AddNamedItem ("xst-sharing",new IFSelect_SelectSharing);
659 WS->AddNamedItem ("xst-shared",new IFSelect_SelectShared);
660 WS->AddNamedItem ("xst-nb-selected",new IFSelect_GraphCounter);
661 theSignType = stp;
662 // au moins cela
663}
664 Handle(Dico_DictionaryOfTransient) XSControl_Controller::AdaptorSession() const
665{
666 return theAdaptorSession;
667}