Revision 11372
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/styling/LabelClass.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.8 2007-04-18 15:35:11 jaume |
|
46 |
* Revision 1.9 2007-04-26 11:41:00 jaume |
|
47 |
* attempting to let defining size in world units |
|
48 |
* |
|
49 |
* Revision 1.8 2007/04/18 15:35:11 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.7 2007/04/12 14:28:43 jaume |
... | ... | |
173 | 176 |
public void drawInsideRectangle(Graphics2D graphics, Rectangle bounds) { |
174 | 177 |
if (labelStyle != null) { |
175 | 178 |
// apply the offset to the markerPoint |
176 |
|
|
179 |
System.out.println(bounds); |
|
177 | 180 |
labelStyle.drawInsideRectangle(graphics, bounds); |
178 | 181 |
|
179 | 182 |
for (int i = 0; i < texts.length; i++) { |
... | ... | |
183 | 186 |
Rectangle2D textArea = labelStyle.getTextBounds()[i]; |
184 | 187 |
|
185 | 188 |
// let's build the text rectangle in screen units |
189 |
double a = textArea.getX(); |
|
190 |
double b = textArea.getWidth(); |
|
191 |
double c = textArea.getY(); |
|
192 |
double d = textArea.getHeight(); |
|
193 |
System.out.println("INSIDE: "+bounds); |
|
194 |
System.err .println(a+","+b+","+c+","+d); |
|
186 | 195 |
|
196 |
int x = (int) (bounds.getX() + a*bounds.getWidth()); |
|
197 |
int y = (int) (bounds.getY() + c*bounds.getHeight()); |
|
198 |
int width = (int) Math.abs((b+a) * bounds.getWidth()); |
|
199 |
int height = (int) Math.abs((d+c) * bounds.getHeight()); |
|
200 |
|
|
201 |
/* |
|
202 |
* Matem?ticament haurien d'?sser estes expressions, per? no entenc perqu? sume |
|
203 |
* els coeficients em compte de restar-los |
|
204 |
* int width = (int) ((b-a) * bounds.getWidth()); |
|
205 |
* int height = (int) ((d-c) * bounds.getHeight()); |
|
206 |
*/ |
|
187 | 207 |
//TODO segueix calculant-se mal |
188 |
int x = (int) (bounds.getX() + textArea.getWidth()*textArea.getMinX()); |
|
189 |
int y = (int) (bounds.getY() + textArea.getHeight()*textArea.getMinY()); |
|
190 |
int width = (int) (bounds.getWidth() - (1-textArea.getWidth())); |
|
191 |
int height = (int) (bounds.getHeight() - (1-textArea.getHeight())); |
|
208 |
// int x = (int) (bounds.getX() + textArea.getWidth()*textArea.getMinX());
|
|
209 |
// int y = (int) (bounds.getY() + textArea.getHeight()*textArea.getMinY());
|
|
210 |
// int width = (int) (bounds.getWidth() - (1-textArea.getWidth()));
|
|
211 |
// int height = (int) (bounds.getHeight() - (1-textArea.getHeight()));
|
|
192 | 212 |
|
193 | 213 |
Rectangle textRect = new Rectangle(x, y, width, height); |
214 |
System.out.println("TEXT_RECT:"+textRect); |
|
194 | 215 |
getLabelSymbol().drawInsideRectangle(graphics, null, textRect); |
195 | 216 |
} |
196 | 217 |
} else { |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/styling/PolygonPlacementConstraints.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.8 2007-04-19 14:21:30 jaume |
|
46 |
* Revision 1.9 2007-04-26 11:41:00 jaume |
|
47 |
* attempting to let defining size in world units |
|
48 |
* |
|
49 |
* Revision 1.8 2007/04/19 14:21:30 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.7 2007/04/18 15:35:11 jaume |
... | ... | |
227 | 230 |
// } |
228 | 231 |
} |
229 | 232 |
startingPoint.transform(transform); |
233 |
// center the label TODO change this |
|
230 | 234 |
labelBounds.setLocation(0-(int) (labelBounds.width*.5), 0 - (int) (labelBounds.height*.5)); |
231 | 235 |
g.translate((int) startingPoint.getX(), (int) startingPoint.getY()); |
232 | 236 |
if (theta != 0) { |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/SymbologyFactory.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.6 2007-03-27 09:28:40 jaume |
|
46 |
* Revision 1.7 2007-04-26 11:41:00 jaume |
|
47 |
* attempting to let defining size in world units |
|
48 |
* |
|
49 |
* Revision 1.6 2007/03/27 09:28:40 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.5 2007/03/21 11:02:51 jaume |
... | ... | |
126 | 129 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
127 | 130 |
*/ |
128 | 131 |
public class SymbologyFactory { |
129 |
public static Color DefaultSymbolColor = Color.BLACK; |
|
132 |
public static Color DefaultSymbolColor = Color.DARK_GRAY; |
|
133 |
public static Color DefaultFillSymbolColor = new Color(60, 235, 235); |
|
130 | 134 |
public static Font DefaultTextFont = new Font("SansSerif", Font.PLAIN, 9); |
131 | 135 |
private static Logger logger = Logger.getLogger(SymbologyFactory.class.getName()); |
132 | 136 |
|
... | ... | |
276 | 280 |
|
277 | 281 |
// Default symbol for polygons |
278 | 282 |
sfs.setOutline(createDefaultLineSymbol()); |
279 |
sfs.setFillColor(null); // transparent fill
|
|
283 |
sfs.setFillColor(DefaultFillSymbolColor); // transparent fill
|
|
280 | 284 |
return sfs; |
281 | 285 |
} |
282 | 286 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/CharacterMarkerSymbol.java | ||
---|---|---|
43 | 43 |
* |
44 | 44 |
* $Id$ |
45 | 45 |
* $Log$ |
46 |
* Revision 1.13 2007-04-20 07:11:11 jaume |
|
46 |
* Revision 1.14 2007-04-26 11:41:00 jaume |
|
47 |
* attempting to let defining size in world units |
|
48 |
* |
|
49 |
* Revision 1.13 2007/04/20 07:11:11 jaume |
|
47 | 50 |
* *** empty log message *** |
48 | 51 |
* |
49 | 52 |
* Revision 1.12 2007/04/19 16:01:27 jaume |
... | ... | |
323 | 326 |
} |
324 | 327 |
|
325 | 328 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) { |
329 |
g.setFont(getFont()); |
|
330 |
g.setColor(getColor()); |
|
331 |
|
|
326 | 332 |
int xIni = (int) (r.width*0.5); |
327 | 333 |
int yIni = (int) (r.height*0.5); |
328 |
g.drawLine(0, yIni, r.width, yIni); |
|
329 |
g.drawLine(xIni, 0, xIni, r.height); |
|
334 |
|
|
330 | 335 |
g.translate(xIni, yIni); |
331 | 336 |
g.rotate(getRotation()); |
337 |
|
|
332 | 338 |
// Sirve de algo el scaleInstance??? |
333 | 339 |
RenderingHints old = g.getRenderingHints(); |
334 | 340 |
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
335 |
// double h = r.getHeight(); |
|
336 |
// g.setFont(font); |
|
337 |
// g.setColor(getColor()); |
|
338 |
// r.y = (int) h; |
|
339 |
// |
|
340 |
// int x = r.x; |
|
341 |
// int y = r.y; |
|
342 |
// int width = (int) r.getHeight(); |
|
343 |
// int height = (int) r.getWidth(); |
|
344 |
// int diff = (width-height); |
|
345 |
// if (diff<0) { |
|
346 |
// x -= diff /2; |
|
347 |
// } else { |
|
348 |
// y += diff /2; |
|
349 |
// } |
|
350 |
// |
|
351 |
// // and apply the offset |
|
352 |
// x = x + (int) getOffset().getX(); // TODO scale offset |
|
353 |
// y = y + (int) getOffset().getY(); // TODO scale offset |
|
354 | 341 |
char[] text = new char[] { (char) unicode }; |
355 |
// g.drawChars(text, 0, text.length, x, y); |
|
356 | 342 |
g.drawChars(text, 0, text.length, (int) getOffset().getX(), (int) getOffset().getY()); |
357 | 343 |
g.setRenderingHints(old); |
344 |
|
|
358 | 345 |
g.rotate(-getRotation()); |
359 | 346 |
g.translate(-xIni, -yIni); |
360 | 347 |
|
Also available in: Unified diff