Hi Mark,
You can grab a reference to the MapBean in the findAndInit method on
your layer. It gets called whenever an object gets added to the
MapHandler, and the MapBean will get delivered there eventually.
So, you need to test for it:
public void findAndInit(Object obj) {
if (obj instanceof MapBean) {
_map = (MapBean)obj;
}
}
There will be only one MapBean in a MapHandler (it's a
SoloMapBeanComponent). For completeness, you'll want to implement the
findAndUndo(Object) method, too, and set your _map to null if that
method is called and the Object == _map. You'll want to do null
checking on _map throughout your layer, too.
- Don
On Apr 22, 2004, at 8:21 AM, Gatrell, Mark (UK) wrote:
>
> Don
>
> Thanks for your response..
>
> I have tried to reference my map bean from my layer, but to be honest
> I can't figure out how to do it.
>
> As you say a handle to the correct map bean needs to be established,
> then my setprojection calls will effect the map.
>
> Could you steer me in the right direction?
>
> Thanks again
>
> Regards
>
> Mark.
>
> -----Original Message-----
> From: Don Dietrick [mailto:dietrick@bbn.com]
> Sent: 22 April 2004 13:11
> To: Gatrell, Mark (UK)
> Cc: Openmap-Users (E-mail)
> Subject: Re: [OpenMap Users] Re centre map
>
>
> *** WARNING ***
>
> This mail has originated outside your organization,
> either from an external partner or the Global Internet.
> Keep this in mind if you answer this message.
>
>
> On Apr 22, 2004, at 4:18 AM, Gatrell, Mark (UK) wrote:
>
>>
>> Don
>>
>> I am trying to re center my map on the result of a gps position
>> change...
>>
>> I have been trying to understand Brian Hudson answer to Jaya back in
>> Feb (RE moving icon)but have come to a dead end!
>>
>> My code so far is :- (Direct copy of Brians!) within my extended
>> version of OMGraphicHandlerLayer.
>>
>>
>> Proj proj = (Proj)getProjection().makeClone();
>> proj.setCenter(newLatPosition,newLongPosition);
>>
>> This compiles fine..
>>
>> But I do not understand the next line...
>>
>> _map.setProjection(proj);
>>
>> I have tried to repaint my MapBean, but this has no affect.
>>
>> Would you be so kind as to explain _map ?
>
> _map is probably a handle to a MapBean. You have to set the projection
> on the map so that all of the layers know to react to the change.
> Calling setProjection() fires events and will cause the layers to react
> and repaint.
>
> - Don
>
>
>
> ********************************************************************
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender.
> You should not copy it or use it for any purpose nor disclose or
> distribute its contents to any other person.
> ********************************************************************
>
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Thu Apr 22 10:26:36 2004
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT