generalMeasureView.as 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. import com.adobe.ac.mxeffects.DistortionConstants;
  2. import com.adobe.ac.mxeffects.Flip;
  3. import com.imt.intimamedia.events.acquire.GetImagesEvent;
  4. import com.imt.intimamedia.events.acquire.GetMarkersEvent;
  5. import com.imt.intimamedia.events.measures.GetMeasuresEvent;
  6. import com.imt.intimamedia.events.measures.GetCTPAEvent;
  7. import com.imt.intimamedia.helpers.HelpUtils;
  8. import com.imt.intimamedia.model.ApplicationModelLocator;
  9. import com.imt.intimamedia.views.physician.acquire.LoadingPopUp;
  10. import com.imt.intimamedia.vo.DragAndDropVo;
  11. import com.imt.intimamedia.vo.MeasuresVo;
  12. import mx.collections.ArrayCollection;
  13. import mx.controls.Alert;
  14. import mx.controls.listClasses.TileListItemRenderer;
  15. import mx.managers.CursorManager;
  16. import mx.managers.PopUpManager;
  17. import mx.resources.ResourceManager;
  18. public var loadingPopUp : LoadingPopUp;
  19. private var _model : ApplicationModelLocator = ApplicationModelLocator.getInstance();
  20. public var collectionImagesCarotidLeft : ArrayCollection = new ArrayCollection();
  21. public var collectionImagesCarotidRight : ArrayCollection = new ArrayCollection();
  22. public var collectionImagesBody : ArrayCollection = new ArrayCollection();
  23. public var collectionImagesArmLeft : ArrayCollection = new ArrayCollection();
  24. public var collectionImagesArmRight : ArrayCollection = new ArrayCollection();
  25. public var collectionImagesLegLeft : ArrayCollection = new ArrayCollection();
  26. public var collectionImagesLegRight : ArrayCollection = new ArrayCollection();
  27. public var collectionDisplay : ArrayCollection = new ArrayCollection();
  28. public var collectionOfMarkers : ArrayCollection = new ArrayCollection();
  29. private var _measuresArray : ArrayCollection = new ArrayCollection();
  30. private var _zoneSelected : String = "";
  31. private function showView() : void
  32. {
  33. // to do : uncomment line below asap
  34. if ( _model.viewPatient /* && _model.measuresList.length == 0 */)
  35. {
  36. loadingPopUp = new LoadingPopUp();
  37. PopUpManager.addPopUp( loadingPopUp, this, true );
  38. PopUpManager.centerPopUp( loadingPopUp );
  39. loadingPopUp.title = ResourceManager.getInstance().getString('labels', 'acquire.loadingAcquisitionDownloadTitle')
  40. loadingPopUp.message = ResourceManager.getInstance().getString( 'labels', 'acquire.popUp.get.images' );
  41. loadingPopUp.progress.setProgress( 15, 100 );
  42. new GetImagesEvent( _model.appointmentSelected.id, this ).dispatch();
  43. }
  44. else
  45. {
  46. if (_model.currentThumbnailIndex <= 0)
  47. {
  48. measures.listImages.selectedIndex = 0;
  49. measures.imageSelection(_model.measuresList.getItemAt(0) as DragAndDropVo);
  50. }
  51. }
  52. // load help if needed
  53. if (ApplicationModelLocator.getInstance().connectedUser.help)
  54. {
  55. HelpUtils.loadHelp(HelpUtils.buildMeasuresHelpPages(), 0);
  56. }
  57. _zoneSelected = '';
  58. }
  59. public function getMeasuresArray () : ArrayCollection
  60. {
  61. return _measuresArray;
  62. }
  63. public function setMeasuresArray ( value : ArrayCollection ) : void
  64. {
  65. _measuresArray = value;
  66. }
  67. public function setImagesLoaded( type : String ) : void
  68. {
  69. this.loadingPopUp.closeHandler();
  70. var idsArray : Array = new Array;
  71. for each( var item : DragAndDropVo in _model.measuresList )
  72. {
  73. idsArray.push(item.id);
  74. }
  75. // get measures
  76. new GetMeasuresEvent(idsArray, this ).dispatch();
  77. // Alert.show("Appel de l'évenement GETCTPA " + _model.appointmentNumber.toString());
  78. // CJ 170915 : CTPA
  79. new GetCTPAEvent( _model.appointmentSelected.id, this).dispatch();
  80. }
  81. public function getMarkers( ) : void
  82. {
  83. _model.listMarkers.removeAll();
  84. new GetMarkersEvent( _model.appointmentSelected.id, this ).dispatch();
  85. }
  86. /***************************************/
  87. // be sure to remove scale cursor when exiting measure page
  88. private function exitView() : void
  89. {
  90. CursorManager.removeAllCursors();
  91. if (_zoneSelected == 'results')
  92. {
  93. _zoneSelected = '';
  94. flipToMeasures();
  95. }
  96. }
  97. public function setMeasures( list : Array ) : void
  98. {
  99. if (list)
  100. {
  101. _measuresArray.removeAll();
  102. for each( var measuresVo : MeasuresVo in list)
  103. _measuresArray.addItem(measuresVo);
  104. }
  105. displayFirstImage();
  106. }
  107. public function setCTPA( value : Number ) : void
  108. {
  109. _model.CTPA = value;
  110. // Alert.show("Passage dans (generalMeasureView) setCTPA : " + _model.CTPA.toString());
  111. }
  112. public function displayFirstImage() : void
  113. {
  114. if (_model.currentThumbnailIndex <= 0)
  115. {
  116. measures.listImages.selectedIndex = 0;
  117. measures.imageSelection(_model.measuresList.getItemAt(0) as DragAndDropVo);
  118. }
  119. }
  120. /**
  121. * Changement d'affichage
  122. */
  123. public function selectZone( zone : String ) : void
  124. {
  125. switch( zone )
  126. {
  127. case "results":
  128. flipToResults();
  129. _zoneSelected = zone;
  130. break;
  131. case "measures":
  132. flipToMeasures();
  133. break;
  134. }
  135. }
  136. /**
  137. * Affichage des mesures
  138. */
  139. private function flipToResults() : void
  140. {
  141. var flip : Flip = new Flip(measures);
  142. flip.siblings = [ results ];
  143. flip.direction = DistortionConstants.RIGHT;
  144. flip.duration = 750;
  145. flip.play();
  146. }
  147. /**
  148. * Affichage du tableau
  149. */
  150. private function flipToMeasures() : void
  151. {
  152. results.createCollection();
  153. var flip : Flip = new Flip(results);
  154. flip.siblings = [ measures ];
  155. flip.direction = DistortionConstants.LEFT;
  156. flip.duration = 750;
  157. flip.play();
  158. }