You have the right class; but unless you change the code to draw lines you
will not draw lines :-)
I think rather than storing individual coordinate on the blackboard you may
want to store a "gate" on the blackboard.

Make a class called gate with 4 points in it. And make your tool create
gates; and you map graphic draw them.

With programming there are always many ways to do things; you should go with
something you are comfortable with.

Why not start off slow and replace the mapgrpahic code (that draws a circle
right now) and ask it to draw a square (just to get practice drawing
squares.

Jody

On Fri, Feb 27, 2009 at 4:43 PM, prasad babu <[email protected]>wrote:

> Hi Jody
>
> I have created a MapGraphic, I am able to place the coardinates now (with
> Blue color), But it is not drawing any lines to combine these coardiants to
> create a gate .
>
> What I have done so far
>
> 1-> Make use of  net.refrations.tuorial.tool.coardinate class . (I just
> create model tool and added this class to that model , so that I can place
> some coordinates using that tool)
> 2->I just added a MapGraphic and I have given a name(Draw Line) to that
> MapGraphic
>
> Step to execute
>
> 1-> I just added a Map to the Udig
> 2-> I just use the coordiante model tool to place the points
> 3->I just created a Map graphic to that Map
>
> Now I can only see  that 4 coardinates with dark blue color on to the Map
>
> Is it the right way to add map graphic? if not plese let me know the
> process,othere wise just send me any doucment related to this.
>
> Thanks in advance
> Babu.
>
> On Thu, Feb 26, 2009 at 12:46 PM, Jody Garnett <[email protected]>wrote:
>
>> On Thu, Feb 26, 2009 at 1:17 PM, prasad babu 
>> <[email protected]>wrote:
>>
>>> Hi
>>>
>>> I added  a plug-in to the tool, and now I need to draw some thing on the
>>> map which conncets 4 coardinates.
>>>
>>
>> So next up you can create a MapGraphic (its responsibility will be to draw
>> the coordinates). Have a look at the code example documented here:
>> -
>> http://udig.refractions.net/confluence/display/DEV/2+Training+Materials#2TrainingMaterials-MapGraphic
>>
>>
>>> and I must restrict the size and way of the polygon or whatever... I wont
>>> allow users to draw what ever they want. I need to do some calculations
>>> while drawing a extra layer on the map.
>>>
>>
>> That is fine; you can do whatever you need when drawing.
>>
>>>
>>> My actual requirement.
>>>
>>> I need to work on a road map, there will be many roads , and I need to
>>> add some gantrys (means toll gates for price calculations) to the map . I
>>> just want to add a plug -in to do this process.
>>>
>>
>> So what is your workflow? Are the four points representing a "tool gate"?
>> 1. Select the "toll gate" tool; use it to draw a gate
>> 2. During drawing you can use a DrawCommand to provide visual feedback;
>> when the gate is done you can invalidate the draw command and add the new
>> gate to the map blackboard. When the gate is done you can check if there is
>> a "toll gate" mapgraphic on the map and if not you can add it; if it is
>> already there you can refresh it
>> 3. Create a "toll gate" mapgraphic that draws the toll gate on the screen
>>
>> Is this correct? Are you really drawing a box for a toll gate; or do you
>> need to click and snap to the nearest layer?
>>
>>    1-> Which class I need to extend to write an extra layer? (I extended
>>> simple tool for calulate the distance in the example,there are methods like
>>> mouse dragged  and so on..) and I also needto do an reverse engine that
>>> means I will get the data from GPS (4 Coardinates)
>>> and I need to connect ther 4 coardinate and  display it
>>> automaticaly once I open the Map.
>>>
>>> Plese suggest me what would be the best way to do this.
>>>
>>> Any ideas will be appriciated.
>>>
>>> Thanks in advance
>>> Babu
>>>
>>>
>>>
>>> On Wed, Feb 25, 2009 at 10:51 AM, Jody Garnett 
>>> <[email protected]>wrote:
>>>
>>>> That sounds perfect; if you are intending to define a region of interest
>>>> then a region of interest tool is more explicit to both you and your user.
>>>> You should find that your tool can store the region of interest on the map
>>>> backboad; and then your other view etc can pick it up from there as needed.
>>>> The coordinate tool / coordinate map graphic example in tutorials show how
>>>> to do this; and it has been used by many other teams. The DIVAGIS team used
>>>> this techqniue to define a region of interest "grid" and then had a bunch 
>>>> of
>>>> operations build around doing analysis of the points that fell into each
>>>> grid square.
>>>>
>>>> Jody
>>>>
>>>>
>>>> On Tue, Feb 24, 2009 at 7:46 PM, Despres 
>>>> <[email protected]>wrote:
>>>>
>>>>>     Thanks for your help,
>>>>>
>>>>>
>>>>>
>>>>> The point is that the filter i get doesn’t contain a bounding box.
>>>>> Indeed, I may have only one or no rasters layer on the map.
>>>>>
>>>>> I think what I tried to do is impossible with the Bbox selection tool,
>>>>> so I developped my own Bbox tool. The goal is just to define a Region of
>>>>> Interest.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Damien
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>  ------------------------------
>>>>>
>>>>> *De :* [email protected] [mailto:
>>>>> [email protected]] *De la part de* Jody Garnett
>>>>> *Envoyé :* mardi 24 février 2009 06:08
>>>>> *À :* User-friendly Desktop Internet GIS
>>>>> *Objet :* Re: [udig-devel] BBoxSelection Listener
>>>>>
>>>>>
>>>>>
>>>>> The filter geneated by the BBoxSelectionCommand is available for you
>>>>> .... layer.getFilter().
>>>>>
>>>>>
>>>>> You can look at this data structure and get the bounding box if you
>>>>> like; altough the selection for a layer (ie the filter) is not always done
>>>>> as a bounding box.
>>>>>
>>>>> I hope this helps.
>>>>>
>>>>> If you need to listen to any random part of the
>>>>> project/map/layer/viewport model you can - the magic word you need to know
>>>>> is "adapters"; the best way to figure out how is to look at some of the
>>>>> existing add/remove listener implementations and watch how they translate 
>>>>> a
>>>>> Notification (ie what adapters "listen to") into a layer change event.
>>>>>
>>>>> I am still not sure if the various map changed, and layer changed
>>>>> events are worth while or if it would be easier just to use this
>>>>> Notification thing everywhere.
>>>>>
>>>>> Jody
>>>>>
>>>>>    On Wed, Feb 18, 2009 at 4:35 AM, Despres <
>>>>> [email protected]> wrote:
>>>>>
>>>>> Hi all,
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> I’m trying to develop a plug-in that could listen to the
>>>>> BBoxSelectionCommand and get the bbox that have been drawn by the user 
>>>>> with
>>>>> the bbox tool.
>>>>>
>>>>> I’ve tried to add a MapListener, I catch an event but it doesn’t help:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *activeMap*.addMapListener(*new* IMapListener(){
>>>>>
>>>>>             *public* *void* changed(MapEvent event)
>>>>>
>>>>>             {
>>>>>
>>>>>               System.*out*.println("change");
>>>>>
>>>>>               *if*(event.getType() == MapEvent.MapEventType.*
>>>>> MAP_COMMAND*){
>>>>>
>>>>>                 CommandManager val =
>>>>> (CommandManager)event.getNewValue();
>>>>>
>>>>>                 Object *old*=event.getOldValue();
>>>>>
>>>>>                 System.*out*.println(val.getMaxHistorySize());
>>>>>
>>>>>               }
>>>>>
>>>>>             }});
>>>>>
>>>>>               }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Thanks in advance for your help, I’m really lost here.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *DESPRES Damien*
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> User-friendly Desktop Internet GIS (uDig)
>>>>> http://udig.refractions.net
>>>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> User-friendly Desktop Internet GIS (uDig)
>>>>> http://udig.refractions.net
>>>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> User-friendly Desktop Internet GIS (uDig)
>>>> http://udig.refractions.net
>>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>>>
>>>>
>>>
>>> _______________________________________________
>>> User-friendly Desktop Internet GIS (uDig)
>>> http://udig.refractions.net
>>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>>
>>>
>>
>> _______________________________________________
>> User-friendly Desktop Internet GIS (uDig)
>> http://udig.refractions.net
>> http://lists.refractions.net/mailman/listinfo/udig-devel
>>
>>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
>
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to