Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Teemu Auvinen
dtek1066-toinen-ryhmis
Commits
80c9cd37
Commit
80c9cd37
authored
Jan 02, 2018
by
Matti Pulkkinen
Browse files
added comments
parent
a0c14355
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/fi/utu/dtek1066/MapDialog.java
View file @
80c9cd37
...
...
@@ -224,6 +224,7 @@ public class MapDialog extends JFrame {
public
void
run
()
{
URL
url
=
null
;
try
{
// TODO StringBuilder
url
=
new
URL
(
"http://demo.mapserver.org/cgi-bin/wms?SERVICE="
+
"WMS&VERSION=1.1.1&REQUEST=GetMap&BBOX="
+
MapDialog
.
this
.
westernLongitude
+
","
+
MapDialog
.
this
.
southernLatitude
+
","
+
MapDialog
.
this
.
easternLongitude
+
","
...
...
@@ -235,12 +236,18 @@ public class MapDialog extends JFrame {
e
.
printStackTrace
();
}
MapDialog
.
this
.
imageLabel
.
setIcon
(
new
ImageIcon
(
url
));
}
}
// run()
}.
start
();
}
// updateImage()
private
void
populateLayerList
()
throws
ParserConfigurationException
,
SAXException
,
IOException
,
MalformedURLException
{
/**
* Fetch the mapserver's capabilities and add their checkboxes to the left panel
*
* @throws ParserConfigurationException If the capability parser creation fails
* @throws SAXException If parsing the capabilities fails
* @throws IOException If any IO errors occur
*/
private
void
populateLayerList
()
throws
ParserConfigurationException
,
SAXException
,
IOException
{
DocumentBuilderFactory
factory
=
DocumentBuilderFactory
.
newInstance
();
DocumentBuilder
parser
=
factory
.
newDocumentBuilder
();
Document
document
=
parser
.
parse
(
new
URL
(
"http://demo.mapserver.org/cgi-bin/"
...
...
@@ -253,14 +260,22 @@ public class MapDialog extends JFrame {
String
title
=
layer
.
getElementsByTagName
(
"Title"
).
item
(
0
).
getTextContent
();
this
.
leftPanel
.
add
(
new
LayerCheckBox
(
name
,
title
,
(
i
==
0
)
?
true
:
false
));
}
}
}
// populateLayerList()
/**
* Updates the map focus coordinates according to the deltas provided.
*
* @param westDelta Difference in western longitude.
* @param eastDelta Difference in eastern longitude.
* @param southDelta Difference in southern latitude.
* @param northDelta Difference in northern latitude.
*/
private
synchronized
void
updateCoordinates
(
int
westDelta
,
int
eastDelta
,
int
southDelta
,
int
northDelta
)
{
this
.
westernLongitude
+=
westDelta
;
this
.
easternLongitude
+=
eastDelta
;
this
.
southernLatitude
+=
southDelta
;
this
.
northernLatitude
+=
northDelta
;
}
}
// updateCoordinates(int, int, int, int)
// Käyttöliittymän komponentit
}
// MapDialog
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment