Package ar.renderers

Examples of ar.renderers.ParallelRenderer.aggregate()


    Aggregator<Object,Integer> aggregator = new Numbers.Count<Object>();
    Selector<Point2D> selector = TouchesPixel.make(dataset);


    AffineTransform vt = Util.zoomFit(dataset.bounds(), width, height);
    Aggregates<Integer> aggregates = r.aggregate(dataset, selector, aggregator, vt, width, height);

   
    Map<String, Transfer<Integer,Integer>> allCarvers = new HashMap<String, Transfer<Integer,Integer>>() {{
        put("incremental", new SeamCarving.CarveIncremental<>(new SeamCarving.LeftValue<Integer>(), Direction.V, 0,seams));
        put("sweep", new SeamCarving.CarveSweep<>(new SeamCarving.LeftValue<Integer>(), Direction.V, 0, seams));
View Full Code Here


    System.out.println("State shapes loaded.");

    final AffineTransform viewTransform = Util.zoomFit(populationSource.bounds().createUnion(states.bounds()), viewBounds.width, viewBounds.height);

   
    final Aggregates<Integer> population = renderer.aggregate(populationSource, TouchesPixel.make(populationSource), new Numbers.Count<>(), viewTransform, viewBounds.width, viewBounds.height);
    final Aggregates<String> labels = renderer.aggregate(states, TouchesPixel.make(states), new General.Last<>(""), viewTransform, viewBounds.width, viewBounds.height);
    Aggregates<Pair<String,Integer>> pairs = CompositeWrapper.wrap(labels, population);
    System.out.println("Base aggregates created.\n");
   
   
View Full Code Here

    final AffineTransform viewTransform = Util.zoomFit(populationSource.bounds().createUnion(states.bounds()), viewBounds.width, viewBounds.height);

   
    final Aggregates<Integer> population = renderer.aggregate(populationSource, TouchesPixel.make(populationSource), new Numbers.Count<>(), viewTransform, viewBounds.width, viewBounds.height);
    final Aggregates<String> labels = renderer.aggregate(states, TouchesPixel.make(states), new General.Last<>(""), viewTransform, viewBounds.width, viewBounds.height);
    Aggregates<Pair<String,Integer>> pairs = CompositeWrapper.wrap(labels, population);
    System.out.println("Base aggregates created.\n");
   
   
    int step=100;
View Full Code Here

    //We must first define a display surface's size, shape and zoom characteristics
    //At the end, a simple buffered image is produced.
    int width = 800;
    int height = 800;
    AffineTransform vt = Util.zoomFit(dataset.bounds(), width, height);
    Aggregates<Integer> aggregates = r.aggregate(dataset, selector, aggregator, vt, width, height);
    Transfer.Specialized<Number,Color> specializedTransfer = transfer.specialize(aggregates);
    Aggregates<Color> colors = r.transfer(aggregates, specializedTransfer);
   
    //Make a final image (if the aggregates are colors)
    @SuppressWarnings("unused"//Unused because its just a demo of how to do it
View Full Code Here

      for (int i=0; i< widths.length; i++) {
        int width = Integer.parseInt(widths[i]);
        int height = Integer.parseInt(heights[i]);
        System.out.printf("Processing %s at %dx%d\n", source, width, height);
        AffineTransform ivt = Util.zoomFit(glyphs.bounds(), width, height).createInverse();
        Aggregates<Integer> aggs = render.aggregate(glyphs, selector, aggregator, ivt, width, height);
        String filepart = String.format("%dx%d", width, height);
        String filename = String.format(outPattern, filepart);
        System.out.printf("\t Writing to %s\n", filename);
        if (filename.endsWith("csv")) {
          AggregatesToCSV.export(aggs, new File(filename));
View Full Code Here

   
    final int width = 800;
    final int height = 800;
    AffineTransform vt = Util.zoomFit(dataset.bounds(), width, height);
    Aggregates<Integer> counts = r.aggregate(dataset, selector, aggregator, vt, width, height);
   
    //final ISOContours.Single.Specialized<Integer> contour = new ISOContours.Single.Specialized<>(5, true, counts);
    //final ISOContours.NContours.Specialized<Integer> contour = new ISOContours.NContours.Specialized<>(5, true, counts);
    //final ISOContours.SpacedContours.Specialized<Integer> contour = new ISOContours.SpacedContours.Specialized<>(0, 100, true, counts);
   
View Full Code Here

  @BeforeClass
  public static void load() throws Exception {
    Glyphset<Rectangle2D, Object> glyphs = GlyphsetUtils.autoLoad(new File("../data/circlepoints.csv"), .1, DynamicQuadTree.<Rectangle2D, Object>make());
    Selector<Rectangle2D> selector = TouchesPixel.make(glyphs);
    Renderer r = new ParallelRenderer();
    count = r.aggregate(glyphs, selector, new Numbers.Count<>(), Util.zoomFit(glyphs.bounds(), 10, 10), 10,10);
  }
 
  @Test
  public void startStop() throws Exception{
    ARCombiner<Integer> c = new ARCombiner<Integer>("localhost", 8739, new ar.ext.avro.Converters.ToCount(), new Numbers.Count<>());
View Full Code Here

   */
  @SuppressWarnings({ "rawtypes", "unchecked" })
  public Aggregates<?> execute(Glyphset<?,?> glyphs, Aggregator agg, List<Transfer<?,?>> transfers, AffineTransform view, int width, int height) {
    Renderer r = new ParallelRenderer();
    Selector s = TouchesPixel.make(glyphs);
    Aggregates aggs = r.aggregate(glyphs, s, agg, view, width, height);

    Transfer transfer;
    if (transfers.size() >= 2) {
      Seq t = new Seq(transfers.get(0), transfers.get(1));
      for (int i=2; i< transfers.size(); i++) {t.then(transfers.get(i));}
View Full Code Here

        0.0,
        241.4615556310524,
        238.49100176586487,
        236.13546883394775);
    Selector<Rectangle2D> s = TouchesPixel.make(glyphs);
    count = r.aggregate(glyphs, s, new Numbers.Count<Object>(), vt, 500,500);
    cocs = r.aggregate(glyphs, s, new Categories.CountCategories<Color>(Util.COLOR_SORTER), vt, 500,500);
  }
 
  @Test
  public void inOrderEqOutOrder() throws Exception {
View Full Code Here

        241.4615556310524,
        238.49100176586487,
        236.13546883394775);
    Selector<Rectangle2D> s = TouchesPixel.make(glyphs);
    count = r.aggregate(glyphs, s, new Numbers.Count<Object>(), vt, 500,500);
    cocs = r.aggregate(glyphs, s, new Categories.CountCategories<Color>(Util.COLOR_SORTER), vt, 500,500);
  }
 
  @Test
  public void inOrderEqOutOrder() throws Exception {
    Aggregates<Integer> ref = new RefFlatAggregates<Integer>(2,2,-1);
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.