protected override void destroy() { AnatomyManager.removeAnatomy(this); foreach (AnatomyCommand command in commands) { command.destroy(); } }
/// <summary> /// Find the anatomy along a given ray. Will fire search events. Returns the best match anatomy based /// on position and selection mode (group or individual). Returns null if no anatomy was found /// along the ray or if the picking mode is null. If a value is returned it will have at least one result. /// </summary> /// <param name="ray">The ray to check for anatomy along.</param> /// <returns>An enumerator over results or null if there are no results to enumerate.</returns> public IEnumerable <Anatomy> findAnatomy(Ray3 ray, out AnatomyIdentifier firstMatch) { firstMatch = null; fireSearchStarted(SuggestedDisplaySortMode.Alphabetical); fireClearDisplayedAnatomy(); IEnumerable <Anatomy> results = null; var matches = AnatomyManager.findAnatomy(ray); if (matches.Count > 0) { //Display found anatomy and related groups HashSet <String> displayedGroups = new HashSet <String>(); foreach (AnatomyIdentifier anatomy in matches.Anatomy) { if (firstMatch == null) { firstMatch = anatomy; } fireDisplayAnatomy(anatomy); foreach (var group in luceneSearch.relatedGroupsFor(anatomy)) { if (group.ShowInClickSearch && displayedGroups.Add(group.AnatomicalName)) { fireDisplayAnatomy(group); } } } if (pickingMode != AnatomyPickingMode.None) { results = currentClickGroupSelectionFor(matches); } } else { foreach (var anatomy in currentTopLevelMode.TopLevelItems) { fireDisplayAnatomy(anatomy); } } fireSearchEnded(); return(results); }
protected override void link() { String errorMessage = null; foreach (AnatomyCommand command in commands) { if (!command.link(Owner, this, ref errorMessage)) { blacklist("SimObject {0} AnatomyIdentifier {1} failed to link command {2}. Reason: {3}", Owner.Name, AnatomicalName, command.UIText, errorMessage); } } SceneNodeElement nodeElement = Owner.getElement(nodeName) as SceneNodeElement; if (nodeElement == null) { blacklist("SimObject {0} AnatomyIdentifier {1} cannot find node named {2}", Owner.Name, AnatomicalName, nodeName); } entity = nodeElement.getNodeObject(entityName) as Entity; if (entity == null) { blacklist("SimObject {0} AnatomyIdentifier {1} Node {2} cannot find entity named {3}", Owner.Name, AnatomicalName, nodeName, entityName); } AnatomyManager.addAnatomy(this); }
public CommonUICallback(StandaloneController standaloneController, EditorController editorController, PropEditController propEditController) { this.editorController = editorController; this.standaloneController = standaloneController; this.propEditController = propEditController; this.addOneWayCustomQuery(CameraPosition.CustomEditQueries.CaptureCameraPosition, delegate(CameraPosition camPos) { SceneViewWindow activeWindow = standaloneController.SceneViewController.ActiveWindow; if (activeWindow != null) { camPos.Translation = activeWindow.Translation; camPos.LookAt = activeWindow.LookAt; activeWindow.calculateIncludePoint(camPos); } }); this.addOneWayCustomQuery(CameraPosition.CustomEditQueries.PreviewCameraPosition, delegate(CameraPosition camPos) { SceneViewWindow activeWindow = standaloneController.SceneViewController.ActiveWindow; if (activeWindow != null) { CameraPosition undo = activeWindow.createCameraPosition(); activeWindow.setPosition(camPos, MedicalConfig.CameraTransitionTime); activeWindow.pushUndoState(undo); } }); this.addCustomQuery <PresetState>(ChangeMedicalStateCommand.CustomEditQueries.CapturePresetState, delegate(SendResult <PresetState> resultCallback) { PresetStateCaptureDialog stateCaptureDialog = new PresetStateCaptureDialog(resultCallback); stateCaptureDialog.SmoothShow = true; stateCaptureDialog.open(true); }); this.addOneWayCustomQuery(RmlView.CustomQueries.OpenFileInRmlViewer, delegate(String file) { editorController.openEditor(file); }); this.addCustomQuery <Browser>(ViewCollection.CustomQueries.CreateViewBrowser, delegate(SendResult <Browser> resultCallback) { Browser browser = new Browser("Views", "Choose View Type"); standaloneController.MvcCore.ViewHostFactory.createViewBrowser(browser); String errorPrompt = null; resultCallback(browser, ref errorPrompt); }); this.addCustomQuery <Browser>(ModelCollection.CustomQueries.CreateModelBrowser, delegate(SendResult <Browser> resultCallback) { Browser browser = new Browser("Models", "Choose Model Type"); browser.addNode(null, null, new BrowserNode("DataModel", typeof(DataModel), DataModel.DefaultName)); browser.addNode(null, null, new BrowserNode("Navigation", typeof(NavigationModel), NavigationModel.DefaultName)); browser.addNode(null, null, new BrowserNode("MedicalStateInfo", typeof(MedicalStateInfoModel), MedicalStateInfoModel.DefaultName)); browser.addNode(null, null, new BrowserNode("BackStack", typeof(BackStackModel), BackStackModel.DefaultName)); String error = null; resultCallback(browser, ref error); }); this.addCustomQuery <Type>(RunCommandsAction.CustomQueries.ShowCommandBrowser, delegate(SendResult <Type> resultCallback) { this.showBrowser(RunCommandsAction.CreateCommandBrowser(), resultCallback); }); this.addCustomQuery <Color>(ShowTextAction.CustomQueries.ChooseColor, queryDelegate => { ColorDialog colorDialog = new ColorDialog(); colorDialog.showModal((result, color) => { if (result == NativeDialogResult.OK) { String errorPrompt = null; queryDelegate.Invoke(color, ref errorPrompt); } }); }); this.addOneWayCustomQuery <ShowPropAction>(ShowPropAction.CustomQueries.KeepOpenToggle, showPropAction => { if (showPropAction.KeepOpen) { propEditController.removeOpenProp(showPropAction); } else { propEditController.addOpenProp(showPropAction); } }); this.addSyncCustomQuery <Browser, IEnumerable <String>, String>(FileBrowserEditableProperty.CustomQueries.BuildBrowser, (searchPattern, prompt) => { return(createFileBrowser(searchPattern, prompt)); }); this.addSyncCustomQuery <Browser>(AnatomyManager.CustomQueries.BuildBrowser, () => { return(AnatomyManager.buildBrowser()); }); this.addSyncCustomQuery <Browser>(PropBrowserEditableProperty.CustomQueries.BuildBrowser, () => { Browser browser = new Browser("Props", "Choose Prop"); foreach (var propDef in standaloneController.TimelineController.PropFactory.PropDefinitions) { if (standaloneController.LicenseManager.allowPropUse(propDef.PropLicenseId)) { browser.addNode(propDef.BrowserPath, new BrowserNode(propDef.PrettyName, propDef.Name)); } } return(browser); }); this.addSyncCustomQuery <Browser>(ElementNameEditableProperty.CustomQueries.BuildBrowser, () => { Browser browser = new Browser("Screen Location Name", "Choose Screen Location Name"); foreach (var elementName in standaloneController.GUIManager.NamedLinks) { browser.addNode(null, null, new BrowserNode(elementName.UniqueDerivedName, elementName)); } return(browser); }); addOneWayCustomQuery <String>(PlaySoundAction.CustomQueries.EditExternally, soundFile => { if (soundFile != null && editorController.ResourceProvider.exists(soundFile)) { String fullPath = editorController.ResourceProvider.getFullFilePath(soundFile); OtherProcessManager.openLocalURL(fullPath); } }); }