"${yOffset}")))))),
pair("renderers",
new Object[] { "SVG", "VML", "Canvas" })));
Point point = new Point(-111.04, 45.68);
Feature pointFeature = new Vector(point, toMap(pair("name", "toto"),
pair("age", 20), pair("favColor", "red"), pair("align", "cm")));
// create a polygon feature from a linear ring of points
List<Point> pointList = new ArrayList<Point>();
for (int p = 0; p < 6; ++p) {
double a = p * (2 * Math.PI) / 7;
double r = Math.random() + 1;
Point newPoint = new Point(point.getX() + 5 + (r * Math.cos(a)),
point.getY() + 5 + (r * Math.sin(a)));
pointList.add(newPoint);
}
pointList.add(pointList.get(0));
LinearRing linearRing = new LinearRing(pointList);
Vector polygonFeature = new Vector(new Polygon(
Arrays.asList(linearRing)), toMap(pair("name", "dude"),
pair("age", 21), pair("favColor", "purple"),
pair("align", "lb")));
Vector multiFeature = new Vector(new Collection(Arrays.asList(
new LineString(Arrays.asList(new Point(-105, 40.0), new Point(
-95, 45.0))), new Point(-105, 40))), toMap(
pair("name", "ball-and-chain"), pair("age", 30),
pair("favColor", "black"), pair("align", "rt")));
// Create a point feature to show the label offset options
Point labelOffsetPoint = new Point(-101.04, 35.68);
Vector labelOffsetFeature = new Vector(labelOffsetPoint, toMap(
pair("name", "offset"), pair("age", 22),
pair("favColor", "blue"), pair("align", "cm"),
// positive value moves the label to the right
pair("xOffset", 50),
// negative value moves the label down
pair("xOffset", -15)));
Vector nullFeature = new Vector(null, toMap(
pair("name", "toto is some text about the world"),
pair("age", 20), pair("favColor", "red"), pair("align", "cm")));
map.addLayer(vectorLayer);
vectorLayer.drawFeature(multiFeature);
map.setCenter(new LonLat(-109.370078125, 43.39484375), 4);