Package ch.bfh.ti.kybernetik.engine.model

Examples of ch.bfh.ti.kybernetik.engine.model.LightSensor


    return roboterMotorDistance;
  }

  private JSlider getRoboterLightSensorAngles() {
    if (roboterLightSensorAngles == null) {
      final LightSensor leftLightSensor = roboterComponent.getModelObject().getLeftLightSensor();
      final LightSensor rightLightSensor = roboterComponent.getModelObject().getRightLightSensor();
      roboterLightSensorAngles = new JSlider(JSlider.HORIZONTAL, 0, 180, (int) rightLightSensor.getElementAngle());
      initJSlider(roboterLightSensorAngles);
      roboterLightSensorAngles.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
          JSlider source = (JSlider) e.getSource();
          int value = source.getValue();
          leftLightSensor.setElementAngle(-value);
          rightLightSensor.setElementAngle(value);
        }
      });
    }
    return roboterLightSensorAngles;
  }
View Full Code Here


    return roboterLightSensorAngles;
  }

  private JSlider getRoboterLightSensorViewField() {
    if (roboterLightSensorViewField == null) {
      final LightSensor leftLightSensor = roboterComponent.getModelObject().getLeftLightSensor();
      final LightSensor rightLightSensor = roboterComponent.getModelObject().getRightLightSensor();
      roboterLightSensorViewField = new JSlider(JSlider.HORIZONTAL, 1, 180, (int) rightLightSensor.getViewFieldSize());
      initJSlider(roboterLightSensorViewField);
      roboterLightSensorViewField.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
          JSlider source = (JSlider) e.getSource();
          int value = source.getValue();
          leftLightSensor.setViewFieldSize(value);
          rightLightSensor.setViewFieldSize(value);
        }
      });
    }
    return roboterLightSensorViewField;
  }
View Full Code Here

    return roboterLightSensorViewField;
  }

  private JSlider getRoboterLightSensorDistance() {
    if (roboterLightSensorDistance == null) {
      final LightSensor leftLightSensor = roboterComponent.getModelObject().getLeftLightSensor();
      final LightSensor rightLightSensor = roboterComponent.getModelObject().getRightLightSensor();
      roboterLightSensorDistance = new JSlider(JSlider.HORIZONTAL, 1, 180, (int) rightLightSensor.getDistanceX());
      initJSlider(roboterLightSensorDistance);
      roboterLightSensorDistance.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
          JSlider source = (JSlider) e.getSource();
          int value = source.getValue();
          leftLightSensor.setDistanceX(-value);
          rightLightSensor.setDistanceX(value);
        }
      });
    }
    return roboterLightSensorDistance;
  }
View Full Code Here

  }

  private JTextField getRoboterMaxLightSensorInputField() {
    if (roboterMaxLightSensor == null) {
      roboterMaxLightSensor = new JTextField(100);
      final LightSensor leftLightSensor = roboterComponent.getModelObject().getLeftLightSensor();
      final LightSensor rightLightSensor = roboterComponent.getModelObject().getRightLightSensor();
      roboterMaxLightSensor.setText(String.valueOf(leftLightSensor.getMaxLightIntensity()));
      roboterMaxLightSensor.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          int value = Integer.valueOf(roboterMaxLightSensor.getText());
          leftLightSensor.setMaxLightIntensity(value);
          rightLightSensor.setMaxLightIntensity(value);

        }
      });
    }
    return roboterMaxLightSensor;
View Full Code Here

    Circle c = SlickRenderUtils.getCircle(roboter.getX(), roboter.getY(), 20);
    return c.contains((float) point.getX(), (float) point.getY());
  }

  private void renderCurrentRoboter(Graphics g) {
    LightSensor leftLightSensor = roboter.getLeftLightSensor();
    LightSensor rightLightSensor = roboter.getRightLightSensor();
    Vector2d directionVector = roboter.getDirection();
    if (renderRoboter) {
      g.setColor(color);
      SlickRenderUtils.fillCircle(g, roboter.getX(), roboter.getY(), 3);
      if (selected) {
View Full Code Here

TOP

Related Classes of ch.bfh.ti.kybernetik.engine.model.LightSensor

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.