Examples of VectorShape


Examples of org.nlogo.shape.VectorShape

        lastList = gl.glGenLists(1);

        // locate new/changed shape in model library
        for (int j = 0; j < modelShapeList.size(); j++) {
          VectorShape vShape =
              (VectorShape) modelShapeList.get(j);
          if (vShape.getName().equals(req.data)) {
            // compile shape
            addModelShape(gl, glu, vShape, lastList);
            break;
          }
        }
View Full Code Here

Examples of org.nlogo.shape.VectorShape

      addLinkShape(gl, glu, (LinkShape) iter.next(), i);
    }
  }

  private void addLinkShape(GL gl, GLU glu, LinkShape shape, int index) {
    VectorShape vShape = (VectorShape) shape.getDirectionIndicator();
    GLLinkShape gShape =
      is3D
      ? new GLLinkShape3D(shape, new GLShape(vShape.getName(), index, vShape.isRotatable()))
      : new GLLinkShape  (shape, new GLShape(vShape.getName(), index, vShape.isRotatable()));
    linkShapes.put(shape.getName(), gShape);
    compileShape(gl, glu, vShape, index, vShape.isRotatable());
  }
View Full Code Here

Examples of org.nlogo.shape.VectorShape

    List<Shape> modelShapeList = turtleShapeList.getShapes();
    lastList = gl.glGenLists(modelShapeList.size());

    // compile each shape in the model
    for (int i = 0; i < modelShapeList.size(); i++) {
      VectorShape vShape =
          (VectorShape) modelShapeList.get(i);
      addModelShape(gl, glu, vShape, (lastList + i));
    }
  }
View Full Code Here

Examples of org.nlogo.shape.VectorShape

  /// Auxiliary Methods

  // Create turtle icon
  private ImageIcon getShapeIcon(double colorValue) {
    VectorShape defaultShape = org.nlogo.shape.VectorShape.getDefaultShape();
    BufferedImage image = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
    org.nlogo.api.Graphics2DWrapper g2 = new org.nlogo.api.Graphics2DWrapper(image.createGraphics());
    g2.antiAliasing(true);
    defaultShape.paint
        (g2,
            new Color(org.nlogo.api.Color.getARGBbyPremodulatedColorNumber(colorValue)),
            0, 0, 16, 0);
    g2.drawImage(image);
    return new ImageIcon(image);
View Full Code Here

Examples of org.nlogo.shape.VectorShape

  // Attempts to save the current shape being drawn, prompting the
  // user if any issues come up
  private void saveShape() {
    String name;
    int overwrite;
    VectorShape newShape;

    // Make sure the shape has a name
    if (nameText.getText().equals("")) {
      name =
          javax.swing.JOptionPane.showInputDialog
              (this, "Name:", "Name Shape", javax.swing.JOptionPane.PLAIN_MESSAGE);
      if (name == null) {
        return;
      }
    } else {
      name = nameText.getText();
    }

    name = name.toLowerCase();

    // If the user chose to quit, don't save
    if (name == null || name.equals("")) {
      return;
    }

    String originalName = originalShape.getName();
    // If this is an attempt to overwrite a shape, prompt for
    // permission to do it
    if (container.exists(name) && !name.equals(originalName)) {
      overwrite = javax.swing.JOptionPane.showConfirmDialog
          (this, "A shape with this name already exists. Do you want to replace it?",
              "Confirm Overwrite", javax.swing.JOptionPane.YES_NO_OPTION);
      if (overwrite != javax.swing.JOptionPane.YES_OPTION) {
        return;
      }
    }

    newShape = shape;
    newShape.setName(name);
    newShape.setRotatable(shapeRotatable);
    newShape.markRecolorableElements(getColor(shape.getEditableColorIndex()),
        shape.getEditableColorIndex());

    container.update(originalShape, newShape);
    dispose();
  }
View Full Code Here

Examples of org.nlogo.shape.VectorShape

    container.update(originalShape, newShape);
    dispose();
  }

  private VectorShape getCurrentShape() {
    VectorShape currentShape = (VectorShape) shape.clone();
    currentShape.setName(nameText.getText());
    currentShape.setRotatable(shapeRotatable);
    currentShape.markRecolorableElements(getColor(shape.getEditableColorIndex()),
        shape.getEditableColorIndex());
    return currentShape;
  }
View Full Code Here

Examples of org.nlogo.shape.VectorShape

                                          org.nlogo.api.Turtle turtle, double patchSize) {
    double turtleSize = turtle.size();
    double xcor = turtle.xcor();
    double ycor = turtle.ycor();

    VectorShape shape = shapes.getShape(turtle);
    VectorShape outline = (VectorShape) shape.clone();
    outline.setOutline();

    double thickness = StrictMath.min(turtleSize / 5, 0.5);

    java.awt.Color color = org.nlogo.api.Color.getColor(turtle.color());
    int heading = (int) turtle.heading();
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.