Package com.eteks.sweethome3d.model

Examples of com.eteks.sweethome3d.model.Compass$GeographicPoint


      }
      if (foundRoom != null
          && stopAtFirstItem) {
        return Arrays.asList(new Selectable [] {foundRoom});
      } else {
        Compass compass = this.home.getCompass();
        if ((!basePlanLocked
              || !isItemPartOfBasePlan(compass))
            && compass.containsPoint(x, y, textMargin)) {
          items.add(compass);
        }
        return items;
      }
    }
View Full Code Here


  private Compass getRotatedCompassAt(float x, float y) {
    List<Selectable> selectedItems = this.home.getSelectedItems();
    if (selectedItems.size() == 1
        && selectedItems.get(0) instanceof Compass
        && isItemMovable(selectedItems.get(0))) {
      Compass compass = (Compass)selectedItems.get(0);
      float margin = PIXEL_MARGIN / getScale();
      float [][] compassPoints = compass.getPoints();
      // Check if (x,y) matches the point between the third and the fourth points (South point)
      // of the rectangle surrounding compass
      float xMiddleThirdAndFourthPoint = (compassPoints [2][0] + compassPoints [3][0]) / 2;
      float yMiddleThirdAndFourthPoint = (compassPoints [2][1] + compassPoints [3][1]) / 2;     
      if (Math.abs(x - xMiddleThirdAndFourthPoint) <= margin
View Full Code Here

  private Compass getResizedCompassAt(float x, float y) {
    List<Selectable> selectedItems = this.home.getSelectedItems();
    if (selectedItems.size() == 1
        && selectedItems.get(0) instanceof Compass
        && isItemMovable(selectedItems.get(0))) {
      Compass compass = (Compass)selectedItems.get(0);
      float margin = PIXEL_MARGIN / getScale();
      float [][] compassPoints = compass.getPoints();
      // Check if (x,y) matches the point between the second and the third points (East point)
      // of the rectangle surrounding compass
      float xMiddleSecondAndThirdPoint = (compassPoints [1][0] + compassPoints [2][0]) / 2;
      float yMiddleSecondAndThirdPoint = (compassPoints [1][1] + compassPoints [2][1]) / 2;     
      if (Math.abs(x - xMiddleSecondAndThirdPoint) <= margin
View Full Code Here

* @author Emmanuel Puybaret
*/
public class PhotoCreationTest extends TestCase {
  public void testSunLocation() {
    // Tests azimuth and elevation values computed in Compass to avoid any regression
    Compass compass = new Compass(0, 0, 2);
    compass.setLatitude((float)Math.toRadians(45));
    compass.setLongitude((float)Math.toRadians(0));
    compass.setTimeZone("Europe/Paris");
    GregorianCalendar calendar = new GregorianCalendar(2010, GregorianCalendar.SEPTEMBER, 1, 14, 30, 10);
    calendar.setTimeZone(TimeZone.getTimeZone(compass.getTimeZone()));
    TestUtilities.assertEqualsWithinEpsilon("Incorrect azimuth", 3.383972f, compass.getSunAzimuth(calendar.getTimeInMillis()), 1E-5f);
    TestUtilities.assertEqualsWithinEpsilon("Incorrect elevation", 0.915943f, compass.getSunElevation(calendar.getTimeInMillis()), 1E-5f);
   
    compass = new Compass(0, 0, 2);
    compass.setLatitude((float)Math.toRadians(40));
    compass.setLongitude((float)Math.toRadians(160));
    compass.setTimeZone("Asia/Tokyo");
    calendar = new GregorianCalendar(2011, GregorianCalendar.JANUARY, 31, 8, 0, 0);
    calendar.setTimeZone(TimeZone.getTimeZone(compass.getTimeZone()));
    TestUtilities.assertEqualsWithinEpsilon("Incorrect azimuth", 2.44565f, compass.getSunAzimuth(calendar.getTimeInMillis()), 1E-5f);
    TestUtilities.assertEqualsWithinEpsilon("Incorrect elevation", 0.38735f, compass.getSunElevation(calendar.getTimeInMillis()), 1E-5f);
  }
View Full Code Here

      }
    }
    homeItems.addAll(this.home.getRooms());
    homeItems.addAll(this.home.getDimensionLines());
    homeItems.addAll(this.home.getLabels());
    Compass compass = this.home.getCompass();
    if (compass.isVisible()) {
      homeItems.add(compass);
    }
    return homeItems;
  }
View Full Code Here

      itemBounds.add(xLabel - labelBounds.getWidth() / 2,
          yLabel - labelFontMetrics.getAscent());
      itemBounds.add(xLabel + labelBounds.getWidth() / 2,
          yLabel + labelFontMetrics.getDescent());
    } else if (item instanceof Compass) {
      Compass compass = (Compass)item;
      AffineTransform transform = AffineTransform.getTranslateInstance(compass.getX(), compass.getY());
      transform.scale(compass.getDiameter(), compass.getDiameter());
      transform.rotate(compass.getNorthDirection());
      return COMPASS.createTransformedShape(transform).getBounds2D();
    }
    return itemBounds;
  }
View Full Code Here

  /**
   * Paints the compass.
   */
  private void paintCompass(Graphics2D g2D, List<Selectable> selectedItems, float planScale,
                            Color foregroundColor, PaintMode paintMode) {
    Compass compass = this.home.getCompass();
    if (compass.isVisible()
        && (paintMode != PaintMode.CLIPBOARD
            || selectedItems.contains(compass))) {
      AffineTransform previousTransform = g2D.getTransform();
      g2D.translate(compass.getX(), compass.getY());
      g2D.rotate(compass.getNorthDirection());
      float diameter = compass.getDiameter();
      g2D.scale(diameter, diameter);
      g2D.setColor(foregroundColor);
      g2D.fill(COMPASS);
      g2D.setTransform(previousTransform);
    }
View Full Code Here

   * Paints the outline of the compass when it's belongs to <code>items</code>.
   */
  private void paintCompassOutline(Graphics2D g2D, List<Selectable> items,
                                   Paint selectionOutlinePaint, Stroke selectionOutlineStroke,
                                   Paint indicatorPaint, float planScale, Color foregroundColor) {
    Compass compass = this.home.getCompass();
    if (items.contains(compass)
        && compass.isVisible()) {
      AffineTransform previousTransform = g2D.getTransform();
      g2D.translate(compass.getX(), compass.getY());
      g2D.rotate(compass.getNorthDirection());
      float diameter = compass.getDiameter();
      g2D.scale(diameter, diameter);
 
      g2D.setPaint(selectionOutlinePaint);
      g2D.setStroke(new BasicStroke((5.5f + planScale) / diameter / planScale));
      g2D.draw(COMPASS_DISC);
View Full Code Here

  /**
   * Updates compass properties edited by this controller.
   */
  protected void updateProperties() {
    Compass compass = this.home.getCompass();
    setX(compass.getX());
    setY(compass.getY());
    setDiameter(compass.getDiameter());
    setVisible(compass.isVisible());
    setNorthDirectionInDegrees((float)Math.toDegrees(compass.getNorthDirection()));
    setLatitudeInDegrees((float)Math.toDegrees(compass.getLatitude()));
    setLongitudeInDegrees((float)Math.toDegrees(compass.getLongitude()));
    setTimeZone(compass.getTimeZone());
 
View Full Code Here

TOP

Related Classes of com.eteks.sweethome3d.model.Compass$GeographicPoint

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.