FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mapserver/mapscript/java/examples/RFC24.java at master · dufop/mapserver · GitHub
dufop
/
mapserver
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
mapserver
/
mapscript
/
java
/
examples
/
RFC24.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
147 lines (123 loc) · 3.97 KB
Breadcrumbs
mapserver
/
mapscript
/
java
/
examples
/
RFC24.java
Copy path
File metadata and controls
147 lines (123 loc) · 3.97 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import
edu
.
umn
.
gis
.
mapscript
.*;
/**
* <p>Title: Mapscript RFC24 tests.</p>
* <p>Description: Tests for RFC24 implementation. (http://mapserver.gis.umn.edu/development/rfc/ms-rfc-24/)</p>
* @author Umberto Nicoletti (umberto.nicoletti@gmail.com)
*/
public
class
RFC24
{
String
mapfile
;
public
static
void
main
(
String
[]
args
) {
new
RFC24
(
args
[
0
]).
run
();
}
public
RFC24
(
String
mapfile
) {
this
.
mapfile
=
mapfile
;
}
public
void
run
() {
System
.
out
.
println
(
"Running "
+
getClass
().
getName
());
testLayerObj
();
testClassObj
();
testInsertLayerObj
();
testInsertClassObj
();
testGetLayerObj
();
testGetLayerObjByName
();
testGetClassObj
();
testGetOutputformatObj
();
testInsertOutputformatObj
();
System
.
out
.
println
(
"Finished "
+
getClass
().
getName
());
}
public
void
testLayerObj
() {
mapObj
map
=
new
mapObj
(
mapfile
);
layerObj
newLayer
=
new
layerObj
(
map
);
map
=
null
;
gc
();
assertNotNull
(
newLayer
.
getMap
(),
"testLayerObj"
);
}
public
void
testInsertLayerObj
() {
mapObj
map
=
new
mapObj
(
mapfile
);
layerObj
newLayer
=
new
layerObj
(
null
);
map
.
insertLayer
(
newLayer
,-
1
);
map
=
null
;
gc
();
assertNotNull
(
newLayer
.
getMap
(),
"testInsertLayerObj"
);
}
public
void
testGetLayerObj
() {
mapObj
map
=
new
mapObj
(
mapfile
);
layerObj
newLayer
=
map
.
getLayer
(
1
);
map
=
null
;
gc
();
assertNotNull
(
newLayer
.
getMap
(),
"testGetLayerObj"
);
}
public
void
testGetLayerObjByName
() {
mapObj
map
=
new
mapObj
(
mapfile
);
layerObj
newLayer
=
map
.
getLayerByName
(
"POLYGON"
);
map
=
null
;
gc
();
assertNotNull
(
newLayer
.
getMap
(),
"testGetLayerObjByName"
);
}
public
void
testClassObj
() {
mapObj
map
=
new
mapObj
(
mapfile
);
layerObj
layer
=
map
.
getLayer
(
1
);
classObj
newClass
=
new
classObj
(
layer
);
map
=
null
;
layer
=
null
;
gc
();
assertNotNull
(
newClass
.
getLayer
(),
"testClassObj"
);
}
public
void
testInsertClassObj
() {
mapObj
map
=
new
mapObj
(
mapfile
);
layerObj
layer
=
map
.
getLayer
(
1
);
classObj
newClass
=
new
classObj
(
null
);
layer
.
insertClass
(
newClass
,-
1
);
map
=
null
;
layer
=
null
;
gc
();
assertNotNull
(
newClass
.
getLayer
(),
"testInsertClassObj"
);
}
public
void
testGetClassObj
() {
mapObj
map
=
new
mapObj
(
mapfile
);
layerObj
layer
=
map
.
getLayer
(
1
);
classObj
newClass
=
layer
.
getClass
(
0
);
map
=
null
;
layer
=
null
;
gc
();
assertNotNull
(
newClass
.
getLayer
(),
"testGetClassObj"
);
}
public
void
testGetOutputformatObj
() {
mapObj
map
=
new
mapObj
(
mapfile
);
outputFormatObj
format
=
null
;
for
(
int
i
=
0
;
i
<
map
.
getNumoutputformats
();
i
++) {
format
=
map
.
getOutputFormat
(
i
);
//System.out.println("["+i+"] Format name: "+format.getName());
}
map
=
null
;
gc
();
assertNotNull
(
format
.
getDriver
(),
"testGetOutputformatObj"
);
}
public
void
testInsertOutputformatObj
() {
mapObj
map
=
new
mapObj
(
mapfile
);
outputFormatObj
format
=
null
;
for
(
int
i
=
0
;
i
<
map
.
getNumoutputformats
();
i
++) {
format
=
map
.
getOutputFormat
(
i
);
// uncomment to see output
//System.out.println("["+i+"] Format name: "+format.getName() + " driver="+format.getDriver());
}
outputFormatObj
newFormat
=
new
outputFormatObj
(
"AGG/PNG"
,
"test/rfc24"
);
map
.
appendOutputFormat
(
newFormat
);
for
(
int
i
=
0
;
i
<
map
.
getNumoutputformats
();
i
++) {
format
=
map
.
getOutputFormat
(
i
);
// uncomment to see output
//System.out.println("["+i+"] Format name: "+format.getName());
}
map
.
draw
();
map
=
null
;
format
=
null
;
gc
();
assertNotNull
(
newFormat
.
getDriver
(),
"testInsertOutputformatObj"
);
}
public
void
gc
() {
for
(
int
i
=
0
;
i
<
10
;
i
++)
System
.
gc
();
}
public
void
assertNotNull
(
Object
object
,
String
test
) {
if
(
object
!=
null
)
System
.
out
.
println
(
"
\t
- "
+
test
+
" PASSED"
);
else
System
.
out
.
println
(
"
\t
- "
+
test
+
" FAILED"
);
}
}
Back
|
FazBrowse Home
|
New Git URL