Package jmt.engine.jaba

Examples of jmt.engine.jaba.Sector3D


      // Used to sort label ascendingly by position
      TreeSet<Caption> labels = new TreeSet<Caption>();

      // per ogni settore
      for (int i = 0; i < s3d.size(); i++) {
        Sector3D sector = (Sector3D) s3d.get(i);
        //System.out.println("Totale: "+s3d.size()+", Parziale: "+i);
        // Sono le coordinate dei punti che saranno passati al metodo fillPolygon
        int[] xxp = new int[sector.CountPoint()];
        int[] yyp = new int[sector.CountPoint()];

        Vector<newPoint> points = new Vector<newPoint>();

        // per ogni punto di un settore
        for (int j = 0; j < sector.CountPoint(); j++) {

          double pb11 = sector.getx(j);
          double pb12 = sector.gety(j);

          int pb1 = (int) Math.floor(pb11 * height);
          int pb2 = (int) Math.floor(pb12 * height);

          //Aggiungo il punto al vettore da passare al Grahamscan
          newPoint temp = new newPoint(pb1, pb2);
          points.addElement(temp);
        }

        //Coloro il settore in base al numero di stazioni che vi saturano
        int numstat = sector.getType();
        if (numstat > 2) {
          sectorcolor = MORE;
        } else if (numstat == 2) {
          sectorcolor = DOUBLE;
        } else {
          sectorcolor = SINGLE;
        }

        grahamScan gr = new grahamScan();
        Vector<newPoint> ordpoint = gr.doGraham(points);

        for (int j = 0; j < ordpoint.size(); j++) {
          xxp[j] = ordpoint.get(j).x;
          yyp[j] = -ordpoint.get(j).y;
        }

        // Disegna i settori di saturazione
        g2.setColor(sectorcolor);
        g2.fillPolygon(xxp, yyp, sector.CountPoint());
        if (numstat != 1) {
          g2.setColor(Color.BLACK);
          g2.draw(new Polygon(xxp, yyp, sector.CountPoint()));
        }

        // Adds this sector to labels
        double[] centre = sector.getCentre();
        labels.add(new Caption(sector.getName(), centre[0], centre[1], sector.getType()));

      }//per ogni settore

      // Now draws captions and link them to the corresponding sector
      Iterator<Caption> i = labels.iterator();
View Full Code Here


      // Used to sort label ascendingly by position
      TreeSet<Caption> labels = new TreeSet<Caption>();

      // per ogni settore
      for (int i = 0; i < s3d.size(); i++) {
        Sector3D sector = (Sector3D) s3d.get(i);
        //System.out.println("Totale: "+s3d.size()+", Parziale: "+i);
        // Sono le coordinate dei punti che saranno passati al metodo fillPolygon
        int[] xxp = new int[sector.CountPoint()];
        int[] yyp = new int[sector.CountPoint()];

        Vector<newPoint> points = new Vector<newPoint>();

        // per ogni punto di un settore
        for (int j = 0; j < sector.CountPoint(); j++) {

          double pb11 = sector.getx(j);
          double pb12 = sector.gety(j);

          int pb1 = (int) Math.floor(pb11 * height);
          int pb2 = (int) Math.floor(pb12 * height);

          //Aggiungo il punto al vettore da passare al Grahamscan
          newPoint temp = new newPoint(pb1, pb2);
          points.addElement(temp);
        }

        //Coloro il settore in base al numero di stazioni che vi saturano
        int numstat = sector.getType();
        if (numstat > 2) {
          sectorcolor = MORE;
        } else if (numstat == 2) {
          sectorcolor = DOUBLE;
        } else {
          sectorcolor = SINGLE;
        }

        grahamScan gr = new grahamScan();
        Vector<newPoint> ordpoint = gr.doGraham(points);

        for (int j = 0; j < ordpoint.size(); j++) {
          xxp[j] = ordpoint.get(j).x;
          yyp[j] = -ordpoint.get(j).y;
        }

        // Disegna i settori di saturazione
        g2.setColor(sectorcolor);
        g2.fillPolygon(xxp, yyp, sector.CountPoint());
        if (numstat != 1) {
          g2.setColor(Color.BLACK);
          g2.draw(new Polygon(xxp, yyp, sector.CountPoint()));
        }

        // Adds this sector to labels
        double[] centre = sector.getCentre();
        labels.add(new Caption(sector.getName(), centre[0], centre[1], sector.getType()));

      }//per ogni settore

      // Now draws captions and link them to the corresponding sector
      Iterator<Caption> i = labels.iterator();
View Full Code Here

TOP

Related Classes of jmt.engine.jaba.Sector3D

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.