예제 #1
0
        public void Write(XmlWriter writer, IProgress<GexfProgress> progress)
        {
            writer.WriteStartElement(XmlElementName);
            writer.WriteAttributeString(XmlAttibuteNameId, Id);
            writer.WriteAttributeString(XmlAttibuteNameSource, Source);
            writer.WriteAttributeString(XmlAttibuteNameTarget, Target);
            if (Weight != 1.0)
            {
                writer.WriteAttributeString(XmlAttibuteNameWeight, Weight.ToString(CultureInfo.InvariantCulture));
            }
            if (!string.IsNullOrEmpty(Label))
            {
                writer.WriteAttributeString(XmlAttibuteNameLabel, Label);
            }
            if (EdgeType != _defaultEdgeType)
            {
                writer.WriteAttributeString(XmlAttibuteNameEdgeType, EdgeType.ToString().ToLower());
            }

            _color.Write(writer, progress);
            _thickness.Write(writer, progress);
            _shape.Write(writer, progress);

            writer.WriteEndElement();
        }
예제 #2
0
 public override string ToString()
 {
     return(string.Format(
                "{0} ({1}) S:[{2} - {3}] ({4}) ({5})",
                Point, IsStart ? "left" : "right", Point, OtherEvent.Point,
                PolygonType.ToString().ToUpper(),
                EdgeType.ToString().ToUpper()
                ));
 }
예제 #3
0
 public override string ToString()
 {
     if (this.Equals(MaxValue))
     {
         return("MaxValue");
     }
     else
     if (this.Equals(MinValue))
     {
         return("MinValue");
     }
     else
     {
         return(Semantic.ToString() + "(" + (Data != null ? Data.ToString() : "NULL") + ")");
     }
 }
예제 #4
0
        private IEnumerable <Issue> getVolumeIssues(HitObject hitObject, HitObject sampledHitObject = null)
        {
            sampledHitObject ??= hitObject;
            if (!sampledHitObject.Samples.Any())
            {
                yield break;
            }

            // Samples that allow themselves to be overridden by control points have a volume of 0.
            int    maxVolume      = sampledHitObject.Samples.Max(sample => sample.Volume > 0 ? sample.Volume : sampledHitObject.SampleControlPoint.SampleVolume);
            double samplePlayTime = sampledHitObject.GetEndTime();

            EdgeType edgeType = getEdgeAtTime(hitObject, samplePlayTime);

            // We only care about samples played on the edges of objects, not ones like spinnerspin or slidertick.
            if (edgeType == EdgeType.None)
            {
                yield break;
            }

            string postfix = hitObject is IHasDuration?edgeType.ToString().ToLower() : null;

            if (maxVolume <= muted_threshold)
            {
                if (edgeType == EdgeType.Head)
                {
                    yield return(new IssueTemplateMutedActive(this).Create(hitObject, maxVolume / 100f, sampledHitObject.GetEndTime(), postfix));
                }
                else
                {
                    yield return(new IssueTemplateMutedPassive(this).Create(hitObject, maxVolume / 100f, sampledHitObject.GetEndTime(), postfix));
                }
            }
            else if (maxVolume <= low_volume_threshold && edgeType == EdgeType.Head)
            {
                yield return(new IssueTemplateLowVolumeActive(this).Create(hitObject, maxVolume / 100f, sampledHitObject.GetEndTime(), postfix));
            }
        }
예제 #5
0
 public EdgeData(VertexData source, VertexData target, EdgeType edgeType = EdgeType.none, double weight = 1) : base(source, target, weight)
 {
     Text = edgeType.ToString();
 }
예제 #6
0
 public override string ToString()
 {
     return("First: " + FirstPosition.ToString() + " Second: " + SecondPosition.ToString() + " Edge: " + EdgeType.ToString());
 }
예제 #7
0
        //##############################################################################################################################################################################################

        /// <summary>
        /// Calculate the edge type (LINE, BULB, HOLE)
        /// </summary>
        private void classify()
        {
            try
            {
                EdgeType = EdgeTypes.UNKNOWN;
                if (NormalizedContour.Size <= 1)
                {
                    return;
                }

                //See if it is an outer edge comparing the distance between beginning and end with the arc length.
                double contour_length = CvInvoke.ArcLength(NormalizedContour, false);

                double begin_end_distance = Utils.Distance(NormalizedContour.ToArray().First(), NormalizedContour.ToArray().Last());
                if (contour_length < begin_end_distance * 1.3)
                {
                    EdgeType = EdgeTypes.LINE;
                }

                if (EdgeType == EdgeTypes.UNKNOWN)
                {
                    //Find the minimum or maximum value for x in the normalized contour and base the classification on that
                    int minx = 100000000;
                    int maxx = -100000000;
                    for (int i = 0; i < NormalizedContour.Size; i++)
                    {
                        if (minx > NormalizedContour[i].X)
                        {
                            minx = (int)NormalizedContour[i].X;
                        }
                        if (maxx < NormalizedContour[i].X)
                        {
                            maxx = (int)NormalizedContour[i].X;
                        }
                    }

                    if (Math.Abs(minx) > Math.Abs(maxx))
                    {
                        EdgeType = EdgeTypes.BULB;
                    }
                    else
                    {
                        EdgeType = EdgeTypes.HOLE;
                    }
                }

                if (PluginFactory.GetGeneralSettingsPlugin().SolverShowDebugResults)
                {
                    Bitmap contourImg = PieceImgColor.Bmp;
                    for (int i = 0; i < contour.Size; i++)
                    {
                        Graphics g = Graphics.FromImage(contourImg);
                        g.DrawEllipse(new Pen(Color.Red), new RectangleF(PointF.Subtract(contour[i], new Size(1, 1)), new SizeF(2, 2)));
                    }
                    _logHandle.Report(new LogEventImage(PieceID + " Edge " + EdgeNumber.ToString() + " " + EdgeType.ToString(), contourImg));
                    ContourImg.Bmp = contourImg;
                    contourImg.Dispose();
                }
            }
            catch (Exception ex)
            {
                _logHandle.Report(new LogBox.LogEvents.LogEventError(ex.Message));
            }
        }
예제 #8
0
 public override string ToString()
 {
     return("Edge Constraint | " + edgeType.ToString());
 }
예제 #9
0
 public static string FormatEdgeId(JSONNode itemOne, JSONNode itemTwo, EdgeType edgeType)
 {
     //return itemOne.ToString() + "--" + itemTwo.ToString() + "--" + edgeType.ToString();
     return(itemOne + "--" + itemTwo + "--" + edgeType.ToString());
 }
예제 #10
0
 public override string ToString()
 {
     return("TypedEdge(" + A + ", " + B + ", " + Type.ToString() + ")");
 }