/// <summary> /// Creates object the corresponds to button /// </summary> /// <param name="button">The button</param> /// <returns>Created object</returns> public override ICategoryObject CreateObject(IPaletteButton button) { Type type = button.ReflectionType; string kind = button.Kind; if (type.Equals(typeof(Basic.Events.ImportedEvent))) { return(new Basic.Events.ImportedEvent(kind)); } if (type.Equals(typeof(Basic.Data.Events.ImportedEventReader))) { return(new Basic.Data.Events.ImportedEventReader(kind)); } if (type.Equals(typeof(Basic.Data.Events.ImportedEventWriter))) { return(new Basic.Data.Events.ImportedEventWriter(kind)); } if (type.Equals(typeof(Basic.Data.Events.ForcedEventData))) { if (kind.Equals("CircularControl2D")) { double a = 0; Basic.Data.Events.ForcedEventData forcedEventData = new Basic.Data.Events.ForcedEventData(); forcedEventData.Types = new List <Tuple <string, object> >() { new Tuple <string, object>("X", a), new Tuple <string, object>("Y", a) }; forcedEventData.Initial = new object[] { a, a }; return(forcedEventData); } } return(null); }
/// <summary> /// Creates object label /// </summary> /// <param name="button">Corresponding button</param> /// <returns>The object label</returns> public override IObjectLabelUI CreateObjectLabel(IPaletteButton button) { Type type = button.ReflectionType; if (type == null) { return(null); } if (type.IsSubclassOf(typeof(Camera))) { object ob = factory.CreateLabel(type); if (ob != null) { return(ob as IObjectLabelUI); } } if (type.Equals(typeof(SerializablePosition))) { object ob = factory.CreateLabel(button.Kind); if (ob != null) { return(ob as IObjectLabelUI); } } return(null); }
/// <summary> /// Creates object the corresponds to button /// </summary> /// <param name="button">The button</param> /// <returns>Created object</returns> public override ICategoryObject CreateObject(IPaletteButton button) { string kind = button.Kind; // Kind of the object Type type = button.ReflectionType; if (type.IsSubclassOf(typeof(Camera))) { return(factory.NewCamera()); } if (type.Equals(typeof(Motion6D.SerializablePosition))) { object ob = factory.CreateObject(kind); // Usage of the kind if (ob != null) { SerializablePosition pos = new SerializablePosition(); pos.Parameters = ob; if (ob is IPositionObject) { IPositionObject po = ob as IPositionObject; po.Position = pos; } return(pos); } } return(null); }
/// <summary> /// Constructor from correspond button /// </summary> /// <param name="button">the button</param> protected NamedComponent(IPaletteButton button) { this.button = button; this.type = button.Type; this.kind = button.Kind; name = ""; }
IObjectLabelUI IDefaultLabelFactory.CreateObjectLabel(IPaletteButton button) { if (button.ReflectionType.GetInterface(typeof(IObjectContainer).FullName) != null) { return(new ContainerObjectLabel(button)); } return(new ObjectLabel(button)); }
/// <summary> /// Object creation /// </summary> /// <param name="button">Corresponding button</param> /// <returns>The object</returns> public override ICategoryObject CreateObject(IPaletteButton button) { if (button.ReflectionType.Equals(typeof(DataPerformer.DataConsumer))) { return(new DataConsumer(0)); } return(null); }
/// <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(); }
/// <summary> /// Gets image number /// </summary> /// <param name="component">Component</param> /// <returns>The image number</returns> public static int GetImageNumber(INamedComponent component) { IPaletteButton button = GetButton(component); if (button == null) { return(0); } return(button.ImageNumber); }
public override IObjectLabelUI CreateObjectLabel(IPaletteButton button) { Type type = button.ReflectionType; if (type.Equals(typeof(BitmapSelection))) { (new BitmapSelectionLabel()).CreateLabelUI(button.ButtonImage, false); } return(Create(type)); }
/// <summary> /// Creates object label /// </summary> /// <param name="button">Corresponding button</param> /// <returns>The object label</returns> public override IObjectLabelUI CreateObjectLabel(IPaletteButton button) { Type t = button.ReflectionType; if (t.Equals(typeof(IObjectContainer))) { return(new ContainerObjectLabel(button)); } return(null); }
/// <summary> /// Creates object from button /// </summary> /// <param name="button">The button</param> /// <returns>The object</returns> public override ICategoryObject CreateObject(IPaletteButton button) { if (button.ReflectionType.Equals(typeof(LibraryObjectWrapper))) { return(LibraryObjectWrapper.Create(button.Kind)); } if (button.ReflectionType.Equals(typeof(ObjectContainer))) { return(load(button.Kind)); } return(null); }
/// <summary> /// Gets button from category /// </summary> /// <param name="category">The category</param> /// <returns>The button</returns> public virtual IPaletteButton GetObjectButton(ICategory category) { foreach (IUIFactory f in factories) { IPaletteButton b = f.GetObjectButton(category); if (b != null) { return(b); } } return(null); }
/// <summary> /// Gets button from arrow /// </summary> /// <param name="arrow">The arrow</param> /// <returns>The arrow</returns> public virtual IPaletteButton GetArrowButton(ICategoryArrow arrow) { foreach (IUIFactory f in factories) { IPaletteButton b = f.GetArrowButton(arrow); if (b != null) { return(b); } } return(null); }
/// <summary> /// Gets button from object /// </summary> /// <param name="obj">The object</param> /// <returns>The button</returns> public virtual IPaletteButton GetObjectButton(ICategoryObject obj) { foreach (IUIFactory f in factories) { IPaletteButton b = f.GetObjectButton(obj); if (b != null) { return(b); } } if (defaultValue) { } return(null); }
/// <summary> /// Creates object label /// </summary> /// <param name="button">Corresponding button</param> /// <returns>The object label</returns> public virtual IObjectLabelUI CreateObjectLabel(IPaletteButton button) { foreach (IUIFactory f in factories) { IObjectLabelUI o = f.CreateObjectLabel(button); if (o != null) { return(o); } } if (defaultValue) { return(factory.CreateObjectLabel(button)); } return(null); }
/// <summary> /// Creates arrow label /// </summary> /// <param name="button">Corresponding button</param> /// <param name="arrow">Corresponding arrow</param> /// <param name="source">Soource label</param> /// <param name="target">Target label</param> /// <returns>The arrow label</returns> public virtual IArrowLabelUI CreateArrowLabel(IPaletteButton button, ICategoryArrow arrow, IObjectLabel source, IObjectLabel target) { foreach (IUIFactory f in factories) { IArrowLabelUI a = f.CreateArrowLabel(button, arrow, source, target); if (a != null) { return(a); } } if (defaultValue) { return(factory.CreateArrowLabel(button, arrow, source, target)); } return(null); }
private static void GetButtons(Control control, Dictionary <Type, Dictionary <string, IPaletteButton> > dictionary) { if (control is IPaletteButton) { IPaletteButton b = control as IPaletteButton; Dictionary <string, IPaletteButton> d = null; Type t = b.ReflectionType; if (dictionary.ContainsKey(t)) { d = dictionary[t]; } else { d = new Dictionary <string, IPaletteButton>(); dictionary[t] = d; } d[b.Kind] = b; } foreach (Control c in control.Controls) { GetButtons(c, dictionary); } if (control is ToolBar) { ToolBar tb = control as ToolBar; foreach (object o in tb.Buttons) { if (o is IPaletteButton) { IPaletteButton b = o as IPaletteButton; Dictionary <string, IPaletteButton> d = null; Type t = b.ReflectionType; if (dictionary.ContainsKey(t)) { d = dictionary[t]; } else { d = new Dictionary <string, IPaletteButton>(); dictionary[t] = d; } d[b.Kind] = b; } } } }
/// <summary> /// Creates object the corresponds to button /// </summary> /// <param name="button">The button</param> /// <returns>Created object</returns> public override ICategoryObject CreateObject(IPaletteButton button) { Type type = button.ReflectionType; string kind = button.Kind; // Kind of object if (type.Equals(typeof(Motion6D.SerializablePosition))) { Motion6D.SerializablePosition p = new Motion6D.SerializablePosition(); if (kind.Equals(SphericalVectorPotentialGragient)) { PhysicalField.SphericalFieldWrapper ph = new PhysicalField.SphericalFieldWrapper((int)SphericalFields.SphericalType.VectorPotentialGragient); p.Parameters = ph; Motion6D.Interfaces.IPositionObject po = ph; po.Position = p; return(p); } if (kind.Equals(Measurements_of_3D_field)) { Motion6D.PhysicalFieldMeasurements3D ph = new Motion6D.PhysicalFieldMeasurements3D(); p.Parameters = ph; Motion6D.Interfaces.IPositionObject po = ph; po.Position = p; return(p); } if (kind.Equals(InertialNavigationSystem)) { Motion6D.InertialSensorData sensor = new Motion6D.InertialSensorData(); p.Parameters = sensor; Motion6D.Interfaces.IPositionObject po = sensor; po.Position = p; return(p); } if (kind.Equals(Field3D)) { Motion6D.PhysicalField3D ph = new Motion6D.PhysicalField3D(); p.Parameters = ph; Motion6D.Interfaces.IPositionObject po = ph; po.Position = p; return(p); } } return(null); }
public override IObjectLabelUI CreateObjectLabel(IPaletteButton button) { Type type = button.ReflectionType; if (type.Equals(typeof(SoundCollection))) { return(typeof(SoundService.UI.Labels.SoundCollectionLabel).CreateLabelUI(false)); } if (type.Equals(typeof(MultiSound))) { return(typeof(SoundService.UI.Labels.MultiSoundLabel).CreateLabelUI(true)); } if (type.Equals(typeof(Object2SoundName))) { return(typeof(SoundService.UI.Labels.Object2SoundNameLabel).CreateLabelUI(true)); } return(null); }
/// <summary> /// Creates object label /// </summary> /// <param name="button">Corresponding button</param> /// <returns>The object label</returns> public override IObjectLabelUI CreateObjectLabel(IPaletteButton button) { Type type = button.ReflectionType; object im = button.ButtonImage; if (type.Equals(typeof(Motion6D.PositionCollectionIndicator))) { return((new Motion6D.UI.Labels.PositionsIndicatorLabel()).CreateLabelUI(im, false)); } if (type.Equals(typeof(ReferenceFrameData))) { return((new Motion6D.UI.Labels.ReferenceFrameDataLabel()).CreateLabelUI(im, true)); } if (type.Equals(typeof(ReferenceFrameDataPitchRollHunting))) { return((new Motion6D.UI.Labels.ReferenceFrameDataPitchRollHuntingLabel()).CreateLabelUI(im, true)); } return(null); }
public override IObjectLabelUI CreateObjectLabel(IPaletteButton button) { Type type = button.ReflectionType; string kind = button.Kind; if (type == null) { return(null); } Image image = type.ToImage(); if (image != null) { return((new ImageTransformations.Labels.BitmapProviderLabel(image)).CreateLabelUI(image, false)); } if (type.Equals(typeof(ImageTransformations.SourceImage))) { return((new Labels.ImageProviderLabel(type, kind, ResourceImage.ImageSource.ToBitmap())).CreateLabelUI( ResourceImage.ImageSource.ToBitmap(), false)); } if (type.Equals(typeof(ImageTransformations.ExternalImage)) | type.Equals(typeof(ImageTransformations.ExternalContextImage))) { if (kind.Equals("Web")) { System.Drawing.Image im = type.Equals(typeof(ImageTransformations.ExternalImage)) ? ResourceImage.BitmapWeb.ToBitmap() : ResourceImage.BitmapWebCtx.ToBitmap(); return((new Labels.WebProviderLabel(type, kind, im)).CreateLabelUI(im, false)); } } if (type.Equals(typeof(ImageTransformations.ExternalUIImage))) { ExternalUIImage im = new ExternalUIImage(kind); object[] ob = (im as IPropertiesEditor).Editor as object[]; object o = ob[1]; System.Drawing.Image img = (o is System.Drawing.Image) ? o as System.Drawing.Image : (o as System.Drawing.Icon).ToBitmap(); return((new Labels.ImageProviderLabel(type, kind, img)).CreateLabelUI(img, false)); } return(null); }
/// <summary> /// Gets image of component /// </summary> /// <param name="component">The component</param> /// <returns>The image</returns> public static Image GetImage(INamedComponent component) { if (component is IObjectLabelUI) { IObjectLabelUI l = component as IObjectLabelUI; return(l.Image as Image); } if (component is IObjectLabel) { IObjectLabel l = component as IObjectLabel; object o = l.Object; if (o is MultiLibraryObject) { return(ResourceImage.MultiInterface.ToBitmap()); } } IPaletteButton button = GetButton(component); return(button.ButtonImage as Image); }
/// <summary> /// Creates an arrow the corresponds to button /// </summary> /// <param name="button">The button</param> /// <returns>Created arrow</returns> public virtual ICategoryArrow CreateArrow(IPaletteButton button) { foreach (IUIFactory f in factories) { ICategoryArrow a = f.CreateArrow(button); if (a != null) { return(a); } } if (defaultValue) { Type t = button.ReflectionType; if (t != null) { ConstructorInfo cons = t.GetConstructor(new System.Type[0]); if (cons != null) { return(cons.Invoke(null) as ICategoryArrow); } } } return(null); }
/// <summary> /// Adds button to this panel /// </summary> /// <param name="button">The button to add</param> public void AddButton(IPaletteButton button) { buttonImages.Images.Add(button.ButtonImage as Image); Type t = button.ReflectionType; if (t == null) { return; } Dictionary <string, IPaletteButton> d = null; if (!buttons.ContainsKey(t)) { d = new Dictionary <string, IPaletteButton>(); buttons[t] = d; } else { d = buttons[t]; } string kind = button.Kind; d[kind] = button; }
IArrowLabelUI IDefaultLabelFactory.CreateArrowLabel(IPaletteButton button, ICategoryArrow arrow, IObjectLabel source, IObjectLabel target) { return(new ArrowLabel(button, arrow, source, target)); }
/// <summary> /// Constructor /// </summary> /// <param name="button">Associated button</param> public ContainerObjectLabel(IPaletteButton button) : base(button) { Move += new EventHandler(onMove); type = button.Type; }
/// <summary> /// Creates object label /// </summary> /// <param name="button">Corresponding button</param> /// <returns>The object label</returns> public virtual IObjectLabelUI CreateObjectLabel(IPaletteButton button) { return(null); }
/// <summary> /// Creates arrow label /// </summary> /// <param name="button">Corresponding button</param> /// <param name="arrow">Corresponding arrow</param> /// <param name="source">Soource label</param> /// <param name="target">Target label</param> /// <returns>The arrow label</returns> public virtual IArrowLabelUI CreateArrowLabel(IPaletteButton button, ICategoryArrow arrow, IObjectLabel source, IObjectLabel target) { return(null); }
/// <summary> /// Creates an arrow the corresponds to button /// </summary> /// <param name="button">The button</param> /// <returns>Created arrow</returns> public virtual ICategoryArrow CreateArrow(IPaletteButton button) { return(null); }
/// <summary> /// Creates object the corresponds to button /// </summary> /// <param name="button">The button</param> /// <returns>Created object</returns> public virtual ICategoryObject CreateObject(IPaletteButton button) { return(null); }