public void restoreSelectedData() { GeoRegion region = GeoEngine.getInstance().getActiveRegion(); if (region == null) { return; } // bool restoredAny = false; for (GeoBlockEntry e = getHead(), p; (e = e.getNext()) != getTail();) { if (!region.dataEqualFor(e.getKey())) { region.restoreBlock(e.getKey()); restoredAny = true; p = e.getPrev(); e.remove(); e = p; } } // if (restoredAny) { //GLDisplay.getInstance().getTerrain().checkNeedUpdateVBO(true, true); //GLDisplay.getInstance().getRenderSelector().forceUpdateGeoBlocks(); updateGUI(null); } }
public void reloadGeo(int regionX, int regionY, bool l2j, string file) { if (file == null || !File.Exists(file)) { throw new GeoFileNotFoundException(file, l2j); } if (_activeRegion != null) { throw new Exception("Geo must be unloaded first"); } // try { using (FileStream stream = File.Open(file, FileMode.Open, FileAccess.Read)) { GeoReader reader = GeoStreamReader.wrap(stream); // if (!l2j) { for (int i = 18; i-- > 0;) { reader.get(); } } _activeRegion = new GeoRegion(regionX, regionY, reader, l2j, file); } } catch (Exception e) { Console.WriteLine(e); throw new GeoFileLoadException(file, l2j, e); } }
public void convertSelectedToType(byte type) { GeoRegion region = GeoEngine.getInstance().getActiveRegion(); if (region == null) { return; } // bool convertedAny = false; for (GeoBlockEntry e = getHead(), p; (e = e.getNext()) != getTail();) { if (e.getKey().getType() != type) { region.convertBlock(e.getKey(), type); convertedAny = true; p = e.getPrev(); e.remove(); e = p; } } // if (convertedAny) { //GLDisplay.getInstance().getTerrain().checkNeedUpdateVBO(false, true); //GLDisplay.getInstance().getRenderSelector().forceUpdateGeoBlocks(); updateGUI(null); } }
public int nGetLayerCount(int geoX, int geoY) { GeoRegion region = getGeoRegion(geoX, geoY); if (region != null) { return(region.nGetLayerCount(geoX, geoY)); } return(1); }
public GeoBlock getBlock(int geoX, int geoY) { GeoRegion region = getGeoRegion(geoX, geoY); if (region != null) { return(region.getBlock(geoX, geoY)); } throw new GeoDataNotFoundException(geoX, geoY); }
public GeoCell nGetCell(int geoX, int geoY, int z) { GeoRegion region = getGeoRegion(geoX, geoY); if (region != null) { return(region.nGetCell(geoX, geoY, z)); } throw new GeoDataNotFoundException(geoX, geoY); }
public byte nGetType(int geoX, int geoY) { GeoRegion region = getGeoRegion(geoX, geoY); if (region != null) { return(region.nGetType(geoX, geoY)); } return(GeoEngine.GEO_BLOCK_TYPE_FLAT); }
public void unload() { GeoRegion region = _activeRegion; if (region != null) { GeoBlockSelector.getInstance().unload(); region.unload(); } _activeRegion = null; }
public bool getSelectedDataEqual() { GeoRegion region = GeoEngine.getInstance().getActiveRegion(); if (region == null) { return(false); } // for (GeoBlockEntry e = getHead(); (e = e.getNext()) != getTail();) { if (!region.dataEqualFor(e.getKey())) { return(false); } } return(true); }
private GeoRegion getGeoRegion(int geoX, int geoY) { GeoRegion region = _activeRegion; if (region == null) { throw new GeoDataNotLoadedException(geoX, geoY); } // int regionX = getRegionXY(geoX); int regionY = getRegionXY(geoY); if (regionX != region.getRegionX() || regionY != region.getRegionY()) { throw new GeoDataNotFoundException(geoX, geoY); } // return(region); }
public int getSelectedDataNotEqualCount() { GeoRegion region = GeoEngine.getInstance().getActiveRegion(); if (region == null) { return(0); } // int count = 0; for (GeoBlockEntry e = getHead(); (e = e.getNext()) != getTail();) { if (!region.dataEqualFor(e.getKey())) { count++; } } return(count); }
public GeoBlock setRegion(GeoRegion region) { _region = region; return(this); }