protected override void OnContentRendered(EventArgs e) { // hides grids model1.GetGrid().Visible = false; model2.GetGrid().Visible = false; // adds entities model1.Entities.Add(new Line(60, 10, 0, 60, 110, 0), System.Drawing.Color.Blue); model1.Entities.Add(new Line(10, 60, 0, 110, 60, 0), System.Drawing.Color.Blue); model1.Entities.Add(new Circle(60, 60, 0, 40), System.Drawing.Color.Red); model1.Entities.Add(new Circle(100, 60, 0, 6), System.Drawing.Color.Red); model1.Entities.Add(new Circle(60, 100, 0, 6), System.Drawing.Color.Red); model1.Entities.Add(new Circle(60, 20, 0, 6), System.Drawing.Color.Red); model1.Entities.Add(new Circle(20, 60, 0, 6), System.Drawing.Color.Red); // adds labels devDept.Eyeshot.Labels.TextOnly label = new TextOnly(30, 95, 0, "CIRCLE", new System.Drawing.Font("Tahoma", 8.25f), Color.Black); label.ColorForSelection = model1.SelectionColor; model1.Labels.Add(label); devDept.Eyeshot.Labels.TextOnly label2 = new TextOnly(40, 60, 0, "LINE", new System.Drawing.Font("Tahoma", 8.25f), Color.Black); label2.ColorForSelection = model1.SelectionColor; model1.Labels.Add(label2); // sets trimetric view model1.SetView(viewType.Trimetric); // fits the model in the viewport model1.ZoomFit(); // refresh the viewports model1.Invalidate(); model2.Invalidate(); base.OnContentRendered(e); }
protected override void OnMouseUp(MouseButtonEventArgs e) { Point location = RenderContextUtility.ConvertPoint(GetMousePosition(e)); if (GetToolBar().Contains(location)) { base.OnMouseUp(e); return; } if (_measuring) { if (e.ChangedButton == MouseButton.Left) { if (_firstClick == false) { _points.Clear(); _firstClick = true; } if (FindClosestPoint(location) == -1) { StopMeasuring(false); } else { _points.Add(_measureEndPoint); if (_points.Count > 1) { _line = new Line(_points[0], _points[1]) { LineWeightMethod = colorMethodType.byEntity, LineWeight = 1 }; string text = String.Format("{0} mm", Math.Round(_line.Length(), 2)); var to = new TextOnly((_line.StartPoint + _line.EndPoint) / 2, text, new Font("Tahoma", 8.25f), Color.Black, ContentAlignment.BottomLeft); Entities.Add(_line, Color.Black); Labels.Add(to); Invalidate(); StopMeasuring(false); } } } else if (e.ChangedButton == MouseButton.Right) { ResetMeasuring(); } } base.OnMouseUp(e); }
// Start is called before the first frame update. void Start() { // Image references. back1 = GameObject.Find("Back1").GetComponent <Image>(); back2 = GameObject.Find("Back2").GetComponent <Image>(); back3 = GameObject.Find("Back3").GetComponent <Image>(); girl1 = GameObject.Find("Girl1").GetComponent <Image>(); girl2 = GameObject.Find("Girl2").GetComponent <Image>(); girl3 = GameObject.Find("Girl3").GetComponent <Image>(); girl4 = GameObject.Find("Girl4").GetComponent <Image>(); girl5 = GameObject.Find("Girl5").GetComponent <Image>(); girl6 = GameObject.Find("Girl6").GetComponent <Image>(); StartImages(); textDisplay = GameObject.Find("Text Display"); textBoxText = textDisplay.transform.Find("TextBoxText").gameObject; textOnly = textBoxText.GetComponent <TextOnly>(); }
/// <summary> /// This method will be called when the user has finished drawing a ghost rectangle or bundle /// and initiates the actual creation of a bundle and the addition to the model via the appropriate command. /// </summary> protected override void GhostDrawingComplete() { try { TextOnly shape = new TextOnly(this.Controller.Model); shape.Width = (int)Rectangle.Width; shape.Height = (int)Rectangle.Height; shape.Text = "New label"; AddShapeCommand cmd = new AddShapeCommand(this.Controller, shape, new Point((int)Rectangle.X, (int)Rectangle.Y)); this.Controller.UndoManager.AddUndoCommand(cmd); cmd.Redo(); TextEditor.GetEditor(shape); TextEditor.Show(); } catch { base.Controller.DeactivateTool(this); Controller.View.Invalidate(); throw; } base.Controller.DeactivateTool(this); }
/// <summary> /// parse tag /// </summary> /// <typeparam name="T"></typeparam> /// <param name="tag"></param> /// <returns></returns> private T Tag <T>(T tag) where T : Attributes { var dot = false; tag.Line = Line; // (attrs | class | id)* var done = false; while (!done) { switch (Peek().Type) { case "id": case "class": { var tok = Advance(); tag.SetAttribute(tok.Type, "'" + tok.Value + "'"); continue; } case "attrs": { var tok = Advance(); var obj = tok.Attrs; var escaped = tok.Escaped; var names = obj.Keys; if (tok.SelfClosing) { tag.SelfClosing = true; } foreach (var name in names) { var val = obj[name]; tag.SetAttribute(name, val.ToString(), escaped[name]); } continue; } default: done = true; break; } } // check immediate '.' if ("." == (string)Peek().Value) { dot = tag.TextOnly = true; Advance(); } // (text | code | ':')? switch (Peek().Type) { case "text": tag.Block.Push(ParseText()); break; case "code": tag.Code = ParseCode(); break; case ":": Advance(); tag.Block = new Block(); tag.Block.Push(ParseExpr()); break; } // newline* while ("newline" == Peek().Type) { Advance(); } tag.TextOnly = tag.TextOnly || TextOnly.Contains(tag.Name); // script special case if ("script" == tag.Name) { var type = tag.GetAttribute("type"); if (!dot && type != null && "text/javascript" == TypeRegex.Replace(type, "")) { tag.TextOnly = false; } } // block? if ("indent" == Peek().Type) { if (tag.TextOnly) { _lexer.Pipeless = true; tag.Block = ParseTextBlock(); _lexer.Pipeless = false; } else { var block = Block(); if (tag.Block != null) { foreach (var node in block.Nodes) { tag.Block.Push(node); } } else { tag.Block = block; } } } return(tag); }