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); }
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); } }
public override short getHeight() { return(GeoEngine.getHeight(_heightAndNSWE)); }