Examples of Camera


Examples of com.eclipsesource.tabris.camera.Camera

    camera.addCameraListener( null );
  }

  @Test( expected = IllegalArgumentException.class )
  public void testRemoveFailsWithNullListener() {
    Camera camera = new CameraImpl();

    camera.removeCameraListener( null );
  }
View Full Code Here

Examples of com.eclipsesource.tabris.camera.Camera

  @Test
  public void testHasCameraService() {
    TabrisClient client = new TabrisClientImpl();

    Camera camera = client.getService( Camera.class );

    assertNotNull( camera );
  }
View Full Code Here

Examples of com.eclipsesource.tabris.camera.Camera

  @Test
  public void testCameraIsSingleton() {
    TabrisClient client = new TabrisClientImpl();

    Camera camera = client.getService( Camera.class );
    Camera camera2 = client.getService( Camera.class );

    assertSame( camera, camera2 );
  }
View Full Code Here

Examples of com.eclipsesource.tabris.camera.Camera

  }

  @Test
  public void testSendsOpenWithTakePhotoCall() {
    RemoteObject remoteObject = environment.getServiceObject();
    Camera camera = new CameraImpl();
    CameraListener listener = mock( CameraListener.class );
    camera.addCameraListener( listener );

    camera.takePicture( createOptions() );

    ArgumentCaptor<JsonObject> captor = ArgumentCaptor.forClass( JsonObject.class );
    verify( remoteObject ).call( eq( "open" ), captor.capture() );
    JsonArray resolution = captor.getValue().get( "resolution" ).asArray();
    assertEquals( 100, resolution.get( 0 ).asInt() );
View Full Code Here

Examples of com.eteks.sweethome3d.model.Camera

          float cameraCircleRadius = 7 / getScale();
          Ellipse2D ellipse = new Ellipse2D.Float(-cameraCircleRadius, -cameraCircleRadius,
              2 * cameraCircleRadius, 2 * cameraCircleRadius);
          List<Camera> cameraPath = controller.getCameraPath();
          for (int i = 0; i < cameraPath.size(); i++) {
            Camera camera = cameraPath.get(i);
            AffineTransform previousTransform = g2D.getTransform();
            g2D.translate(camera.getX(), camera.getY());
            g2D.rotate(camera.getYaw());
            // Paint camera location
            g2D.fill(ellipse);
            // Paint field of sight angle
            double sin = (float)Math.sin(camera.getFieldOfView() / 2);
            double cos = (float)Math.cos(camera.getFieldOfView() / 2);
            float xStartAngle = (float)(1.2f * cameraCircleRadius * sin);
            float yStartAngle = (float)(1.2f * cameraCircleRadius * cos);
            float xEndAngle = (float)(2.5f * cameraCircleRadius * sin);
            float yEndAngle = (float)(2.5f * cameraCircleRadius * cos);
            GeneralPath cameraFieldOfViewAngle = new GeneralPath();
            g2D.setStroke(new BasicStroke(1 / getScale()));
            cameraFieldOfViewAngle.moveTo(xStartAngle, yStartAngle);
            cameraFieldOfViewAngle.lineTo(xEndAngle, yEndAngle);
            cameraFieldOfViewAngle.moveTo(-xStartAngle, yStartAngle);
            cameraFieldOfViewAngle.lineTo(-xEndAngle, yEndAngle);
            g2D.draw(cameraFieldOfViewAngle);
            g2D.setTransform(previousTransform);
           
            if (i > 0) {
              g2D.setStroke(new BasicStroke(2 / getScale()));
              g2D.draw(new Line2D.Float(camera.getX(), camera.getY(),
                  cameraPath.get(i - 1).getX(), cameraPath.get(i - 1).getY()));
            }
          }
          g2D.setComposite(oldComposite);
        }
View Full Code Here

Examples of com.eteks.sweethome3d.model.Camera

  /**
   * Records the location and the angles of the current camera.
   */
  private void recordCameraLocation() {
    List<Camera> cameraPath = this.controller.getCameraPath();
    Camera camera = this.home.getCamera();   
    Camera lastCamera = null;   
    if (cameraPath.size() > 0) {
      lastCamera = cameraPath.get(cameraPath.size() - 1);
    }
    if (lastCamera == null     
        || !compareCameraLocation(lastCamera, camera)) {
      // Record only new locations
      cameraPath = new ArrayList<Camera>(cameraPath);
      Camera recordedCamera = camera.clone();
      recordedCamera.setLens(Camera.Lens.NORMAL);
      recordedCamera.setTime(this.controller.getTime());
      cameraPath.add(recordedCamera);
      this.controller.setCameraPath(cameraPath);
    }
  }
View Full Code Here

Examples of com.eteks.sweethome3d.model.Camera

    final ActionMap actionMap = getActionMap();
    boolean playable = cameraPath.size() > 1;
    if (playable) {
      Camera [] videoFramesPath = getVideoFramesPath(12);
      // Find current camera location
      Camera homeCamera = home.getCamera();
      int index = videoFramesPath.length;
      while (--index > 0
          && !compareCameraLocation(videoFramesPath [index], homeCamera)) {       
      }
      // Prefer last location
      if (index < 0 || index == videoFramesPath.length - 1) {
        index = videoFramesPath.length;
      }
      this.cameraPathIterator = Arrays.asList(videoFramesPath).listIterator(index);
      ActionListener playbackAction = new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            if ("backward".equals(ev.getActionCommand())) {
              if (cameraPathIterator.hasPrevious()) {
                Camera camera = cameraPathIterator.previous();
                home.getCamera().setCamera(camera);
                controller.setTime(camera.getTime());
              } else {
                pausePlayback();
              }
            } else {
              if (cameraPathIterator.hasNext()) {
                Camera camera = cameraPathIterator.next();
                home.getCamera().setCamera(camera);
                controller.setTime(camera.getTime());
              } else {
                pausePlayback();
              }
            }
            boolean pathEditable = videoCreationExecutor == null && !((Timer)ev.getSource()).isRunning();
View Full Code Here

Examples of com.eteks.sweethome3d.model.Camera

    final float moveDistancePerFrame = 240000f / 3600 / frameRate;  // 3 cm/frame = 1800 m / 3600 s / 25 frame/s = 2.4 km/h
    final float moveAnglePerFrame = (float)(Math.PI / 180 * 30 / frameRate);
    final float elapsedTimePerFrame = 345600 / frameRate * 25; // 250 frame/day at 25 frame/second
   
    List<Camera> cameraPath = this.controller.getCameraPath();
    Camera camera = cameraPath.get(0);
    float x = camera.getX();
    float y = camera.getY();
    float z = camera.getZ();
    float yaw = camera.getYaw();
    float pitch = camera.getPitch();
    float fieldOfView = camera.getFieldOfView();
    long  time = camera.getTime();
    videoFramesPath.add(camera.clone());
   
    for (int i = 1; i < cameraPath.size(); i++) {
      camera = cameraPath.get(i);                 
      float newX = camera.getX();
      float newY = camera.getY();
      float newZ = camera.getZ();
      float newYaw = camera.getYaw();
      float newPitch = camera.getPitch();
      float newFieldOfView = camera.getFieldOfView();
      long  newTime = camera.getTime();
     
      float distance = new Point3f(x, y, z).distance(new Point3f(newX, newY, newZ));
      float moveCount = distance / moveDistancePerFrame;
      float yawAngleCount = Math.abs(newYaw - yaw) / moveAnglePerFrame;
      float pitchAngleCount = Math.abs(newPitch - pitch) / moveAnglePerFrame;
      float fieldOfViewAngleCount = Math.abs(newFieldOfView - fieldOfView) / moveAnglePerFrame;
      float timeCount = Math.abs(newTime - time) / elapsedTimePerFrame;

      int frameCount = (int)Math.max(moveCount, Math.max(yawAngleCount,
          Math.max(pitchAngleCount, Math.max(fieldOfViewAngleCount, timeCount))));
     
      float deltaX = (newX - x) / frameCount;
      float deltaY = (newY - y) / frameCount;
      float deltaZ = (newZ - z) / frameCount;
      float deltaYawAngle = (newYaw - yaw) / frameCount;
      float deltaPitchAngle = (newPitch - pitch) / frameCount;
      float deltaFieldOfViewAngle = (newFieldOfView - fieldOfView) / frameCount;
      long deltaTime = Math.round(((double)newTime - time) / frameCount);
     
      for (int j = 1; j <= frameCount; j++) {
        videoFramesPath.add(new Camera(
            x + deltaX * j, y + deltaY * j, z + deltaZ * j,
            yaw + deltaYawAngle * j, pitch + deltaPitchAngle * j,
            fieldOfView + deltaFieldOfViewAngle * j,
            time + deltaTime * j,
            Camera.Lens.NORMAL));
View Full Code Here

Examples of com.eteks.sweethome3d.model.Camera

   
    transform.setIdentity();
    transform.setTranslation(new Vector3f(cameraX, cameraZ, cameraY));
    transform.mul(yawRotation);
   
    this.camera = new Camera(cameraX, cameraY, cameraZ, cameraYaw, cameraPitch, 0);
  }
View Full Code Here

Examples of com.eteks.sweethome3d.model.Camera

          || this.finalCamera.getYaw() != finalCamera.getYaw()
          || this.finalCamera.getPitch() != finalCamera.getPitch()) {
        synchronized (this) {
          Alpha alpha = getAlpha();
          if (alpha == null || alpha.finished()) {
            this.initialCamera = new Camera(camera.getX(), camera.getY(), camera.getZ(),
                camera.getYaw(), camera.getPitch(), camera.getFieldOfView());
          } else if (alpha.value() < 0.3) {
            Transform3D finalTransformation = new Transform3D();
            // Jump directly to final location
            updateViewPlatformTransform(finalTransformation, this.finalCamera.getX(), this.finalCamera.getY(), this.finalCamera.getZ(),
                this.finalCamera.getYaw(), this.finalCamera.getPitch());
            getTarget().setTransform(finalTransformation);
            this.initialCamera = this.finalCamera;
          } else {
            // Compute initial location from current alpha value
            this.initialCamera = new Camera(this.initialCamera.getX() + (this.finalCamera.getX() - this.initialCamera.getX()) * alpha.value(),
                this.initialCamera.getY() + (this.finalCamera.getY() - this.initialCamera.getY()) * alpha.value(),
                this.initialCamera.getZ() + (this.finalCamera.getZ() - this.initialCamera.getZ()) * alpha.value(),
                this.initialCamera.getYaw() + (this.finalCamera.getYaw() - this.initialCamera.getYaw()) * alpha.value(),
                this.initialCamera.getPitch() + (this.finalCamera.getPitch() - this.initialCamera.getPitch()) * alpha.value(),
                finalCamera.getFieldOfView());
          }
          this.finalCamera = new Camera(finalCamera.getX(), finalCamera.getY(), finalCamera.getZ(),
              finalCamera.getYaw(), finalCamera.getPitch(), finalCamera.getFieldOfView());
         
          // Create an animation that will interpolate camera location
          // between initial camera and final camera in 150 ms
          if (alpha == null) {
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.