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(); } }
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; } }
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); } } }
public static void main(String[] args) { int a = ROW * PREFERRED_GRID_SIZE_PIXELS; int b = ROW * PREFERRED_GRID_SIZE_PIXELS; BuildArray(); SquareGrid test = new SquareGrid(); JFrame f = new JFrame(); f.setTitle("ObjectVis"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(test); // setPreferredSize(new Dimension(80, 50)); f.setSize(a, 800); // f.setSize(f.MAXIMIZED_HORIZ, f.MAXIMIZED_VERT); Dimension d = f.getMaximumSize(); // int m=f.MAXIMIZED_BOTH; // f.setMaximumSize(d); // f.setLocation(100,100); f.setVisible(true); f.setJMenuBar(test.addMenu()); test.addComponentListener(test.cl); f.setJMenuBar(test.addMenu()); }