コード例 #1
0
 object IObjectCollection.this[string name]
 {
     get
     {
         foreach (object o in list)
         {
             if (o is IAssociatedObject)
             {
                 string n = this.GetRelativeName(o as IAssociatedObject);
                 if (n.Equals(name))
                 {
                     if (o is ICategoryObject | o is ICategoryArrow)
                     {
                         return(o);
                     }
                 }
             }
             if (o is IObjectLabel)
             {
                 IObjectLabel ol = o as IObjectLabel;
                 return(ol.Object);
             }
             if (o is IArrowLabel)
             {
                 IArrowLabel al = o as IArrowLabel;
                 return(al.Arrow);
             }
         }
         return(null);
     }
 }
コード例 #2
0
ファイル: PureObjectLabel.cs プロジェクト: Erroman/universal
        /// <summary>
        /// Gets all object aliases
        /// </summary>
        /// <param name="baseObject">Base object</param>
        /// <param name="o">object</param>
        /// <param name="list">List of aliases</param>
        /// <param name="type">Type of alias</param>
        public static void GetAllObjectAliases(IAssociatedObject baseObject, object o, List <string> list, object type)
        {
            IAssociatedObject ass = o as IAssociatedObject;
            IObjectLabel      l   = ass.Object as IObjectLabel;

            GetAllAliases(baseObject, l, list, type);
        }
コード例 #3
0
        protected void Add(object o, DataRow row, TestData test)
        {
            IObjectLabel l = o as IObjectLabel;

            ICategoryObject co   = l.Object;
            string          name = l.GetName(collection);

            if (co is global::Regression.AliasRegression)
            {
                test.AddRegression(name, (uint)row[3], collection);
                return;
            }
            if (o is IProperties)
            {
                object ob = (o as IProperties).Properties;
                if (ob.GetType().Equals(typeof(DataPerformer.UI.Labels.GraphLabel)))
                {
                    /*       DataPerformer.UI.Interfaces.IGraphLabel lab = ob as DataPerformer.UI.Labels.GraphLabel;
                     *     Tuple<Dictionary<string, Color>[], Dictionary<string, bool>[],
                     * Dictionary<string, string>[], string[], int[]>[] data = null;// lab.Data;
                     * Tuple<Dictionary<string, Color>[], Dictionary<string, bool>[],
                     * Dictionary<string, string>[], string[], int[]> t = data[0];
                     *     Dictionary<string, Color>[] d = t.Item1;
                     *   IEnumerable<string> keys =  d[0].Keys;
                     *    DataPerformer.DataConsumer cons = co as DataPerformer.DataConsumer;
                     *    test.AddChart(name, cons.Start, cons.Step, cons.Steps, lab.Data[0].Item4[1],
                     *        keys.ToArray<string>(), collection);*/
                    return;
                }
            }
            onAdd(o, row, test);
        }
コード例 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="label">Object label</param>
 public FormSimulinkContainer(IObjectLabel label)
     : this()
 {
     this.label = label;
     UpdateFormUI();
     userControlSimulinkContainer.TheObject = label.Object;
 }
コード例 #5
0
        /// <summary>
        /// Gets root label of control
        /// </summary>
        /// <param name="control">The control</param>
        /// <returns>The root label</returns>
        public static IObjectLabel GetRootLabel(this Control control)
        {
            IObjectLabel l = null;

            GetRootLabel(control, ref l);
            return(l);
        }
コード例 #6
0
 public FormTransformationFunction(IObjectLabel label)
     : this()
 {
     this.label = label;
     UpdateFormUI();
     transform = label.Object as RationalTransformControlSystemFunctionWrapper;
 }
コード例 #7
0
 static private Form CreateControlSystemForm(IObjectLabel l)
 {
     ControlSystems.Data.RationalTransformControlSystemData tr =
         l.Object as ControlSystems.Data.RationalTransformControlSystemData;
     ControlSystems.UI.Forms.FormTransformationFunction form =
         new ControlSystems.UI.Forms.FormTransformationFunction(l);
     form.ShowComboBox();
     try
     {
         form.Measurements = tr.InputMeasurements;
         form.SelectedItem = tr.Input;
     }
     catch (Exception ex)
     {
         ex.ShowError(10);
     }
     form.SelectMeasure += delegate(object ob)
     {
         if (ob == null)
         {
             tr.Input = "";
         }
         tr.Input = ob + "";
     };
     try
     {
         form.Feedback = new Feedback(tr);
     }
     catch (Exception exc)
     {
         exc.ShowError(10);
     }
     return(form);
 }
コード例 #8
0
 /// <summary>
 /// Creates a form for component properties editor
 /// </summary>
 /// <param name="comp">The component</param>
 /// <returns>The result form</returns>
 public override object CreateForm(INamedComponent comp)
 {
     if (comp is IObjectLabel)
     {
         IObjectLabel    ol     = comp as IObjectLabel;
         ICategoryObject obj    = ol.Object;
         Camera          camera = obj.GetSimpleObject <Camera>();
         if (camera != null)
         {
         }
         if (obj is Motion6D.SerializablePosition)
         {
             Motion6D.Interfaces.IPosition p = obj as Motion6D.Interfaces.IPosition;
             object o = p.Parameters;
             if (o != null)
             {
                 if (o is Motion6D.Interfaces.IVisible)
                 {
                     Motion6D.Interfaces.IVisible v = o as Motion6D.Interfaces.IVisible;
                     object ob = factory.CreateForm(p, v);
                     if (ob != null)
                     {
                         if (ob is Form)
                         {
                             Form f = ob as Form;
                             return(f);
                         }
                     }
                 }
             }
         }
     }
     return(null);
 }
コード例 #9
0
 public FormCtxExternalImage(IObjectLabel label)
     : this()
 {
     this.label = label;
     userControlContextImage.Image = label.Object as ExternalContextImage;
     UpdateFormUI();
 }
コード例 #10
0
        /// <summary>
        /// Sets parents of objects
        /// </summary>
        /// <param name="desktop">The desktop</param>
        public void SetParents(IDesktop desktop)
        {
            IEnumerable <IObjectLabel> objs = desktop.Objects;
            INamedComponent            comp = null;

            foreach (IObjectLabel ol in objs)
            {
                if (ol.Object == this)
                {
                    comp = ol;
                    break;
                }
            }
            IEnumerable <object> objects = this.desktop.Components;

            foreach (INamedComponent nc in objects)
            {
                if (nc is IObjectLabel)
                {
                    IObjectLabel l = nc as IObjectLabel;
                    if (l.Object is IObjectContainer)
                    {
                        IObjectContainer oc = l.Object as IObjectContainer;
                        oc.Desktop.SetParents();
                    }
                }
                nc.Parent = comp;
            }
        }
コード例 #11
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="source">Arrow source</param>
 /// <param name="target">Arrow target</param>
 public ArrowPanel(IObjectLabel source, IObjectLabel target)
 {
     objects    = new IObjectLabel[2];
     objects[0] = source;
     objects[1] = target;
     initialize();
 }
コード例 #12
0
ファイル: PanelUnary.cs プロジェクト: Erroman/universal
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="operation">Operation</param>
        /// <param name="w">Width</param>
        public PanelUnary(IObjectOperation operation, int w)
        {
            Width          = w;
            this.operation = operation;
            ICategoryObject o = operation as ICategoryObject;

            label = o.Object as IObjectLabel;
            PictureBox p = new PictureBox();

            p.Image = NamedComponent.GetImage(label);
            int y = 10;
            int x = 10;

            p.Left = x;
            p.Top  = y;
            Controls.Add(p);
            y += p.Height + 10;
            Label lab = new Label();

            lab.Text = label.RootName;            //NamedComponent.GetText(label) + "";
            lab.Left = x;
            lab.Top  = y;
            Controls.Add(lab);
            y      += lab.Height + 10;
            cb.Top  = y;
            cb.Left = x;
            Controls.Add(cb);
            y     += cb.Height + 10;
            Height = y;
        }
コード例 #13
0
ファイル: PureDesktop.cs プロジェクト: Erroman/universal
 /// <summary>
 /// Gets objects and arrows of associated object
 /// </summary>
 /// <param name="ao">The associated object</param>
 /// <param name="objects">Objects</param>
 /// <param name="arrows">Arrows</param>
 protected virtual void GetObjects(IAssociatedObject ao, IList <ICategoryObject> objects, IList <ICategoryArrow> arrows)
 {
     if (ao is IObjectContainer)
     {
         IObjectContainer     oc = ao as IObjectContainer;
         IDesktop             d  = oc.Desktop;
         IEnumerable <object> c  = d.AllComponents;
         foreach (object o in c)
         {
             if (o is IObjectLabel)
             {
                 IObjectLabel ol = o as IObjectLabel;
                 GetObjects(ol.Object, objects, arrows);
             }
             if (o is IArrowLabel)
             {
                 IArrowLabel al = o as IArrowLabel;
                 GetObjects(al.Arrow, objects, arrows);
             }
         }
     }
     else
     {
         GetObjectsPrivate(ao, objects, arrows);
     }
 }
コード例 #14
0
ファイル: PureDesktop.cs プロジェクト: Erroman/universal
 public void PreSave()
 {
     this.SetParents();
     PureObjectLabel.SetType(objects);
     PureArrowLabel.SetType(arrows);
     foreach (IArrowLabel label in arrows)
     {
         if (objects.Contains(label.Source))
         {
             label.SourceNumber = objects.IndexOf(label.Source);
         }
         else
         {
             IObjectLabel     ls    = label.Source.GetRoot(this) as IObjectLabel;
             int              sn    = objects.IndexOf(ls);
             IObjectContainer scont = ls.Object as IObjectContainer;
             string           ns    = scont.GetName(label.Source);
             label.SourceNumber = new object[] { sn, ns };
         }
         if (objects.Contains(label.Target))
         {
             label.TargetNumber = objects.IndexOf(label.Target);
         }
         else
         {
             IObjectLabel     lt    = label.Target.GetRoot(this) as IObjectLabel;
             int              tn    = objects.IndexOf(lt);
             IObjectContainer tcont = lt.Object as IObjectContainer;
             string           nt    = tcont.GetName(label.Target);
             label.TargetNumber = new object[] { tn, nt };
         }
     }
 }
コード例 #15
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="label">Label</param>
 public FormKalmanFilter(IObjectLabel label)
     : this()
 {
     this.label = label;
     UpdateFormUI();
     userControlKalmanFilter.Filter = label.Object as KalmanFilter;
 }
コード例 #16
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="label">Label</param>
 public FormVectorConsumer(IObjectLabel label)
     : this()
 {
     this.label = label;
     consumer   = label.Object as VectorFormulaConsumer;
     UpdateFormUI();
 }
コード例 #17
0
 public FormBitmapTransformer(IObjectLabel label)
     : this()
 {
     ResourceService.Resources.LoadControlResources(this, ImageTransformations.Utils.ControlUtilites.Resources);
     this.label     = label;
     trans          = label.Object as BitmapTransformer;
     coord          = userControlComboboxListCoordinates.Boxes.ToArray();
     colors         = userControlComboboxListColors.Boxes.ToArray();
     string[, ,] se = trans.ExternalColors;
     if (se != null)
     {
         if (se.Length > 0)
         {
             numericUpDownL.Value = trans.Left;
             numericUpDownT.Value = trans.Top;
             numericUpDownR.Value = se.GetLength(0) - trans.Left - 1;
             numericUpDownB.Value = se.GetLength(1) - trans.Top - 1;
         }
     }
     setNumbers();
     fill();
     select();
     performer         = BitmapIndicator.Indicators.ObjectIndicator.Create(toolStripStatusLabel, null, panelImage);
     panelImage.Cursor = Cursors.Cross;
     this.UpdateFormUI();
 }
コード例 #18
0
ファイル: FormContainer.cs プロジェクト: Erroman/universal
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="label">Label</param>
 public FormContainer(IObjectLabel label)
     : this()
 {
     this.label = label;
     container  = label.Object as ObjectContainer;
     this.UpdateFormUI();
 }
コード例 #19
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label">Label of component</param>
        public FormPointCollection(IObjectLabel label)
        {
            InitializeComponent();
            this.label = label;
            draw       = label.Object as DrawSeries;
            Text       = label.Name;
            string[] names = PointCollectionChooserFactory.Factory.Names;
            comboBoxType.FillCombo(names);
            PanelChart panel = new PanelChart(new int[, ] {
                { 80, 20 }, { 30, 40 }
            });

            panel.Width  = panelChart.Width - 100;
            panel.Height = panelChart.Height - 100;
            panel.Top    = 50;
            panel.Left   = 50;
            panel.Dock   = DockStyle.Fill;
            performer    = panel.Performer;
            performer.Resize();
            panelChart.Controls.Add(panel);
            SimpleCoordinator coordinator = new SimpleCoordinator(5, 5, performer);

            performer.Coordinator = coordinator;
            setChooser();
            string fn = draw.FactoryName;

            if (fn != null)
            {
                comboBoxType.SelectCombo(fn);
            }
        }
コード例 #20
0
 private void SetControl(object obj)
 {
     if (obj is Control)
     {
         Control c = obj as Control;
         c.Dock = DockStyle.Fill;
         panelCenter.Controls.Add(c);
     }
     if (obj is IObjectLabel)
     {
         child = obj as IObjectLabel;
         if (icon == null)
         {
             if (child is INonstandardLabel)
             {
                 INonstandardLabel nl = child as INonstandardLabel;
                 Image             im = nl.Image as Image;
                 if (im != null)
                 {
                     icon = im;
                     pictureBoxIcon.Image = im;
                 }
             }
         }
         properties = child;
     }
 }
コード例 #21
0
        void ProcessArrow(IDataConsumer dc, IObjectLabel label, Arrow arrow, List <Arrow> absc)
        {
            BlockPort    bp = arrow.Source;
            string       to = bp.Block;
            IObjectLabel l  = desktop[to] as IObjectLabel;

            if (l == null)
            {
                return;
            }
            DataLink dl = new DataLink();

            try
            {
                if (desktop is PureDesktopPeer)
                {
                    PureDesktopPeer pdp = desktop as PureDesktopPeer;
                    if (label.Ord < l.Ord)
                    {
                        absc.Add(arrow);
                        return;
                    }
                    pdp.AddArrowWithExistingLabels(dl, label, l, "", "");
                }
            }
            catch (Exception)
            {
                absc.Add(arrow);
            }
        }
コード例 #22
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="l">Label of object</param>
 public FormFuncAccumulator(IObjectLabel l)
     : this()
 {
     this.l = l;
     userControlFuncAccumulatorFull.Function = l.Object as DataPerformer.FunctionAccumulator;
     UpdateFormUI();
 }
コード例 #23
0
        /// <summary>
        /// The on mouse down event handler
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The event arguments</param>
        private void onMouseDownMoveEventHandler(object sender, MouseEventArgs e)
        {
            if (!e.IsArrowClick())
            {
                return;
            }
            IObjectLabel lab = Label;

            if (lab == null)
            {
                return;
            }
            PanelDesktop  desktop = Parent as PanelDesktop;
            PaletteButton active  = desktop.Tools.Active;

            if (active != null)
            {
                if (active.IsArrow & !(active.ReflectionType == null))
                {
                    try
                    {
                        ICategoryArrow arrow = desktop.Tools.Factory.CreateArrow(active);
                        arrow.Source              = lab.Object;
                        desktop.ActiveArrow       = arrow;
                        desktop.ActiveObjectLabel = lab;
                        return;
                    }
                    catch (Exception ex)
                    {
                        ex.ShowError(10);
                    }
                }
            }
        }
コード例 #24
0
        private void addObjectNode(TreeNode parent, IObjectLabel label)
        {
            if (tree == null)
            {
                return;
            }
            NamedNode node = new NamedNode(label, false);

            if (label is IObjectLabelUI)
            {
                IObjectLabelUI lab = label as IObjectLabelUI;
                lab.Node = node;
            }
            parent.Nodes.Add(node);
            if (!(label.Object is IObjectContainer))
            {
                return;
            }
            IObjectContainer            cont = label.Object as IObjectContainer;
            IDesktop                    desk = cont.Desktop;
            Dictionary <string, object> t    = cont.Interface;

            foreach (string str in t.Keys)
            {
                INamedComponent comp = desk[str];
                NamedNode       n    = new NamedNode(comp, false);
                node.Nodes.Add(n);
            }
        }
コード例 #25
0
ファイル: MotionFactory.cs プロジェクト: Erroman/universal
 /// <summary>
 /// Creates a form for component properties editor
 /// </summary>
 /// <param name="comp">The component</param>
 /// <returns>The result form</returns>
 public override object CreateForm(INamedComponent comp)
 {
     if (comp is IObjectLabel)
     {
         IObjectLabel lab = comp as IObjectLabel;
         // The object of component
         ICategoryObject obj = lab.Object;
         if (obj is Motion6D.SerializablePosition)
         {
             Motion6D.Interfaces.IPosition p = obj as Motion6D.Interfaces.IPosition;
             object o = p.Parameters;
             if (o != null)
             {
                 if (o is Motion6D.PhysicalFieldBase)
                 {
                     return(new Motion6D.UI.Forms.FormField3D(lab, o as Motion6D.PhysicalField3D));
                 }
                 if (o is PhysicalField.SphericalFieldWrapper)
                 {
                     return(new Motion6D.UI.FormSphericalMagnnetic(lab, o as PhysicalField.SphericalFieldWrapper));
                 }
                 if (o is Motion6D.InertialSensorData)
                 {
                     return(new Motion6D.UI.FormInertialSystem(lab, o as Motion6D.InertialSensorData));
                 }
             }
         }
         if (obj is Motion6D.InertialReferenceFrame)
         {
             return(new Motion6D.UI.FormInertia(lab));
         }
         if (obj is Motion6D.ReferenceFrameData)
         {
             return(new Motion6D.UI.Forms.FormFrameData(lab));
         }
         if (obj is Motion6D.RigidReferenceFrame)
         {
             return(new Motion6D.UI.Forms.FormRigidFrame(lab));
         }
         if (obj is Motion6D.AcceleratedPosition)
         {
             return(new Motion6D.UI.FormAcceleratedPoint(lab));
         }
         if (obj is Motion6D.PositionCollectionData)
         {
             return(new FormPointsCollection(lab));
         }
     }
     if (comp is IArrowLabel)
     {
         IArrowLabel    l     = comp as IArrowLabel;
         ICategoryArrow arrow = l.Arrow;
         if (arrow is MechanicalAggregateLink)
         {
             return(new FormAggregateLink(l));
         }
     }
     return(null);
 }
コード例 #26
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="label">Object label</param>
 /// <param name="data">Inertial sensor</param>
 public FormInertialSystem(IObjectLabel label, InertialSensorData data)
     : this()
 {
     this.label = label;
     this.data  = data;
     UpdateFormUI();
     post();
 }
コード例 #27
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="label">Object label</param>
 /// <param name="lab">Graph label</param>
 public FormExternalChart(IObjectLabel label, GraphLabel lab)
     : this()
 {
     this.label = label;
     this.lab   = lab;
     UpdateFormUI();
     consumer = label.Object as DataConsumer;
 }
コード例 #28
0
 public FormBitmapSelection(IObjectLabel label)
     : this()
 {
     ResourceService.Resources.LoadControlResources(this, ImageNavigation.Utils.ControlUtilites.Resources);
     this.label = label;
     UpdateFormUI();
     selection = label.Object as BitmapSelection;
 }
コード例 #29
0
ファイル: ArrowLabel.cs プロジェクト: Erroman/universal
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="button">Associated button</param>
 /// <param name="arrow">Associated arrow</param>
 /// <param name="source">Associated source</param>
 /// <param name="target">Associated target</param>
 public ArrowLabel(IPaletteButton button, ICategoryArrow arrow,
                   IObjectLabel source, IObjectLabel target) : base(button)
 {
     this.arrow  = arrow;
     this.source = source;
     this.target = target;
     Initialize();
 }
コード例 #30
0
 public static IChildObjectLabel GetPanel(IObjectLabel c)
 {
     if (!children.ContainsKey(c))
     {
         return(null);
     }
     return(children[c]);
 }