コード例 #1
0
ファイル: DrawVector.java プロジェクト: hulstores/geogebra
  @Override
  public void draw(org.geogebra.common.awt.GGraphics2D g2) {
    if (isVisible) {
      if (traceDrawingNeeded) {
        traceDrawingNeeded = false;
        org.geogebra.common.awt.GGraphics2D g2d = view.getBackgroundGraphics();
        if (g2d != null) drawTrace(g2d);
      }

      if (geo.doHighlighting()) {
        g2.setPaint(((GeoElement) v).getSelColor());
        g2.setStroke(selStroke);
        if (lineVisible) g2.draw(line);
      }

      g2.setPaint(getObjectColor());
      g2.setStroke(objStroke);
      if (lineVisible) g2.draw(line);
      if (arrowheadVisible) g2.fill(gp);

      if (labelVisible) {
        g2.setFont(view.getFontVector());
        g2.setPaint(((GeoElement) v).getLabelColor());
        drawLabel(g2);
      }
    }
  }
コード例 #2
0
ファイル: DrawSlope.java プロジェクト: hulstores/geogebra
  @Override
  public final void draw(GGraphics2D g2) {
    if (isVisible) {
      fill(g2, gp, false); // fill using default/hatching/image as
      // appropriate

      if (geo.doHighlighting()) {
        g2.setPaint(geo.getSelColor());
        g2.setStroke(selStroke);
        g2.draw(gp);
      }

      if (geo.lineThickness > 0) {
        g2.setPaint(getObjectColor());
        g2.setStroke(objStroke);
        g2.draw(gp);
      }

      if (labelVisible) {
        g2.setPaint(slope.getLabelColor());
        g2.setFont(view.getFontLine());
        drawLabel(g2);
        g2.drawString(horLabel, xLabelHor, yLabelHor);
      }
    }
  }
コード例 #3
0
ファイル: DrawVector.java プロジェクト: hulstores/geogebra
 @Override
 protected final void drawTrace(org.geogebra.common.awt.GGraphics2D g2) {
   g2.setPaint(getObjectColor());
   g2.setStroke(objStroke);
   if (lineVisible) g2.draw(line);
   if (arrowheadVisible) g2.fill(gp);
 }
コード例 #4
0
ファイル: DrawVector.java プロジェクト: hulstores/geogebra
 public final void drawPreview(org.geogebra.common.awt.GGraphics2D g2) {
   if (isVisible) {
     g2.setPaint(getObjectColor());
     updateStrokes(geo);
     g2.setStroke(objStroke);
     if (arrowheadVisible) g2.fill(gp);
     if (lineVisible) g2.draw(line);
   }
 }
コード例 #5
0
ファイル: CanvasDrawable.java プロジェクト: DanielG/geolibra
  protected void drawLabel(GGraphics2D g2, GeoElement geo0, String text) {

    if (isLatexString(text)) {
      drawLatex(g2, geo0, getLabelFont(), text, xLabel, yLabel);
    } else {
      g2.setPaint(geo.getObjectColor());

      EuclidianStatic.drawIndexedString(
          view.getApplication(), g2, text, xLabel, yLabel + getTextBottom(), false, false);
    }
  }
コード例 #6
0
ファイル: CanvasDrawable.java プロジェクト: DanielG/geolibra
  protected void drawOnCanvas(org.geogebra.common.awt.GGraphics2D g2, String text) {
    App app = view.getApplication();
    setPreferredSize(getPreferredSize());

    GFont vFont = view.getFont();
    setLabelFont(app.getFontCanDisplay(text, false, vFont.getStyle(), getLabelFontSize()));

    g2.setFont(getLabelFont());
    g2.setStroke(EuclidianStatic.getDefaultStroke());

    g2.setPaint(geo.getObjectColor());

    if (geo.isVisible()) {

      drawWidget(g2);
    }
  }
コード例 #7
0
ファイル: DrawBarGraph.java プロジェクト: rlangdon95/geogebra
  @Override
  public void draw(org.geogebra.common.awt.GGraphics2D g2) {
    // Save fill, color and alfa of object
    GColor color = geo.getSelColor();
    FillType fillType = geo.getFillType();
    int hatchingDistance = geo.getHatchingDistance();
    String symbol = geo.getFillSymbol();
    double hatchingAngle = geo.getHatchingAngle();
    String fileName = geo.getImageFileName();
    float alpha = geo.getAlphaValue();
    AlgoBarChart algop = (AlgoBarChart) geo.getParentAlgorithm();
    int k;
    if (isVisible) {
      try {
        if (geo.doHighlighting()) {
          g2.setPaint(sum.getSelColor());
          g2.setStroke(selStroke);
          for (int i = 0; i < gp.length; i++) {
            k = i + 1;
            if (algop.getBarColor(k) != null) {
              GColor col = algop.getBarColor(k);
              g2.setPaint(
                  AwtFactory.prototype.newColor(
                      col.getRed(), col.getGreen(),
                      col.getBlue(), col.getAlpha()));
            }
            g2.draw(gp[i]);
          }
          g2.setPaint(color);
        }
      } catch (Exception e) {
        App.debug(e.getMessage());
      }

      try {
        if (algo.getDrawType() != DrawType.STEP_GRAPH_CONTINUOUS) {
          /*
           * Use tags for draw if there are
           */
          for (int i = 0; i < gp.length; i++) {
            k = i + 1;
            if (algop.getBarColor(k) != null) {
              GColor col = algop.getBarColor(k);
              geo.setObjColor(col);
              geo.setAlphaValue(col.getAlpha());
            }
            if (algop.getBarAlpha(k) != -1.0) {
              geo.setAlphaValue(algop.getBarAlpha(k));
            }

            geo.setFillType(algop.getBarFillType(k));

            if (algop.getBarSymbol(k) != null) {
              geo.setFillSymbol(algop.getBarSymbol(k));
            }
            if (algop.getBarImage(k) != null) {
              geo.setImageFileName(algop.getBarImage(k));
            }
            if (algop.getBarHatchDistance(k) != -1) {
              geo.setHatchingDistance(algop.getBarHatchDistance(k));
            }
            if (algop.getBarHatchAngle(k) != -1) {
              geo.setHatchingAngle(algop.getBarHatchAngle(k));
            }

            fill(g2, gp[i], false); // fill using
            // default/hatching/image as
            // appropriate
            // Restore values
            geo.setObjColor(color);
            geo.setFillType(fillType);
            geo.setHatchingAngle((int) hatchingAngle);
            geo.setHatchingDistance(hatchingDistance);
            geo.setFillSymbol(symbol);
            geo.setImageFileName(fileName);
            geo.setAlphaValue(alpha);
          }
        }

      } catch (Exception e) {
        e.printStackTrace();
      }

      try {
        if (geo.getLineThickness() > 0) {
          g2.setPaint(getObjectColor());
          g2.setStroke(objStroke);
          for (int i = 0; i < gp.length; i++) {
            k = i + 1;
            if (algop.getBarColor(k) != null) {
              GColor col = algop.getBarColor(k);
              g2.setPaint(
                  AwtFactory.prototype.newColor(
                      col.getRed(), col.getGreen(),
                      col.getBlue(), geo.getLineOpacity()));
            }
            g2.draw(gp[i]);
          }
          g2.setPaint(color);
        }
      } catch (Exception e) {
        App.debug(e.getMessage());
      }
      if (labelVisible) {
        g2.setFont(view.getFontConic());
        g2.setPaint(geo.getLabelColor());
        drawLabel(g2);
      }

      // point
      if (algo.hasPoints()) {
        for (int i = 0; i < drawPoints.size(); i++) {
          drawPoints.get(i).draw(g2);
        }
      }
    }
  }