示例#1
0
        void InitLabelFixture(Edge edge)
        {
            if (edge.Label == null)
            {
                return;
            }
            if (labelFixtures.ContainsKey(edge.EdgeGeometry))
            {
                return;
            }

            var attachmentPar = edge.Curve.ClosestParameter(edge.Label.Center);

            var curve            = edge.Curve;
            var tang             = curve.Derivative(attachmentPar);
            var normal           = tang.Rotate90Cw();
            var fromCurveToLabel = edge.Label.Center - curve[attachmentPar];
            var fixture          = new LabelFixture()
            {
                RelativeLengthOnCurve = curve.LengthPartial(0, attachmentPar) / curve.Length,
                NormalLength          = fromCurveToLabel.Length,
                RightSide             = fromCurveToLabel * normal > 0
            };

            labelFixtures[edge.EdgeGeometry] = fixture;
        }
        void InitLabelFixture(Edge edge) {
            if (edge.Label == null) return;
            if (labelFixtures.ContainsKey(edge.EdgeGeometry)) return;

            var attachmentPar = edge.Curve.ClosestParameter(edge.Label.Center);
            
            var curve = edge.Curve;
            var tang = curve.Derivative(attachmentPar);
            var normal = tang.Rotate90Cw();
            var fromCurveToLabel = edge.Label.Center - curve[attachmentPar];
            var fixture = new LabelFixture() {
                RelativeLengthOnCurve = curve.LengthPartial(0, attachmentPar)/curve.Length,
                NormalLength = fromCurveToLabel.Length,
                RightSide = fromCurveToLabel*normal>0
            };

            labelFixtures[edge.EdgeGeometry] = fixture;
        }