How to set the area of interest
Create a new openMap4u instance (with the default settings).OpenMap4u oM4u = new OpenMap4u();
Create a rectangular drawing canvas with the given width (=4 cm) and height (=2 cm).
OverrideDrawOrWriteable myCanvas = oM4u.getCanvas(4.0, 4.0);
- Center of the drawing canvas in map units.
myCanvas.center(1.0,1.5);
- Scale of the drawing canvas.
myCanvas.scale(.5);
- Rotation of the drawing canvas angle units.
myCanvas.rotate(30);
myCanvas.draw(om4u.get(Text.class).text("Hello world!").center(2.0,2.0);
myCanvas.write("myText.png");
But wait you can do it much faster and simpler with the fluent builder pattern
new OpenMap4u().canvas(4.0,4.0).center(1.0,1.5).scale(0.5).rotate(30).draw(
om4u.get(Text.class).text("Hello world").center(0.5,0.25)
).write("myText.png");