public static pt intersect(line m, line n) { pt res = new pt(); float zn = det (m.a, m.b, n.a, n.b); if (Math.Abs(zn) < EPS) return null; res.x = - det (m.c, m.b, n.c, n.b) / zn; res.y = - det (m.a, m.c, n.a, n.c) / zn; return res; }
internal static g CmdCreateIconMinusOrPlusTop(bool ParMinusOrPlus) { g g1 = CmdCreateIconMinusOrPlus(ParMinusOrPlus); line line1 = new line(); line1.x1 = 27; line1.y1 = 0; line1.x2 = 27; line1.y2 = 12; line1.stroke_width = LocalData.LineStrokeThickness; line1.stroke = LocalData.LineColor.Name; if (LocalData.IsLineDashed) { line1.stroke_dasharray = LocalData.DashArrayValue + ", " + LocalData.DashArrayValue; } g1.Children.Add(line1); return(g1); }
internal static g Cmd_Create_Icon_Minus_Or_Plus_Top(bool Par_Minus_Or_Plus) { g g1 = Cmd_Create_Icon_Minus_Or_Plus(Par_Minus_Or_Plus); line line1 = new line(); line1.x1 = 27; line1.y1 = 0; line1.x2 = 27; line1.y2 = 12; line1.stroke_width = LocalData.MyTree_Line_StrokeThickness; line1.stroke = LocalData.MyTree_Line_Color.Name; if (LocalData.My_IsLineDashed) { line1.stroke_dasharray = LocalData.My_DashArray_Value + ", " + LocalData.My_DashArray_Value; } g1.Children.Add(line1); return(g1); }
// line at 0 - is the oldest // line at Last - is the newest public override line line_at(int idx) { lock (this) { if (idx < entries_.Count) { // the only reason I have this is so that I append things correctly to the large-string, since // we're adding always prepending lines when we're in reverse order // // thus, the index in the large string should be valid all the time (even after new lines are added) int old_entries = (reader_ as event_log_reader).old_event_count; if (idx < old_entries || old_entries < 0) { if (reader_.are_elements_in_reverse_order) { if (old_entries < 0) old_entries = entries_.Count; idx = old_entries - idx - 1; } var entry = entries_[idx]; var l = new line(new sub_string(string_, idx), entry.idx_in_line(aliases), entry.time); return l; } else { // it's new entries var entry = entries_[idx]; var l = new line(new sub_string(string_, idx), entry.idx_in_line(aliases), entry.time); return l; } } // this can happen, when the log has been re-written, and everything is being refreshed throw new line.exception("invalid line request " + idx + " / " + entries_.Count); } }
// Update is called once per frame void Update() { if (OnTouchDown() == true) { line linecomp = lineObj.GetComponent <line>(); linecomp.startdrawline(transform.position); } if (OnMouseDown() == true) { print("ドラッグしながら触れられたか"); line linecomp = lineObj.GetComponent <line>(); linecomp.startdrawlinePC(transform.position); } if (OnDragOver() == true) { line linecomp = lineObj.GetComponent <line>(); linecomp.makeTurningPoint(transform.position); } if (OnMouseEnter() == true) { print("ドラッグしながら触れられたか"); line linecomp = lineObj.GetComponent <line>(); linecomp.makeTurningPointPC(transform.position); } }
void drawRoad(Road road) { int width = road.width; node node1 = myNode[road.node1 - 1]; node node2 = myNode[road.node2 - 1]; if (node1.xPos == node2.xPos) { GameObject road1 = Instantiate(line1); GameObject road2 = Instantiate(line2); myLine1 = road1.GetComponent <line>(); myLine2 = road2.GetComponent <line>(); Vector3[] forNode1 = NodeToVec(node1, true, (float)width); Vector3[] forNode2 = NodeToVec(node2, true, (float)width); myLine1.DrawLine(forNode1[0], forNode2[0]); myLine2.DrawLine(forNode1[1], forNode2[1]); } else { GameObject road1 = Instantiate(line1); GameObject road2 = Instantiate(line2); myLine1 = road1.GetComponent <line>(); myLine2 = road2.GetComponent <line>(); Vector3[] forNode1 = NodeToVec(node1, false, (float)width); Vector3[] forNode2 = NodeToVec(node2, false, (float)width); //printVec(forNode1); //printVec(forNode2); myLine1.DrawLine(forNode1[0], forNode2[0]); myLine2.DrawLine(forNode1[1], forNode2[1]); } }
/* * This small example creates a line and a plane from points. * It then computes the intersection point of the line and the plane. * * In this step, all types and functions are specialized. */ static void Main(string[] args) { // get five points normalizedPoint linePt1 = c3ga.cgaPoint(1.0f, 0.0f, 0.0f); normalizedPoint linePt2 = c3ga.cgaPoint(1.0f, 1.0f, 0.0f); normalizedPoint planePt1 = c3ga.cgaPoint(1.0f, 2.0f, 0.0f); normalizedPoint planePt2 = c3ga.cgaPoint(1.0f, 2.0f, 1.0f); normalizedPoint planePt3 = c3ga.cgaPoint(0.0f, 2.0f, 1.0f); // output text the can be copy-pasted into GAViewer Console.WriteLine("linePt1 = " + linePt1 + ","); Console.WriteLine("linePt2 = " + linePt2 + ","); Console.WriteLine("planePt1 = " + planePt1 + ","); Console.WriteLine("planePt2 = " + planePt2 + ","); Console.WriteLine("planePt3 = " + planePt3 + ","); // create line and plane out of points line L = linePt1 ^ (linePt2 ^ c3ga.ni); plane P = planePt1 ^ (planePt2 ^ (planePt3 ^ c3ga.ni)); // output text the can be copy-pasted into GAViewer Console.WriteLine("L = " + L + ","); Console.WriteLine("P = " + P + ","); // compute intersection of line and plane flatPoint intersection = c3ga.lc(c3ga.dual(L), P); normalizedPoint intersectionPt = c3ga.cgaPoint(intersection); // example of how to convert flatPoint to normalizedPoint Console.WriteLine("intersection = " + intersection + ","); }
//Constructor for the line class, simply assign the parameters to a new instance of a line and return the result line Line(string d, bool c, string s, int blo, int blu, int dlo, int dlu, int plo, int plu, int rlo, int rlu, int tllo, int tllu, int ttlo, int ttlu, string c1, string c2, string c3, int e) { line nl = new line(); nl.dialogue = d; nl.is_choice = c; nl.speaker = s; nl.baley_love = blo; nl.baley_lust = blu; nl.dumphrey_love = dlo; nl.dumphrey_lust = dlu; nl.presston_love = plo; nl.presston_lust = plu; nl.rusty_love = rlo; nl.rusty_lust = rlu; nl.trashley_love = tllo; nl.trashley_lust = tllu; nl.trashton_love = ttlo; nl.trashton_lust = ttlu; nl.choice_1 = c1; nl.choice_2 = c2; nl.choice_3 = c3; nl.effect = e; return(nl); }
// methods //------------------------------------------------- // actual_left //------------------------------------------------- public float actual_left() { if (m_current_line != null) { // TODO: is there a sane way to allow an open line to be temporarily finalised and rolled back? m_current_line.align_text(this); m_current_line = null; } if (empty()) // degenerate scenario { return(0.0f); } float result = 1.0f; foreach (var line in m_lines) { if (line.width() != 0) { result = std.min(result, line.xoffset(this)); } } return(result); }
public bool Compare(line l) { if (this.a != l.a) return false; if (this.b != l.b) return false; if (this.c != l.c) return false; return true; }
void RegenerateGround(int index) { int modulatedIndex_ = index - 1 < 0 ? _instances.Length - 1 : index - 1; line lastInstance_ = _instances [modulatedIndex_]; _instances [index].transform.position = lastInstance_.transform.position + Vector3.right * lastInstance_.GetLength(); }
private line parse_line(sub_string l) { Debug.Assert(syntaxes_.Count > 0); foreach (var si in syntaxes_) { line result = null; if (si.relative_syntax_) { result = parse_relative_line(l, si); } else { result = parse_line_with_syntax(l, si); } if (result != null) { return(result); } } // in this case, we can't parse the line at all - use default return(new line(l, syntax_info.line_contains_msg_only_)); }
public void postOng8Sports(line lineCls, Dictionary <string, string> dictionary) { try { if (lineCls.event_id == -9999) { return; } string str1 = this.getLineDate(lineCls.event_id).ToString(); if (str1 != "NOID") { // string str2 = str1.Substring(0,10); //dt.Date.ToShortDateString(); DateTime dt = Convert.ToDateTime(str1); string dateBridge = dt.Month.ToString() + "/" + dt.Day.ToString() + "/" + dt.Year.ToString(); string user = "******"; string pwd = "g8bridge"; string action = "setValue"; string rot = lineCls.rot.ToString(); string sport = lineCls.sport_id.ToString(); string period = lineCls.period_id.ToString(); string lineTypeID = "154"; int? nullable1 = lineCls.ml_away_price; string visitorML = nullable1.ToString(); nullable1 = lineCls.ml_home_price; string homeML = nullable1.ToString(); float? nullable2 = lineCls.total; string total = nullable2.ToString(); nullable1 = lineCls.over_price; string totalOver = nullable1.ToString(); nullable1 = lineCls.under_price; string totalUnder = nullable1.ToString(); nullable2 = lineCls.ps_away_spread; string visitorSpread = nullable2.ToString(); nullable1 = lineCls.ps_away_price; string visitorSpreadOdds = nullable1.ToString(); nullable2 = lineCls.ps_home_spread; string homeSpread = nullable2.ToString(); string homeSpreadOdds = lineCls.ps_home_price.ToString(); nullable1 = lineCls.draw_price; string draw = nullable1.ToString(); string sportBookId = lineCls.sportsbook.ToString(); string leagueid = lineCls.league_id.ToString(); this.doWebReq(user, pwd, action, rot, sport, period, lineTypeID, visitorML, homeML, total, totalOver, totalUnder, visitorSpread, visitorSpreadOdds, homeSpread, homeSpreadOdds, draw, sportBookId, dateBridge, leagueid); } else { Console.WriteLine("There are not event id " + (object)lineCls.event_id + "in database, therefore can not be sent to API"); } } catch (Exception ex) { Console.WriteLine("**************** THERE IS AN ERROR ******************: " + ex.Message + " Date: " + this.getLineDate(lineCls.event_id).ToString()); Errors += ex.Message + DateTime.Now + Environment.NewLine; Print(Errors); } }
public line createClassLine(Dictionary <string, string> dictionary) { this.lineClass = new line(); try { this.lineClass.rot = new int?(int.Parse(this.GetValue("rot", dictionary))); this.lineClass.sport_id = int.Parse(this.GetValue("sport_id", dictionary)); this.lineClass.away_money = new int?(int.Parse(this.GetValue("away_money", dictionary))); this.lineClass.period = this.GetValue("period", dictionary); this.lineClass.period_id = int.Parse(this.GetValue("period_id", dictionary)); this.lineClass.ml_away_price = new int?(int.Parse(this.GetValue("ml_away_price", dictionary))); this.lineClass.ml_home_price = new int?(int.Parse(this.GetValue("ml_home_price", dictionary))); this.lineClass.total = new float?(float.Parse(this.GetValue("total", dictionary))); this.lineClass.over_price = new int?(int.Parse(this.GetValue("over_price", dictionary))); this.lineClass.under_price = new int?(int.Parse(this.GetValue("under_price", dictionary))); this.lineClass.ps_away_spread = new float?(float.Parse(this.GetValue("ps_away_spread", dictionary))); this.lineClass.ps_away_price = new int?(int.Parse(this.GetValue("ps_away_price", dictionary))); this.lineClass.ps_home_spread = new float?(float.Parse(this.GetValue("ps_home_spread", dictionary))); this.lineClass.ps_home_price = new double?((double)float.Parse(this.GetValue("ps_home_price", dictionary))); this.lineClass.draw_price = new int?(int.Parse(this.GetValue("draw_price", dictionary))); this.lineClass.ps_away_price = new int?(int.Parse(this.GetValue("ps_away_price", dictionary))); this.lineClass.sportsbook = new short?(short.Parse(this.GetValue("sportsbook", dictionary))); this.lineClass.event_id = int.Parse(this.GetValue("event_id", dictionary)); this.lineClass.league_id = int.Parse(this.GetValue("league_id", dictionary)); } catch (Exception ex) { Errors += ex.Message + DateTime.Now + Environment.NewLine; Print(Errors); Console.WriteLine("Error to createClassLine: " + ex.Message); } return(this.lineClass); }
//parses file and creates script for game to read info from. public void LoadDialogue(string fileName) { string currLine; StreamReader r = new StreamReader(fileName); while ((currLine = r.ReadLine()) != null) { string[] data = currLine.Split(';'); if (data.Length == 0) { continue; } if (data[0] == "Player") { line entry = new line(data[0], ""); for (int i = 1; i < data.Length; i++) { entry.choices.Add(data[i]); } script.Add(entry); } else { line entry = new line(data[0], data[1]); script.Add(entry); } } r.Close(); }
public square(line line1, line line2, line line3, line line4) { this.line1 = line1; this.line2 = line2; this.line3 = line3; this.line4 = line4; }
/* * This small example creates a line and a plane from points. * It then computes the intersection point of the line and the plane. * * In this step, all GA variables are stored in specialized multivector types, * such as 'line', 'plane' and 'flatPoint'. */ static void Main(string[] args) { // get five points normalizedPoint linePt1 = c3ga.cgaPoint(1.0f, 0.0f, 0.0f); normalizedPoint linePt2 = c3ga.cgaPoint(1.0f, 1.0f, 0.0f); normalizedPoint planePt1 = c3ga.cgaPoint(1.0f, 2.0f, 0.0f); normalizedPoint planePt2 = c3ga.cgaPoint(1.0f, 2.0f, 1.0f); normalizedPoint planePt3 = c3ga.cgaPoint(0.0f, 2.0f, 1.0f); // output text the can be copy-pasted into GAViewer Console.WriteLine("linePt1 = " + linePt1 + ","); Console.WriteLine("linePt2 = " + linePt2 + ","); Console.WriteLine("planePt1 = " + planePt1 + ","); Console.WriteLine("planePt2 = " + planePt2 + ","); Console.WriteLine("planePt3 = " + planePt3 + ","); // create line and plane out of points line L = new line((mv)linePt1 ^ (mv)linePt2 ^ (mv)c3ga.ni); //line L = new line(c3ga.op(linePt1, c3ga.op(linePt2, c3ga.ni))); // alternative, no explicit conversion required plane P = new plane((mv)planePt1 ^ (mv)planePt2 ^ (mv)planePt3 ^ (mv)c3ga.ni); //plane P = new plane(c3ga.op(planePt1, c3ga.op(planePt2, c3ga.op(planePt3, c3ga.ni)))); // alternative, no explicit conversion required // output text the can be copy-pasted into GAViewer Console.WriteLine("L = " + L + ","); Console.WriteLine("P = " + P + ","); // compute intersection of line and plane flatPoint intersection = new flatPoint(c3ga.lc(c3ga.dual(L), P)); Console.WriteLine("intersection = " + intersection + ","); }
//shape without parameter. public Bitmap createShape(string type, Bitmap drawArea) { this.type = type; if (type == "circle") { shape shape = new Circle(drawArea); try { drawArea = shape.draw(); return(drawArea); } catch (NotImplementedException e) { MessageBox.Show(e.Message); }; } else if (circleReg.IsMatch(type)) { MessageBox.Show("hello"); return(null); } else if (type == "rectangle") { graphicApplication.model.Rectangle shapeRec = new graphicApplication.model.Rectangle(drawArea); try { drawArea = shapeRec.draw(400, 400); return(drawArea); } catch (Exception e) { MessageBox.Show(e.Message); } } else if (type == "drawLine") { line l = new line(drawArea); Pen p = new Pen(Color.Black, 2); drawArea = l.draw(); return(drawArea); } else if (type == "triangle") { shape s = new Triangle(drawArea); drawArea = s.draw(); return(drawArea); } else if (type == "polygon") { shape s = new Polygon(drawArea); drawArea = s.draw(); return(drawArea); } return(null); }
internal static g CmdCreateIconMinusOrPlusBottom(bool ParMinusOrPlus) { g g1 = CmdCreateIconMinusOrPlus(ParMinusOrPlus); line line1 = new line { x1 = LocalData.TreeIconBoxSize50, y1 = LocalData.TreeIconBoxSize75, x2 = LocalData.TreeIconBoxSize50, y2 = LocalData.VisualParams.TreeIconBoxSize, stroke_width = LocalData.VisualParams.LineStrokeThickness, stroke = LocalData.VisualParams.LineColor.Name }; if (LocalData.VisualParams.IsLineDashed) { line1.stroke_dasharray = LocalData.VisualParams.DashArrayValue + " " + LocalData.VisualParams.DashArrayValue; } g1.Children.Add(line1); return(g1); }
/// <summary> /// Run one route script with an IFR model aircraft /// </summary> /// <param name="route">A complete route script to run</param> /// <returns>True if OK</returns> private bool RunSimFromScript(CmdList route) { string routeName = route.Descriptor.Start_IcaoID + "_" + route.Descriptor.End_IcaoID; var virtAcft = new IFRvAcft(route); // use the Jet model var kmlFile = new KmlFile( ); var kmlLine = new line { Name = routeName, LineColor = LineStyle.LT_Blue }; do { virtAcft.StepModel(m_stepLen_sec); // step the model at 2 sec until finished kmlLine.Add(new point { Position = new LatLon(virtAcft.LatLon), Altitude_ft = virtAcft.Alt_ft, Heading = (int)virtAcft.TRK }); } while (!virtAcft.Out); // setup Comm kmlFile.Lines.Add(kmlLine); kmlFile.WriteKML(routeName + ".kml"); return(Valid); }
//------------------------------------------------- // word_wrap //------------------------------------------------- void word_wrap() { // keep track of the last line and break line last_line = m_current_line; UInt32 last_break = m_last_break; // start a new line with the same justification start_new_line(last_line.justify(), last_line.character(last_line.character_count() - 1).style.size); // find the begining of the word to wrap UInt32 position = last_break; while (position + 1 < last_line.character_count() && is_space_character(last_line.character(position).character)) { position++; } // transcribe the characters for (UInt32 i = position; i < last_line.character_count(); i++) { var ch = last_line.character(i); m_current_line.add_character(ch.character, ch.style, ch.source); } // and finally, truncate the last line last_line.truncate(last_break); }
public void DrawBox(Color color) { for (int index = 0; index < boxLines.Length; index++) { line curLine = boxLines[index]; Debug.DrawLine(curLine.start, curLine.end, color); } }
internal void add(line x) { while (len >= 2 && bad(r[len - 2], r[len - 1], x)) { --len; } r[len++] = x; }
//------------------------------------------------- // start_new_line //------------------------------------------------- void start_new_line(float height) { // update the current line m_current_line = new line(actual_height(), height * yscale()); //m_current_line = m_lines.emplace_back(std::make_unique<line>(actual_height(), height * yscale())).get(); m_lines.emplace_back(m_current_line); m_last_break = 0; m_truncating = false; }
/// <summary> /// 获取线路文件夹名称 /// </summary> /// <param name="lid"></param> /// <returns></returns> public string GetLineFolderName(int lid) { using (sartas3 db = new sartas3()) { line l = db.line.Where(n => n.ID == lid).FirstOrDefault(); return(l != null ? l.LineCode : null); } }
// GET: Provider/Delete/5 public ActionResult Delete(int id) { line l = nv.lines.SingleOrDefault(x => x.id == id); nv.lines.Remove(l); nv.SaveChanges(); return(RedirectToAction("Index", "provider")); }
//------------------------------------------------- // actual_height //------------------------------------------------- public float actual_height() { line last_line = (m_lines.size() > 0) ? m_lines[m_lines.size() - 1] : null; return(last_line != null ? last_line.yoffset() + last_line.height() : 0); }
public ActionResult Create(line l) { l.owner_company = Convert.ToInt32(TempData["user_id"].ToString()); l.departure_time = TimeSpan.Parse(Request.Form["departure_time"]); l.estimated_arrival_time = TimeSpan.Parse(Request.Form["estimated_arrival_time"]); nv.lines.Add(l); nv.SaveChanges(); return(RedirectToAction("Index", "provider")); }
private void Form1_MouseDown(object sender, MouseEventArgs e) { //鼠标第一次按下时,设置鼠标坐标为第一个点的坐标 this.MyFlag = 1; this.MyPoint1.X = e.X; this.MyPoint1.Y = e.Y; line_detection = new line(); line_detection.point_start_x = MyPoint1.X; line_detection.point_start_y = MyPoint1.Y; //g = this.CreateGraphics(); }
void SetObjects(GameObject inputline, GameObject outputbox) { lineobj = inputline; line = inputline.GetComponent <line>(); charContainer = outputbox; objectsReady = true; Debug.Log("found line component on " + lineobj.name + ": "); Debug.Log(line); }
void drawLine(node node1, node node2) { GameObject road1 = Instantiate(line1); myLine1 = road1.GetComponent <line>(); LineRenderer lineRenderer = myLine1.GetComponent <LineRenderer>(); lineRenderer.material = new Material(Shader.Find("Particles/Additive")); lineRenderer.SetColors(Color.green, Color.green); myLine1.DrawLine(new Vector3(node1.xPos, node1.yPos, 0), new Vector3(node2.xPos, node2.yPos)); }
public static line createLine(Vector2 p1, Vector2 p2) { /* Ecuacion de la recta: y = m*x + b * Basta con devolver m y b. */ line l1 = new line(); l1.m = (p2.y - p1.y) / (p2.x - p1.x); l1.b = p1.y - l1.m * p1.x; l1.p1 = new Vector2(p1.x, p1.y); return(l1); }
static void Main(string[] args) { DrawObject[] newobj = new DrawObject[3]; newobj[0] = new line(); newobj[1] = new Circle(); newobj[2] = new Triangle(); foreach (DrawObject drawObj in newobj) { drawObj.Draw(); } }
public override line line_at(int idx) { lock (this) { if (idx < entries_.Count) { var entry = entries_[idx]; var l = new line( new sub_string(string_, idx), entry.idx_in_line(aliases) ); return l; } else { // this can happen, when the log has been re-written, and everything is being refreshed throw new line.exception("invalid line request " + idx + " / " + entries_.Count); } } }
public static line segment_to_line(segment s) { line l = new line(); if (eq (s.x1, s.x2)) { l.a = 1; l.b = 0; l.c = - s.x1; } else { l.a = - (s.y1 - s.y2) / (s.x1 - s.x2); l.b = 1; l.c = - (l.a * s.x1 + l.b * s.y1); } return l; }
public override line line_at(int idx) { lock (this) { if (idx < entries_.Count) { int old_entries = (reader_ as event_log_reader).old_event_count; if (idx < old_entries || old_entries < 0) { if (old_entries < 0) old_entries = entries_.Count; idx = old_entries - idx - 1; var entry = entries_[idx]; var l = new line(new sub_string(string_, idx), entry.idx_in_line(aliases)); return l; } else { // it's new entries var entry = entries_[idx]; var l = new line(new sub_string(string_, idx), entry.idx_in_line(aliases)); return l; } } // this can happen, when the log has been re-written, and everything is being refreshed throw new line.exception("invalid line request " + idx + " / " + entries_.Count); } }
private void updateLineView(line tmp, int index) { hieght = linesHeight[index]; int y = nextY + hieght; y -= 24; tmp.tree.Location = new System.Drawing.Point(0, nextY); tmp.tree.Size = new System.Drawing.Size(780, hieght); //need to calculate according to the number of comments + add comment line tmp.lblDelete.Location = new System.Drawing.Point(711, nextY + 4); tmp.lblEdit.Location = new System.Drawing.Point(742, nextY + 4); tmp.btnComment.Location = new System.Drawing.Point(714, y); tmp.lnedComment.Location = new System.Drawing.Point(35, y); tmp.lstDates.Location = new System.Drawing.Point(786, nextY); tmp.lstDates.Size = new System.Drawing.Size(120, hieght); tmp.lstPublishers.Location = new System.Drawing.Point(912, nextY); tmp.lstPublishers.Size = new System.Drawing.Size(130, hieght); if (loginLevel != (int)loginLevels.GUEST) { this.pnlDiscussion.Controls.Add(tmp.lblDelete); this.pnlDiscussion.Controls.Add(tmp.lblEdit); } if (hieght > minHeight && loginLevel != (int)loginLevels.GUEST) { this.pnlDiscussion.Controls.Add(tmp.btnComment); this.pnlDiscussion.Controls.Add(tmp.lnedComment); } tmp.lstDates.Items.Clear(); ; tmp.lstPublishers.Items.Clear(); if (hieght > minHeight) { tmp.lstDates.Items.AddRange( tmp.dates.ToArray<Object>() ); tmp.lstPublishers.Items.AddRange(tmp.publishers.ToArray<Object>()); } else { tmp.lstDates.Items.AddRange(new object[] { tmp.dates[0] }); tmp.lstPublishers.Items.AddRange(new object[] { tmp.publishers[0] }); } this.pnlDiscussion.Controls.Add(tmp.tree); this.pnlDiscussion.Controls.Add(tmp.lstDates); this.pnlDiscussion.Controls.Add(tmp.lstPublishers); nextY += tmp.tree.Size.Height; nextY += delta; }
private void initTreeView(line tmp, int index, Discussion discussion) { // // treeView + nodes // Comment[] comm = mainMethods.getCommentList(discussion.discussionId); tmp.publishers.Add(discussion.publisher.userName); tmp.dates.Add(discussion.publishDate.ToString()); tmp.dates.Add(""); tmp.publishers.Add(""); for (int i = 0; i < comm.Length; i++) { TreeNode treeNodeTmp = new TreeNode(comm[i].content); tmp.comments.Add(treeNodeTmp); tmp.publishers.Add(comm[i].publisher.userName); tmp.dates.Add(comm[i].publishDate.ToString()); } tmp.tnodeContent = new TreeNode("Msg Content", tmp.comments.ToArray<TreeNode>()); tmp.tnodeTitle = new TreeNode("Hello Forum!", new System.Windows.Forms.TreeNode[] { tmp.tnodeContent }); tmp.tree.BorderStyle = System.Windows.Forms.BorderStyle.None; tmp.tree.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177))); tmp.tree.ForeColor = System.Drawing.SystemColors.InfoText; tmp.tree.FullRowSelect = true; tmp.tree.Indent = 13; tmp.tree.ItemHeight = 20; tmp.tree.LineColor = System.Drawing.Color.White; tmp.tree.Location = new System.Drawing.Point(0, nextY); tmp.tree.Name = index.ToString(); // tmp.tnodeContent.Name = "content"; tmp.tnodeContent.Text = discussion.content; // tmp.tnodeTitle.Name = "title"; tmp.tnodeTitle.NodeFont = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177))); tmp.tnodeTitle.Text = discussion.title; // tmp.tree.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { tmp.tnodeTitle }); tmp.tree.Size = new System.Drawing.Size(780, hieght); //need to calculate according to the number of comments + add comment line tmp.tree.BeforeCollapse += new System.Windows.Forms.TreeViewCancelEventHandler(treeViewBeforeCollapse); tmp.tree.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(treeViewBeforeExpand); }
private void glControl1_MouseUp(object sender, MouseEventArgs e) { prevUpLoc = mouseUpLoc; Point actualGL_pos = new Point(e.Location.X - (int)xWCS, e.Location.Y - (int)yWCS); mouseUpLoc = actualGL_pos; if (userLine) { line temp = new line(mouseDownLoc, mouseUpLoc); temp.propColor = Color.GreenYellow; ds.Add(temp); ds.useDrawProgress = false; mouseDownLoc = new Point(); } if (userPoly) { //userPolyPts.Add(mouseDownLoc); userPolyPts.Add(mouseUpLoc); polygon temp = new polygon(userPolyPts); ds.Add(temp); ds.useDrawProgress = false; mouseDownLoc = new Point(); //mouseUpLoc = mouseDownLoc; } if (userQuad && (mouseDownLoc != new Point())) { quad temp = new quad(mouseDownLoc, mouseUpLoc); ds.Add(temp); ds.useDrawProgress = false; prevDownLoc = mouseDownLoc; mouseDownLoc = new Point(); mouseUpLoc = new Point(); } if (userLoopLine && (mouseDownLoc != new Point())) { userPoints.Add(mouseDownLoc); userPoints.Add(mouseUpLoc); loopline temp = new loopline(userPoints); ds.Add(temp); ds.useDrawProgress = false; } refreshListView1(); }
/// <summary> /// Возвращает точку пересечения отрезков (включая крайние точки) или значение по умолчанию, если отрезки не пересекаются /// </summary> public static Vector2 getSegments(line a, line b, Vector2 defaultValue) { return getSegments(a.p1, a.p2, b.p1, b.p2, true, defaultValue); }
/// <summary> /// Указывает, пересекаются ли прямые и возвращает точку пересечения прямых /// </summary> public static bool tryStraights(line a, line b, out Vector2 point) { return trySegments(a.p1, a.p2, b.p1, b.p2, out point); }
/// <summary> /// Указывает, пересекаются ли отрезки /// </summary> public static bool tryStraights(line a, Vector2 b1, Vector2 b2) { return tryStraights(a.p1, a.p2, b1, b2); }
/// <summary> /// Указывает, пересекаются ли отрезки (включая крайние точки) и возвращает точку пересечения /// </summary> public static bool trySegments(line a, Vector2 b1, Vector2 b2, out Vector2 point) { return trySegments(a.p1, a.p2, b1, b2, true, out point); }
private void glPrimitiveDialog_Load(object sender, EventArgs e) { this.Text = _Type + " properties"; _isOpen = true; switch (_Type) { case "TRIANGLE": _aTri = (triangle)input; enableControls(true, true, true); checkBox_showVerts.Checked = _aTri.showVerts; button_VertexColor.BackColor = _aTri.lineColor; UpDown_VertextSize.Text = _aTri.vertSize.ToString(); checkBox_showLines.Checked = _aTri.showLines; button_LineColor.BackColor = _aTri.lineColor; UpDown_LineWidth.Text = _aTri.lineWidth.ToString(); break; case "LINE": _aLine = (line)input; enableControls(true, true, false); checkBox_showVerts.Checked = _aLine.showVerts; UpDown_VertextSize.Text = _aLine.vertSize.ToString(); break; case "POINT": _aPoint = (point)input; enableControls(true, false, false); break; case "POLYGON": _aPoly = (polygon)input; enableControls(true, true, true); break; case "QUAD": _aQuad = (quad)input; enableControls(true, true, true); checkBox_showVerts.Checked = _aQuad.showVerts; button_VertexColor.BackColor = _aQuad.lineColor; UpDown_VertextSize.Text = _aQuad.vertSize.ToString(); checkBox_showLines.Checked = _aQuad.showLines; button_LineColor.BackColor = _aQuad.lineColor; UpDown_LineWidth.Text = _aQuad.lineWidth.ToString(); button_ObjectColor.BackColor = _aQuad.propColor; break; case "LOOPLINE": _aLoopLine = (loopline)input; enableControls(true, true, true); break; default: break; } }
private void buttonOkay_Click(object sender, EventArgs e) { //Gather up the information and set it output = new glPrimitives(); output = input; switch (_Type) { case "TRIANGLE": _aTri = (triangle)input; _aTri.showVerts = checkBox_showVerts.Checked; _aTri.lineColor = button_VertexColor.BackColor; _aTri.vertSize = (float)Convert.ToDecimal(UpDown_VertextSize.Text.ToString()); _aTri.showLines = checkBox_showLines.Checked; _aTri.lineColor = button_LineColor.BackColor; _aTri.lineWidth = (float)Convert.ToDecimal(UpDown_LineWidth.Text.ToString()); output = _aTri; break; case "LINE": _aLine = (line)input; _aLine.showVerts = checkBox_showVerts.Checked; _aLine.propColor = button_ObjectColor.BackColor; _aLine.vertColor = button_VertexColor.BackColor; _aLine.vertSize = (float)Convert.ToDecimal(UpDown_VertextSize.Text.ToString()); output = _aLine; break; case "POINT": _aPoint = (point)input; output = _aPoint; break; case "POLYGON": _aPoly = (polygon)input; output = _aPoly; break; case "QUAD": _aQuad = (quad)input; _aQuad.showVerts = checkBox_showVerts.Checked; _aQuad.lineColor = button_VertexColor.BackColor; _aQuad.vertSize = (float)Convert.ToDecimal(UpDown_VertextSize.Text.ToString()); _aQuad.showLines = checkBox_showLines.Checked; _aQuad.lineColor = button_LineColor.BackColor; _aQuad.lineWidth = (float)Convert.ToDecimal(UpDown_LineWidth.Text.ToString()); _aQuad.propColor = button_ObjectColor.BackColor; output = _aQuad; break; case "LOOPLINE": _aLoopLine = (loopline)input; output = _aLoopLine; break; default: break; } this.Close(); }
private void glControl1_MouseMove(object sender, MouseEventArgs e) { actualGL_pos = new Point(e.Location.X - (int)xWCS, e.Location.Y - (int)yWCS); label3.Text = "X: " + actualGL_pos.X.ToString() + " Y: " + actualGL_pos.Y.ToString(); if (ds.useMoveProgress) Render(); else { if (cb_vertexSnap.Checked) if (!bgw_vertexSnap.IsBusy) bgw_vertexSnap.RunWorkerAsync(actualGL_pos); if (userLine && (mouseDownLoc != new Point())) { line temp = new line(mouseDownLoc, actualGL_pos); ds.setProgressObj(temp); ds.useDrawProgress = true; } if (userPoly && userPolyPts.Count > 0 && mouseDownLoc != new Point()) { userPolyPts.Add(actualGL_pos); // mouse current location polygon temp = new polygon(userPolyPts); ds.setProgressObj(temp); ds.useDrawProgress = true; } if (userPoint) { point temp = new point(actualGL_pos); temp.size = 5; temp.propColor = Color.Azure; ds.setProgressObj(temp); ds.useDrawProgress = true; } if (userQuad && (mouseDownLoc != new Point())) { quad temp = new quad(mouseDownLoc, actualGL_pos); // use the two point method ds.setProgressObj(temp); ds.useDrawProgress = true; prevDownLoc = mouseDownLoc; } if (userLoopLine && (mouseDownLoc != new Point()) && (userPoints.Count() > 0)) { userPoints.Add(actualGL_pos); loopline temp = new loopline(userPoints); userPoints.RemoveAt(userPoints.Count() - 1); ds.setProgressObj(temp); ds.useDrawProgress = true; } } }
public full_log_match_item(BitArray matches, font_info font, line line, int line_idx, log_view parent) : base(matches, font, line, line_idx, parent) { Debug.Assert(parent != null); parent_ = parent; }
public List<filter_line.match_index> match_indexes(line l, info_type type) { List<filter_line.match_index> indexes = null; bool has_match_color = font_.match_fg != util.transparent || font_.match_bg != util.transparent; if ( has_match_color) foreach (filter_line line in items_) { var now = line.match_indexes(l, type); if (now.Count > 0) { if ( indexes == null) indexes = new List<filter_line.match_index>(); // here, we need to set the match colors foreach (var index in now) { index.fg = font_.match_fg; index.bg = font_.match_bg; } indexes.AddRange(now); } } return indexes ?? empty_; }
l_lines.Add(line);
/// <summary> /// Указывает, пересекаются ли отрезки /// </summary> public static bool trySegments(line a, Vector2 b1, Vector2 b2, bool withCloseUp = true) { return trySegments(a.p1, a.p2, b1, b2, withCloseUp); }
/// <summary> /// Указывает, пересекаются ли отрезки /// </summary> public static bool trySegments(line a, line b, bool withCloseUp = true) { return trySegments(a.p1, a.p2, b.p1, b.p2, withCloseUp); }
private void createNewLine(Discussion discussion) { int index = lines.Count; line tmp = new line(); hieght = minHeight; linesHeight.Add(hieght); tmp.comments = new List<TreeNode>(); tmp.tree = new TreeView(); tmp.dates = new List<string>(); tmp.publishers = new List<string>(); tmp.lblEdit = new Label(); tmp.lblDelete = new Label(); tmp.lnedComment = new TextBox(); tmp.btnComment = new Button(); tmp.lstDates = new ListBox(); tmp.lstPublishers = new ListBox(); initTreeView(tmp, index, discussion); initDeleteEditLbls(tmp ,index); initCommentLine(tmp, index); initDateList(tmp, index); initPublishersList(tmp, index); if (index % 2 == 0) { tmp.lblEdit.BackColor = System.Drawing.SystemColors.GradientActiveCaption; tmp.lblDelete.BackColor = System.Drawing.SystemColors.GradientActiveCaption; tmp.tree.BackColor = System.Drawing.SystemColors.GradientActiveCaption; tmp.lstDates.BackColor = System.Drawing.SystemColors.GradientActiveCaption; tmp.lstPublishers.BackColor = System.Drawing.SystemColors.GradientActiveCaption; } else { tmp.lblEdit.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; tmp.lblDelete.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; tmp.tree.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; tmp.lstDates.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; tmp.lstPublishers.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; } if (loginLevel != (int)loginLevels.GUEST) { this.pnlDiscussion.Controls.Add(tmp.lblDelete); this.pnlDiscussion.Controls.Add(tmp.lblEdit); } this.pnlDiscussion.Controls.Add(tmp.lstDates); this.pnlDiscussion.Controls.Add(tmp.lstPublishers); this.pnlDiscussion.Controls.Add(tmp.tree); lines.Add(tmp); nextY += tmp.tree.Size.Height; nextY += delta; }
/// <summary> /// Указывает, пересекаются ли отрезки и возвращает точку пересечения /// </summary> public static bool trySegments(line a, line b, bool withCloseUp, out Vector2 point) { return trySegments(a.p1, a.p2, b.p1, b.p2, withCloseUp, out point); }
private void initCommentLine(line tmp, int index) { int y = nextY + tmp.tree.Size.Height; y -= 35; // // button - comment // tmp.btnComment.BackColor = System.Drawing.SystemColors.HighlightText; tmp.btnComment.Location = new System.Drawing.Point(714, y); tmp.btnComment.Name = index.ToString(); // tmp.btnComment.Size = new System.Drawing.Size(63, 20); tmp.btnComment.TabIndex = 46; tmp.btnComment.Text = "Comment"; tmp.btnComment.UseVisualStyleBackColor = false; tmp.btnComment.Click += new System.EventHandler(this.commentMsgClicked); // // textBox - comment // tmp.lnedComment.Location = new System.Drawing.Point(35, y); tmp.lnedComment.Name = index.ToString(); // tmp.lnedComment.Size = new System.Drawing.Size(673, 20); tmp.lnedComment.TabIndex = 45; tmp.lnedComment.MaxLength = 80; }
/// <summary> /// Указывает, пересекаются ли отрезки /// </summary> public static bool tryStraights(line a, line b) { return tryStraights(a.p1, a.p2, b.p1, b.p2); }
private void initDeleteEditLbls(line tmp, int index) { // // lbl Edit // tmp.lblEdit.AutoSize = true; tmp.lblEdit.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(177))); tmp.lblEdit.Location = new System.Drawing.Point(711, nextY + 4); tmp.lblEdit.Name = index.ToString(); // tmp.lblEdit.Size = new System.Drawing.Size(38, 13); tmp.lblEdit.TabIndex = 48; tmp.lblEdit.Text = "Delete"; tmp.lblEdit.Cursor = System.Windows.Forms.Cursors.Hand; tmp.lblEdit.Click += new System.EventHandler(this.deleteMsgClicked); // // lbl Delete // tmp.lblDelete.AutoSize = true; tmp.lblDelete.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(177))); tmp.lblDelete.Location = new System.Drawing.Point(742, nextY + 4); tmp.lblDelete.Name = index.ToString(); // tmp.lblDelete.Size = new System.Drawing.Size(25, 13); tmp.lblDelete.TabIndex = 47; tmp.lblDelete.Text = "Edit"; tmp.lblDelete.Cursor = System.Windows.Forms.Cursors.Hand; tmp.lblDelete.Click += new System.EventHandler(this.editMsgClicked); }
/// <summary> /// Возвращает точку пересечения отрезков или значение по умолчанию, если отрезки не пересекаются /// </summary> public static Vector2 getSegments(line a, line b, bool withCloseUp, Vector2 defaultValue) { return getSegments(a.p1, a.p2, b.p1, b.p2, withCloseUp, defaultValue); }
private void initPublishersList(line tmp, int index) { // // Publishers // tmp.lstPublishers.BorderStyle = System.Windows.Forms.BorderStyle.None; tmp.lstPublishers.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177))); tmp.lstPublishers.FormattingEnabled = true; tmp.lstPublishers.IntegralHeight = false; tmp.lstPublishers.DrawMode = DrawMode.OwnerDrawVariable; tmp.lstPublishers.ItemHeight = 20; tmp.lstPublishers.Items.AddRange(new object[] { tmp.publishers[0] }); tmp.lstPublishers.Location = new System.Drawing.Point(912, nextY); tmp.lstPublishers.Name = index.ToString(); // tmp.lstPublishers.Size = new System.Drawing.Size(130, hieght); //need to calculate height tmp.lstPublishers.TabIndex = 43; tmp.lstPublishers.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lstPublishers_DrawItem); }
/// <summary> /// Возвращает точку пересечения прямых или значение по умолчанию, если прямые параллельны /// </summary> public static Vector2 getStraights(line a, line b, Vector2 defaultValue) { return getStraights(a.p1, a.p2, b.p1, b.p2, defaultValue); }
private filter.match create_match_object(BitArray matches, font_info font, line line, int lineIdx) { return is_full_log ? new full_log_match_item(matches, font, line, lineIdx, this) : new match_item(matches, font, line, lineIdx, this); }