Exemplo n.º 1
0
 @Test
 public void testPLine() throws IOException {
   URL url = this.getClass().getResource("pline.gp");
   InputStream is = url.openStream();
   GocadReaderParameters parameters = new GocadReaderParameters();
   List<FastShape> shapes = GocadFactory.read(is, url, parameters);
   assertEquals(1, shapes.size());
   assertEquals(2, shapes.get(0).getPositions().size());
 }
Exemplo n.º 2
0
  @Test
  public void testVSet() throws IOException {
    URL url = this.getClass().getResource("vset.vs");
    InputStream is = url.openStream();
    GocadReaderParameters parameters = new GocadReaderParameters();
    List<FastShape> shapes = GocadFactory.read(is, url, parameters);

    assertEquals(1, shapes.size());

    FastShape shape = shapes.get(0);
    assertEquals(20, shape.getPositions().size());
    assertEquals(GL.GL_POINTS, shape.getMode());
    assertFalse(shape.isLighted());
    assertEquals(2.0, shape.getPointSize(), 0.001);
    assertEquals(new Color(0.098039f, 0.098039f, 0.439216f), shape.getColor());
    assertNull(shape.getColorBuffer());
  }
Exemplo n.º 3
0
  @Test
  public void testVSetWithColorMap() throws IOException {
    URL url = this.getClass().getResource("vset.vs");
    InputStream is = url.openStream();

    GocadReaderParameters parameters = new GocadReaderParameters();
    ColorMap colorMap = new ColorMap();
    colorMap.setValuesPercentages(true);
    colorMap.put(0d, Color.BLACK);
    colorMap.put(1d, Color.WHITE);
    parameters.setColorMap(colorMap);

    List<FastShape> shapes = GocadFactory.read(is, url, parameters);

    assertEquals(1, shapes.size());

    FastShape shape = shapes.get(0);
    assertNotNull(shape.getColorBuffer());
    assertEquals(20 * 4, shape.getColorBuffer().length);
  }