| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859 |
- import com.adobe.ac.mxeffects.DistortionConstants;
- import com.adobe.ac.mxeffects.Flip;
- import com.imt.flex.cairngormExtended.event.ChainEvent;
- import com.imt.flex.cairngormExtended.event.EventChainFactory;
- import com.imt.intimamedia.events.acquire.DeleteImagesEvent;
- import com.imt.intimamedia.events.acquire.DeleteMarkersEvent;
- import com.imt.intimamedia.events.acquire.GetImagesEvent;
- import com.imt.intimamedia.events.acquire.GetMarkersEvent;
- import com.imt.intimamedia.events.acquire.GetTypeFromLocationEvent;
- import com.imt.intimamedia.events.acquire.SaveImageEvent;
- import com.imt.intimamedia.events.acquire.SaveMarkerEvent;
- import com.imt.intimamedia.events.patient.UpdateAppointmentEvent;
- import com.imt.intimamedia.helpers.FlashHelper;
- import com.imt.intimamedia.helpers.HelpUtils;
- import com.imt.intimamedia.helpers.ImageCJ;
- import com.imt.intimamedia.helpers.Measure;
- import com.imt.intimamedia.model.ApplicationModelLocator;
- import com.imt.intimamedia.views.common.ImtToaster;
- import com.imt.intimamedia.views.common.ShowProgress;
- import com.imt.intimamedia.views.menus.PhysicianMenu;
- import com.imt.intimamedia.views.physician.acquire.IncidencePopUp;
- import com.imt.intimamedia.views.physician.acquire.LoadingPopUp;
- import com.imt.intimamedia.views.physician.measure.MeasureView;
- import com.imt.intimamedia.views.physician.patient.PatientFile;
- import com.imt.intimamedia.vo.DragAndDropVo;
- import com.imt.intimamedia.vo.MarkerVo;
- import com.imt.intimamedia.vo.ScaleCjVo;
- import com.imt.intimamedia.vo.ScaleVo;
- import flash.display.Bitmap;
- import flash.display.BitmapData;
- import flash.display.Loader;
- import flash.events.Event;
- import flash.events.IEventDispatcher;
- import flash.events.KeyboardEvent;
- import flash.events.MouseEvent;
- import flash.events.ProgressEvent;
- import flash.events.TimerEvent;
- import flash.geom.Matrix;
- import flash.geom.Rectangle;
- import flash.media.Camera;
- import flash.net.FileFilter;
- import flash.net.FileReference;
- import flash.net.URLRequest;
- import flash.net.URLRequestMethod;
- import flash.net.URLVariables;
- import flash.system.Security;
- import flash.system.SecurityPanel;
- import flash.system.System;
- import flash.utils.Timer;
- import mx.collections.ArrayCollection;
- import mx.containers.Canvas;
- import mx.containers.HBox;
- import mx.controls.Alert;
- import mx.controls.Button;
- import mx.controls.HSlider;
- import mx.controls.Image;
- import mx.controls.ProgressBar;
- import mx.controls.SWFLoader;
- import mx.controls.TileList;
- import mx.core.Application;
- import mx.core.DragSource;
- import mx.events.DragEvent;
- import mx.events.EffectEvent;
- import mx.events.ResizeEvent;
- import mx.managers.CursorManager;
- import mx.managers.DragManager;
- import mx.managers.PopUpManager;
- import mx.resources.ResourceManager;
- import mx.rpc.events.FaultEvent;
- import mx.rpc.events.ResultEvent;
- import mx.rpc.http.HTTPService;
- import mx.utils.ObjectUtil;
- import org.rockholla.controls.panzoom.PanZoomComponent;
- /**
- * Référence sur le modèle
- */
- [Bindable]
- private var _model : ApplicationModelLocator = ApplicationModelLocator.getInstance();
- /**
- * Liste des constantes de glisser/déplacer
- */
- private const SNAPSHOT : String = "snapshot";
- private const LIST_LEFT : String = "listLeft";
- private const LIST_RIGHT : String = "listRight";
- private const BODY : String = "body";
- public const CAROTID_RIGHT : String = "carotidRight";
- public const CAROTID_LEFT : String = "carotidLeft";
- public const BODY_AORTE : String = "body";
- public const ARM_RIGHT : String = "armRight";
- public const ARM_LEFT : String = "armLeft";
- public const LEG_RIGHT : String = "legRight";
- public const LEG_LEFT : String = "legLeft";
- public const SWF_STENOSE : String = "stenose";
- public const SWF_PLAQUE : String = "plaque";
- public const SWF_OCCLUSION : String = "occlusion";
- /**
- * Liste des constantes de zoom
- */
- public static const MAX_ZOOM:Number = 2;
- public static const MIN_ZOOM:Number = 1;
- /**
- * Liste des curseurs
- */
- [Embed(source="images/acquire/plaque.png")]
- public var plaque : Class;
- [Embed(source="images/acquire/stenose.png")]
- public var stenose : Class;
- [Embed(source="images/acquire/occlusion.png")]
- public var occlusion : Class;
- /**
- * Liste des collections des miniatures de stockage
- */
- [Bindable]
- public var collectionImagesCarotidLeft : ArrayCollection = new ArrayCollection();
- [Bindable]
- public var collectionImagesCarotidRight : ArrayCollection = new ArrayCollection();
- [Bindable]
- public var collectionImagesBody : ArrayCollection = new ArrayCollection();
- [Bindable]
- public var collectionImagesArmLeft : ArrayCollection = new ArrayCollection();
- [Bindable]
- public var collectionImagesArmRight : ArrayCollection = new ArrayCollection();
- [Bindable]
- public var collectionImagesLegLeft : ArrayCollection = new ArrayCollection();
- [Bindable]
- public var collectionImagesLegRight : ArrayCollection = new ArrayCollection();
- [Bindable]
- public var collectionDisplay : ArrayCollection = new ArrayCollection();
- [Bindable]
- public var collectionOfMarkers : ArrayCollection = new ArrayCollection();
- /**
- * Information sur le côté qui est affiché dans les miniatures sous les SWF
- */
- public var sideDisplay : String;
- /**
- * Elément en cours de déplacement
- */
- public var currentDragAndDropObject : DragAndDropVo;
- /**
- * Références sur les SWF
- */
- public var carotidLeftSWF : *;
- public var carotidRightSWF : *;
- public var bodySWF : *;
- public var armLeftSWF : *;
- public var armRightSWF : *;
- public var legLeftSWF : *;
- public var legRightSWF : *;
- /**
- * Variables locales au composant
- */
- [Bindable]
- private var _man : Boolean = true;
- [Bindable]
- private var _carotids : Boolean = false;
- [Bindable]
- private var _arms : Boolean = false;
- [Bindable]
- private var _body : Boolean = false;
- [Bindable]
- private var _legs : Boolean = false;
- private var _webcam : Camera = null;
- [Bindable]
- private var _webcamMaxHeight : int = 0;
- [Bindable]
- private var _webcamMaxWidth : int = 0;
- private var _imagesFilter : FileFilter = new FileFilter("Images","*.jpg;*.jpeg;*.png;*.dcm;*.dcim");
- private var _fileReference : FileReference = new FileReference();
- private var _rollOverElement : *;
- private var _cursorID : Number = 0;
- private var _cursor : Class = null;
- private var _typeCursor : String = null;
- private var _offset : int = -7;
- private var _canvasActive : Canvas = null;
- private var _boxActive : Canvas = null;
- public var list : Array = new Array();
- private var _timer : Timer;
- private var _appointmentId : int = 0;
- private var _cameraSelected : Boolean = true;
- [Bindable]
- private var _flowChoice : Boolean = false;
- private var _imagesLoaded : Boolean = false;
- [Bindable]
- private var _twoSideSelected : Boolean = true;
- // used if "saveImage" failed to know on which collectionImagesXX do a removeItem
- private var _lastAddedImgCollection : String;
- public var isDicomImg : Boolean = false;
- public var dicomScale : Number;
- private var dicomProgressPopup : ShowProgress;
- /**
- * Fenêtre d'information lors de la sauvegardes des acquisitions
- */
- public var loadingPopUp : LoadingPopUp;
- /**
- * Fonction activée à l'affichage de la vue permettant de récupérer les images
- */
- private function showView() : void
- {
- _model.acquireViewLoaded = true;
-
- if( _appointmentId != _model.appointmentSelected.id )
- _appointmentId = _model.appointmentSelected.id;
-
- _model.application.menuPhysician.patient.patientFile.updateAppointment();
-
- if (_model.viewPatient)
- {
- if (!_imagesLoaded)
- {
- this.loadingPopUp = new LoadingPopUp();
-
- PopUpManager.addPopUp( this.loadingPopUp, this, true );
- PopUpManager.centerPopUp( this.loadingPopUp );
-
- this.loadingPopUp.title = ResourceManager.getInstance().getString('labels', 'acquire.loadingAcquisitionDownloadTitle')
- this.loadingPopUp.message = ResourceManager.getInstance().getString( 'labels', 'acquire.popUp.get.images' );
- this.loadingPopUp.progress.setProgress( 15, 100 );
-
- new GetImagesEvent( _model.appointmentSelected.id, this ).dispatch();
- }
-
- var isCameraSelected : Boolean = _cameraSelected;
- viewBrowse();
- _cameraSelected = isCameraSelected;
- }
- else
- {
- if (_cameraSelected)
- viewCamera();
- }
-
- this.setFocus();
- this.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
- }
- private function loadFirstImage(dragAndDropVo : DragAndDropVo) : void
- {
- var bitmapData : BitmapData = new BitmapData(dragAndDropVo.imageHigh.width,dragAndDropVo.imageHigh.height);
-
- bitmapData.draw(dragAndDropVo.imageHigh,new Matrix());
- var bitmap : Bitmap = new Bitmap(bitmapData);
-
- snapshotImage.maintainAspectRatio = true;
- snapshotImage.visible = true;
- snapshotImage.source = bitmap;
- }
- /**
- * Fonction permettant de préparer la récupération des marqueurs
- */
- public function getMarkers() : void
- {
- this.loadingPopUp.action.visible = true;
- this.loadingPopUp.message = ResourceManager.getInstance().getString( 'labels', 'acquire.popUp.get.markers' );
- this.loadingPopUp.progress.setProgress( 80, 100 );
-
- _timer = new Timer( 500, 1 )
-
- _timer.addEventListener( TimerEvent.TIMER_COMPLETE, getMarkersEvent );
- _timer.start();
- }
- /**
- * Fonction permettant de récupérer les marqueurs
- */
- private function getMarkersEvent( event : TimerEvent ) : void
- {
- _timer.removeEventListener( TimerEvent.TIMER_COMPLETE, getMarkersEvent );
-
- new GetMarkersEvent( _model.appointmentSelected.id, this ).dispatch();
- }
- /**
- * Changement du slider
- */
- private function sliderChanged( slider : HSlider , zoom : PanZoomComponent ) : void
- {
- zoom.zoom( slider.value / 100 );
- }
- /**
- * Changement du zoom
- */
- private function zoomChanged( slider : HSlider , zoom : PanZoomComponent ) : void
- {
- if( slider.value/100 != zoom.scale )
- {
- slider.value = zoom.scale * 100;
- }
- }
- /**
- * Création de la vue
- */
- private function creationCompleteHandler() : void
- {
- acquireImageSelectionHelp.source = 'images/help/' + ResourceManager.getInstance().getString('labels', 'lang') + '/acquireArterySelection.png';
- acquireGlobalProcessHelp.source = 'images/help/' + ResourceManager.getInstance().getString('labels', 'lang') + '/acquireGlobalProcess.png';
- acquireAcquisitionHelp.source = 'images/help/' + ResourceManager.getInstance().getString('labels', 'lang') + '/acquireAcquisition.png';
- acquireAffectationHelp.source = 'images/help/' + ResourceManager.getInstance().getString('labels', 'lang') + '/acquireAffectation.png';
- acquireThumbnailHelp.source = 'images/help/' + ResourceManager.getInstance().getString('labels', 'lang') + '/acquireThumbnail.png';
- acquireLesionsHelp.source = 'images/help/' + ResourceManager.getInstance().getString('labels', 'lang') + '/acquireLesions.png';
-
- launchVideoStream();
- configureListeners( _fileReference );
- }
- private function keyHandler( event : KeyboardEvent ) : void
- {
- if (event.charCode == 32)
- togglePlaySnapshot();
-
- else if (event.charCode == 83 || event.charCode == 115)
- changeSecurity();
- }
- private function resetLists() : void
- {
- _carotids = false;
- _arms = false;
- _legs = false;
- _body = false;
- }
- /**
- * Passage à la vue des carotides
- */
- private function flipToCarotids() : void
- {
- _boxActive = carotids;
-
- resetLists();
- _carotids = true;
-
- var flip : Flip = new Flip(human);
- flip.siblings = [ carotids ];
- flip.direction = DistortionConstants.RIGHT;
- flip.duration = 750;
-
- flip.addEventListener( EffectEvent.EFFECT_END, hideMan );
-
- flip.play();
- }
- /**
- * Passage à la vue du tronc
- */
- private function flipToBody() : void
- {
- _boxActive = body;
-
- resetLists();
- _body = true;
- var flip : Flip = new Flip(human);
- flip.siblings = [ body ];
- flip.direction = DistortionConstants.RIGHT;
- flip.duration = 750;
-
- flip.addEventListener( EffectEvent.EFFECT_END, hideMan );
-
- flip.play();
- }
- /**
- * Passage à la vue des jambes
- */
- private function flipToLegs() : void
- {
- _boxActive = legs;
-
- resetLists();
- _legs = true;
- var flip : Flip = new Flip(human);
- flip.siblings = [ legs ];
- flip.direction = DistortionConstants.RIGHT;
- flip.duration = 750;
-
- flip.addEventListener( EffectEvent.EFFECT_END, hideMan );
-
- flip.play();
- }
- /**
- * Passage à la vue des bras
- */
- private function flipToArms() : void
- {
- _boxActive = arms;
-
- resetLists();
- _arms = true;
-
- var flip : Flip = new Flip(human);
- flip.siblings = [ arms ];
- flip.direction = DistortionConstants.RIGHT;
- flip.duration = 750;
-
- flip.addEventListener( EffectEvent.EFFECT_END, hideMan );
-
- flip.play();
- }
- /**
- * Passage à la vue de la silhouette
- */
- private function flipToHuman() : void
- {
- var flip : Flip = new Flip(_boxActive);
- flip.siblings = [ human ];
- flip.direction = DistortionConstants.LEFT;
- flip.duration = 750;
-
- flip.addEventListener( EffectEvent.EFFECT_END, showMan );
-
- flip.play();
- }
- /**
- * Masquer la silhouette (fin d'événement)
- */
- private function hideMan( event : EffectEvent ) : void
- {
- _man = false;
-
- // load help if needed
- if (ApplicationModelLocator.getInstance().connectedUser.help)
- {
- HelpUtils.loadHelp(HelpUtils.buildAcquireHelpPages(), 0);
- }
- }
- /**
- * Afficher la silhouette (fin d'événement)
- */
- private function showMan( event : EffectEvent ) : void
- {
- _man = true;
-
- collectionDisplay.removeAll();
- }
- /**
- * Activation du champ parcourir sur le disque
- */
- private function viewBrowse() : void
- {
- snapshotVideo.removeEventListener( MouseEvent.MOUSE_DOWN, beginDragFromVideoOrBrowse );
- snapshotImage.addEventListener( MouseEvent.MOUSE_DOWN, beginDragFromVideoOrBrowse );
- cameraViews.selectedIndex = 1;
- _cameraSelected = false;
- _flowChoice = true;
-
- if (!_model.viewPatient)
- browse();
- }
- /**
- * Activation du flux vidéo
- */
- private function viewCamera() : void
- {
- snapshotVideo.addEventListener( MouseEvent.MOUSE_DOWN, beginDragFromVideoOrBrowse );
- snapshotImage.removeEventListener( MouseEvent.MOUSE_DOWN, beginDragFromVideoOrBrowse );
- cameraViews.selectedIndex = 0;
- _cameraSelected = true;
- _flowChoice = true;
- //flowChoice.includeInLayout = false;
- //flowChoice.visible = false;
- }
- /**
- * Lancement du flux vidéo
- */
- public function launchVideoStream() : void
- {
- try {
- _webcam = Camera.getCamera();
- _webcam.setQuality(0, 100);
- //_webcam.setMode(10240, 7680, 30, true);
- _webcam.setMode(640, 480, 25, true);
-
- _webcamMaxWidth = _webcam.width;
- _webcamMaxHeight = _webcam.height;
- video.attachCamera( _webcam );
- videoHD.attachCamera( _webcam );
- }
- catch ( error : * ) {
- var toastMessage : ImtToaster = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'error.camera.title');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'error.camera');
- toastMessage.level = ImtToaster.ERROR;
-
- _model.toaster.toast( toastMessage );
- return;
- }
- }
- /**
- * Lancement de source vidéo
- */
- private function changeCamera() : void
- {
- Security.showSettings(SecurityPanel.CAMERA);
- launchVideoStream();
- }
- /**
- * Affichage du paramètrage de la sécurité
- */
- private function changeSecurity() : void
- {
- Security.showSettings(SecurityPanel.PRIVACY);
- }
- /**
- * Réalisation d'une capture d'écran de la vidéo
- */
- private function snapshot() : void
- {
- var bitmapData : BitmapData = new BitmapData(_webcamMaxWidth, _webcamMaxHeight);
- bitmapData.draw( videoHD );
-
- var bitmapDataHD : BitmapData = new BitmapData(_webcamMaxWidth, _webcamMaxHeight)
- bitmapDataHD.draw( videoHD );
-
- var bitmap : Bitmap = new Bitmap( bitmapData );
- var bitmapHD : Bitmap = new Bitmap( bitmapDataHD );
-
- snapshotVideo.source = bitmap;
- snapshotVideoHD.source = bitmapHD;
-
- snapshotVideo.visible = true;
- snapshotVideo.includeInLayout = true;
- playButton.visible = true;
- playButton.includeInLayout = true;
-
- video.visible = false;
- video.includeInLayout = false;
- snapshotButton.visible = false;
- snapshotButton.includeInLayout = false;
-
- if (_model.dragAndDropExplanation)
- {
- _model.dragAndDropExplanation = false;
-
- var toastMessage : ImtToaster = new ImtToaster();
-
- toastMessage = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'title.dragAndDrop');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'dragAndDropHowTo');
- toastMessage.timeToLive = 15;
- toastMessage.level = ImtToaster.INFORMATION;
-
- _model.toaster.toast( toastMessage );
- }
-
- this.setFocus();
- }
- /**
- * Diffusion du flux vidéo
- */
- private function play() : void
- {
- snapshotVideo.visible = false;
- snapshotVideo.includeInLayout = false;
- playButton.visible = false;
- playButton.includeInLayout = false;
-
- video.visible = true;
- video.includeInLayout = true;
- snapshotButton.visible = true;
- snapshotButton.includeInLayout = true;
-
- this.setFocus();
- }
- private function togglePlaySnapshot() : void
- {
- if (snapshotVideo.visible == true)
- play();
- else
- snapshot();
- }
- /**
- * Début du déplacement de la capture ou de la photo chargée
- */
- private function beginDragFromVideoOrBrowse( mouseEvent : MouseEvent ) : void
- {
- var dragInitiator : Image = mouseEvent.currentTarget as Image;
- dragInitiator.maintainAspectRatio = true;
-
- var dragSource : DragSource = new DragSource();
- dragSource.addData( ObjectUtil.copy( dragInitiator ), SNAPSHOT );
-
- var bitmapDataDragView : BitmapData = new BitmapData(660, 494);
- bitmapDataDragView.draw( dragInitiator, new Matrix() );
-
- var bitmapDragView : Bitmap = new Bitmap( bitmapDataDragView );
-
- var dragView : Image = new Image();
- dragView.maintainAspectRatio = true;
- dragView.width = 450;
- dragView.height = 337;
- dragView.source = bitmapDragView;
-
- DragManager.doDrag( dragInitiator, dragSource, mouseEvent, dragView, -( dragInitiator.mouseX + 5 ), -( dragInitiator.mouseY + 5) );
- }
- /**
- * Accepter le coller sur les deux listes
- */
- private function allowDropToTileList( dragEvent : DragEvent ) : void
- {
- var dropTarget : TileList = dragEvent.currentTarget as TileList;
-
- if( dragEvent.dragSource.formats[ 0 ] == SNAPSHOT )
- {
- DragManager.acceptDragDrop( dropTarget );
- DragManager.showFeedback(DragManager.COPY);
- } else {
- DragManager.showFeedback(DragManager.NONE);
- }
- }
- /**
- * Survol d'un segment sur les éléments Flash
- */
- private function rollOverSegment( event : MouseEvent, type : String, canvas : Canvas ) : void
- {
- _canvasActive = canvas;
-
- if( event.target is Loader )
- {
- //Focus sur le loader et non le movieclip
- } else {
- if( ObjectUtil.compare( event.target.parent, event.target.root, 0) == 0 )
- {
- //Le Focus est sur l'objet MainTimeLine de Flash
- switch( type )
- {
- case CAROTID_RIGHT :
- carotidRightSWF = event.target.parent;
- break;
- case CAROTID_LEFT :
- carotidLeftSWF = event.target.parent;
- break;
- case BODY_AORTE :
- bodySWF = event.target.parent;
- break;
- case ARM_RIGHT :
- armRightSWF = event.target.parent;
- break;
- case ARM_LEFT :
- armLeftSWF = event.target.parent;
- break;
- case LEG_RIGHT :
- legRightSWF = event.target.parent;
- break;
- case LEG_LEFT :
- legLeftSWF = event.target.parent;
- break;
- }
- }
- }
-
- _rollOverElement = event.target;
-
- if( _cursor != null )
- _cursorID = CursorManager.setCursor( _cursor, 2, _offset, _offset );
- }
- /**
- * Ajout du curseur au déplacement pour compenser le composant zoom qui supprime les curseurs
- */
- private function addCursor() : void
- {
- if( _cursor != null )
- _cursorID = CursorManager.setCursor( _cursor, 2, _offset, _offset );
- }
- /**
- * Survol hors d'un segment sur les éléments Flash
- */
- private function rollOutSegment( event : MouseEvent ) : void
- {
- CursorManager.removeAllCursors();
- }
- /**
- * Accepter le coller sur la liste de gauche
- */
- private function allowDropFromLeftList( dragEvent : DragEvent ) : void
- {
- var dropTarget : SWFLoader = dragEvent.currentTarget as SWFLoader;
-
- if( dragEvent.dragSource.formats[ 0 ] == LIST_LEFT )
- {
- DragManager.acceptDragDrop( dropTarget );
- DragManager.showFeedback(DragManager.LINK);
- } else if( dragEvent.dragSource.formats[ 0 ] == SNAPSHOT ) {
- DragManager.acceptDragDrop( dropTarget );
- DragManager.showFeedback(DragManager.LINK);
- } else {
- DragManager.showFeedback(DragManager.NONE);
- }
- }
- /**
- * Accepter le coller sur la liste de droite
- */
- private function allowDropFromRightList( dragEvent : DragEvent ) : void
- {
- var dropTarget : SWFLoader = dragEvent.currentTarget as SWFLoader;
-
- if( dragEvent.dragSource.formats[ 0 ] == LIST_RIGHT )
- {
- DragManager.acceptDragDrop( dropTarget );
- DragManager.showFeedback(DragManager.LINK);
- } else if( dragEvent.dragSource.formats[ 0 ] == SNAPSHOT ) {
- DragManager.acceptDragDrop( dropTarget );
- DragManager.showFeedback(DragManager.LINK);
- } else {
- DragManager.showFeedback(DragManager.NONE);
- }
- }
- /**
- * Accepter le coller sur la liste de droite
- */
- private function allowDropFromBodyList( dragEvent : DragEvent ) : void
- {
- var dropTarget : SWFLoader = dragEvent.currentTarget as SWFLoader;
-
- if( dragEvent.dragSource.formats[ 0 ] == BODY )
- {
- DragManager.acceptDragDrop( dropTarget );
- DragManager.showFeedback(DragManager.LINK);
- } else if( dragEvent.dragSource.formats[ 0 ] == SNAPSHOT ) {
- DragManager.acceptDragDrop( dropTarget );
- DragManager.showFeedback(DragManager.LINK);
- } else {
- DragManager.showFeedback(DragManager.NONE);
- }
- }
- /**
- * Réalisation du coller de l'image sur un tronçon des éléments Flash et modification du Flash
- */
- private function dropOnSWF( event : DragEvent, flash : String ) : void
- {
- var previousType : String;
- if (_model.viewPatient)
- {
- var toastMessage : ImtToaster = new ImtToaster();
-
- toastMessage = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'warning.use');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'acquire.updateImgInVisualMode');
- toastMessage.level = ImtToaster.WARNING;
-
- _model.toaster.toast( toastMessage );
-
- return;
- }
-
- if( event.dragSource.formats[ 0 ] == SNAPSHOT )
- {
- if( currentDragAndDropObject != null )
- {
- previousType = currentDragAndDropObject.type;
- }
- else
- {
- currentDragAndDropObject = new DragAndDropVo();
- }
-
- _rollOverElement.gotoAndStop( 2 );
-
- //création du DragAndDropObject à inserer dans la bonne liste
- var dragSource : DragSource = event.dragSource;
- var dragInitiator : Image = event.dragInitiator as Image;
- dragInitiator.maintainAspectRatio = true;
-
- var bitmapDataSmall : BitmapData = new BitmapData(450, 337);
- bitmapDataSmall.draw( dragInitiator, new Matrix() );
-
- var bitmapDataHigh : BitmapData;
-
- if( _cameraSelected )
- {
- bitmapDataHigh = ( snapshotVideoHD.content as Bitmap ).bitmapData;
- bitmapDataHigh.draw( snapshotVideoHD, new Matrix() );
- }
- else
- {
- bitmapDataHigh = ( snapshotImageHD.content as Bitmap ).bitmapData;
- bitmapDataHigh.draw( snapshotImageHD, new Matrix() );
-
- var dragAndDropObject : DragAndDropVo = new DragAndDropVo();
-
- dragAndDropObject.imageSmall = new Bitmap( bitmapDataSmall );
- dragAndDropObject.imageHigh = new Bitmap( bitmapDataHigh );
-
- if( isDicomImg )
- {
- if (!dragAndDropObject.scale)
- dragAndDropObject.scale = new ScaleVo();
-
- dragAndDropObject.scale.value = dicomScale;
- dragAndDropObject.isDicom = true;
- }
-
- dragAndDropObject.type = _rollOverElement.name;
- dragAndDropObject.width = dragAndDropObject.imageHigh.bitmapData.width;
- dragAndDropObject.height = dragAndDropObject.imageHigh.bitmapData.height;
-
- switch( flash )
- {
- case CAROTID_RIGHT:
- dragAndDropObject.collection = "CR";
- collectionImagesCarotidRight.addItem( dragAndDropObject );
- break;
- case CAROTID_LEFT:
- dragAndDropObject.collection = "CL";
- collectionImagesCarotidLeft.addItem( dragAndDropObject );
- break;
- case BODY_AORTE:
- dragAndDropObject.collection = "BO";
- collectionImagesBody.addItem( dragAndDropObject );
- break;
- case ARM_RIGHT:
- dragAndDropObject.collection = "AR";
- collectionImagesArmRight.addItem( dragAndDropObject );
- break;
- case ARM_LEFT:
- dragAndDropObject.collection = "AL";
- collectionImagesArmLeft.addItem( dragAndDropObject );
- break;
- case LEG_RIGHT:
- dragAndDropObject.collection = "LR";
- collectionImagesLegRight.addItem( dragAndDropObject );
- break;
- case LEG_LEFT:
- dragAndDropObject.collection = "LL";
- collectionImagesLegLeft.addItem( dragAndDropObject );
- break;
- }
-
- _lastAddedImgCollection = dragAndDropObject.collection;
-
- currentDragAndDropObject = dragAndDropObject;
-
- play();
- }
- }
- else
- {
- previousType = currentDragAndDropObject.type;
-
- deleteImage();
-
- currentDragAndDropObject.type = _rollOverElement.name;
-
- _rollOverElement.gotoAndStop( 2 );
-
- _lastAddedImgCollection = "";
-
- currentDragAndDropObject = (event.dragInitiator as Image).data as DragAndDropVo;
- }
-
- switch( flash )
- {
- case CAROTID_RIGHT:
- if (_lastAddedImgCollection == "")
- currentDragAndDropObject.collection = "CR";
- FlashHelper.refreshCarotidRight( previousType, this );
- break;
- case CAROTID_LEFT:
- if (_lastAddedImgCollection == "")
- currentDragAndDropObject.collection = "CL";
- FlashHelper.refreshCarotidLeft( previousType, this );
- break;
- case BODY_AORTE:
- if (_lastAddedImgCollection == "")
- currentDragAndDropObject.collection = "BO";
- FlashHelper.refreshBody( previousType, this );
- break;
- case ARM_RIGHT:
- if (_lastAddedImgCollection == "")
- currentDragAndDropObject.collection = "AR";
- FlashHelper.refreshArmRight( previousType, this );
- break;
- case ARM_LEFT:
- if (_lastAddedImgCollection == "")
- currentDragAndDropObject.collection = "AL";
- FlashHelper.refreshArmLeft( previousType, this );
- break;
- case LEG_RIGHT:
- if (_lastAddedImgCollection == "")
- currentDragAndDropObject.collection = "LR";
- FlashHelper.refreshLegRight( previousType, this );
- break;
- case LEG_LEFT:
- if (_lastAddedImgCollection == "")
- currentDragAndDropObject.collection = "LL";
- FlashHelper.refreshLegLeft( previousType, this );
- break;
- }
-
- if (currentDragAndDropObject.type == 'COMD' || currentDragAndDropObject.type == 'COMG')
- {
- var incidencePopUp : IncidencePopUp = new IncidencePopUp();
-
- incidencePopUp.parentAcquire = this;
- PopUpManager.addPopUp( incidencePopUp, this, true );
- PopUpManager.centerPopUp( incidencePopUp );
- }
- else
- {
- saveImage();
- }
- }
- private function removeImageFromCollection() : void
- {
- switch( currentDragAndDropObject.collection )
- {
- case "CR":
- if (_lastAddedImgCollection)
- collectionImagesCarotidRight.removeItemAt(collectionImagesCarotidRight.length - 1);
- FlashHelper.removeSelectionForRightCarotid( currentDragAndDropObject.type );
- break;
- case "CL":
- if (_lastAddedImgCollection)
- collectionImagesCarotidLeft.removeItemAt(collectionImagesCarotidLeft.length - 1);
- FlashHelper.removeSelectionForLeftCarotid( currentDragAndDropObject.type );
- break;
- case "BO":
- if (_lastAddedImgCollection)
- collectionImagesBody.removeItemAt(collectionImagesBody.length - 1);
- FlashHelper.removeSelectionForBody( currentDragAndDropObject.type );
- break;
- case "AR":
- if (_lastAddedImgCollection)
- collectionImagesArmRight.removeItemAt(collectionImagesArmRight.length - 1);
- FlashHelper.removeSelectionForRightArm( currentDragAndDropObject.type );
- break;
- case "AL":
- if (_lastAddedImgCollection)
- collectionImagesArmLeft.removeItemAt(collectionImagesArmLeft.length - 1);
- FlashHelper.removeSelectionForLeftArm( currentDragAndDropObject.type );
- break;
- case "LR":
- if (_lastAddedImgCollection)
- collectionImagesLegRight.removeItemAt(collectionImagesLegRight.length - 1);
- FlashHelper.removeSelectionForRightLeg( currentDragAndDropObject.type );
- break;
- case "LL":
- if (_lastAddedImgCollection)
- collectionImagesLegLeft.removeItemAt(collectionImagesLegLeft.length - 1);
- FlashHelper.removeSelectionForLeftLeg( currentDragAndDropObject.type );
- break;
- default:
- break;
- }
-
- _lastAddedImgCollection = "";
- }
- /**
- * Conversion de l'image en Base64 et déclenchement de l'événement de sauvegarde
- */
- private function saveImage() : void
- {
- this.loadingPopUp = new LoadingPopUp();
-
- PopUpManager.addPopUp( this.loadingPopUp, this, true );
- PopUpManager.centerPopUp( this.loadingPopUp );
-
- this.loadingPopUp.message = ResourceManager.getInstance().getString( 'labels', 'acquire.popUp.convert' );
- this.loadingPopUp.action.visible = true;
- this.loadingPopUp.progress.setProgress( 50, 100 );
-
- new SaveImageEvent( currentDragAndDropObject, _model.appointmentSelected.id, this ).dispatch();
- }
- public function saveImageEnded(id : int) : void
- {
- currentDragAndDropObject.id = id;
- _model.measuresList.addItem( currentDragAndDropObject );
-
- if (_model.measuresList.length == 1)
- _model.appointmentSelected.type = currentDragAndDropObject.collection;
-
- saveEnding();
-
- _model.enabledMeasure = true;
-
- }
- public function removeImageFromError() : void
- {
- this.loadingPopUp.closeHandler();
- removeImageFromCollection();
- }
- /**
- * Déclenchement de l'événement de suppression d'image
- */
- public function deleteImage() : void
- {
- new DeleteImagesEvent( currentDragAndDropObject, _model.appointmentSelected.id, this ).dispatch() ;
-
- var index : int = 0;
-
- for each( var elementToDelete : DragAndDropVo in _model.measuresList )
- {
- if( ObjectUtil.compare( elementToDelete, currentDragAndDropObject, 0) == 0 )
- _model.measuresList.removeItemAt( index );
-
- index++;
- }
-
- switch( currentDragAndDropObject.collection )
- {
- case "CR":
- FlashHelper.removeSelectionForRightCarotid(currentDragAndDropObject.type);
- break;
- case "CL":
- FlashHelper.removeSelectionForLeftCarotid(currentDragAndDropObject.type);
- break;
- case "AR":
- FlashHelper.removeSelectionForRightArm(currentDragAndDropObject.type);
- break;
- case "AL":
- FlashHelper.removeSelectionForLeftArm(currentDragAndDropObject.type);
- break;
- case "LR":
- FlashHelper.removeSelectionForRightLeg(currentDragAndDropObject.type);
- break;
- case "LL":
- FlashHelper.removeSelectionForLeftLeg(currentDragAndDropObject.type);
- break;
- case "BO":
- FlashHelper.removeSelectionForBody(currentDragAndDropObject.type);
- break;
- }
-
- if (_model.measuresList.length == 0)
- {
- _model.enabledMeasure = false;
- _model.enabledReport = false;
- }
-
- // remove image from measures page
- Application.application.menuPhysician.generalMeasure.measures.imageZoom.removeAllChildren();
- Application.application.menuPhysician.generalMeasure.measures.selectedZoneLabel.text = "";
- }
- /**
- * Déclenchement de l'événement de sauvegarde des marqueurs
- */
- public function saveMarker() : void
- {
- this.loadingPopUp.message = ResourceManager.getInstance().getString( 'labels', 'acquire.popUp.trasnfert.lesions' );
- this.loadingPopUp.progress.setProgress( 85, 100 );
-
- new SaveMarkerEvent( collectionOfMarkers.source, _model.appointmentSelected.id, this ).dispatch();
- }
- /**
- * Déclenchement de l'événement de suppression des marqueurs
- */
- public function deleteMarkersEvent() : void
- {
- new DeleteMarkersEvent( collectionOfMarkers.source, _model.appointmentSelected.id, this ).dispatch();
- }
- /**
- * Déclenchement de l'événement de sauvegarde des marqueurs
- */
- public function saveEnding() : void
- {
- this.loadingPopUp.message = ResourceManager.getInstance().getString( "labels", "acquire.popUp.save.done");
- this.loadingPopUp.progress.setProgress( 100, 100 );
- this.loadingPopUp.closeHandler();
-
- panzoomCarotidRight.zoom( 1 );
- panzoomCarotidLeft.zoom( 1 );
- panzoomArmRight.zoom( 1 );
- panzoomArmLeft.zoom( 1 );
- panzoomLegRight.zoom( 1 );
- panzoomLegLeft.zoom( 1 );
- panzoomBody.zoom( 1 );
-
- _timer = new Timer( 1000, 1 );
-
- _timer.addEventListener( TimerEvent.TIMER_COMPLETE, buildSegments );
- _timer.start();
- }
- /**
- * Construction des differents segments (conversion swf en bitmap)
- */
- private function buildSegments( event : TimerEvent ) : void
- {
- FlashHelper.buildSegmentSelected( panzoomCarotidRight, "CR" );
- FlashHelper.buildSegmentSelected( panzoomCarotidLeft, "CL" );
- FlashHelper.buildSegmentSelected( panzoomArmRight, "AR" );
- FlashHelper.buildSegmentSelected( panzoomArmLeft, "AL" );
- FlashHelper.buildSegmentSelected( panzoomLegRight, "LR" );
- FlashHelper.buildSegmentSelected( panzoomLegLeft, "LL" );
- FlashHelper.buildSegmentSelected( panzoomBody, "BO" );
- }
- /**
- * Convertisseur de SWF en bitmap pour les mesures
- */
- private function convertSWFToBitmap( swf : PanZoomComponent, bitmap : String ) : void
- {
- var bitmapData : BitmapData = new BitmapData( swf.width - 15, swf.height - 14 );
- var matrix : Matrix = new Matrix(1,0,0,1,2,2);
-
- var rectangle : Rectangle = new Rectangle( 5, 5, swf.width - 15, swf.height - 14 );
-
- bitmapData.draw( swf, matrix, null, null, rectangle );
-
- switch( bitmap )
- {
- case "CR":
- _model.carotidRight = new Bitmap( bitmapData );
- _model.carotidRight.smoothing = true;
- break;
- case "CL":
- _model.carotidLeft = new Bitmap( bitmapData );
- _model.carotidLeft.smoothing = true;
- break;
- case "AR":
- _model.armRight = new Bitmap( bitmapData );
- _model.armRight.smoothing = true;
- break;
- case "AL":
- _model.armLeft = new Bitmap( bitmapData );
- _model.armLeft.smoothing = true;
- break;
- case "LR":
- _model.legRight = new Bitmap( bitmapData );
- _model.legRight.smoothing = true;
- break;
- case "LL":
- _model.legLeft = new Bitmap( bitmapData );
- _model.legLeft.smoothing = true;
- break;
- case "BO":
- _model.body = new Bitmap( bitmapData );
- _model.body.smoothing = true;
- break;
- }
- }
- /**
- * Acceptation du copier de l'image provenant de l'acquisition (flux vidéo ou champ parcourir)
- */
- private function acceptDropToTileList( dragEvent : DragEvent ) : void
- {
- var dragSource : DragSource = dragEvent.dragSource;
- var dragInitiator : Image = dragEvent.dragInitiator as Image;
- var dropTarget : TileList = dragEvent.currentTarget as TileList;
-
- var bitmapDataSmall : BitmapData = new BitmapData(400, 300);
- bitmapDataSmall.draw( dragInitiator, new Matrix() );
-
- var bitmapDataHigh : BitmapData;
-
- if( _cameraSelected )
- {
- bitmapDataHigh = ( snapshotVideoHD.content as Bitmap ).bitmapData;
- bitmapDataHigh.draw( snapshotVideoHD, new Matrix() );
- }
- else
- {
- bitmapDataHigh = ( snapshotImageHD.content as Bitmap ).bitmapData;
- bitmapDataHigh.draw( snapshotImageHD, new Matrix() );
- }
-
- var dragAndDropObject : DragAndDropVo = new DragAndDropVo();
-
- dragAndDropObject.imageSmall = new Bitmap( bitmapDataSmall );
- dragAndDropObject.imageHigh = new Bitmap( bitmapDataHigh );
-
- if( isDicomImg )
- {
- if (!dragAndDropObject.scale)
- dragAndDropObject.scale = new ScaleVo();
- dragAndDropObject.scale.value = dicomScale;
- dragAndDropObject.isDicom = true;
- }
-
- if( dragSource.formats[ 0 ] == SNAPSHOT )
- {
- dropTarget.dataProvider.addItem( dragAndDropObject );
- }
- play();
- }
- /**
- * Création d'écouteurs lors de la création du composant
- */
- private function configureListeners( dispatcher : IEventDispatcher ) : void
- {
- snapshotVideo.addEventListener( MouseEvent.MOUSE_DOWN, beginDragFromVideoOrBrowse );
- }
- /**
- * Ouverture de la fenêtre parcourir
- */
- private function browse() : void
- {
- _fileReference = new FileReference();
-
- _fileReference.addEventListener(Event.SELECT, imageSelected);
- _fileReference.addEventListener(Event.COMPLETE, imageLoaded);
-
- _fileReference.browse( [_imagesFilter] );
- }
- private function imagesDownload() : void
- {
- _fileReference = new FileReference();
-
- _fileReference.download(new URLRequest(_model.ipProtocol + "://" + _model.ipAddress + "/images/images.zip"));
- }
- /**
- * Image séléctionnée depuis le champ parcourir
- */
- private function imageSelected( event : Event ) : void
- {
- var _fileReference : FileReference = FileReference(event.target);
- _fileReference.load();
- }
- /**
- * Image chargée depuis le champ parcourir
- */
- private function imageLoaded( event : Event ) : void
- {
- var toastMessage : ImtToaster;
-
- var _fileReference : FileReference = FileReference(event.target);
-
- var filename : String = event.target.name;
- var extension : String = filename.substr(filename.lastIndexOf(".") + 1);
-
- if (extension == "jpg" || extension == "jpeg" || extension == "png"
- || extension == "JPG" || extension == "JPEG" || extension == "PNG")
- {
- isDicomImg = false;
- snapshotImage.source = _fileReference.data;
- snapshotImageHD.source = _fileReference.data;
-
- // var imageCJ : ImageCJ = new ImageCJ();
- // imageCJ.toQuatreTiers( ( snapshotImageHD.content as Bitmap ).bitmapData.width, ( snapshotImageHD.content as Bitmap ).bitmapData.height, ( snapshotImageHD.content as Bitmap ).bitmapData );
-
- // bitmapDataHigh = ( snapshotImageHD.content as Bitmap ).bitmapData;
- // bitmapDataHigh.draw( snapshotImageHD, new Matrix() );
- }
- else if (extension == "dcm" || extension == "dcim" || extension == "DCM" || extension == "DCIM")
- {
- isDicomImg = true
-
- snapshotImage.source = null;
- snapshotImageHD.source = null;
-
- dicomProgressPopup = ShowProgress(PopUpManager.createPopUp(this, ShowProgress, true));
- dicomProgressPopup.progress.label = "Uploading...";
- PopUpManager.centerPopUp(dicomProgressPopup);
-
- _fileReference.removeEventListener(Event.COMPLETE, imageLoaded);
- _fileReference.removeEventListener(Event.SELECT, imageSelected);
- _fileReference.addEventListener(Event.COMPLETE, uploadCompleteHandler);
-
- var request : URLRequest = new URLRequest();
- request.url = _model.ipProtocol + "://" + _model.ipAddress + "/services/common/dicom/upload.php";
- request.method = URLRequestMethod.POST;
-
- _fileReference.upload( request, "filename" );
- }
-
- if (_model.dragAndDropExplanation)
- {
- // one time by connection : display drag and drop howto
- _model.dragAndDropExplanation = false;
-
- toastMessage = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'title.dragAndDrop');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'dragAndDropHowTo');
- toastMessage.timeToLive = 12;
- toastMessage.level = ImtToaster.INFORMATION;
-
- _model.toaster.toast( toastMessage );
- }
- }
- private function uploadCompleteHandler(event:Event):void
- {
- PopUpManager.removePopUp(dicomProgressPopup);
-
- var service : HTTPService = new HTTPService();
-
- _fileReference.removeEventListener(Event.COMPLETE, uploadCompleteHandler);
- service.url = _model.ipProtocol + "://" + _model.ipAddress + "/services/common/dicom/dicomProcessing.php";
- service.method = URLRequestMethod.GET;
- service.resultFormat = "text";
-
- var parameters : Object = new Object();
-
- parameters.filename = event.target.name;
-
- parameters.idpatient = _model.connectedUser.id;
- parameters.lastname = _model.connectedUser.person.lastName;
- parameters.firstname = _model.connectedUser.person.firstName;
- parameters.sex = "";
- parameters.birthdate = "";
-
- service.request = parameters;
-
- service.addEventListener(ResultEvent.RESULT, onDicomOK );
- service.addEventListener(FaultEvent.FAULT, onDicomFault );
-
- dicomProgressPopup = ShowProgress(PopUpManager.createPopUp(this, ShowProgress, true));
- dicomProgressPopup.progress.label = "Downloading...";
- PopUpManager.centerPopUp(dicomProgressPopup);
-
- service.send();
- }
- /**
- * Changement d'affichage du curseur
- */
- private function changeCursor( icon : Class, swf : String, event : Event, buttons : Array ) : void
- {
- if( event.currentTarget.selected )
- {
- _cursor = icon;
- _typeCursor = "swf/" + swf + ".swf";
-
- for each( var button : Button in buttons )
- button.selected = false;
-
- } else {
- _cursor = null;
- }
- }
- /**
- * Ajout d'un marqueur
- */
- private function addMarkerOrDisplayPictures( event : MouseEvent, flash : String, canvas : Canvas ) : void
- {
- if( _cursor != null )
- {
- var markerVo : MarkerVo = new MarkerVo();
- var marker : SWFLoader = new SWFLoader();
-
- marker.source = _typeCursor;
-
- if( _typeCursor == "swf/" + SWF_STENOSE + ".swf" )
- markerVo.type = MarkerVo.STENOSE;
-
- if( _typeCursor == "swf/" + SWF_PLAQUE + ".swf" )
- markerVo.type = MarkerVo.PLAQUE;
- if( _typeCursor == "swf/" + SWF_OCCLUSION + ".swf" )
- markerVo.type = MarkerVo.OCCLUSION;
- canvas.addChild( marker );
-
- marker.x = canvas.contentMouseX + _offset;
- marker.y = canvas.contentMouseY + _offset;
-
- switch( flash )
- {
- case CAROTID_RIGHT :
- markerVo.location = MarkerVo.CAROTID;
- markerVo.side = MarkerVo.RIGHT;
- break;
-
- case CAROTID_LEFT :
- markerVo.location = MarkerVo.CAROTID;
- markerVo.side = MarkerVo.LEFT;
- break;
-
- case ARM_RIGHT :
- markerVo.location = MarkerVo.ARM;
- markerVo.side = MarkerVo.RIGHT;
- break;
-
- case ARM_LEFT :
- markerVo.location = MarkerVo.ARM;
- markerVo.side = MarkerVo.LEFT;
- break;
-
- case LEG_RIGHT :
- markerVo.location = MarkerVo.LEG;
- markerVo.side = MarkerVo.RIGHT;
- break;
-
- case LEG_LEFT :
- markerVo.location = MarkerVo.LEG;
- markerVo.side = MarkerVo.LEFT;
- break;
-
- case BODY :
- markerVo.location = MarkerVo.BODY;
- markerVo.side = MarkerVo.CENTER;
- break;
- }
-
- markerVo.xPosition = marker.x;
- markerVo.yPosition = marker.y;
- markerVo.uidDisplayObject = marker.uid;
-
- collectionOfMarkers.addItem( markerVo );
-
- marker.addEventListener( MouseEvent.CLICK, removeMarker );
-
- for each( var button : Button in [ buttonPlaque, buttonStenosis, buttonOcclusion ] )
- button.selected = false;
-
- _cursor = null;
-
- saveMarker();
- }
- else
- refreshDisplayList( event, flash );
- }
- /**
- * Suppression d'un marqueur
- */
- private function removeMarker( event : MouseEvent ) : void
- {
- _canvasActive.removeChild( event.currentTarget as SWFLoader );
-
- var index : int = 0;
-
- for each( var item : MarkerVo in collectionOfMarkers )
- {
- if( ObjectUtil.compare( item.uidDisplayObject, ( event.currentTarget.uid as String ), 0) == 0 )
- {
- collectionOfMarkers.removeItemAt( index );
- break;
- }
- index++;
- }
-
- saveMarker();
- }
- /**
- * Rafraichissement de la collection d'affichage
- */
- private function refreshDisplayList( event : Event, flash : String ) : void
- {
- collectionDisplay.removeAll();
-
- var item : DragAndDropVo;
-
- for each( item in collectionImagesCarotidRight )
- {
- item.segment = false
- }
- for each( item in collectionImagesCarotidLeft )
- {
- item.segment = false
- }
- for each( item in collectionImagesBody )
- {
- item.segment = false
- }
- for each( item in collectionImagesLegRight )
- {
- item.segment = false
- }
- for each( item in collectionImagesLegLeft )
- {
- item.segment = false
- }
- for each( item in collectionImagesArmRight )
- {
- item.segment = false
- }
- for each( item in collectionImagesArmLeft )
- {
- item.segment = false
- }
-
- switch( flash )
- {
- case CAROTID_RIGHT:
- for each( item in collectionImagesCarotidRight )
- {
- if( item.type == event.target.name )
- {
- collectionDisplay.addItem( item );
- item.segment = true
- } else {
- item.segment = false
- }
- }
- sideDisplay = CAROTID_RIGHT;
- break;
- case CAROTID_LEFT:
- for each( item in collectionImagesCarotidLeft )
- {
- if( item.type == event.target.name )
- {
- collectionDisplay.addItem( item );
- item.segment = true
- } else {
- item.segment = false
- }
- }
- sideDisplay = CAROTID_LEFT;
- break;
- case BODY_AORTE:
- for each( item in collectionImagesBody )
- {
- if( item.type == event.target.name )
- {
- collectionDisplay.addItem( item );
- item.segment = true
- } else {
- item.segment = false
- }
- }
- sideDisplay = BODY_AORTE;
- break;
- case LEG_RIGHT:
- for each( item in collectionImagesLegRight )
- {
- if( item.type == event.target.name )
- {
- collectionDisplay.addItem( item );
- item.segment = true
- } else {
- item.segment = false
- }
- }
- sideDisplay = LEG_RIGHT;
- break;
- case LEG_LEFT:
- for each( item in collectionImagesLegLeft )
- {
- if( item.type == event.target.name )
- {
- collectionDisplay.addItem( item );
- item.segment = true
- } else {
- item.segment = false
- }
- }
- sideDisplay = LEG_LEFT;
- break;
- case ARM_RIGHT:
- for each( item in collectionImagesArmRight )
- {
- if( item.type == event.target.name )
- {
- collectionDisplay.addItem( item );
- item.segment = true
- } else {
- item.segment = false
- }
- }
- sideDisplay = ARM_RIGHT;
- break;
- case ARM_LEFT:
- for each( item in collectionImagesArmLeft )
- {
- if( item.type == event.target.name )
- {
- collectionDisplay.addItem( item );
- item.segment = true
- } else {
- item.segment = false
- }
- }
- sideDisplay = ARM_LEFT;
- break;
- }
- }
- /**
- * Lors de la sélection d'une zone du corps on charge les éléments qui lui sont liés depuis la base.
- * Au 10/05/2011 cette collection n'est plus utilisée pour des raisons de lisibilité.
- */
- private function selectZone( event : MouseEvent ) : void
- {
- _twoSideSelected = true;
- switch( event.target.name )
- {
- case "neck":
- flipToCarotids();
- new GetTypeFromLocationEvent( "CL" ).dispatch();
- new GetTypeFromLocationEvent( "CR" ).dispatch();
- break;
- case "armL":
- case "armR":
- flipToArms();
- new GetTypeFromLocationEvent( "AL" ).dispatch();
- new GetTypeFromLocationEvent( "AR" ).dispatch();
- break;
- case "body":
- flipToBody();
- _twoSideSelected = false;
- new GetTypeFromLocationEvent( "BO" ).dispatch();
- break;
- case "legs":
- flipToLegs();
- new GetTypeFromLocationEvent( "LL" ).dispatch();
- new GetTypeFromLocationEvent( "LR" ).dispatch();
- break;
- }
- }
- /**
- * Affichage des contrôles vidéos
- */
- private function displayControls( box : HBox ) : void
- {
- box.alpha = 1;
- }
- /**
- * Disparition des contrôles vidéos
- */
- private function hideControls( box : HBox ) : void
- {
- box.alpha = 0;
- }
- public function setImagesLoaded( type : String ) : void
- {
- _imagesLoaded = true;
-
- if (_model.viewPatient)
- {
- var dragAndDropVo : DragAndDropVo = null;
-
- switch( type )
- {
- case "CR":
- case "CL":
- if (collectionImagesCarotidRight)
- dragAndDropVo = collectionImagesCarotidRight.getItemAt(0) as DragAndDropVo;
- else if (collectionImagesCarotidLeft)
- dragAndDropVo = collectionImagesCarotidLeft.getItemAt(0) as DragAndDropVo;
- flipToCarotids();
- break;
- case "AR":
- case "AL":
- if (collectionImagesArmRight)
- dragAndDropVo = collectionImagesArmRight.getItemAt(0) as DragAndDropVo;
- else if (collectionImagesArmLeft)
- dragAndDropVo = collectionImagesArmLeft.getItemAt(0) as DragAndDropVo;
- flipToArms();
- break;
- case "LR":
- case "LL":
- if (collectionImagesLegRight)
- dragAndDropVo = collectionImagesLegRight.getItemAt(0) as DragAndDropVo;
- else if (collectionImagesLegLeft)
- dragAndDropVo = collectionImagesLegLeft.getItemAt(0) as DragAndDropVo;
- flipToLegs();
- break;
- case "BO":
- if (collectionImagesBody)
- dragAndDropVo = collectionImagesBody.getItemAt(0) as DragAndDropVo;
- flipToBody();
- break;
- }
-
- if (dragAndDropVo)
- loadFirstImage(dragAndDropVo);
- }
- }
- public function clearPage() : void
- {
- collectionImagesCarotidLeft.removeAll();
- collectionImagesCarotidRight.removeAll();
- collectionImagesBody.removeAll();
- collectionImagesArmLeft.removeAll();
- collectionImagesArmRight.removeAll();
- collectionImagesLegLeft.removeAll();
- collectionImagesLegRight.removeAll();
- collectionDisplay.removeAll();
- collectionOfMarkers.removeAll();
-
- _imagesLoaded = false;
-
- _model.measuresList.removeAll();
- _model.listMarkers.removeAll();
-
- snapshotImage.source = null;
- snapshotImageHD.source = null;
-
- cameraViews.selectedIndex = 0;
-
- for each( var button : Button in [ buttonPlaque, buttonStenosis, buttonOcclusion ] )
- button.selected = false;
-
- var stenose : String = "swf/" + SWF_STENOSE + ".swf";
- var occlusion : String = "swf/" + SWF_OCCLUSION + ".swf";
- var plaque : String = "swf/" + SWF_PLAQUE + ".swf";
-
- for each ( var theCanvas : Canvas in [ canvasArmLeft, canvasArmRight, canvasBody, canvasCarotidLeft, canvasCarotidRight, canvasLegLeft, canvasLegRight ] )
- for each ( var itsChild : SWFLoader in theCanvas.getChildren() )
- {
- if ( itsChild.source == stenose
- || itsChild.source == occlusion
- || itsChild.source == plaque )
- {
- theCanvas.removeChild(itsChild);
- }
- }
-
- _cursor = null;
-
- if( _boxActive != null )
- {
- _boxActive.visible = false;
- human.visible = true;
- _man = true;
- }
-
- FlashHelper.resetAll();
- }
- public function setImageIncidence(incidence : String) : void
- {
- currentDragAndDropObject.incidence = incidence;
- saveImage();
- }
- public function showHelp(image : Image) : void
- {
- HelpUtils.showHelp(this, image, zoomHelpAdd, zoomHelpRemove);
- }
- /************
- * DICOM PHP
- */
- private function onDicomFault(event:FaultEvent):void
- {
- PopUpManager.removePopUp(dicomProgressPopup);
-
- var toastMessage : ImtToaster = new ImtToaster();
-
- toastMessage = new ImtToaster();
-
- toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'error.title');
- toastMessage.message = ResourceManager.getInstance().getString('labels', 'error.dicom');
- toastMessage.level = ImtToaster.ERROR;
-
- _model.toaster.toast( toastMessage );
- }
- private function onDicomOK(event:ResultEvent):void
- {
- PopUpManager.removePopUp(dicomProgressPopup);
-
- // Récupère les Tags sous forme de chaine
- var vStr:String = event.result.toString();
- var tagsDicom:Array = vStr.split(/_TAG_/, 8);
-
- snapshotImage.source = _model.ipProtocol + "://" + _model.ipAddress + "/services/common/dicom/upload/" + tagsDicom[0];
- snapshotImageHD.source = _model.ipProtocol + "://" + _model.ipAddress + "/services/common/dicom/upload/" + tagsDicom[0];
-
- var physicalDeltaX : Number = tagsDicom[1];
- var physicalDeltaY : Number = tagsDicom[2];
- var pixelSpacingX : Number = tagsDicom[3];
- var pixelSpacingY : Number = tagsDicom[4];
-
- if ((pixelSpacingX == 0) && (pixelSpacingY == 0))
- {
- dicomScale = physicalDeltaX < physicalDeltaY ? (physicalDeltaX * 10) : (physicalDeltaY * 10);
- }
- else
- {
- dicomScale = pixelSpacingX < pixelSpacingY ? pixelSpacingX : pixelSpacingY;
- }
- }
- /******************************
- * Fin DICOM PHP
- */
|