@SuppressWarnings("rawtypes") public void createText( final CoverageTable c, final TextTable texttable, final Vector textvec, final float latitude, final float longitude, final String text, final String featureType) { counter++; // get the colour final java.awt.Color res = getColor(featureType); // set the colour _myCanvas.setColor(res); // find the screen location _workingLocation.setLat(latitude); _workingLocation.setLong(longitude); final java.awt.Point pt = _myCanvas.toScreen(_workingLocation); // and plot it _myCanvas.drawText(text, pt.x, pt.y); }
@SuppressWarnings("rawtypes") public void createText( final CoverageTable c, final TextTable texttable, final Vector textvec, final float latitude, final float longitude, final String text) { // is the current painter interested in text? if (_drawText != null) { final boolean res = _drawText.booleanValue(); if (!res) return; } else { // hey the client hasn't set a preference, so lets just paint anyway } // set the colour _myCanvas.setColor(getColor(null)); // find the screen location _workingLocation.setLat(latitude); _workingLocation.setLong(longitude); counter++; // convert to screen coordinates final java.awt.Point pt = _myCanvas.toScreen(_workingLocation); // and plot it _myCanvas.drawText(text, pt.x, pt.y); }
/** * Edge painter. In this implementation we build the edges up into a polygon which we then plot - * this works much more quickly and is an option because we get the edges in the correctly tiled * order. * * @param c parameter for createEdge * @param edgevec parameter for createEdge * @param ll2 parameter for createEdge * @param dpplon parameter for createEdge * @param coords list of coordinates which make up this edge * @param featureType the type for this feature */ @SuppressWarnings("rawtypes") public void createEdge( final CoverageTable c, final EdgeTable edgetable, final Vector edgevec, final LatLonPoint ll1, final LatLonPoint ll2, final float dpplat, final float dpplon, final CoordFloatString coords, final String featureType) { // get this feature painter final FeaturePainter fp = _currentFeatures.get(featureType); // is this feature currently visible? if (!fp.getVisible()) return; // is this line currently visible? if (!isVisible(ll1, ll2, coords)) return; // get the colour final java.awt.Color res = fp.getColor(); if (res == null) { System.out.println(" not painting!"); return; } // set the colour _myCanvas.setColor(res); // now plot the polygon final int len = coords.maxIndex(); final int[] points = new int[len * 2]; counter++; try { for (int i = 0; i < len; i++) { final float x = coords.getXasFloat(i); final float y = coords.getYasFloat(i); _workingLocation.setLat(y); _workingLocation.setLong(x); final java.awt.Point pt = _myCanvas.toScreen(_workingLocation); points[i * 2] = pt.x; points[i * 2 + 1] = pt.y; } // finally plot the polygon _myCanvas.drawPolyline(points); } catch (final Exception E) { E.printStackTrace(); } }
/** * edge plotter for when we're not plotting by features this is really only used for coastlines - * which aren't tiled. We can't build up the coastline into a single large polyline, since it * jumps around a little! */ @SuppressWarnings("rawtypes") public void createEdge( final CoverageTable c, final EdgeTable edgetable, final Vector edgevec, final LatLonPoint ll1, final LatLonPoint ll2, final float dpplat, final float dpplon, final CoordFloatString coords) { // is the current painter interested in text? if (_drawLines != null) { final boolean res = _drawLines.booleanValue(); if (!res) return; } else { // hey the client hasn't set a preference, so lets just paint anyway } // is this line currently visible? if (!isVisible(ll1, ll2, coords)) return; // get the colour final java.awt.Color res = getColor(null); // set the colour _myCanvas.setColor(res); // now plot the polygon final int len = coords.maxIndex(); java.awt.Point _lastPoint = null; // create working location try { for (int i = 0; i < len; i++) { final float x = coords.getXasFloat(i); final float y = coords.getYasFloat(i); _workingLocation.setLat(y); _workingLocation.setLong(x); final java.awt.Point pt = _myCanvas.toScreen(_workingLocation); // xpoints[i] = pt.x; // ypoints[i] = pt.y; if (_lastPoint != null) { _myCanvas.drawLine(_lastPoint.x, _lastPoint.y, pt.x, pt.y); } _lastPoint = new java.awt.Point(pt); } // finally plot the polygon // _myCanvas.drawPolygon(xpoints, ypoints, len); } catch (final Exception E) { E.printStackTrace(); } }