Beispiel #1
0
        public void SetApexHeight(Point2D apexPoint, float value, int lod)
        {
            Preconditions.Assert(lod >= SubmapInfo.LodFactor, "Cant set apex height. Lod factor is too small");
            var pixelSize = (int)Math.Pow(2, lod - SubmapInfo.LodFactor);

            if (Equals(apexPoint, SubmapInfo.DownLeftPoint))
            {
                HeightmapArray.SetDownLeftApexMarginHeight(value, pixelSize);
            }
            else if (Equals(apexPoint, SubmapInfo.DownRightPoint))
            {
                HeightmapArray.SetDownRightApexMarginHeight(value, pixelSize);
            }
            else if (Equals(apexPoint, SubmapInfo.TopLeftPoint))
            {
                HeightmapArray.SetTopLeftApexMarginHeight(value, pixelSize);
            }
            else if (Equals(apexPoint, SubmapInfo.TopRightPoint))
            {
                HeightmapArray.SetTopRightApexMarginHeight(value, pixelSize);
            }
            else
            {
                Preconditions.Fail(string.Format("Point {0} is not apex point", apexPoint));
            }
        }
Beispiel #2
0
 public float GetApexHeight(Point2D apexPoint)
 {
     if (Equals(apexPoint, SubmapInfo.DownLeftPoint))
     {
         return(HeightmapArray.GetHeight(0, 0));
     }
     else if (Equals(apexPoint, SubmapInfo.DownRightPoint))
     {
         return(HeightmapArray.GetHeight(HeightmapArray.WorkingWidth, 0));
     }
     else if (Equals(apexPoint, SubmapInfo.TopLeftPoint))
     {
         return(HeightmapArray.GetHeight(0, HeightmapArray.WorkingHeight));
     }
     else if (Equals(apexPoint, SubmapInfo.TopRightPoint))
     {
         return(HeightmapArray.GetHeight(HeightmapArray.WorkingWidth, HeightmapArray.WorkingHeight));
     }
     else
     {
         Preconditions.Fail(string.Format("Point {0} is not apex point", apexPoint));
         return(-22); //not used
     }
 }