Revision 4171

View differences:

org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/RasterExtension.java
2 2
*
3 3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4 4
* of the Valencian Government (CIT)
5
* 
5
*
6 6
* This program is free software; you can redistribute it and/or
7 7
* modify it under the terms of the GNU General Public License
8 8
* as published by the Free Software Foundation; either version 2
9 9
* of the License, or (at your option) any later version.
10
* 
10
*
11 11
* This program is distributed in the hope that it will be useful,
12 12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
* GNU General Public License for more details.
15
* 
15
*
16 16
* You should have received a copy of the GNU General Public License
17 17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
* MA  02110-1301, USA.
20
* 
20
*
21 21
*/
22 22
package org.gvsig.raster.tools.app.basic;
23 23

  
......
95 95
 */
96 96
public class RasterExtension extends Extension implements ConfigurationListener, IExtensionQueryByAction {
97 97
	public static final String         CLIPPING_PROCESS_LABEL   = ClippingProcess.PROCESS_LABEL;
98
	
98

  
99 99
	/**
100 100
	 * Indica si en el panel de preferencias se refresca automaticamente la vista
101 101
	 * para mostrar los cambios
......
154 154
		// A?adimos paneles al cuadro de propiedades.
155 155
		point = extensionPoints.get("RasterSEPropertiesDialog");
156 156
		point.append("info", "", InfoPanel.class);
157
		point.append("general_panel", "", GeneralPanel.class);
157 158
		point.append("transparencia", "", TransparencyPanel.class);
158 159
		point.append("realce", "", EnhancedPanel.class);
159
		point.append("general_panel", "", GeneralPanel.class);
160 160

  
161

  
161 162
		// A?adimos las entradas del men?  del toc de raster
162 163
		point = extensionPoints.get("View_TocActions");
163 164
		//point.append("RasterSEProperties", "Raster Properties", RasterPropertiesTocMenuEntry.getSingleton());
......
167 168
		point.append("Color table", "Color table for a raster layer", ColorTableTocMenuEntry.getSingleton());
168 169
		point.append("Histogram", "Histogram of a raster layer", HistogramTocMenuEntry.getSingleton());
169 170
		point.append("Overviews", "Build overviews", OverviewsTocMenuEntry.getSingleton());
170
		
171

  
171 172
		ApplicationManager appGvSigMan = ApplicationLocator.getManager();
172 173

  
173 174
		appGvSigMan.registerPrepareOpenDataStoreParameters(new PrepareLayerAskWritableDirectory());
......
181 182
		registerMenuElements();
182 183
		registerProcesses();
183 184
	}
184
	
185

  
185 186
	private void registerProcesses() {
186 187
    	RasterBaseAlgorithmLibrary.register(CLIPPING_PROCESS_LABEL, ClippingProcess.class);
187 188
    	ClippingProcess.registerParameters();
......
190 191
	/**
191 192
	 * Registra los iconos a utilizar en andami.
192 193
	 */
193
	private void registerIcons() {	
194
	private void registerIcons() {
194 195
		//Actions
195 196
		IconThemeHelper.registerIcon("action", "menu-layer-icon", this);
196 197
		IconThemeHelper.registerIcon("action", "menu-process-icon", this);
197 198
		IconThemeHelper.registerIcon("action", "menu-transgeo-icon", this);
198 199
		IconThemeHelper.registerIcon("action", "menu-raster-export", this);
199
		
200

  
200 201
		IconThemeHelper.registerIcon("action", "layer-modify-roi", this);
201 202
		IconThemeHelper.registerIcon("action", "layer-histogram", this);
202 203
		IconThemeHelper.registerIcon("action", "layer-color-table", this);
......
215 216
		IconThemeHelper.registerIcon("action", "layer-info-by-pixel", this);
216 217
		IconThemeHelper.registerIcon("action", "layer-vectorization", this);
217 218
		IconThemeHelper.registerIcon("action", "view-export-image", this);
218
		
219

  
219 220
		//Cursor
220 221
		IconThemeHelper.registerIcon("cursor", "zoom-pixel-cursor", this);
221 222
		IconThemeHelper.registerIcon("cursor", "hor-arrow-cursor", this);
......
236 237
		IconThemeHelper.registerIcon("cursor", "line-cursor", this);
237 238
		IconThemeHelper.registerIcon("cursor", "polygon-cursor", this);
238 239
		IconThemeHelper.registerIcon("cursor", "point-cursor", this);
239
		
240

  
240 241
		//Other
241 242
		IconThemeHelper.registerIcon(null, "forward-icon", this);
242 243
		IconThemeHelper.registerIcon(null, "backward-icon", this);
......
245 246
		IconThemeHelper.registerIcon(null, "delall-icon", this);
246 247
		IconThemeHelper.registerIcon(null, "back-icon", this);
247 248
		IconThemeHelper.registerIcon(null, "next-icon", this);
248
		IconThemeHelper.registerIcon(null, "undo-icon", this);	
249
		IconThemeHelper.registerIcon(null, "undo-icon", this);
249 250
		IconThemeHelper.registerIcon(null, "pixel-increase", this);
250 251
		IconThemeHelper.registerIcon(null, "pref-raster-icon", this);
251 252
		IconThemeHelper.registerIcon(null, "back-icon", this);
......
287 288
		IconThemeHelper.registerIcon(null, "gvsig-icon", this);
288 289
		IconThemeHelper.registerIcon(null, "gvsig-icon16x16", this);
289 290
	}
290
	
291

  
291 292
	public void registerMenuElements() {
292 293
		// Creaci?n del punto de extensi?n para registrar paneles en el cuadro de propiedades.
293 294
		ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager();
......
305 306
		point.append("RoisManager", "", ROIManagerTocMenuEntry.getSingleton());
306 307
		point.append("ViewRasterAnalysis", "", ViewRasterAnalysisTocMenuEntry.getSingleton());
307 308
		point.append("ZoomResolutionLevel", "", ZoomResolutionLevelTocMenuEntry.getSingleton());
308
		
309

  
309 310
		//point.append("SaveRaster", "", SaveViewToRasterTocMenuEntry.getSingleton());
310 311
		point.append("SaveAs", "", SaveAsTocMenuEntry.getSingleton());
311 312
		point.append("ClippingPanel", "", ClippingTocMenuEntry.getSingleton());
......
316 317
		point.append("EnhancedPanel", "", EnhancedTocMenuEntry.getSingleton());
317 318
		point.append("InfoByPoint", "", InfoByRasterPointTocMenuEntry.getSingleton());
318 319
		point.append("LayerDatatype", "", LayerDatatypeTocMenuEntry.getSingleton());
319
		
320

  
320 321
		point.append("GeoLocation", "", GeoLocationTocMenuEntry.getSingleton());
321 322
		point.append("SetProjection", "", SetViewProjectionTocMenuEntry.getSingleton());
322 323

  
323 324
	}
324
	
325

  
325 326
	public boolean isEnabled() {
326 327
		org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager().getActiveWindow();
327 328
		if (f == null)
......
345 346

  
346 347
		if (f instanceof AbstractViewPanel) {
347 348
			FLayers lyrs = ((AbstractViewPanel)f).getMapControl().getMapContext().getLayers();
348
			if (lyrs.getLayersCount() > 0) 
349
			if (lyrs.getLayersCount() > 0)
349 350
				return true;
350 351
		}
351 352

  
......
496 497
		super.postInitialize();
497 498
		new ToolboxRasterToolsLoader().registerTool();
498 499
	}
499
	
500

  
500 501
	public boolean canQueryByAction() {
501
		return true;	
502
		return true;
502 503
	}
503
	
504

  
504 505
	public boolean isEnabled(String action) {
505 506
		//Las entradas en GenericToolBarModule est?n registradas con la misma etiqueta que el actionCommand
506 507
		//De esta forma pueden recuperarse los TocMenuEntry del punto de extensi?n y ejecutar isEnable a
......
518 519
		}
519 520
		return false;
520 521
	}
521
	
522

  
522 523
	public boolean isVisible(String action) {
523 524
		//Las entradas en GenericToolBarModule est?n registradas con la misma etiqueta que el actionCommand
524 525
		//De esta forma pueden recuperarse los TocMenuEntry del punto de extensi?n y ejecutar isVisible a
......
536 537
		}
537 538
		return false;
538 539
	}
539
	
540

  
540 541
	public ExtensionPoint getGenericToolBarMenuExtensionPoint() {
541 542
		if(genericToolBarMenuExtensionPoint == null) {
542 543
			ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager();
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/properties/panel/EnhancedPanel.java
2 2
*
3 3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4 4
* of the Valencian Government (CIT)
5
* 
5
*
6 6
* This program is free software; you can redistribute it and/or
7 7
* modify it under the terms of the GNU General Public License
8 8
* as published by the Free Software Foundation; either version 2
9 9
* of the License, or (at your option) any later version.
10
* 
10
*
11 11
* This program is distributed in the hope that it will be useful,
12 12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
* GNU General Public License for more details.
15
* 
15
*
16 16
* You should have received a copy of the GNU General Public License
17 17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
* MA  02110-1301, USA.
20
* 
20
*
21 21
*/
22 22
package org.gvsig.raster.tools.app.basic.tool.properties.panel;
23 23

  
......
58 58
		add(getBrightnessContrastPanel());
59 59
		add(getEnhancedWithTrimPanel());
60 60
		this.setPreferredSize(new Dimension(100, 80));
61

  
62
		this.setPriority(60);
61 63
	}
62 64

  
63 65
	public void initializeUI() {
......
121 123

  
122 124
		if (!actions.isActionEnabled(IRasterLayerActions.ENHANCED))
123 125
			StatusComponent.setDisabled(getEnhancedWithTrimPanel());
124
		
125
		if (actions.isActionEnabled(IRasterLayerActions.ENHANCED) && 
126

  
127
		if (actions.isActionEnabled(IRasterLayerActions.ENHANCED) &&
126 128
			!actions.isActionEnabled(IRasterLayerActions.TAILTRIM)) {
127 129
			getEnhancedWithTrimPanel().getTrimSlider().setVisible(false);
128 130
			getEnhancedWithTrimPanel().getTrimCheck().setVisible(false);
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/properties/panel/TransparencyPanel.java
2 2
*
3 3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4 4
* of the Valencian Government (CIT)
5
* 
5
*
6 6
* This program is free software; you can redistribute it and/or
7 7
* modify it under the terms of the GNU General Public License
8 8
* as published by the Free Software Foundation; either version 2
9 9
* of the License, or (at your option) any later version.
10
* 
10
*
11 11
* This program is distributed in the hope that it will be useful,
12 12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
* GNU General Public License for more details.
15
* 
15
*
16 16
* You should have received a copy of the GNU General Public License
17 17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
* MA  02110-1301, USA.
20
* 
20
*
21 21
*/
22 22
package org.gvsig.raster.tools.app.basic.tool.properties.panel;
23 23

  
......
85 85
		this.add(getPTranspByPixel(), BorderLayout.CENTER);
86 86
		initControls();
87 87
		this.setPreferredSize(new Dimension(100, 80));
88
		this.setPriority(70);
88 89
	}
89 90

  
90 91
	/**
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/properties/panel/InfoPanel.java
2 2
*
3 3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4 4
* of the Valencian Government (CIT)
5
* 
5
*
6 6
* This program is free software; you can redistribute it and/or
7 7
* modify it under the terms of the GNU General Public License
8 8
* as published by the Free Software Foundation; either version 2
9 9
* of the License, or (at your option) any later version.
10
* 
10
*
11 11
* This program is distributed in the hope that it will be useful,
12 12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
* GNU General Public License for more details.
15
* 
15
*
16 16
* You should have received a copy of the GNU General Public License
17 17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
* MA  02110-1301, USA.
20
* 
20
*
21 21
*/
22 22
package org.gvsig.raster.tools.app.basic.tool.properties.panel;
23 23

  
......
136 136
			}
137 137
		});
138 138
		this.setPreferredSize(new Dimension(100, 80));
139
		this.setPriority(100);
139 140
	}
140 141

  
141 142
	/*
......
280 281
		String cabInfo = Messages.getText("general_info");
281 282
		String propiedades = "";
282 283
		long fileSize = 0;
283
		
284

  
284 285
		String cabecera = setHTMLTitleTable(cabInfo, 2);
285 286

  
286 287
		long[] filesSize = lyr.getDataStore().getFileSizeByProvider();
287 288
		fileSize = filesSize[selectedDataSet];
288
		
289

  
289 290
		String[] names = lyr.getDataStore().getURIByProvider();
290 291
		propiedades += setHTMLBasicProperty(Messages.getText("archivo"), names[selectedDataSet]);
291 292

  
......
317 318

  
318 319
		double pixelSizeX = lyr.getDataStore().getAffineTransform().getScaleX();
319 320
		double pixelSizeY = lyr.getDataStore().getAffineTransform().getScaleY();
320
		
321

  
321 322
		Extent ext = lyr.getFullRasterExtent();
322 323
		propiedades += setHTMLBasicProperty(Messages.getText("ul"), ext.getULX() + ", " + ext.getULY());
323 324
		propiedades += setHTMLBasicProperty(Messages.getText("lr"), ext.getLRX() + ", " + ext.getLRY());
......
334 335

  
335 336
		return "<br>" + setHTMLTable(cabecera + propiedades);
336 337
	}
337
	
338

  
338 339
	/**
339 340
	 * M?todo que crea la tabla de origen de datos dentro del panel
340 341
	 * de Informaci?n.
......
460 461
		String cabecera = setHTMLTitleTable(cabMeta, 2);
461 462

  
462 463
		Metadata[] metaList = lyr.getDataStore().getMetadataByProvider();
463
		
464

  
464 465
		meta = metaList[selectedDataSet];
465 466
		if (meta != null) {
466 467
			metadatos = meta.getMetadataString();
......
497 498

  
498 499
			String nameFile = "";
499 500
			String[] uris = lyr.getDataStore().getURIByProvider();
500
			
501

  
501 502
			getJComboBox().removeAllItems();
502 503
			for (int i = 0; i < uris.length; i++) {
503 504
				nameFile = uris[i];
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/properties/panel/GeneralPanel.java
2 2
*
3 3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4 4
* of the Valencian Government (CIT)
5
* 
5
*
6 6
* This program is free software; you can redistribute it and/or
7 7
* modify it under the terms of the GNU General Public License
8 8
* as published by the Free Software Foundation; either version 2
9 9
* of the License, or (at your option) any later version.
10
* 
10
*
11 11
* This program is distributed in the hope that it will be useful,
12 12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
* GNU General Public License for more details.
15
* 
15
*
16 16
* You should have received a copy of the GNU General Public License
17 17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 19
* MA  02110-1301, USA.
20
* 
20
*
21 21
*/
22 22
package org.gvsig.raster.tools.app.basic.tool.properties.panel;
23 23

  
......
57 57

  
58 58
/**
59 59
 * Main panel of Properties window. This panel contains general options.
60
 * 
60
 *
61 61
 * @author Nacho Brodin (nachobrodin@gmail.com)
62 62
 */
63 63
public class GeneralPanel extends AbstractPanel implements ActionListener, IProcessActions {
......
82 82
	private JPanel              recalcStatsPanel    = null;
83 83
	private NoDataPanel      pNoDataPanel        = null;
84 84
	//private Transparency        transparency        = null;
85
	
85

  
86 86
	private JScrollPane         jScrollPane         = null;
87 87
	private JEditorPane         jEditorPane         = null;
88 88

  
......
142 142
		gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
143 143
		gridBagConstraints.weightx = 1.0;
144 144
		add(getScalePanel(), gridBagConstraints);
145
		
145

  
146 146
		gridBagConstraints = new java.awt.GridBagConstraints();
147 147
		gridBagConstraints.gridx = 0;
148 148
		gridBagConstraints.gridy = 1;
......
155 155
		gridBagConstraints.weighty = 1.0;
156 156
		gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
157 157
		add(getRecalcStatsPanel(), gridBagConstraints);
158
		
158

  
159 159
		this.setPreferredSize(new Dimension(100, 80));
160

  
161
		this.setPriority(90);
160 162
	}
161
	
162
	
163

  
164

  
163 165
	private void actionEnabled() {
164 166
		IRasterLayerActions actions = null;
165 167
		if(fLayer instanceof IRasterLayerActions)
......
167 169

  
168 170
		if (!actions.isActionEnabled(IRasterLayerActions.STATS))
169 171
			getRecalcStatsPanel().setVisible(false);
170
		
172

  
171 173
		if (!actions.isActionEnabled(IRasterLayerActions.NODATA))
172 174
			getNoDataPanel().setVisible(false);
173 175
	}
174
	
176

  
175 177
	/**
176 178
	 * This method initializes TranspOpacitySliderPanel
177 179
	 * @return javax.swing.JPanel
......
184 186

  
185 187
		return pNoDataPanel;
186 188
	}
187
	
189

  
188 190
	public JPanel getScalePanel() {
189 191
		if (scalePanel == null) {
190 192
			scalePanel = new JPanel();
191 193
			scalePanel.setLayout(new GridBagLayout());
192
			
194

  
193 195
			GridBagConstraints gridBagConstraints;
194 196

  
195 197
			int y = 0;
......
266 268
		if (recalcStatsPanel == null) {
267 269
			recalcStatsPanel = new JPanel();
268 270
			recalcStatsPanel.setLayout(new BorderLayout(5, 5));
269
			
271

  
270 272
			recalcStatsPanel.add(getJScrollPane(), BorderLayout.CENTER);
271 273
			recalcStatsPanel.add(getCalcStatsButton(), BorderLayout.SOUTH);
272 274
		}
......
371 373
			process.setActions(this);
372 374
			process.start();
373 375
		}
374
		
376

  
375 377
		if (e.getSource() == getJCheckBoxMaxim()) {
376 378
			boolean enabled = getJCheckBoxMaxim().isSelected();
377 379
			getJLabelMaxim().setEnabled(enabled);
......
390 392
		rowColor = !rowColor;
391 393
		return color;
392 394
	}
393
	
395

  
394 396
	/**
395 397
	 * Obtiene una entrada de la tabla en formato HTML a partir de una propiedad,
396 398
	 * un valor y un color.
......
443 445
		return "<table cellpadding=\"0\" cellspacing=\"0\" align=\"center\" width=\"100%\">" + content + "</table>";
444 446
	}
445 447

  
446
	
448

  
447 449
	/*
448 450
	 * (non-Javadoc)
449 451
	 * @see org.gvsig.gui.beans.panelGroup.panels.AbstractPanel#setReference(java.lang.Object)
......
455 457
			return;
456 458

  
457 459
		fLayer = (FLyrRaster) ref;
458
		
460

  
459 461
		actionEnabled();
460 462

  
461 463
		getNoDataPanel().setLayer(fLayer);
......
483 485
		refreshHTMLStatistics();
484 486
		setValuesFromPanelToTransparency();
485 487
	}
486
		
488

  
487 489
	/**
488 490
	 * Refresca el HTML del cuadro de texto de las estadisticas de todas las capas
489 491
	 */
......
521 523
		getJEditorStatsPanel().setText(html);
522 524
		getJEditorStatsPanel().setCaretPosition(0);
523 525
	}
524
	
526

  
525 527
	/**
526 528
	 * This method initializes jScrollPane
527 529
	 *
......
534 536
		}
535 537
		return jScrollPane;
536 538
	}
537
	
539

  
538 540
	/**
539 541
	 * This method initializes jEditorPane
540 542
	 *
......
565 567
			return;
566 568

  
567 569
		fLayer.setNoDataTransparent(getNoDataPanel().getCheckBoxNoDataEnabled().isSelected());
568
		
570

  
569 571
		// Redibujamos
570 572
		fLayer.getMapContext().invalidate();
571 573
	}
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/pom.xml
10 10
	<parent>
11 11
      <groupId>org.gvsig</groupId>
12 12
      <artifactId>org.gvsig.desktop</artifactId>
13
      <version>2.0.111</version>
13
      <version>2.0.112</version>
14 14
  </parent>
15 15

  
16 16
        <properties>

Also available in: Unified diff