void IScriptable.SetProperty(string name, string value)
        {
            try
            {
                if (LayerManager.CurrentSelection is LayerMap)
                {
                    LayerMap map = LayerManager.CurrentSelection as LayerMap;
                    if (map.Frame.reference == ReferenceFrames.Custom)
                    {
                        ReferenceFrame frame = map.Frame;
                        double         val;
                        if (name.ToLower() == "scale")
                        {
                            val = double.Parse(value);

                            frame.Scale = val;
                            return;
                        }

                        if (name.ToLower().StartsWith("translate."))
                        {
                            val = double.Parse(value);
                            Vector3d translate = frame.translation;
                            switch (name.ToLower())
                            {
                            case "translate.x":
                                translate.X = val;

                                break;

                            case "translate.y":
                                translate.Y = val;
                                break;

                            case "translate.z":
                                translate.Z = val;
                                break;
                            }
                            frame.translation = translate;
                            return;
                        }

                        frame.SetProp(name, value);
                    }
                }
            }
            catch
            {
            }
        }
Esempio n. 2
0
        void IScriptable.SetProperty(string name, string value)
        {
            try
            {
                if (LayerManager.CurrentSelection is LayerMap)
                {
                    LayerMap map = LayerManager.CurrentSelection as LayerMap;
                    if (map.Frame.reference == ReferenceFrames.Custom)
                    {
                        ReferenceFrame frame = map.Frame;
                        double         val;
                        if (name.ToLower() == "scale")
                        {
                            val = double.Parse(value);

                            frame.Scale = val;
                            return;
                        }

                        if (name.ToLower().StartsWith("translate."))
                        {
                            val = double.Parse(value);
                            Vector3d translate = frame.translation;
                            switch (name.ToLower())
                            {
                            case "translate.x":
                                translate.X = val;

                                break;

                            case "translate.y":
                                translate.Y = val;
                                break;

                            case "translate.z":
                                translate.Z = val;
                                break;
                            }
                            frame.translation = translate;
                            return;
                        }

                        frame.SetProp(name, value);
                    }
                }
                if (LayerManager.CurrentSelection is Layer)
                {
                    //MethodInvoker doIt = delegate
                    //{
                    //    Earth3d.MainWindow.Text = value;
                    //};

                    //Earth3d.MainWindow.Invoke(doIt);

                    Layer layer = LayerManager.CurrentSelection as Layer;
                    if (layer is Object3dLayer)
                    {
                        Object3dLayer object3d = layer as Object3dLayer;
                        double        val;
                        if (name.ToLower() == "scale")
                        {
                            val = double.Parse(value);

                            object3d.Scale = new Vector3d(val, val, val);
                            return;
                        }

                        if (name.ToLower().StartsWith("translate."))
                        {
                            val = double.Parse(value);
                            Vector3d translate = object3d.Translate;
                            switch (name.ToLower())
                            {
                            case "translate.x":
                                translate.X = val;

                                break;

                            case "translate.y":
                                translate.Y = val;
                                break;

                            case "translate.z":
                                translate.Z = val;
                                break;
                            }
                            object3d.Translate = translate;
                        }

                        layer.SetProp(name, value);
                    }
                }
            }
            catch
            {
            }
        }