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