1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<html>
<head>
<script src="../OLLoader.js"></script>
<script type="text/javascript">
var polygon;
var components = [new OpenLayers.Geometry.Point(10,10), new OpenLayers.Geometry.Point(0,0)];
var components2 = [new OpenLayers.Geometry.Point(10,10), new OpenLayers.Geometry.Point(0,0), new OpenLayers.Geometry.Point(10,0), new OpenLayers.Geometry.Point(10,10)];
var linearRing = new OpenLayers.Geometry.LinearRing(components);
var linearRing2 = new OpenLayers.Geometry.LinearRing(components2);
var polygon = new OpenLayers.Geometry.Polygon([linearRing]);
var polygon2 = new OpenLayers.Geometry.Polygon([linearRing2]);
function test_MultiPolygon_constructor (t) {
t.plan( 2 );
multipolygon = new OpenLayers.Geometry.MultiPolygon();
t.ok( multipolygon instanceof OpenLayers.Geometry.MultiPolygon, "new OpenLayers.Geometry.MultiPolygon returns multipolygon object" );
t.eq( multipolygon.CLASS_NAME, "OpenLayers.Geometry.MultiPolygon", "multipolygon.CLASS_NAME is set correctly");
}
function test_MultiPolygon_constructor (t) {
t.plan( 3 );
multipolygon = new OpenLayers.Geometry.MultiPolygon([polygon, polygon2]);
t.ok( multipolygon instanceof OpenLayers.Geometry.MultiPolygon, "new OpenLayers.Geometry.MultiPolygon returns multipolygon object" );
t.eq( multipolygon.CLASS_NAME, "OpenLayers.Geometry.MultiPolygon", "multipolygon.CLASS_NAME is set correctly");
t.eq( multipolygon.components.length, 2, "multipolygon.components.length is set correctly");
}
</script>
</head>
<body>
</body>
</html>
|