Exemple #1
0
    private void DragEvent(TouchControllersState state, Vector3 point1, Vector3 point1Delta, float EventTime)
    {
        /*
         *  Событие перемешения обьекта, имеет 3 состояния Старт,работа,конец
         *  Происхотит при попадании в Drag обьекты, без учета пальцев попавших в элементы UI.
         *  При В старте нужно реализовать выдиление здания
         *  При В работа перемешение, в конце проверку на отпускания браг обьекта.
         *  Дополнительные проверки не нужны
         *  point1 - палец 1
         *  point1Delta - дульта перемешения пальца 1
         *  EventTime - Время нахождения пальца в одном состоянии
         */
#if DEBUG_LOG
        Log.Write("DragEvent: " + state.ToString() + " p1:" + point1.ToString() + " dp1:" + point1Delta.ToString());
#endif
        DragModel dragModel = new DragModel()
        {
            stateT      = state,
            EventTime   = EventTime,
            point1      = point1,
            point1Delta = point1Delta
        };

        MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel);
    }
        private void Point_MouseMove(object sender, MouseEventArgs e)
        {
            if (isCaptured == true)
            {
                ClickModel senderModel = (ClickModel)((FrameworkElement)sender).DataContext;
                Point      coordinates = new Point(e.GetPosition(OverlayCanvas).X, e.GetPosition(OverlayCanvas).Y);

                Canvas.SetLeft(senderModel.ClickPoint, coordinates.X - (senderModel.ClickPoint.Width / 2));
                Canvas.SetTop(senderModel.ClickPoint, coordinates.Y - (senderModel.ClickPoint.Height / 2));

                if (senderModel.Parent is TextModel)
                {
                    TextModel senderTextModel = (TextModel)senderModel.Parent;

                    Canvas.SetLeft(senderTextModel.TextBox, coordinates.X);
                    Canvas.SetTop(senderTextModel.TextBox, coordinates.Y);
                }
                else if (senderModel.Parent is DragModel)
                {
                    DragModel senderDragModel = (DragModel)senderModel.Parent;

                    if (sender == senderDragModel.StartClickModel.ClickPoint)
                    {
                        senderDragModel.DragPath.X1 = coordinates.X;
                        senderDragModel.DragPath.Y1 = coordinates.Y;
                    }
                    else if (sender == senderDragModel.EndClickModel.ClickPoint)
                    {
                        senderDragModel.DragPath.X2 = coordinates.X;
                        senderDragModel.DragPath.Y2 = coordinates.Y;
                    }
                }
            }
        }
Exemple #3
0
        public void Close()
        {
            foreach (var item in gameObject.GetComponents <TweenFloat>())
            {
                item.CancelInvoke();
            }
            gameObject.SetActive(false);
            DragModel dragModel = this.m_hero.GetComponent <DragModel>();

            if (dragModel != null)
            {
                Destroy(dragModel);
            }
        }
        private void Point_Remove(object sender, EventArgs e)
        {
            int        numRemoved  = 0;
            ClickModel senderModel = ((ClickModelSettings)sender).Parent;

            if (senderModel.Parent == null)
            {
                OverlayCanvas.Children.Remove(senderModel.ClickPoint);
                pointCount--;
                numRemoved = 1;
            }
            else if (senderModel.Parent is TextModel)
            {
                TextModel senderTextModel = (TextModel)senderModel.Parent;

                OverlayCanvas.Children.Remove(senderTextModel.ClickModel.ClickPoint);
                OverlayCanvas.Children.Remove(senderTextModel.TextBox);

                pointCount--;
                numRemoved = 1;
            }
            else if (senderModel.Parent is DragModel)
            {
                DragModel senderDragModel = (DragModel)senderModel.Parent;

                OverlayCanvas.Children.Remove(senderDragModel.EndClickModel.ClickPoint);
                OverlayCanvas.Children.Remove(senderDragModel.StartClickModel.ClickPoint);
                OverlayCanvas.Children.Remove(senderDragModel.DragPath);

                pointCount -= 2;
                numRemoved  = 2;
            }

            foreach (FrameworkElement child in OverlayCanvas.Children)
            {
                if (child.DataContext is ClickModel)
                {
                    ClickModel childModel = (ClickModel)child.DataContext;

                    if (childModel.Id > senderModel.Id)
                    {
                        childModel.Id         -= numRemoved;
                        childModel.FillColor   = GetColor(childModel.Id - 1);
                        childModel.BorderColor = GetBorderColor(childModel.Id - 1);
                    }
                }
            }
        }
Exemple #5
0
 public void Close()
 {
     CurrentWeaponID  = 0;
     CurrentFashionID = 0;
     gameObject.SetActive(false);
     transform.ClearChild();
     if (m_hero)
     {
         DragModel dragModel = this.m_hero.GetComponent <DragModel>();
         if (dragModel != null)
         {
             Destroy(dragModel);
         }
     }
     StopAllCoroutines();
     //CancelInvoke("AddRotateComponentForSeconds");
 }
Exemple #6
0
    public override void BreakTouch(TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null)
    {
        if (stateT == TouchControllersState.TCS_End)
        {
            return;
        }
        Touch[] touchOne    = touches.touchOne;
        Touch[] touchTwo    = touches.touchTwo;
        Touch[] touchTree   = touches.touchTree;
        Vector3 point1      = Vector3.zero;
        Vector3 point1Delta = Vector3.zero;

        if (touchOne != null)
        {
            point1      = touchOne[0].position;
            point1Delta = touchOne[0].deltaPosition;
        }
        DragModel dragModel = new DragModel()
        {
            stateT      = stateT,
            EventTime   = touchOneStateTime,
            point1      = point1,
            point1Delta = point1Delta
        };

        if (stateT == TouchControllersState.TCS_Start)
        {
            MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel);
            dragModel.stateT = TouchControllersState.TCS_Action;
            MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel);
            dragModel.stateT = TouchControllersState.TCS_End;
            MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel);
        }
        else if (stateT == TouchControllersState.TCS_Action)
        {
            MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel);
            dragModel.stateT = TouchControllersState.TCS_End;
            MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel);
        }
    }
Exemple #7
0
    private void Start()
    {
        segmentSelect = false;
        readJson      = GameObject.Find("Selection Manager").GetComponent <ReadJson>();
        //dragModel = GameObject.Find("hand").GetComponent<DragModel>();
        dragModel = GameObject.Find("flowered_teapot_simplified").GetComponent <DragModel>();
        actions.Add("select", treatslectionManager.OnSelect);
        actions.Add("discard", treatslectionManager.OnDelete);
        actions.Add("pippo", SelectSegment);
        actions.Add("discard segment", DeleteSegment);
        actions.Add("level zero", readJson.ChangeLevel0);
        actions.Add("level one", readJson.ChangeLevel1);
        actions.Add("level two", readJson.ChangeLevel2); //"lowest level"; "highest level" as key word
        actions.Add("change level", dragModel.SwitchLevel);
        actions.Add("scale", dragModel.ChangeScaleOfModel);
        actions.Add("stop scaling", dragModel.StopScaleModel);


        keywordRecognizer = new KeywordRecognizer(actions.Keys.ToArray());
        keywordRecognizer.OnPhraseRecognized += RecognizedSpeech;
        keywordRecognizer.Start();
    }
        private void AddDragPoint_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Point coordinates = new Point(e.GetPosition(OverlayCanvas).X, e.GetPosition(OverlayCanvas).Y);

            if (isDragPoint == false)
            {
                isDragPoint = true;

                DragModel dragModel = new DragModel(pointCount + 1, GetColor(pointCount), GetBorderColor(pointCount),
                                                    pointCount + 2, GetColor(pointCount + 1), GetBorderColor(pointCount + 1));

                OverlayCanvas.Children.Add(dragModel.DragPath);
                dragModel.DragPath.X1 = dragModel.DragPath.X2 = coordinates.X;
                dragModel.DragPath.Y1 = dragModel.DragPath.Y2 = coordinates.Y;

                AddClickPointToCanvas(dragModel.StartClickModel.ClickPoint, coordinates.X, coordinates.Y);

                Mouse.Capture((UIElement)sender);
                isCaptured   = true;
                capturedDrag = dragModel;
                MouseMove   += AddDragPoint_MouseMove;
            }
            else
            {
                isDragPoint = false;

                AddClickPointToCanvas(capturedDrag.EndClickModel.ClickPoint, coordinates.X, coordinates.Y);

                Mouse.Capture(null);
                capturedDrag = null;
                isCaptured   = false;
                MouseMove   -= AddDragPoint_MouseMove;

                OverlayCanvas.Background = Brushes.Transparent;
                MouseLeftButtonDown     -= AddDragPoint_MouseLeftButtonDown;
                isAdding = false;
            }
        }
        public void GetDroppedAsObservableTest()
        {
            var usecase    = new ExclusiveDragDropUseCase();
            var collider1  = CreateCollider2D();
            var collider3  = CreateCollider2D();
            var collider4  = CreateCollider2D();
            var dropModel1 = new DropModel {
                Id = 1, Collider2D = collider1
            };
            var dragModel1 = new DragModel {
                Id = 1, Collider2D = collider3
            };
            var dragModel2 = new DragModel {
                Id = 2, Collider2D = collider4
            };
            var observer = new TestObserver <IDropModel>();

            usecase.GetDroppedAsObservable(dragModel1).Subscribe(observer);

            // drag1 into void
            Assert.IsNull(usecase.Drop(dragModel1));

            // drag1 into drop1
            usecase.Drag(dropModel1, dragModel1);
            Assert.IsNotNull(usecase.Drop(dragModel1));

            Assert.AreEqual(1, observer.OnNextCount);
            Assert.AreEqual(dropModel1.GetInstanceID(), observer.OnNextLastValue.GetInstanceID());
            Assert.AreEqual(dropModel1.Id, observer.OnNextLastValue.Id);

            // drag2 into drop1
            usecase.Drag(dropModel1, dragModel2);
            Assert.IsNotNull(usecase.Drop(dragModel2));

            Assert.AreEqual(2, observer.OnNextCount);
            Assert.IsNull(observer.OnNextLastValue);
        }
        public void LoadRoutine()
        {
            OpenFileDialog openDialog = new OpenFileDialog();

            openDialog.Title            = "Open Routine";
            openDialog.Filter           = "XML File (.xml)|*.xml";
            openDialog.DefaultExt       = ".xml";
            openDialog.ValidateNames    = true;
            openDialog.InitialDirectory = defaultPath;

            if (openDialog.ShowDialog() == true)
            {
                OverlayCanvas.Children.Clear();
                pointCount = 0;

                XDocument routine = XDocument.Load(openDialog.FileName);

                foreach (XElement element in routine.Root.Elements())
                {
                    if (element.Name == "Click")
                    {
                        XElement point = element.Element("Point");
                        int      id    = int.Parse(point.Attribute("id").Value);
                        int      x     = int.Parse(point.Attribute("x").Value);
                        int      y     = int.Parse(point.Attribute("y").Value);

                        XElement  settings   = point.Element("Settings");
                        ClickType clickType  = (ClickType)Enum.Parse(typeof(ClickType), settings.Attribute("ClickType").Value);
                        int       delay      = int.Parse(settings.Attribute("Delay").Value);
                        bool      indefinite = bool.Parse(settings.Attribute("IndefiniteDelay").Value);

                        ClickModel click = new ClickModel(id, GetColor(id - 1), GetBorderColor(id - 1));
                        click.Settings.ClickType       = clickType;
                        click.Settings.Delay           = delay;
                        click.Settings.IndefiniteDelay = indefinite;
                        AddClickPointToCanvas(click.ClickPoint, x, y);
                    }
                    else if (element.Name == "TextClick")
                    {
                        string text;
                        if (element.Attribute("text").Value == ":EMPTY:")
                        {
                            text = "";
                        }
                        else
                        {
                            text = element.Attribute("text").Value;
                        }

                        XElement point = element.Element("Point");
                        int      id    = int.Parse(point.Attribute("id").Value);
                        int      x     = int.Parse(point.Attribute("x").Value);
                        int      y     = int.Parse(point.Attribute("y").Value);

                        XElement  settings   = point.Element("Settings");
                        ClickType clickType  = (ClickType)Enum.Parse(typeof(ClickType), settings.Attribute("ClickType").Value);
                        int       delay      = int.Parse(settings.Attribute("Delay").Value);
                        bool      indefinite = bool.Parse(settings.Attribute("IndefiniteDelay").Value);

                        TextModel textClick = new TextModel(id, GetColor(id - 1), GetBorderColor(id - 1));
                        textClick.Text = text;
                        textClick.ClickModel.Settings.ClickType       = clickType;
                        textClick.ClickModel.Settings.Delay           = delay;
                        textClick.ClickModel.Settings.IndefiniteDelay = indefinite;

                        OverlayCanvas.Children.Add(textClick.TextBox);
                        Canvas.SetLeft(textClick.TextBox, x);
                        Canvas.SetTop(textClick.TextBox, y);
                        AddClickPointToCanvas(textClick.ClickModel.ClickPoint, x, y);
                    }
                    else if (element.Name == "DragClick")
                    {
                        XElement startPoint = element.Element("StartPoint");
                        int      startId    = int.Parse(startPoint.Attribute("id").Value);
                        int      startX     = int.Parse(startPoint.Attribute("x").Value);
                        int      startY     = int.Parse(startPoint.Attribute("y").Value);

                        XElement  startSettings   = startPoint.Element("Settings");
                        ClickType startClickType  = (ClickType)Enum.Parse(typeof(ClickType), startSettings.Attribute("ClickType").Value);
                        int       startDelay      = int.Parse(startSettings.Attribute("Delay").Value);
                        bool      startIndefinite = bool.Parse(startSettings.Attribute("IndefiniteDelay").Value);

                        XElement endPoint = element.Element("EndPoint");
                        int      endId    = int.Parse(endPoint.Attribute("id").Value);
                        int      endX     = int.Parse(endPoint.Attribute("x").Value);
                        int      endY     = int.Parse(endPoint.Attribute("y").Value);

                        XElement  endSettings   = endPoint.Element("Settings");
                        ClickType endClickType  = (ClickType)Enum.Parse(typeof(ClickType), endSettings.Attribute("ClickType").Value);
                        int       endDelay      = int.Parse(endSettings.Attribute("Delay").Value);
                        bool      endIndefinite = bool.Parse(endSettings.Attribute("IndefiniteDelay").Value);

                        DragModel dragModel = new DragModel(startId, GetColor(startId - 1), GetBorderColor(startId - 1), endId, GetColor(endId - 1), GetBorderColor(endId - 1));
                        dragModel.StartClickModel.Settings.ClickType       = startClickType;
                        dragModel.StartClickModel.Settings.Delay           = startDelay;
                        dragModel.StartClickModel.Settings.IndefiniteDelay = startIndefinite;
                        dragModel.EndClickModel.Settings.ClickType         = endClickType;
                        dragModel.EndClickModel.Settings.Delay             = endDelay;
                        dragModel.EndClickModel.Settings.IndefiniteDelay   = endIndefinite;

                        OverlayCanvas.Children.Add(dragModel.DragPath);
                        dragModel.DragPath.X1 = startX;
                        dragModel.DragPath.Y1 = startY;
                        dragModel.DragPath.X2 = endX;
                        dragModel.DragPath.Y2 = endY;
                        AddClickPointToCanvas(dragModel.StartClickModel.ClickPoint, startX, startY);
                        AddClickPointToCanvas(dragModel.EndClickModel.ClickPoint, endX, endY);
                    }
                }
            }
        }
Exemple #11
0
        public bool CreateCdmSatellite(bool zoomTo = false)
        {
            string cmdResult;
            string command = "BatchGraphics * On";

            StkAssistant.TryConnect(command, out cmdResult);

            try
            {
                #region New Satellite
                string color;
                string zonal    = "";
                string tesseral = "";
                if (isPrimary)
                {
                    _stkCdmSatelliteName = "cdmPrimary_" + SafeSatName;
                    color = "#00FF00";
                }
                else
                {
                    _stkCdmSatelliteName = "cdmSecondary_" + SafeSatName;
                    color = "#FF9900";
                }

                string position = String.Format("{0} {1} {2}", XPos, YPos, ZPos); // m
                double posMag   = VecMagS(position);
                string velocity = String.Format("{0} {1} {2}", XVel, YVel, ZVel); // m/s

                if (posMag < 1)
                {
                    return(false);
                }

                if (!StkAssistant.Root.CurrentScenario.Children.Contains(AgESTKObjectType.eSatellite, StkCdmSatelliteName))
                {
                    StkAssistant.Root.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, StkCdmSatelliteName);
                }


                string stkReferenceFrame = "Fixed";

                switch (this.ReferenceFrame)
                {
                case "ITRF":
                    stkReferenceFrame = "Fixed";
                    break;

                case "ICRF":
                case "GCRF":
                    stkReferenceFrame = "ICRF";
                    break;

                case "EME2000":
                    stkReferenceFrame = "J2000";
                    break;

                case "MeanOfDate":
                    stkReferenceFrame = "MeanOfDate";
                    break;

                case "MeanOfEpoch":
                    stkReferenceFrame = "MeanOfEpoch";
                    break;

                case "TrueOfDate":
                    stkReferenceFrame = "TrueOfDate";
                    break;

                case "TrueOfEpoch":
                    stkReferenceFrame = "TrueOfEpoch";
                    break;

                case "B1950":
                    stkReferenceFrame = "B1950";
                    break;

                case "TEMEOfDate":
                    stkReferenceFrame = "TEMEOfDate";
                    break;

                case "TEMEOfEpoch":
                    stkReferenceFrame = "TEMEOfEpoch";
                    break;

                case "AlignmentAtEpoch":
                    stkReferenceFrame = "AlignmentAtEpoch";
                    break;
                }

                command = String.Format("SetStateIgnoreCB  */Satellite/{0} Cartesian HPOP \"{1}\" \"{2}\" 10 {3} \"{4}\" {5} {6}",
                                        StkCdmSatelliteName, (StkAssistant.Root.CurrentScenario as IAgScenario).StartTime, (StkAssistant.Root.CurrentScenario as IAgScenario).StopTime,
                                        stkReferenceFrame, EpochISOYMD, position, velocity);
                if (!StkAssistant.TryConnect(command, out cmdResult))
                {
                    return(false); // object with no state
                }
                #endregion New Satellite


                SetSatVizOptions(StkCdmSatelliteName, color);


                #region Force Model
                if (!string.IsNullOrEmpty(GeopotentialModel))
                {
                    // Set geopotential: EGM-96, ...
                    Regex regex = new Regex(@"(EGM-96):\s+(\d+)D\s+(\d+)O");
                    Match match = regex.Match(GeopotentialModel);
                    if (match.Success)
                    {
                        if (match.Groups[1].Value != "EGM-96")
                        {
                            //outputToDebugLog("WARNING: " + match.Groups[1].Value + " gravitational model");
                            //warning = true;
                        }
                        zonal    = match.Groups[2].Value;
                        tesseral = match.Groups[3].Value;
                        command  = String.Format("HPOP */Satellite/{0} Force Gravity \"{1}STKData\\CentralBodies\\Earth\\WGS84_EGM96.grv\" {2} {3}",
                                                 StkCdmSatelliteName, StkAssistant.StkInstallDirectory, zonal, tesseral);
                        StkAssistant.TryConnect(command, out cmdResult);

                        command = String.Format("HPOP */Satellite/{0} Covariance Gravity {1} {2}", StkCdmSatelliteName, zonal, tesseral);
                        StkAssistant.TryConnect(command, out cmdResult);
                    }
                }
                else
                {
                    //outputToDebugLog(String.Format("WARNING: Undefined gravitational model: {0}", geopotentialModel[index].InnerText));
                    //warning = true;
                }

                if (!string.IsNullOrEmpty(LunarsolarPerturbations))
                {
                    string nBody = LunarsolarPerturbations.ToUpper();
                    if ((nBody != "NONE") || ((isEphemerisBased) && (isGeoRegime)))
                    {
                        if (nBody.Contains("SUN"))
                        {
                            command = String.Format("HPOP */Satellite/{0} Force ThirdBodyGravity Sun On JPLDEFile", StkCdmSatelliteName);
                            StkAssistant.TryConnect(command, out cmdResult);
                        }
                        if (nBody.Contains("MOON"))
                        {
                            command = String.Format("HPOP */Satellite/{0} Force ThirdBodyGravity Moon On JPLDEFile", StkCdmSatelliteName);
                            StkAssistant.TryConnect(command, out cmdResult);
                        }
                    }
                }
                else
                {
                    command = String.Format("HPOP */Satellite/{0} Force ThirdBodyGravity Sun Off", StkCdmSatelliteName);
                    StkAssistant.TryConnect(command, out cmdResult);
                    command = String.Format("HPOP */Satellite/{0} Force ThirdBodyGravity Moon Off", StkCdmSatelliteName);
                    StkAssistant.TryConnect(command, out cmdResult);
                }

                if (!string.IsNullOrEmpty(SolidEarthTidesPerturbation) &&
                    SolidEarthTidesPerturbation.ToUpper() == "YES")
                {
                    command = String.Format("HPOP */Satellite/{0} Force SolidTides Full", StkCdmSatelliteName); // Permanent only or full tide?
                    StkAssistant.TryConnect(command, out cmdResult);
                }
                else
                {
                    command = String.Format("HPOP */Satellite/{0} Force SolidTides Off", StkCdmSatelliteName);
                    StkAssistant.TryConnect(command, out cmdResult);
                }

                command = String.Format("HPOP */Satellite/{0} Force OceanTides Off", StkCdmSatelliteName);
                StkAssistant.TryConnect(command, out cmdResult);

                if (!string.IsNullOrEmpty(DragModel))
                {
                    bool noDrag = (StkAssistant.GetSatellitePerigee(StkCdmSatellitePath, EpochISOYMD) > _leoLimit * 1E3); // m
                    if (!"JACCHIA70DCA|NONE".Contains(DragModel))
                    {
                        //outputToDebugLog(String.Format("WARNING: Undefined drag model: {0}", dragModel[index].InnerText));
                        //warning = true;
                    }
                    if ((DragModel.ToUpper() == "NONE") || noDrag)
                    {
                        command = String.Format("HPOP */Satellite/{0} Drag Off", StkCdmSatelliteName);
                        StkAssistant.TryConnect(command, out cmdResult);
                    }
                    else
                    {
                        command = String.Format("HPOP */Satellite/{0} Drag On {1} {2} \"Jacchia 1970\" File \"{3}SpaceWeather-v1.2.txt\"",
                                                StkCdmSatelliteName, Math.Sign(BallisticCoefficient).ToString("F1"), Math.Abs(BallisticCoefficient).ToString("F6"), StkAssistant.StkDataDirectory);
                        StkAssistant.TryConnect(command, out cmdResult);
                    }
                }


                if (!string.IsNullOrEmpty(SolarRadiationPerturbation) &&
                    SolarRadiationPerturbation.ToUpper() == "YES")
                {
                    command = String.Format("HPOP */Satellite/{0} Force SRP On Model Spherical {1} {2} ShadowModel Cylindrical BoundaryMitigation On",
                                            StkCdmSatelliteName, Math.Sign(SolarRadiationCoefficient).ToString("F1"), Math.Abs(SolarRadiationCoefficient).ToString("F6"));
                    StkAssistant.TryConnect(command, out cmdResult);
                }
                else
                {
                    command = String.Format("HPOP */Satellite/{0} Force SRP Off", StkCdmSatelliteName);
                    StkAssistant.TryConnect(command, out cmdResult);
                }

                command = String.Format("HPOP */Satellite/{0} Force RadiationPressure Albedo Off Thermal Off", StkCdmSatelliteName);
                StkAssistant.TryConnect(command, out cmdResult);

                command = String.Format("HPOP */Satellite/{0} Integrator IntegMethod RKF78 StepControl RelativeError 1E-13", StkCdmSatelliteName);
                StkAssistant.TryConnect(command, out cmdResult);
                // Set HPOP Options
                //stkExecute(String.Format("HPOP */Satellite/{0} Options Mass " + FloatToStr(mass)), satObj));
                #endregion Force Model

                #region Covariance
                // Set up covariance
                command = String.Format("HPOP */Satellite/{0} Covariance On", StkCdmSatelliteName);
                StkAssistant.TryConnect(command, out cmdResult);

                command = String.Format("HPOP */Satellite/{0} Covariance Frame LVLH", StkCdmSatelliteName);
                StkAssistant.TryConnect(command, out cmdResult);
                command = String.Format("HPOP */Satellite/{0} Covariance Consider Off", StkCdmSatelliteName);
                StkAssistant.TryConnect(command, out cmdResult);

                // Force non-zero principal components
                if (xx == 0)
                {
                    xx = small;
                }
                if (yy == 0)
                {
                    yy = small;
                }
                if (zz == 0)
                {
                    zz = small;
                }
                if (VxVx == 0)
                {
                    VxVx = small;
                }
                if (VyVy == 0)
                {
                    VyVy = small;
                }
                if (VzVz == 0)
                {
                    VzVz = small;
                }
                string ldMatrix = xx + " ";
                ldMatrix += yx + " " + yy + " ";
                ldMatrix += zx + " " + zy + " " + zz + " ";
                ldMatrix += Vxx + " " + Vxy + " " + Vxz + " " + VxVx + " ";
                ldMatrix += Vyx + " " + Vyy + " " + Vyz + " " + VyVx + " " + VyVy + " ";
                ldMatrix += Vzx + " " + Vzy + " " + Vzz + " " + VzVx + " " + VzVy + " " + VzVz;
                string covCommand = String.Format("HPOP */Satellite/{0} Covariance PosVel {1}", StkCdmSatelliteName, ldMatrix);
                string covColor   = color;
                if (!StkAssistant.TryConnect(covCommand, out cmdResult))
                {
                    //notes.Add("<span style=\"color:red\">WARNING: " + satObjName.Substring(3) + " CDM covariance matrix not positive definite</span>");
                    string zero    = "0";
                    string nonzero = "1000";
                    ldMatrix   = nonzero + " ";
                    ldMatrix  += zero + " " + nonzero + " ";
                    ldMatrix  += zero + " " + zero + " " + nonzero + " ";
                    ldMatrix  += zero + " " + zero + " " + zero + " " + nonzero + " ";
                    ldMatrix  += zero + " " + zero + " " + zero + " " + zero + " " + nonzero + " ";
                    ldMatrix  += zero + " " + zero + " " + zero + " " + zero + " " + zero + " " + nonzero;
                    covColor   = "#FF0000";
                    covCommand = String.Format("HPOP */Satellite/{0} Covariance PosVel {1}", StkCdmSatelliteName, ldMatrix);
                    StkAssistant.TryConnect(covCommand, out cmdResult);
                    command = String.Format("VO */Satellite/{0} Covariance Basic Show Off", StkCdmSatelliteName);
                    StkAssistant.TryConnect(command, out cmdResult);
                }
                else
                {
                    command = String.Format("VO */Satellite/{0} Covariance Scale 3.0", StkCdmSatelliteName);
                    StkAssistant.TryConnect(command, out cmdResult);
                    command = String.Format("VO */Satellite/{0} Covariance Basic Show On Color {1} LineWidth 2 Translucency 50", StkCdmSatelliteName, covColor);
                    StkAssistant.TryConnect(command, out cmdResult);
                }
                #endregion Covariance

                command = String.Format("Propagate */Satellite/{0} {1} {2}", StkCdmSatelliteName, StkAssistant.ScenarioStartTime, StkAssistant.ScenarioStopTime);
                StkAssistant.TryConnect(command, out cmdResult);

                if (zoomTo)
                {
                    StkAssistant.TryConnect(String.Format("VO * ViewFromTo Normal From */Satellite/{0}", StkCdmSatelliteName), out cmdResult);
                }
            }
            finally
            {
                command = "BatchGraphics * Off";
                StkAssistant.TryConnect(command, out cmdResult);
            }
            return(true);
        }
Exemple #12
0
 public void SetImage(DragModel dragModel)
 {
     this.Image.sprite = dragModel != default(DragModel) ? dragModel.Sprite : this.DefaultSprite;
 }