Revision 379

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FLabel.java
1 1
/* Generated by Together */
2

  
3 2
package com.iver.cit.gvsig.fmap.core;
4 3

  
4
import com.iver.cit.gvsig.fmap.ViewPort;
5
import com.iver.cit.gvsig.fmap.drivers.shp.SHP;
6
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
7

  
8
import org.geotools.geometry.Geometry;
9

  
5 10
import java.awt.Graphics2D;
11
import java.awt.Rectangle;
12
import java.awt.geom.AffineTransform;
13
import java.awt.geom.PathIterator;
14
import java.awt.geom.Point2D;
6 15
import java.awt.geom.Rectangle2D;
7 16

  
8
import org.geotools.geometry.Geometry;
9 17

  
10
import com.iver.cit.gvsig.fmap.ViewPort;
11
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
18
/**
19
 * DOCUMENT ME!
20
 *
21
 * @author Vicente Caballero Navarro
22
 */
23
public class FLabel implements FShape {
24
    private String text;
25
    private boolean scaled;
26
    private FPoint2D pos;
27
    private int height;
12 28

  
13
public class FLabel implements IGeometry {
29
    /**
30
     * Crea un nuevo FLabel.
31
     *
32
     * @param text DOCUMENT ME!
33
     * @param scaled DOCUMENT ME!
34
     * @param pos DOCUMENT ME!
35
     * @param height DOCUMENT ME!
36
     */
37
    public FLabel(String text, boolean scaled, FPoint2D pos, int height) {
38
        this.text = text;
39
        this.scaled = scaled;
40
        this.pos = pos;
41
        this.height = height;
42
    }
43
    public void transform(AffineTransform at)
44
    {
45
    	at.transform(pos.p,pos.p);
46
    }
47
    /**
48
     * @see com.iver.cit.gvsig.fmap.core.IGeometry#draw(java.awt.Graphics2D,
49
     *      ViewPort, FStyle2D)
50
     */
51
    public void draw(Graphics2D g, ViewPort vp, FStyle2D symbol) {
52
    }
14 53

  
54
    /**
55
     * @see com.iver.cit.gvsig.fmap.core.IGeometry#toJTSGeometry()
56
     */
57
    public Geometry toJTSGeometry() {
58
        return null;
59
    }
60

  
61
    /**
62
     * @see com.iver.cit.gvsig.fmap.core.IGeometry#createLabels(int, boolean)
63
     */
64
    public IGeometry[] createLabels(int position, boolean duplicates) {
65
        return null;
66
    }
67

  
68
    /* (non-Javadoc)
69
     * @see com.iver.cit.gvsig.fmap.core.IGeometry#intersects(java.awt.geom.Rectangle2D)
70
     */
71
    public boolean intersects(Rectangle2D r) {
72
        // TODO Auto-generated method stub
73
        return false;
74
    }
75

  
76
    /* (non-Javadoc)
77
     * @see com.iver.cit.gvsig.fmap.core.IGeometry#getBounds2D()
78
     */
79
    public Rectangle2D getBounds2D() {
80
        // TODO Auto-generated method stub
81
        return new Rectangle2D.Double(pos.p.getX(), pos.p.getY(), 0, 0);
82
    }
83

  
84
    /**
85
     * @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeometryType()
86
     */
87
    public int getGeometryType() {
88
        return FShape.TEXT;
89
    }
90

  
15 91
	/**
16
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#draw(java.awt.Graphics2D, ViewPort, FStyle2D)
92
	 * @see com.iver.cit.gvsig.fmap.core.FShape#getShapeType()
17 93
	 */
18
	public void draw(Graphics2D g, ViewPort vp, FStyle2D symbol) {
94
	public int getShapeType() {
95
		return FShape.TEXT;
19 96
	}
20 97

  
21 98
	/**
22
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#toJTSGeometry()
99
	 * @see java.awt.Shape#contains(double, double)
23 100
	 */
24
	public Geometry toJTSGeometry() {
25
		return null;
101
	public boolean contains(double x, double y) {
102
		if ((x == pos.p.getX()) || (y == pos.p.getY()))
103
			return true;
104
		else
105
		return false;
26 106
	}
27 107

  
28 108
	/**
29
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#createLabels(int, boolean)
109
	 * @see java.awt.Shape#contains(double, double, double, double)
30 110
	 */
31
	public IGeometry[] createLabels(int position, boolean duplicates) {
32
		return null;
111
	public boolean contains(double arg0, double arg1, double arg2, double arg3) {
112
		return false;
33 113
	}
34 114

  
35
	/* (non-Javadoc)
36
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#intersects(java.awt.geom.Rectangle2D)
115
	/**
116
	 * @see java.awt.Shape#intersects(double, double, double, double)
37 117
	 */
38
	public boolean intersects(Rectangle2D r) {
39
		// TODO Auto-generated method stub
118
	public boolean intersects(double arg0, double arg1, double arg2, double arg3) {
40 119
		return false;
41 120
	}
42 121

  
43
	/* (non-Javadoc)
44
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#getBounds2D()
122
	/**
123
	 * @see java.awt.Shape#getBounds()
45 124
	 */
46
	public Rectangle2D getBounds2D() {
47
		// TODO Auto-generated method stub
48
		return null;
125
	public Rectangle getBounds() {
126
		return new Rectangle((int) pos.p.getX(), (int) pos.p.getY(), 0, 0);
49 127
	}
50 128

  
51 129
	/**
52
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeometryType()
130
	 * @see java.awt.Shape#contains(java.awt.geom.Point2D)
53 131
	 */
54
	public int getGeometryType() {
55
		return FShape.TEXT;
132
	public boolean contains(Point2D arg0) {
133
		return false;
56 134
	}
57 135

  
136
	/**
137
	 * @see java.awt.Shape#contains(java.awt.geom.Rectangle2D)
138
	 */
139
	public boolean contains(Rectangle2D arg0) {
140
		return false;
141
	}
142

  
143
	/**
144
	 * @see java.awt.Shape#getPathIterator(java.awt.geom.AffineTransform)
145
	 */
146
	public PathIterator getPathIterator(AffineTransform at) {
147
		return new FPointIterator(pos.p,at);
148
	}
149

  
150
	/**
151
	 * @see java.awt.Shape#getPathIterator(java.awt.geom.AffineTransform, double)
152
	 */
153
	public PathIterator getPathIterator(AffineTransform at, double arg1) {
154
		return new FPointIterator(pos.p,at);
155
	}
58 156
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/ShapeFactory.java
35 35
    }
36 36
    public static IGeometry createLabel(String text, boolean scaled, FPoint2D pos, int height) {
37 37
    	//TODO implementar bien
38
    	return null;
38
    	return new FGeometry(new FLabel(text,scaled,pos,height));
39 39
    }
40 40
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FGeometry.java
60 60
	        if (shp instanceof FPoint2D) {
61 61
	        	((FPoint2D) shp).transform(at);
62 62
	        }
63
	        if (shp instanceof FLabel){
64
	        	((FLabel)shp).transform(at);
65
	        }
63 66
		
64 67
	} 
65 68
	

Also available in: Unified diff