589 |
589 |
|
590 |
590 |
getMapControl().setCursor(transparentCursor);
|
591 |
591 |
}
|
|
592 |
|
|
593 |
/**
|
|
594 |
* Uses like a mouse pointer the image that provides the
|
|
595 |
* selected tool.
|
|
596 |
*/
|
|
597 |
private void setToolMouse(){
|
|
598 |
Image cursor = PluginServices.getIconTheme().get("cad-selection-icon").getImage();
|
|
599 |
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
|
600 |
Cursor c = toolkit.createCustomCursor(cursor ,
|
|
601 |
new Point(16, 16), "img");
|
|
602 |
getMapControl().setCursor (c);
|
|
603 |
}
|
592 |
604 |
|
593 |
605 |
/**
|
594 |
606 |
* <p>Draws a 31x31 pixels cross round the mouse's cursor with an small geometry centered:
|
... | ... | |
603 |
615 |
* @param g <code>MapControl</code>'s graphics where the data will be drawn
|
604 |
616 |
*/
|
605 |
617 |
private void drawCursor(Graphics g) {
|
606 |
|
((Graphics2D)g).setStroke(new BasicStroke(1));
|
607 |
|
g.setColor(Color.black);
|
608 |
|
Point2D p = adjustedPoint;
|
609 |
|
|
610 |
|
if (p == null) {
|
611 |
|
getGrid().setViewPort(getMapControl().getViewPort());
|
612 |
|
|
|
618 |
if (adjustedPoint == null){
|
613 |
619 |
return;
|
614 |
620 |
}
|
615 |
|
|
616 |
|
int size1 = 15;
|
617 |
|
int size2 = 3;
|
618 |
|
g.drawLine((int) (p.getX() - size1), (int) (p.getY()),
|
619 |
|
(int) (p.getX() + size1), (int) (p.getY()));
|
620 |
|
g.drawLine((int) (p.getX()), (int) (p.getY() - size1),
|
621 |
|
(int) (p.getX()), (int) (p.getY() + size1));
|
622 |
|
|
623 |
|
// getMapControl().setToolTipText(null);
|
624 |
|
if (adjustedPoint != null) {
|
625 |
|
if (bForceCoord) {
|
626 |
|
/* g.setColor(Color.ORANGE);
|
627 |
|
g.drawRect((int) (adjustedPoint.getX() - 6),
|
628 |
|
(int) (adjustedPoint.getY() - 6), 12, 12);
|
629 |
|
g.drawRect((int) (adjustedPoint.getX() - 3),
|
630 |
|
(int) (adjustedPoint.getY() - 3), 6, 6);
|
631 |
|
g.setColor(Color.MAGENTA);
|
632 |
|
g.drawRect((int) (adjustedPoint.getX() - 4),
|
633 |
|
(int) (adjustedPoint.getY() - 4), 8, 8); */
|
634 |
|
if (usedSnap != null)
|
635 |
|
{
|
636 |
|
usedSnap.draw(g, adjustedPoint);
|
637 |
|
|
638 |
|
Graphics2D g2 = (Graphics2D) g;
|
639 |
|
FontMetrics metrics = g2.getFontMetrics();
|
640 |
|
int w = metrics.stringWidth(usedSnap.getToolTipText()) + 5;
|
641 |
|
int h = metrics.getMaxAscent() + 5;
|
642 |
|
int x = (int)p.getX()+9;
|
643 |
|
int y = (int)p.getY()- 7;
|
644 |
|
|
645 |
|
g2.setColor(theTipColor );
|
646 |
|
g2.fillRect(x, y-h, w, h);
|
647 |
|
g2.setColor(Color.BLACK);
|
648 |
|
g2.drawRect(x, y-h, w, h);
|
649 |
|
g2.drawString(usedSnap.getToolTipText(), x+3, y-3);
|
650 |
|
|
651 |
|
|
652 |
|
// getMapControl().setToolTipText(usedSnap.getToolTipText());
|
653 |
|
}
|
654 |
|
|
655 |
|
bForceCoord = false;
|
656 |
|
} else {
|
657 |
|
g.drawRect((int) (p.getX() - size2), (int) (p.getY() - size2),
|
658 |
|
(int) (size2 * 2), (int) (size2 * 2));
|
659 |
|
}
|
|
621 |
|
|
622 |
if (usedSnap != null){
|
|
623 |
usedSnap.draw(g, adjustedPoint);
|
|
624 |
clearMouseImage();
|
|
625 |
}else{
|
|
626 |
setToolMouse();
|
660 |
627 |
}
|
661 |
628 |
}
|
662 |
629 |
|