当前位置: 首页>>代码示例>>C#>>正文


C# Dimension类代码示例

本文整理汇总了C#中Dimension的典型用法代码示例。如果您正苦于以下问题:C# Dimension类的具体用法?C# Dimension怎么用?C# Dimension使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Dimension类属于命名空间,在下文中一共展示了Dimension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateUnit

        public KnownUnit CreateUnit(IUnitSystem system, double factor, Dimension dimension, string symbol, string name,
            bool inherentPrefix)
        {
            var unit = new KnownUnit(system, factor, dimension, symbol, name, inherentPrefix);

            return unit;
        }
开发者ID:jhgbrt,项目名称:Physics,代码行数:7,代码来源:UnitFactory.cs

示例2: CreateDimensionInfo

        public static DimensionInfo CreateDimensionInfo(Dimension dim)
        {
            if (dim == null)
                return null;
            DimensionInfo info = new DimensionInfo();
            info.Caption = dim.Caption;
            info.Description = dim.Description;
            info.DimensionType = (DimensionInfoTypeEnum)(dim.DimensionType);
            info.Name = dim.Name;
            info.WriteEnabled = dim.WriteEnabled;
            info.UniqueName = dim.UniqueName;

            // Информация о предках
            if (dim.ParentCube != null)
            {
                info.ParentCubeId = dim.ParentCube.Name;
                info.CustomProperties.Add(new PropertyInfo(InfoBase.CUBE_CAPTION, dim.ParentCube.Caption));
            }

            // Свойства
            foreach (Property prop in dim.Properties)
            {
                //                PropertyInfo pi = new PropertyInfo(prop.Name, prop.Type, prop.Value);
                PropertyInfo pi = new PropertyInfo(prop.Name, prop.Value);
                info.Properties.Add(pi);
            }
            return info;
        }
开发者ID:SmallMobile,项目名称:ranet-uilibrary-olap.latest-unstabilized,代码行数:28,代码来源:InfoHelper.cs

示例3: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			Button button = FindViewById<Button> (Resource.Id.getcloudwatchdata);
			EditText cloudwatchdata = FindViewById<EditText> (Resource.Id.cloudwatchdata);

			button.Click += delegate {
				const string ACCESS_KEY = "";
				const string SECRET_KEY = "";
				IAmazonCloudWatch cw = Amazon.AWSClientFactory.CreateAmazonCloudWatchClient (ACCESS_KEY, SECRET_KEY, Amazon.RegionEndpoint.USWest1);

				string measureName = "CPUUtilization";

				GetMetricStatisticsRequest request = new GetMetricStatisticsRequest ();
				request.StartTime = DateTime.Now.AddDays (-1);
				request.Namespace = "AWS/EC2";
				request.Period = 5 * 60;
				var dimensions = new Dimension ();
				dimensions.Name = "InstanceType";
				dimensions.Value = "t1.micro";
				request.Dimensions = new List<Dimension>{ dimensions };
				request.MetricName = measureName;
				request.Statistics = new List<string>{"Average", "Maximum", "Minimum"};
				request.EndTime = DateTime.Now;

				List<Datapoint> datapoints = cw.GetMetricStatistics(request).Datapoints;
				datapoints.ForEach(d => cloudwatchdata.Text = String.Format("Min: {0} Max: {1} Average: {3} Unit: {4}\n", d.Minimum, d.Maximum, d.Average, d.Unit));
			};
		}
开发者ID:Clancey,项目名称:aws-sdk-net,代码行数:35,代码来源:MainActivity.cs

示例4: MatchCoordinate

        protected override Point MatchCoordinate(Dimension dimension)
        {
            Match match = MatchRegex(@"^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)");

            if (match.Success)
            {
                geometryDimension = Dimension.Xyzm;
                return new Point(double.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture), double.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture), double.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture), double.Parse(match.Groups[4].Value, CultureInfo.InvariantCulture));
            }

            match = MatchRegex(@"^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)\s+(-?\d+\.?\d*)");

            if (match.Success)
            {
                if (dimension == Dimension.Xym)
                {
                    geometryDimension = Dimension.Xym;
                    return new Point(double.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture), double.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture), null, double.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture));
                }
                else
                {
                    geometryDimension = Dimension.Xyz;
                    return new Point(double.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture), double.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture), double.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture));
                }
            }

            geometryDimension = Dimension.Xy;
            match = MatchRegex(@"^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)");
            return new Point(double.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture), double.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture));
        }
开发者ID:cschwarz,项目名称:wkx-sharp,代码行数:30,代码来源:EwktReader.cs

示例5: Discharge

 public static Dimension Discharge()
 {
     Dimension d = new Dimension();
     d.SetPower(DimensionBase.Length, 3.0);
     d.SetPower(DimensionBase.Time, -1.0);
     return d;
 }
开发者ID:CNH-Hyper-Extractive,项目名称:parallel-sdk,代码行数:7,代码来源:LibraryDimensions.cs

示例6: ThenExponentsDetermineEquality

        public void ThenExponentsDetermineEquality()
        {
            var dim1 = new Dimension(1, 2, 3);
            var dim2 = new Dimension(1, 2, 3);
            var dim3 = new Dimension(3, 2, 1);

            Assert.AreEqual(dim1, dim2);
            Assert.AreEqual(dim1.GetHashCode(), dim1.GetHashCode());
            Assert.AreNotEqual(dim1, dim3);
            Assert.AreNotEqual(dim1.GetHashCode(), dim3.GetHashCode());
            Assert.AreNotEqual(dim2, dim3);
            Assert.AreNotEqual(dim2.GetHashCode(), dim3.GetHashCode());

            var dim4 = new Dimension(1);
            var dim5 = new Dimension(1);

            Assert.AreEqual(dim4, dim5);
            Assert.AreEqual(dim4.GetHashCode(), dim5.GetHashCode());

            var dim6 = new Dimension();
            var dim7 = new Dimension();

            Assert.AreEqual(dim6, dim7);
            Assert.AreEqual(dim6.GetHashCode(), dim7.GetHashCode());
        }
开发者ID:jhgbrt,项目名称:Physics,代码行数:25,代码来源:WhenComparingDimensions.cs

示例7: Renderable

 public Renderable(String texturePath)
 {
     Texture = new Bitmap(texturePath);
     Position = new Coordinate();
     Dimension = new Dimension();
     PinPositions = new List<Coordinate>();
 }
开发者ID:ArkayCZ,项目名称:NexusCircuit,代码行数:7,代码来源:Renderable.cs

示例8: Render

    public static Bitmap Render(Dimension d, LatticeLayoutMethod method, bool ShowOnlyMultilevelRelationships)
    {
        if (ShowOnlyMultilevelRelationships)
        {
            if (d.Attributes.Count == 1)
            {
                //avoid an error
                ShowOnlyMultilevelRelationships = false;
            }
        }
        LatticeDrawing ld = new LatticeDrawing(d.Name);
        ld.LayoutMethod = method;
        foreach (DimensionAttribute a in d.Attributes)
        {
            ld.Nodes.Add(a.ID, new LatticeNode(a.Name));
            if (d.KeyAttribute == a)
            {
                ld.Nodes[a.ID].IsKey = true;
            }
            ld.Nodes[a.ID].Visible = a.AttributeHierarchyVisible;
            ld.Nodes[a.ID].Enabled = a.AttributeHierarchyEnabled;
        }
        foreach (DimensionAttribute a in d.Attributes)
        {
            foreach (AttributeRelationship r in a.AttributeRelationships)
            {
                ld.Nodes[a.ID].Relationships.Add(new LatticeRelationship(ld.Nodes[r.AttributeID], r.RelationshipType, r.Visible));
                if (d.KeyAttribute != a)
                {
                    ld.Nodes[r.AttributeID].NonKeyReferenceCount++;
                }
            }
        }
        if (ShowOnlyMultilevelRelationships)
        {
            foreach (DimensionAttribute a in d.Attributes)
            {
                if (a.AttributeRelationships.Count == 0 && ld.Nodes[a.ID].NonKeyReferenceCount == 0)
                {
                    ld.Nodes.Remove(a.ID);
                }
            }
            foreach (LatticeNode ln in ld.Nodes.Values)
            {
                for (int i = 0; i < ln.Relationships.Count; i++)
                {
                    LatticeRelationship lr = ln.Relationships[i];
                    if (!ld.Nodes.ContainsValue(lr.node))
                    {
                        ln.Relationships.Remove(lr);
                        i--;
                    }
                }
            }
        }


        ld.LayoutMethod = method;
        return ld.Render();
    }
开发者ID:japj,项目名称:bidshelper,代码行数:60,代码来源:VisualizeAttributeLattice.cs

示例9: CubicGrid

        public CubicGrid(int3 dimensions, float valueMin, float valueMax, Dimension gradientDirection)
        {
            Dimensions = dimensions;
            Values = new float[dimensions.Z, dimensions.Y, dimensions.X];
            float Step = valueMax - valueMin;
            if (gradientDirection == Dimension.X)
                Step /= Math.Max(1, dimensions.X - 1);
            else if (gradientDirection == Dimension.Y)
                Step /= Math.Max(1, dimensions.Y - 1);
            else if (gradientDirection == Dimension.Z)
                Step /= Math.Max(1, dimensions.Z - 1);

            for (int z = 0; z < dimensions.Z; z++)
                for (int y = 0; y < dimensions.Y; y++)
                    for (int x = 0; x < dimensions.X; x++)
                    {
                        float Value = valueMin;
                        if (gradientDirection == Dimension.X)
                            Value += x * Step;
                        if (gradientDirection == Dimension.Y)
                            Value += y * Step;
                        if (gradientDirection == Dimension.Z)
                            Value += z * Step;

                        Values[z, y, x] = Value;
                    }

            Spacing = new float3(1f / Math.Max(1, dimensions.X - 1), 1f / Math.Max(1, dimensions.Y - 1), 1f / Math.Max(1, dimensions.Z - 1));
        }
开发者ID:dtegunov,项目名称:warp,代码行数:29,代码来源:CubicGrid.cs

示例10: testBlockDimensions

 public void testBlockDimensions()
 {
     Dimension frame = new Dimension(320,240);
     for(int numY = 1; numY < 10; numY ++) {
         for(int numX = 1; numX < 10; numX++) {
         Console.WriteLine("numX: %d\tnumY: %d\n", numX, numY);
         Dimension block = new Dimension(frame.Width / numX,
                         frame.Height / numY);
         for(int i = 0; i < numY; i++)
             for(int j = 0; j < numX; j++) {
             int testStart = (block.Width*j) +
                 (frame.Width*block.Height*i);
             int testEnd = testStart + block.Width +
                 (frame.Width*(block.Height-1));
             int specX = (frame.Width * j)/numX;
             int specY = (frame.Height *i)/numY;
             int specStart = (frame.Width*specY) + specX;
             int specEndX = (frame.Width * (j+1))/numX;
             int specEndY = (frame.Height *(i+1))/numY;
             int specEnd = (frame.Width*(specEndY - 1)) + specEndX;
             if(specEnd != testEnd ||
                specStart != testStart) {
                 Console.WriteLine("Spec:\t\tTest\n%d\t\t%d\n",
                           specEnd, testEnd);
                 Console.WriteLine("%d\t\t%d\n", specStart,
                           testStart);
             }
             }
         }
     }
 }
开发者ID:mono,项目名称:csdirac,代码行数:31,代码来源:GeneralTest.cs

示例11: ImportD5

        private static void ImportD5()
        {
            Dictionary<string,string> dict =  new Dictionary<string,string>(11);
            //dict.Add("Peroid","期");
            //dict.Add("DaXiao","大小");
            //dict.Add("DanShuang","单双");
            //dict.Add("ZiHe","质合");
            //dict.Add("Lu012","012路");
            //dict.Add("He","和");
            //dict.Add("HeWei","和尾");
            //dict.Add("Ji","积");
            //dict.Add("JiWei","积尾");
            //dict.Add("KuaDu","跨度");
            //dict.Add("AC","AC");
            //dict.Add("DaXiaoBi", "大小比");
            //dict.Add("ZiHeBi", "质合比");
            //dict.Add("DanShuangBi", "单双比");
            //dict.Add("Lu012Bi", "012路比");

            foreach (var kp in dict)
            {
                Dimension dim = new Dimension();
                dim.Name = kp.Value;
                dim.Code = kp.Key;
                dim.Seq = 100;
                DimensionBiz.Instance.Add(dim);
            }
        }
开发者ID:tomdeng,项目名称:gaopincai,代码行数:28,代码来源:ImportDimension.cs

示例12: LightSequenceBar

 public LightSequenceBar(LightSequence sequence, Point pivot, Dimension tileSize, int indent)
     : base(Geometry.ConstructRectangle(pivot, tileSize))
 {
     this.sequence = sequence;
     this.tileSize = tileSize;
     this.indent = indent;
 }
开发者ID:johnfn,项目名称:Illumination,代码行数:7,代码来源:LightSequenceBar.cs

示例13: ThenStartingZerosAreNotIgnored

        public void ThenStartingZerosAreNotIgnored()
        {
            var dim1 = new Dimension(0, 0, 1);
            var dim2 = new Dimension(1);

            Assert.AreNotEqual(dim1, dim2);
        }
开发者ID:jhgbrt,项目名称:Physics,代码行数:7,代码来源:WhenComparingDimensions.cs

示例14: ReadPacket

 public void ReadPacket(IMinecraftStream stream)
 {
     EntityID = stream.ReadInt32();
     stream.ReadString(); // Unused
     Seed = stream.ReadInt64();
     Dimension = (Dimension)stream.ReadInt8();
 }
开发者ID:Zoxive,项目名称:TrueCraft,代码行数:7,代码来源:LoginResponsePacket.cs

示例15: LifeBoard

 public LifeBoard(Dimension dim)
 {
     width = dim.Width;
     height = dim.Height;
     size = dim.Size;
     array = new bool[width, height];
 }
开发者ID:prvit,项目名称:GameOfLife,代码行数:7,代码来源:LifeBoard.cs


注:本文中的Dimension类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。