RE: [OpenMap Users] Box shape around OMCircle during selection

From: Alex Yeo <alexyeo_at_stee.stengg.com>
Date: Fri, 13 Oct 2006 14:34:16 +0800

Hi Carsten,

Yeah the code works (except that I needed to cast g to Graphics2D but that's minor)!

Great! Thanks.

Alex

-----Original Message-----
From: "Carsten Ø. Madsen" [mailto:com_at_navicon.dk]
Sent: 13 October 2006 14:04
To: Alex Yeo
Cc: openMap
Subject: Re: [OpenMap Users] Box shape around OMCircle during selection


Try subclassing OMCircle and then override render to be something like
this (not tested):

public void render(Graphics g) {
   super.render(g);
   Rectangle2D loc = getShape().getBounds2D();
   int arc = 8;
   int offSet = 4;
   Stroke popedStroke = g.getStroke();
   g.setStroke(dashed);
   g.setColor(Color.BLACK);
   g.draw(new RoundRectangle2D.Double(loc.getMinX() - offSet / 2, loc
       .getMinY()
   - offSet / 2, loc.getWidth() + offSet + 2, loc.getHeight()
    + offSet + 2, arc, arc));
   g.setStroke(popedStroke);
}

regards
/carsten

Alex Yeo wrote:
> Hi Don,
>
> I have implemented the guides that were provided below, but I am not clear how to "modify your class to paint that OMRactangle in the paint() method" since OMRect does not provide/inherit any paint() method.
>
> Thanks in advance.
>
> Alex
>
> -----Original Message-----
> From: Don Dietrick [mailto:dietrick_at_bbn.com]
> Sent: 11 October 2006 00:00
> To: Alex Yeo
> Cc: openMap
> Subject: Re: [OpenMap Users] Box shape around OMCircle during selection
>
>
> Hi Alex,
>
> You could extend OMCircle to create a class that, after generate
> (Projection) is called, fetches the bounding box around the shape in
> the OMGraphic, and creates an OMRectangle out of those parameters.
> Note that the rectangle will be defined in pixel space. If you want
> to have the rectangle defined in coordinate space, you could probably
> take the pixel extents of the first rectangle, inverse project them
> using the Projection object, and then create a lat/lon OMRectangle.
> You'd have to call generate(Projection) on that rectangle, though,
> and modify your class to paint that OMRactangle in the paint() method.
>
> Hope this helps,
>
> Don
>
> On Oct 10, 2006, at 4:08 AM, Alex Yeo wrote:
>
>
>> Hi,
>>
>> I have created an OMGraphicList consisting of an OMCircle and an
>> OMText. My intent is to create a box around the selected OMCircle
>> (much like when an OMRaster graphic is selected) but not the OMText.
>>
>> Could anyone please provide a hint to how this is possible? Does it
>> have anything to do with the createShape method in the OMGraphic
>> class?
>>
>> Cheers.
>>
>> Alex
>>
>
>
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, dietrick_at_bbn.com
> BBN Technologies, Cambridge, MA
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> [This e-mail is confidential and may be priviledged. If you are not the
> intended recipient, please kindly notify us immediately and delete the message
> from your system; please do not copy or use it for any purpose, nor disclose
> its contents to any other person. Thank you.]
> ---ST Electronics Group---
>
> --
> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
> with the following text in the BODY of the message "unsubscribe openmap-users"]
>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Oct 13 2006 - 02:33:59 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT