示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
        public void checkDeselection(int minBlockX, int maxBlockX, int minBlockY, int maxBlockY)
        {
            GeoCell cell = FrameMain.getInstance().getSelectedGeoCell();
            //
            GeoBlock block;

            for (GeoBlockEntry e = getHead(), p; (e = e.getNext()) != getTail();)
            {
                block = e.getKey();
                if (block.getBlockX() < minBlockX || block.getBlockX() >= maxBlockX || block.getBlockY() < minBlockY || block.getBlockY() >= maxBlockY)
                {
                    if (cell != null && cell.getBlock() == block)
                    {
                        cell = null;
                        FrameMain.getInstance().setSelectedGeoCell(null);
                    }
                    //
                    setStateOf(block.getCells(), SelectionState.NORMAL);
                    p = e.getPrev();
                    e.remove();
                    e = p;
                }
            }
            //
            if (cell == null && hasSelected())
            {
                FrameMain.getInstance().setSelectedGeoCell(getTail().getPrev().getValue().getLastUnsafe());
            }
        }
示例#4
0
 public void unselectAll()
 {
     for (GeoBlockEntry e = getHead(), p; (e = e.getNext()) != getTail();)
     {
         setStateOf(e.getKey().getCells(), SelectionState.NORMAL);
         p = e.getPrev();
         e.remove();
         e = p;
     }
 }
示例#5
0
        public int getSelectedTypesNotEqual(byte type)
        {
            int count = 0;

            for (GeoBlockEntry e = getHead(); (e = e.getNext()) != getTail();)
            {
                if (e.getKey().getType() != type)
                {
                    count++;
                }
            }
            return(count);
        }
示例#6
0
 public bool[] getSelectedTypes()
 {
     bool[] selectedTypes = new bool[3];
     for (GeoBlockEntry e = getHead(); (e = e.getNext()) != getTail();)
     {
         selectedTypes[e.getKey().getType()] = true;
         if (selectedTypes[0] && selectedTypes[1] && selectedTypes[2])
         {
             break;
         }
     }
     return(selectedTypes);
 }
示例#7
0
        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);
        }
示例#8
0
        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);
        }