Package jmt.engine.jaba

Examples of jmt.engine.jaba.FinalSect2D


    g2.setStroke(DOTTED_LINES);
    ArrayList<DPoint> valuesOnX = new ArrayList<DPoint>();
    Vector<Object> sectors = data.getResults().getSaturationSectors();
    for (int i = 0; i < sectors.size() && sectors.size() != 1; i++) {
      FinalSect2D sect;// Current sector
      sect = (FinalSect2D) sectors.get(i);
      plane.drawProjectionOnTheXAxis(new DPoint(sect.getBeta1(),
          yMaxValue));
      valuesOnX.add(new DPoint(sect.getBeta1(), sect.getBeta11()));
    }
    g2.setStroke(LINES);

    if (!valuesOnX.contains(new DPoint(1, 0)))
      valuesOnX.add(new DPoint(1, 0));
View Full Code Here


    // Used to avoid station label overlapping
    float previousFirstPos = Float.POSITIVE_INFINITY;

    for (int i = 0; i < s3d.size(); i++) {
      // Current sector
      FinalSect2D sect = (FinalSect2D) s3d.get(i);
      double pb11 = sect.getBeta11();
      double pb12 = sect.getBeta1();
      double pb21 = sect.getBeta22();
      double pb22 = sect.getBeta2();

      // Station's number
      int numstat = sect.countStation();

      if (numstat > 2) {
        sectorcolor = MORE;
      } else if (numstat == 2) {
        sectorcolor = DOUBLE;
      } else {
        sectorcolor = SINGLE;
      }

      g2.setStroke(SECTORS);

      g2.setColor(sectorcolor);
      g2.draw(new Line2D.Double(getX(pb11), getY(pb12), getX(pb21), getY(pb22)));

      // Dotted line
      g2.setStroke(DOTTED);
      sectorcolor = GREY;
      g2.setColor(sectorcolor);
      g2.draw(new Line2D.Double(getX(pb21), getY(pb22), getX(0), getY(pb22)));
      g2.draw(new Line2D.Double(getX(pb21), getY(pb22), getX(pb21), getY(0)));

      // Values on X-axis
      g2.setColor(BLACK);
      String coordx = formatter.format(pb21);

      if (i % 2 == 1 || s3d.size() == 1) {
        g2.drawString(coordx, (float) (getX(pb21) - fontBounds.getWidth() / 2), (float) getY(0) + 15);
      } else {
        g2.drawString(coordx, (float) (getX(pb21) - fontBounds.getWidth() / 2), (float) (getY(0) + 17 + fontBounds.getHeight()));
        g2.setStroke(DOTTED);
        g2.setColor(GREY);
        g2.draw(new Line2D.Double(getX(pb21), getY(0), getX(pb21), (float) (getY(0) + fontBounds.getHeight() + 2)));
      }

      // Values on Y-axis
      g2.setColor(BLACK);
      String coordy = formatter.format(pb12);

      g2.drawString(coordy, (float) (getX(0) - fontBounds.getWidth() - 5), (float) (getY(pb12) + fontBounds.getHeight() / 2 - 2));

      // Now draws station name labels. They are centered on the line of the caption (if possible)
      g2.setColor(BLACK);
      String etichetta = (sect.getstation()).get(0).getName();

      // position of first label. Try to center with the middle of the sector but avoids overlapping with previous ones
      boolean overlapping = false;
      float firstpos = (float) (getY((pb12 + pb22) / 2) - (numstat - 1) * (fontBounds.getHeight()) / 2) + 3;
      if (firstpos + (numstat + .5) * (float) fontBounds.getHeight() > previousFirstPos) {
        // Labels are overlapping
        firstpos = (float) (previousFirstPos - (numstat + .5) * fontBounds.getHeight());
        overlapping = true;
      }
      // Updates previousFirstPos value
      previousFirstPos = firstpos;

      g2.drawString(etichetta, xetich, firstpos);
      // Next labels
      for (int j = 1; j < numstat; j++) {
        String etich = (sect.getstation()).get(j).getName();
        g2.drawString(etich, xetich, firstpos + j * (float) fontBounds.getHeight());
      }

      // Draws the line of the caption. Prefers horizontal line if possible
      g2.setColor(BLACK);
View Full Code Here

    valuesOnY = new ArrayList<DPoint>();
    valuesOnX = new ArrayList<DPoint>();
    for (int i = 0; i < s3d.size(); i++) {
      String label;
      DPoint sectorBegin, sectorEnd, labelPoint;
      FinalSect2D sect;// Current sector

      sect = (FinalSect2D) s3d.get(i);
      sectorBegin = new DPoint(sect.getBeta1(), sect.getBeta11());
      sectorEnd = new DPoint(sect.getBeta2(), sect.getBeta22());
      // labelPoint is the mean between sectorBegin and sectorEnd
      labelPoint = new DPoint(plane.getTrueX((sectorBegin.getX())
          + ((sectorEnd.getX() - sectorBegin.getX()) / 2)),
          plane.getTrueY((sectorEnd.getY())
              + ((sectorBegin.getY() - sectorEnd.getY()) / 2)));

      valuesOnY.add(sectorBegin);
      valuesOnX.add(sectorBegin);

      switch (sect.getstation().size()) {
      case 1:
        g2.setColor(SINGLE);
        break;
      case 2:
        g2.setColor(DOUBLE);
        break;
      default:
        g2.setColor(MORE);
      }

      g2.setStroke(SECTORS);
      plane.drawSegment(sectorBegin, sectorEnd);
      g2.setStroke(DOTTED);
      g2.setColor(Color.BLACK);
      plane.drawProjectionOnTheXAxis(sectorBegin);
      plane.drawProjectionOnTheXAxis(sectorEnd);
      plane.drawProjectionOnTheYAxis(sectorEnd);
      plane.drawProjectionOnTheYAxis(sectorBegin);
      label = labelGenerator(sect.getstation());
      labels.add(label);
      labelPoints.add(labelPoint);

    }
    g2.setColor(Color.BLACK);
View Full Code Here

      g.setFont(label);

      //Draw the label
      for (int i = 0; i < s3d.size(); i++) {
        // Current sector
        FinalSect2D sect = (FinalSect2D) s3d.get(i);
        String pb11 = format2Dec.format(sect.getBeta11() * 100);
        String pb12 = format2Dec.format(sect.getBeta1() * 100);
        String pb21 = format2Dec.format(sect.getBeta22() * 100);
        String pb22 = format2Dec.format(sect.getBeta2() * 100);

        if (sect.countStation() < 2) {
          continue;
        }

        Station2D d1 = (sect.getstation()).get(0);
        Station2D d2 = (sect.getstation()).get(1);
        int d1x = (int) (d1.getVert()).getX();
        int d1y = (int) (d1.getVert()).getY();
        int d2x = (int) (d2.getVert()).getX();
        int d2y = (int) (d2.getVert()).getY();
        int p1x = (int) (p1.getX() * 100);
 
View Full Code Here

      g.setFont(label);

      // Draw the label
      for (int i = 0; i < data.getResults().getSaturationSectors().size(); i++) {
        // Current sector
        FinalSect2D sect = (FinalSect2D) data.getResults()
            .getSaturationSectors().get(i);
        String pb11 = FORMAT_3_DEC.format(sect.getBeta11() * 100);
        String pb12 = FORMAT_3_DEC.format(sect.getBeta1() * 100);
        String pb21 = FORMAT_3_DEC.format(sect.getBeta22() * 100);
        String pb22 = FORMAT_3_DEC.format(sect.getBeta2() * 100);

        if (sect.countStation() < 2) {
          continue;
        }

        Station2D d1 = (sect.getstation()).get(0);
        Station2D d2 = (sect.getstation()).get(1);
        int d1x = (int) (d1.getVert()).getX();
        int d1y = (int) (d1.getVert()).getY();
        int d2x = (int) (d2.getVert()).getX();
        int d2y = (int) (d2.getVert()).getY();
        int p1x = (int) (p1.getX() * 100);
 
View Full Code Here

TOP

Related Classes of jmt.engine.jaba.FinalSect2D

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.