[jmapviewer] 07/14: Imported Upstream version 1.02+svn30322.notreally.1.02+dfsg1

David Paleino dapal at debian.org
Tue Mar 18 18:01:13 UTC 2014


This is an automated email from the git hooks/post-receive script.

dapal pushed a commit to branch master
in repository jmapviewer.

commit c0e0c94823f92490affa155140ce31eaccd6f55c
Author: David Paleino <dapal at debian.org>
Date:   Wed Mar 12 12:23:30 2014 +0100

    Imported Upstream version 1.02+svn30322.notreally.1.02+dfsg1
---
 .classpath                                         |   6 -
 .project                                           |  17 --
 .settings/org.eclipse.core.resources.prefs         |   3 -
 .settings/org.eclipse.jdt.core.prefs               | 280 ------------------
 .settings/org.eclipse.jdt.ui.prefs                 |   8 -
 Readme.txt                                         |  23 +-
 releases/1.0/JMapViewer-1.0-Source.zip             | Bin 99256 -> 0 bytes
 releases/1.0/JMapViewer-1.0.zip                    | Bin 222809 -> 0 bytes
 releases/1.01/JMapViewer-1.01-Source.zip           | Bin 99402 -> 0 bytes
 releases/1.01/JMapViewer-1.01.zip                  | Bin 222797 -> 0 bytes
 releases/1.02/JMapViewer-1.02-Source.zip           | Bin 99405 -> 0 bytes
 releases/1.02/JMapViewer-1.02.zip                  | Bin 222769 -> 0 bytes
 .../gui/jmapviewer/AbstractLayer.java              | 175 ++++++-----
 .../gui/jmapviewer/AttributionSupport.java         | 327 +++++++++++----------
 .../openstreetmap/gui/jmapviewer/Coordinate.java   |   3 +-
 .../gui/jmapviewer/DefaultMapController.java       |   3 +-
 src/org/openstreetmap/gui/jmapviewer/Demo.java     |   6 +-
 .../gui/jmapviewer/FeatureAdapter.java             | 127 ++++----
 .../gui/jmapviewer/JMapController.java             |   3 +-
 .../openstreetmap/gui/jmapviewer/JMapViewer.java   |  71 ++---
 .../gui/jmapviewer/JMapViewerTree.java             |   1 -
 .../gui/jmapviewer/JobDispatcher.java              |   3 +-
 src/org/openstreetmap/gui/jmapviewer/Layer.java    |   1 -
 .../openstreetmap/gui/jmapviewer/LayerGroup.java   |   1 -
 .../gui/jmapviewer/MapMarkerCircle.java            |   3 +-
 .../openstreetmap/gui/jmapviewer/MapMarkerDot.java |   3 +-
 .../gui/jmapviewer/MapObjectImpl.java              |   3 +-
 .../gui/jmapviewer/MapPolygonImpl.java             | 225 +++++++-------
 .../gui/jmapviewer/MapRectangleImpl.java           | 167 ++++++-----
 .../gui/jmapviewer/MemoryTileCache.java            |   3 +-
 .../gui/jmapviewer/OsmFileCacheTileLoader.java     |  18 +-
 .../openstreetmap/gui/jmapviewer/OsmMercator.java  |  27 +-
 .../gui/jmapviewer/OsmTileLoader.java              |   3 +-
 src/org/openstreetmap/gui/jmapviewer/Style.java    |   1 -
 src/org/openstreetmap/gui/jmapviewer/Tile.java     |   3 +-
 .../gui/jmapviewer/TileController.java             |   1 -
 .../jmapviewer/checkBoxTree/CheckBoxNodeData.java  |   1 -
 .../checkBoxTree/CheckBoxNodeEditor.java           |   1 -
 .../jmapviewer/checkBoxTree/CheckBoxNodePanel.java |   1 -
 .../checkBoxTree/CheckBoxNodeRenderer.java         |   1 -
 .../gui/jmapviewer/checkBoxTree/CheckBoxTree.java  |   1 -
 .../gui/jmapviewer/events/JMVCommandEvent.java     |  97 +++---
 .../gui/jmapviewer/interfaces/Attributed.java      | 101 +++----
 .../jmapviewer/interfaces/CachedTileLoader.java    |   2 +-
 .../gui/jmapviewer/interfaces/ICoordinate.java     |   1 -
 .../interfaces/JMapViewerEventListener.java        |  35 +--
 .../gui/jmapviewer/interfaces/MapMarker.java       |   5 +-
 .../gui/jmapviewer/interfaces/MapObject.java       |   1 -
 .../gui/jmapviewer/interfaces/MapPolygon.java      |  76 ++---
 .../gui/jmapviewer/interfaces/MapRectangle.java    |   3 +-
 .../gui/jmapviewer/interfaces/TileCache.java       |   3 +-
 .../jmapviewer/interfaces/TileClearController.java |   1 -
 .../gui/jmapviewer/interfaces/TileJob.java         |   3 +-
 .../gui/jmapviewer/interfaces/TileLoader.java      |   3 +-
 .../jmapviewer/interfaces/TileLoaderListener.java  |   3 +-
 .../gui/jmapviewer/interfaces/TileSource.java      |  53 +---
 .../tilesources/AbstractMapQuestTileSource.java    |   1 -
 .../tilesources/AbstractOsmTileSource.java         |   1 -
 .../tilesources/AbstractTMSTileSource.java         | 215 ++++++--------
 .../jmapviewer/tilesources/AbstractTileSource.java | 155 +++++-----
 .../tilesources/BingAerialTileSource.java          |   3 +-
 .../tilesources/MapQuestOpenAerialTileSource.java  |   1 -
 .../tilesources/MapQuestOsmTileSource.java         |   1 -
 .../gui/jmapviewer/tilesources/OsmTileSource.java  |   3 +-
 .../jmapviewer/tilesources/ScanexTileSource.java   |  83 ++----
 .../gui/jmapviewer/tilesources/TMSTileSource.java  |   8 +-
 .../tilesources/TemplatedTMSTileSource.java        |   1 -
 67 files changed, 1002 insertions(+), 1377 deletions(-)

diff --git a/.classpath b/.classpath
deleted file mode 100644
index d171cd4..0000000
--- a/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/.project b/.project
deleted file mode 100644
index b18095b..0000000
--- a/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>OSM</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 80b990a..0000000
--- a/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Wed Jul 16 10:49:16 CEST 2008
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 3408a14..0000000
--- a/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,280 +0,0 @@
-#Sun Jan 31 13:16:40 CET 2010
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=16
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=false
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=false
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=100
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=true
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=120
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index d6d3a9b..0000000
--- a/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Sun Jan 31 13:16:40 CET 2010
-eclipse.preferences.version=1
-formatter_profile=_JOSM
-formatter_settings_version=11
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
diff --git a/Readme.txt b/Readme.txt
index ef51e62..8ce68aa 100644
--- a/Readme.txt
+++ b/Readme.txt
@@ -1,23 +1,6 @@
 JMapViewer
 
-(c) 2007, Tim Haussmann
-(c) 2008-2012, Jan Peter Stotz
-(c) 2009-2013, Dirk Stöcker
-(c) 2009, Stefan Zeller
-(c) 2009, Karl Guggisberg
-(c) 2009, Dave Hansen
-(c) 2010-2011, Ian Dees
-(c) 2010-2011, Michael Vigovsky
-(c) 2011-2013, Paul Hartmann
-(c) 2011-2014, Gleb Smirnoff
-(c) 2011-2014, Vincent Privat
-(c) 2011, Jason Huntley
-(c) 2012, Simon Legner
-(c) 2012, Teemu Koskinen
-(c) 2012, Jiri Klement
-(c) 2013, Matt Hoover
-(c) 2013, Alexei Kasatkin
-(c) 2013, Galo Higueras
+(c) 2008 Jan Peter Stotz and others
 
 This work bases partly on the JOSM plugin "Slippy Map Chooser" by Tim Haussmann
 
@@ -39,5 +22,5 @@ Therefore any application using JMapViewer requires a working Internet connectio
 3. How do I use JMapViewer in my application?
 
 You can just create an instance of the class org.openstreetmap.gui.jmapviewer.JMapViewer
-using the default constructor and add it to your panel/frame/windows.
-For more details please see the Demo class in the same package.
+using the default constructor and add it to your panel/frame/windows.  
+For more details please see the Demo class in the same package.  
\ No newline at end of file
diff --git a/releases/1.0/JMapViewer-1.0-Source.zip b/releases/1.0/JMapViewer-1.0-Source.zip
deleted file mode 100644
index eed7909..0000000
Binary files a/releases/1.0/JMapViewer-1.0-Source.zip and /dev/null differ
diff --git a/releases/1.0/JMapViewer-1.0.zip b/releases/1.0/JMapViewer-1.0.zip
deleted file mode 100644
index f0b0ba9..0000000
Binary files a/releases/1.0/JMapViewer-1.0.zip and /dev/null differ
diff --git a/releases/1.01/JMapViewer-1.01-Source.zip b/releases/1.01/JMapViewer-1.01-Source.zip
deleted file mode 100644
index e67f77b..0000000
Binary files a/releases/1.01/JMapViewer-1.01-Source.zip and /dev/null differ
diff --git a/releases/1.01/JMapViewer-1.01.zip b/releases/1.01/JMapViewer-1.01.zip
deleted file mode 100644
index 99a89d8..0000000
Binary files a/releases/1.01/JMapViewer-1.01.zip and /dev/null differ
diff --git a/releases/1.02/JMapViewer-1.02-Source.zip b/releases/1.02/JMapViewer-1.02-Source.zip
deleted file mode 100644
index 241110f..0000000
Binary files a/releases/1.02/JMapViewer-1.02-Source.zip and /dev/null differ
diff --git a/releases/1.02/JMapViewer-1.02.zip b/releases/1.02/JMapViewer-1.02.zip
deleted file mode 100644
index 6536932..0000000
Binary files a/releases/1.02/JMapViewer-1.02.zip and /dev/null differ
diff --git a/src/org/openstreetmap/gui/jmapviewer/AbstractLayer.java b/src/org/openstreetmap/gui/jmapviewer/AbstractLayer.java
index 1691032..49b41ff 100644
--- a/src/org/openstreetmap/gui/jmapviewer/AbstractLayer.java
+++ b/src/org/openstreetmap/gui/jmapviewer/AbstractLayer.java
@@ -1,88 +1,87 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class AbstractLayer {
-    private LayerGroup parent;
-    private String name;
-    private String description;
-    private Style style;
-    private Boolean visible;
-    private Boolean visibleTexts=true;
-
-    public AbstractLayer(String name){
-        this(name, (String)null);
-    }
-    public AbstractLayer(String name, String description){
-        this(name, description, MapMarkerCircle.getDefaultStyle());
-    }
-    public AbstractLayer(String name, Style style){
-        this(name, null, style);
-    }
-    public AbstractLayer(String name, String description, Style style){
-        this(null, name, description, style);
-    }
-    public AbstractLayer(LayerGroup parent, String name){
-        this(parent, name, MapMarkerCircle.getDefaultStyle());
-    }
-    public AbstractLayer(LayerGroup parent, String name, Style style){
-        this(parent, name, null, style);
-    }
-    public AbstractLayer(LayerGroup parent, String name, String description, Style style){
-        setParent(parent);
-        setName(name);
-        setDescription(description);
-        setStyle(style);
-        setVisible(true);
-
-        if(parent!=null) parent.add(this);
-    }
-    public LayerGroup getParent() {
-        return parent;
-    }
-    public void setParent(LayerGroup parent) {
-        this.parent = parent;
-    }
-    public String getName() {
-        return name;
-    }
-    public void setName(String name) {
-        this.name = name;
-    }
-    public String getDescription() {
-        return description;
-    }
-    public void setDescription(String description) {
-        this.description = description;
-    }
-    public Style getStyle() {
-        return style;
-    }
-    public void setStyle(Style style) {
-        this.style = style;
-    }
-    public Boolean isVisible() {
-        return visible;
-    }
-    public void setVisible(Boolean visible) {
-        this.visible = visible;
-    }
-    public static <E> List<E> add(List<E> list, E element) {
-        if(element!=null){
-            if(list==null) list = new ArrayList<E>();
-            if(!list.contains(element)) list.add(element);
-        }
-        return list;
-    }
-    public Boolean isVisibleTexts() {
-        return visibleTexts;
-    }
-    public void setVisibleTexts(Boolean visibleTexts) {
-        this.visibleTexts = visibleTexts;
-    }
-    public String toString(){
-        return name;
-    }
-}
+package org.openstreetmap.gui.jmapviewer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AbstractLayer {
+    private LayerGroup parent;
+    private String name;
+    private String description;
+    private Style style;
+    private Boolean visible;
+    private Boolean visibleTexts=true;
+    
+    public AbstractLayer(String name){
+        this(name, (String)null);
+    }
+    public AbstractLayer(String name, String description){
+        this(name, description, MapMarkerCircle.getDefaultStyle());
+    }
+    public AbstractLayer(String name, Style style){
+        this(name, null, style);
+    }
+    public AbstractLayer(String name, String description, Style style){
+        this(null, name, description, style);
+    }
+    public AbstractLayer(LayerGroup parent, String name){
+        this(parent, name, MapMarkerCircle.getDefaultStyle());
+    }
+    public AbstractLayer(LayerGroup parent, String name, Style style){
+        this(parent, name, null, style);
+    }
+    public AbstractLayer(LayerGroup parent, String name, String description, Style style){
+        setParent(parent);
+        setName(name);
+        setDescription(description);
+        setStyle(style);
+        setVisible(true);
+
+        if(parent!=null) parent.add(this);
+    }
+    public LayerGroup getParent() {
+        return parent;
+    }
+    public void setParent(LayerGroup parent) {
+        this.parent = parent;
+    }
+    public String getName() {
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getDescription() {
+        return description;
+    }
+    public void setDescription(String description) {
+        this.description = description;
+    }
+    public Style getStyle() {
+        return style;
+    }
+    public void setStyle(Style style) {
+        this.style = style;
+    }
+    public Boolean isVisible() {
+        return visible;
+    }
+    public void setVisible(Boolean visible) {
+        this.visible = visible;
+    }
+    public static <E> List<E> add(List<E> list, E element) {
+        if(element!=null){
+            if(list==null) list = new ArrayList<E>();
+            if(!list.contains(element)) list.add(element);
+        }
+        return list;
+    }
+    public Boolean isVisibleTexts() {
+        return visibleTexts;
+    }
+    public void setVisibleTexts(Boolean visibleTexts) {
+        this.visibleTexts = visibleTexts;
+    }
+    public String toString(){
+        return name;
+    }
+}
diff --git a/src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java b/src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java
index 261632e..62d01e7 100644
--- a/src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java
+++ b/src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java
@@ -1,163 +1,164 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer;
-
-import static org.openstreetmap.gui.jmapviewer.FeatureAdapter.tr;
-
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.Image;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.font.TextAttribute;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.ImageObserver;
-import java.util.HashMap;
-
-import org.openstreetmap.gui.jmapviewer.interfaces.Attributed;
-
-public class AttributionSupport {
-
-    private Attributed source;
-
-    private Image attrImage;
-    private String attrTermsText;
-    private String attrTermsUrl;
-    public static final Font ATTR_FONT = new Font("Arial", Font.PLAIN, 10);
-    public static final Font ATTR_LINK_FONT;
-
-    protected Rectangle attrTextBounds = null;
-    protected Rectangle attrToUBounds = null;
-    protected Rectangle attrImageBounds = null;
-
-    static {
-        HashMap<TextAttribute, Integer> aUnderline = new HashMap<TextAttribute, Integer>();
-        aUnderline.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
-        ATTR_LINK_FONT = ATTR_FONT.deriveFont(aUnderline);
-    }
-
-    public void initialize(Attributed source) {
-        this.source = source;
-        boolean requireAttr = source.requiresAttribution();
-        if (requireAttr) {
-            attrImage = source.getAttributionImage();
-            attrTermsText = source.getTermsOfUseText();
-            attrTermsUrl = source.getTermsOfUseURL();
-            if (attrTermsUrl != null && attrTermsText == null) {
-                attrTermsText = tr("Background Terms of Use");
-            }
-        } else {
-            attrImage = null;
-            attrTermsUrl = null;
-        }
-    }
-
-    public void paintAttribution(Graphics g, int width, int height, Coordinate topLeft, Coordinate bottomRight, int zoom, ImageObserver observer) {
-        if (source == null || !source.requiresAttribution()) {
-            attrToUBounds = null;
-            attrImageBounds = null;
-            attrTextBounds = null;
-            return;
-        }
-
-        // Draw attribution
-        Font font = g.getFont();
-        g.setFont(ATTR_LINK_FONT);
-
-        // Draw terms of use text
-        int termsTextHeight = 0;
-        int termsTextY = height;
-
-        if (attrTermsText != null) {
-            Rectangle2D termsStringBounds = g.getFontMetrics().getStringBounds(attrTermsText, g);
-            int textRealHeight = (int) termsStringBounds.getHeight();
-            termsTextHeight = textRealHeight - 5;
-            int termsTextWidth = (int) termsStringBounds.getWidth();
-            termsTextY = height - termsTextHeight;
-            int x = 2;
-            int y = height - termsTextHeight;
-            attrToUBounds = new Rectangle(x, y-termsTextHeight, termsTextWidth, textRealHeight);
-            g.setColor(Color.black);
-            g.drawString(attrTermsText, x + 1, y + 1);
-            g.setColor(Color.white);
-            g.drawString(attrTermsText, x, y);
-        } else {
-            attrToUBounds = null;
-        }
-
-        // Draw attribution logo
-        if (attrImage != null) {
-            int x = 2;
-            int imgWidth = attrImage.getWidth(observer);
-            int imgHeight = attrImage.getHeight(observer);
-            int y = termsTextY - imgHeight - termsTextHeight - 5;
-            attrImageBounds = new Rectangle(x, y, imgWidth, imgHeight);
-            g.drawImage(attrImage, x, y, null);
-        } else {
-            attrImageBounds = null;
-        }
-
-        g.setFont(ATTR_FONT);
-        String attributionText = source.getAttributionText(zoom, topLeft, bottomRight);
-        if (attributionText != null) {
-            Rectangle2D stringBounds = g.getFontMetrics().getStringBounds(attributionText, g);
-            int textHeight = (int) stringBounds.getHeight() - 5;
-            int x = width - (int) stringBounds.getWidth();
-            int y = height - textHeight;
-            g.setColor(Color.black);
-            g.drawString(attributionText, x + 1, y + 1);
-            g.setColor(Color.white);
-            g.drawString(attributionText, x, y);
-            attrTextBounds = new Rectangle(x, y-textHeight, (int) stringBounds.getWidth(), (int) stringBounds.getHeight());
-        } else {
-            attrTextBounds = null;
-        }
-
-        g.setFont(font);
-    }
-
-    public boolean handleAttributionCursor(Point p) {
-        if (attrTextBounds != null && attrTextBounds.contains(p)) {
-            return true;
-        } else if (attrImageBounds != null && attrImageBounds.contains(p)) {
-            return true;
-        } else if (attrToUBounds != null && attrToUBounds.contains(p)) {
-            return true;
-        }
-        return false;
-    }
-
-    public boolean handleAttribution(Point p, boolean click) {
-        if (source == null || !source.requiresAttribution())
-            return false;
-
-        if (attrTextBounds != null && attrTextBounds.contains(p)) {
-            String attributionURL = source.getAttributionLinkURL();
-            if (attributionURL != null) {
-                if (click) {
-                    FeatureAdapter.openLink(attributionURL);
-                }
-                return true;
-            }
-        } else if (attrImageBounds != null && attrImageBounds.contains(p)) {
-            String attributionImageURL = source.getAttributionImageURL();
-            if (attributionImageURL != null) {
-                if (click) {
-                    FeatureAdapter.openLink(source.getAttributionImageURL());
-                }
-                return true;
-            }
-        } else if (attrToUBounds != null && attrToUBounds.contains(p)) {
-            String termsOfUseURL = source.getTermsOfUseURL();
-            if (termsOfUseURL != null) {
-                if (click) {
-                    FeatureAdapter.openLink(termsOfUseURL);
-                }
-                return true;
-            }
-        }
-        return false;
-    }
-
-}
-
+package org.openstreetmap.gui.jmapviewer;
+
+//License: GPL.
+
+import static org.openstreetmap.gui.jmapviewer.FeatureAdapter.tr;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.font.TextAttribute;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.ImageObserver;
+import java.util.HashMap;
+
+import org.openstreetmap.gui.jmapviewer.interfaces.Attributed;
+
+public class AttributionSupport {
+
+    private Attributed source;
+
+    private Image attrImage;
+    private String attrTermsText;
+    private String attrTermsUrl;
+    public static final Font ATTR_FONT = new Font("Arial", Font.PLAIN, 10);
+    public static final Font ATTR_LINK_FONT;
+
+    protected Rectangle attrTextBounds = null;
+    protected Rectangle attrToUBounds = null;
+    protected Rectangle attrImageBounds = null;
+
+    static {
+        HashMap<TextAttribute, Integer> aUnderline = new HashMap<TextAttribute, Integer>();
+        aUnderline.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
+        ATTR_LINK_FONT = ATTR_FONT.deriveFont(aUnderline);
+    }
+
+    public void initialize(Attributed source) {
+        this.source = source;
+        boolean requireAttr = source.requiresAttribution();
+        if (requireAttr) {
+            attrImage = source.getAttributionImage();
+            attrTermsText = source.getTermsOfUseText();
+            attrTermsUrl = source.getTermsOfUseURL();
+            if (attrTermsUrl != null && attrTermsText == null) {
+                attrTermsText = tr("Background Terms of Use");
+            }
+        } else {
+            attrImage = null;
+            attrTermsUrl = null;
+        }
+    }
+
+    public void paintAttribution(Graphics g, int width, int height, Coordinate topLeft, Coordinate bottomRight, int zoom, ImageObserver observer) {
+        if (source == null || !source.requiresAttribution()) {
+            attrToUBounds = null;
+            attrImageBounds = null;
+            attrTextBounds = null;
+            return;
+        }
+
+        // Draw attribution
+        Font font = g.getFont();
+        g.setFont(ATTR_LINK_FONT);
+
+        // Draw terms of use text
+        int termsTextHeight = 0;
+        int termsTextY = height;
+
+        if (attrTermsText != null) {
+            Rectangle2D termsStringBounds = g.getFontMetrics().getStringBounds(attrTermsText, g);
+            int textRealHeight = (int) termsStringBounds.getHeight();
+            termsTextHeight = textRealHeight - 5;
+            int termsTextWidth = (int) termsStringBounds.getWidth();
+            termsTextY = height - termsTextHeight;
+            int x = 2;
+            int y = height - termsTextHeight;
+            attrToUBounds = new Rectangle(x, y-termsTextHeight, termsTextWidth, textRealHeight);
+            g.setColor(Color.black);
+            g.drawString(attrTermsText, x + 1, y + 1);
+            g.setColor(Color.white);
+            g.drawString(attrTermsText, x, y);
+        } else {
+            attrToUBounds = null;
+        }
+
+        // Draw attribution logo
+        if (attrImage != null) {
+            int x = 2;
+            int imgWidth = attrImage.getWidth(observer);
+            int imgHeight = attrImage.getHeight(observer);
+            int y = termsTextY - imgHeight - termsTextHeight - 5;
+            attrImageBounds = new Rectangle(x, y, imgWidth, imgHeight);
+            g.drawImage(attrImage, x, y, null);
+        } else {
+            attrImageBounds = null;
+        }
+
+        g.setFont(ATTR_FONT);
+        String attributionText = source.getAttributionText(zoom, topLeft, bottomRight);
+        if (attributionText != null) {
+            Rectangle2D stringBounds = g.getFontMetrics().getStringBounds(attributionText, g);
+            int textHeight = (int) stringBounds.getHeight() - 5;
+            int x = width - (int) stringBounds.getWidth();
+            int y = height - textHeight;
+            g.setColor(Color.black);
+            g.drawString(attributionText, x + 1, y + 1);
+            g.setColor(Color.white);
+            g.drawString(attributionText, x, y);
+            attrTextBounds = new Rectangle(x, y-textHeight, (int) stringBounds.getWidth(), (int) stringBounds.getHeight());
+        } else {
+            attrTextBounds = null;
+        }
+
+        g.setFont(font);
+    }
+
+    public boolean handleAttributionCursor(Point p) {
+        if (attrTextBounds != null && attrTextBounds.contains(p)) {
+            return true;
+        } else if (attrImageBounds != null && attrImageBounds.contains(p)) {
+            return true;
+        } else if (attrToUBounds != null && attrToUBounds.contains(p)) {
+            return true;
+        }
+        return false;
+    }
+
+    public boolean handleAttribution(Point p, boolean click) {
+        if (source == null || !source.requiresAttribution())
+            return false;
+
+        if (attrTextBounds != null && attrTextBounds.contains(p)) {
+            String attributionURL = source.getAttributionLinkURL();
+            if (attributionURL != null) {
+                if (click) {
+                    FeatureAdapter.openLink(attributionURL);
+                }
+                return true;
+            }
+        } else if (attrImageBounds != null && attrImageBounds.contains(p)) {
+            String attributionImageURL = source.getAttributionImageURL();
+            if (attributionImageURL != null) {
+                if (click) {
+                    FeatureAdapter.openLink(source.getAttributionImageURL());
+                }
+                return true;
+            }
+        } else if (attrToUBounds != null && attrToUBounds.contains(p)) {
+            String termsOfUseURL = source.getTermsOfUseURL();
+            if (termsOfUseURL != null) {
+                if (click) {
+                    FeatureAdapter.openLink(termsOfUseURL);
+                }
+                return true;
+            }
+        }
+        return false;
+    }
+
+}
+
diff --git a/src/org/openstreetmap/gui/jmapviewer/Coordinate.java b/src/org/openstreetmap/gui/jmapviewer/Coordinate.java
index d3803ce..f98338b 100644
--- a/src/org/openstreetmap/gui/jmapviewer/Coordinate.java
+++ b/src/org/openstreetmap/gui/jmapviewer/Coordinate.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2009 by Stefan Zeller
+
 import java.awt.geom.Point2D;
 import java.io.IOException;
 import java.io.ObjectInputStream;
diff --git a/src/org/openstreetmap/gui/jmapviewer/DefaultMapController.java b/src/org/openstreetmap/gui/jmapviewer/DefaultMapController.java
index a37929b..81b2e11 100644
--- a/src/org/openstreetmap/gui/jmapviewer/DefaultMapController.java
+++ b/src/org/openstreetmap/gui/jmapviewer/DefaultMapController.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.awt.Point;
 import java.awt.event.MouseEvent;
 import java.awt.event.MouseListener;
diff --git a/src/org/openstreetmap/gui/jmapviewer/Demo.java b/src/org/openstreetmap/gui/jmapviewer/Demo.java
index b8ff7bb..68c466b 100644
--- a/src/org/openstreetmap/gui/jmapviewer/Demo.java
+++ b/src/org/openstreetmap/gui/jmapviewer/Demo.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.awt.BorderLayout;
 import java.awt.Cursor;
 import java.awt.Point;
@@ -30,6 +31,7 @@ import org.openstreetmap.gui.jmapviewer.tilesources.MapQuestOsmTileSource;
 import org.openstreetmap.gui.jmapviewer.tilesources.OsmTileSource;
 
 /**
+ *
  * Demonstrates the usage of {@link JMapViewer}
  *
  * @author Jan Peter Stotz
@@ -204,7 +206,7 @@ public class Demo extends JFrame implements JMapViewerEventListener  {
         Layer wales = treeMap.addLayer("UK");
         map().addMapRectangle(new MapRectangleImpl(wales, "Wales", c(53.35,-4.57), c(51.64,-2.63)));
 
-        // map.setDisplayPosition(new Coordinate(49.807, 8.6), 11);
+        // map.setDisplayPositionByLatLon(49.807, 8.6, 11);
         // map.setTileGridVisible(true);
 
         map().addMouseListener(new MouseAdapter() {
diff --git a/src/org/openstreetmap/gui/jmapviewer/FeatureAdapter.java b/src/org/openstreetmap/gui/jmapviewer/FeatureAdapter.java
index b1e3fb4..83e6d37 100644
--- a/src/org/openstreetmap/gui/jmapviewer/FeatureAdapter.java
+++ b/src/org/openstreetmap/gui/jmapviewer/FeatureAdapter.java
@@ -1,63 +1,64 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer;
-
-import java.awt.Desktop;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.MessageFormat;
-
-public class FeatureAdapter {
-
-    public static interface BrowserAdapter {
-        void openLink(String url);
-    }
-
-    public static interface TranslationAdapter {
-        String tr(String text, Object... objects);
-        // TODO: more i18n functions
-    }
-
-    private static BrowserAdapter browserAdapter = new DefaultBrowserAdapter();
-    private static TranslationAdapter translationAdapter = new DefaultTranslationAdapter();
-
-    public static void registerBrowserAdapter(BrowserAdapter browserAdapter) {
-        FeatureAdapter.browserAdapter = browserAdapter;
-    }
-
-    public static void registerTranslationAdapter(TranslationAdapter translationAdapter) {
-        FeatureAdapter.translationAdapter = translationAdapter;
-    }
-
-    public static void openLink(String url) {
-        browserAdapter.openLink(url);
-    }
-
-    public static String tr(String text, Object... objects) {
-        return translationAdapter.tr(text, objects);
-    }
-
-    public static class DefaultBrowserAdapter implements BrowserAdapter {
-        @Override
-        public void openLink(String url) {
-            if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
-                try {
-                    Desktop.getDesktop().browse(new URI(url));
-                } catch (IOException e) {
-                    e.printStackTrace();
-                } catch (URISyntaxException e) {
-                    e.printStackTrace();
-                }
-            } else {
-                System.err.println(tr("Opening link not supported on current platform (''{0}'')", url));
-            }
-        }
-    }
-
-    public static class DefaultTranslationAdapter implements TranslationAdapter {
-        @Override
-        public String tr(String text, Object... objects) {
-            return MessageFormat.format(text, objects);
-        }
-    }
-}
+package org.openstreetmap.gui.jmapviewer;
+
+//License: GPL.
+
+import java.awt.Desktop;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.MessageFormat;
+
+public class FeatureAdapter {
+
+    public static interface BrowserAdapter {
+        void openLink(String url);
+    }
+
+    public static interface TranslationAdapter {
+        String tr(String text, Object... objects);
+        // TODO: more i18n functions
+    }
+
+    private static BrowserAdapter browserAdapter = new DefaultBrowserAdapter();
+    private static TranslationAdapter translationAdapter = new DefaultTranslationAdapter();
+
+    public static void registerBrowserAdapter(BrowserAdapter browserAdapter) {
+        FeatureAdapter.browserAdapter = browserAdapter;
+    }
+
+    public static void registerTranslationAdapter(TranslationAdapter translationAdapter) {
+        FeatureAdapter.translationAdapter = translationAdapter;
+    }
+
+    public static void openLink(String url) {
+        browserAdapter.openLink(url);
+    }
+
+    public static String tr(String text, Object... objects) {
+        return translationAdapter.tr(text, objects);
+    }
+
+    public static class DefaultBrowserAdapter implements BrowserAdapter {
+        @Override
+        public void openLink(String url) {
+            if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
+                try {
+                    Desktop.getDesktop().browse(new URI(url));
+                } catch (IOException e) {
+                    e.printStackTrace();
+                } catch (URISyntaxException e) {
+                    e.printStackTrace();
+                }
+            } else {
+                System.err.println(tr("Opening link not supported on current platform (''{0}'')", url));
+            }
+        }
+    }
+
+    public static class DefaultTranslationAdapter implements TranslationAdapter {
+        @Override
+        public String tr(String text, Object... objects) {
+            return MessageFormat.format(text, objects);
+        }
+    }
+}
diff --git a/src/org/openstreetmap/gui/jmapviewer/JMapController.java b/src/org/openstreetmap/gui/jmapviewer/JMapController.java
index 8de5300..63307f1 100644
--- a/src/org/openstreetmap/gui/jmapviewer/JMapController.java
+++ b/src/org/openstreetmap/gui/jmapviewer/JMapController.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.awt.event.MouseListener;
 import java.awt.event.MouseMotionListener;
 import java.awt.event.MouseWheelListener;
diff --git a/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java b/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
index 368a90f..dcce880 100644
--- a/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
+++ b/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.Graphics;
@@ -34,6 +35,7 @@ import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
 import org.openstreetmap.gui.jmapviewer.tilesources.OsmTileSource;
 
 /**
+ *
  * Provides a simple panel that displays pre-rendered map tiles loaded from the
  * OpenStreetMap project.
  *
@@ -86,7 +88,7 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
     }
     protected ZOOM_BUTTON_STYLE zoomButtonStyle;
 
-    protected TileSource tileSource;
+    private TileSource tileSource;
 
     protected AttributionSupport attribution = new AttributionSupport();
 
@@ -118,7 +120,7 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
         initializeZoomSlider();
         setMinimumSize(new Dimension(tileSource.getTileSize(), tileSource.getTileSize()));
         setPreferredSize(new Dimension(400, 400));
-        setDisplayPosition(new Coordinate(50, 9), 3);
+        setDisplayPositionByLatLon(50, 9, 3);
         //setToolTipText("");
     }
 
@@ -182,13 +184,15 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
      * Changes the map pane so that it is centered on the specified coordinate
      * at the given zoom level.
      *
-     * @param to
-     *            specified coordinate
+     * @param lat
+     *            latitude of the specified coordinate
+     * @param lon
+     *            longitude of the specified coordinate
      * @param zoom
-     *            {@link #MIN_ZOOM} <= zoom level <= {@link #MAX_ZOOM}
+     *            {@link #MIN_ZOOM} <= zoom level <= {@link #MAX_ZOOM}
      */
-    public void setDisplayPosition(Coordinate to, int zoom) {
-        setDisplayPosition(new Point(getWidth() / 2, getHeight() / 2), to, zoom);
+    public void setDisplayPositionByLatLon(double lat, double lon, int zoom) {
+        setDisplayPositionByLatLon(new Point(getWidth() / 2, getHeight() / 2), lat, lon, zoom);
     }
 
     /**
@@ -199,15 +203,17 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
      * @param mapPoint
      *            point on the map denoted in pixels where the coordinate should
      *            be set
-     * @param to
-     *            specified coordinate
+     * @param lat
+     *            latitude of the specified coordinate
+     * @param lon
+     *            longitude of the specified coordinate
      * @param zoom
-     *            {@link #MIN_ZOOM} <= zoom level <=
+     *            {@link #MIN_ZOOM} <= zoom level <=
      *            {@link TileSource#getMaxZoom()}
      */
-    public void setDisplayPosition(Point mapPoint, Coordinate to, int zoom) {
-        int x = tileSource.LonToX(to.getLon(), zoom);
-        int y = tileSource.LatToY(to.getLat(), zoom);
+    public void setDisplayPositionByLatLon(Point mapPoint, double lat, double lon, int zoom) {
+        int x = OsmMercator.LonToX(lon, zoom);
+        int y = OsmMercator.LatToY(lat, zoom);
         setDisplayPosition(mapPoint, x, y, zoom);
     }
 
@@ -264,8 +270,8 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
         if (markers) {
             for (MapMarker marker : mapMarkerList) {
                 if(marker.isVisible()){
-                    int x = tileSource.LonToX(marker.getLon(), mapZoomMax);
-                    int y = tileSource.LatToY(marker.getLat(), mapZoomMax);
+                    int x = OsmMercator.LonToX(marker.getLon(), mapZoomMax);
+                    int y = OsmMercator.LatToY(marker.getLat(), mapZoomMax);
                     x_max = Math.max(x_max, x);
                     y_max = Math.max(y_max, y);
                     x_min = Math.min(x_min, x);
@@ -277,10 +283,10 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
         if (rectangles) {
             for (MapRectangle rectangle : mapRectangleList) {
                 if(rectangle.isVisible()){
-                    x_max = Math.max(x_max, tileSource.LonToX(rectangle.getBottomRight().getLon(), mapZoomMax));
-                    y_max = Math.max(y_max, tileSource.LatToY(rectangle.getTopLeft().getLat(), mapZoomMax));
-                    x_min = Math.min(x_min, tileSource.LonToX(rectangle.getTopLeft().getLon(), mapZoomMax));
-                    y_min = Math.min(y_min, tileSource.LatToY(rectangle.getBottomRight().getLat(), mapZoomMax));
+                    x_max = Math.max(x_max, OsmMercator.LonToX(rectangle.getBottomRight().getLon(), mapZoomMax));
+                    y_max = Math.max(y_max, OsmMercator.LatToY(rectangle.getTopLeft().getLat(), mapZoomMax));
+                    x_min = Math.min(x_min, OsmMercator.LonToX(rectangle.getTopLeft().getLon(), mapZoomMax));
+                    y_min = Math.min(y_min, OsmMercator.LatToY(rectangle.getBottomRight().getLat(), mapZoomMax));
                 }
             }
         }
@@ -289,8 +295,8 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
             for (MapPolygon polygon : mapPolygonList) {
                 if(polygon.isVisible()){
                     for (ICoordinate c : polygon.getPoints()) {
-                        int x = tileSource.LonToX(c.getLon(), mapZoomMax);
-                        int y = tileSource.LatToY(c.getLat(), mapZoomMax);
+                        int x = OsmMercator.LonToX(c.getLon(), mapZoomMax);
+                        int y = OsmMercator.LatToY(c.getLat(), mapZoomMax);
                         x_max = Math.max(x_max, x);
                         y_max = Math.max(y_max, y);
                         x_min = Math.min(x_min, x);
@@ -364,8 +370,8 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
      * @return latitude / longitude
      */
     public Coordinate getPosition() {
-        double lon = tileSource.XToLon(center.x, zoom);
-        double lat = tileSource.YToLat(center.y, zoom);
+        double lon = OsmMercator.XToLon(center.x, zoom);
+        double lat = OsmMercator.YToLat(center.y, zoom);
         return new Coordinate(lat, lon);
     }
 
@@ -393,8 +399,8 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
     public Coordinate getPosition(int mapPointX, int mapPointY) {
         int x = center.x + mapPointX - getWidth() / 2;
         int y = center.y + mapPointY - getHeight() / 2;
-        double lon = tileSource.XToLon(x, zoom);
-        double lat = tileSource.YToLat(y, zoom);
+        double lon = OsmMercator.XToLon(x, zoom);
+        double lat = OsmMercator.YToLat(y, zoom);
         return new Coordinate(lat, lon);
     }
 
@@ -408,8 +414,8 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
      *         and checkOutside set to <code>true</code>
      */
     public Point getMapPosition(double lat, double lon, boolean checkOutside) {
-        int x = tileSource.LonToX(lon, zoom);
-        int y = tileSource.LatToY(lat, zoom);
+        int x = OsmMercator.LonToX(lon, zoom);
+        int y = OsmMercator.LatToY(lat, zoom);
         x -= center.x - getWidth() / 2;
         y -= center.y - getHeight() / 2;
         if (checkOutside) {
@@ -428,7 +434,7 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
      * @return Integer the radius in pixels
      */
     public Integer getLatOffset(double lat, double offset, boolean checkOutside) {
-        int y = tileSource.LatToY(lat+offset, zoom);
+        int y = OsmMercator.LatToY(lat+offset, zoom);
         y -= center.y - getHeight() / 2;
         if (checkOutside) {
             if (y < 0 || y > getHeight())
@@ -506,7 +512,7 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
         Coordinate originCoord=getPosition(origin);
         Coordinate centerCoord=getPosition(center);
 
-        double mDistance = tileSource.getDistance(originCoord.getLat(), originCoord.getLon(),
+        double mDistance=OsmMercator.getDistance(originCoord.getLat(), originCoord.getLon(),
                 centerCoord.getLat(), centerCoord.getLon());
 
         return mDistance/pDistance;
@@ -813,7 +819,7 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
         Coordinate zoomPos = getPosition(mapPoint);
         tileController.cancelOutstandingJobs(); // Clearing outstanding load
         // requests
-        setDisplayPosition(mapPoint, zoomPos, zoom);
+        setDisplayPositionByLatLon(mapPoint, zoomPos.getLat(), zoomPos.getLon(), zoom);
 
         this.fireJMVEvent(new JMVCommandEvent(COMMAND.ZOOM, this));
     }
@@ -955,7 +961,6 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
             throw new RuntimeException("Maximum zoom level too high");
         if (tileSource.getMinZoom() < MIN_ZOOM)
             throw new RuntimeException("Minumim zoom level too low");
-        Coordinate position = getPosition();
         this.tileSource = tileSource;
         tileController.setTileSource(tileSource);
         zoomSlider.setMinimum(tileSource.getMinZoom());
@@ -964,8 +969,8 @@ public class JMapViewer extends JPanel implements TileLoaderListener {
         if (zoom > tileSource.getMaxZoom()) {
             setZoom(tileSource.getMaxZoom());
         }
+
         attribution.initialize(tileSource);
-        setDisplayPosition(position, zoom);
         repaint();
     }
 
diff --git a/src/org/openstreetmap/gui/jmapviewer/JMapViewerTree.java b/src/org/openstreetmap/gui/jmapviewer/JMapViewerTree.java
index 472a620..38eeb57 100644
--- a/src/org/openstreetmap/gui/jmapviewer/JMapViewerTree.java
+++ b/src/org/openstreetmap/gui/jmapviewer/JMapViewerTree.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
 import java.awt.BorderLayout;
diff --git a/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java b/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java
index 1cc4754..9639c37 100644
--- a/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java
+++ b/src/org/openstreetmap/gui/jmapviewer/JobDispatcher.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.util.concurrent.BlockingDeque;
 import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.TimeUnit;
diff --git a/src/org/openstreetmap/gui/jmapviewer/Layer.java b/src/org/openstreetmap/gui/jmapviewer/Layer.java
index 5d73c39..18aff1f 100644
--- a/src/org/openstreetmap/gui/jmapviewer/Layer.java
+++ b/src/org/openstreetmap/gui/jmapviewer/Layer.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
 import java.util.List;
diff --git a/src/org/openstreetmap/gui/jmapviewer/LayerGroup.java b/src/org/openstreetmap/gui/jmapviewer/LayerGroup.java
index a27a348..04cffb3 100644
--- a/src/org/openstreetmap/gui/jmapviewer/LayerGroup.java
+++ b/src/org/openstreetmap/gui/jmapviewer/LayerGroup.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
 import java.util.List;
diff --git a/src/org/openstreetmap/gui/jmapviewer/MapMarkerCircle.java b/src/org/openstreetmap/gui/jmapviewer/MapMarkerCircle.java
index fb2276b..d7a2472 100644
--- a/src/org/openstreetmap/gui/jmapviewer/MapMarkerCircle.java
+++ b/src/org/openstreetmap/gui/jmapviewer/MapMarkerCircle.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.awt.AlphaComposite;
 import java.awt.Color;
 import java.awt.Composite;
diff --git a/src/org/openstreetmap/gui/jmapviewer/MapMarkerDot.java b/src/org/openstreetmap/gui/jmapviewer/MapMarkerDot.java
index b54e79a..4b55e4f 100644
--- a/src/org/openstreetmap/gui/jmapviewer/MapMarkerDot.java
+++ b/src/org/openstreetmap/gui/jmapviewer/MapMarkerDot.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.awt.Color;
 
 import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;
diff --git a/src/org/openstreetmap/gui/jmapviewer/MapObjectImpl.java b/src/org/openstreetmap/gui/jmapviewer/MapObjectImpl.java
index 2e9cd90..69b8b01 100644
--- a/src/org/openstreetmap/gui/jmapviewer/MapObjectImpl.java
+++ b/src/org/openstreetmap/gui/jmapviewer/MapObjectImpl.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
 import java.awt.Color;
@@ -99,7 +98,7 @@ public abstract class MapObjectImpl {
     public void paintText(Graphics g, Point position) {
         if(name!=null && g!=null && position!=null){
             if(getFont()==null){
-                Font f = getDefaultFont();
+                Font f = getDefaultFont(); // g.getFont();
                 setFont(new Font(f.getName(), Font.BOLD, f.getSize()));
             }
             g.setColor(Color.DARK_GRAY);
diff --git a/src/org/openstreetmap/gui/jmapviewer/MapPolygonImpl.java b/src/org/openstreetmap/gui/jmapviewer/MapPolygonImpl.java
index daf201b..4ea4515 100644
--- a/src/org/openstreetmap/gui/jmapviewer/MapPolygonImpl.java
+++ b/src/org/openstreetmap/gui/jmapviewer/MapPolygonImpl.java
@@ -1,105 +1,120 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer;
-
-import java.awt.AlphaComposite;
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Composite;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Point;
-import java.awt.Polygon;
-import java.awt.Rectangle;
-import java.awt.Stroke;
-import java.util.Arrays;
-import java.util.List;
-
-import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
-import org.openstreetmap.gui.jmapviewer.interfaces.MapPolygon;
-
-public class MapPolygonImpl extends MapObjectImpl implements MapPolygon {
-
-    private List<? extends ICoordinate> points;
-
-    public MapPolygonImpl(ICoordinate ... points) {
-        this(null, null, points);
-    }
-    public MapPolygonImpl(List<? extends ICoordinate> points) {
-        this(null, null, points);
-    }
-    public MapPolygonImpl(String name, List<? extends ICoordinate> points) {
-        this(null, name, points);
-    }
-    public MapPolygonImpl(String name, ICoordinate ... points) {
-        this(null, name, points);
-    }
-    public MapPolygonImpl(Layer layer, List<? extends ICoordinate> points) {
-        this(layer, null, points);
-    }
-    public MapPolygonImpl(Layer layer, String name, List<? extends ICoordinate> points) {
-        this(layer, name, points, getDefaultStyle());
-    }
-    public MapPolygonImpl(Layer layer, String name, ICoordinate ... points) {
-        this(layer, name, Arrays.asList(points), getDefaultStyle());
-    }
-    public MapPolygonImpl(Layer layer, String name, List<? extends ICoordinate> points, Style style) {
-        super(layer, name, style);
-        this.points = points;
-    }
-
-    @Override
-    public List<? extends ICoordinate> getPoints() {
-        return this.points;
-    }
-
-    @Override
-    public void paint(Graphics g, List<Point> points) {
-        Polygon polygon = new Polygon();
-        for (Point p : points) {
-            polygon.addPoint(p.x, p.y);
-        }
-        paint(g, polygon);
-    }
-
-    @Override
-    public void paint(Graphics g, Polygon polygon) {
-        // Prepare graphics
-        Color oldColor = g.getColor();
-        g.setColor(getColor());
-
-        Stroke oldStroke = null;
-        if (g instanceof Graphics2D) {
-            Graphics2D g2 = (Graphics2D) g;
-            oldStroke = g2.getStroke();
-            g2.setStroke(getStroke());
-        }
-        // Draw
-        g.drawPolygon(polygon);
-        if (g instanceof Graphics2D && getBackColor()!=null) {
-            Graphics2D g2 = (Graphics2D) g;
-            Composite oldComposite = g2.getComposite();
-            g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
-            g2.setPaint(getBackColor());
-            g2.fillPolygon(polygon);
-            g2.setComposite(oldComposite);
-        }
-        // Restore graphics
-        g.setColor(oldColor);
-        if (g instanceof Graphics2D) {
-            ((Graphics2D) g).setStroke(oldStroke);
-        }
-        Rectangle rec = polygon.getBounds();
-        Point corner = rec.getLocation();
-        Point p= new Point(corner.x+(rec.width/2), corner.y+(rec.height/2));
-        if(getLayer()==null||getLayer().isVisibleTexts()) paintText(g, p);
-    }
-
-    public static Style getDefaultStyle(){
-        return new Style(Color.BLUE, new Color(100,100,100,50), new BasicStroke(2), getDefaultFont());
-    }
-
-    @Override
-    public String toString() {
-        return "MapPolygon [points=" + points + "]";
-    }
-}
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.gui.jmapviewer;
+
+import java.awt.AlphaComposite;
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Composite;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.Stroke;
+import java.util.Arrays;
+import java.util.List;
+
+import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
+import org.openstreetmap.gui.jmapviewer.interfaces.MapPolygon;
+
+/**
+ * @author Vincent
+ *
+ */
+public class MapPolygonImpl extends MapObjectImpl implements MapPolygon {
+
+    private List<? extends ICoordinate> points;
+
+    public MapPolygonImpl(ICoordinate ... points) {
+        this(null, null, points);
+    }
+    public MapPolygonImpl(List<? extends ICoordinate> points) {
+        this(null, null, points);
+    }
+    public MapPolygonImpl(String name, List<? extends ICoordinate> points) {
+        this(null, name, points);
+    }
+    public MapPolygonImpl(String name, ICoordinate ... points) {
+        this(null, name, points);
+    }
+    public MapPolygonImpl(Layer layer, List<? extends ICoordinate> points) {
+        this(layer, null, points);
+    }
+    public MapPolygonImpl(Layer layer, String name, List<? extends ICoordinate> points) {
+        this(layer, name, points, getDefaultStyle());
+    }
+    public MapPolygonImpl(Layer layer, String name, ICoordinate ... points) {
+        this(layer, name, Arrays.asList(points), getDefaultStyle());
+    }
+    public MapPolygonImpl(Layer layer, String name, List<? extends ICoordinate> points, Style style) {
+        super(layer, name, style);
+        this.points = points;
+    }
+
+    /* (non-Javadoc)
+     * @see org.openstreetmap.gui.jmapviewer.interfaces.MapPolygon#getPoints()
+     */
+    @Override
+    public List<? extends ICoordinate> getPoints() {
+        return this.points;
+    }
+
+    /* (non-Javadoc)
+     * @see org.openstreetmap.gui.jmapviewer.interfaces.MapPolygon#paint(java.awt.Graphics, java.util.List)
+     */
+    @Override
+    public void paint(Graphics g, List<Point> points) {
+        Polygon polygon = new Polygon();
+        for (Point p : points) {
+            polygon.addPoint(p.x, p.y);
+        }
+        paint(g, polygon);
+    }
+
+    /* (non-Javadoc)
+     * @see org.openstreetmap.gui.jmapviewer.interfaces.MapPolygon#paint(java.awt.Graphics, java.awt.Polygon)
+     */
+    @Override
+    public void paint(Graphics g, Polygon polygon) {
+        // Prepare graphics
+        Color oldColor = g.getColor();
+        g.setColor(getColor());
+
+        Stroke oldStroke = null;
+        if (g instanceof Graphics2D) {
+            Graphics2D g2 = (Graphics2D) g;
+            oldStroke = g2.getStroke();
+            g2.setStroke(getStroke());
+        }
+        // Draw
+        g.drawPolygon(polygon);
+        if (g instanceof Graphics2D && getBackColor()!=null) {
+            Graphics2D g2 = (Graphics2D) g;
+            Composite oldComposite = g2.getComposite();
+            g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
+            g2.setPaint(getBackColor());
+            g2.fillPolygon(polygon);
+            g2.setComposite(oldComposite);
+        }
+        // Restore graphics
+        g.setColor(oldColor);
+        if (g instanceof Graphics2D) {
+            ((Graphics2D) g).setStroke(oldStroke);
+        }
+        Rectangle rec = polygon.getBounds();
+        Point corner = rec.getLocation();
+        Point p= new Point(corner.x+(rec.width/2), corner.y+(rec.height/2));
+        if(getLayer()==null||getLayer().isVisibleTexts()) paintText(g, p);
+    }
+
+    public static Style getDefaultStyle(){
+        return new Style(Color.BLUE, new Color(100,100,100,50), new BasicStroke(2), getDefaultFont());
+    }
+    /* (non-Javadoc)
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return "MapPolygon [points=" + points + "]";
+    }
+}
diff --git a/src/org/openstreetmap/gui/jmapviewer/MapRectangleImpl.java b/src/org/openstreetmap/gui/jmapviewer/MapRectangleImpl.java
index 51c8b33..08bc7d3 100644
--- a/src/org/openstreetmap/gui/jmapviewer/MapRectangleImpl.java
+++ b/src/org/openstreetmap/gui/jmapviewer/MapRectangleImpl.java
@@ -1,78 +1,89 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Point;
-import java.awt.Stroke;
-
-import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle;
-
-public class MapRectangleImpl extends MapObjectImpl implements MapRectangle {
-
-    private Coordinate topLeft;
-    private Coordinate bottomRight;
-
-    public MapRectangleImpl(Coordinate topLeft, Coordinate bottomRight) {
-        this(null, null, topLeft, bottomRight);
-    }
-    public MapRectangleImpl(String name, Coordinate topLeft, Coordinate bottomRight) {
-        this(null, name, topLeft, bottomRight);
-    }
-    public MapRectangleImpl(Layer layer, Coordinate topLeft, Coordinate bottomRight) {
-        this(layer, null, topLeft, bottomRight);
-    }
-    public MapRectangleImpl(Layer layer, String name, Coordinate topLeft, Coordinate bottomRight) {
-        this(layer, name, topLeft, bottomRight, getDefaultStyle());
-    }
-    public MapRectangleImpl(Layer layer, String name, Coordinate topLeft, Coordinate bottomRight, Style style) {
-        super(layer, name, style);
-        this.topLeft = topLeft;
-        this.bottomRight = bottomRight;
-    }
-
-    @Override
-    public Coordinate getTopLeft() {
-        return topLeft;
-    }
-
-    @Override
-    public Coordinate getBottomRight() {
-        return bottomRight;
-    }
-
-    @Override
-    public void paint(Graphics g, Point topLeft, Point bottomRight) {
-        // Prepare graphics
-        Color oldColor = g.getColor();
-        g.setColor(getColor());
-        Stroke oldStroke = null;
-        if (g instanceof Graphics2D) {
-            Graphics2D g2 = (Graphics2D) g;
-            oldStroke = g2.getStroke();
-            g2.setStroke(getStroke());
-        }
-        // Draw
-        g.drawRect(topLeft.x, topLeft.y, bottomRight.x - topLeft.x, bottomRight.y - topLeft.y);
-        // Restore graphics
-        g.setColor(oldColor);
-        if (g instanceof Graphics2D) {
-            ((Graphics2D) g).setStroke(oldStroke);
-        }
-        int width=bottomRight.x-topLeft.x;
-        int height=bottomRight.y-topLeft.y;
-        Point p= new Point(topLeft.x+(width/2), topLeft.y+(height/2));
-        if(getLayer()==null||getLayer().isVisibleTexts()) paintText(g, p);
-    }
-
-    public static Style getDefaultStyle(){
-        return new Style(Color.BLUE, null, new BasicStroke(2), getDefaultFont());
-    }
-
-    @Override
-    public String toString() {
-        return "MapRectangle from " + getTopLeft() + " to " + getBottomRight();
-    }
-}
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.gui.jmapviewer;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Stroke;
+
+import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle;
+
+/**
+ * @author Vincent
+ *
+ */
+public class MapRectangleImpl extends MapObjectImpl implements MapRectangle {
+
+    private Coordinate topLeft;
+    private Coordinate bottomRight;
+
+    public MapRectangleImpl(Coordinate topLeft, Coordinate bottomRight) {
+        this(null, null, topLeft, bottomRight);
+    }
+    public MapRectangleImpl(String name, Coordinate topLeft, Coordinate bottomRight) {
+        this(null, name, topLeft, bottomRight);
+    }
+    public MapRectangleImpl(Layer layer, Coordinate topLeft, Coordinate bottomRight) {
+        this(layer, null, topLeft, bottomRight);
+    }
+    public MapRectangleImpl(Layer layer, String name, Coordinate topLeft, Coordinate bottomRight) {
+        this(layer, name, topLeft, bottomRight, getDefaultStyle());
+    }
+    public MapRectangleImpl(Layer layer, String name, Coordinate topLeft, Coordinate bottomRight, Style style) {
+        super(layer, name, style);
+        this.topLeft = topLeft;
+        this.bottomRight = bottomRight;
+    }
+
+    /* (non-Javadoc)
+     * @see org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle#getTopLeft()
+     */
+    @Override
+    public Coordinate getTopLeft() {
+        return topLeft;
+    }
+
+    /* (non-Javadoc)
+     * @see org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle#getBottomRight()
+     */
+    @Override
+    public Coordinate getBottomRight() {
+        return bottomRight;
+    }
+
+    /* (non-Javadoc)
+     * @see org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle#paint(java.awt.Graphics, java.awt.Point, java.awt.Point)
+     */
+    @Override
+    public void paint(Graphics g, Point topLeft, Point bottomRight) {
+        // Prepare graphics
+        Color oldColor = g.getColor();
+        g.setColor(getColor());
+        Stroke oldStroke = null;
+        if (g instanceof Graphics2D) {
+            Graphics2D g2 = (Graphics2D) g;
+            oldStroke = g2.getStroke();
+            g2.setStroke(getStroke());
+        }
+        // Draw
+        g.drawRect(topLeft.x, topLeft.y, bottomRight.x - topLeft.x, bottomRight.y - topLeft.y);
+        // Restore graphics
+        g.setColor(oldColor);
+        if (g instanceof Graphics2D) {
+            ((Graphics2D) g).setStroke(oldStroke);
+        }
+        int width=bottomRight.x-topLeft.x;
+        int height=bottomRight.y-topLeft.y;
+        Point p= new Point(topLeft.x+(width/2), topLeft.y+(height/2));
+        if(getLayer()==null||getLayer().isVisibleTexts()) paintText(g, p);
+    }
+    public static Style getDefaultStyle(){
+        return new Style(Color.BLUE, null, new BasicStroke(2), getDefaultFont());
+    }
+    @Override
+    public String toString() {
+        return "MapRectangle from " + getTopLeft() + " to " + getBottomRight();
+    }
+}
diff --git a/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java b/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java
index 4fb527a..f1d4dd1 100644
--- a/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java
+++ b/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.util.HashMap;
 import java.util.Map;
 import java.util.logging.Logger;
diff --git a/src/org/openstreetmap/gui/jmapviewer/OsmFileCacheTileLoader.java b/src/org/openstreetmap/gui/jmapviewer/OsmFileCacheTileLoader.java
index f82a874..7cc6dab 100644
--- a/src/org/openstreetmap/gui/jmapviewer/OsmFileCacheTileLoader.java
+++ b/src/org/openstreetmap/gui/jmapviewer/OsmFileCacheTileLoader.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -276,13 +277,10 @@ public class OsmFileCacheTileLoader extends OsmTileLoader implements CachedTileL
                     tileFile = getTagsFile();
                 } else {
                     fin = new FileInputStream(tileFile);
-                    try {
-                        if (fin.available() == 0)
-                            throw new IOException("File empty");
-                        tile.loadImage(fin);
-                    } finally {
-                        fin.close();
-                    }
+                    if (fin.available() == 0)
+                        throw new IOException("File empty");
+                    tile.loadImage(fin);
+                    fin.close();
                 }
 
                 fileAge = tileFile.lastModified();
@@ -339,8 +337,8 @@ public class OsmFileCacheTileLoader extends OsmTileLoader implements CachedTileL
          * Note: This does only work with servers providing the
          * <code>LastModified</code> header:
          * <ul>
-         * <li>{@link org.openstreetmap.gui.jmapviewer.tilesources.OsmTileSource.CycleMap} - supported</li>
-         * <li>{@link org.openstreetmap.gui.jmapviewer.tilesources.OsmTileSource.Mapnik} - not supported</li>
+         * <li>{@link tilesources.OsmTileSource.CycleMap} - supported</li>
+         * <li>{@link tilesources.OsmTileSource.Mapnik} - not supported</li>
          * </ul>
          *
          * @param fileAge time of the
diff --git a/src/org/openstreetmap/gui/jmapviewer/OsmMercator.java b/src/org/openstreetmap/gui/jmapviewer/OsmMercator.java
index 903ee25..8bc92a1 100644
--- a/src/org/openstreetmap/gui/jmapviewer/OsmMercator.java
+++ b/src/org/openstreetmap/gui/jmapviewer/OsmMercator.java
@@ -1,16 +1,21 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+// License: GPL. Copyright 2007 by Tim Haussmann
+
 /**
- * This class implements the Mercator Projection as it is used by OpenStreetMap
+ * This class implements the Mercator Projection as it is used by Openstreetmap
  * (and google). It provides methods to translate coordinates from 'map space'
  * into latitude and longitude (on the WGS84 ellipsoid) and vice versa. Map
  * space is measured in pixels. The origin of the map space is the top left
- * corner. The map space origin (0,0) has latitude ~85 and longitude -180.
+ * corner. The map space origin (0,0) has latitude ~85 and longitude -180
+ *
+ * @author Tim Haussmann
+ *
  */
+
 public class OsmMercator {
 
-    public static int TILE_SIZE = 256;
+    private static int TILE_SIZE = 256;
     public static final double MAX_LAT = 85.05112877980659;
     public static final double MIN_LAT = -85.05112877980659;
     private static double EARTH_RADIUS = 6378137; // equatorial earth radius for EPSG:3857 (Mercator)
@@ -100,10 +105,11 @@ public class OsmMercator {
      * @return [0..2^Zoomlevel*TILE_SIZE[
      * @author Jan Peter Stotz
      */
-    public static double LonToX(double aLongitude, int aZoomlevel) {
+    public static int LonToX(double aLongitude, int aZoomlevel) {
         int mp = getMaxPixels(aZoomlevel);
-        double x = (mp * (aLongitude + 180l)) / 360l;
-        return Math.min(x, mp - 1);
+        int x = (int) ((mp * (aLongitude + 180l)) / 360l);
+        x = Math.min(x, mp - 1);
+        return x;
     }
 
     /**
@@ -124,7 +130,7 @@ public class OsmMercator {
      * @return [0..2^Zoomlevel*TILE_SIZE[
      * @author Jan Peter Stotz
      */
-    public static double LatToY(double aLat, int aZoomlevel) {
+    public static int LatToY(double aLat, int aZoomlevel) {
         if (aLat < MIN_LAT)
             aLat = MIN_LAT;
         else if (aLat > MAX_LAT)
@@ -132,8 +138,9 @@ public class OsmMercator {
         double sinLat = Math.sin(Math.toRadians(aLat));
         double log = Math.log((1.0 + sinLat) / (1.0 - sinLat));
         int mp = getMaxPixels(aZoomlevel);
-        double y = mp * (0.5 - (log / (4.0 * Math.PI)));
-        return Math.min(y, mp - 1);
+        int y = (int) (mp * (0.5 - (log / (4.0 * Math.PI))));
+        y = Math.min(y, mp - 1);
+        return y;
     }
 
     /**
diff --git a/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java b/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
index b84f83e..8f34039 100644
--- a/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
+++ b/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.HttpURLConnection;
diff --git a/src/org/openstreetmap/gui/jmapviewer/Style.java b/src/org/openstreetmap/gui/jmapviewer/Style.java
index 44bad2b..b7e3e8f 100644
--- a/src/org/openstreetmap/gui/jmapviewer/Style.java
+++ b/src/org/openstreetmap/gui/jmapviewer/Style.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
 import java.awt.AlphaComposite;
diff --git a/src/org/openstreetmap/gui/jmapviewer/Tile.java b/src/org/openstreetmap/gui/jmapviewer/Tile.java
index 99b04d7..7a6086e 100644
--- a/src/org/openstreetmap/gui/jmapviewer/Tile.java
+++ b/src/org/openstreetmap/gui/jmapviewer/Tile.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.geom.AffineTransform;
diff --git a/src/org/openstreetmap/gui/jmapviewer/TileController.java b/src/org/openstreetmap/gui/jmapviewer/TileController.java
index e16255a..9cc82f7 100644
--- a/src/org/openstreetmap/gui/jmapviewer/TileController.java
+++ b/src/org/openstreetmap/gui/jmapviewer/TileController.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer;
 
 import org.openstreetmap.gui.jmapviewer.JobDispatcher.JobThread;
diff --git a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeData.java b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeData.java
index 32acde0..152a15a 100644
--- a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeData.java
+++ b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeData.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.checkBoxTree;
 
 import org.openstreetmap.gui.jmapviewer.AbstractLayer;
diff --git a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeEditor.java b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeEditor.java
index e7e4e7b..b55a15e 100644
--- a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeEditor.java
+++ b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeEditor.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.checkBoxTree;
 
 import java.awt.Component;
diff --git a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodePanel.java b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodePanel.java
index 4fa42a7..e8985dc 100644
--- a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodePanel.java
+++ b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodePanel.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.checkBoxTree;
 
 import java.awt.BorderLayout;
diff --git a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeRenderer.java b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeRenderer.java
index 29739c1..a85cb0e 100644
--- a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeRenderer.java
+++ b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxNodeRenderer.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.checkBoxTree;
 
 import java.awt.Color;
diff --git a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxTree.java b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxTree.java
index 5167860..dcd0a7b 100644
--- a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxTree.java
+++ b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxTree.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.checkBoxTree;
 
 import java.awt.BorderLayout;
diff --git a/src/org/openstreetmap/gui/jmapviewer/events/JMVCommandEvent.java b/src/org/openstreetmap/gui/jmapviewer/events/JMVCommandEvent.java
index a3c2c47..74f9954 100644
--- a/src/org/openstreetmap/gui/jmapviewer/events/JMVCommandEvent.java
+++ b/src/org/openstreetmap/gui/jmapviewer/events/JMVCommandEvent.java
@@ -1,48 +1,49 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer.events;
-
-import java.util.EventObject;
-
-/**
- * Used for passing events between UI components and other
- * objects that register as a JMapViewerEventListener
- *
- * @author Jason Huntley
- *
- */
-public class JMVCommandEvent extends EventObject {
-    public static enum COMMAND {
-        MOVE,
-        ZOOM
-    }
-
-    private COMMAND command;
-    /**
-     *
-     */
-    private static final long serialVersionUID = 8701544867914969620L;
-
-    public JMVCommandEvent(COMMAND cmd, Object source) {
-        super(source);
-
-        setCommand(cmd);
-    }
-
-    public JMVCommandEvent(Object source) {
-        super(source);
-    }
-
-    /**
-     * @return the command
-     */
-    public COMMAND getCommand() {
-        return command;
-    }
-
-    /**
-     * @param command the command to set
-     */
-    public void setCommand(COMMAND command) {
-        this.command = command;
-    }
-}
+package org.openstreetmap.gui.jmapviewer.events;
+
+//License: GPL.
+
+import java.util.EventObject;
+
+/**
+ * Used for passing events between UI components and other
+ * objects that register as a JMapViewerEventListener
+ *
+ * @author Jason Huntley
+ *
+ */
+public class JMVCommandEvent extends EventObject {
+    public static enum COMMAND {
+        MOVE,
+        ZOOM
+    }
+
+    private COMMAND command;
+    /**
+     *
+     */
+    private static final long serialVersionUID = 8701544867914969620L;
+
+    public JMVCommandEvent(COMMAND cmd, Object source) {
+        super(source);
+
+        setCommand(cmd);
+    }
+
+    public JMVCommandEvent(Object source) {
+        super(source);
+    }
+
+    /**
+     * @return the command
+     */
+    public COMMAND getCommand() {
+        return command;
+    }
+
+    /**
+     * @param command the command to set
+     */
+    public void setCommand(COMMAND command) {
+        this.command = command;
+    }
+}
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/Attributed.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/Attributed.java
index 862ec81..81a8ca0 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/Attributed.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/Attributed.java
@@ -1,50 +1,51 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer.interfaces;
-
-import java.awt.Image;
-
-import org.openstreetmap.gui.jmapviewer.Coordinate;
-
-public interface Attributed {
-    /**
-     * @return True if the tile source requires attribution in text or image form.
-     */
-    boolean requiresAttribution();
-
-    /**
-     * @param zoom The optional zoom level for the view.
-     * @param botRight The bottom right of the bounding box for attribution.
-     * @param topLeft The top left of the bounding box for attribution.
-     * @return Attribution text for the image source.
-     */
-    String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight);
-
-    /**
-     * @return The URL to open when the user clicks the attribution text.
-     */
-    String getAttributionLinkURL();
-
-    /**
-     * @return The URL for the attribution image. Null if no image should be displayed.
-     */
-    Image getAttributionImage();
-
-    /**
-     * @return The URL to open when the user clicks the attribution image.
-     * When return value is null, the image is still displayed (provided getAttributionImage()
-     * returns a value other than null), but the image does not link to a website.
-     */
-    String getAttributionImageURL();
-
-    /**
-     * @return The attribution "Terms of Use" text.
-     * In case it returns null, but getTermsOfUseURL() is not null, a default
-     * terms of use text is used.
-     */
-    String getTermsOfUseText();
-
-    /**
-     * @return The URL to open when the user clicks the attribution "Terms of Use" text.
-     */
-    String getTermsOfUseURL();
-}
+package org.openstreetmap.gui.jmapviewer.interfaces;
+
+import java.awt.Image;
+
+import org.openstreetmap.gui.jmapviewer.Coordinate;
+
+//License: GPL.
+
+public interface Attributed {
+    /**
+     * @return True if the tile source requires attribution in text or image form.
+     */
+    boolean requiresAttribution();
+
+    /**
+     * @param zoom The optional zoom level for the view.
+     * @param botRight The bottom right of the bounding box for attribution.
+     * @param topLeft The top left of the bounding box for attribution.
+     * @return Attribution text for the image source.
+     */
+    String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight);
+
+    /**
+     * @return The URL to open when the user clicks the attribution text.
+     */
+    String getAttributionLinkURL();
+
+    /**
+     * @return The URL for the attribution image. Null if no image should be displayed.
+     */
+    Image getAttributionImage();
+
+    /**
+     * @return The URL to open when the user clicks the attribution image.
+     * When return value is null, the image is still displayed (provided getAttributionImage()
+     * returns a value other than null), but the image does not link to a website.
+     */
+    String getAttributionImageURL();
+
+    /**
+     * @return The attribution "Terms of Use" text.
+     * In case it returns null, but getTermsOfUseURL() is not null, a default
+     * terms of use text is used.
+     */
+    String getTermsOfUseText();
+
+    /**
+     * @return The URL to open when the user clicks the attribution "Terms of Use" text.
+     */
+    String getTermsOfUseURL();
+}
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/CachedTileLoader.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/CachedTileLoader.java
index 94c152f..1a40956 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/CachedTileLoader.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/CachedTileLoader.java
@@ -1,4 +1,4 @@
-// License: GPL. For details, see Readme.txt file.
+// License: GPL
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
 /**
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/ICoordinate.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/ICoordinate.java
index 1b14153..c34e00f 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/ICoordinate.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/ICoordinate.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
 public interface ICoordinate {
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/JMapViewerEventListener.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/JMapViewerEventListener.java
index e0914ad..b56032e 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/JMapViewerEventListener.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/JMapViewerEventListener.java
@@ -1,17 +1,18 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer.interfaces;
-
-import java.util.EventListener;
-
-import org.openstreetmap.gui.jmapviewer.events.JMVCommandEvent;
-
-/**
- * Must be implemented for processing commands while user
- * interacts with map viewer.
- *
- * @author Jason Huntley
- *
- */
-public interface JMapViewerEventListener extends EventListener {
-    public void processCommand(JMVCommandEvent command);
-}
+package org.openstreetmap.gui.jmapviewer.interfaces;
+
+//License: GPL.
+
+import java.util.EventListener;
+
+import org.openstreetmap.gui.jmapviewer.events.JMVCommandEvent;
+
+/**
+ * Must be implemented for processing commands while user
+ * interacts with map viewer.
+ *
+ * @author Jason Huntley
+ *
+ */
+public interface JMapViewerEventListener extends EventListener {
+    public void processCommand(JMVCommandEvent command);
+}
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/MapMarker.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/MapMarker.java
index 29ae5c2..2c1dc34 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/MapMarker.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/MapMarker.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import java.awt.Graphics;
 import java.awt.Point;
 
@@ -16,7 +17,7 @@ import org.openstreetmap.gui.jmapviewer.JMapViewer;
  */
 public interface MapMarker extends MapObject, ICoordinate{
 
-    public static enum STYLE {FIXED, VARIABLE}
+    public static enum STYLE {FIXED, VARIABLE};
 
     /**
      * @return Latitude and Longitude of the map marker position
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/MapObject.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/MapObject.java
index 71ca133..9c0f7fe 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/MapObject.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/MapObject.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
 import java.awt.Color;
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/MapPolygon.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/MapPolygon.java
index 8db97da..aa054de 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/MapPolygon.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/MapPolygon.java
@@ -1,38 +1,38 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer.interfaces;
-
-import java.awt.Graphics;
-import java.awt.Point;
-import java.awt.Polygon;
-import java.util.List;
-
-/**
- * Interface to be implemented by polygons that can be displayed on the map.
- *
- * @author Vincent
- */
-public interface MapPolygon extends MapObject{
-
-    /**
-     * @return Latitude/Longitude of each point of polygon
-     */
-    public List<? extends ICoordinate> getPoints();
-
-    /**
-     * Paints the map rectangle on the map. The <code>points</code>
-     * are specifying the coordinates within <code>g</code>
-     *
-     * @param g
-     * @param points
-     */
-    public void paint(Graphics g, List<Point> points);
-
-    /**
-     * Paints the map rectangle on the map. The <code>polygon</code>
-     * is specifying the coordinates within <code>g</code>
-     *
-     * @param g
-     * @param polygon
-     */
-    public void paint(Graphics g, Polygon polygon);
-}
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.gui.jmapviewer.interfaces;
+
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Polygon;
+import java.util.List;
+
+/**
+ * Interface to be implemented by polygons that can be displayed on the map.
+ *
+ * @author Vincent
+ */
+public interface MapPolygon extends MapObject{
+
+    /**
+     * @return Latitude/Longitude of each point of polygon
+     */
+    public List<? extends ICoordinate> getPoints();
+
+    /**
+     * Paints the map rectangle on the map. The <code>points</code>
+     * are specifying the coordinates within <code>g</code>
+     *
+     * @param g
+     * @param points
+     */
+    public void paint(Graphics g, List<Point> points);
+
+    /**
+     * Paints the map rectangle on the map. The <code>polygon</code>
+     * is specifying the coordinates within <code>g</code>
+     *
+     * @param g
+     * @param polygon
+     */
+    public void paint(Graphics g, Polygon polygon);
+}
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/MapRectangle.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/MapRectangle.java
index f76197b..8e0b942 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/MapRectangle.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/MapRectangle.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
+//License: GPL. Copyright 2009 by Stefan Zeller
+
 import java.awt.Graphics;
 import java.awt.Point;
 
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileCache.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileCache.java
index 0082987..69b16e4 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileCache.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileCache.java
@@ -1,9 +1,10 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
 import org.openstreetmap.gui.jmapviewer.JMapViewer;
 import org.openstreetmap.gui.jmapviewer.Tile;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 /**
  * Implement this interface for creating your custom tile cache for
  * {@link JMapViewer}.
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileClearController.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileClearController.java
index 603d354..3ae88c4 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileClearController.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileClearController.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
 import java.io.File;
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileJob.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileJob.java
index 45fdc54..b82bdc7 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileJob.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileJob.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
+//License: GPL. Copyright 2012 by Dirk Stöcker
+
 import org.openstreetmap.gui.jmapviewer.Tile;
 
 /**
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoader.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoader.java
index c07619a..38d26c1 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoader.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoader.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 import org.openstreetmap.gui.jmapviewer.Tile;
 
 /**
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoaderListener.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoaderListener.java
index 075ac9f..cf01494 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoaderListener.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileLoaderListener.java
@@ -1,8 +1,9 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
 import org.openstreetmap.gui.jmapviewer.Tile;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 public interface TileLoaderListener {
 
     /**
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java
index 74a0284..83de8a9 100644
--- a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java
@@ -1,10 +1,11 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.interfaces;
 
 import java.io.IOException;
 
 import org.openstreetmap.gui.jmapviewer.JMapViewer;
 
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
 /**
  *
  * @author Jan Peter Stotz
@@ -93,57 +94,11 @@ public interface TileSource extends Attributed {
      */
     int getTileSize();
 
-    /**
-     * Gets the distance using Spherical law of cosines.
-     *  @return the distance, m.
-     */
-    double getDistance(double la1, double lo1, double la2, double lo2);
-
-    /**
-     * Transform longitude to pixelspace.
-     * @return [0..2^Zoomlevel*TILE_SIZE[
-     */
-    int LonToX(double aLongitude, int aZoomlevel);
-
-    /**
-     * Transforms latitude to pixelspace.
-     * @return [0..2^Zoomlevel*TILE_SIZE[
-     */
-    int LatToY(double aLat, int aZoomlevel);
-
-    /**
-     * Transforms pixel coordinate X to longitude
-     * @return ]-180..180[
-     */
-    double XToLon(int aX, int aZoomlevel);
-
-    /**
-     * Transforms pixel coordinate Y to latitude.
-     * @return [MIN_LAT..MAX_LAT]
-     */
-    double YToLat(int aY, int aZoomlevel);
+    double latToTileY(double lat, int zoom);
 
-    /**
-     * Transforms longitude to X tile coordinate.
-     * @return [0..2^Zoomlevel[
-     */
     double lonToTileX(double lon, int zoom);
 
-    /**
-     * Transforms latitude to Y tile coordinate.
-     * @return [0..2^Zoomlevel[
-     */
-    double latToTileY(double lat, int zoom);
+    double tileYToLat(int y, int zoom);
 
-    /**
-     * Transforms tile X coordinate to longitude.
-     * @return ]-180..180[
-     */
     double tileXToLon(int x, int zoom);
-
-    /**
-     * Transforms tile Y coordinate to latitude.
-     * @return [MIN_LAT..MAX_LAT]
-     */
-    double tileYToLat(int y, int zoom);
 }
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractMapQuestTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractMapQuestTileSource.java
index 4dbee39..6004d48 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractMapQuestTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractMapQuestTileSource.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.tilesources;
 
 import java.awt.Image;
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractOsmTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractOsmTileSource.java
index 518c400..2dac34c 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractOsmTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractOsmTileSource.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.tilesources;
 
 import java.awt.Image;
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
index 37b3c4a..ad091b0 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java
@@ -1,118 +1,97 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer.tilesources;
-
-import java.io.IOException;
-
-import org.openstreetmap.gui.jmapviewer.OsmMercator;
-
-public abstract class AbstractTMSTileSource extends AbstractTileSource {
-
-    protected String name;
-    protected String baseUrl;
-
-    public AbstractTMSTileSource(String name, String base_url) {
-        this.name = name;
-        this.baseUrl = base_url;
-        if(baseUrl.endsWith("/")) {
-            baseUrl = baseUrl.substring(0,baseUrl.length()-1);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public int getMaxZoom() {
-        return 21;
-    }
-
-    @Override
-    public int getMinZoom() {
-        return 0;
-    }
-
-    public String getExtension() {
-        return "png";
-    }
-
-    /**
-     * @throws IOException when subclass cannot return the tile URL
-     */
-    public String getTilePath(int zoom, int tilex, int tiley) throws IOException {
-        return "/" + zoom + "/" + tilex + "/" + tiley + "." + getExtension();
-    }
-
-    public String getBaseUrl() {
-        return this.baseUrl;
-    }
-
-    @Override
-    public String getTileUrl(int zoom, int tilex, int tiley) throws IOException {
-        return this.getBaseUrl() + getTilePath(zoom, tilex, tiley);
-    }
-
-    @Override
-    public String toString() {
-        return getName();
-    }
-
-    @Override
-    public String getTileType() {
-        return "png";
-    }
-
-    /*
-     * Most tilesources use OsmMercator projection.
-     */
-    @Override
-    public int getTileSize() {
-        return OsmMercator.TILE_SIZE;
-    }
-
-    @Override
-    public double getDistance(double lat1, double lon1, double lat2, double lon2) {
-        return OsmMercator.getDistance(lat1, lon1, lat2, lon2);
-    }
-
-    @Override
-    public int LonToX(double lon, int zoom) {
-        return (int )OsmMercator.LonToX(lon, zoom);
-    }
-
-    @Override
-    public int LatToY(double lat, int zoom) {
-        return (int )OsmMercator.LatToY(lat, zoom);
-    }
-
-    @Override
-    public double XToLon(int x, int zoom) {
-        return OsmMercator.XToLon(x, zoom);
-    }
-
-    @Override
-    public double YToLat(int y, int zoom) {
-        return OsmMercator.YToLat(y, zoom);
-    }
-
-    @Override
-    public double latToTileY(double lat, int zoom) {
-        return OsmMercator.LatToY(lat, zoom) / OsmMercator.TILE_SIZE;
-    }
-
-    @Override
-    public double lonToTileX(double lon, int zoom) {
-        return OsmMercator.LonToX(lon, zoom) / OsmMercator.TILE_SIZE;
-    }
-
-    @Override
-    public double tileYToLat(int y, int zoom) {
-        return OsmMercator.YToLat(y * OsmMercator.TILE_SIZE, zoom);
-    }
-
-    @Override
-    public double tileXToLon(int x, int zoom) {
-        return OsmMercator.XToLon(x * OsmMercator.TILE_SIZE, zoom);
-    }
-}
+package org.openstreetmap.gui.jmapviewer.tilesources;
+
+//License: GPL.
+
+import java.awt.Image;
+import java.io.IOException;
+
+import javax.swing.ImageIcon;
+
+import org.openstreetmap.gui.jmapviewer.Coordinate;
+import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
+
+public abstract class AbstractTMSTileSource extends AbstractTileSource {
+
+    protected String name;
+    protected String baseUrl;
+
+    public AbstractTMSTileSource(String name, String base_url) {
+        this.name = name;
+        this.baseUrl = base_url;
+        if(baseUrl.endsWith("/")) {
+            baseUrl = baseUrl.substring(0,baseUrl.length()-1);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public int getMaxZoom() {
+        return 21;
+    }
+
+    @Override
+    public int getMinZoom() {
+        return 0;
+    }
+
+    public String getExtension() {
+        return "png";
+    }
+
+    /**
+     * @throws IOException when subclass cannot return the tile URL
+     */
+    public String getTilePath(int zoom, int tilex, int tiley) throws IOException {
+        return "/" + zoom + "/" + tilex + "/" + tiley + "." + getExtension();
+    }
+
+    public String getBaseUrl() {
+        return this.baseUrl;
+    }
+
+    @Override
+    public String getTileUrl(int zoom, int tilex, int tiley) throws IOException {
+        return this.getBaseUrl() + getTilePath(zoom, tilex, tiley);
+    }
+
+    @Override
+    public String toString() {
+        return getName();
+    }
+
+    @Override
+    public String getTileType() {
+        return "png";
+    }
+
+    @Override
+    public int getTileSize() {
+        return 256;
+    }
+
+    @Override
+    public double latToTileY(double lat, int zoom) {
+        double l = lat / 180 * Math.PI;
+        double pf = Math.log(Math.tan(l) + (1 / Math.cos(l)));
+        return Math.pow(2.0, zoom - 1) * (Math.PI - pf) / Math.PI;
+    }
+
+    @Override
+    public double lonToTileX(double lon, int zoom) {
+        return Math.pow(2.0, zoom - 3) * (lon + 180.0) / 45.0;
+    }
+
+    @Override
+    public double tileYToLat(int y, int zoom) {
+        return Math.atan(Math.sinh(Math.PI - (Math.PI * y / Math.pow(2.0, zoom - 1)))) * 180 / Math.PI;
+    }
+
+    @Override
+    public double tileXToLon(int x, int zoom) {
+        return x * 45.0 / Math.pow(2.0, zoom - 3) - 180.0;
+    }
+}
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTileSource.java
index 66456a6..9c961f5 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTileSource.java
@@ -1,77 +1,78 @@
-// License: GPL. For details, see Readme.txt file.
-package org.openstreetmap.gui.jmapviewer.tilesources;
-
-import java.awt.Image;
-
-import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
-import org.openstreetmap.gui.jmapviewer.Coordinate;
-
-abstract public class AbstractTileSource implements TileSource {
-
-    protected String attributionText;
-    protected String attributionLinkURL;
-    protected Image attributionImage;
-    protected String attributionImageURL;
-    protected String termsOfUseText;
-    protected String termsOfUseURL;
-
-    @Override
-    public boolean requiresAttribution() {
-        return attributionText != null || attributionImage != null || termsOfUseText != null || termsOfUseURL != null;
-    }
-
-    @Override
-    public String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight) {
-        return attributionText;
-    }
-
-    @Override
-    public String getAttributionLinkURL() {
-        return attributionLinkURL;
-    }
-
-    @Override
-    public Image getAttributionImage() {
-        return attributionImage;
-    }
-
-    @Override
-    public String getAttributionImageURL() {
-        return attributionImageURL;
-    }
-
-    @Override
-    public String getTermsOfUseText() {
-        return termsOfUseText;
-    }
-
-    @Override
-    public String getTermsOfUseURL() {
-        return termsOfUseURL;
-    }
-
-    public void setAttributionText(String attributionText) {
-        this.attributionText = attributionText;
-    }
-
-    public void setAttributionLinkURL(String attributionLinkURL) {
-        this.attributionLinkURL = attributionLinkURL;
-    }
-
-    public void setAttributionImage(Image attributionImage) {
-        this.attributionImage = attributionImage;
-    }
-
-    public void setAttributionImageURL(String attributionImageURL) {
-        this.attributionImageURL = attributionImageURL;
-    }
-
-    public void setTermsOfUseText(String termsOfUseText) {
-        this.termsOfUseText = termsOfUseText;
-    }
-
-    public void setTermsOfUseURL(String termsOfUseURL) {
-        this.termsOfUseURL = termsOfUseURL;
-    }
-
-}
+package org.openstreetmap.gui.jmapviewer.tilesources;
+
+import java.awt.Image;
+
+import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
+import org.openstreetmap.gui.jmapviewer.Coordinate;
+
+//License: GPL. Copyright 2008 by Jan Peter Stotz
+
+abstract public class AbstractTileSource implements TileSource {
+
+    protected String attributionText;
+    protected String attributionLinkURL;
+    protected Image attributionImage;
+    protected String attributionImageURL;
+    protected String termsOfUseText;
+    protected String termsOfUseURL;
+
+    @Override
+    public boolean requiresAttribution() {
+        return attributionText != null || attributionImage != null || termsOfUseText != null || termsOfUseURL != null;
+    }
+
+    @Override
+    public String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight) {
+        return attributionText;
+    }
+
+    @Override
+    public String getAttributionLinkURL() {
+        return attributionLinkURL;
+    }
+
+    @Override
+    public Image getAttributionImage() {
+        return attributionImage;
+    }
+
+    @Override
+    public String getAttributionImageURL() {
+        return attributionImageURL;
+    }
+
+    @Override
+    public String getTermsOfUseText() {
+        return termsOfUseText;
+    }
+
+    @Override
+    public String getTermsOfUseURL() {
+        return termsOfUseURL;
+    }
+
+    public void setAttributionText(String attributionText) {
+        this.attributionText = attributionText;
+    }
+
+    public void setAttributionLinkURL(String attributionLinkURL) {
+        this.attributionLinkURL = attributionLinkURL;
+    }
+
+    public void setAttributionImage(Image attributionImage) {
+        this.attributionImage = attributionImage;
+    }
+
+    public void setAttributionImageURL(String attributionImageURL) {
+        this.attributionImageURL = attributionImageURL;
+    }
+
+    public void setTermsOfUseText(String termsOfUseText) {
+        this.termsOfUseText = termsOfUseText;
+    }
+
+    public void setTermsOfUseURL(String termsOfUseURL) {
+        this.termsOfUseURL = termsOfUseURL;
+    }
+
+}
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
index a4cbc16..1ce79da 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
@@ -1,6 +1,7 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.tilesources;
 
+//License: GPL.
+
 import java.awt.Image;
 import java.io.IOException;
 import java.net.MalformedURLException;
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/MapQuestOpenAerialTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/MapQuestOpenAerialTileSource.java
index e48e88d..2599163 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/MapQuestOpenAerialTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/MapQuestOpenAerialTileSource.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.tilesources;
 
 import org.openstreetmap.gui.jmapviewer.Coordinate;
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/MapQuestOsmTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/MapQuestOsmTileSource.java
index 30f6288..56c2359 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/MapQuestOsmTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/MapQuestOsmTileSource.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.tilesources;
 
 import org.openstreetmap.gui.jmapviewer.Coordinate;
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/OsmTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/OsmTileSource.java
index 3d6bf70..be0bc1c 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/OsmTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/OsmTileSource.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.tilesources;
 
 /**
@@ -43,7 +42,7 @@ public class OsmTileSource {
          * Constructs a new {@code CycleMap} tile source.
          */
         public CycleMap() {
-            super("Cyclemap", PATTERN);
+            super("OSM Cycle Map", PATTERN);
         }
 
         @Override
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java
index fd48b29..4d20822 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/ScanexTileSource.java
@@ -1,26 +1,10 @@
-// License: BSD or GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.tilesources;
 
 import java.util.Random;
 
 import org.openstreetmap.gui.jmapviewer.OsmMercator;
 
-/*
- * This tilesource uses different to OsmMercator projection.
- *
- * Earth is assumed an ellipsoid in this projection, unlike
- * sphere in OsmMercator, so latitude calculation differs
- * a lot.
- *
- * The longitude calculation is the same as in OsmMercator,
- * we inherit it from AbstractTMSTileSource.
- *
- * TODO: correct getDistance() method.
- */
-
-public class ScanexTileSource extends TMSTileSource {
-    private static final String DEFAULT_URL = "http://maps.kosmosnimki.ru";
-    private static final int DEFAULT_MAXZOOM = 14;
+public class ScanexTileSource extends AbstractTMSTileSource {
     private static String API_KEY = "4018C5A9AECAD8868ED5DEB2E41D09F7";
 
     private enum ScanexLayer {
@@ -45,24 +29,23 @@ public class ScanexTileSource extends TMSTileSource {
     /* IRS by default */
     private ScanexLayer Layer = ScanexLayer.IRS;
 
-    public ScanexTileSource(String name, String url, int maxZoom) {
-        super(name, url, maxZoom);
+    public ScanexTileSource(String url) {
+        super("Scanex " + url, "http://maps.kosmosnimki.ru");
 
         for (ScanexLayer layer : ScanexLayer.values()) {
             if (url.equalsIgnoreCase(layer.getName())) {
                 this.Layer = layer;
-                /*
-                 * Override baseUrl and maxZoom in base class.
-                 */
-                this.baseUrl = DEFAULT_URL;
-                if (maxZoom == 0)
-                    this.maxZoom = DEFAULT_MAXZOOM;
                 break;
             }
         }
     }
 
     @Override
+    public int getMaxZoom() {
+        return 14;
+    }
+
+    @Override
     public String getExtension() {
         return("jpeg");
     }
@@ -81,25 +64,11 @@ public class ScanexTileSource extends TMSTileSource {
         return TileUpdate.IfNoneMatch;
     }
 
-
-    /*
-     * Latitude to Y and back calculations.
-     */
     private static double RADIUS_E = 6378137;   /* radius of Earth at equator, m */
     private static double EQUATOR = 40075016.68557849; /* equator length, m */
     private static double E = 0.0818191908426;  /* eccentricity of Earth's ellipsoid */
 
     @Override
-    public int LatToY(double lat, int zoom) {
-        return (int )(latToTileY(lat, zoom) * OsmMercator.TILE_SIZE);
-    }
- 
-    @Override
-    public double YToLat(int y, int zoom) {
-        return tileYToLat((double )y / OsmMercator.TILE_SIZE, zoom);
-    }
-
-    @Override
     public double latToTileY(double lat, int zoom) {
         double tmp = Math.tan(Math.PI/4 * (1 + lat/90));
         double pow = Math.pow(Math.tan(Math.PI/4 + Math.asin(E * Math.sin(Math.toRadians(lat)))/2), E);
@@ -108,8 +77,8 @@ public class ScanexTileSource extends TMSTileSource {
     }
 
     @Override
-    public double tileYToLat(int y, int zoom) {
-        return tileYToLat((double )y, zoom);
+    public double lonToTileX(double lon, int zoom) {
+        return (RADIUS_E * lon * Math.PI / (90*EQUATOR) + 1) * Math.pow(2.0, zoom - 1);
     }
 
     /*
@@ -120,21 +89,24 @@ public class ScanexTileSource extends TMSTileSource {
      * value.
      */
     private double cached_lat = 0;
-    private double tileYToLat(double y, int zoom) {
+
+    @Override
+    public double tileYToLat(int y, int zoom) {
+    Random r= new Random();
         double lat0, lat;
 
-        lat = cached_lat;
-        do {
-            lat0 = lat;
+    lat = cached_lat;
+    do {
+        lat0 = lat;
             lat = lat - Math.toDegrees(NextTerm(Math.toRadians(lat), y, zoom));
             if (lat > OsmMercator.MAX_LAT || lat < OsmMercator.MIN_LAT) {
-                Random r = new Random();
                 lat = OsmMercator.MIN_LAT +
-                  r.nextInt((int )(OsmMercator.MAX_LAT - OsmMercator.MIN_LAT));
+                    (double )r.nextInt((int )(OsmMercator.MAX_LAT -
+                    OsmMercator.MIN_LAT));
             }
-        } while ((Math.abs(lat0 - lat) > 0.000001));
+    } while ((Math.abs(lat0 - lat) > 0.000001));
 
-        cached_lat = lat;
+    cached_lat = lat;
 
         return (lat);
     }
@@ -143,16 +115,21 @@ public class ScanexTileSource extends TMSTileSource {
     private double NextTerm(double lat, double y, int zoom) {
         double sinl=Math.sin(lat);
         double cosl=Math.cos(lat);
-        double ec, f, df;
+    double ec, f, df;
 
         zoom = (int )Math.pow(2.0, zoom - 1);
-        ec = Math.exp((1 - y/zoom)*Math.PI);
+    ec = Math.exp((1 - y/zoom)*Math.PI);
 
-        f = (Math.tan(Math.PI/4+lat/2) -
-            ec * Math.pow(Math.tan(Math.PI/4 + Math.asin(E * sinl)/2), E));
+    f = (Math.tan(Math.PI/4+lat/2) -
+        ec * Math.pow(Math.tan(Math.PI/4 + Math.asin(E * sinl)/2), E));
         df = 1/(1 - sinl) - ec * E * cosl/((1 - E * sinl) *
             (Math.sqrt (1 - E * E * sinl * sinl)));
 
         return (f/df);
     }
+
+    @Override
+    public double tileXToLon(int x, int zoom) {
+        return (x / Math.pow(2.0, zoom - 1) - 1) * (90*EQUATOR) / RADIUS_E / Math.PI;
+    }
 }
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/TMSTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/TMSTileSource.java
index f22c0ac..d85d0ff 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/TMSTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/TMSTileSource.java
@@ -1,6 +1,11 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.tilesources;
 
+//License: GPL.
+
+import java.awt.Image;
+
+import org.openstreetmap.gui.jmapviewer.Coordinate;
+
 public class TMSTileSource extends AbstractTMSTileSource {
 
     protected int maxZoom;
@@ -30,4 +35,5 @@ public class TMSTileSource extends AbstractTMSTileSource {
     public TileUpdate getTileUpdate() {
         return TileUpdate.IfNoneMatch;
     }
+
 }
diff --git a/src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java b/src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java
index 9113813..2717dfe 100644
--- a/src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java
+++ b/src/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSource.java
@@ -1,4 +1,3 @@
-// License: GPL. For details, see Readme.txt file.
 package org.openstreetmap.gui.jmapviewer.tilesources;
 
 import java.util.Map;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/jmapviewer.git



More information about the Pkg-grass-devel mailing list