📄 graphicwarehousesupport.java
字号:
// + ((pts == null) ? -1 : pts.length) // + "; Pts2: " // + ((pts_tcm == null) ? -1 : pts_tcm.length)); // } if (pts == null) { /* Completely eliminated poly */ // System.out.println("eliminated poly!"); // System.out.println("\tLL1: " + ll1); // System.out.println("\tLL2: " + ll2); // System.out.println("\tdpplat: " + dpplat); // System.out.println("\tdpplon: " + dpplon); // System.out.println("\tcoords: " + coords); return null; } SPoly py = new SPoly(pts, LineType.LT_Straight); return py; } /** * Clip raw lon/lats to the screen. * * @return LLPoint[] */ public LLPoint[] clipToScreen(CoordFloatString cfs, float north, float south, float east, float west, float dpplat, float dpplon) { LLPoint pts[] = new LLPoint[cfs.maxIndex()]; int lpcount = 0, outcount = 0, elimscale = 0; float cfslls[] = cfs.vals; int cfstupsize = cfs.tsize; for (int i = 0; i < pts.length; i++) { float lllon = cfslls[cfstupsize * i]; float lllat = cfslls[cfstupsize * i + 1]; if ((lllat < south) || (lllat > north) || ((west < east) && ((lllon < west) || (lllon > east))) || ((west > east) && (lllon < west) && (lllon > east))) { outcount++; if (((lpcount > 1) && (outcount > 2)) || ((lpcount == 1) && (outcount > 1))) { pts[lpcount] = new LLPoint(lllat, lllon); //overwrite // previous continue; } } else { outcount = 0; } if ((lpcount > 0) && (i != (pts.length - 1)) && (java.lang.Math.abs(pts[lpcount - 1].lat - lllat) < dpplat) && (java.lang.Math.abs(pts[lpcount - 1].lon - lllon) < dpplon)) { elimscale++; continue; } pts[lpcount++] = new LLPoint(lllat, lllon); } //only 1 point in poly, and it was out of bounds... if ((lpcount == 1) && (outcount > 0)) lpcount = 0; if (lpcount != cfs.maxIndex()) { LLPoint newpts[] = new LLPoint[lpcount]; System.arraycopy(pts, 0, newpts, 0, lpcount); pts = newpts; //System.out.println("Old(" + cfs.maxIndex() + // ")-area(" + elimarea+")-scale(" + elimscale + // ") = new(" + pts.length + ")"); } if (pts.length == 0) { return null; } return pts; } /** * */ public LLPoint[] clipToScreen_tcm(CoordFloatString cfs, float north, float south, float east, float west, float dpplat, float dpplon) { if (west > east) { } if ((west < east) && com.bbn.openmap.MoreMath.approximately_equal(east, west, 0.001f)) { float tmp = west; west = east; east = tmp; } LLPoint pts[] = new LLPoint[cfs.maxIndex()]; int lpcount = 0, outcount = 0, elimscale = 0; float cfslls[] = cfs.vals; int cfstupsize = cfs.tsize; for (int i = 0; i < pts.length; i++) { float lllon = cfslls[cfstupsize * i]; float lllat = cfslls[cfstupsize * i + 1]; if ((lllat < south) || (lllat > north) || ((west < east) && ((lllon < west) || (lllon > east))) || ((west > east) && (lllon < west) && (lllon > east))) { outcount++; if (((lpcount > 1) && (outcount > 2)) || ((lpcount == 1) && (outcount > 1))) { pts[lpcount] = new LLPoint(lllat, lllon); //overwrite // previous continue; } } else { outcount = 0; } if ((lpcount > 0) && (i != (pts.length - 1)) && (java.lang.Math.abs(pts[lpcount - 1].lat - lllat) < dpplat) && (java.lang.Math.abs(pts[lpcount - 1].lon - lllon) < dpplon)) { elimscale++; continue; } pts[lpcount++] = new LLPoint(lllat, lllon); } //only 1 point in poly, and it was out of bounds... if ((lpcount == 1) && (outcount > 0)) lpcount = 0; if (lpcount != cfs.maxIndex()) { LLPoint newpts[] = new LLPoint[lpcount]; System.arraycopy(pts, 0, newpts, 0, lpcount); pts = newpts; //System.out.println("Old(" + cfs.maxIndex() + // ")-area(" + elimarea+")-scale(" + elimscale + // ") = new(" + pts.length + ")"); } if (pts.length == 0) { return null; } return pts; } protected static SColor textColors[] = { new SColor((short) (244 * 255), (short) (164 * 255), (short) (96 * 255)), new SColor((short) (210 * 255), (short) (180 * 255), (short) (140 * 255)), new SColor((short) (210 * 255), (short) (105 * 255), (short) (30 * 255)), new SColor((short) (188 * 255), (short) (143 * 255), (short) (143 * 255)), new SColor((short) (205 * 255), (short) (92 * 255), (short) (92 * 255)), new SColor((short) (178 * 255), (short) (34 * 255), (short) (34 * 255)) }; /** * */ public SText createTextSText(String text, float latitude, float longitude) { SText py = new SText(); py.rType(RenderType.RT_LatLon); py.data(text); py.ll1(new LLPoint(latitude, longitude)); return py; } // public void drawTile(GraphicList spec, float dpplat, float // dpplon, // LatLonPoint ll1, LatLonPoint ll2, int[] hack) { // SColor colors[] = new SColor[6]; // colors[0] = new // SColor((short)(244*255),(short)(164*255),(short)(96*255)); // colors[1] = new // SColor((short)(210*255),(short)(180*255),(short)(140*255)); // colors[2] = new // SColor((short)(210*255),(short)(105*255),(short)(30*255)); // colors[3] = new // SColor((short)(188*255),(short)(143*255),(short)(143*255)); // colors[4] = new // SColor((short)(205*255),(short)(92*255),(short)(92*255)); // colors[5] = new // SColor((short)(178*255),(short)(34*255),(short)(34*255)); // float ll1lat = ll1.getLatitude(); // float ll1lon = ll1.getLongitude(); // float ll2lat = ll2.getLatitude(); // float ll2lon = ll2.getLongitude(); // Vector v; // try { // while ((v = parseRow()) != null) { // System.out.println("tt1"); // TCMDBG // String textval = (String)(v.elementAt(textColumn)); // MutableInt texttype = new MutableInt(-1); // String desc = covtable.getTextDescription(v, texttype); // CoordFloatString coords = // (CoordFloatString)(v.elementAt(coordColumn)); // LLPoint pts = new LLPoint(coords.getYasFloat(0), // coords.getXasFloat(0)); // if ((pts.lat < ll2lat) || (pts.lat > ll1lat) || // (pts.lon < ll1lon) || (pts.lon > ll2lon)) { // continue; // } // hack[0] = hack[0] + 1; // hack[1] = hack[1] + coords.maxIndex(); // SText py = new SText(); // py.rType(RenderType.RT_LatLon); // py.data(textval); // py.ll1(pts); // py.object(new LineComp(desc)); // if (texttype.value < 0) { // py.color(colors[5]); // } else { // py.color(colors[texttype.value%5]); // } // if (spec != null) { // spec.addSGraphic(py); // } // } // } catch (FormatException f) { // System.out.println("Exception: " + f.getClass() + " " + // f.getMessage()); // } // } public UGraphic[] packGraphics() { return graphics.packGraphics(); } Comp[] getComps() { return graphics.getComps(); } private static SColor cmap[] = null; public static SColor ns(java.awt.Color color) { int r = color.getRed(); int g = color.getGreen(); int b = color.getBlue(); return ns(r, g, b); } private static SColor ns(int r, int g, int b) { return new SColor((short) (r * 256), (short) (g * 256), (short) (b * 256)); } public static SColor getSColor(int place) { if (cmap == null) { cmap = new SColor[8]; //cmap[0] = ns(255, 0,0); //cmap[1] = ns(0, 255, 0); // cmap[2] = ns(0, 0, 255); cmap[0] = ns(205, 192, 176); cmap[1] = ns(255, 192, 203); cmap[2] = ns(221, 160, 221); cmap[3] = ns(162, 205, 90); cmap[4] = ns(255, 218, 185); cmap[5] = ns(255, 160, 122); cmap[6] = ns(205, 201, 165); cmap[7] = ns(216, 191, 216); // cmap[8] = ns(255, 165, 0); // cmap[9] = ns( 0, 255, 0); // cmap[10] = ns( 0, 255, 255); } return (cmap[place % cmap.length]); } /** * Return true if we may draw some entity node(point) features. */ public boolean drawEPointFeatures() { return false; } /** * Return true if we may draw some connected node(point) features. */ public boolean drawCPointFeatures() { return false; } /** * Get a List of Strings listing all the feature types wanted. * Returned with the area features first, then text features, then * line features, then point features. */ public List getFeatures() { return new ArrayList(); } /** * Set which library to use. If null, all applicable libraries in * database will be searched. */ private String useLibrary = null; /** * Set the VPF library to use. If null, all libraries will be * searched. Null is default. */ public void setUseLibrary(String lib) { useLibrary = lib; } /** * Get a library name to limit selections from. Used by the * LibrarySelectionTable to find out if selection from database * should be limitied to tiles or feature from certain libraries. * Specified here instead of the LibrarySelectionTable in case the * LST is shared among layers, since the warehouse is specific to * a particular layer. */ public String getUseLibrary() { return useLibrary; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -