public override int nGetLayer(int geoX, int geoY, int z)
        {
            int cellX = GeoEngine.getCellXY(geoX);
            int cellY = GeoEngine.getCellXY(geoY);

            GeoCell[] heights = _cells3D[cellX, cellY];
            //
            short temp;
            int   layer = 0, sub1, sub1Sq, sub2Sq = int.MaxValue;

            // from highest z (layer) to lowest z (layer)
            for (int i = heights.Length; i-- > 0;)
            {
                temp   = heights[i].getHeightAndNSWE();
                sub1   = z - GeoEngine.getHeight(temp);
                sub1Sq = sub1 * sub1;
                if (sub1Sq < sub2Sq)
                {
                    sub2Sq = sub1Sq;
                    layer  = i;
                }
                else
                {
                    break;
                }
            }
            return(layer);
        }
예제 #2
0
        public override void setHeightAndNSWE(short heightAndNSWE)
        {
            short oldHeight = getHeight();

            _height = GeoEngine.getHeight(heightAndNSWE);
            //
            getBlock().updateMinMaxHeight(_height, oldHeight);
            //
            if (FrameMain.getInstance().isSelectedGeoCell(this))
            {
                FrameMain.getInstance().setSelectedGeoCell(this);
            }
        }
예제 #3
0
 public override short getHeight()
 {
     return(GeoEngine.getHeight(_heightAndNSWE));
 }