Good afternoon guys I was looking at the code of this page:
http://udig.refractions.net/confluence/display/DEV/Providing+Visual+Feedback+from+a+Viewmy
doubts is when I call the command I have to draw MapGraphicContext
pass
an object as I take this object on the map I'm working?

I'll paste the code down here

public void draw( MapGraphicContext context ) {

//initialize the graphics handle
ViewportGraphics g = context.getGraphics();
g.setColor(Color.BLACK);
g.setStroke(ViewportGraphics.LINE_SOLID, 1);

//get the map blackboard
IMap map = context.getLayer().getMap();
IBlackboard blackboard = map.getBlackboard();

List<Coordinate> coordinates = (List<Coordinate>) blackboard.get("route");

if (coordinates == null) {
return; //no coordinates to draw
}

MathTransform data2world = CRS.findMathTransform(
DefaultGeographicCRS.WGS84, context.getCRS() );

for (Coordinate coordinate : coordinates) {
Ellipse2D e = new Ellipse2D.Double(
coordinate.x-4,
coordinate.y-4,
10,10);
g.draw(e);
try {
Coordinate worldCoord = JTS.transform(coordinate, null, data2world );
Point point = context.worldToPixel(worldCoord);
g.drawOval( point.x-1, point.y-2, 3, 3);
} catch (TransformException e1) {
}
}
}
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to