當前位置: 首頁>>代碼示例>>C#>>正文


C# PointCollection.Freeze方法代碼示例

本文整理匯總了C#中System.Windows.Media.PointCollection.Freeze方法的典型用法代碼示例。如果您正苦於以下問題:C# PointCollection.Freeze方法的具體用法?C# PointCollection.Freeze怎麽用?C# PointCollection.Freeze使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.PointCollection的用法示例。


在下文中一共展示了PointCollection.Freeze方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Terrain3D

 static Terrain3D()
 {
     {
     SX = new double[17];
     SZ = new double[17];
     int i = 0;
     for (double d = 0; d < 2; d += 0.125)
     {
       i++;
       SX[i] = Math.Cos(Math.PI * d);
       SZ[i] = Math.Sin(Math.PI * d);
     }
       }
       {
     TEXTURE_COORDINATES = new PointCollection(17);
     TEXTURE_COORDINATES.Add(new Point(0, 0));
     Point p = new Point(1, 0);
     int i = -1;
     while (++i < 16) TEXTURE_COORDINATES.Add(p);
     TEXTURE_COORDINATES.Freeze();
       }
       {
     TRIANGLE_INDICES = new Int32Collection(48);
     for (int i = 1; i < 16; i++)
     {
       TRIANGLE_INDICES.Add(0);
       TRIANGLE_INDICES.Add(i + 1);
       TRIANGLE_INDICES.Add(i);
     }
     TRIANGLE_INDICES.Add(0);
     TRIANGLE_INDICES.Add(1);
     TRIANGLE_INDICES.Add(16);
     TRIANGLE_INDICES.Freeze();
       }
 }
開發者ID:sunoru,項目名稱:PBO,代碼行數:35,代碼來源:Terrain.cs

示例2: Pokemon3D

 static Pokemon3D()
 {
     TEXTURE_COORDINATES = new PointCollection(new Point[]
     { new Point(0, 1), new Point(0, 0), new Point(1, 1), new Point(1, 0) });
       TRIANGLE_INDICES = new Int32Collection(new int[] { 0, 2, 1, 3, 1, 2 });
       TEXTURE_COORDINATES.Freeze();
       TRIANGLE_INDICES.Freeze();
 }
開發者ID:sunoru,項目名稱:PBO,代碼行數:8,代碼來源:Pokemon.cs

示例3: ComputeConnectionPoints

        /// <summary>
        /// Rebuild connection points.
        /// </summary>
        private void ComputeConnectionPoints()
        {
            PointCollection computedPoints = new PointCollection();
            computedPoints.Add(this.SourceConnectorHotspot);

            double deltaX = Math.Abs(this.DestConnectorHotspot.X - this.SourceConnectorHotspot.X);
            double deltaY = Math.Abs(this.DestConnectorHotspot.Y - this.SourceConnectorHotspot.Y);
            if (deltaX > deltaY)
            {
                double midPointX = this.SourceConnectorHotspot.X + ((this.DestConnectorHotspot.X - this.SourceConnectorHotspot.X) / 2);
                computedPoints.Add(new Point(midPointX, this.SourceConnectorHotspot.Y));
                computedPoints.Add(new Point(midPointX, this.DestConnectorHotspot.Y));
            }
            else
            {
                double midPointY = this.SourceConnectorHotspot.Y + ((this.DestConnectorHotspot.Y - this.SourceConnectorHotspot.Y) / 2);
                computedPoints.Add(new Point(this.SourceConnectorHotspot.X, midPointY));
                computedPoints.Add(new Point(this.DestConnectorHotspot.X, midPointY));
            }

            computedPoints.Add(this.DestConnectorHotspot);
            computedPoints.Freeze();

            this.Points = computedPoints;
        }
開發者ID:IrisTechnica,項目名稱:Iris-Engine,代碼行數:28,代碼來源:ConnectionViewModel.cs

示例4: ConvertToPointCollection

        public static PointCollection ConvertToPointCollection(int[] values)
        {
            PointCollection points = new PointCollection();
            if (values == null)
            {
                points.Freeze();
                return points;
            }

            values = SmoothHistogram(values);

            int max = values.Max();

            // first point (lower-left corner)
            points.Add(new Point(0, max));
            // middle points
            for (int i = 0; i < values.Length; i++)
            {
                points.Add(new Point(i, max - values[i]));
            }
            // last point (lower-right corner)
            points.Add(new Point(values.Length - 1, max));
            points.Freeze();
            return points;
        }
開發者ID:CadeLaRen,項目名稱:digiCamControl,代碼行數:25,代碼來源:BitmapLoader.cs

示例5: ComputeConnectionPoints

        /// <summary>
        /// Rebuild connection points.
        /// </summary>
        private void ComputeConnectionPoints()
        {
            const double offset = 120.0;

            double srcDeltaX = offset;
            double destDeltaX = -offset;

            if (SourceConnector != null)
            {
                if (SourceConnector.Type == ConnectorType.Input
                    || SourceConnector.Type == ConnectorType.VariableInput)
                {
                    srcDeltaX = -offset;
                }
                else if (SourceConnector.Type == ConnectorType.Output
                    || SourceConnector.Type == ConnectorType.VariableOutput)
                {
                    srcDeltaX = offset;
                }
            }

            if (DestConnector != null)
            {
                if (DestConnector.Type == ConnectorType.Output
                    || DestConnector.Type == ConnectorType.VariableOutput
                    || DestConnector.Type == ConnectorType.VariableInputOutput)
                {
                    destDeltaX = offset;
                }
            }

            PointCollection computedPoints = new PointCollection();
            computedPoints.Add(SourceConnectorHotspot);
            computedPoints.Add(new Point(SourceConnectorHotspot.X + srcDeltaX, SourceConnectorHotspot.Y));
            computedPoints.Add(new Point(DestConnectorHotspot.X + destDeltaX, this.DestConnectorHotspot.Y));
            computedPoints.Add(DestConnectorHotspot);
            computedPoints.Freeze();

            this.Points = computedPoints;
        }
開發者ID:xcasadio,項目名稱:FlowGraph,代碼行數:43,代碼來源:ConnectionViewModel.cs

示例6: ConvertToPointCollection

        private PointCollection ConvertToPointCollection(int[] values)
        {
            values = SmoothHistogram(values);

            int max = values.Max();

            PointCollection points = new PointCollection();
            // first point (lower-left corner)
            points.Add(new System.Windows.Point(0, max));
            // middle points
            for (int i = 0; i < values.Length; i++)
            {
                points.Add(new System.Windows.Point(i, max - values[i]));
            }
            // last point (lower-right corner)
            points.Add(new System.Windows.Point(values.Length - 1, max));
            points.Freeze();
            return points;
        }
開發者ID:kwagalajosam,項目名稱:digiCamControl,代碼行數:19,代碼來源:BitmapLoaderOld.cs

示例7: AddFigureToList

            internal unsafe void AddFigureToList(bool isFilled, bool isClosed, MilPoint2F* pPoints, UInt32 pointCount, byte* pSegTypes, UInt32 segmentCount)
            {
                if (pointCount >=1 && segmentCount >= 1)
                {
                    PathFigure figure = new PathFigure();

                    figure.IsFilled = isFilled;
                    figure.StartPoint = new Point(pPoints->X, pPoints->Y);

                    int pointIndex = 1;
                    int sameSegCount = 0;

                    for (int segIndex=0; segIndex<segmentCount; segIndex += sameSegCount)
                    {
                        byte segType = (byte)(pSegTypes[segIndex] & (byte)MILCoreSegFlags.SegTypeMask);

                        sameSegCount = 1;

                        // Look for a run of same-type segments for a PolyXXXSegment.
                        while (((segIndex + sameSegCount) < segmentCount) &&
                            (pSegTypes[segIndex] == pSegTypes[segIndex+sameSegCount]))
                        {
                            sameSegCount++;
                        }

                        bool fStroked = (pSegTypes[segIndex] & (byte)MILCoreSegFlags.SegIsAGap) == (byte)0;
                        bool fSmooth = (pSegTypes[segIndex] & (byte)MILCoreSegFlags.SegSmoothJoin) != (byte)0;

                        if (segType == (byte)MILCoreSegFlags.SegTypeLine)
                        {
                            if (pointIndex+sameSegCount > pointCount)
                            {
                                throw new System.InvalidOperationException(SR.Get(SRID.PathGeometry_InternalReadBackError));
                            }

                            if (sameSegCount>1)
                            {
                                PointCollection ptCollection = new PointCollection();
                                for (int i=0; i<sameSegCount; i++)
                                {
                                    ptCollection.Add(new Point(pPoints[pointIndex+i].X, pPoints[pointIndex+i].Y));
                                }
                                ptCollection.Freeze();

                                PolyLineSegment polySeg = new PolyLineSegment(ptCollection, fStroked, fSmooth);
                                polySeg.Freeze();

                                figure.Segments.Add(polySeg);
                            }
                            else
                            {
                                Debug.Assert(sameSegCount == 1);
                                figure.Segments.Add(new LineSegment(new Point(pPoints[pointIndex].X, pPoints[pointIndex].Y), fStroked, fSmooth));
                            }

                            pointIndex += sameSegCount;
                        }
                        else if (segType == (byte)MILCoreSegFlags.SegTypeBezier)
                        {
                            int pointBezierCount = sameSegCount*3;

                            if (pointIndex+pointBezierCount > pointCount)
                            {
                                throw new System.InvalidOperationException(SR.Get(SRID.PathGeometry_InternalReadBackError));
                            }

                            if (sameSegCount>1)
                            {
                                PointCollection ptCollection = new PointCollection();
                                for (int i=0; i<pointBezierCount; i++)
                                {
                                    ptCollection.Add(new Point(pPoints[pointIndex+i].X, pPoints[pointIndex+i].Y));
                                }
                                ptCollection.Freeze();

                                PolyBezierSegment polySeg = new PolyBezierSegment(ptCollection, fStroked, fSmooth);
                                polySeg.Freeze();

                                figure.Segments.Add(polySeg);
                            }
                            else
                            {
                                Debug.Assert(sameSegCount == 1);

                                figure.Segments.Add(new BezierSegment(
                                    new Point(pPoints[pointIndex].X, pPoints[pointIndex].Y),
                                    new Point(pPoints[pointIndex+1].X, pPoints[pointIndex+1].Y),
                                    new Point(pPoints[pointIndex+2].X, pPoints[pointIndex+2].Y),
                                    fStroked,
                                    fSmooth));
                            }

                            pointIndex += pointBezierCount;
                        }
                        else
                        {
                            throw new System.InvalidOperationException(SR.Get(SRID.PathGeometry_InternalReadBackError));
                        }
                    }

//.........這裏部分代碼省略.........
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:101,代碼來源:PathGeometry.cs

示例8: ComputeConnectionPoints

        /// <summary>
        /// Rebuild connection points.
        /// </summary>
        private void ComputeConnectionPoints()
        {
            PointCollection computedPoints = new PointCollection();
            computedPoints.Add(this.SourceConnectorHotspot);

            double midPointX = this.SourceConnectorHotspot.X + ((this.DestConnectorHotspot.X - this.SourceConnectorHotspot.X) / 2);
            computedPoints.Add(new Point(midPointX, this.SourceConnectorHotspot.Y));
            computedPoints.Add(new Point(midPointX, this.DestConnectorHotspot.Y));

            //Add an extra point to the curve that allows the line into the destination look visually pleasing.
            const double precedingPoint = 2.5;
            if ( (this.DestConnectorHotspot.X - precedingPoint) > midPointX)
                computedPoints.Add(new Point(this.DestConnectorHotspot.X - precedingPoint, this.DestConnectorHotspot.Y));

            computedPoints.Add(this.DestConnectorHotspot);
            computedPoints.Freeze();

            this.Points = computedPoints;
        }
開發者ID:kweinberg1,項目名稱:SoundAtlas,代碼行數:22,代碼來源:ConnectionViewModel.cs


注:本文中的System.Windows.Media.PointCollection.Freeze方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。