Revision 12529 branches/v10/extensions/extAnnotations/src/com/iver/cit/gvsig/fmap/layers/Annotation_Layer.java
Annotation_Layer.java | ||
---|---|---|
470 | 470 |
.getRecordset() |
471 | 471 |
.getSelectionSupport()); |
472 | 472 |
} else { |
473 |
// getRecordset().reload(); |
|
474 | 473 |
} |
475 | 474 |
} catch (DriverIOException e) { |
476 | 475 |
throw new EditionException(); |
... | ... | |
517 | 516 |
strategy = null; |
518 | 517 |
System.gc(); |
519 | 518 |
} |
520 |
|
|
521 |
/** |
|
522 |
* DOCUMENT ME! |
|
523 |
* |
|
524 |
* @param height DOCUMENT ME! |
|
525 |
* @param description DOCUMENT ME! |
|
526 |
* @param rotation DOCUMENT ME! |
|
527 |
* @param numReg DOCUMENT ME! |
|
528 |
* |
|
529 |
* @return DOCUMENT ME! |
|
530 |
* |
|
531 |
* @throws DriverIOException DOCUMENT ME! |
|
532 |
*/ |
|
533 |
// public IGeometry getTextWrappingGeometry(float height, String description, |
|
534 |
// double rotation, String type, int style, int numReg, ViewPort vp) throws DriverIOException { |
|
535 |
// ReadableVectorial adapter = getSource(); |
|
536 |
// ICoordTrans ct = getCoordTrans(); |
|
537 |
// IGeometry geom = adapter.getShape(numReg); |
|
538 |
// boolean bMustClone = false; |
|
539 |
// |
|
540 |
// if (geom == null) { |
|
541 |
// return null; |
|
542 |
// } |
|
543 |
// |
|
544 |
// if (ct != null) { |
|
545 |
// if (bMustClone) { |
|
546 |
// geom = geom.cloneGeometry(); |
|
547 |
// } |
|
548 |
// |
|
549 |
// geom.reProject(ct); |
|
550 |
// } |
|
551 |
// Point2D p = null; |
|
552 |
// Rectangle2D r=geom.getBounds2D(); |
|
553 |
//// if (geom.getInternalShape() instanceof FPolygon2D){ |
|
554 |
//// r=new Rectangle2D.Double(r.getX()-r.getWidth()*0.5,r.getY()-r.getHeight()*0.5,r.getWidth(),r.getHeight()); |
|
555 |
//// |
|
556 |
//// } |
|
557 |
// p=new Point2D.Double(r.getCenterX(),r.getCenterY()); |
|
558 |
// |
|
559 |
// double h = height; |
|
560 |
// |
|
561 |
// if (((FSymbol) getLegend().getDefaultSymbol()).isFontSizeInPixels()) { |
|
562 |
// h = vp.toMapDistance((int) (height)); |
|
563 |
// } |
|
564 |
// |
|
565 |
// Font font = new Font(type, style, |
|
566 |
// (int) (h)); |
|
567 |
// FontRenderContext frc = new FontRenderContext(ati, |
|
568 |
// false, true); |
|
569 |
// GlyphVector gv = font.createGlyphVector(frc, description); |
|
570 |
// |
|
571 |
// Shape shape = gv.getOutline((float) p.getX(), (float) (p.getY() + h)); |
|
572 |
// |
|
573 |
// IGeometry geomResult = ShapeFactory.createPolygon2D(new GeneralPathX( |
|
574 |
// shape.getBounds2D())); |
|
575 |
// |
|
576 |
//// if (rotation != 0) { |
|
577 |
//// AffineTransform at=new AffineTransform(); |
|
578 |
//// at.rotate(Math.toRadians(rotation),p.getX(),p.getY()); |
|
579 |
////// at.translate(p.getX(),p.getY()); |
|
580 |
//// geomResult.transform(at); |
|
581 |
////// geomResult.transform(AffineTransform.getRotateInstance(Math.toRadians(rotation),p.getX(),p.getY())); |
|
582 |
////// geomResult.rotate(Math.toRadians(rotation), p.getX(), |
|
583 |
////// p.getY()); |
|
584 |
//// } |
|
585 |
// |
|
586 |
// return geomResult; |
|
587 |
// } |
|
588 | 519 |
public IGeometry getTextWrappingGeometryInPixels(double height, String description, |
589 |
double rotation, String type, int style, int numReg,ViewPort vp) throws DriverIOException { |
|
590 |
ReadableVectorial adapter = getSource(); |
|
591 |
|
|
520 |
double rotation, String type, int style, int numReg,ViewPort vp, IGeometry geom) throws DriverIOException { |
|
592 | 521 |
ICoordTrans ct = getCoordTrans(); |
593 |
adapter.start(); |
|
594 |
IGeometry geom = adapter.getShape(numReg); |
|
595 |
adapter.stop(); |
|
596 |
geom.transform(vp.getAffineTransform()); |
|
522 |
|
|
597 | 523 |
boolean bMustClone = false; |
598 | 524 |
|
599 | 525 |
if (geom == null) { |
... | ... | |
626 | 552 |
Rectangle2D rGeom=shape.getBounds2D(); |
627 | 553 |
IGeometry geomResult = ShapeFactory.createPolygon2D(new GeneralPathX( |
628 | 554 |
rGeom)); |
555 |
|
|
629 | 556 |
if (rotation != 0) { |
630 |
// AffineTransform at = new AffineTransform(); |
|
631 |
// at.rotate(Math.toRadians(rotation)); // S2: rotate around anchor |
|
632 |
// at.translate(p.getX(), p.getY()); // S3: final translation |
|
633 |
// geomResult.transform(at); |
|
634 |
geomResult.transform(AffineTransform.getRotateInstance(-Math.toRadians(rotation),p.getX(),p.getY()-height)); |
|
557 |
AffineTransform Tx = AffineTransform.getRotateInstance(Math.toRadians(-rotation),p.getX(),p.getY()); |
|
558 |
geomResult.transform(Tx); |
|
559 |
// geomResult.transform(AffineTransform.getRotateInstance(Math.toRadians(-rotation),p.getX(),p.getY())); |
|
635 | 560 |
// geomResult.rotate(Math.toRadians(rotation), p.getX(), |
636 | 561 |
// p.getY()); |
637 | 562 |
} |
Also available in: Unified diff