Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] How to use MapGraphic to draw a graph

Hi,

I want to implement a zoom in/zoom out bar. It is something like the vertical bar in google maps. The map will be zoom in or out when users clicks on the bar.

I am trying to implement the net.refractions.udig.mapgraphic.MapGraphic interface to draw the bar. So I followed the net.refractions.udig.tutorials.mapgraphic example and created my own mapgraphic.

Firstly, I created ZoomBarMapGraphic class which implements MapGrahic

        public class ZoomBarMapGraphic implements MapGraphic{

              @Override
               public void draw(MapGraphicContext context) {
                     //draw the zoom bar here
               }
        }

Secondly, I added the class to the  extension point: net.refractions.udig.mapgraphic.mapgraphic
<extension
         point="net.refractions.udig.mapgraphic.mapgraphic">
      <mapGraphic
            class="net.refractions.udig.tutorials.customapp.ssds.ZoomBarMapGraphic"
            id="net.refractions.udig.tutorials.customapp.mapGraphic1">
      </mapGraphic>
   </extension>

And then, I try to run the application. But It didn't draw anything. Actually, the ZoomBarMapGraphic.draw(MapGraphicContext context) method is not called.

Do I miss anything here? Can anybody help me out of here?

Thank you in advance.

Derek

Back to the top