Revision 6239

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/ViewControls.java
87 87
		MapControl mapCtrl = vista.getMapControl();
88 88
		logger.debug("Comand : " + s);
89 89

  
90
		if (s.compareTo("FULL") == 0) {
90
		if (s.equals("FULL") ) {
91 91
			try {
92 92
			    // mapa.beginAtomicEvent();
93 93
				mapa.getViewPort().setExtent(mapa.getLayers().getFullExtent());
......
97 97
				NotificationManager.addError("Error obteniendo el full extent",
98 98
					e);
99 99
			}
100
		} else if (s.compareTo("SELECTIONBYSHAPE") == 0) {
100
		} else if (s.equals("SELECTIONBYSHAPE") ) {
101 101
			SelectionByTheme dlg = new SelectionByTheme();
102 102
			//FLayer[] layers = mapa.getLayers().getActives();
103 103
			//int count = 0;
104 104
			dlg.setModel(new DefaultSelectionByThemeModel());
105 105
			dlg.addSelectionListener(new MySelectionByThemeListener());
106 106
			PluginServices.getMDIManager().addView(dlg);
107
		} else if (s.compareTo("ENCUADRE") == 0) {
107
		} else if (s.equals("ENCUADRE") ) {
108 108
			FPanelExtentSelector l = new FPanelExtentSelector();
109 109

  
110 110
			ProjectExtension p = (ProjectExtension) PluginServices.getExtension(com.iver.cit.gvsig.ProjectExtension.class);
......
115 115
			l.setModel(modelo);
116 116
			l.addSelectionListener(new Encuadrator(project, mapa, vista));
117 117
			PluginServices.getMDIManager().addView(l);
118
		} else if (s.compareTo("CONFIG_LOCATOR") == 0) {
118
		} else if (s.equals("CONFIG_LOCATOR") ) {
119 119
			//Set up the map overview
120 120
			FPanelLocConfig m_panelLoc = new FPanelLocConfig(vista.getMapOverview());
121 121
			PluginServices.getMDIManager().addView(m_panelLoc);
122 122
			m_panelLoc.setPreferredSize(m_panelLoc.getSize());
123
		} else if (s.compareTo("PAN") == 0) {
123
		} else if (s.equals("PAN") ) {
124 124
			mapCtrl.setTool("pan");
125
		} else if (s.compareTo("ZOOM_IN") == 0) {
125
		} else if (s.equals("ZOOM_IN") ) {
126 126
			mapCtrl.setTool("zoomIn");
127
		} else if (s.compareTo("ZOOM_OUT") == 0) {
127
		} else if (s.equals("ZOOM_OUT") ) {
128 128
			mapCtrl.setTool("zoomOut");
129
		} else if (s.compareTo("MEDICION") == 0) {
129
		} else if (s.equals("MEDICION") ) {
130 130
			mapCtrl.setTool("medicion");
131
		} else if (s.compareTo("AREA") == 0) {
131
		} else if (s.equals("AREA") ) {
132 132
			mapCtrl.setTool("area");
133
		} else if (s.compareTo("SELRECT") == 0) {
133
		} else if (s.equals("SELRECT") ) {
134 134
			mapCtrl.setTool("rectSelection");
135
		} else if (s.compareTo("SELPOINT") == 0) {
135
		} else if (s.equals("SELPOINT") ) {
136 136
			mapCtrl.setTool("pointSelection");
137
		} else if (s.compareTo("CAPAS_VISIBLES") == 0) {
137
		} else if (s.equals("CAPAS_VISIBLES") ) {
138 138
			setVisibles(true, mapa);
139
		} else if (s.compareTo("CAPAS_NOVISIBLES") == 0) {
139
		} else if (s.equals("CAPAS_NOVISIBLES") ) {
140 140
			setVisibles(false, mapa);
141
		} else if (s.compareTo("CAPAS_ACTIVAS") == 0) {
141
		} else if (s.equals("CAPAS_ACTIVAS") ) {
142 142
			setActives(true, mapa);
143
		} else if (s.compareTo("CAPAS_NOACTIVAS") == 0) {
143
		} else if (s.equals("CAPAS_NOACTIVAS") ) {
144 144
			setActives(false, mapa);
145
		}else if (s.compareTo("SAVERASTER") == 0) {
145
		} else if (s.equals("SAVERASTER") ) {
146 146
			mapCtrl.setTool("saveRaster");
147
		}else if (s.compareTo("SELECTIMAGE") == 0) {
147
		} else if (s.equals("SELECTIMAGE") ) {
148 148
			mapCtrl.setTool("selectImage");
149
		} else if (s.equals("ACTION_ZOOM_IN") ) {
150
			mapCtrl.zoomIn();
151
		} else if (s.equals("ACTION_ZOOM_OUT") ) {
152
			mapCtrl.zoomOut();
149 153
		}
150 154
	}
151 155

  
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/layout/FLayoutDraw.java
52 52
import java.awt.geom.Rectangle2D;
53 53
import java.awt.image.BufferedImage;
54 54
import java.awt.print.PageFormat;
55
import java.awt.print.Printable;
55 56
import java.awt.print.PrinterException;
57
import java.io.BufferedOutputStream;
56 58
import java.io.File;
57 59
import java.io.FileOutputStream;
58 60
import java.io.IOException;
61
import java.io.OutputStream;
62
import java.net.MalformedURLException;
59 63

  
64
import javax.print.Doc;
65
import javax.print.DocFlavor;
66
import javax.print.DocPrintJob;
67
import javax.print.PrintException;
68
import javax.print.PrintService;
69
import javax.print.PrintServiceLookup;
70
import javax.print.SimpleDoc;
71
import javax.print.StreamPrintService;
72
import javax.print.StreamPrintServiceFactory;
73
import javax.print.attribute.PrintRequestAttributeSet;
60 74
import javax.swing.JOptionPane;
61 75

  
62 76
import com.iver.andami.PluginServices;
......
114 128
        layout.getAtributes().setDistanceUnitY(layout.getRect());
115 129
        IFFrame[] fframes=layout.getFFrames();
116 130
        for (int i = 0; i < fframes.length; i++) {
117
        	IFFrame f = fframes[i];
118
        	f.draw(g2, layout.getAT(), layout.getVisibleRect(),
131
            IFFrame f = fframes[i];
132
            f.draw(g2, layout.getAT(), layout.getVisibleRect(),
119 133
                    imgBase);
120 134
            //          Dibuja el s?mbolo de que contiene un tag.
121 135
            if ((f.getTag() != null) && (layout.isModeDebug())) {
......
466 480
     *
467 481
     * @param pdf
468 482
     */
483
 /*   public void toPS(File ps) {
484

  
485
             try {
486
                 // Open the image file
487
                // InputStream is = new BufferedInputStream(
488
                //     new FileInputStream("filename.gif"));
489

  
490
                 // Prepare the output file to receive the postscript
491
                 OutputStream fos = new BufferedOutputStream(
492
                     new FileOutputStream("filename.ps"));
493

  
494
                 // Find a factory that can do the conversion
495
                 //DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
496
                 DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
497
                 StreamPrintServiceFactory[] factories =
498
                     StreamPrintServiceFactory.lookupStreamPrintServiceFactories(
499
                         flavor,
500
                         DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType());
501

  
502
                 if (factories.length > 0) {
503
                     StreamPrintService service = factories[0].getPrintService(fos);
504

  
505
                     // Create the print job
506
                     DocPrintJob job = service.createPrintJob();
507
                     Print print= (Print)PluginServices.getExtension(
508
                               com.iver.cit.gvsig.Print.class);
509
                     print.setLayout(layout);
510
                     Doc doc = new SimpleDoc((Printable)print, flavor, null);
511
                     //Doc doc = new SimpleDoc(is, flavor, null);
512
                     // Monitor print job events; for the implementation of PrintJobWatcher,
513
                     // see e702 Determining When a Print Job Has Finished
514
                     //PrintJobWatcher pjDone = new PrintJobWatcher(job);
515
//                   Actualizar attributes
516
                      PrintRequestAttributeSet att = layout.getAtributes()
517
                                                           .toPrintAttributes();
518
                     // Print it
519
                     job.print(doc, att);
520

  
521
                     // Wait for the print job to be done
522
                     //pjDone.waitForDone();
523
                     // It is now safe to close the streams
524
                 }
525

  
526
                // is.close();
527
                 fos.close();
528
             } catch (PrintException e) {
529
             } catch (IOException e) {
530
             }
531
             }
532
             */
533

  
534
/*
535
             public void printLayout(Layout layout) {
536
                 l = layout;
537

  
538
                 try {
539
                     printerJob.setPrintable((Printable) PluginServices.getExtension(
540
                             com.iver.cit.gvsig.Print.class));
541

  
542
                     //Actualizar attributes
543
                     PrintRequestAttributeSet att = layout.getAtributes()
544
                                                          .toPrintAttributes();
545
                     DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
546

  
547
                     if (m_cachePrintServices == null) {
548
                         m_cachePrintServices = PrintServiceLookup.lookupPrintServices(flavor,
549
                                 null);
550
                     }
551

  
552
                     PrintService defaultService = null;
553

  
554
                     if (m_cachePrintService == null) {
555
                         defaultService = PrintServiceLookup.lookupDefaultPrintService();
556
                     }
557

  
558
                     if (m_cachePrintService == null) {
559
                         m_cachePrintService = ServiceUI.printDialog(null, 200, 200,
560
                                 m_cachePrintServices, defaultService, flavor, att);
561
                     }
562

  
563
                     if (m_cachePrintService != null) {
564
                         DocPrintJob jobNuevo = m_cachePrintService.createPrintJob();
565
                         PrintJobListener pjlistener = new PrintJobAdapter() {
566
                                 public void printDataTransferCompleted(PrintJobEvent e) {
567
                                     System.out.println("Fin de impresi?n");
568
                                 }
569
                             };
570

  
571
                         jobNuevo.addPrintJobListener(pjlistener);
572

  
573
                         Doc doc = new SimpleDoc((Printable) PluginServices.getExtension(
574
                                     com.iver.cit.gvsig.Print.class), flavor, null);
575
                         jobNuevo.print(doc, att);
576
                     }
577
                 } catch (PrintException pe) {
578
                     pe.printStackTrace();
579
                 }
580
             }
581

  
582
        document.close();
583

  
584
        layout.fullRect();
585
    }
586
*/
587

  
588

  
589

  
590
    /**
591
     * A partir de un fichero que se pasa como par?metro se crea un ps con el
592
     * contenido del Layout.
593
     *
594
     * @param ps
595
     */
596
    public void toPS(File ps) {
597
    	try {
598
            // Prepare the output file to receive the postscript
599
            OutputStream fos = new BufferedOutputStream(
600
                new FileOutputStream(ps));
601

  
602
            // Find a factory that can do the conversion
603
            //DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
604
            DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
605
            StreamPrintServiceFactory [] factories =
606
                 StreamPrintServiceFactory.lookupStreamPrintServiceFactories(flavor,
607
                       "application/postscript");
608

  
609
            if (factories.length > 0) {
610
                StreamPrintService service = factories[0].getPrintService(fos);
611

  
612
                // Create the print job
613
                DocPrintJob job = service.createPrintJob();
614
                Print print= (Print)PluginServices.getExtension(
615
                            com.iver.cit.gvsig.Print.class);
616
                print.setLayout(layout);
617
                Doc doc = new SimpleDoc((Printable)print, flavor, null);
618
                //Doc doc = new SimpleDoc(is, flavor, null);
619
                // Monitor print job events; for the implementation of PrintJobWatcher,
620
                // see e702 Determining When a Print Job Has Finished
621
                //PrintJobWatcher pjDone = new PrintJobWatcher(job);
622
//              Actualizar attributes
623
                 PrintRequestAttributeSet att = layout.getAtributes()
624
                                                      .toPrintAttributes();
625
                // Print it
626
                job.print(doc, att);
627

  
628
                // Wait for the print job to be done
629
                //pjDone.waitForDone();
630
                // It is now safe to close the streams
631
            }
632

  
633
           // is.close();
634
            fos.close();
635
        } catch (PrintException e) {
636
        } catch (IOException e) {
637
        }
638
    /*    PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
639
        DocPrintJob printerJob = defaultPrintService.createPrintJob();
640

  
641
        try {
642
        	DocFlavor flavor=DocFlavor.URL.POSTSCRIPT;
643
        	if (!defaultPrintService.isDocFlavorSupported(flavor)) {
644
        		   System.err.println("The printer does not support the appropriate DocFlavor");
645
        	}else {
646

  
647
        	SimpleDoc simpleDoc;
648
            simpleDoc = new SimpleDoc(ps.toURL(),flavor, null);
649
            printerJob.print(simpleDoc, null);
650
        	}
651
        } catch (MalformedURLException e) {
652
            // TODO Auto-generated catch block
653
            e.printStackTrace();
654
        } catch (PrintException e) {
655
            // TODO Auto-generated catch block
656
            e.printStackTrace();
657
        }
658
        */
659
         layout.fullRect();
660
    }
661

  
662

  
663
    /**
664
     * A partir de un fichero que se pasa como par?metro se crea un pdf con el
665
     * contenido del Layout.
666
     *
667
     * @param pdf
668
     */
469 669
    public void toPDF(File pdf) {
470 670
        double w = 0;
471 671
        double h = 0;
......
482 682
        document.setPageSize(new com.lowagie.text.Rectangle((float) w, (float) h));
483 683

  
484 684
        try {
485
            PdfWriter writer = PdfWriter.getInstance(document,
486
                    new FileOutputStream(pdf));
685
        	FileOutputStream fos=new FileOutputStream(pdf);
686
            PdfWriter writer = PdfWriter.getInstance(document,fos);
487 687
            document.open();
488 688

  
489 689
            Print print = new Print();
......
507 707
            }
508 708

  
509 709
            g2.dispose();
710

  
510 711
        } catch (DocumentException de) {
511 712
            System.err.println(de.getMessage());
512 713
        } catch (IOException ioe) {
......
515 716
        }
516 717

  
517 718
        document.close();
719

  
518 720
        layout.fullRect();
519
    }
721
      }
520 722
}
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/LayoutControls.java
82 82
		FLayoutZooms zooms = new FLayoutZooms(layout);
83 83
		logger.debug("Comand : " + s);
84 84

  
85
		if (s.compareTo("PAN") == 0) {
85
		if (s.equals("PAN")) {
86 86
			layout.setTool(Layout.PAN);
87
		} else if (s.compareTo("ZOOM_IN") == 0) {
87
		} else if (s.equals("ZOOM_IN")) {
88 88
			layout.setTool(Layout.ZOOM_MAS);
89
		} else if (s.compareTo("ZOOM_OUT") == 0) {
89
		} else if (s.equals("ZOOM_OUT")) {
90 90
			layout.setTool(Layout.ZOOM_MENOS);
91
		} else if (s.compareTo("CONFIG") == 0) {
91
		} else if (s.equals("CONFIG")) {
92 92
			layout.showFConfig();
93 93
			layout.fullRect();
94
		} else if (s.compareTo("PROPERTIES") == 0) {
94
		} else if (s.equals("PROPERTIES")) {
95 95
			layout.showFProperties();
96
		} else if (s.compareTo("FULL") == 0) {
96
		} else if (s.equals("FULL")) {
97 97
			layout.fullRect();
98
		} else if (s.compareTo("REALZOOM") == 0) {
98
		} else if (s.equals("REALZOOM")) {
99 99
			zooms.realZoom();
100
		} else if (s.compareTo("ZOOMOUT") == 0) {
100
		} else if (s.equals("ZOOMOUT")) {
101 101
			zooms.zoomOut();
102
		} else if (s.compareTo("ZOOMIN") == 0) {
102
		} else if (s.equals("ZOOMIN")) {
103 103
			zooms.zoomIn();
104
		} else if (s.compareTo("ZOOMSELECT") == 0) {
104
		} else if (s.equals("ZOOMSELECT")) {
105 105
			zooms.zoomSelect();
106
		} else if (s.compareTo("PDF")==0){
106
		} else if (s.equals("PDF")){
107 107
			layout.layoutToPDF();
108
		} else if (s.compareTo("SAVETEMPLATE")==0){
108
		} else if (s.equals("PS")){
109
			layout.layoutToPS();
110
		} else if (s.equals("SAVETEMPLATE")){
109 111
			saveLayout();
110
		} 
112
		}
111 113
	}
112 114
	private void saveLayout() {
113 115
    	layout = (Layout) PluginServices.getMDIManager().getActiveView();
trunk/applications/appgvSIG/config/text.properties
450 450
exportar=Exportar
451 451
exportar_a=Exportar a...
452 452
exportar_pdf=Exportar a pdf
453
exportar_ps=Exportar a ps
453 454
extension=Extensi\u00F3n
454 455
extents_no_coincidentes=El extent de la imagen seleccionada no coincide con la imagen de origen.
455 456
fallo_capas=fallo capas
trunk/applications/appgvSIG/config/config.xml
120 120
			<menu text="Vista/navegacion/Zoom_Mas" action-command="ZOOM_IN" icon="images/ZoomIn.png"/>
121 121
			<menu text="Vista/navegacion/Zoom_Menos" action-command="ZOOM_OUT" icon="images/ZoomOut.png"/>
122 122
			<menu text="Vista/navegacion/Zoom_Completo" action-command="FULL" icon="images/MapContents.png"/>
123
			<menu text="Mapa/navegacion/Zoom_Acercar" action-command="ACTION_ZOOM_IN" tooltip="Zoom_Mas" icon="images/zoommas.png"/>
124
			<menu text="Mapa/navegacion/Zoom_Alejar" action-command="ACTION_ZOOM_OUT" tooltip="Zoom_Menos" icon="images/zoommenos.png"/>
123 125

  
124 126
			<menu text="Vista/navegacion/Desplazamiento" action-command="PAN" icon="images/Pan.png"/>
125 127
			<menu text="Vista/navegacion/Encuadre" action-command="ENCUADRE" icon="images/encuadre.png"/>
......
143 145
				<selectable-tool is-default="true" icon="images/ZoomIn.png" action-command="ZOOM_IN" tooltip="Zoom_Mas"/>
144 146
				<selectable-tool icon="images/ZoomOut.png" action-command="ZOOM_OUT"  tooltip="Zoom_Menos"/>
145 147
				<action-tool icon="images/MapContents.png" action-command="FULL" tooltip="Zoom_Completo"/>
148
				<action-tool icon="images/zoommas.png" action-command="ACTION_ZOOM_IN" tooltip="Zoom_Mas"/>
149
				<action-tool icon="images/zoommenos.png" action-command="ACTION_ZOOM_OUT" tooltip="Zoom_Menos"/>
146 150

  
147 151
			</tool-bar>
148 152
			<tool-bar name="View_Tools" position ="4">
......
212 216
			<menu text="Archivo/exportar_pdf" action-command="PDF"
213 217
				 tooltip="exportar_pdf" icon="images/pdf.png"
214 218
				 position="38"/>
219
			<menu text="Archivo/exportar_ps" action-command="PS"
220
				 tooltip="exportar_ps" icon="images/ps.png"
221
				 position="39"/>
215 222
			<tool-bar name="gvSIG" position="1">
216 223
				<action-tool icon="images/pdf.png" action-command="PDF"  tooltip="exportar_pdf"/>
224
				<action-tool icon="images/ps.png" action-command="PS"  tooltip="exportar_ps"/>
217 225
			</tool-bar>
218 226
			<tool-bar name="Layout_Tools_Zooms" position="20">
219 227
				<selectable-tool icon="images/LayoutZoomIn.png" action-command="ZOOM_IN" tooltip="Zoom_Mas"/>
......
247 255
			<menu text="Mapa/Insertar/circulo" action-command="CIRCLE" tooltip="insertar_circulo" icon="images/Circle.png"/>
248 256
			<menu text="Mapa/Insertar/linea" action-command="LINE" tooltip="insertar_linea" icon="images/Rect.png"/>
249 257
			<menu text="Mapa/Insertar/polilinea" action-command="POLYLINE" tooltip="insertar_polilinea" icon="images/Line.png"/>
250
			<menu text="Mapa/Insertar/poligono" action-command="POLYGON" tooltip="insertar_poligono" icon="images/Poligon.png"/>
258
			<menu text="Mapa/Insertar/poligono" action-command="POLYGON" tooltip="insertar_poligono" icon="images/Polygon.png"/>
251 259
			<menu text="Mapa/Insertar/imagen" action-command="RECTANGLEPICTURE" tooltip="insertar_imagen" icon="images/MapaImagen.png"/>
252 260

  
253 261
			<menu text="Mapa/Insertar/Vista" action-command="RECTANGLEVIEW" tooltip="insertar_vista" icon="images/MapaVista.png"/>
......
413 421
			active="true">
414 422
			<menu text="Tabla/manage_fields" action-command="MANAGE_FIELDS"/>
415 423
		</extension>
416
		
424

  
417 425
		<extension class-name="com.iver.cit.gvsig.TableEditCopyExtension"
418 426
			description="Extensi?n encargada de gestionar las operaciones de edici?n sobre las tablas."
419 427
			active="true">
......
443 451
			description="Extensi?n encargada de gestionar las operaciones sobre los campos num?ricos."
444 452
			active="true">
445 453
			<menu text="Tabla/statistics" icon="images/statistics.png"/>
446
			<tool-bar name="Herramientas" position="11">
454
			<tool-bar name="Herramientas" position="12">
447 455
				<action-tool icon="images/statistics.png" tooltip="statistics"/>
448 456
			</tool-bar>
449 457
		</extension>
458
		<extension class-name="com.iver.cit.gvsig.TableRowsOperations"
459
			description="Extensi?n encargada de gestionar la selecci?n en la tabla."
460
			active="true">
461
			<menu text="Tabla/selection_up" icon="images/selectionUp.png"/>
462
			<tool-bar name="Herramientas" position="13">
463
				<action-tool icon="images/selectionUp.png" tooltip="selection_up"/>
464
			</tool-bar>
465
		</extension>
466

  
450 467
		<extension class-name="com.iver.cit.gvsig.FiltroExtension"
451 468
			description="Extensi?n encargada de abrir el di?logo para filtrar una tabla."
452 469
			active="true">
453 470
			<menu text="Tabla/filtro" icon="images/Filtro.png" action-command="FILTRO"/>
454
			<tool-bar name="Herramientas" position="11">
471
			<tool-bar name="Herramientas" position="14">
455 472
				<action-tool icon="images/Filtro.png" action-command="FILTRO" tooltip="filtro"/>
456 473
			</tool-bar>
457 474
		</extension>
......
477 494
			description="Extensi?n encargada de seleccionar una capa de raster en el toc."
478 495
			active="true">
479 496
			<menu text="Vista/seleccion/seleccionar_capas" icon="images/zoommas.png" action-command="SELECTIMAGE"/>
480
			<tool-bar name="Herramientas" position="11">
497
			<tool-bar name="Herramientas" position="15">
481 498
				<selectable-tool icon="images/zoommas.png" action-command="SELECTIMAGE"  tooltip="seleccionar_capas"/>
482 499
			</tool-bar>
483 500
		</extension>
......
485 502
			description="Extensi?n encargada de abrir la tabla asociada a la capa seleccionado."
486 503
			active="true">
487 504
			<menu text="Capa/ver_tabla_atributos" icon="images/ResultConsulta.png"/>
488
			<tool-bar name="Acciones" position="12">
505
			<tool-bar name="Acciones" position="116">
489 506
				<action-tool icon="images/ResultConsulta.png"
490 507
					enableText="Un_Layer"
491 508
					tooltip="Muestra_atributos"/>

Also available in: Unified diff