コード例 #1
0
  protected Tile[] buildTiles(PlaceNameService placeNameService, NavigationTile navTile) {
    final Angle dLat = placeNameService.getTileDelta().getLatitude();
    final Angle dLon = placeNameService.getTileDelta().getLongitude();

    // Determine the row and column offset from the global tiling origin for the southwest tile
    // corner
    int firstRow = Tile.computeRow(dLat, navTile.navSector.getMinLatitude());
    int firstCol = Tile.computeColumn(dLon, navTile.navSector.getMinLongitude());
    int lastRow = Tile.computeRow(dLat, navTile.navSector.getMaxLatitude().subtract(dLat));
    int lastCol = Tile.computeColumn(dLon, navTile.navSector.getMaxLongitude().subtract(dLon));

    int nLatTiles = lastRow - firstRow + 1;
    int nLonTiles = lastCol - firstCol + 1;

    Tile[] tiles = new Tile[nLatTiles * nLonTiles];

    Angle p1 = Tile.computeRowLatitude(firstRow, dLat);
    for (int row = 0; row <= lastRow - firstRow; row++) {
      Angle p2;
      p2 = p1.add(dLat);

      Angle t1 = Tile.computeColumnLongitude(firstCol, dLon);
      for (int col = 0; col <= lastCol - firstCol; col++) {
        Angle t2;
        t2 = t1.add(dLon);
        // Need offset row and column to correspond to total ro/col numbering
        tiles[col + row * nLonTiles] =
            new Tile(placeNameService, new Sector(p1, p2, t1, t2), row + firstRow, col + firstCol);
        t1 = t2;
      }
      p1 = p2;
    }

    return tiles;
  }
コード例 #2
0
  public void rotate(Angle angle) {
    if (this.view == null) {
      return;
    }

    Angle heading = view.getHeading();
    Angle newHeading = heading.add(angle);
    this.view.setHeading(newHeading);
    this.view.firePropertyChange(AVKey.VIEW, null, this.view);
  }
コード例 #3
0
  private static MeshTile[] createTiles(LevelSet levelSet, int levelNumber, MeshCoords coords) {
    Sector sector = levelSet.getSector();
    Level level = levelSet.getLevel(levelNumber);
    Angle dLat = level.getTileDelta().getLatitude();
    Angle dLon = level.getTileDelta().getLongitude();
    Angle latOrigin = levelSet.getTileOrigin().getLatitude();
    Angle lonOrigin = levelSet.getTileOrigin().getLongitude();

    // Determine the row and column offset from the common World Wind global tiling origin.
    int firstRow = Tile.computeRow(dLat, sector.getMinLatitude(), latOrigin);
    int firstCol = Tile.computeColumn(dLon, sector.getMinLongitude(), lonOrigin);
    int lastRow = Tile.computeRow(dLat, sector.getMaxLatitude(), latOrigin);
    int lastCol = Tile.computeColumn(dLon, sector.getMaxLongitude(), lonOrigin);

    int numLatTiles = lastRow - firstRow + 1;
    int numLonTiles = lastCol - firstCol + 1;

    AffineTransform sectorTransform = createTransform(sector, coords);

    MeshTile[] tiles = new MeshTile[numLatTiles * numLonTiles];
    int index = 0;

    Angle p1 = Tile.computeRowLatitude(firstRow, dLat, latOrigin);

    for (int row = firstRow; row <= lastRow; row++) {
      Angle p2 = p1.add(dLat);

      Angle t1 = Tile.computeColumnLongitude(firstCol, dLon, lonOrigin);

      for (int col = firstCol; col <= lastCol; col++) {
        Angle t2 = t1.add(dLon);

        Sector tileSector = new Sector(p1, p2, t1, t2);
        MeshCoords tileCoords = transformSector(sectorTransform, tileSector);
        tiles[index++] = new MeshTile(tileSector, level, row, col, tileCoords);

        t1 = t2;
      }
      p1 = p2;
    }

    return tiles;
  }
コード例 #4
0
ファイル: SearchArea.java プロジェクト: metsci/worldwind
  protected List<Position> computePathPositions(
      Position startPosition, Position endPosition, Angle delta) {
    Angle dist = LatLon.greatCircleDistance(startPosition, endPosition);
    dist = dist.multiply(0.6);

    Angle azimuth = LatLon.greatCircleAzimuth(startPosition, endPosition);

    LatLon locA = LatLon.greatCircleEndPosition(startPosition, azimuth.add(delta), dist);

    dist = dist.multiply(0.9);
    LatLon locB = LatLon.greatCircleEndPosition(startPosition, azimuth.subtract(delta), dist);

    return Arrays.asList(startPosition, new Position(locA, 0), new Position(locB, 0), endPosition);
  }
コード例 #5
0
  public void tilt(Angle tilt) {
    if (this.view == null) {
      return;
    }

    Angle pitch = view.getPitch();
    Angle newPitch = pitch.add(tilt);

    if (newPitch.degrees < 0 || newPitch.degrees > 90) {
      return;
    }

    this.view.setPitch(newPitch);
    this.view.firePropertyChange(AVKey.VIEW, null, this.view);
  }
  private void createTopLevelTiles() {
    MercatorSector sector = (MercatorSector) this.levels.getSector();

    Level level = levels.getFirstLevel();
    Angle dLat = level.getTileDelta().getLatitude();
    Angle dLon = level.getTileDelta().getLongitude();

    Angle latOrigin = this.levels.getTileOrigin().getLatitude();
    Angle lonOrigin = this.levels.getTileOrigin().getLongitude();

    // Determine the row and column offset from the common World Wind global tiling origin.
    int firstRow = Tile.computeRow(dLat, sector.getMinLatitude(), latOrigin);
    int firstCol = Tile.computeColumn(dLon, sector.getMinLongitude(), lonOrigin);
    int lastRow = Tile.computeRow(dLat, sector.getMaxLatitude(), latOrigin);
    int lastCol = Tile.computeColumn(dLon, sector.getMaxLongitude(), lonOrigin);

    int nLatTiles = lastRow - firstRow + 1;
    int nLonTiles = lastCol - firstCol + 1;

    this.topLevels = new ArrayList<MercatorTextureTile>(nLatTiles * nLonTiles);

    // Angle p1 = Tile.computeRowLatitude(firstRow, dLat);
    double deltaLat = dLat.degrees / 90;
    double d1 = -1.0 + deltaLat * firstRow;
    for (int row = firstRow; row <= lastRow; row++) {
      // Angle p2;
      // p2 = p1.add(dLat);
      double d2 = d1 + deltaLat;

      Angle t1 = Tile.computeColumnLongitude(firstCol, dLon, lonOrigin);
      for (int col = firstCol; col <= lastCol; col++) {
        Angle t2;
        t2 = t1.add(dLon);

        this.topLevels.add(
            new MercatorTextureTile(new MercatorSector(d1, d2, t1, t2), level, row, col));
        t1 = t2;
      }
      d1 = d2;
    }
  }
コード例 #7
0
 protected Angle computeSafeRadius(DrawContext dc, SurfaceTileDrawContext sdc) {
   double regionPixelSize = this.computeDrawPixelSize(dc, sdc);
   Angle sectorRadius = this.computeSectorRadius(sdc.getSector());
   Angle iconRadius = this.computeIconRadius(dc, regionPixelSize, sdc.getSector());
   return sectorRadius.add(iconRadius);
 }