Revision: 5716
          http://sourceforge.net/p/jump-pilot/code/5716
Author:   ma15569
Date:     2018-03-22 14:03:21 +0000 (Thu, 22 Mar 2018)
Log Message:
-----------
improved dxf export

Modified Paths:
--------------
    core/trunk/src/it/betastudio/adbtoolbox/libs/DxfExport.java
    
core/trunk/src/org/openjump/sextante/gui/additionalResults/AdditionalResultsFrame.java

Modified: core/trunk/src/it/betastudio/adbtoolbox/libs/DxfExport.java
===================================================================
--- core/trunk/src/it/betastudio/adbtoolbox/libs/DxfExport.java 2018-03-15 
06:22:35 UTC (rev 5715)
+++ core/trunk/src/it/betastudio/adbtoolbox/libs/DxfExport.java 2018-03-22 
14:03:21 UTC (rev 5716)
@@ -3,9 +3,9 @@
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
+
 import javax.swing.JOptionPane;
 
-
 /**
  *
  * @author Beta Studio
@@ -12,13 +12,13 @@
  */
 public class DxfExport {
 
-    public DxfExport(){
+    public DxfExport() {
 
         dxfOut = new String();
 
     }
 
-    public void writeHeader(double minX, double minY, double maxX, double 
maxY){
+    public void writeHeader(double minX, double minY, double maxX, double 
maxY) {
 
         dxfOut = "0";
         appString("SECTION");
@@ -45,7 +45,7 @@
         appString(maxY);
         appString(30);
         appString(0);
-        
+
         appString(9);
         appString("$LIMMIN");
         appString(10);
@@ -58,16 +58,16 @@
         appString(maxX);
         appString(20);
         appString(maxY);
-//        appString(9);
-//        appString("$CLAYER");
-//        appString(8);
-//        appString(layerName);
+        // appString(9);
+        // appString("$CLAYER");
+        // appString(8);
+        // appString(layerName);
         appString(0);
         appString("ENDSEC");
 
     }
 
-    public void writeStartSec(){
+    public void writeStartSec() {
 
         appString(0);
         appString("SECTION");
@@ -74,7 +74,7 @@
 
     }
 
-    public void writeEndSec(){
+    public void writeEndSec() {
 
         appString(0);
         appString("ENDSEC");
@@ -81,29 +81,29 @@
 
     }
 
-    public void writeTablesStart(){
-        
+    public void writeTablesStart() {
+
         appString(2);
-        appString("TABLES");        
-    
+        appString("TABLES");
+
     }
-    
-    public void writeTableStart(){
-    
+
+    public void writeTableStart() {
+
         appString(0);
-        appString("TABLE");       
-        
+        appString("TABLE");
+
     }
 
-    public void writeTableEnd(){
-        
+    public void writeTableEnd() {
+
         appString(0);
-        appString("ENDTAB");      
-    
+        appString("ENDTAB");
+
     }
-    
-    public void writeLayersStart(){
 
+    public void writeLayersStart() {
+
         appString(2);
         appString("LAYER");
         appString(70);
@@ -111,7 +111,7 @@
 
     }
 
-    public void writeLayer(String layName, int colourNr){
+    public void writeLayer(String layName, int colourNr) {
 
         appString(0);
         appString("LAYER");
@@ -125,9 +125,10 @@
         appString("CONTINUOUS");
 
     }
-    
-    public void writeVPort(double centerX, double centerY, double minX, double 
minY, double maxX, double maxY){
 
+    public void writeVPort(double centerX, double centerY, double minX,
+            double minY, double maxX, double maxY) {
+
         appString(2);
         appString("VPORT");
         appString(5);
@@ -215,16 +216,16 @@
         appString(78);
         appString(0);
 
-    }    
+    }
 
-    public void writeEntStart(){
-        
+    public void writeEntStart() {
+
         appString(2);
         appString("ENTITIES");
 
     }
 
-    public void writeAppId(){
+    public void writeAppId() {
 
         appString(2);
         appString("APPID");
@@ -246,7 +247,7 @@
         appString("ACAD");
         appString(70);
         appString(0);
-        
+
     }
 
     public void writeEnding() {
@@ -259,7 +260,8 @@
 
     }
 
-    public void writeLine(String layName, double p1x, double p1y, double p2x, 
double p2y){
+    public void writeLine(String layName, double p1x, double p1y, double p2x,
+            double p2y) {
 
         appString("0");
         appString("LINE");
@@ -276,30 +278,59 @@
 
     }
 
-    public void writePolyline(String layName, double[][] vertices){
+    /**
+     * @param layName
+     * @param lineType
+     *            ( DASHED - DOTTED -DOTTINY etc)
+     * @param p1x
+     * @param p1y
+     * @param p2x
+     * @param p2y
+     */
+    public void writeLineType(String layName, String lineType, double p1x,
+            double p1y, double p2x, double p2y) {
 
+        appString("0");
+        appString("LINE");
+        appString(8);
+        appString(layName);
+        appString(6);
+        appString(lineType);
+        appString("10");
+        appString(p1x);
+        appString("20");
+        appString(p1y);
+        appString("11");
+        appString(p2x);
+        appString("21");
+        appString(p2y);
+
+    }
+
+    public void writePolyline(String layName, double[][] vertices) {
+
         appString(0);
         appString("POLYLINE");
         appString(8);
         appString(layName);
         appString(62);
-        appString(1);
+        appString(5);
         appString(66);
         appString(1);
 
-        for(int v=0; v<vertices.length; v++){
+        for (final double[] vertice : vertices) {
             appString(0);
             appString("VERTEX");
             appString(8);
             appString(layName);
-            appString(10);  // X value
-            appString(vertices[v][0]);
-            appString(20);  // Y value
-            appString(vertices[v][1]);
-//            appString(30);  // Z value
-//            appString(vertices[v][2]);
-            appString(70);  // Vertex flag
-            appString(4);  // Vertex flags:
+            appString(10); // X value
+            appString(vertice[0]);
+            appString(20); // Y value
+            appString(vertice[1]);
+            // appString(30); // Z value
+            // appString(vertices[v][2]);
+            appString(70); // Vertex flag
+            appString(4); // Vertex flags:
         }
 
         appString("0");
@@ -307,37 +338,72 @@
 
     }
 
-    public void writeLwPolyLine(double[][] vertices){
+    public void writePolyline(String layName, String lineType,
+            double[][] vertices, int colourNr) {
 
+        appString(0);
+        appString("POLYLINE");
+        appString(8);
+        appString(layName);
+        appString(lineType);
+        appString(62);
+        appString(colourNr);
+        // appString(1);
+        appString(66);
+        appString(1);
 
+        for (final double[] vertice : vertices) {
+            appString(0);
+            appString("VERTEX");
+            appString(8);
+            appString(layName);
+            appString(10); // X value
+            appString(vertice[0]);
+            appString(20); // Y value
+            appString(vertice[1]);
+            // appString(30); // Z value
+            // appString(vertices[v][2]);
+            appString(70); // Vertex flag
+            appString(4); // Vertex flags:
+        }
 
+        appString("0");
+        appString("SEQEND");
+
     }
 
-    public void writeText(String layName, double alignPoint1x, double 
alignPoint1y, double alignPoint1z, double alignPoint2x, double alignPoint2y, 
double alignPoint2z, int textHight, double textRotation, int horizJust, int 
vertAlign, String text){
+    public void writeLwPolyLine(double[][] vertices) {
 
+    }
+
+    public void writeText(String layName, double alignPoint1x,
+            double alignPoint1y, double alignPoint1z, double alignPoint2x,
+            double alignPoint2y, double alignPoint2z, int textHight,
+            double textRotation, int horizJust, int vertAlign, String text) {
+
         appString(0);
         appString("TEXT");
         appString(8);
         appString(layName);
-        appString(10);            // Alignment point x
+        appString(10); // Alignment point x
         appString(alignPoint1x);
-        appString(20);            // Alignment point y
+        appString(20); // Alignment point y
         appString(alignPoint1y);
-        appString(30);            // Alignment point z
+        appString(30); // Alignment point z
         appString(alignPoint1z);
-        appString(40);            // Text hight
+        appString(40); // Text hight
         appString(textHight);
-        appString(50);            // Text rotation
+        appString(50); // Text rotation
         appString(textRotation);
-        appString(1);             // Text
+        appString(1); // Text
         appString(text);
 
-        if(horizJust != 0 || vertAlign != 0){
-            appString(11);            // Alignment point x
+        if (horizJust != 0 || vertAlign != 0) {
+            appString(11); // Alignment point x
             appString(alignPoint2x);
-            appString(21);            // Alignment point y
+            appString(21); // Alignment point y
             appString(alignPoint2y);
-            appString(31);            // Alignment point z
+            appString(31); // Alignment point z
             appString(alignPoint2z);
             appString(72);
             appString(horizJust);
@@ -348,27 +414,30 @@
 
     }
 
-    private void appString(String appEnd){
+    private void appString(String appEnd) {
         dxfOut = dxfOut + lineFeed + appEnd;
     }
 
-    private void appString(int appEnd){
+    private void appString(int appEnd) {
         dxfOut = dxfOut + lineFeed + Integer.toString(appEnd);
     }
 
-    private void appString(double appEnd){
+    private void appString(double appEnd) {
         dxfOut = dxfOut + lineFeed + Double.toString(appEnd);
     }
 
-    public int exportDxf(String dxfFullFileName){
+    public int exportDxf(String dxfFullFileName) {
 
-        try{
-            BufferedWriter buffWrite = new BufferedWriter(new FileWriter(new 
File(dxfFullFileName)));
+        try {
+            final BufferedWriter buffWrite = new BufferedWriter(new FileWriter(
+                    new File(dxfFullFileName)));
             buffWrite.write(dxfOut, 0, dxfOut.length());
             buffWrite.close();
             return 0;
-        }catch(Exception ex){
-            JOptionPane.showMessageDialog(null, "Errore durante la scrittura 
del DXF: " + ex, "Errore", JOptionPane.ERROR_MESSAGE);
+        } catch (final Exception ex) {
+            JOptionPane.showMessageDialog(null,
+                    "Errore durante la scrittura del DXF: " + ex, "Errore",
+                    JOptionPane.ERROR_MESSAGE);
             return 1;
         }
 
@@ -375,6 +444,6 @@
     }
 
     private String dxfOut = null;
-    private String lineFeed = System.getProperty("line.separator");
+    private final String lineFeed = System.getProperty("line.separator");
 
 }

Modified: 
core/trunk/src/org/openjump/sextante/gui/additionalResults/AdditionalResultsFrame.java
===================================================================
--- 
core/trunk/src/org/openjump/sextante/gui/additionalResults/AdditionalResultsFrame.java
      2018-03-15 06:22:35 UTC (rev 5715)
+++ 
core/trunk/src/org/openjump/sextante/gui/additionalResults/AdditionalResultsFrame.java
      2018-03-22 14:03:21 UTC (rev 5716)
@@ -6,6 +6,7 @@
 import java.awt.Component;
 import java.awt.Cursor;
 import java.awt.Dimension;
+import java.awt.FlowLayout;
 import java.awt.Graphics2D;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -23,9 +24,12 @@
 import java.util.Locale;
 
 import javax.imageio.ImageIO;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
 import javax.swing.JButton;
+import javax.swing.JCheckBox;
 import javax.swing.JDialog;
 import javax.swing.JFileChooser;
 import javax.swing.JLabel;
@@ -65,10 +69,6 @@
 import com.vividsolutions.jump.workbench.ui.GUIUtil;
 import com.vividsolutions.jump.workbench.ui.HTMLPanel;
 
-import de.fho.jump.pirol.utilities.settings.PirolPlugInSettings;
-//-da rimuovere
-//import com.vividsolutions.jump.workbench.ui.OKCancelApplyPanel;
-
 public class AdditionalResultsFrame extends DetachableInternalFrame {
 
     /**
@@ -109,6 +109,10 @@
             .get("deejump.plugin.SaveLegendPlugIn.Save");
     private final String CLOSE = I18N
             .get("ui.plugin.imagery.ImageLayerManagerDialog.Close");
+    public final static String HEIGHT = I18N
+            .get("org.openjump.core.ui.plugin.raster.ProfileGraphTool.values");
+    public final static String WIDTH = I18N
+            
.get("org.openjump.core.ui.plugin.raster.ProfileGraphTool.2d-distance");
 
     private static final long serialVersionUID = 1L;
     private JSplitPane jSplitPane;
@@ -278,21 +282,6 @@
             });
             popupMenu.add(menuItemRename);
 
-            // ---Da rimuovere
-            // okCancelApplyPanel.addActionListener(new ActionListener() {
-            // @Override
-            // public void actionPerformed(final ActionEvent evt) {
-
-            // try {
-            // dispose();
-            // } catch (final Exception e) {
-            // }
-            //
-            // }
-            // });
-            // okCancelApplyPanel.setApplyVisible(false);
-            // okCancelApplyPanel.setCancelVisible(false);
-            // okCancelApplyPanel.setOKEnabled(true);
             panel.updateUI();
             return true;
         } catch (final Exception e) {
@@ -405,8 +394,7 @@
                     } else {
                         filter = new FileNameExtensionFilter("SHP", "shp");
                     }
-                    final JFileChooser fc = new JFileChooser(
-                            PirolPlugInSettings.configDirectory());
+                    final JFileChooser fc = new 
GUIUtil.FileChooserWithOverwritePrompting();
                     fc.setFileFilter(filter);
                     fc.addChoosableFileFilter(filter);
                     final int returnVal = fc
@@ -429,8 +417,8 @@
                     if (view instanceof JTextPane) {
                         final JTextPane text = (JTextPane) pane.getViewport()
                                 .getView();
-                        final JFileChooser fc = new JFileChooser(
-                                PirolPlugInSettings.configDirectory());
+                        final JFileChooser fc = new 
GUIUtil.FileChooserWithOverwritePrompting(
+                                "html");
                         filter = new FileNameExtensionFilter("HTML", "html");
                         fc.setFileFilter(filter);
                         fc.addChoosableFileFilter(filter);
@@ -457,8 +445,8 @@
                     } else if (view instanceof JLabel) {
                         final String text = ((JLabel) view).getText();
                         filter = new FileNameExtensionFilter("HTML", "html");
-                        final JFileChooser fc = new JFileChooser(
-                                PirolPlugInSettings.configDirectory());
+                        final JFileChooser fc = new 
GUIUtil.FileChooserWithOverwritePrompting(
+                                "html");
                         fc.setFileFilter(filter);
                         fc.addChoosableFileFilter(filter);
                         final int returnVal = fc
@@ -484,8 +472,8 @@
                     } else if (view instanceof JTextArea) {
                         final String text = ((JLabel) view).getText();
                         filter = new FileNameExtensionFilter("HTML", "html");
-                        final JFileChooser fc = new JFileChooser(
-                                PirolPlugInSettings.configDirectory());
+                        final JFileChooser fc = new 
GUIUtil.FileChooserWithOverwritePrompting(
+                                "html");
                         fc.setFileFilter(filter);
                         fc.addChoosableFileFilter(filter);
                         final int returnVal = fc
@@ -513,8 +501,8 @@
                                 .getView();
                         filter = new FileNameExtensionFilter(
                                 "Comma-Separated Values (csv)", "csv");
-                        final JFileChooser fc = new JFileChooser(
-                                PirolPlugInSettings.configDirectory());
+                        final JFileChooser fc = new 
GUIUtil.FileChooserWithOverwritePrompting(
+                                "csv");
                         fc.setFileFilter(filter);
                         fc.addChoosableFileFilter(filter);
                         final int returnVal = fc
@@ -555,16 +543,12 @@
                     }
                 } else if (c instanceof PlotPanel) {
                     final PlotPanel panel = (PlotPanel) c;
-                    // final JFileChooser chooser =
-                    // SaveGUI.getFileChooser(panel);
-                    // chooser.showSaveDialog(this);
 
                     filter = new FileNameExtensionFilter(
                             "Portable Network Graphics (png)", "png");
                     final FileNameExtensionFilter filter2 = new 
FileNameExtensionFilter(
                             "Drawing Interchange Format(dxf)", "dxf");
-                    final JFileChooser fc = new JFileChooser(
-                            PirolPlugInSettings.configDirectory());
+                    final JFileChooser fc = new 
GUIUtil.FileChooserWithOverwritePrompting();
                     if (oad.getDescription()
                             .contains(
                                     
I18N.get("org.openjump.core.ui.plugin.raster.ProfileGraphTool.Profile-Plot"))) {
@@ -576,6 +560,29 @@
                             .showSaveDialog(AdditionalResultsFrame.this);
                     fc.getWidth();
                     fc.getHeight();
+                    final Box box = new Box(BoxLayout.Y_AXIS);
+                    box.add(Box.createRigidArea(new Dimension(5, 180)));
+                    final JPanel jPanelSize = new JPanel(new FlowLayout(
+                            FlowLayout.LEFT));
+                    final JCheckBox worldFileCheckBox = new 
javax.swing.JCheckBox();
+                    worldFileCheckBox
+                            .setText(I18N
+                                    
.get("ui.plugin.SaveImageAsPlugIn.write-world-file"));
+                    jPanelSize.add(worldFileCheckBox);
+                    box.add(jPanelSize);
+                    fc.setAccessory(box);
+                    if (fc.getFileFilter().equals(filter)) {
+                        worldFileCheckBox.setEnabled(false);
+                        ;
+                        ;
+                        fc.repaint();
+                    } else if (fc.getFileFilter().equals(filter2)) {
+                        worldFileCheckBox.setEnabled(true);
+                        ;
+                        ;
+                        fc.repaint();
+                    }
+
                     if (returnVal == JFileChooser.APPROVE_OPTION) {
                         if (fc.getFileFilter().equals(filter)) {
                             file = new File(fc.getSelectedFile() + ".png");
@@ -600,8 +607,8 @@
                     final JTable table = (JTable) c;
                     filter = new FileNameExtensionFilter(
                             "Comma-Separated Values (csv)", "csv");
-                    final JFileChooser fc = new JFileChooser(
-                            PirolPlugInSettings.configDirectory());
+                    final JFileChooser fc = new 
GUIUtil.FileChooserWithOverwritePrompting(
+                            "csv");
                     fc.setFileFilter(filter);
                     fc.addChoosableFileFilter(filter);
                     final int returnVal = fc
@@ -643,8 +650,8 @@
                     final HTMLPanel panel = (HTMLPanel) c;
                     final String text = panel.lastString();
                     filter = new FileNameExtensionFilter("HTML", "html");
-                    final JFileChooser fc = new JFileChooser(
-                            PirolPlugInSettings.configDirectory());
+                    final JFileChooser fc = new 
GUIUtil.FileChooserWithOverwritePrompting(
+                            "html");
                     fc.setFileFilter(filter);
                     fc.addChoosableFileFilter(filter);
                     final int returnVal = fc
@@ -676,8 +683,8 @@
                     panel.paint(g);
                     filter = new FileNameExtensionFilter(
                             "Portable Network Graphics (png)", "png");
-                    final JFileChooser fc = new JFileChooser(
-                            PirolPlugInSettings.configDirectory());
+                    final JFileChooser fc = new 
GUIUtil.FileChooserWithOverwritePrompting(
+                            "png");
                     fc.setFileFilter(filter);
                     fc.addChoosableFileFilter(filter);
                     final int returnVal = fc
@@ -827,9 +834,14 @@
 
     }
 
+    public static Integer round100(Integer b) {
+        return b - (b % 100);
+    }
+
     // [Giuseppe Aruta 2018-3-14] The following code derives from AdbToolbox
     // Raster>Topography>Section code.
     // see also class it.betastudio.adbtoolbox.libs.DxfExport
+    // [Giuseppe Aruta 2018-3-22] Enhenced dxf output
 
     public static void exportToDxf(String fileName, double[][] points) {
 
@@ -858,34 +870,38 @@
             final DecimalFormatSymbols dfs = new DecimalFormatSymbols(
                     Locale.ENGLISH);
             DecimalFormat twoPlaces = null;
+
             final String twoPlacesS = "0.00";
             twoPlaces = new DecimalFormat(twoPlacesS, dfs);
 
             final int pointsCount = points.length;
-            int interPointsCount = 0;
-            final int txtHight = 10;
-            double baseElev = 0.0D;
+
+            final int txtHight = 14;
+            final int txtHight2 = 22;
+
+            // min elevation of the grid, 200m below the min elevation of the
+            // profile
+            final int b = ((int) minY - 99) / 100 * 100;
+            final double baseElev = b - 100;
+
+            // max elevation of the grid, 200m above the max elevation of the
+            // profile
+            final int a = ((int) maxY + 99) / 100 * 100;
+            final double topElev = a + 200;
+
             final int sepSpacing = 10 * txtHight;
             final String layNameProf = "PROFILE";
-            final String layNameNeatLines = "BASE";
-            final String layNameText = "TEXT";
+            final String baseSectionLayer = "BASE";
+            final String partialValuesLayer = "PARTIAL_VALUES";
+            final String gridLayer = "GRID";
+            final String layNameText = "GRID_TEXT";
 
-            if (baseElev < minY) {
-                minY = baseElev;
-            } else {
-                baseElev = minY;
-            }
-
             // Main points coords
-            final double sep1Y = minY - txtHight * 2;
+            final double sep1Y = baseElev - txtHight * 2;
             final double sep2Y = sep1Y - sepSpacing;
-            final double sep3Y = sep2Y - sepSpacing;
-
+            final double sep3Y = topElev;
+            final double leg5Y = sep3Y + sepSpacing;
             final double legX = minX - (txtHight * 30);
-            final double leg1Y = minY + 0.5 * txtHight;
-            final double leg2Y = sep1Y + txtHight;
-            final double leg3Y = sep2Y + 0.5 * sepSpacing;
-            final double leg4Y = sep3Y + 0.5 * sepSpacing;
 
             final DxfExport dxfExp = new DxfExport();
 
@@ -907,8 +923,10 @@
 
             dxfExp.writeTableStart();
             dxfExp.writeLayersStart();
-            dxfExp.writeLayer(layNameProf, 1);
-            dxfExp.writeLayer(layNameNeatLines, 5);
+            dxfExp.writeLayer(layNameProf, 5);
+            dxfExp.writeLayer(baseSectionLayer, 0);
+            dxfExp.writeLayer(partialValuesLayer, 8);
+            dxfExp.writeLayer(gridLayer, 9);
             dxfExp.writeLayer(layNameText, 7);
             dxfExp.writeTableEnd();
 
@@ -919,18 +937,6 @@
             dxfExp.writeEntStart();
             dxfExp.writePolyline(layNameProf, points);
 
-            // Write bounding lines
-            // dxfExp.writeLine(layNameNeatLines, minX, minY, minX,
-            // points[0][1]);
-            dxfExp.writeLine(layNameNeatLines, legX, minY, maxX, minY);
-            // dxfExp.writeLine(layNameNeatLines, maxX, minY, maxX,
-            // points[pointsCount-1][1]);
-
-            // Write separators
-            dxfExp.writeLine(layNameNeatLines, legX, sep1Y, maxX, sep1Y);
-            dxfExp.writeLine(layNameNeatLines, legX, sep2Y, maxX, sep2Y);
-            dxfExp.writeLine(layNameNeatLines, legX, sep3Y, maxX, sep3Y);
-
             // Write legend
 
             final Task selectedTask = workbenchContext.getTask();
@@ -938,21 +944,22 @@
 
             if (selectedTask.getProperties().containsKey(
                     new QName(Task.PROJECT_UNIT_KEY))) {
-                unitsDistLabel = selectedTask.getProperty(
-                        new QName(Task.PROJECT_UNIT_KEY)).toString();
+                unitsDistLabel = " ["
+                        + selectedTask.getProperty(
+                                new QName(Task.PROJECT_UNIT_KEY)).toString()
+                        + "]";
             } else {
                 unitsDistLabel = "";
             }
-            dxfExp.writeText(layNameText, legX, leg1Y, 0, 0, 0, 0, txtHight, 0,
-                    0, 0, "Reference height: " + twoPlaces.format(baseElev)
-                            + " " + unitsDistLabel);
-            dxfExp.writeText(layNameText, 0, 0, 0, legX, leg2Y, 0, txtHight, 0,
-                    0, 2, "Partial distance" + unitsDistLabel);
-            dxfExp.writeText(layNameText, 0, 0, 0, legX, leg3Y, 0, txtHight, 0,
-                    0, 2, "Progressive distance" + unitsDistLabel);
-            dxfExp.writeText(layNameText, 0, 0, 0, legX, leg4Y, 0, txtHight, 0,
-                    0, 2, "Height" + unitsDistLabel);
 
+            // Text of X axe
+            dxfExp.writeText(layNameText, 0, 0, 0, (maxX - minX) / 2, sep2Y, 0,
+                    txtHight2, 0, 0, 2, WIDTH + unitsDistLabel);
+
+            // Text of Y axe
+            dxfExp.writeText(partialValuesLayer, 0, 0, 0, (maxX - minX) / 2,
+                    leg5Y, 0, txtHight2, 0, 0, 2, HEIGHT + unitsDistLabel);
+
             // Write interpoints labels and ticks
             double p1x = 0;
             double p1y = 0;
@@ -963,12 +970,13 @@
             double alPt2y = 0;
             String labelText = null;
 
+            int interPointsCount = 0;
             // Count interpoints
             double[] interStepD = null;
 
             interStepD = new double[1];
             // Define 100 meters for length/height steps
-            interStepD[0] = 100;
+            interStepD[0] = 100D;
             interPointsCount = (int) ((maxX - minX) / interStepD[0]) + 2;
 
             // Prepare x positions
@@ -1025,50 +1033,91 @@
 
             for (int ip = 0; ip < interPointsCount; ip++) { // OKKIO
 
-                // Vertical lines
-                p1x = interPointsDists[ip];
-                p1y = interPointsElev[ip];
-                p2x = interPointsDists[ip];
-                p2y = minY;
-                dxfExp.writeLine(layNameNeatLines, p1x, p1y, p2x, p2y);
+                if (baseElev + interPointsDists[ip] < topElev
+                        || baseElev + interPointsDists[ip] == topElev) {
 
-                if (ip < interPointsCount - 1) {
-                    // Partial distance labels
-                    alPt1x = (interPointsDists[ip] + interPointsDists[ip + 1]) 
/ 2;
-                    alPt1y = sep1Y + txtHight;
-                    labelText = twoPlaces.format(interPointsDists[ip + 1]
-                            - interPointsDists[ip]);
+                    dxfExp.writeText(layNameText, 0, 0, 0, minX - 200,
+                            interPointsDists[5], 0, txtHight2, 90, 0, 2, HEIGHT
+                                    + unitsDistLabel);
+                    // Grid - orizontal lines every 100 m
+                    p1x = maxX;
+                    p1y = interPointsDists[ip] + baseElev;
+                    p2x = minX;
+                    p2y = interPointsDists[ip] + baseElev;
+                    dxfExp.writeLineType(gridLayer, "DOTTINY", p1x, p1y, p2x,
+                            p2y);
+
+                    // Heights (Y) - text on right and left part of the profile
+                    // every 100m
+                    alPt1x = minX - 100;// sep1Y + txtHight;
+                    final double alPt1ax = maxX + txtHight;//
+                    alPt1y = interPointsDists[ip] + baseElev;
+                    labelText = twoPlaces.format(interPointsDists[ip]
+                            + baseElev);
                     dxfExp.writeText(layNameText, 0, 0, 0, alPt1x, alPt1y, 0,
-                            txtHight, 0, 4, 2, labelText);
+                            txtHight, 0, 0, 2, labelText);
+                    dxfExp.writeText(layNameText, 0, 0, 0, alPt1ax, alPt1y, 0,
+                            txtHight, 0, 0, 2, labelText);
+
+                    // Heights (Y) - small tracks on right and left part of the
+                    // profile
+                    alPt1x = minX;
+                    alPt1y = interPointsDists[ip] + baseElev;
+                    final double alPt2x = minX - (txtHight / 2);
+                    dxfExp.writeLine(baseSectionLayer, alPt1x, alPt1y, alPt2x,
+                            alPt1y);
+                    final double alPt2x2 = maxX + (txtHight / 2);
+                    dxfExp.writeLine(baseSectionLayer, maxX, alPt1y, alPt2x2,
+                            alPt1y);
+
                 }
+            }
 
-                // Progressive distance labels
+            for (int ip = 0; ip < interPointsCount; ip++) { // OKKIO
+
+                // Grid - vertical lines every 100 m
+                p1x = interPointsDists[ip];
+                p1y = topElev;// interPointsElev[ip];
+                p2x = interPointsDists[ip];
+                p2y = baseElev;// minY;
+                dxfExp.writeLineType(gridLayer, "DOTTINY", p1x, p1y, p2x, p2y);
+
+                // Widths (X axe) - texts below the X line, every 100 m
                 alPt1x = interPointsDists[ip];
-                alPt1y = sep2Y + txtHight;
+                alPt1y = sep1Y - 4 * txtHight;
                 labelText = twoPlaces.format(interPointsDists[ip]);
                 dxfExp.writeText(layNameText, 0, 0, 0, alPt1x, alPt1y, 0,
                         txtHight, 90, 0, 2, labelText);
 
-                // Elevation lables
+                // Widths (X axe) - small tracks above the texts
                 alPt1x = interPointsDists[ip];
+                alPt1y = baseElev;
+                alPt2y = baseElev - (txtHight / 2);
+                dxfExp.writeLine(baseSectionLayer, alPt1x, alPt1y, alPt1x,
+                        alPt2y);
+
+                // Partial heights - texts per every 100 width
+                alPt1x = interPointsDists[ip];
                 alPt1y = sep3Y + txtHight;
                 labelText = twoPlaces.format(points[interPointsIds[ip]][1]);
-                dxfExp.writeText(layNameText, 0, 0, 0, alPt1x, alPt1y, 0,
-                        txtHight, 90, 0, 2, labelText);
+                dxfExp.writeText(partialValuesLayer, 0, 0, 0, alPt1x, alPt1y,
+                        0, txtHight, 90, 0, 2, labelText);
 
-                // Ticks
-                alPt1x = interPointsDists[ip];
-                alPt1y = sep2Y;
-                alPt2y = sep2Y + (txtHight / 2);
-                dxfExp.writeLine(layNameNeatLines, alPt1x, alPt1y, alPt1x,
-                        alPt2y);
+                // Partial heights - small tracks
                 alPt1y = sep3Y;
                 alPt2y = sep3Y + (txtHight / 2);
-                dxfExp.writeLine(layNameNeatLines, alPt1x, alPt1y, alPt1x,
+                dxfExp.writeLine(partialValuesLayer, alPt1x, alPt1y, alPt1x,
                         alPt2y);
 
             }
 
+            // Width - X line of the profile
+            dxfExp.writeLine(baseSectionLayer, minX, baseElev, maxX, baseElev);
+            // Height - Y lines of the profile
+            dxfExp.writeLine(baseSectionLayer, minX, baseElev, minX, topElev);
+            dxfExp.writeLine(baseSectionLayer, maxX, baseElev, maxX, topElev);
+            // Partial heights width line
+            dxfExp.writeLine(partialValuesLayer, minX, sep3Y, maxX, sep3Y);
             // Finalize DXF
             dxfExp.writeEnding();
             final int ret = dxfExp.exportDxf(fileName);
@@ -1086,4 +1135,5 @@
 
     public static WorkbenchContext workbenchContext = JUMPWorkbench
             .getInstance().getContext();
+
 }


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to