コード例 #1
0
        public override bool link(SimObject owner, AnatomyIdentifier parentAnatomy, ref String errorMessage)
        {
            SimObject targetSimObject = owner.getOtherSimObject(targetSimObjectName);

            if (targetSimObject == null)
            {
                errorMessage = String.Format("Could not find target SimObject {0}", targetSimObjectName);
                return(false);
            }
            transparencyInterface = targetSimObject.getElement(targetTransparencyInterfaceName) as TransparencyInterface;
            if (transparencyInterface == null)
            {
                errorMessage = String.Format("Could not find target TransparencyInterface '{0}' in '{1}'", targetTransparencyInterfaceName, targetSimObject.Name);
                return(false);
            }
            foreach (AnatomyCommand command in parentAnatomy.Commands)
            {
                if (command.UIText == TransparencyAnatomyCommand.UI_TEXT)
                {
                    transparencyAnatomyCommand = (TransparencyAnatomyCommand)command;
                    break;
                }
            }
            if (transparencyAnatomyCommand == null)
            {
                errorMessage = String.Format("Can not have a TransparencySectionAnatomyCommand on AnatomyIdentifier {0} because it has no TransparencyAnatomyCommand.", parentAnatomy.AnatomicalName);
                return(false);
            }
            transparencyAnatomyCommand.NumericValueChanged += transparencyAnatomyCommand_NumericValueChanged;
            transparencyAnatomyCommand.SmoothBlendApplied  += transparencyAnatomyCommand_SmoothBlendApplied;
            return(true);
        }
コード例 #2
0
        protected override void link()
        {
            base.link();
            SimObject entitySimObject = Owner.getOtherSimObject(anatomySimObjectName);

            if (entitySimObject == null)
            {
                blacklist("Cannot find Anatomy SimObject named '{0}'", anatomySimObjectName);
            }

            anatomy = entitySimObject.getElement(anatomyName) as AnatomyIdentifier;
            if (anatomy == null)
            {
                blacklist("Cannot find AnatomyIdentifier '{0}' on Anatomy SimObject '{1}'", anatomyName, anatomySimObjectName);
            }

            SimObject poseHandlerSimObject = Owner.getOtherSimObject(poseHandlerSimObjectName);

            if (poseHandlerSimObject == null)
            {
                blacklist("Cannot find PoseHandler SimObject named '{0}'", poseHandlerSimObjectName);
            }

            poseHandler = poseHandlerSimObject.getElement(poseHandlerName) as PoseHandler;
            if (poseHandler == null)
            {
                blacklist("Cannot find PoseHandler '{0}' in SimObject '{1}'", poseHandlerName, poseHandlerSimObjectName);
            }

            PoseableObjectsManager.add(this);
        }
コード例 #3
0
        /// <summary>
        /// This function provdies an enumeration over all groups related to the given anatomy.
        /// </summary>
        /// <param name="anatomyIdentifier">The AnatomyIdentifier to scan.</param>
        /// <returns>Enumerates over all AnatomyGroups that could be a group selection mode.</returns>
        public IEnumerable <AnatomyGroup> relatedGroupsFor(AnatomyIdentifier anatomyIdentifier)
        {
            AnatomyGroup group;

            foreach (var name in anatomyIdentifier.Tags)
            {
                if (tags.tryGetGroup(name, out group))
                {
                    yield return(group);
                }
            }

            foreach (var name in anatomyIdentifier.Systems)
            {
                if (systems.tryGetGroup(name, out group))
                {
                    yield return(group);
                }
            }

            if (anatomyIdentifier.Structure != null && structures.tryGetGroup(anatomyIdentifier.Structure, out group))
            {
                yield return(group);
            }

            if (anatomyIdentifier.Classification != null && classifications.tryGetGroup(anatomyIdentifier.Classification, out group))
            {
                yield return(group);
            }

            if (anatomyIdentifier.Region != null && regions.tryGetGroup(anatomyIdentifier.Region, out group))
            {
                yield return(group);
            }
        }
コード例 #4
0
 public override bool link(SimObject owner, AnatomyIdentifier parentAnatomy, ref String errorMessage)
 {
     transparencyInterface = owner.getElement(transparencyInterfaceName) as TransparencyInterface;
     if (transparencyInterface == null)
     {
         errorMessage = String.Format("Could not find TransparencyInterface named {0}", transparencyInterfaceName);
         return(false);
     }
     parentAnatomy._setTransparencyCommand(this);
     return(true);
 }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
 public abstract bool link(SimObject owner, AnatomyIdentifier parentAnatomy, ref String errorMessage);
コード例 #7
0
 public static void removeAnatomy(AnatomyIdentifier anatomy)
 {
     anatomyList.Remove(anatomy);
 }
コード例 #8
0
 public static void addAnatomy(AnatomyIdentifier anatomy)
 {
     anatomyList.Add(anatomy);
 }
コード例 #9
0
 private void showGroupsForAnatomy(AnatomyIdentifier anatomy)
 {
     anatomyController.displayAnatomy(String.Format("{0} Groups", anatomy.AnatomicalName), relatedGroupsFor(anatomy), SuggestedDisplaySortMode.Alphabetical);
 }
コード例 #10
0
 public override bool link(SimObject owner, AnatomyIdentifier parentAnatomy, ref string errorMessage)
 {
     return(true);
 }
コード例 #11
0
 public AnatomyClickResult(AnatomyIdentifier anatomyIdentifier, float distance)
 {
     this.AnatomyIdentifier = anatomyIdentifier;
     this.Distance          = distance;
 }
コード例 #12
0
 public Anatomy buildGroupSelectionFor(AnatomyIdentifier anatomy)
 {
     return(buildGroupSelection(anatomy));
 }