Exemplo n.º 1
0
        public bool Evaluate(AgCrdnCalcScalarPluginResultEval Result)
        {
            if (m_ObjectTrajectoryCatesianX != null && m_ObjectTrajectoryCatesianZ != null)
            {
                double x = 0;
                double z = 0;

                m_ObjectTrajectoryCatesianX.CurrentValue(Result, ref x);
                m_ObjectTrajectoryCatesianZ.CurrentValue(Result, ref z);

                Result.SetValue(x + z);
            }

            return(true);
        }
        public bool Evaluate(AgCrdnCalcScalarPluginResultEval Result)
        {
            // If the constraint facility object hasn't been linked to yet, do that here:
            if (m_cnstrFacility == null)
            {
                // The plugin returns the truncated object path, so split the string to get the base name:
                string   cnstrFacPath      = Result.ObjectPath;
                string[] cnstrFacPathSplit = cnstrFacPath.Split('/');
                string   cnstrFacName      = cnstrFacPathSplit[cnstrFacPathSplit.Length - 1];
                m_cnstrFacility = m_StkScenario.Children[cnstrFacName] as IAgFacility;
            }

            double facilityLatitude  = 0.0;
            double facilityLongitude = 0.0;

            try
            {
                Array facilityPosition = m_cnstrFacility.Position.QueryPlanetodeticArray();
                facilityLatitude  = Convert.ToDouble(facilityPosition.GetValue(0).ToString());
                facilityLongitude = Convert.ToDouble(facilityPosition.GetValue(1).ToString());
                if (facilityLongitude < 0)
                {
                    facilityLongitude = facilityLongitude + 360;
                }
            }
            catch (Exception)
            {
                Debug.WriteLine("Unable to retrieve grid constraint facility position.");
            }

            foreach (ExternalDataItems item in _inputValueList)
            {
                if (Math.Abs(item.Latitude - facilityLatitude) < Tolerance &&
                    Math.Abs(item.Longitude - facilityLongitude) < Tolerance)
                {
                    Result.SetValue(item.Value);
                    break;
                }
            }

            return(true);
        }