40 |
40 |
*/
|
41 |
41 |
package com.iver.cit.gvsig.fmap.core.adapter;
|
42 |
42 |
|
|
43 |
import java.awt.Color;
|
43 |
44 |
import java.awt.Graphics2D;
|
44 |
45 |
import java.awt.geom.AffineTransform;
|
|
46 |
import java.awt.geom.Point2D;
|
|
47 |
import java.awt.geom.Rectangle2D;
|
45 |
48 |
|
46 |
49 |
import javax.print.attribute.PrintRequestAttributeSet;
|
47 |
50 |
|
... | ... | |
49 |
52 |
import com.iver.cit.gvsig.fmap.core.FPoint2D;
|
50 |
53 |
import com.iver.cit.gvsig.fmap.core.FShape;
|
51 |
54 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
|
|
55 |
import com.iver.cit.gvsig.fmap.core.SymbologyFactory;
|
|
56 |
import com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol;
|
|
57 |
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol;
|
52 |
58 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
|
53 |
59 |
|
54 |
60 |
|
... | ... | |
58 |
64 |
* @author Vicente Caballero Navarro
|
59 |
65 |
*/
|
60 |
66 |
public class PointAdapter extends PolyLineAdapter {
|
61 |
|
/**
|
|
67 |
|
|
68 |
public void paint(Graphics2D g, AffineTransform at, boolean andLastPoint) {
|
|
69 |
}
|
|
70 |
public void obtainShape(Point2D p) {
|
|
71 |
GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD, 1);
|
|
72 |
elShape.moveTo(p.getX(), p.getY());
|
|
73 |
setGPX(elShape);
|
|
74 |
}
|
|
75 |
|
|
76 |
|
|
77 |
/**
|
62 |
78 |
* DOCUMENT ME!
|
63 |
79 |
*
|
64 |
80 |
* @param g DOCUMENT ME!
|
... | ... | |
67 |
83 |
*/
|
68 |
84 |
public void draw(Graphics2D g, AffineTransform at, ISymbol symbol) {
|
69 |
85 |
symbol.draw(g,at,getShape(at), null);
|
70 |
|
// FGraphicUtilities.DrawShape(g, at, shapeAux, symbol);
|
71 |
86 |
}
|
72 |
87 |
public void print(Graphics2D g, AffineTransform at, ISymbol symbol,PrintRequestAttributeSet properties) {
|
73 |
88 |
symbol.print(g,at,getShape(at), properties);
|
74 |
|
// FGraphicUtilities.DrawShape(g, at, shapeAux, symbol);
|
75 |
89 |
}
|
76 |
90 |
/**
|
77 |
91 |
* DOCUMENT ME!
|
... | ... | |
83 |
97 |
point.transform(at);
|
84 |
98 |
return point;
|
85 |
99 |
}
|
|
100 |
public Rectangle2D getBounds2D(){
|
|
101 |
Rectangle2D r=getShape(new AffineTransform()).getBounds2D();
|
|
102 |
double w=r.getWidth();
|
|
103 |
double h=r.getHeight();
|
|
104 |
double x=r.getX();
|
|
105 |
double y=r.getY();
|
|
106 |
boolean modified=false;
|
|
107 |
if (r.getWidth()<0.5) {
|
|
108 |
modified=true;
|
|
109 |
w=1;
|
|
110 |
x=x-0.25;
|
|
111 |
}
|
|
112 |
if(r.getHeight()<0.5) {
|
|
113 |
modified=true;
|
|
114 |
h=1;
|
|
115 |
// y=y-0.5;
|
|
116 |
}
|
|
117 |
if (modified)
|
|
118 |
return new Rectangle2D.Double(x,y,w,h);
|
|
119 |
return r;
|
|
120 |
}
|
86 |
121 |
}
|