コード例 #1
0
    public void selectRenderables(DrawContext dc, Sector vs) {
      // Select our renderables
      if (this.gridElements == null) createRenderables();

      int gridStep = (int) this.size / 10;
      boolean drawMetricLabels = getSizeInPixels(dc) > MIN_CELL_SIZE_PIXELS * 4 * 1.7;
      String graticuleType = getTypeFor(gridStep);

      for (GridElement ge : this.gridElements) {
        if (ge.isInView(dc, vs)) {
          if (drawMetricLabels)
            metricScaleSupport.computeMetricScaleExtremes(
                this.UTMZone, this.hemisphere, ge, this.size);

          addRenderable(ge.renderable, graticuleType);
        }
      }

      if (getSizeInPixels(dc) <= MIN_CELL_SIZE_PIXELS * 4 * 2) return;

      // Select sub grids renderables
      if (this.subGrids == null) createSubGrids();
      for (SquareGrid sg : this.subGrids) {
        if (sg.isInView(dc)) {
          sg.selectRenderables(dc, vs);
        } else sg.clearRenderables();
      }
    }
コード例 #2
0
 public void clearRenderables() {
   if (this.gridElements != null) {
     this.gridElements.clear();
     this.gridElements = null;
   }
   if (this.subGrids != null) {
     for (SquareGrid sg : this.subGrids) {
       sg.clearRenderables();
     }
     this.subGrids.clear();
     this.subGrids = null;
   }
 }
コード例 #3
0
 public void createSubGrids() {
   this.subGrids = new ArrayList<SquareGrid>();
   double gridStep = this.size / 10;
   for (int i = 0; i < 10; i++) {
     double easting = this.SWEasting + gridStep * i;
     for (int j = 0; j < 10; j++) {
       double northing = this.SWNorthing + gridStep * j;
       SquareGrid sg =
           new SquareGrid(
               this.UTMZone, this.hemisphere, this.UTMZoneSector, easting, northing, gridStep);
       if (!sg.isOutsideGridZone()) this.subGrids.add(sg);
     }
   }
 }