public ArrayList getPointList(long handId) {
   ArrayList curList;
   if (_pointLists.containsKey(handId)) curList = (ArrayList) _pointLists.get(handId);
   else {
     curList = new ArrayList(_maxPoints);
     _pointLists.put(handId, curList);
   }
   return curList;
 }
示例#2
0
 /**
  * Returns the necessary exports for the specified platform. If no 32 or 64-bit version of the
  * exports exists, it returns the version that doesn't specify bit depth.
  */
 public String[] getApplicationExportList(int platform, String variant) {
   String platformName = PConstants.platformNames[platform];
   if (variant.equals("32")) {
     String[] pieces = exportList.get(platformName + "32");
     if (pieces != null) return pieces;
   } else if (variant.equals("64")) {
     String[] pieces = exportList.get(platformName + "64");
     if (pieces != null) return pieces;
   } else if (variant.equals("armv6hf")) {
     String[] pieces = exportList.get(platformName + "-armv6hf");
     if (pieces != null) return pieces;
   }
   return exportList.get(platformName);
 }
    public void draw() {
      if (_pointLists.size() <= 0) return;

      pushStyle();
      noFill();

      PVector vec;
      PVector firstVec;
      PVector screenPos = new PVector();
      int colorIndex = 0;

      // draw the hand lists
      Iterator<Map.Entry> itrList = _pointLists.entrySet().iterator();
      while (itrList.hasNext()) {
        strokeWeight(2);
        stroke(_colorList[colorIndex % (_colorList.length - 1)]);

        ArrayList curList = (ArrayList) itrList.next().getValue();

        // draw line
        firstVec = null;
        Iterator<PVector> itr = curList.iterator();
        beginShape();
        while (itr.hasNext()) {
          vec = itr.next();
          if (firstVec == null) firstVec = vec;
          // calc the screen pos
          context.convertRealWorldToProjective(vec, screenPos);
          vertex(screenPos.x, screenPos.y);
        }
        endShape();

        // draw current pos of the hand
        if (firstVec != null) {
          strokeWeight(8);
          context.convertRealWorldToProjective(firstVec, screenPos);
          point(screenPos.x, screenPos.y);
        }
        colorIndex++;
      }

      popStyle();
    }
示例#4
0
 /**
  * List the fonts known to the PDF renderer. This is like PFont.list(), however not all those
  * fonts are available by default.
  */
 @SuppressWarnings("unchecked")
 public static String[] listFonts() {
   if (fontList == null) {
     HashMap<?, ?> map = getMapper().getAliases();
     //      Set entries = map.entrySet();
     //      fontList = new String[entries.size()];
     fontList = new String[map.size()];
     int count = 0;
     for (Object entry : map.entrySet()) {
       fontList[count++] = (String) ((Map.Entry) entry).getKey();
     }
     //      Iterator it = entries.iterator();
     //      int count = 0;
     //      while (it.hasNext()) {
     //        Map.Entry entry = (Map.Entry) it.next();
     //        //System.out.println(entry.getKey() + "-->" + entry.getValue());
     //        fontList[count++] = (String) entry.getKey();
     //      }
     fontList = PApplet.sort(fontList);
   }
   return fontList;
 }
    public void OnPointDestroy(long nID) {
      println("OnPointDestroy, handId: " + nID);

      // remove list
      if (_pointLists.containsKey(nID)) _pointLists.remove(nID);
    }
示例#6
0
  private Library(File folder, String groupName) {
    super(folder);
    this.group = groupName;

    libraryFolder = new File(folder, "library");
    examplesFolder = new File(folder, "examples");
    referenceFile = new File(folder, "reference/index.html");

    File exportSettings = new File(libraryFolder, "export.txt");
    StringDict exportTable =
        exportSettings.exists() ? Util.readSettings(exportSettings) : new StringDict();

    exportList = new HashMap<String, String[]>();

    // get the list of files just in the library root
    String[] baseList = libraryFolder.list(standardFilter);
    //    System.out.println("Loading " + name + "...");
    //    PApplet.println(baseList);

    String appletExportStr = exportTable.get("applet");
    if (appletExportStr != null) {
      appletExportList = PApplet.splitTokens(appletExportStr, ", ");
    } else {
      appletExportList = baseList;
    }

    String androidExportStr = exportTable.get("android");
    if (androidExportStr != null) {
      androidExportList = PApplet.splitTokens(androidExportStr, ", ");
    } else {
      androidExportList = baseList;
    }

    // for the host platform, need to figure out what's available
    File nativeLibraryFolder = libraryFolder;
    String hostPlatform = Platform.getName();
    //    System.out.println("1 native lib folder now " + nativeLibraryFolder);
    // see if there's a 'windows', 'macosx', or 'linux' folder
    File hostLibrary = new File(libraryFolder, hostPlatform);
    if (hostLibrary.exists()) {
      nativeLibraryFolder = hostLibrary;
    }
    //    System.out.println("2 native lib folder now " + nativeLibraryFolder);
    // check for bit-specific version, e.g. on windows, check if there
    // is a window32 or windows64 folder (on windows)
    hostLibrary = new File(libraryFolder, hostPlatform + Platform.getNativeBits());
    if (hostLibrary.exists()) {
      nativeLibraryFolder = hostLibrary;
    }
    //    System.out.println("3 native lib folder now " + nativeLibraryFolder);

    if (hostPlatform.equals("linux") && System.getProperty("os.arch").equals("arm")) {
      hostLibrary = new File(libraryFolder, "linux-armv6hf");
      if (hostLibrary.exists()) {
        nativeLibraryFolder = hostLibrary;
      }
    }

    // save that folder for later use
    nativeLibraryPath = nativeLibraryFolder.getAbsolutePath();

    // for each individual platform that this library supports, figure out what's around
    for (int i = 1; i < platformNames.length; i++) {
      String platformName = platformNames[i];
      String platformName32 = platformName + "32";
      String platformName64 = platformName + "64";
      String platformNameArmv6hh = platformName + "-armv6hf";

      // First check for things like 'application.macosx=' or 'application.windows32' in the
      // export.txt file.
      // These will override anything in the platform-specific subfolders.
      String platformAll = exportTable.get("application." + platformName);
      String[] platformList = platformAll == null ? null : PApplet.splitTokens(platformAll, ", ");
      String platform32 = exportTable.get("application." + platformName + "32");
      String[] platformList32 = platform32 == null ? null : PApplet.splitTokens(platform32, ", ");
      String platform64 = exportTable.get("application." + platformName + "64");
      String[] platformList64 = platform64 == null ? null : PApplet.splitTokens(platform64, ", ");
      String platformArmv6hf = exportTable.get("application." + platformName + "-armv6hf");
      String[] platformListArmv6hf =
          platformArmv6hf == null ? null : PApplet.splitTokens(platformArmv6hf, ", ");

      // If nothing specified in the export.txt entries, look for the platform-specific folders.
      if (platformAll == null) {
        platformList = listPlatformEntries(libraryFolder, platformName, baseList);
      }
      if (platform32 == null) {
        platformList32 = listPlatformEntries(libraryFolder, platformName32, baseList);
      }
      if (platform64 == null) {
        platformList64 = listPlatformEntries(libraryFolder, platformName64, baseList);
      }
      if (platformListArmv6hf == null) {
        platformListArmv6hf = listPlatformEntries(libraryFolder, platformNameArmv6hh, baseList);
      }

      if (platformList32 != null || platformList64 != null || platformListArmv6hf != null) {
        multipleArch[i] = true;
      }

      // if there aren't any relevant imports specified or in their own folders,
      // then use the baseList (root of the library folder) as the default.
      if (platformList == null
          && platformList32 == null
          && platformList64 == null
          && platformListArmv6hf == null) {
        exportList.put(platformName, baseList);

      } else {
        // once we've figured out which side our bread is buttered on, save it.
        // (also concatenate the list of files in the root folder as well
        if (platformList != null) {
          exportList.put(platformName, platformList);
        }
        if (platformList32 != null) {
          exportList.put(platformName32, platformList32);
        }
        if (platformList64 != null) {
          exportList.put(platformName64, platformList64);
        }
        if (platformListArmv6hf != null) {
          exportList.put(platformNameArmv6hh, platformListArmv6hf);
        }
      }
    }
    //    for (String p : exportList.keySet()) {
    //      System.out.println(p + " -> ");
    //      PApplet.println(exportList.get(p));
    //    }

    // get the path for all .jar files in this code folder
    packageList = Util.packageListFromClassPath(getClassPath());
  }
示例#7
0
 /*
 	Returns the Sensor with the specified ID
 */
 public Sensor getSensor(String ID) {
   return mappedSensors.get(ID);
 }
示例#8
0
 /*
 	Register a sensor inside this robot, with the given ID
 */
 protected void registerSensor(Sensor sensor, String ID) {
   mappedSensors.put(ID, sensor);
   sensors.add(sensor);
 }