📄 e00layer.java
字号:
if (gui != null) { label.setText(E00File.getName()); } } /** * Description of the Method * * @param type Description of Parameter * @return Description of the Returned Value * @since */ protected File chooseFile(int type) { Frame frame = getFrame(); File f = null; if (fileChooser == null) fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(E00File); if (type == 0) fileChooser.setDialogType(JFileChooser.OPEN_DIALOG); else fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); int retval = fileChooser.showDialog(frame, null); if (retval == JFileChooser.APPROVE_OPTION) f = fileChooser.getSelectedFile(); return f; } /** * Description of the Method * * @since */ protected void filtre() { System.out.print("E00: filter type=" + filtreType + " value=" + filtreValeur); OMGraphic og; Object O; int count = 0; OMGraphicList g = arcs; int n = arcs.size(); if ((filtreType == Integer.MIN_VALUE) && (filtreValeur == Integer.MIN_VALUE)) { for (int i = 0; i < n; i++) g.getOMGraphicAt(i).setVisible(true); count = n; } else for (int i = 0; i < n; i++) { og = g.getOMGraphicAt(i); O = og.getAppObject(); if (O == null) setVisible(false); else { E00Data d = (E00Data) O; boolean r = true; if (filtreType != Integer.MIN_VALUE) r &= (filtreType == d.type); if (filtreValeur != Integer.MIN_VALUE) r &= (filtreValeur == d.valeur); og.setVisible(r); if (r) count++; } } Debug.output(" count:" + count); repaint(); } /** * Description of the Method * * @since */ protected void exportArcs() { if (arcs == null) return; Vector V = new Vector(); int n = arcs.size(); float ll[]; int llsize; double lnmax = Double.MIN_VALUE; double lnmin = Double.MAX_VALUE; double ltmin = lnmin; double ltmax = lnmax; double lt; double ln; for (int i = 0; i < n; i++) { OMPoly oj = (OMPoly) arcs.getOMGraphicAt(i); if (oj == null) continue; E00Data data = (E00Data) oj.getAppObject(); if (data == null) continue; ll = oj.getLatLonArray(); llsize = ll.length; if ((ll[0] != ll[llsize - 2]) || (ll[1] != ll[llsize - 1])) { // contour non clos; float[] coords = new float[] { ll[0], ll[1], ll[llsize - 2], ll[llsize - 1] }; ArcData dn = new ArcData(data); dn.coords = coords; oj.setAppObject(dn); V.add(dn); } int k = 0; while (k < llsize) { lt = ll[k++]; ln = ll[k++]; if (lt > ltmax) ltmax = lt; else if (lt < ltmin) ltmin = lt; if (ln > lnmax) lnmax = ln; else if (ln < lnmin) lnmin = ln; } } System.out.println("#minmax " + lnmin + " " + lnmax + " " + ltmin + " " + ltmax); int unClosedCount = V.size(); ArcData[] unClosed = (ArcData[]) V.toArray(new ArcData[unClosedCount]); V.clear(); V = null; //chercher les connections; ArcData d0; //chercher les connections; ArcData d1; //chercher les connections; ArcData d2; //chercher les connections; ArcData dx; float lt1; float lg1; float lt2; float lg2; for (int i = 0; i < unClosedCount; i++) { d0 = unClosed[i]; d0.deja = 0; if (d0.type > 1) continue; lt1 = d0.coords[0]; lg1 = d0.coords[1]; lt2 = d0.coords[2]; lg2 = d0.coords[3]; for (int j = i + 1; j < unClosedCount; j++) { d1 = unClosed[j]; if (d1.type > 1) continue; if ((lt1 == d1.coords[0]) && (lg1 == d1.coords[1])) { d1.setC(d0); d0.setC(d1); } else if ((lt1 == d1.coords[2]) && (lg1 == d1.coords[3])) { d1.setF(d0); d0.setC(d1); } if ((lt2 == d1.coords[0]) && (lg2 == d1.coords[1])) { d1.setC(d0); d0.setF(d1); } else if ((lt2 == d1.coords[2]) && (lg2 == d1.coords[3])) { d1.setF(d0); d0.setF(d1); } } } for (int k = 0; k < unClosedCount; k++) { d0 = unClosed[k]; if ((d0.type != 0) || (d0.deja != 0)) continue; if ((d0.c0 == null) && (d0.f0 == null)) continue; d1 = d0; d2 = (d1.c0 == null) ? d1.f0 : d1.c0; System.out.print("#contour "); System.out.print(d0.id); System.out.print(' '); int decount = unClosedCount * 3 / 2; do { System.out.print(d2.id); if (d2.deja != 0) System.out.print('*'); System.out.print(' '); dx = d2.visit(d1); d1 = d2; d2 = dx; if (decount-- < 0) { System.out.print(" BOUCLE "); break; } } while ((d2 != null) && (d2 != d0)); if (d2 == null) System.out.print(" unclosed"); System.out.println(); System.out.println(); } for (int i = 0; i < n; i++) { OMPoly oj = (OMPoly) arcs.getOMGraphicAt(i); if (oj == null) continue; E00Data data = (E00Data) oj.getAppObject(); if (data == null) continue; ll = oj.getLatLonArray(); llsize = ll.length; double z = data.valeur * 0.304;// double z2 = data.valeur2 * 0.304; boolean closed = true;// float[] coords = null; if (data instanceof ArcData) { ArcData dn = (ArcData) data;// coords = dn.coords; dn.coords = null; closed = false; } int k = 0; System.out.println("#type " + data.type); while (k < llsize) { lt = ll[k++]; ln = ll[k++]; System.out.println("c " + ln + " " + lt + " " + z); } System.out.println((closed) ? "#LC" : "#LX"); System.out.println(); } } /** * Description of the Method * * @since */ protected void exportArcs1() { PrintStream out = null; double lt; double ln; float ll[]; int llsize; int n; File f = chooseFile(1); if (arcs == null) return; if (f == null) return; try { out = new PrintStream(new FileOutputStream(f)); } catch (IOException e) { System.out.println(e); return; } n = arcs.size(); for (int i = 0; i < n; i++) { OMPoly oj = (OMPoly) arcs.getOMGraphicAt(i); if (oj == null) continue; if (!oj.isSelected()) continue; ll = oj.getLatLonArray(); llsize = ll.length; out.println(oj.getLinePaint()); if ((ll[0] != ll[llsize - 2]) || (ll[1] != ll[llsize - 1])) out.print("MetaPolyline: "); else { llsize -= 2; out.print("MetaPolyline: "); } out.print(llsize / 2); Object o = oj.getAppObject(); if (o != null && o instanceof String) System.out.println(o); else out.println(); int k = 0; while (k < llsize) { lt = ll[k++]; ln = ll[k++]; out.println(ln + " " + lt); } } out.close(); } /** * Description of the Method * * @since */ protected void exportPoints() { if (labs == null) return; //OMGraphic oj ; BasicLocation oj; double lt; double ln; double z; int n = labs.size(); System.out.println("#type 0"); for (int i = 0; i < n; i++) { oj = (BasicLocation) labs.getOMGraphicAt(i); if (oj == null) continue; E00Data data = (E00Data) oj.getAppObject(); if (data == null) continue; lt = oj.lat / 180 * Math.PI; ln = oj.lon / 180 * Math.PI; z = data.valeur * 0.304; System.out.println("c " + ln + " " + lt + " " + z); } } /** * Description of the Method * * @param props Description of Parameter * @param prefix Description of Parameter * @param prop Description of Parameter * @param dfault Description of Parameter * @return Description of the Returned Value * @since */ protected Paint parseColor(Properties props, String prefix, String prop, Paint dfault) { try { return PropUtils.parseColorFromProperties(props, prefix + "." + prop, dfault); } catch (NumberFormatException exc) { System.out.println("Color Error " + prefix + "." + prop); } return dfault; } /** * Description of the Method * * @param props Description of Parameter * @param prefix Description of Parameter * @param prop Description of Parameter * @param err Description of Parameter * @return Description of the Returned Value * @since */ protected Paint[] parseColors(Properties props, String prefix, String prop, Paint err) { Paint[] colors = null; String[] colorStrings = PropUtils.stringArrayFromProperties(props, prefix + "." + prop, " ,"); if (colorStrings != null) { colors = new Color[colorStrings.length]; for (int i = 0; i < colorStrings.length; i++) try { colors[i] = PropUtils.parseColor(colorStrings[i]); } catch (NumberFormatException exc) { System.out.println("Colors Error " + prefix + "." + prop + " " + i); colors[i] = err; } } return colors; } /** * Description of the Method * * @param props Description of Parameter * @param prefix Description of Parameter * @param prop Description of Parameter * @param dfault Description of Parameter * @return Description of the Returned Value * @since */ protected Font parseFont(Properties props, String prefix, String prop, Font dfault) { String[] fontItems = PropUtils.stringArrayFromProperties(props, prefix + "." + prop, " ,"); int style = 0; int size = 10; if (fontItems == null || fontItems.length == 0) return dfault; try { size = Integer.parseInt(fontItems[1]); } catch (Exception e) { } for (int i = 2; i < fontItems.length; i++) { String S = fontItems[i]; if ("BOLD".equals(S)) style |= Font.BOLD; else if ("ITALIC".equals(S)) style |= Font.ITALIC; else if ("PLAIN".equals(S)) style |= Font.PLAIN; } return new Font(fontItems[0], style, size); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -