Examples of DoubleMap


Examples of com.linkedin.data.template.DoubleMap

    result = test("{\"key1\": 2.2, \"key2\": 3.3}", DoubleMap.class);
    final Map<String, Double> doubleFixture = new HashMap<String, Double>();
    doubleFixture.put("key1", 2.2D);
    doubleFixture.put("key2", 3.3D);
    Assert.assertEquals(result, new DoubleMap(doubleFixture));
    Assert.assertSame(result.getClass(), DoubleMap.class);

    result = test("{\"key1\": " + _bytes16Quoted + ", \"key2\": " + _bytes16Quoted + "}", BytesMap.class);
    final Map<String, ByteString> bytesFixture = new HashMap<String, ByteString>();
    bytesFixture.put("key1", ByteString.copyAvroString(_bytes16, true));
View Full Code Here

Examples of com.linkedin.data.template.DoubleMap

  public void testMapSchema()
  {
    TyperefTest record = new TyperefTest();
    RecordDataSchema recordDataSchema = record.schema();

    DoubleMap doubleMap = new DoubleMap();
    record.setDoubleRefMap(doubleMap);
    doubleMap = record.getDoubleRefMap();
    assertEquals(doubleMap.schema(), DataTemplateUtil.getSchema(DoubleMap.class));
    assertNotEquals(recordDataSchema.getField("doubleRefMap").getType(), doubleMap.schema());

    IntegerMap intMap = new IntegerMap();
    record.setIntMap(intMap);
    intMap = record.getIntMap();
    assertEquals(intMap.schema(), DataTemplateUtil.getSchema(IntegerMap.class));
View Full Code Here

Examples of dwlab.shapes.maps.DoubleMap

 
  public static void main() {
    Platform.setClearingColor( 0.25d, 0.5d, 0d );

    clearScreen();
    DoubleMap doubleMap = new DoubleMap( mapSize, mapSize );
    drawDoubleMap( doubleMap );
    printText( "Step 1: creating Double map and set its resolution" );
    swapBuffers();
    waitForKey();

    clearScreen();
    doubleMap.perlinNoise( 16, 16, 0.25, 0.5, 4 );
    drawDoubleMap( doubleMap );
    printText( "Step 2: filling DoubleMap with Perlin noise" );
    swapBuffers();
    waitForKey();

    clearScreen();
    World.fromFile( "res/tileset.lw" );
    TileSet tileSet = World.editorData.tilesets.getFirst();
    TileMap tileMap = TileMap.create( tileSet, mapSize, mapSize );
    tileMap.setSize( 400d / 25d, 400d / 25d );
    Project.printText( "Step 3: loading world, extract tileset from there and" );
    Project.printText( "creating tilemap with same size and this tileset", 1 );
    drawDoubleMap( doubleMap );
    swapBuffers();
    waitForKey();

    clearScreen();
    doubleMap.extractTo( tileMap, 0.5d, 1d, filledTileNum );
    Project.printText( "Step 4: setting tiles number of tilemap to FilledTileNum" );
    Project.printText( "if corresponding value of Double map is higher than 0.5", 1 );
    tileMap.draw();
    drawSignature();
    swapBuffers();
View Full Code Here

Examples of dwlab.shapes.maps.DoubleMap

    LWJGL.init();
    main();
  }
 
  public static void main() {
    DoubleMap sourceMap = new DoubleMap( mapSize, mapSize );
    sourceMap.drawCircle( mapSize * 0.375d, mapSize * 0.375d, mapSize * 0.35d, 0.6d );
    draw( sourceMap.toNewImage(), "Source map" );

    DoubleMap targetMap = new DoubleMap( mapSize, mapSize );
    targetMap.drawCircle( mapSize * 0.625d, mapSize * 0.625d, mapSize * 0.35d, 0.8d );
    draw( targetMap.toNewImage(), "Target map" );

    DoubleMap doubleMap = new DoubleMap( mapSize, mapSize );
    doubleMap.paste( targetMap );
    doubleMap.paste( sourceMap, 0, 0, DoubleMap.PasteMode.ADD );
    doubleMap.limit();
    draw( doubleMap.toNewImage(), "Adding source map to target map" );

    doubleMap.paste( targetMap );
    doubleMap.paste( sourceMap, 0, 0, DoubleMap.PasteMode.MULTIPLY );
    draw( doubleMap.toNewImage(), "Multiplying source map with target map" );

    doubleMap.paste( targetMap );
    doubleMap.paste( sourceMap, 0, 0, DoubleMap.PasteMode.MAXIMUM );
    draw( doubleMap.toNewImage(), "Maximum of source map and target map" );

    doubleMap.paste( targetMap );
    doubleMap.paste( sourceMap, 0, 0, DoubleMap.PasteMode.MINIMUM );
    draw( doubleMap.toNewImage(), "Minimum of source map and target map" );

    ImageBuffer buffer = sourceMap.toNewImageBuffer( DoubleMap.Channel.RED );
    targetMap.paste( buffer, DoubleMap.Channel.GREEN );
    draw( buffer.toImage(), "Pasting maps to different color channels" );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.