Package org.stathissideris.ascii2image.text

Examples of org.stathissideris.ascii2image.text.CellSet


   
    if(DEBUG){
      System.out.println("******* Distinct shapes found using AbstractionGrid *******");
      Iterator<CellSet> dit = boundarySetsStep1.iterator();
      while (dit.hasNext()) {
        CellSet set = dit.next();
        set.printAsGrid();
      }
      System.out.println("******* Same set of shapes after processing them by filling *******");
    }
   
   
    //Find all the boundaries by using the special version of the filling method
    //(fills in a different buffer than the buffer it reads from)
    ArrayList<CellSet> boundarySetsStep2 = new ArrayList<CellSet>();
    for(CellSet set : boundarySetsStep1) {     
      //the fill buffer keeps track of which cells have been
      //filled already
      TextGrid fillBuffer = new TextGrid(width * 3, height * 3);
     
      for(int yi = 0; yi < height * 3; yi++){
        for(int xi = 0; xi < width * 3; xi++){
          if(fillBuffer.isBlank(xi, yi)){
           
            TextGrid copyGrid = new AbstractionGrid(workGrid, set).getCopyOfInternalBuffer();

            CellSet boundaries =
              copyGrid
              .findBoundariesExpandingFrom(copyGrid.new Cell(xi, yi));
            if(boundaries.size() == 0) continue; //i'm not sure why these occur
            boundarySetsStep2.add(boundaries.makeScaledOneThirdEquivalent());
         
            copyGrid = new AbstractionGrid(workGrid, set).getCopyOfInternalBuffer();
            CellSet filled =
              copyGrid
              .fillContinuousArea(copyGrid.new Cell(xi, yi), '*');
            fillBuffer.fillCellsWith(filled, '*');
            fillBuffer.fillCellsWith(boundaries, '-');
           
            if(DEBUG){
              //System.out.println("Fill buffer:");
              //fillBuffer.printDebug();
              boundaries.makeScaledOneThirdEquivalent().printAsGrid();
              System.out.println("-----------------------------------");
            }
           
          }
        }
      }
    }

    if (DEBUG)
      System.out.println("******* Removed duplicates *******");

    boundarySetsStep2 = CellSet.removeDuplicateSets(boundarySetsStep2);

    if(DEBUG){
      Iterator<CellSet> dit = boundarySetsStep2.iterator();
      while (dit.hasNext()) {
        CellSet set = dit.next();
        set.printAsGrid();
      }
    }

    int originalSize = boundarySetsStep2.size();
    boundarySetsStep2 = CellSet.removeDuplicateSets(boundarySetsStep2);
    if(DEBUG) {
      System.out.println(
        "******* Removed duplicates: there were "
        +originalSize
        +" shapes and now there are "
        +boundarySetsStep2.size());
    }
   

    //split boundaries to open, closed and mixed
   
    if (DEBUG)
      System.out.println("******* First evaluation of openess *******");
   
    ArrayList<CellSet> open = new ArrayList<CellSet>();
    ArrayList<CellSet> closed = new ArrayList<CellSet>();
    ArrayList<CellSet> mixed = new ArrayList<CellSet>();
   
    Iterator<CellSet> sets = boundarySetsStep2.iterator();
    while(sets.hasNext()){
      CellSet set = (CellSet) sets.next();
      int type = set.getType(workGrid);
      if(type == CellSet.TYPE_CLOSED) closed.add(set);
      else if(type == CellSet.TYPE_OPEN) open.add(set);
      else if(type == CellSet.TYPE_MIXED) mixed.add(set);
      if(DEBUG){
        if(type == CellSet.TYPE_CLOSED) System.out.println("Closed boundaries:");
        else if(type == CellSet.TYPE_OPEN) System.out.println("Open boundaries:");
        else if(type == CellSet.TYPE_MIXED) System.out.println("Mixed boundaries:");
        set.printAsGrid();
      }
    }
   
    boolean hadToEliminateMixed = false;
   
    if(mixed.size() > 0 && closed.size() > 0) {
              // mixed shapes can be eliminated by
              // subtracting all the closed shapes from them
      if (DEBUG)
        System.out.println("******* Eliminating mixed shapes (basic algorithm) *******");
   
      hadToEliminateMixed = true;
     
      //subtract from each of the mixed sets all the closed sets
      sets = mixed.iterator();
      while(sets.hasNext()){
        CellSet set = (CellSet) sets.next();
        Iterator<CellSet> closedSets = closed.iterator();
        while(closedSets.hasNext()){
          CellSet closedSet = closedSets.next();
          set.subtractSet(closedSet);
        }
        // this is necessary because some mixed sets produce
        // several distinct open sets after you subtract the
        // closed sets from them
        if(set.getType(workGrid) == CellSet.TYPE_OPEN) {
          boundarySetsStep2.remove(set);
          boundarySetsStep2.addAll(set.breakIntoDistinctBoundaries(workGrid));
        }
      }

    } else if(mixed.size() > 0 && closed.size() == 0) {
              // no closed shape exists, will have to
              // handle mixed shape on its own
      // an example of this case is the following:
      // +-----+
      // |  A  |C                 B
      // +  ---+-------------------
      // |     |
      // +-----+

      hadToEliminateMixed = true;

      if (DEBUG)
        System.out.println("******* Eliminating mixed shapes (advanced algorithm for truly mixed shapes) *******");
       
      sets = mixed.iterator();
      while(sets.hasNext()){
        CellSet set = (CellSet) sets.next();
        boundarySetsStep2.remove(set);
        boundarySetsStep2.addAll(set.breakTrulyMixedBoundaries(workGrid));
      }

    } else {
      if (DEBUG)
        System.out.println("No mixed shapes found. Skipped mixed shape elimination step");
    }
   
   
    if(hadToEliminateMixed){
      if (DEBUG)
        System.out.println("******* Second evaluation of openess *******");
   
      //split boundaries again to open, closed and mixed
      open = new ArrayList<CellSet>();
      closed = new ArrayList<CellSet>();
      mixed = new ArrayList<CellSet>();
   
      sets = boundarySetsStep2.iterator();
      while(sets.hasNext()){
        CellSet set = (CellSet) sets.next();
        int type = set.getType(workGrid);
        if(type == CellSet.TYPE_CLOSED) closed.add(set);
        else if(type == CellSet.TYPE_OPEN) open.add(set);
        else if(type == CellSet.TYPE_MIXED) mixed.add(set);
        if(DEBUG){
          if(type == CellSet.TYPE_CLOSED) System.out.println("Closed boundaries:");
          else if(type == CellSet.TYPE_OPEN) System.out.println("Open boundaries:");
          else if(type == CellSet.TYPE_MIXED) System.out.println("Mixed boundaries:");
          set.printAsGrid();
        }
      }
    }

    boolean removedAnyObsolete = removeObsoleteShapes(workGrid, closed);
   
    boolean allCornersRound = false;
    if(options.processingOptions.areAllCornersRound()) allCornersRound = true;
   
    //make shapes from the boundary sets
    //make closed shapes
    if(DEBUG_MAKE_SHAPES) {
      System.out.println("***** MAKING SHAPES FROM BOUNDARY SETS *****");
      System.out.println("***** CLOSED: *****");
    }
   
    ArrayList<DiagramComponent> closedShapes = new ArrayList<DiagramComponent>();
    sets = closed.iterator();
    while(sets.hasNext()){
      CellSet set = (CellSet) sets.next();
     
      if(DEBUG_MAKE_SHAPES) {
        set.printAsGrid();
      }
     
      DiagramComponent shape = DiagramComponent.createClosedFromBoundaryCells(workGrid, set, cellWidth, cellHeight, allCornersRound);
      if(shape != null){
        if(shape instanceof DiagramShape){
          addToShapes((DiagramShape) shape);
          closedShapes.add(shape);
        } else if(shape instanceof CompositeDiagramShape)
          addToCompositeShapes((CompositeDiagramShape) shape);
      }
    }

    if(options.processingOptions.performSeparationOfCommonEdges())
      separateCommonEdges(closedShapes);

    //make open shapes
    sets = open.iterator();
    while(sets.hasNext()){
      CellSet set = (CellSet) sets.next();
      if(set.size() == 1){ //single cell "shape"
        TextGrid.Cell cell = (TextGrid.Cell) set.getFirst();
        if(!grid.cellContainsDashedLineChar(cell)) {
          DiagramShape shape = DiagramShape.createSmallLine(workGrid, cell, cellWidth, cellHeight);
          if(shape != null) {
            addToShapes(shape);
            shape.connectEndsToAnchors(workGrid, this);
          }
        }
      } else { //normal shape
                if (DEBUG)
                    System.out.println(set.getCellsAsString());       
       
        DiagramComponent shape =
          CompositeDiagramShape
            .createOpenFromBoundaryCells(
                workGrid, set, cellWidth, cellHeight, allCornersRound);

        if(shape != null){
          if(shape instanceof CompositeDiagramShape){
            addToCompositeShapes((CompositeDiagramShape) shape);
            ((CompositeDiagramShape) shape).connectEndsToAnchors(workGrid, this);
          } else if(shape instanceof DiagramShape) {
            addToShapes((DiagramShape) shape);
            ((DiagramShape) shape).connectEndsToAnchors(workGrid, this);
            ((DiagramShape) shape).moveEndsToCellEdges(grid, this);
          }
        }
         
      }
    }

    //assign color codes to shapes
    //TODO: text on line should not change its color
   
    Iterator<CellColorPair> cellColorPairs = grid.findColorCodes().iterator();
    while(cellColorPairs.hasNext()){
      TextGrid.CellColorPair pair =
        (TextGrid.CellColorPair) cellColorPairs.next();
     
      ShapePoint point =
        new ShapePoint(getCellMidX(pair.cell), getCellMidY(pair.cell));
      DiagramShape containingShape = findSmallestShapeContaining(point);
     
      if(containingShape != null)
        containingShape.setFillColor(pair.color);
    }

    //assign markup to shapes
    Iterator<CellTagPair> cellTagPairs = grid.findMarkupTags().iterator();
    while(cellTagPairs.hasNext()){
      TextGrid.CellTagPair pair =
        (TextGrid.CellTagPair) cellTagPairs.next();
     
      ShapePoint point =
        new ShapePoint(getCellMidX(pair.cell), getCellMidY(pair.cell));
     
      DiagramShape containingShape = findSmallestShapeContaining(point);
     
      //this tag is not within a shape, skip
      if(containingShape == null) continue;
     
      //TODO: the code below could be a lot more concise
      if(pair.tag.equals("d")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("d");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_DOCUMENT);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("s")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("s");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_STORAGE);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("io")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("io");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_IO);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("c")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("c");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_DECISION);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("mo")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("mo");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_MANUAL_OPERATION);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("tr")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("tr");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_TRAPEZOID);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else if(pair.tag.equals("o")){
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes("o");
        if(def == null)
          containingShape.setType(DiagramShape.TYPE_ELLIPSE);
        else {
          containingShape.setType(DiagramShape.TYPE_CUSTOM);
          containingShape.setDefinition(def);
        }
      } else {
        CustomShapeDefinition def =
          options.processingOptions.getFromCustomShapes(pair.tag);
        containingShape.setType(DiagramShape.TYPE_CUSTOM);
        containingShape.setDefinition(def);           
      }
    }
   
    //make arrowheads
    Iterator<Cell> arrowheadCells = workGrid.findArrowheads().iterator();
    while(arrowheadCells.hasNext()){
      TextGrid.Cell cell = arrowheadCells.next();
      DiagramShape arrowhead = DiagramShape.createArrowhead(workGrid, cell, cellWidth, cellHeight);
      if(arrowhead != null) addToShapes(arrowhead);
      else System.err.println("Could not create arrowhead shape. Unexpected error.");
    }
   
    //make point markers
    Iterator<TextGrid.Cell> markersIt = grid.getPointMarkersOnLine().iterator();
    while (markersIt.hasNext()) {
      TextGrid.Cell cell = markersIt.next();

      DiagramShape mark = new DiagramShape();
      mark.addToPoints(new ShapePoint(
          getCellMidX(cell),
          getCellMidY(cell)
        ));
      mark.setType(DiagramShape.TYPE_POINT_MARKER);
      mark.setFillColor(Color.white);
      shapes.add(mark);
    }

    removeDuplicateShapes();
   
    if(DEBUG) System.out.println("Shape count: "+shapes.size());
    if(DEBUG) System.out.println("Composite shape count: "+compositeShapes.size());
   
    //copy again
    workGrid = new TextGrid(grid);
    workGrid.removeNonText();
   
   
    // ****** handle text *******
    //break up text into groups
    TextGrid textGroupGrid = new TextGrid(workGrid);
    CellSet gaps = textGroupGrid.getAllBlanksBetweenCharacters();
    //kludge
    textGroupGrid.fillCellsWith(gaps, '|');
    CellSet nonBlank = textGroupGrid.getAllNonBlank();
    ArrayList<CellSet> textGroups = nonBlank.breakIntoDistinctBoundaries();
    if(DEBUG) System.out.println(textGroups.size()+" text groups found");
   
    Font font = FontMeasurer.instance().getFontFor(cellHeight);
   
    Iterator<CellSet> textGroupIt = textGroups.iterator();
    while(textGroupIt.hasNext()){
      CellSet textGroupCellSet = (CellSet) textGroupIt.next();
     
      TextGrid isolationGrid = new TextGrid(width, height);
      workGrid.copyCellsTo(textGroupCellSet, isolationGrid);
      
      ArrayList<CellStringPair> strings = isolationGrid.findStrings();
View Full Code Here


    if(DEBUG_VERBOSE) {
      System.out.println("******* Sets before *******");
      it = sets.iterator();
      while(it.hasNext()){
        CellSet set = (CellSet) it.next();
        set.printAsGrid();
      }
    }

    //make filled versions of all the boundary sets
    it = sets.iterator();
    while(it.hasNext()){
      CellSet set = (CellSet) it.next();
      set = set.getFilledEquivalent(grid);
      if(set == null){
        return false;
      } else filledSets.add(set);
    }
   
    ArrayList<Integer> toBeRemovedIndices = new ArrayList<Integer>();
    it = filledSets.iterator();
    while(it.hasNext()){
      CellSet set = (CellSet) it.next();
     
      if(DEBUG_VERBOSE){
        System.out.println("*** Deciding if the following should be removed:");
        set.printAsGrid();
      }
     
      //find the other sets that have common cells with set
      ArrayList<CellSet> common = new ArrayList<CellSet>();
      common.add(set);
      Iterator it2 = filledSets.iterator();
      while(it2.hasNext()){
        CellSet set2 = (CellSet) it2.next();
        if(set != set2 && set.hasCommonCells(set2)){
          common.add(set2);
        }
      }
      //it only makes sense for more than 2 sets
      if(common.size() == 2) continue;
     
      //find largest set
      CellSet largest = set;
      it2 = common.iterator();
      while(it2.hasNext()){
        CellSet set2 = (CellSet) it2.next();
        if(set2.size() > largest.size()){
          largest = set2;
        }
      }
     
      if(DEBUG_VERBOSE){
        System.out.println("Largest:");
        largest.printAsGrid();
      }

      //see if largest is sum of others
      common.remove(largest);

      //make the sum set of the small sets on a grid
      TextGrid gridOfSmalls = new TextGrid(largest.getMaxX() + 2, largest.getMaxY() + 2);
      CellSet sumOfSmall = new CellSet();
      it2 = common.iterator();
      while(it2.hasNext()){
        CellSet set2 = (CellSet) it2.next();
        if(DEBUG_VERBOSE){
          System.out.println("One of smalls:");
          set2.printAsGrid();
        }
        gridOfSmalls.fillCellsWith(set2, '*');
      }
      if(DEBUG_VERBOSE){
        System.out.println("Sum of smalls:");
        gridOfSmalls.printDebug();
      }
      TextGrid gridLargest = new TextGrid(largest.getMaxX() + 2, largest.getMaxY() + 2);
      gridLargest.fillCellsWith(largest, '*');

      int index = filledSets.indexOf(largest);
      if(gridLargest.equals(gridOfSmalls)
          && !toBeRemovedIndices.contains(new Integer(index))) {
        toBeRemovedIndices.add(new Integer(index));
        if (DEBUG){
          System.out.println("Decided to remove set:");
          largest.printAsGrid();
        }
      } /*else if (DEBUG){
        System.out.println("This set WILL NOT be removed:");
        largest.printAsGrid();
      }*/
      //if(gridLargest.equals(gridOfSmalls)) toBeRemovedIndices.add(new Integer(index));
    }
   
    ArrayList<CellSet> setsToBeRemoved = new ArrayList<CellSet>();
    it = toBeRemovedIndices.iterator();
    while(it.hasNext()){
      int i = ((Integer) it.next()).intValue();
      setsToBeRemoved.add(sets.get(i));
    }
 
    it = setsToBeRemoved.iterator();
    while(it.hasNext()){
      CellSet set = (CellSet) it.next();
      removedAny = true;
      sets.remove(set);
    }
 
    if(DEBUG_VERBOSE) {
      System.out.println("******* Sets after *******");
      it = sets.iterator();
      while(it.hasNext()){
        CellSet set = (CellSet) it.next();
        set.printAsGrid();
      }
    }
   
    return removedAny;
  }
View Full Code Here

   
    TextGrid.Cell start = (TextGrid.Cell) cells.getFirst();
    if(workGrid.isCorner(start)) shape.addToPoints(makePointForCell(start, workGrid, cellWidth, cellHeight, allRound));
    TextGrid.Cell previous = start;
    TextGrid.Cell cell = null;
    CellSet nextCells = workGrid.followCell(previous);
    if(nextCells.size() == 0) return null;
    cell = (TextGrid.Cell) nextCells.getFirst();
    if(workGrid.isCorner(cell)) shape.addToPoints(makePointForCell(cell, workGrid, cellWidth, cellHeight, allRound));
   
    while(!cell.equals(start)){
      nextCells = workGrid.followCell(cell, previous);
      if(nextCells.size() == 1) {
        previous = cell;
        cell = (TextGrid.Cell) nextCells.getFirst();
        if(!cell.equals(start) && workGrid.isCorner(cell))
          shape.addToPoints(makePointForCell(cell, workGrid, cellWidth, cellHeight, allRound));
      } else if(nextCells.size() > 1) {
        return null;
      }
    }
   
    return shape;
View Full Code Here

  @Test public void testFillContinuousAreaSquareOutside() throws FileNotFoundException, IOException {
    TextGrid squareGrid;
    squareGrid = new TextGrid();
    squareGrid.loadFrom("tests/text/simple_square01.txt");

    CellSet filledArea = squareGrid.fillContinuousArea(0, 0, '*');
    int size = filledArea.size();
    assertEquals(64, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(squareGrid, expectedFilledArea, 0,0, 11,2);
    addSquareToCellSet(squareGrid, expectedFilledArea, 0,7, 11,2);
    addSquareToCellSet(squareGrid, expectedFilledArea, 0,2, 2,5);
    addSquareToCellSet(squareGrid, expectedFilledArea, 9,2, 2,5);
    assertEquals(expectedFilledArea, filledArea);
View Full Code Here

  @Test public void testFillContinuousAreaSquareInside() throws FileNotFoundException, IOException {
    TextGrid squareGrid;
    squareGrid = new TextGrid();
    squareGrid.loadFrom("tests/text/simple_square01.txt");
   
    CellSet filledArea = squareGrid.fillContinuousArea(3, 3, '*');
    int size = filledArea.size();
    assertEquals(15, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(squareGrid, expectedFilledArea, 3,3, 5,3);
    assertEquals(expectedFilledArea, filledArea);
  }
View Full Code Here

  @Test public void testFillContinuousAreaUInside() throws FileNotFoundException, IOException {
    TextGrid uGrid;
    uGrid = new TextGrid();
    uGrid.loadFrom("tests/text/simple_U01.txt");
   
    CellSet filledArea = uGrid.fillContinuousArea(3, 3, '*');
    int size = filledArea.size();
   
    assertEquals(62, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(uGrid, expectedFilledArea,  3,3, 5,5);
    addSquareToCellSet(uGrid, expectedFilledArea, 14,3, 5,5);
    addSquareToCellSet(uGrid, expectedFilledArea,  8,6, 6,2);
    assertEquals(expectedFilledArea, filledArea);
  }
View Full Code Here

  @Test public void testFillContinuousAreaUOutside() throws FileNotFoundException, IOException {
    TextGrid uGrid;
    uGrid = new TextGrid();
    uGrid.loadFrom("tests/text/simple_U01.txt");
   
    CellSet filledArea = uGrid.fillContinuousArea(0, 0, '*');
    int size = filledArea.size();
   
    assertEquals(128, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(uGrid, expectedFilledArea,  0,02,11);
    addSquareToCellSet(uGrid, expectedFilledArea, 20,02,11);
   
    addSquareToCellSet(uGrid, expectedFilledArea,  0,0, 22, 2);
    addSquareToCellSet(uGrid, expectedFilledArea,  0,9, 22, 2);
View Full Code Here

  @Test public void testFillContinuousAreaSOutside() throws FileNotFoundException, IOException {
    TextGrid uGrid;
    uGrid = new TextGrid();
    uGrid.loadFrom("tests/text/simple_S01.txt");
   
    CellSet filledArea = uGrid.fillContinuousArea(0, 0, '*');
    int size = filledArea.size();
   
    assertEquals(246, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(uGrid, expectedFilledArea,  0, 0, 25, 2);
    addSquareToCellSet(uGrid, expectedFilledArea,  0,12, 25, 2);

    addSquareToCellSet(uGrid, expectedFilledArea,  0, 02,14);
    addSquareToCellSet(uGrid, expectedFilledArea, 23, 02,14);

    addSquareToCellSet(uGrid, expectedFilledArea,  9, 07, 7);
    addSquareToCellSet(uGrid, expectedFilledArea,  0, 79, 7);
    addSquareToCellSet(uGrid, expectedFilledArea, 16, 79, 7);

    expectedFilledArea.add(uGrid.new Cell(22, 6));
   
    assertEquals(expectedFilledArea, filledArea);
  }
View Full Code Here

  @Test public void testFillContinuousAreaSInside1() throws FileNotFoundException, IOException {
    TextGrid uGrid;
    uGrid = new TextGrid();
    uGrid.loadFrom("tests/text/simple_S01.txt");
   
    CellSet filledArea = uGrid.fillContinuousArea(3, 3, '*');
    int size = filledArea.size();
   
    assertEquals(15, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(uGrid, expectedFilledArea,  3, 35, 3);
    assertEquals(expectedFilledArea, filledArea);
  }
View Full Code Here

  @Test public void testFillContinuousAreaSInside2() throws FileNotFoundException, IOException {
    TextGrid uGrid;
    uGrid = new TextGrid();
    uGrid.loadFrom("tests/text/simple_S01.txt");
   
    CellSet filledArea = uGrid.fillContinuousArea(17, 3, '*');
    int size = filledArea.size();

    assertEquals(15, size);
   
    CellSet expectedFilledArea = new CellSet();
    addSquareToCellSet(uGrid, expectedFilledArea,  17, 35, 3);
    assertEquals(expectedFilledArea, filledArea);
  }
View Full Code Here

TOP

Related Classes of org.stathissideris.ascii2image.text.CellSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.