コード例 #1
0
        internal void AddAdditionalTargets(GeometryVision geoVision, List <GeometryType> geoTypes)
        {
            var targetingSystems = MakeTargetingSystems();

            AssignTargetingInstructions();

            //Make all currently supported targeting systems and return them in a tuple like object

            void AssignTargetingInstructions()
            {
                foreach (var geoType in geoTypes)
                {
                    if (geoType == GeometryType.Objects)
                    {
                        var targetingInstruction = new TargetingInstruction(GeometryType.Objects, settings.defaultTag,
                                                                            (targetingSystems.Item4, targetingSystems.Item1), true, null);
                        geoVision.TargetingInstructions.Add(targetingInstruction);
                    }

                    if (geoType == GeometryType.Lines)
                    {
                        var targetingInstruction = new TargetingInstruction(GeometryType.Lines, settings.defaultTag,
                                                                            (targetingSystems.Item5, targetingSystems.Item2), true, null);
                        geoVision.TargetingInstructions.Add(targetingInstruction);
                    }

                    if (geoType == GeometryType.Vertices)
                    {
                        var targetingInstruction = new TargetingInstruction(GeometryType.Vertices, settings.defaultTag,
                                                                            (targetingSystems.Item6, targetingSystems.Item3), true, null);
                        geoVision.TargetingInstructions.Add(targetingInstruction);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the first targeting instruction matching the give type as GeometryType.
        /// </summary>
        /// <param name="geometryType">Targeting instruction search parameter. GeometryType to look for. Default use case is GeometryType.Objects</param>
        /// <returns></returns>
        public TargetingInstruction GetTargetingInstructionOfType(GeometryType geometryType)
        {
            TargetingInstruction instructionToReturn = null;

            foreach (var instruction in TargetingInstructions)
            {
                if ((int)instruction.GeometryType == (int)geometryType)
                {
                    instructionToReturn = instruction;
                    break;
                }
            }

            return(instructionToReturn);
        }