Ejemplo n.º 1
0
 public Line(Point start, Point stop, LineType type, LineStyle style)
 {
     Start = start;
     Stop = stop;
     Type = type;
     Style = style;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Construction
 /// </summary>
 public LinePrimitive(LineType type, int penIndex, PointF p1, PointF p2)
 {
     this.m_LineType = type;
     this.m_PenIndex = penIndex;
     this.m_P1 = p1;
     this.m_P2 = p2;
 }
Ejemplo n.º 3
0
 protected override RuleResult CreateResult(LineType lineType, string key)
 {
     RuleResult result = base.CreateResult(lineType, key);
     if(lineType != LineType.Unknown && lineType != LineType.Empty)
         result.EventType = EventType.Sql;
     return result;
 }
Ejemplo n.º 4
0
 public LineInfo(LineType aType, int aLineNumber, int aIncludeFileID, string aLine)
 {
     Type          = aType;
     LineNumber    = aLineNumber;
     Line          = aLine;
     IncludeFileID = aIncludeFileID;
 }
Ejemplo n.º 5
0
 protected override void BeginLine(string label, TextWriter fw, LineType type)
 {
     if (m_textProps.TextLabels)
     {
         if (TextFormatter.IsLabel(label))
         {
             RtfTools.SetFont(fw, Fonts.LabelFont, 3);
             fw.Write(label);
         }
         else
         {
             RtfTools.SetFont(fw, Fonts.TextFont, 1);
             fw.Write(label);
         }
     }
     switch (type)
     {
         case LineType.TEXT:
             RtfTools.SetFont(fw, Fonts.TextFont, 1);
             break;
         case LineType.CHORD:
             RtfTools.SetFont(fw, Fonts.ChordFont, 2);
             break;
     }
 }
Ejemplo n.º 6
0
 public LineData(string text, int left, int right, LineType type)
 {
   _text = text;
   _left = left;
   _right = right;
   _type = type;
 }
Ejemplo n.º 7
0
        public ParcourChannel(Vector Start, Vector End, LineType type, List<Line> lines, Converter c)
        {
            this.Start = Start;
            this.End = End;
            List<Line> pointLine = lines.Where(p => p.Type == (int)LineType.Point).ToList();
            int i = 0;
            if (type == LineType.START_B)
            {
                i = 9;
            }
            else if (type == LineType.START_C)
            {
                i = 18;
            }
            else if (type == LineType.START_D)
            {
                i = 27;
            }
            List<Line> corridorPoints = new List<Line>();
            for (int j = 0; j < 9; j++)
            {
                corridorPoints.Add(pointLine[i + j]);
            }
            foreach (Line l in corridorPoints)
            {
                Vector v = ParcourModel.getVector(c, l.A);

                if (isEdited(l))
                {
                    ImmutablePoints.Add(v);
                }
                LinearCombinations.Add(v);
            }
            LinearCombinations.Add(End);
        }
Ejemplo n.º 8
0
		public static Point ProjectOnto(this Point p, LineSegment seg, LineType type, out int? end)
		{
			end = 0;
			Vector v = seg.Vector();
			Vector w = p.Sub(seg.A);
			T c1 = w.Dot(v); // c1 == |w|*|v|*cos(angle between them)
			if (c1 <= 0) { // angle between line segment and (p-seg.A) is negative (-180..0)?
				if (v.X == 0 && v.Y == 0) {
					// seg.A == seg.B
					end = null;
					return seg.A;
				} else if (c1 < 0)
					end = -1;
				if (type != LineType.Infinite)
					return seg.A;
			}
			T c2 = v.Quadrance(); // == |v|*|v|
			if (c1 >= c2) { // quadrance from seg.A to projected point >= quadrance of seg
				if (c1 > c2)
					end = 1;
				if (type == LineType.Segment)
					return seg.B;
			}
			if (c2 == 0) {
				// seg.A and seg.B are infitessimally close together; c2 was truncated to zero
				end = null;
				return seg.A;
			}

			T frac = c1 / c2;                    // == |w|/|v|*cos(angle)
			Point projected = seg.A.Add(v.Mul(frac)); // == p0 + v/|v|*|w|*cos(angle)
			return projected;
		}
Ejemplo n.º 9
0
 public static Paint.Style GetLineStyle(LineType lineType)
 {
     if (lineType == LineType.Solid)
         return Paint.Style.Fill;
     if (lineType == LineType.Stroke)
         return Paint.Style.Stroke;
     return Paint.Style.Fill;
 }
Ejemplo n.º 10
0
 public BorderBrush(Color backgroundColor, LineType lineType, Color lineColor, int lineWidth = 1)
 {
     BackgroundColor = backgroundColor;
     this.lineType = lineType;
     this.lineColor = lineColor;
     this.lineWidth = lineWidth;
     RebuildTexture();
 }
Ejemplo n.º 11
0
        public Line(PointD tstartpnt, PointD tendpnt, Color tcolor, LineType ttype, float twidth)
        {
            this.Color = tcolor;
            this.LineType = ttype;
            this.LineWidth = twidth;

            this.p1 = tstartpnt.Clone() as PointD;
            this.p2 = tendpnt.Clone() as PointD;
        }
Ejemplo n.º 12
0
		private void TestItsc(LineSegment<float> p, LineSegment<float> q, Point<float>? expected, float expect_pFrac, LineType pt = LineType.Segment, LineType qt = LineType.Segment)
		{
			float pFrac, qFrac;
			bool intersected = p.ComputeIntersection(pt, out pFrac, q, qt, out qFrac);
			Assert.AreEqual(expected.HasValue, intersected);
			Point<float>? result = p.ComputeIntersection(pt, q, qt);
			Assert.AreEqual(expected, result);
			Assert.AreEqual(expect_pFrac, pFrac);
		}
Ejemplo n.º 13
0
        public void UpdateWinnerInfo(LineType lineType, int index, bool first)
        {
            WinnerLine  = lineType;
            WinnerIndex = index;

            if (first)
                Wins++;
            else
                Losses++;
        }
Ejemplo n.º 14
0
        public Line(Line tline, Color tcolor, LineType ttype, float twidth)
        {
            if (tline.Name != null)
                Name = tline.Name;
            this.Color = tcolor;
            this.LineType = ttype;
            this.LineWidth = twidth;

            this.p1 = tline.p1.Clone() as PointD;
            this.p2 = tline.p2.Clone() as PointD;
        }
Ejemplo n.º 15
0
		public FilterSource ()
		{
			// Initialize the linetype member.
			SrcLineType = LineType.None;
			SrcLangType = LangType.None;
			StrConstIdentifier = " ";

			SnippetMode = true;
			OriginalIsText = true;
			token = new StringBuilder ();
			SetFileType ("source");
		}
Ejemplo n.º 16
0
 private bool AddLinePrefixTags(LineType type, bool flagOpened, StringBuilder sb)
 {
     if (((type & LineType.CloseBefore) != 0) || (flagOpened == false))
     {
         sb.Append("<p>");
         flagOpened = true;
     }
     if ((type & LineType.PreFormatted) != 0)
     {
         sb.Append("<pre>");
     }
     return flagOpened;
 }
Ejemplo n.º 17
0
 public static void DrawLine(IInputOutputArray image,
     Point start,
     Point end,
     MCvScalar color,
     int thickness = 1,
     LineType lineType = LineType.EightConnected,
     int shift = 0)
 {
     using (InputOutputArray array = image.GetInputOutputArray())
     {
         cveLine(array, ref start, ref end, ref color, thickness, lineType, shift);
     }
 }
Ejemplo n.º 18
0
 private bool AddLinePostfixTags(LineType type, bool flagOpened, StringBuilder sb, int count, int linesLength)
 {
     if ((type & LineType.PreFormatted) != 0)
     {
         sb.Append("</pre>");
     }
     if (((type & LineType.CloseEnd) != 0) || (count == linesLength - 1))
     {
         sb.Append("</p>");
         flagOpened = false;
     }
     return flagOpened;
 }
Ejemplo n.º 19
0
 public static void DrawCircle(IInputOutputArray image,
     Point center,
     int radius,
     MCvScalar color,
     int thickness = 1,
     LineType lineType = LineType.EightConnected,
     int shift = 0)
 {
     using (InputOutputArray array = image.GetInputOutputArray())
     {
         cveCircle(array, ref center, radius, ref color, thickness, lineType, shift);
     }
 }
Ejemplo n.º 20
0
        public static void DrawEllipse(IInputOutputArray image,
            RotatedRect box,
            MCvScalar color,
            int thickness = 1,
            LineType lineType = LineType.EightConnected,
            int shift = 0)
        {
            int width = (int)Math.Round(box.Size.Height * 0.5F);
            int height = (int)Math.Round(box.Size.Width * 0.5F);
            Size axesSize = new Size(width, height);
            Point center = Point.Round(box.Center);

            DrawEllipse(image, center, axesSize, box.Angle, 0.0D, 360.0D, color, thickness, lineType, shift);
        }
Ejemplo n.º 21
0
 public static void DrawEllipse(IInputOutputArray image,
     Point center,
     Size axes,
     double angle,
     double startAngle,
     double endAngle,
     MCvScalar color,
     int thickness = 1,
     LineType lineType = LineType.EightConnected,
     int shift = 0)
 {
     using (InputOutputArray array = image.GetInputOutputArray())
     {
         cveEllipse(array, ref center, ref axes, angle, startAngle, endAngle, ref color, thickness, lineType, shift);
     }
 }
        public static Pen getConnection(LineType LineType, ConnectionType ConnectionType, Graphics g)
        {
            Pen pen = ConnectionPen.getConnection(ConnectionType, g);

            switch (LineType)
            {
                case LineType.NORMAL: //normal
                    ConnectionPen.setPen(Color.Black, 1.3F);
                    break;
                case LineType.HIGHLIGHTED:
                    ConnectionPen.setPen(Color.Red, 2F);
                    break;
                default:
                    ConnectionPen.setPen(Color.Blue, 1.5F);
                    break;
            }
            return pen ;
        }
Ejemplo n.º 23
0
 public static void DrawContours(IInputOutputArray image,
     IInputArray contours,
     int contourIdx,
     MCvScalar color,
     int thickness = 1,
     LineType lineType = LineType.EightConnected,
     IInputArray hierarchy = null,
     int maxLevel = int.MaxValue,
     Point offset = default(Point))
 {
     using (InputOutputArray imageArray = image.GetInputOutputArray())
     {
         using (InputArray contoursArray = contours.GetInputArray())
         {
             using (InputArray hierarchyArray = (hierarchy != null) ? hierarchy.GetInputArray() : EmptyArray<InputArray>.Value)
             {
                 cveDrawContours(imageArray, contoursArray, contourIdx, ref color, thickness, lineType, hierarchyArray, maxLevel, ref offset);
             }
         }
     }
 }
Ejemplo n.º 24
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Adds content from various fields in the ANA record.
		/// </summary>
		/// <param name="type">The type of field being processed.</param>
		/// <param name="form">The individual form being added.</param>
		/// -----------------------------------------------------------------------------------
		internal virtual void AddContent(LineType type, string form)
		{
			switch (type)
			{
				case LineType.kUnderlyingForm:
				{
					m_underlyingForm = form;
					break;
				}
				case LineType.kCategory:
				{
					m_category = form;
					break;
				}
				case LineType.kDecomposition:
				{
					m_decomposition = form;
					break;
				}
			}
		}
Ejemplo n.º 25
0
        public Line(string lineText, LineType? overrideLineType = null)
        {
            var trimmedLineText = lineText.TrimEnd();

            if (overrideLineType != null)
            {
                Type = overrideLineType.Value;
                Text = lineText;
            }
            //The % sign at the end of the line is a convention
            //that indicates that the line is a set of chords
            else if (trimmedLineText.EndsWith("%"))
            {
                Type = LineType.Chord;

                int lastLocation = trimmedLineText.LastIndexOf("%");

                if (lastLocation > -1)
                    trimmedLineText = trimmedLineText.Substring(0, lastLocation);

                Text = trimmedLineText;

                for(int c = 0; c < Text.Length; c++)
                {
                    if(Text[c] == ' ')
                    {
                        Text = Text.Insert(c, "  ");
                        c+=2;
                    }
                }
            }
            else
            {
                Type = LineType.Text;
                Text = trimmedLineText;
            }
        }
Ejemplo n.º 26
0
        public int GetLineIndex(Position position, LineType type)
        {
            if (type == LineType.Row)
            {
                return(position.Row);
            }

            if (type == LineType.Column)
            {
                return(position.Col);
            }

            if (type == LineType.DiagonalOne)
            {
                return(GetDiagonalOneIndex(position));
            }

            if (type == LineType.DiagonalTwo)
            {
                return(GetDiagonalTwoIndex(position));
            }

            throw new ArgumentException($"Unsupported LineType: {type}.");
        }
Ejemplo n.º 27
0
        static double[] getDashByLineStyle(LineType type)
        {
            switch (type)
            {
            case LineType.Solid:
                return(null);

            case LineType.Dots:
                return(dotsStyle);

            case LineType.Dash:
                return(dashesStyle);

            case LineType.DashDot:
                return(dashDotStyle);

            case LineType.DashDotDot:
                return(dashDotDotStyle);

            default:
                break;
            }
            return(null);
        }
Ejemplo n.º 28
0
        private LineType GetLineType(string value)
        {
            LineType rval = LineType.solid; // default

            switch (value)
            {
            case "solid":
                rval = LineType.solid;
                break;

            case "dashed":
                rval = LineType.dashed;
                break;

            case "dotted":
                rval = LineType.dotted;
                break;

            default:
                M.ThrowError("Error: unknown line type");
                break;
            }
            return(rval);
        }
Ejemplo n.º 29
0
        protected internal override xyz Cross(LineType ViewLine)
        {
            xyArray A = this.CurveArray.getxyArray();

            double Dummy = -1;
            double _Lam  = -1;
            double di    = A.Distance(ViewLine, 2 * Snapdist, out _Lam, out Dummy);

            if (di <= 2 * Snapdist)
            {
                Lam        = this.CurveArray.xyArrayIndexToCurveArrayIndex(_Lam);
                doExchange = true;
                return(this.CurveArray.Value(Lam).toXYZ());
            }
            else
            {
                Lam = -1;
            }
            xyz    Result  = new xyz(0, 0, 0);
            double LineLam = -1;

            new Plane(new xyz(0, 0, 0), new xyz(0, 0, 1)).Cross(ViewLine, out LineLam, out Result);
            return(Result);
        }
Ejemplo n.º 30
0
        public ParcourChannelSingle(Vector Start, Vector End, LineType type, List <Line> lines, Converter c)
        {
            this.Start = Start;
            this.End   = End;
            List <Line> pointLine      = lines.Where(p => p.Type == (int)LineType.Point).ToList();
            int         i              = 0;
            List <Line> corridorPoints = new List <Line>();

            for (int j = 0; j < 9; j++)
            {
                corridorPoints.Add(pointLine[i + j]);
            }
            foreach (Line l in corridorPoints)
            {
                Vector v = ParcourModel.getVector(c, l.A);

                if (isEdited(l))
                {
                    ImmutablePoints.Add(v);
                }
                LinearCombinations.Add(v);
            }
            LinearCombinations.Add(End);
        }
Ejemplo n.º 31
0
        public override Base GetBase()
        {
            Base B = ModelMatrix.toBase();;

            B.BaseO = Point;
            int id = -1;

            for (int i = 0; i < PolyPoly.Count; i++)
            {
                xyArray  A        = PolyPoly[i];
                LineType ViewLine = Device.FromScr(Device.MousePos);
                double   Dummy    = -1;
                double   di       = A.Distance(ViewLine, 2 * Snapdist, out Lam, out Dummy);
                if (di <= 2 * Snapdist)
                {
                    id = i;
                    break;
                }
            }
            if (id >= 0)
            {
                xyzArray A = ModelMatrix * PolyPoly[id].ToxyzArray();
                if (Lam >= 0)
                {
                    xyz D = ModelMatrix * PolyPoly[id].Direction(Lam).toXYZ() - ModelMatrix * new xyz(0, 0, 0);
                    B = Base.DoComplete(Point, D, new xyz(0, 0, 1) & D);
                }
            }
            else
            {
                xyzArray A = ModelMatrix * PolyPoly[0].ToxyzArray();
                xyz      D = A.cross();
                B = Base.DoComplete(Point, D, new xyz(0, 0, 1) & D);
            }
            return(B);
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Initializes a new instance of the <c>Insert</c> class.
        /// </summary>
        /// <param name="block">Insert block definition.</param>
        /// <param name="insertionPoint">Insert <see cref="Vector3f">point</see>.</param>
        public Insert(Block block, Vector3f insertionPoint)
            : base(DxfObjectCode.Insert)
        {
            if (block == null)
            {
                throw new ArgumentNullException("block");
            }

            this.block          = block;
            this.insertionPoint = insertionPoint;
            this.scale          = new Vector3f(1.0f, 1.0f, 1.0f);
            this.rotation       = 0.0f;
            this.normal         = Vector3f.UnitZ;
            this.layer          = Layer.Default;
            this.color          = AciColor.ByLayer;
            this.lineType       = LineType.ByLayer;
            this.attributes     = new List <RTSafe.DxfCore.Entities.Attribute>();
            foreach (AttributeDefinition attdef in block.Attributes.Values)
            {
                //this.attributes.Add(new Attribute(attdef));
                //this.attributes.Add(()attdef);
            }
            this.endSequence = new EndSequence();
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Parses a file
        /// </summary>
        /// <param name="fileStream">file stream</param>
        /// <returns></returns>
        ILineCount IFileParser.Parse(FileStream fileStream)
        {
            LineCounter lineCounter = LineCounter.CreateLineCounter();

            ILineParser lineParser = lineCounter.GetLineParser();

            fileStream.Position = 0;
            LineCountImp lineCount = new LineCountImp();

            if (fileStream.CanRead)
            {
                StreamReader sr = new StreamReader(fileStream);

                bool inComment = false;

                while (sr.Peek() > -1)
                {
                    string   line     = sr.ReadLine();
                    LineType lineType = lineParser.Parse(line);

                    if (lineType == LineType.BeginComment)
                    {
                        inComment = true;
                    }

                    lineCount.SetLine((inComment ? LineType.LineComment : lineType));

                    if (lineType == LineType.EndComment)
                    {
                        inComment = false;
                    }
                }
            }

            return(lineCount);
        }
Ejemplo n.º 34
0
        static bool Cross(LineType L1, LineType L2, ref double Lam1, ref double Lam2)
        {
            xyz    PQ  = L2.P - L1.P;
            double PQV = PQ * L1.Direction;
            double PQW = PQ * L2.Direction;
            double vv  = L1.Direction * L1.Direction;
            double ww  = L2.Direction * L2.Direction;
            double vw  = L2.Direction * L1.Direction;
            double Det = vv * ww - vw * vw;

            if (Det == 0)// parallele
            {
                return(false);
            }
            else
            {
                Lam1 = (PQV * ww - PQW * vw) / Det;
                Lam2 = -(PQW * vv - PQV * vw) / Det;

                double d = PQ * (L2.Direction & L1.Direction).normalized();

                return((System.Math.Abs(d) < 0.0000001) && (0 <= Lam1) && (Lam1 <= 1) && (0 <= Lam2) && (Lam2 <= 1));
            }
        }
Ejemplo n.º 35
0
 public TooltipLine(LineType InType)
 {
     Type = InType;
 }
Ejemplo n.º 36
0
        /// <summary>Creates a series definition.</summary>
        /// <param name="title">The title.</param>
        /// <param name="filter">The filter. Can be null.</param>
        /// <param name="colour">The colour.</param>
        /// <param name="line">The line type.</param>
        /// <param name="marker">The marker type.</param>
        /// <param name="simulationNames">A list of simulations to include in data.</param>
        /// <returns>The newly created definition.</returns>
        private SeriesDefinition CreateDefinition(string title, string filter, Color colour, MarkerType marker, LineType line, string[] simulationNames)
        {
            SeriesDefinition definition = new SeriesDefinition();

            definition.SimulationNames = simulationNames;
            definition.Filter          = filter;
            definition.colour          = colour;
            definition.title           = title;
            if (IncludeSeriesNameInLegend)
            {
                definition.title += ": " + Name;
            }
            definition.line          = line;
            definition.marker        = marker;
            definition.lineThickness = LineThickness;
            definition.markerSize    = MarkerSize;
            definition.showInLegend  = ShowInLegend;
            definition.type          = Type;
            definition.xAxis         = XAxis;
            definition.xFieldName    = XFieldName;
            definition.yAxis         = YAxis;
            definition.yFieldName    = YFieldName;
            return(definition);
        }
Ejemplo n.º 37
0
 public VectorLine(Vector _A, Vector _B)
 {
     A  = _A;
     B  = _B;
     lt = LineType.Infinite;
 }
Ejemplo n.º 38
0
		public static Point? ComputeIntersection(this LineSegment P, LineSegment Q, LineType type = LineType.Segment)
		{
			return ComputeIntersection(P, type, Q, type);
		}
Ejemplo n.º 39
0
        public static Rectangle DrawLine(this Context g, PointD p1, PointD p2, Cairo.Color color, double lineWidth, LineType lineType, bool render)
        {
            g.Save ();
            var dashesStyle = getDashByLineStyle(lineType);
            if(dashesStyle != null){
                g.SetDash(dashesStyle,lineWidth);
            }
            g.MoveTo (p1.X, p1.Y);
            g.LineTo (p2.X, p2.Y);

            g.Color = color;
            g.LineWidth = lineWidth;
            g.LineCap = LineCap.Butt;

            Rectangle dirty = g.StrokeExtents ();
            if(render)
                g.Stroke ();

            g.Restore ();

            return dirty;
        }
Ejemplo n.º 40
0
 /// <summary>
 /// Determines if a specified line type exists in the table.
 /// </summary>
 /// <param name="lineType">Line type to locate.</param>
 /// <returns>True if the specified line type exists or false in any other case.</returns>
 public bool ContainsLineType(LineType lineType)
 {
     return(this.lineTypes.ContainsKey(lineType.Name));
 }
Ejemplo n.º 41
0
		public static bool ComputeIntersection(this LineSegment P, LineSegment Q, out T pFrac, LineType type = LineType.Segment)
		{
			T qFrac;
			return ComputeIntersection(P, type, out pFrac, Q, type, out qFrac);
		}
Ejemplo n.º 42
0
 public VectorLine(string lineName, Vector3[] linePoints, Material lineMaterial, float width, LineType lineType, Joins joins)
 {
     points3 = linePoints;
     SetupMesh(ref lineName, lineMaterial, null, ref width, lineType, joins, false, false);
 }
Ejemplo n.º 43
0
 public VectorLine(string lineName, Vector2[] linePoints, Material lineMaterial, float width, LineType lineType)
 {
     points2 = linePoints;
     SetupMesh(ref lineName, lineMaterial, null, ref width, lineType, Joins.None, true, false);
 }
        /// <summary>
        /// Constructor dedicado para crear líneas de apertura y cierre de documentos
        /// hijo del documento principal o de otros subdocumentos.
        /// </summary>
        /// <param name="line">Par de valores con la clave conteniendo el nombre del objecto y
        /// como valor el BsonValue que define el contenido del objeto BSON.</param>
        /// <param name="lineType">Definición del tipo de línea</param>
        /// <param name="tabLength">Longitud del tabulado para esta linea.</param>
        public DocumentViewerLine(KeyValuePair <string, BsonValue> line, int lineNumber, LineType lineType, int tabLength)
        {
            InitializeComponent();

            RawLine       = line;
            LineKey       = line.Key;
            LineValue     = line.Value;
            LineType      = lineType;
            LineTabLength = tabLength;
            LineNumber    = lineNumber;

            if (lineType == LineType.NestedObjectOpening)
            {
                tbxVariable.Text        = line.Key;
                tbxValue.Text           = "{";
                tbkDoubleDot.Visibility = Visibility.Visible;
                tbxValue.Visibility     = Visibility.Visible;
                IsVariableEditable      = true;
                IsValueEditable         = false;
                btnFolding.Visibility   = Visibility.Visible;
            }
            else if (lineType == LineType.NestedObjectClosing)
            {
                tbxVariable.Text        = "}";
                tbkDoubleDot.Visibility = Visibility.Hidden;
                tbxValue.Visibility     = Visibility.Hidden;
                IsVariableEditable      = false;
                IsValueEditable         = false;
            }

            SetLineValueType();
            IsEndingOrStartingLine = true;
            tbxVariable.Margin     = new Thickness(tabLength, 0, 0, 0);
            HideValueTypeSelection();
        }
Ejemplo n.º 45
0
 public VectorLine(string lineName, Vector3[] linePoints, Color[] colors, Material lineMaterial, float width, LineType lineType)
 {
     points3 = linePoints;
     SetupMesh(ref lineName, lineMaterial, colors, ref width, lineType, Joins.None, false, false);
 }
 /// <summary>
 /// Constructor dedicado para crear líneas de apertura y cierre de documentos
 /// hijo del documento principal o de otros subdocumentos.
 /// </summary>
 /// <param name="line">Par de valores con la clave conteniendo el nombre del objecto y
 /// como valor el BsonValue que define el contenido del objeto BSON.</param>
 /// <param name="lineType">Definición del tipo de línea</param>
 public DocumentViewerLine(KeyValuePair <string, BsonValue> line, int lineNumber, LineType lineType) : this(line, lineNumber, lineType, DEFAULT_TAB_LENGTH)
 {
 }
 /// <summary>
 /// Constructor dedicado para crear líneas de apertura y cierre del documento
 /// principal. También puede ser usada para el cierre de subdocumentos.
 /// </summary>
 /// <param name="lineType">Definición del tipo de línea</param>
 public DocumentViewerLine(LineType lineType, int lineNumber) : this(lineType, lineNumber, MAIN_DOCUMENT_BRACKETS_TAB_LENGTH)
 {
 }
Ejemplo n.º 48
0
        /// <summary>
        /// Series line type has been changed by the user.
        /// </summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event arguments</param>
        private void OnSeriesLineTypeChanged(object sender, EventArgs e)
        {
            LineType lineType = (LineType)Enum.Parse(typeof(LineType), this.seriesView.SeriesLineType);

            this.SetModelProperty("Line", lineType);
        }
Ejemplo n.º 49
0
 public TooltipLine(LineType InType, string InText)
 {
     Type = InType;
     Text = InText;
 }
Ejemplo n.º 50
0
 public VectorLine(string lineName, Vector2[] linePoints, Color color, Material lineMaterial, float width, LineType lineType)
 {
     points2 = linePoints;
     Color[] colors = SetColor(color, lineType, linePoints.Length, false);
     SetupMesh(ref lineName, lineMaterial, colors, ref width, lineType, Joins.None, true, false);
 }
Ejemplo n.º 51
0
        private void ReAsignHandlersAndDefaultObjects()
        {
            this.handleCount = 100;

            //add default viewports
            ViewPort active = ViewPort.Active;

            if (!this.viewports.ContainsKey(active.Name))
            {
                this.viewports.Add(active.Name, active);
            }
            foreach (ViewPort viewPort in this.viewports.Values)
            {
                this.handleCount = viewPort.AsignHandle(this.handleCount);
            }

            //add default layer
            Layer.PlotStyleHandle = Convert.ToString(this.handleCount++, 16);
            Layer byDefault = Layer.Default;

            if (!this.layers.ContainsKey(byDefault.Name))
            {
                this.layers.Add(byDefault.Name, byDefault);
            }
            foreach (Layer layer in this.layers.Values)
            {
                this.handleCount = layer.AsignHandle(this.handleCount);
            }

            // add default line types
            LineType byLayer = LineType.ByLayer;
            LineType byBlock = LineType.ByBlock;

            if (!this.lineTypes.ContainsKey(byLayer.Name))
            {
                this.lineTypes.Add(byLayer.Name, byLayer);
            }
            if (!this.lineTypes.ContainsKey(byBlock.Name))
            {
                this.lineTypes.Add(byBlock.Name, byBlock);
            }
            foreach (LineType lineType in this.lineTypes.Values)
            {
                this.handleCount = lineType.AsignHandle(this.handleCount);
            }

            // add default text style
            TextStyle defaultStyle = TextStyle.Default;

            if (!this.textStyles.ContainsKey(defaultStyle.Name))
            {
                this.textStyles.Add(defaultStyle.Name, defaultStyle);
            }
            foreach (TextStyle textStyle in this.textStyles.Values)
            {
                this.handleCount = textStyle.AsignHandle(this.handleCount);
            }

            // add default blocks
            Block modelSpace = Block.ModelSpace;
            Block paperSpace = Block.PaperSpace;

            if (!this.blocks.ContainsKey(modelSpace.Name))
            {
                this.blocks.Add(modelSpace.Name, modelSpace);
            }
            if (!this.blocks.ContainsKey(paperSpace.Name))
            {
                this.blocks.Add(paperSpace.Name, paperSpace);
            }
            foreach (Block block in this.blocks.Values)
            {
                this.handleCount = block.AsignHandle(this.handleCount);
            }

            // add default application registry
            ApplicationRegistry defaultAppId = ApplicationRegistry.Default;

            if (!this.appRegisterNames.ContainsKey(defaultAppId.Name))
            {
                this.appRegisterNames.Add(defaultAppId.Name, defaultAppId);
            }
            foreach (ApplicationRegistry appId in this.appRegisterNames.Values)
            {
                this.handleCount = appId.AsignHandle(this.handleCount);
            }

            //add default dimension style
            DimensionStyle defaultDimStyle = DimensionStyle.Default;

            if (!this.dimStyles.ContainsKey(defaultDimStyle.Name))
            {
                this.dimStyles.Add(defaultDimStyle.Name, defaultDimStyle);
            }
            foreach (DimensionStyle style in this.dimStyles.Values)
            {
                this.handleCount = style.AsignHandle(this.handleCount);
            }

            foreach (Arc entity in this.arcs)
            {
                this.handleCount = entity.AsignHandle(this.handleCount);
            }
            foreach (Ellipse entity in this.ellipses)
            {
                this.handleCount = entity.AsignHandle(this.handleCount);
            }
            foreach (Face3d entity in this.faces3d)
            {
                this.handleCount = entity.AsignHandle(this.handleCount);
            }
            foreach (Solid entity in this.solids)
            {
                this.handleCount = entity.AsignHandle(this.handleCount);
            }
            foreach (Insert entity in this.inserts)
            {
                this.handleCount = entity.AsignHandle(this.handleCount);
            }
            foreach (IPolyline entity in this.polylines)
            {
                this.handleCount = ((DxfObject)entity).AsignHandle(this.handleCount);
            }
            foreach (Line entity in this.lines)
            {
                this.handleCount = entity.AsignHandle(this.handleCount);
            }
            foreach (Circle entity in this.circles)
            {
                this.handleCount = entity.AsignHandle(this.handleCount);
            }
            foreach (Point entity in this.points)
            {
                this.handleCount = entity.AsignHandle(this.handleCount);
            }
            foreach (Text entity in this.texts)
            {
                this.handleCount = entity.AsignHandle(this.handleCount);
            }
        }
Ejemplo n.º 52
0
 public VectorLine(string lineName, Vector2[] linePoints, Color[] colors, Material lineMaterial, float width, LineType lineType, Joins joins)
 {
     points2 = linePoints;
     SetupMesh(ref lineName, lineMaterial, colors, ref width, lineType, joins, true, false);
 }
Ejemplo n.º 53
0
        public NodeSet CreateIterateNodeSet(NodeSet parentNodeSet)
        {
            DependencyMatrix          parentDM        = parentNodeSet.GetDependencyMatrix();
            Dictionary <string, Node> parentNodeMap   = parentNodeSet.GetNodeMap();
            Dictionary <int?, string> parentNodeIdMap = parentNodeSet.GetNodeIdMap();


            Dictionary <string, Node> thisNodeMap        = new Dictionary <string, Node>();
            Dictionary <int?, string> thisNodeIdMap      = new Dictionary <int?, string>();
            List <Dependency>         tempDependencyList = new List <Dependency>();
            NodeSet newNodeSet = new NodeSet();

            thisNodeMap.Add(this.nodeName, this);
            thisNodeIdMap.Add(this.nodeId, this.nodeName);
            Enumerable.Range(1, this.givenListSize).ToList().ForEach((nth) =>
            {
                parentDM.GetToChildDependencyList(this.nodeId).ForEach((item) =>
                {
                    if (this.GetNodeId() + 1 != item) // not first question id
                    {
                        Node tempChildNode = parentNodeMap[parentNodeIdMap[item]];
                        LineType lineType  = tempChildNode.GetLineType();

                        Node tempNode          = null;
                        string nextNThInString = Oridinal(nth);

                        if (lineType.Equals(LineType.VALUE_CONCLUSION))
                        {
                            tempNode = new ValueConclusionLine(nextNThInString + " " + this.GetVariableName() + " " + tempChildNode.GetNodeName(), tempChildNode.GetTokens());
                        }
                        else if (lineType.Equals(LineType.COMPARISON))
                        {
                            tempNode             = new ComparisonLine(nextNThInString + " " + this.GetVariableName() + " " + tempChildNode.GetNodeName(), tempChildNode.GetTokens());
                            FactValue tempNodeFv = ((ComparisonLine)tempNode).GetRHS();
                            if (tempNodeFv.GetFactValueType().Equals(FactValueType.STRING))
                            {
                                FactValue tempFv = FactValue.Parse(nextNThInString + " " + this.GetVariableName() + " " + FactValue.GetValueInString(FactValueType.STRING, tempNodeFv));
                                tempNode.SetValue(tempFv);
                            }
                        }
                        else if (lineType.Equals(LineType.EXPR_CONCLUSION))
                        {
                            tempNode = new ExprConclusionLine(nextNThInString + " " + this.GetVariableName() + " " + tempChildNode.GetNodeName(), tempChildNode.GetTokens());
                        }


                        thisNodeMap.Add(tempNode.GetNodeName(), tempNode);
                        thisNodeIdMap.Add(tempNode.GetNodeId(), tempNode.GetNodeName());
                        tempDependencyList.Add(new Dependency(this, tempNode, parentDM.GetDependencyType(this.nodeId, item)));

                        CreateIterateNodeSetAux(parentDM, parentNodeMap, parentNodeIdMap, thisNodeMap, thisNodeIdMap, tempDependencyList, item, tempNode.GetNodeId(), nextNThInString);
                    }
                    else // first question id
                    {
                        Node firstIterateQuestionNode = parentNodeSet.GetNodeByNodeId(parentNodeSet.GetDependencyMatrix().GetToChildDependencyList(this.GetNodeId()).Min());
                        if (!thisNodeMap.ContainsKey(firstIterateQuestionNode.GetNodeName()))
                        {
                            thisNodeMap.Add(firstIterateQuestionNode.GetNodeName(), firstIterateQuestionNode);
                            thisNodeIdMap.Add(item, firstIterateQuestionNode.GetNodeName());
                            tempDependencyList.Add(new Dependency(this, firstIterateQuestionNode, parentDM.GetDependencyType(this.nodeId, item)));
                        }
                    }
                });
            });



            int numberOfRules = Node.GetStaticNodeId();

            int[,] dependencyMatrix = new int[numberOfRules, numberOfRules];


            tempDependencyList.ForEach(dp => {
                int parentId = dp.GetParentNode().GetNodeId();
                int childId  = dp.GetChildNode().GetNodeId();
                int dpType   = dp.GetDependencyType();
                dependencyMatrix[parentId, childId] = dpType;
            });



            newNodeSet.SetNodeIdMap(thisNodeIdMap);
            newNodeSet.SetNodeMap(thisNodeMap);
            newNodeSet.SetDependencyMatrix(new DependencyMatrix(dependencyMatrix));
            newNodeSet.SetFactMap(parentNodeSet.GetFactMap());
            newNodeSet.SetNodeSortedList(TopoSort.DfsTopoSort(thisNodeMap, thisNodeIdMap, dependencyMatrix));
            //      newNodeSet.getNodeSortedList().stream().forEachOrdered(item->System.out.println(item.getNodeId()+"="+item.getNodeName()));
            return(newNodeSet);
        }
Ejemplo n.º 54
0
    protected void SetupMesh(ref string lineName, Material useMaterial, Color[] colors, ref float width, LineType lineType, Joins joins, bool use2Dlines, bool usePoints)
    {
        m_fillJoins  = (joins == Joins.Fill? true : false);
        m_continuous = (lineType == LineType.Continuous? true : false);
        if (m_fillJoins && !continuous)
        {
            Debug.LogError("VectorLine: Must use LineType.Continuous if using Joins.Fill for \"" + lineName + "\"");
            return;
        }
        if ((use2Dlines && points2 == null) || (!use2Dlines && points3 == null))
        {
            Debug.LogError("VectorLine: the points array is null for \"" + lineName + "\"");
            return;
        }
        int pointsLength = use2Dlines? points2.Length : points3.Length;

        if (!usePoints && pointsLength < 2)
        {
            Debug.LogError("The points array must contain at least two points");
            return;
        }
        if (!continuous && pointsLength % 2 != 0)
        {
            Debug.LogError("VectorLine: Must have an even points array length for \"" + lineName + "\" when using LineType.Discrete");
            return;
        }

        lineWidths    = new float[1];
        lineWidths[0] = width * .5f;
        m_isPoints    = usePoints;
        bool useSegmentColors = (colors != null)? true : false;

        m_weldJoins = (joins == Joins.Weld)? true : false;

        if (!usePoints)
        {
            if (continuous)
            {
                if (useSegmentColors && colors.Length != pointsLength - 1)
                {
                    Debug.LogWarning("VectorLine: Length of color array for \"" + lineName + "\" must be length of points array minus one...disabling segment colors");
                    useSegmentColors = false;
                }
            }
            else
            {
                if (useSegmentColors && colors.Length != pointsLength / 2)
                {
                    Debug.LogWarning("VectorLine: Length of color array for \"" + lineName + "\" must be exactly half the length of points array...disabling segment colors");
                    useSegmentColors = false;
                }
            }
        }
        else
        {
            if (useSegmentColors && colors.Length != pointsLength)
            {
                Debug.LogWarning("VectorLine: Length of color array for \"" + lineName + "\" must be the same length as the points array...disabling segment colors");
                useSegmentColors = false;
            }
        }

        if (useMaterial == null)
        {
            if (VectorMaterial.defaultLineMaterial == null)
            {
#pragma warning disable 0618
                VectorMaterial.defaultLineMaterial = new Material("Shader \"Vertex Colors/Alpha\" {Category{Tags {\"Queue\"=\"Transparent\" \"IgnoreProjector\"=\"True\" \"RenderType\"=\"Transparent\"}SubShader {Cull Off ZWrite On Blend SrcAlpha OneMinusSrcAlpha Pass {BindChannels {Bind \"Color\", color Bind \"Vertex\", vertex}}}}}");
#pragma warning restore 0618
            }
            useMaterial = VectorMaterial.defaultLineMaterial;
        }

        mesh               = new Mesh();
        mesh.name          = lineName;
        vectorObject       = new GameObject("Vector " + lineName, typeof(MeshRenderer));
        vectorObject.layer = Vector.vectorLayer;
        meshFilter         = (MeshFilter)vectorObject.AddComponent(typeof(MeshFilter));
        vectorObject.GetComponent <Renderer>().material = useMaterial;
        meshFilter.mesh = mesh;
        name            = lineName;
        BuildMesh(pointsLength, use2Dlines, useSegmentColors, colors);
    }
Ejemplo n.º 55
0
		/// <summary>Computes the intersection point between two lines, rays or 
		/// line segments.</summary>
		/// <remarks>This method is implemented based on the other overload,
		/// <see cref="ComputeIntersection(LineSegment, LineType, out T, LineSegment, LineType, out T)"/>.
		/// </remarks>
		public static Point? ComputeIntersection(this LineSegment P, LineType pType, LineSegment Q, LineType qType)
		{
			T pFrac, qFrac;
			if (!ComputeIntersection(P, pType, out pFrac, Q, qType, out qFrac))
				return null;
			return P.A.Add(P.Vector().Mul(pFrac));
		}
Ejemplo n.º 56
0
 public ConnectorType(ArrowHeadType arrowHeadType, LineType shaftLineType)
 {
     ArrowHeadType = arrowHeadType;
     ShaftLineType = shaftLineType;
 }
Ejemplo n.º 57
0
        static double[] getDashByLineStyle(LineType type )
        {
            switch ( type) {

                case LineType.Solid:
                    return null;
                case LineType.Dots:
                    return dotsStyle;
                case LineType.Dash:
                    return dashesStyle;
                case LineType.DashDot:
                    return dashDotStyle;
                case LineType.DashDotDot:
                    return dashDotDotStyle;

            default:
            break;
            }
            return null;
        }
Ejemplo n.º 58
0
 public VectorLine(Vector _A, Vector _B, LineType _lt)
 {
     A  = _A;
     B  = _B;
     lt = _lt;
 }
Ejemplo n.º 59
0
 /// <summary>
 /// Draws a set of lines. The lineType parameter controls how
 /// lines are connected.
 /// </summary>
 /// <param name="lineType">The type of lines to draw.</param>
 /// <param name="color">The color of lines to draw.</param>
 /// <param name="points">The points that are used to
 /// build the individual line segments.</param>
 public static void DrawLines(this IPrimitiveRenderer primitives, Effect effect, LineType lineType, Color color,
                              IEnumerable <Vector2> points)
 {
     primitives.DrawLines(effect, lineType, color, points);
 }
Ejemplo n.º 60
0
        /// <summary>
        /// Graph the specified experiment.
        /// </summary>
        /// <param name="parentExperiment"></param>
        /// <param name="ourDefinitions"></param>
        private void GraphExperiment(Experiment parentExperiment, List <SeriesDefinition> ourDefinitions)
        {
            Factors factors = Apsim.Child(parentExperiment as IModel, typeof(Factors)) as Factors;

            if (factors != null)
            {
                // Given this example (from Teff.apsimx).
                //    Factors
                //       CV   - Gibe, Ziquala, Ayana, 04T19   (4 factor values)
                //       PP   - 1, 2, 3, 4, 5, 6              (6 factor values)
                // -----------------------------------------------------------
                //    If FactorIndexToVaryColours = 0  (index of CV factor)
                //       FactorIndexToVaryLines   = 1  (index of PP factor)
                //       FactorIndexToVaryMarkers = -1 (doesn't point to a factor)
                //    Then permutations will be:
                //       CVGibe & PP1
                //       CVZiquala & PP2
                //       CVAyana & PP3
                //       ... (24 in total - 4 x 6)
                // -----------------------------------------------------------
                //    If FactorIndexToVaryColours = 0  (index of CV factor)
                //       FactorIndexToVaryLines   = -1 (doesn't point to a factor)
                //       FactorIndexToVaryMarkers = -1 (doesn't point to a factor)
                //    Then permutations will be:
                //       CVGibe
                //       CVZiquala
                //       CVAyana
                //       CV04T19  (4 in total - 4)
                // -----------------------------------------------------------
                // The FactorIndexToVary... variables denote which factors should be
                // separate series.

                List <List <FactorAndIndex> > factorIndexes = new List <List <FactorAndIndex> >();
                for (int f = 0; f != factors.Children.Count; f++)
                {
                    if (FactorIndexToVaryColours == f)
                    {
                        CreateFactorAndIndex(factors.Children[FactorIndexToVaryColours] as Factor, factorIndexes,
                                             FactorAndIndex.TypeToVary.Colour);
                    }

                    if (FactorIndexToVaryLines == f)
                    {
                        CreateFactorAndIndex(factors.Children[FactorIndexToVaryLines] as Factor, factorIndexes,
                                             FactorAndIndex.TypeToVary.Line);
                    }

                    if (FactorIndexToVaryMarkers == f)
                    {
                        CreateFactorAndIndex(factors.Children[FactorIndexToVaryMarkers] as Factor, factorIndexes,
                                             FactorAndIndex.TypeToVary.Marker);
                    }
                }

                List <List <FactorAndIndex> > permutations = MathUtilities.AllCombinationsOf(factorIndexes.ToArray());

                // If no 'vary by' were specified then create a dummy one. All data will be on one series.
                if (permutations == null || permutations.Count == 0)
                {
                    permutations = new List <List <FactorAndIndex> >();
                    permutations.Add(new List <FactorAndIndex>());
                }

                // Loop through all permutations and create a graph series definition for each.
                foreach (List <FactorAndIndex> combination in permutations)
                {
                    // Determine the marker, line and colour for this combination.
                    MarkerType marker      = Marker;
                    LineType   line        = Line;
                    int        colourIndex = Array.IndexOf(ColourUtilities.Colours, Colour);
                    if (colourIndex == -1)
                    {
                        colourIndex = 0;
                    }
                    string seriesName = string.Empty;
                    for (int i = 0; i < combination.Count; i++)
                    {
                        if (combination[i].typeToVary == FactorAndIndex.TypeToVary.Colour)
                        {
                            colourIndex = combination[i].factorValueIndex;
                        }
                        if (combination[i].typeToVary == FactorAndIndex.TypeToVary.Marker)
                        {
                            marker = GetEnumValue <MarkerType>(combination[i].factorValueIndex);
                        }
                        if (combination[i].typeToVary == FactorAndIndex.TypeToVary.Line)
                        {
                            line = GetEnumValue <LineType>(combination[i].factorValueIndex);
                        }
                        seriesName += combination[i].factorName + combination[i].factorValue;
                    }

                    string filter = GetFilter(parentExperiment, combination);

                    CreateDefinitions(parentExperiment.BaseSimulation, seriesName, filter, ref colourIndex,
                                      ref marker, line, ourDefinitions, parentExperiment.Names());
                }
            }
        }