Package org.nlogo.api

Examples of org.nlogo.api.Link


          && (world.observer().targetAgent() == turtle);

      return !riding_agent && !turtle.hidden()
        && (turtle.alpha() > 0.0 || turtle.hasLabel());
    } else if (agent instanceof Link) {
      Link link = (Link) agent;
      return !link.hidden() && (link.alpha() > 0.0 || link.hasLabel());
    } else if (agent instanceof Patch3D) {
      // Patch3D supports the alpha variable, so check Patch3D
      // before checking the regular Patch.

      Patch3D patch = (Patch3D) agent;
View Full Code Here


  // detects which turtle(s) a pick-ray intersects with
  void pickLinks(List<Agent> agents, double[][] ray) {
    // detect any turtles in the pick-ray
    for (Agent a : world.links().agents()) {
      Link link = (Link) a;
      if (!link.hidden()) {
        double[] end1 = getTurtleCoords(link.end1(), 0);
        double[] end2 = getTurtleCoords(link.end2(), 0);

        double dist = Picker.distanceFromRayToSegment(ray, end1, end2);

        if (dist <= PICK_THRESHOLD) {
          agents.add(link);
View Full Code Here

  private void updateLinks(World world, DiffBuffer buf) {
    // turtles, on the other hand, can die, so we move each one to a new
    // map as we encounter it...
    Map<ClientWorld.LinkKey, LinkData> newLinks = new HashMap<ClientWorld.LinkKey, LinkData>();
    for (Agent a : world.links().agents()) {
      Link link = (Link) a;
      LinkData diffs = updateLink(link);
      if (diffs != null) {
        buf.addLink(diffs);
      }
      ClientWorld.LinkKey key =
          new ClientWorld.LinkKey(link.id(), link.end1().id(), link.end2().id(), link.getBreedIndex());
      LinkData tmp = links.remove(key);
      newLinks.put(key, tmp);
    }
    // now, any link left in the old map must have died...
    for (LinkData data : links.values()) {
View Full Code Here

      }
    }
    if (linksDrawn < world.links().count()) {
      // uh oh, we have some unbreeded turtles we need to go back and draw
      for (Agent a : world.links().agents()) {
        Link link = (Link) a;
        if (link.getBreed() == world.links()) {
          linkDrawer.drawLink(g, topology, link, patchSize, false);
        }
      }
    }
    if (outlineAgent instanceof Link) {
View Full Code Here

      spotlightSize = turtle.size() * 2;
      xcor = turtle.xcor();
      ycor = turtle.ycor();
      wrap = true;
    } else if (agent instanceof Link) {
      Link link = (Link) agent;
      spotlightSize = link.size();
      xcor = link.midpointX();
      ycor = link.midpointY();
    } else {
      Patch patch = (Patch) agent;
      spotlightSize = 2;
      xcor = patch.pxcor();
      ycor = patch.pycor();
View Full Code Here

TOP

Related Classes of org.nlogo.api.Link

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.