public static ICanvasSelectableObject CanvasFromDrawableObject(IBlackboardObject drawable) { ICanvasDrawableObject d = CanvasFromDrawableObjectRegistry.CanvasFromDrawableObject(drawable); d.IDrawableObject = drawable; return(d); }
public IBlackboardObject GetClosestObject(Coordinate coordinate) { double DistanceClosestM = double.MaxValue; IBlackboardObject closestObj = null; foreach (var obj in BlackboardController.Objects) { if (obj is T) { double ThisDistanceM = obj.DistanceToM(coordinate); if (closestObj == null) { DistanceClosestM = ThisDistanceM; closestObj = obj; } else { if (obj.DistanceToM(closestObj.Coordinate) < DistanceClosestM) { DistanceClosestM = ThisDistanceM; closestObj = obj; } } } } return(closestObj); }
ICanvasSelectableObject Add(IBlackboardObject drawable) { ICanvasSelectableObject cso = Utils.CanvasFromDrawableObject(drawable); AddObject(cso); return(cso); }
public static ICanvasDrawableObject CanvasFromDrawableObject(IBlackboardObject srcInstance) { TypeAndAssembly ta = CanvasFromDrawableObjectMap [srcInstance.GetType().ToString()]; ObjectHandle handle = null; handle = Activator.CreateInstance(ta.AssemblyName, ta.Type.ToString()); return((ICanvasDrawableObject)handle.Unwrap()); }
public static ICanvasSelectableObject CanvasFromDrawableObject(IBlackboardObject drawable) { string objecttype = String.Format ("LongoMatch.Drawing.CanvasObjects.Blackboard.{0}Object", drawable.GetType ().ToString ().Split ('.').Last ()); ObjectHandle handle = Activator.CreateInstance (null, objecttype); ICanvasDrawableObject d = (ICanvasDrawableObject)handle.Unwrap (); d.IDrawableObject = drawable; return d; }
public static ICanvasSelectableObject CanvasFromDrawableObject(IBlackboardObject drawable) { string objecttype = String.Format("LongoMatch.Drawing.CanvasObjects.Blackboard.{0}Object", drawable.GetType().ToString().Split('.').Last()); ObjectHandle handle = Activator.CreateInstance(null, objecttype); ICanvasDrawableObject d = (ICanvasDrawableObject)handle.Unwrap(); d.IDrawableObject = drawable; return(d); }
void HandleDrawableChangedEvent(IBlackboardObject drawable) { selectedDrawable = drawable as Drawable; colorbutton.Sensitive = !(drawable is Text); ignoreChanges = true; if (selectedDrawable == null) { colorbutton.Color = Misc.ToGdkColor(blackboard.Color); textcolorbutton.Color = Misc.ToGdkColor(blackboard.TextColor); backgroundcolorbutton.Color = Misc.ToGdkColor(blackboard.TextBackgroundColor); backgroundcolorbutton.Alpha = Color.ByteToUShort(blackboard.TextBackgroundColor.A); linesizespinbutton.Value = OriginalSize(blackboard.LineWidth); if (blackboard.LineStyle == LineStyle.Normal) { stylecombobox.Active = 0; } else { stylecombobox.Active = 1; } typecombobox.Active = (int)blackboard.LineType; } else { if (drawable is Text) { textcolorbutton.Color = Misc.ToGdkColor((selectedDrawable as Text).TextColor); backgroundcolorbutton.Color = Misc.ToGdkColor(selectedDrawable.FillColor); backgroundcolorbutton.Alpha = Color.ByteToUShort(selectedDrawable.FillColor.A); textspinbutton.Value = OriginalSize((selectedDrawable as Text).TextSize); } else { colorbutton.Color = Misc.ToGdkColor(selectedDrawable.StrokeColor); } if (drawable is Line) { typecombobox.Active = (int)(drawable as Line).Type; } linesizespinbutton.Value = OriginalSize(selectedDrawable.LineWidth); if (selectedDrawable.Style == LineStyle.Normal) { stylecombobox.Active = 0; } else { stylecombobox.Active = 1; } } ignoreChanges = false; }
void HandleConfigureObjectEvent(IBlackboardObject drawable, DrawTool tool) { if (drawable is Text) { if (tool == DrawTool.Text) { EditText(drawable as Text); } else if (tool == DrawTool.Player) { EditPlayer(drawable as Text); } } }
void HandleShowMenuEvent(IBlackboardObject drawable) { Menu m = new Menu(); MenuItem item = new MenuItem(Catalog.GetString("Delete")); item.Activated += (sender, e) => blackboard.DeleteSelection(); m.Add(item); if (drawable is Text) { MenuItem edit = new MenuItem(Catalog.GetString("Edit")); edit.Activated += (sender, e) => EditText(drawable as Text); m.Add(edit); } m.ShowAll(); m.Popup(); }
void HandleShowMenuEvent(IBlackboardObject drawable) { Menu m = new Menu (); MenuItem item = new MenuItem (Catalog.GetString ("Delete")); item.Activated += (sender, e) => blackboard.DeleteSelection (); m.Add (item); if (drawable is Text) { MenuItem edit = new MenuItem (Catalog.GetString ("Edit")); edit.Activated += (sender, e) => EditText (drawable as Text); m.Add (edit); } m.ShowAll (); m.Popup (); }
void HandleDrawableChangedEvent(IBlackboardObject drawable) { selectedDrawable = drawable as Drawable; colorbutton.Sensitive = !(drawable is Text); ignoreChanges = true; if (selectedDrawable == null) { colorbutton.Color = Misc.ToGdkColor (blackboard.Color); textcolorbutton.Color = Misc.ToGdkColor (blackboard.TextColor); backgroundcolorbutton.Color = Misc.ToGdkColor (blackboard.TextBackgroundColor); backgroundcolorbutton.Alpha = Color.ByteToUShort (blackboard.TextBackgroundColor.A); linesizespinbutton.Value = OriginalSize (blackboard.LineWidth); if (blackboard.LineStyle == LineStyle.Normal) { stylecombobox.Active = 0; } else { stylecombobox.Active = 1; } typecombobox.Active = (int)blackboard.LineType; } else { if (drawable is Text) { textcolorbutton.Color = Misc.ToGdkColor ((selectedDrawable as Text).TextColor); backgroundcolorbutton.Color = Misc.ToGdkColor (selectedDrawable.FillColor); backgroundcolorbutton.Alpha = Color.ByteToUShort (selectedDrawable.FillColor.A); textspinbutton.Value = OriginalSize ((selectedDrawable as Text).TextSize); } else { colorbutton.Color = Misc.ToGdkColor (selectedDrawable.StrokeColor); } if (drawable is Line) { typecombobox.Active = (int)(drawable as Line).Type; } linesizespinbutton.Value = OriginalSize (selectedDrawable.LineWidth); if (selectedDrawable.Style == LineStyle.Normal) { stylecombobox.Active = 0; } else { stylecombobox.Active = 1; } } ignoreChanges = false; }
void HandleConfigureObjectEvent(IBlackboardObject drawable, DrawTool tool) { if (drawable is Text) { if (tool == DrawTool.Text) { EditText (drawable as Text); } else if (tool == DrawTool.Player) { EditPlayer (drawable as Text); } } }
ICanvasSelectableObject Add(IBlackboardObject drawable) { ICanvasSelectableObject cso = Utils.CanvasFromDrawableObject (drawable); AddObject (cso); return cso; }