Esempio n. 1
0
  //////////////////////////
  ///// SET MARKERS ///////////
  private void initMarkers() {

    for (int i = 0; i < latList.size(); i++) {

      // theMarker = new GPSMarker(lo,lt);
      theMarker = new GPSMarker(longArray[i], latArray[i]);
      theMarker.computePosOnSphere(EARTH_RADIUS);
      GPSArray.add(theMarker);
      theMarker.doInitSpawn();
      /// add all data to user profile
      theMarker.theID = i;
    }
  }
Esempio n. 2
0
  public void setDestroyer() {
    // convert cur mouse pos to lat and long
    // map(value, low1, high1, low2, high2)

    if (doCursor == true) {
      // theLat = map(oscY1, 1, 0, 0, 90);
      // theLong = map(oscX1, 0, 1, -180, 180);

      /// change osc values to mouse-parsed
      float newOscY = map(oscY1, 0, 1, 0, screenHeight);
      float newOscX = map(oscX1, 0, 1, 0, screenWidth);

      desRot.interpolateToSelf(new Vec3D(newOscX * 0.51f, newOscY * 0.51f, 0), 0.25f / currZoom);
      theLat = desRot.y; // map(mouseY, 0, screenHeight, 0, 90);
      theLong = desRot.x; // map(mouseX, 0, screenWidth, -180, 180);

    } else {
      // theLat = map(mouseY, 600, 0, 0, 90);
      // theLong = map(mouseX, 200, 800, -180, 180);

    }
    if (!mousePressed && useKeyboard == true) {

      /// *
      desRot.interpolateToSelf(new Vec3D(mouseX * 0.51f, mouseY * 0.51f, 0), 0.25f / currZoom);
      theLat = desRot.y; // map(mouseY, 0, screenHeight, 0, 90);
      theLong = desRot.x; // map(mouseX, 0, screenWidth, -180, 180);
      // */

    }
    doCursor = false;

    /*
    * theCamX = camRot.x;
    theCamY = camRot.y;
    */

    //

    theDestroyer.setSpherePosition(theLong, theLat);
    theDestroyer.computePosOnSphere(EARTH_RADIUS);

    //// CHECK FOR INTERSECTION with other markers
    boolean isPopupVisible = false;
    for (int i = 0; i < GPSArray.size(); i++) {
      // for(int i=0; i<2; i++){

      /// DESTROYER LAT AND LONG
      float dlat = theDestroyer.theLat;
      float dlong = theDestroyer.theLong; // theDestroyer.theLat;

      //// MARKER LAT AND LONG
      float mlat = GPSArray.get(i).theLat;
      float mlong = GPSArray.get(i).theLong;
      // println("dlat " + dlat + " mlat: " + mlat);
      // println("dlong " + dlong + " mlong: " + mlong);
      //// check to see if the destroyer is within the range of the current lat and long
      /// if (dlat >= (mlat -1) && dlat <= (mlat + 1) &&  dlong <= (mlong + 1) && dlong >= (mlong -
      // 1)){

      //// CHECK INTERSECTION of MARKER AND DESTROYER
      GPSMarker tMark = GPSArray.get(i);
      if (isPopupVisible == false
          && theDestroyer.pos.y <= (tMark.pos.y + 10)
          && theDestroyer.pos.y >= (tMark.pos.y - 10)
          && theDestroyer.pos.x <= (tMark.pos.x + 10)
          && theDestroyer.pos.x >= (tMark.pos.x - 10)) {

        tMark.doHit();

        //// init popup data
        thePopUp.theName = "";
        thePopUp.theText = "";

        thePopUp.theHeader = headerList.get(tMark.theID);
        thePopUp.theName = nameList.get(tMark.theID);
        thePopUp.theText = blurbList.get(tMark.theID);
        // thePopUp.theVideoPath = videoPathList.get(tMark.theID);

        /// swtich video if it's different than the current
        if (curID != tMark.theID) {
          // println("Cur ID: " + curID + " new ID: " + tMark.theID);
          /// stop current, switch
          thePopUp.stopVideo();
          thePopUp.switchCurVideo(tMark.theID);
          curID = tMark.theID;
        }

        //// showing popup data
        thePopUp.drawPopup(tMark.theID);
        isPopupVisible = true;
      }
    }
  }