Revision 47476 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/label/GeneralLabelingStrategy.java

View differences:

GeneralLabelingStrategy.java
1 1
package org.gvsig.labeling.label;
2 2

  
3 3
import java.awt.Graphics2D;
4
import java.awt.geom.Point2D;
5 4
import java.awt.image.BufferedImage;
6
import java.io.File;
7
import java.io.IOException;
8 5
import java.util.ArrayList;
9 6
import java.util.Iterator;
10 7
import java.util.List;
11 8
import java.util.TreeMap;
12 9
import java.util.TreeSet;
13
import java.util.logging.Level;
14
import javax.imageio.ImageIO;
15 10
import org.cresques.cts.ICoordTrans;
16

  
17
import org.slf4j.Logger;
18
import org.slf4j.LoggerFactory;
19

  
20 11
import org.gvsig.compat.print.PrintAttributes;
21 12
import org.gvsig.fmap.dal.exception.DataException;
22 13
import org.gvsig.fmap.dal.exception.ReadException;
......
40 31
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
41 32
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass;
42 33
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingMethod;
43
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingStrategy;
44 34
import org.gvsig.fmap.mapcontext.rendering.legend.styling.IPlacementConstraints;
45 35
import org.gvsig.fmap.mapcontext.rendering.legend.styling.IZoomConstraints;
46
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
47 36
import org.gvsig.i18n.Messages;
48 37
import org.gvsig.labeling.lang.LabelClassUtils;
49 38
import org.gvsig.labeling.placements.ILabelPlacement;
......
57 46
import org.gvsig.labeling.symbol.SymbolUtils;
58 47
import org.gvsig.symbology.SymbologyLocator;
59 48
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelLocationMetrics;
49
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractCartographicSupport;
60 50
import org.gvsig.tools.ToolsLocator;
61 51
import org.gvsig.tools.dispose.DisposableIterator;
62 52
import org.gvsig.tools.dynobject.DynStruct;
63 53
import org.gvsig.tools.persistence.PersistenceManager;
64 54
import org.gvsig.tools.persistence.PersistentState;
65 55
import org.gvsig.tools.persistence.exception.PersistenceException;
66
import org.gvsig.tools.swing.api.SimpleImage;
67
import org.gvsig.tools.swing.api.ToolsSwingLocator;
68 56
import org.gvsig.tools.task.Cancellable;
57
import org.slf4j.Logger;
58
import org.slf4j.LoggerFactory;
69 59

  
70
public class GeneralLabelingStrategy implements IGeneralLabelingStrategy {
60
public class GeneralLabelingStrategy extends AbstractCartographicSupport implements IGeneralLabelingStrategy {
71 61

  
72 62
	private static final Logger logger = LoggerFactory
73 63
			.getLogger(GeneralLabelingStrategy.class);
......
91 81
	protected FLyrVect layer;
92 82

  
93 83
	// private long parseTime;
94
	private int unit;
95
	private int referenceSystem;
84
//	private int unit;
85
//	private int referenceSystem;
96 86
	// private double sizeAfter;
97 87
	private boolean printMode = false; /*
98 88
										 * indicate whether output is for a
......
402 392
			Geometry geom, Cancellable cancel, double dpi,
403 393
			boolean bLabelsReallocatable) throws GeometryException {
404 394

  
405
		lc.toCartographicSize(viewPort, dpi, null);
395
            lc.setCartographicContext(viewPort, dpi, geom);
396
//		lc.toCartographicSize(viewPort, dpi, null);
406 397
		ArrayList<LabelLocationMetrics> llm = null;
407 398
		llm = placement.guess(lc, geom, getPlacementConstraints(), 0, cancel,
408 399
				viewPort);
......
766 757
		return false;
767 758
	}
768 759

  
769
	public void setUnit(int unitIndex) {
770
		unit = unitIndex;
760
//	public void setUnit(int unitIndex) {
761
//		unit = unitIndex;
762
//
763
//	}
764
//
765
//	public int getUnit() {
766
//		return unit;
767
//	}
768
//
769
//	public int getReferenceSystem() {
770
//		return referenceSystem;
771
//	}
772
//
773
//	public void setReferenceSystem(int referenceSystem) {
774
//		this.referenceSystem = referenceSystem;
775
//	}
771 776

  
772
	}
773

  
774
	public int getUnit() {
775
		return unit;
776
	}
777

  
778
	public int getReferenceSystem() {
779
		return referenceSystem;
780
	}
781

  
782
	public void setReferenceSystem(int referenceSystem) {
783
		this.referenceSystem = referenceSystem;
784
	}
785

  
786 777
	public static void registerPersistent() {
787 778

  
788 779
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
......
823 814
		}
824 815

  
825 816
		this.allowOverlapping = state.getBoolean("allowOverlapping");
826
		this.unit = state.getInt("unit");
827
		this.referenceSystem = state.getInt("referenceSystem");
817
		this.setUnit(state.getInt("unit"));
818
		this.setReferenceSystem(state.getInt("referenceSystem"));
828 819
	}
829 820

  
830 821
	public void saveToState(PersistentState state) throws PersistenceException {
......
840 831
		}
841 832

  
842 833
		state.set("allowOverlapping", allowOverlapping);
843
		state.set("unit", unit);
844
		state.set("referenceSystem", referenceSystem);
834
		state.set("unit", this.getUnit());
835
		state.set("referenceSystem", this.getReferenceSystem());
845 836

  
846 837
	}
847 838

  
848
	public double toCartographicSize(ViewPort vp, double dpi, Geometry geom) {
849
		/*
850
		 * This method is not used but we must implement CartographicSupport
851
		 */
852
		return 0;
853
	}
854

  
855
	public void setCartographicSize(double cartographicSize, Geometry geom) {
856
		/*
857
		 * This method is not used but we must implement CartographicSupport
858
		 */
859
	}
860

  
861
	public double getCartographicSize(ViewPort vp, double dpi, Geometry geom) {
862
		/*
863
		 * This method is not used but we must implement CartographicSupport
864
		 */
865
		return 0;
866
	}
867

  
839
//	public double toCartographicSize(ViewPort vp, double dpi, Geometry geom) {
840
//		/*
841
//		 * This method is not used but we must implement CartographicSupport
842
//		 */
843
//		return 0;
844
//	}
845
//
846
//	public void setCartographicSize(double cartographicSize, Geometry geom) {
847
//		/*
848
//		 * This method is not used but we must implement CartographicSupport
849
//		 */
850
//	}
851
//
852
//	public double getCartographicSize(ViewPort vp, double dpi, Geometry geom) {
853
//		/*
854
//		 * This method is not used but we must implement CartographicSupport
855
//		 */
856
//		return 0;
857
//	}
858
//
868 859
	public Object clone() throws CloneNotSupportedException {
869 860
		return LabelClassUtils.clone(this);
870 861
	}

Also available in: Unified diff