josm-plugins-0.0.svn31964/0000755000175000017500000000000012643536105013315 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/0000755000175000017500000000000012643536103014757 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/resources/0000755000175000017500000000000012643536103016771 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/build.xml0000644000175000017500000000213712642235110016574 0ustar basbas josm-plugins-0.0.svn31964/editgpx/images/0000755000175000017500000000000012643536103016224 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/images/mapmode/0000755000175000017500000000000012643536103017646 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/images/mapmode/editgpx_mode.png0000644000175000017500000000216311161736510023024 0ustar basbasPNG  IHDRw=sRGBbKGD pHYs  tIME IDATHŕ]Leoiii˂0c) ,!`L6ÕF/K65z$,BcdXtci :ʇBaF]y9y<#=.QnZ>LǾp)&%1c 'Ov ΍#//f4A, Kܸ9cGE*ݍA @v'/i?/fzrF‘^x%~_XWST\-48Xd''ωnG11~PT^sm.M+?#݂ɔN,(%,YYznruxk"J723hS-ϱD`1 @VmYcyue]Tb&܍zk nND݌7}^V+kBg&Xi %Ey9BQo>FZmVnGUמfuXx<$qDQDE6 '<\=4׋L @}:z2 2 N~΀˙PNUǘ\KsjsC <$iM4jz]h4j,j^U{U}7D"ABe*\f4z_b`#FwyZ\>h]s @\zcs=֐̣#Q񐬪;A!զ{{לy9t_Ts[m^l<Nۉ e:SZ` 8^VVU.$ ׁj5`(6%jT tP=`xC ӝV`@EH Ik$dZޫ@u吔 Pd.74E/cvS)Fɯ",Q"IENDB`josm-plugins-0.0.svn31964/editgpx/images/editgpx_layer.png0000644000175000017500000000057111161736510021573 0ustar basbasPNG  IHDRw=sRGBbKGD pHYs  tIME v$߮ 6Vz͵ l(Vҫ 6 珘o8/=IENDB`josm-plugins-0.0.svn31964/editgpx/.project0000644000175000017500000000056312326557333016440 0ustar basbas JOSM-editgpx org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature josm-plugins-0.0.svn31964/editgpx/.settings/0000755000175000017500000000000012643536103016675 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000001176411456531276023364 0ustar basbas#Sat Oct 16 19:07:29 CEST 2010 cleanup.add_default_serial_version_id=true cleanup.add_generated_serial_version_id=false cleanup.add_missing_annotations=true cleanup.add_missing_deprecated_annotations=true cleanup.add_missing_methods=false cleanup.add_missing_nls_tags=false cleanup.add_missing_override_annotations=true cleanup.add_serial_version_id=false cleanup.always_use_blocks=true cleanup.always_use_parentheses_in_expressions=false cleanup.always_use_this_for_non_static_field_access=false cleanup.always_use_this_for_non_static_method_access=false cleanup.convert_to_enhanced_for_loop=false cleanup.correct_indentation=false cleanup.format_source_code=false cleanup.format_source_code_changes_only=false cleanup.make_local_variable_final=true cleanup.make_parameters_final=false cleanup.make_private_fields_final=true cleanup.make_type_abstract_if_missing_method=false cleanup.make_variable_declarations_final=false cleanup.never_use_blocks=false cleanup.never_use_parentheses_in_expressions=true cleanup.organize_imports=false cleanup.qualify_static_field_accesses_with_declaring_class=false cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.remove_private_constructors=true cleanup.remove_trailing_whitespaces=false cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_ignore_empty=false cleanup.remove_unnecessary_casts=true cleanup.remove_unnecessary_nls_tags=true cleanup.remove_unused_imports=true cleanup.remove_unused_local_variables=false cleanup.remove_unused_private_fields=true cleanup.remove_unused_private_members=false cleanup.remove_unused_private_methods=true cleanup.remove_unused_private_types=true cleanup.sort_members=false cleanup.sort_members_all=false cleanup.use_blocks=false cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_parentheses_in_expressions=false cleanup.use_this_for_non_static_field_access=false cleanup.use_this_for_non_static_field_access_only_if_necessary=true cleanup.use_this_for_non_static_method_access=false cleanup.use_this_for_non_static_method_access_only_if_necessary=true cleanup_profile=org.eclipse.jdt.ui.default.eclipse_clean_up_profile cleanup_settings_version=2 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_Eclipse [built-in] + spaces for indent formatter_settings_version=11 sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=false sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=true sp_cleanup.format_source_code=false sp_cleanup.format_source_code_changes_only=false sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=false sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true josm-plugins-0.0.svn31964/editgpx/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000007067012420547421023667 0ustar basbaseclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 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=0 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=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.line_length=80 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_field=insert 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_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=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_annotation_on_type=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=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=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=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=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=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=80 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=true org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true josm-plugins-0.0.svn31964/editgpx/data/0000755000175000017500000000000012643536103015670 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/.classpath0000644000175000017500000000070012326615515016742 0ustar basbas josm-plugins-0.0.svn31964/editgpx/src/0000755000175000017500000000000012643536103015546 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/src/org/0000755000175000017500000000000012643536103016335 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/0000755000175000017500000000000012643536103021223 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/0000755000175000017500000000000012643536103022173 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/0000755000175000017500000000000012643536103023654 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/0000755000175000017500000000000012643536103025320 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/data/0000755000175000017500000000000012643536103026231 5ustar basbasjosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/data/EditGpxData.java0000644000175000017500000000547412420553250031237 0ustar basbaspackage org.openstreetmap.josm.plugins.editgpx.data; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; import org.openstreetmap.josm.data.gpx.GpxData; import org.openstreetmap.josm.data.gpx.GpxRoute; import org.openstreetmap.josm.data.gpx.GpxTrack; import org.openstreetmap.josm.data.gpx.WayPoint; public class EditGpxData { private final List tracks = new ArrayList<>(); // Only copy of routes and waypoints to preserve all info when converting back to gpx track private final List routes = new ArrayList<>(); private final List waypoints = new ArrayList<>(); public void load(GpxData data) { for (GpxTrack track: data.tracks) { tracks.add(new EditGpxTrack(track)); } routes.clear(); routes.addAll(data.routes); waypoints.clear(); waypoints.addAll(data.waypoints); } public boolean isEmpty() { for (EditGpxTrack track: tracks) { for (EditGpxTrackSegment segment: track.getSegments()) { if (!segment.getWayPoints().isEmpty()) { return false; } } } return true; } public List getTracks() { return tracks; } public GpxData createGpxData(boolean anonTime) { GpxData result = new GpxData(); double minTime = 0.0; if (anonTime) { try { minTime = minNonDeletedTime(); } catch (NoSuchElementException e) { // minTime won't be used, so ignore the exception } } for (EditGpxTrack track: tracks) { if (!track.isDeleted()) { GpxTrack newTrack = track.createGpxTrack(anonTime, minTime); if (!newTrack.getSegments().isEmpty()) { result.tracks.add(newTrack); } } } result.routes.addAll(routes); result.waypoints.addAll(waypoints); return result; } /** * time of the oldest waypoint in the set of non-deleted waypoints * in this data (in seconds since Epoch) */ public double minNonDeletedTime() { boolean foundOne = false; double minTime = 0.0; for (EditGpxTrack track: tracks) { if (!track.isDeleted()) { try { double t = track.minNonDeletedTime(); if ((!foundOne) || (t < minTime)) { minTime = t; } foundOne = true; } catch (NoSuchElementException e) { continue; } } } if (!foundOne) { throw new NoSuchElementException(); } return minTime; } } josm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/data/EditGpxTrack.java0000644000175000017500000000722012420553250031421 0ustar basbaspackage org.openstreetmap.josm.plugins.editgpx.data; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.TimeZone; import org.openstreetmap.josm.data.gpx.GpxTrack; import org.openstreetmap.josm.data.gpx.GpxTrackSegment; import org.openstreetmap.josm.data.gpx.ImmutableGpxTrack; import org.openstreetmap.josm.data.gpx.WayPoint; public class EditGpxTrack { private final List segments = new ArrayList<>(); private final Map attributes = new HashMap<>(); private boolean isDeleted; public EditGpxTrack(GpxTrack track) { attributes.putAll(track.getAttributes()); for (GpxTrackSegment segment: track.getSegments()) { segments.add(new EditGpxTrackSegment(segment)); } } public List getSegments() { return segments; } public Map getAttributes() { return attributes; } public GpxTrack createGpxTrack(boolean anonTime, double minTime) { Collection> wayPoints = new ArrayList<>(); final DateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); final TimeZone utc = TimeZone.getTimeZone("UTC"); iso8601.setTimeZone(utc); for (EditGpxTrackSegment segment: segments) { if (!segment.isDeleted()) { List points = segment.getNonDeletedWaypoints(); if (!points.isEmpty()) { if (anonTime) { // convert to anonymous time for (WayPoint w : points) { double t = w.time - minTime; w.attr.put("time", iso8601.format( new Date((long)(t * 1000)))); w.setTime(); assert w.time == t; if (w.attr.containsKey("name")) { w.attr.put("name", "anon"); //time information can also be in "name" field. so delete time information } } } wayPoints.add(points); } } } if (anonTime) { if (attributes.containsKey("name")) { attributes.put("name", "anon");//time information can also be in "name" field. so delete time information } } return new ImmutableGpxTrack(wayPoints, attributes); } public void setDeleted(boolean isDeleted) { this.isDeleted = isDeleted; } public boolean isDeleted() { return isDeleted; } /** * time of the oldest waypoint in the set of non-deleted waypoints * in this track (in seconds since Epoch) */ public double minNonDeletedTime() { boolean foundOne = false; double minTime = 0.0; for (EditGpxTrackSegment segment: segments) { if (!segment.isDeleted()) { try { double t = segment.minNonDeletedTime(); if ((!foundOne) || (t < minTime)) { minTime = t; } foundOne = true; } catch (NoSuchElementException e) { continue; } } } if (!foundOne) { throw new NoSuchElementException(); } return minTime; } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootjosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/data/EditGpxTrackSegment.javajosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/data/EditGpxTrackSegmen0000644000175000017500000000247312420553250031645 0ustar basbaspackage org.openstreetmap.josm.plugins.editgpx.data; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.openstreetmap.josm.data.gpx.GpxTrackSegment; import org.openstreetmap.josm.data.gpx.WayPoint; public class EditGpxTrackSegment { private final List wayPoints = new ArrayList<>(); private boolean deleted; public EditGpxTrackSegment(GpxTrackSegment segment) { for (WayPoint wayPoint: segment.getWayPoints()) { wayPoints.add(new EditGpxWayPoint(wayPoint)); } } public List getWayPoints() { return wayPoints; } public List getNonDeletedWaypoints() { List result = new ArrayList<>(); for (EditGpxWayPoint wp: wayPoints) { if (!wp.isDeleted()) { result.add(wp.createWayPoint()); } } return result; } public void setDeleted(boolean deleted) { this.deleted = deleted; } public boolean isDeleted() { return deleted; } /** * time of the oldest waypoint in the set of non-deleted waypoints * in this segment (in seconds since Epoch) */ public double minNonDeletedTime() { return Collections.min(getNonDeletedWaypoints()).time; } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootjosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/data/EditGpxWayPoint.javajosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/data/EditGpxWayPoint.ja0000644000175000017500000000235412420553250031603 0ustar basbaspackage org.openstreetmap.josm.plugins.editgpx.data; import java.util.HashMap; import java.util.Map; import org.openstreetmap.josm.data.coor.CachedLatLon; import org.openstreetmap.josm.data.gpx.WayPoint; public class EditGpxWayPoint implements Comparable { private final double time; private final CachedLatLon coor; private boolean deleted; private Map attributes; public EditGpxWayPoint(WayPoint wayPoint) { this.time = wayPoint.time; this.coor = new CachedLatLon(wayPoint.getCoor()); this.attributes = new HashMap<>(wayPoint.attr); } public WayPoint createWayPoint() { WayPoint result = new WayPoint(getCoor()); result.time = time; result.attr = attributes; return result; } public void setDeleted(boolean deleted) { this.deleted = deleted; } public boolean isDeleted() { return deleted; } /** * returns this waypoint's time in seconds since Epoch */ public double getTime() { return time; } public CachedLatLon getCoor() { return coor; } public int compareTo(EditGpxWayPoint o) { return Double.compare(getTime(), o.getTime()); } } josm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxLayer.java0000644000175000017500000001316112405376701030530 0ustar basbas/** * License: GPL. Copyright 2008. Martin Garbe (leo at running-sheep dot com) */ package org.openstreetmap.josm.plugins.editgpx; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Toolkit; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.Icon; import javax.swing.ImageIcon; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.data.gpx.GpxData; import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; import org.openstreetmap.josm.gui.MapView; import org.openstreetmap.josm.gui.dialogs.LayerListDialog; import org.openstreetmap.josm.gui.dialogs.LayerListPopup; import org.openstreetmap.josm.gui.layer.GpxLayer; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.plugins.editgpx.data.EditGpxData; import org.openstreetmap.josm.plugins.editgpx.data.EditGpxTrack; import org.openstreetmap.josm.plugins.editgpx.data.EditGpxTrackSegment; import org.openstreetmap.josm.plugins.editgpx.data.EditGpxWayPoint; import org.openstreetmap.josm.tools.ImageProvider; public class EditGpxLayer extends Layer { private static Icon icon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(EditGpxPlugin.class.getResource("/images/editgpx_layer.png"))); public final EditGpxData data; private GPXLayerImportAction layerImport; public EditGpxLayer(String str, EditGpxData gpxData) { super(str); data = gpxData; layerImport = new GPXLayerImportAction(data); } /** * check if dataSet is empty * if so show import dialog to user */ public void initializeImport() { try { if (data.isEmpty()) { layerImport.activateImport(); } } catch (Exception e) { Main.error(e); } } @Override public Icon getIcon() { return icon; } @Override public Object getInfoComponent() { return getToolTipText(); } @Override public Action[] getMenuEntries() { return new Action[] { LayerListDialog.getInstance().createShowHideLayerAction(), LayerListDialog.getInstance().createDeleteLayerAction(), SeparatorLayerAction.INSTANCE, layerImport, new ConvertToGpxLayerAction(), new ConvertToAnonTimeGpxLayerAction(), SeparatorLayerAction.INSTANCE, new LayerListPopup.InfoAction(this)}; } @Override public String getToolTipText() { return tr("Layer for editing GPX tracks"); } @Override public boolean isMergable(Layer other) { // TODO return false; } @Override public void mergeFrom(Layer from) { // TODO } @Override public void paint(Graphics2D g, MapView mv, Bounds bounds) { g.setColor(Color.yellow); //don't iterate through dataSet whiling making changes synchronized(layerImport.importing) { for (EditGpxTrack track: data.getTracks()) { for (EditGpxTrackSegment segment: track.getSegments()) { for (EditGpxWayPoint wayPoint: segment.getWayPoints()) { if (!wayPoint.isDeleted()) { Point pnt = mv.getPoint(wayPoint.getCoor().getEastNorth()); g.drawOval(pnt.x - 2, pnt.y - 2, 4, 4); } } } } } } public void reset(){ //TODO implement a reset } @Override public void visitBoundingBox(BoundingXYVisitor v) { // TODO Auto-generated method stub } /** * convert a DataSet to GPX * * @param boolean anonTime If true set all time and date in GPX to 01/01/1970 00:00 ? * @return GPXData */ private GpxData toGpxData(boolean anonTime) { return data.createGpxData(anonTime); } /** * Context item "Convert to GPX layer" */ public class ConvertToGpxLayerAction extends AbstractAction { public ConvertToGpxLayerAction() { super(tr("Convert to GPX layer"), ImageProvider.get("converttogpx")); } @Override public void actionPerformed(ActionEvent e) { if (Main.map.mapMode instanceof EditGpxMode) { if (!Main.map.selectSelectTool(false)) { Main.map.selectZoomTool(false); // Select tool might not be support of active layer, zoom is always supported } } Main.main.addLayer(new GpxLayer(toGpxData(false), tr("Converted from: {0}", getName()))); Main.main.removeLayer(EditGpxLayer.this); } } /** * Context item "Convert to GPX layer with anonymised time" */ public class ConvertToAnonTimeGpxLayerAction extends AbstractAction { public ConvertToAnonTimeGpxLayerAction() { super(tr("Convert to GPX layer with anonymised time"), ImageProvider.get("converttogpx")); } @Override public void actionPerformed(ActionEvent e) { if (Main.map.mapMode instanceof EditGpxMode) { if (!Main.map.selectSelectTool(false)) { Main.map.selectZoomTool(false); // Select tool might not be support of active layer, zoom is always supported } } Main.main.addLayer(new GpxLayer(toGpxData(true), tr("Converted from: {0}", getName()))); Main.main.removeLayer(EditGpxLayer.this); } } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootjosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/GPXLayerImportAction.javajosm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/GPXLayerImportAction.ja0000644000175000017500000001016612405376701031626 0ustar basbas/** * License: GPL. Copyright 2008. Martin Garbe (leo at running-sheep dot com) * * other source from mesurement plugin written by Raphael Mack * */ package org.openstreetmap.josm.plugins.editgpx; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.Component; import java.awt.event.ActionEvent; import java.util.Collection; import javax.swing.AbstractAction; import javax.swing.Box; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.Icon; import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.gui.layer.GpxLayer; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.plugins.editgpx.data.EditGpxData; import org.openstreetmap.josm.tools.ImageProvider; /** * Import GPX data from available layers. * */ class GPXLayerImportAction extends AbstractAction { private EditGpxData data; public Object importing = new Object(); //used for synchronization public GPXLayerImportAction(EditGpxData data) { //TODO what is icon at the end? super(tr("Import path from GPX layer"), ImageProvider.get("dialogs", "edit")); this.data = data; } /** * shows a list of GPX layers. if user selects one the data from this layer is imported. */ public void activateImport() { Box panel = Box.createVerticalBox(); DefaultListModel dModel = new DefaultListModel<>(); final JList layerList = new JList<>(dModel); Collection data = Main.map.mapView.getAllLayers(); int layerCnt = 0; for (Layer l : data){ if(l instanceof GpxLayer){ dModel.addElement((GpxLayer) l); layerCnt++; } } if(layerCnt > 0){ layerList.setSelectionInterval(0, layerCnt-1); layerList.setCellRenderer(new DefaultListCellRenderer(){ @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Layer layer = (Layer)value; JLabel label = (JLabel)super.getListCellRendererComponent(list, layer.getName(), index, isSelected, cellHasFocus); Icon icon = layer.getIcon(); label.setIcon(icon); label.setToolTipText(layer.getToolTipText()); return label; } }); JCheckBox dropFirst = new JCheckBox(tr("Drop existing path")); dropFirst.setEnabled(!this.data.getTracks().isEmpty()); panel.add(layerList); panel.add(dropFirst); final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION){ @Override public void selectInitialValue() { layerList.requestFocusInWindow(); } }; final JDialog dlg = optionPane.createDialog(Main.parent, tr("Import path from GPX layer")); dlg.setVisible(true); Object answer = optionPane.getValue(); if (answer == null || answer == JOptionPane.UNINITIALIZED_VALUE || (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION)) { return; } if (dropFirst.isSelected()) { this.data.getTracks().clear(); } synchronized(importing) { for (GpxLayer gpx : layerList.getSelectedValuesList()) { this.data.load(gpx.data); } } Main.map.mapView.repaint(); } else { // no gps layer JOptionPane.showMessageDialog(Main.parent,tr("No GPX data layer found.")); } } /** * called when pressing "Import.." from context menu of EditGpx layer * */ public void actionPerformed(ActionEvent arg0) { activateImport(); } } josm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxPlugin.java0000644000175000017500000000346412015535255030715 0ustar basbas/** * License: GPL. Copyright 2008. Martin Garbe (leo at running-sheep dot com) */ package org.openstreetmap.josm.plugins.editgpx; import static org.openstreetmap.josm.tools.I18n.tr; import java.net.URL; import javax.swing.ImageIcon; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.gui.IconToggleButton; import org.openstreetmap.josm.gui.MapFrame; import org.openstreetmap.josm.plugins.Plugin; import org.openstreetmap.josm.plugins.PluginInformation; /** * Provides an editable GPX layer. Editable layer here means the deletion of points is supported. * This plugin can be used to prepare tracks for upload to OSM eg. delete uninteresting parts * of the track. * Additionally while converting the track back to a normal GPX layer the time can be made * anonymous. This feature sets all time stamps to 1970-01-01 00:00. * * TODO: * - BUG: when importing eGpxLayer is shown as RawGpxLayer?? * - implement reset if user made mistake while marking * * */ public class EditGpxPlugin extends Plugin { private IconToggleButton btn; private EditGpxMode mode; public EditGpxPlugin(PluginInformation info) { super(info); mode = new EditGpxMode(Main.map, "editgpx", tr("edit gpx tracks")); btn = new IconToggleButton(mode); btn.setVisible(true); } /** * initialize button. if button is pressed create new layer. */ @Override public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { mode.setFrame(newFrame); if (oldFrame == null && newFrame != null) { if (Main.map != null) Main.map.addMapMode(btn); } } public static ImageIcon loadIcon(String name) { URL url = EditGpxPlugin.class.getResource("/images/editgpx.png"); return new ImageIcon(url); } } josm-plugins-0.0.svn31964/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxMode.java0000644000175000017500000001361212405376701030341 0ustar basbas/** * License: GPL. Copyright 2008. Martin Garbe (leo at running-sheep dot com) */ package org.openstreetmap.josm.plugins.editgpx; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.Color; import java.awt.Cursor; import java.awt.Graphics; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import java.util.List; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.actions.mapmode.MapMode; import org.openstreetmap.josm.gui.MapFrame; import org.openstreetmap.josm.gui.MapView; import org.openstreetmap.josm.gui.MapView.LayerChangeListener; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.plugins.editgpx.data.EditGpxData; import org.openstreetmap.josm.plugins.editgpx.data.EditGpxTrack; import org.openstreetmap.josm.plugins.editgpx.data.EditGpxTrackSegment; import org.openstreetmap.josm.plugins.editgpx.data.EditGpxWayPoint; public class EditGpxMode extends MapMode implements LayerChangeListener { private static final long serialVersionUID = 7940589057093872411L; Point pointPressed; MapFrame mapFrame; Rectangle oldRect; MapFrame frame; EditGpxLayer currentEditLayer; public EditGpxMode(MapFrame mapFrame, String name, String desc) { super(name, "editgpx_mode.png", desc, mapFrame, Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); } @Override public void enterMode() { super.enterMode(); Main.map.mapView.addMouseListener(this); Main.map.mapView.addMouseMotionListener(this); MapView.addLayerChangeListener(this); updateLayer(); } @Override public void exitMode() { super.exitMode(); Main.map.mapView.removeMouseListener(this); Main.map.mapView.removeMouseMotionListener(this); } @Override public void mousePressed(MouseEvent e) { pointPressed = new Point(e.getPoint()); } @Override public void mouseDragged(MouseEvent e) { if ( (e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == InputEvent.BUTTON1_DOWN_MASK) { //if button1 is hold, draw the rectangle. paintRect(pointPressed, e.getPoint()); } } @Override public void mouseReleased(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } requestFocusInMapView(); Point pointReleased = e.getPoint(); Rectangle r = createRect(pointReleased, pointPressed); //go through nodes and mark the ones in the selection rect as deleted if (currentEditLayer != null) { for (EditGpxTrack track: currentEditLayer.data.getTracks()) { for (EditGpxTrackSegment segment: track.getSegments()) { for (EditGpxWayPoint wayPoint: segment.getWayPoints()) { Point p = Main.map.mapView.getPoint(wayPoint.getCoor().getEastNorth()); if (r.contains(p)) { wayPoint.setDeleted(true); } } } } } oldRect = null; Main.map.mapView.repaint(); } /** * create rectangle out of two given corners */ public Rectangle createRect(Point p1, Point p2) { int x,y,w,h; if (p1.x == p2.x && p1.y == p2.y) { //if p1 and p2 same points draw a small rectangle around them x = p1.x -1; y = p1.y -1; w = 3; h = 3; } else { if (p1.x < p2.x){ x = p1.x; w = p2.x-p1.x; } else { x = p2.x; w = p1.x-p2.x; } if (p1.y < p2.y) { y = p1.y; h = p2.y-p1.y; } else { y = p2.y; h = p1.y-p2.y; } } return new Rectangle(x,y,w,h); } /** * Draw a selection rectangle on screen. */ private void paintRect(Point p1, Point p2) { if (frame != null) { Graphics g = frame.getGraphics(); Rectangle r = oldRect; if (r != null) { //overwrite old rct g.setXORMode(Color.BLACK); g.setColor(Color.WHITE); g.drawRect(r.x,r.y,r.width,r.height); } g.setXORMode(Color.BLACK); g.setColor(Color.WHITE); r = createRect(p1,p2); g.drawRect(r.x,r.y,r.width,r.height); oldRect = r; } } public void setFrame(MapFrame mapFrame) { frame = mapFrame; } /** * create new layer, add listeners and try importing gpx data. */ private void updateLayer() { List layers = Main.map.mapView.getLayersOfType(EditGpxLayer.class); currentEditLayer = layers.isEmpty()?null:layers.get(0); if(currentEditLayer == null) { currentEditLayer = new EditGpxLayer(tr("EditGpx"), new EditGpxData()); Main.main.addLayer(currentEditLayer); currentEditLayer.initializeImport(); } Main.map.mapView.repaint(); } public void activeLayerChange(Layer oldLayer, Layer newLayer) { } public void layerAdded(Layer newLayer) { } public void layerRemoved(Layer oldLayer) { if (oldLayer instanceof EditGpxLayer) { currentEditLayer = null; if (Main.map.mapMode instanceof EditGpxMode) { if (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) { Main.map.selectSelectTool(false); } else { Main.map.selectZoomTool(false); } } } } @Override public void destroy() { super.destroy(); MapView.removeLayerChangeListener(this); } } josm-plugins-0.0.svn31964/openvisible/0000755000175000017500000000000012643536104015633 5ustar basbasjosm-plugins-0.0.svn31964/openvisible/build.xml0000644000175000017500000001650512622466256017472 0ustar basbas Building against core revision ${coreversion.info.entry.revision}. Plugin-Mainversion is set to ${plugin.main.version}. Commiting the plugin source with message '${commit.message}' ... Updating plugin source ... Updating ${plugin.jar} ... ***** Properties of published ${plugin.jar} ***** Commit message : '${commit.message}' Plugin-Mainversion: ${plugin.main.version} JOSM build version: ${coreversion.info.entry.revision} Plugin-Version : ${version.entry.commit.revision} ***** / Properties of published ${plugin.jar} ***** Now commiting ${plugin.jar} ... josm-plugins-0.0.svn31964/openvisible/images/0000755000175000017500000000000012643536104017100 5ustar basbasjosm-plugins-0.0.svn31964/openvisible/images/openvisible.png0000644000175000017500000000142010707374273022130 0ustar basbasPNG  IHDRw=bKGDC pHYs  tIME  ԸIDATHUOQޝ15&"4 4gAX-,oD/  2 B4T&$voߌ`vi}f ]ݝO<{3¶lӎ\! ;:Rx~tx5`~~.xٺ07PWwPg#V)rcj3.,@8@mRIa!X (gjSW^]0s|D66(r?8hWivv6jrƵC`Pt` è a#hk(mёB*p ._/ d]+%q!D˝Ύs c߅L j9dz\܂ 4_R[7μ\LZȤ34[rİm։t #] (2 Z܄.E "\y\03nwܴdۮ@)K)XJR R)se[ADS8pJ GSp9ο}7~OLǩ PJA2dYBJ TPR&#A_ROl 0{9z&yiqyyeeO5TL)/ s(y:^yjvIENDB`josm-plugins-0.0.svn31964/openvisible/gpl-2.0.txt0000644000175000017500000004310311307646311017452 0ustar basbas GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. josm-plugins-0.0.svn31964/openvisible/.project0000644000175000017500000000056711230653047017307 0ustar basbas JOSM-openvisible org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature josm-plugins-0.0.svn31964/openvisible/.settings/0000755000175000017500000000000012643536104017551 5ustar basbasjosm-plugins-0.0.svn31964/openvisible/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000001514712420547421024540 0ustar basbaseclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 josm-plugins-0.0.svn31964/openvisible/data/0000755000175000017500000000000012643536104016544 5ustar basbasjosm-plugins-0.0.svn31964/openvisible/copyright.txt0000644000175000017500000000031111307646256020405 0ustar basbasPlugin openvisibl This plugin is copyrighted 2008-2009 by Christof Dallermassl . It is distributed under GPL-v3 or later license (see file gpl-3.0.txt in this directory). josm-plugins-0.0.svn31964/openvisible/.classpath0000644000175000017500000000056412326615515017625 0ustar basbas josm-plugins-0.0.svn31964/openvisible/gpl-3.0.txt0000644000175000017500000010451311307646311017456 0ustar basbas GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . josm-plugins-0.0.svn31964/openvisible/src/0000755000175000017500000000000012643536104016422 5ustar basbasjosm-plugins-0.0.svn31964/openvisible/src/at/0000755000175000017500000000000012643536104017026 5ustar basbasjosm-plugins-0.0.svn31964/openvisible/src/at/dallermassl/0000755000175000017500000000000012643536104021331 5ustar basbasjosm-plugins-0.0.svn31964/openvisible/src/at/dallermassl/josm/0000755000175000017500000000000012643536104022301 5ustar basbasjosm-plugins-0.0.svn31964/openvisible/src/at/dallermassl/josm/plugin/0000755000175000017500000000000012643536104023577 5ustar basbasjosm-plugins-0.0.svn31964/openvisible/src/at/dallermassl/josm/plugin/openvisible/0000755000175000017500000000000012643536104026116 5ustar basbas././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootjosm-plugins-0.0.svn31964/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisibleAction.javajosm-plugins-0.0.svn31964/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisibleAction.j0000644000175000017500000001264212102472047031646 0ustar basbas/** * */ package at.dallermassl.josm.plugin.openvisible; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.zip.GZIPInputStream; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.actions.JosmAction; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.gui.MapView; import org.openstreetmap.josm.gui.layer.GpxLayer; import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; import org.openstreetmap.josm.gui.progress.NullProgressMonitor; import org.openstreetmap.josm.io.GpxImporter; import org.openstreetmap.josm.io.GpxReader; import org.openstreetmap.josm.io.IllegalDataException; import org.openstreetmap.josm.io.OsmImporter; import org.openstreetmap.josm.io.OsmReader; import org.openstreetmap.josm.tools.Shortcut; import org.xml.sax.SAXException; import at.dallermassl.josm.plugin.openvisible.OsmGpxBounds; /** * @author cdaller * */ public class OpenVisibleAction extends JosmAction { private File lastDirectory; public OpenVisibleAction() { super(tr("Open Visible..."), "openvisible", tr("Open only files that are visible in current view."), Shortcut.registerShortcut("tools:openvisible", tr("Menu: {0}", tr("Open Visible...")), KeyEvent.VK_I, Shortcut.ALT_CTRL_SHIFT), true); } /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { if(Main.map == null || Main.map.mapView == null) { JOptionPane.showMessageDialog(Main.parent, tr("No view open - cannot determine boundaries!")); return; } MapView view = Main.map.mapView; Rectangle bounds = view.getBounds(); LatLon bottomLeft = view.getLatLon(bounds.x, bounds.y + bounds.height); LatLon topRight = view.getLatLon(bounds.x + bounds.width, bounds.y); System.err.println("FileFind Bounds: " + bottomLeft + " to " + topRight); JFileChooser fileChooser; if(lastDirectory != null) { fileChooser = new JFileChooser(lastDirectory); } else { fileChooser = new JFileChooser(); } fileChooser.setMultiSelectionEnabled(true); fileChooser.showOpenDialog(Main.parent); File[] files = fileChooser.getSelectedFiles(); lastDirectory = fileChooser.getCurrentDirectory(); for(File file : files) { try { OsmGpxBounds parser = new OsmGpxBounds(); parser.parse(new BufferedInputStream(new FileInputStream(file))); if(parser.intersects(bottomLeft.lat(), topRight.lat(), bottomLeft.lon(), topRight.lon())) { System.out.println(file.getAbsolutePath()); // + "," + parser.minLat + "," + parser.maxLat + "," + parser.minLon + "," + parser.maxLon); if(file.getName().endsWith("osm")) { openAsData(file); } else if(file.getName().endsWith("gpx")) { openFileAsGpx(file); } } } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } catch (SAXException e1) { e1.printStackTrace(); } catch(IllegalDataException e1) { e1.printStackTrace(); } } } private void openAsData(File file) throws SAXException, IOException, FileNotFoundException, IllegalDataException { String fn = file.getName(); if (new OsmImporter().acceptFile(file)) { DataSet dataSet = OsmReader.parseDataSet(new FileInputStream(file), NullProgressMonitor.INSTANCE); OsmDataLayer layer = new OsmDataLayer(dataSet, fn, file); Main.main.addLayer(layer); } else JOptionPane.showMessageDialog(Main.parent, fn+": "+tr("Unknown file extension: {0}", fn.substring(fn.lastIndexOf('.')+1))); } private void openFileAsGpx(File file) throws SAXException, IOException, FileNotFoundException { String fn = file.getName(); if (new GpxImporter().acceptFile(file)) { GpxReader r = null; if (file.getName().endsWith(".gpx.gz")) { r = new GpxReader(new GZIPInputStream(new FileInputStream(file))); } else{ r = new GpxReader(new FileInputStream(file)); } if (!r.parse(true)) { // input was not properly parsed, abort JOptionPane.showMessageDialog(Main.parent, tr("Parsing file \"{0}\" failed", file)); throw new IllegalStateException(); } r.getGpxData().storageFile = file; GpxLayer gpxLayer = new GpxLayer(r.getGpxData(), fn); Main.main.addLayer(gpxLayer); Main.main.addLayer(new MarkerLayer(r.getGpxData(), tr("Markers from {0}", fn), file, gpxLayer)); } else { throw new IllegalStateException(); } } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootjosm-plugins-0.0.svn31964/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisiblePlugin.javajosm-plugins-0.0.svn31964/openvisible/src/at/dallermassl/josm/plugin/openvisible/OpenVisiblePlugin.j0000644000175000017500000000073712174301462031672 0ustar basbas/** * */ package at.dallermassl.josm.plugin.openvisible; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.gui.MainMenu; import org.openstreetmap.josm.plugins.Plugin; import org.openstreetmap.josm.plugins.PluginInformation; /** * @author cdaller * */ public class OpenVisiblePlugin extends Plugin { public OpenVisiblePlugin(PluginInformation info) { super(info); MainMenu.add(Main.main.menu.gpsMenu, new OpenVisibleAction()); } } josm-plugins-0.0.svn31964/openvisible/src/at/dallermassl/josm/plugin/openvisible/OsmGpxBounds.java0000644000175000017500000001011511141405442031337 0ustar basbas/** * */ package at.dallermassl.josm.plugin.openvisible; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; /** * @author cdaller * */ public class OsmGpxBounds extends DefaultHandler { private double minLat = 180.0; private double maxLat = -180.0; private double minLon = 90.0; private double maxLon = -90.0; public OsmGpxBounds() { } /** * Parses the given input stream (gpx or osm file). * @param in the stream to parse. * @throws IOException if the file cannot be read. * @throws SAXException if the file could not be parsed. */ public void parse(InputStream in) throws IOException, SAXException { try { SAXParserFactory.newInstance().newSAXParser().parse(in, this); } catch (ParserConfigurationException e1) { e1.printStackTrace(); // broken SAXException chaining throw new SAXException(e1); } } @Override public void startElement(String ns, String lname, String qname, Attributes a) { if (qname.equals("node") || qname.equals("trkpt")) { double lat = Double.parseDouble(a.getValue("lat")); double lon = Double.parseDouble(a.getValue("lon")); minLat = Math.min(minLat, lat); minLon = Math.min(minLon, lon); maxLat = Math.max(maxLat, lat); maxLon = Math.max(maxLon, lon); } } /** * Returns true, if the given coordinates intersect with the * parsed min/max latitude longitude. * @param minLat the minimum latitude. * @param maxLat the maximum latitude. * @param minLon the minimum longitude. * @param maxLon the maximum longitude. * @return true if the given rectangle intersects with the parsed min/max. */ public boolean intersects(double minLat, double maxLat, double minLon, double maxLon) { double lat1 = Math.max(this.minLat, minLat); double lon1 = Math.max(this.minLon, minLon); double lat2 = Math.min(this.maxLat, maxLat); double lon2 = Math.min(this.maxLon, maxLon); return ((lat2-lat1) > 0) && ((lon2-lon1) > 0); } public static void main(String[] args) { if(args.length < 5) { printHelp(); return; } double minLat = Double.parseDouble(args[0]); double maxLat = Double.parseDouble(args[1]); double minLon = Double.parseDouble(args[2]); double maxLon = Double.parseDouble(args[3]); String[] files = new String[args.length - 4]; System.arraycopy(args, 4, files, 0, args.length - 4); try { File file; for(String fileName : files) { file = new File(fileName); if(!file.isDirectory() && (file.getName().endsWith("gpx") || file.getName().endsWith("osm"))) { OsmGpxBounds parser = new OsmGpxBounds(); parser.parse(new BufferedInputStream(new FileInputStream(file))); if(parser.intersects(minLat, maxLat, minLon, maxLon)) { System.out.println(file.getAbsolutePath()); // + "," + parser.minLat + "," + parser.maxLat + "," + parser.minLon + "," + parser.maxLon); } // System.out.println(parser.intersects(47.0555, 47.09, 15.406, 15.4737)); } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } } /** * */ private static void printHelp() { System.out.println(OsmGpxBounds.class.getName() + " "); } } josm-plugins-0.0.svn31964/openvisible/nbproject/0000755000175000017500000000000012643536104017621 5ustar basbasjosm-plugins-0.0.svn31964/openvisible/nbproject/project.xml0000644000175000017500000000526212326615515022020 0ustar basbas org.netbeans.modules.ant.freeform openvisible openvisible java src UTF-8 . UTF-8 compile clean install clean compile src build.xml src ../../core/src 1.7 josm-plugins-0.0.svn31964/lakewalker/0000755000175000017500000000000012643536104015436 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/resources/0000755000175000017500000000000012643536104017450 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/build.xml0000644000175000017500000000225712642235110017255 0ustar basbas josm-plugins-0.0.svn31964/lakewalker/images/0000755000175000017500000000000012643536104016703 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/images/preferences/0000755000175000017500000000000012643536104021204 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/images/preferences/lakewalker.png0000644000175000017500000000211110656707157024041 0ustar basbasPNG  IHDR szzbKGD pHYs  tIME . 3CtEXtCommentCreated with The GIMPd%nIDATxWAL#UڙN m@cmXԉY؋pⰗv7&Gmb4d5BR/tWcl x@[I-vq" -]B㗼˼}Wϳ-#@DtZp>#4MF1|xajr5L9^$Pu:M*Ab $5`0I&/eT*AՎh 5f;*_߹;kO"xMf2|] ð$Ea9C񈽜Dni֩@|w'fGo5cR/tK vf;4T{ 0ZPDv~@3/VibHN1Ot3 XtFL(hgEG(e/9y&nw<Ų _$I,,%P`_=@$P(ʲ Ma k'D37ZW4M矚@(_zmDJ6G Lz0S5"̆NY톜˩Mz//xSfZH"+\.ft&), ׏FoJ'UD{$#],7ۓW:PLt{*UG5SE!,/"s$ A-4.IRػd\WFtABvi(@ ug[ (c+&V(fޏ\;C5Í)mܿO% 0rxMC'IEQ+ʿ 5tvvƝNg`ee0̤ \%EZ~˞d}yox^:119 Cp&ᥥ%W#|! RaQ E9its9xpUә{ܚ0I"QUA# (&空xaEW"#ɲ{U.8lXac!F& Ud/uA̓J7.ڥ||j]CF>i"k P*A TAiSPPk X.NzH[ͯOȴiǨ|]hvvQ{ݣʼn!E*"E;bFx,mXloeNBȶi͏ZǎYY O4>>NM=j h50Իh4Uq^{Yg(\9S$T r9-ǥC&#w&|ӋWVDhoo΂Y|~_"(?ZX}$ovg{_zyp_'_OďGI:m~dyii <*ٺ"n6^+r mAO0m%-/Q^: µo9s쇶t,cϙc[釡W)Xk79՜yƦ&Vc PJgנe@_2(/\.I~ ލ%~ix6wqѼC&0BdVogʓb9f.NY;*%$I*dVM&L&ӛ,1؇96_7=3=BUpIENDB`josm-plugins-0.0.svn31964/lakewalker/images/lakewalker-sml.png0000644000175000017500000000202710656707157022337 0ustar basbasPNG  IHDRw=bKGD pHYs  tIME ..CtEXtCommentCreated with The GIMPd%n{IDATxUMlEfv^8]'!]ˉ$UEUJ RDUr zq(Gz@%P P%*P!USr  1$Yk.@ZvV;>}yox^:119 Cp&ᥥ%W#|! RaQ E9its9xpUә{ܚ0I"QUA# (&空xaEW"#ɲ{U.8lXac!F& Ud/uA̓J7.ڥ||j]CF>i"k P*A TAiSPPk X.NzH[ͯOȴiǨ|]hvvQ{ݣʼn!E*"E;bFx,mXloeNBȶi͏ZǎYY O4>>NM=j h50Իh4Uq^{Yg(\9S$T r9-ǥC&#w&|ӋWVDhoo΂Y|~_"(?ZX}$ovg{_zyp_'_OďGI:m~dyii <*ٺ"n6^+r mAO0m%-/Q^: µo9s쇶t,cϙc[釡W)Xk79՜yƦ&Vc PJgנe@_2(/\.I~ ލ%~ix6wqѼC&0BdVogʓb9f.NY;*%$I*dVM&L&ӛ,1؇96_7=3=BUpIENDB`josm-plugins-0.0.svn31964/lakewalker/.project0000644000175000017500000000060712204774241017107 0ustar basbas JOSM-lakewalker org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature josm-plugins-0.0.svn31964/lakewalker/.settings/0000755000175000017500000000000012643536104017354 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/.settings/org.eclipse.jdt.ui.prefs0000644000175000017500000000510411327367545024034 0ustar basbas#Sun Jan 24 21:18:20 CET 2010 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_to_enhanced_for_loop=false sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=false sp_cleanup.format_source_code_changes_only=false sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true sp_cleanup.remove_unnecessary_nls_tags=false sp_cleanup.remove_unused_imports=false sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true josm-plugins-0.0.svn31964/lakewalker/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000001514712420547421024343 0ustar basbaseclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 josm-plugins-0.0.svn31964/lakewalker/data/0000755000175000017500000000000012643536104016347 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/.classpath0000644000175000017500000000056612326615515017432 0ustar basbas josm-plugins-0.0.svn31964/lakewalker/README0000644000175000017500000000137510756236166016334 0ustar basbasREADME FOR Lakewalker ======================= The Lakewalker plugin can be used to generate traces of lakes, rivers or shoreline from LANDSAT imagery (or theoretically any imagery that is provided on a WMS server). Currently the plugin features 2 modes of operation: Native and Classic. The classic mode requires the Python lakewalker.py script to be downloaded into the lakewalker directory within the JOSM plugin directory. Common Features: - On-screen feedback to Lakewalker progress with cancel - Tag ways appropriately - limit ways to length - Manage Landsat image cache from Prefs screen Native Features: - Doesn't require Python Classic Features: - Access all lakewalker options via preferences - Read data in thread - ...josm-plugins-0.0.svn31964/lakewalker/src/0000755000175000017500000000000012643536104016225 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/src/org/0000755000175000017500000000000012643536104017014 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/0000755000175000017500000000000012643536104021702 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/0000755000175000017500000000000012643536104022652 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/0000755000175000017500000000000012643536104024333 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/0000755000175000017500000000000012643536104026455 5ustar basbas././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.javajosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringConfigurer.0000644000175000017500000000451511444175072031756 0ustar basbas/* * $Id: StringConfigurer.java 2073 2007-05-10 14:34:31 +0000 (Thu, 10 May 2007) rodneykinney $ * * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License (LGPL) as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, copies are available * at http://www.opensource.org. */ package org.openstreetmap.josm.plugins.lakewalker; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; /** * A Configurer for String values */ public class StringConfigurer extends Configurer { protected JPanel p; protected JTextField nameField = new JTextField(12); public StringConfigurer() { this(null, ""); } public StringConfigurer(String key, String name) { this(key, name, ""); } public StringConfigurer(String key, String name, String val) { super(key, name, val); } @Override public String getValueString() { return (String) value; } @Override public void setValue(String s) { if (!noUpdate && nameField != null) { nameField.setText(s); } setValue((Object) s); } public void setToolTipText(String s) { nameField.setToolTipText(s); } @Override public java.awt.Component getControls() { if (p == null) { p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(new JLabel(getName())); nameField.setMaximumSize (new java.awt.Dimension(nameField.getMaximumSize().width, nameField.getPreferredSize().height)); nameField.setText(getValueString()); p.add(nameField); nameField.addKeyListener(new java.awt.event.KeyAdapter() { @Override public void keyReleased(java.awt.event.KeyEvent evt) { noUpdate = true; setValue(nameField.getText()); noUpdate = false; } }); } return p; } } josm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Configurer.java0000644000175000017500000000774311444175072031437 0ustar basbas/* * $Id: Configurer.java 2175 2007-06-04 04:19:59 +0000 (Mon, 04 Jun 2007) rodneykinney $ * * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License (LGPL) as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, copies are available * at http://www.opensource.org. */ package org.openstreetmap.josm.plugins.lakewalker; import java.beans.PropertyChangeListener; /** * A property editor class. Wraps an Object value and provides * methods for saving and restoring the Object from a String. Also * includes a {@link java.awt.Component} that can be placed into a * property editing window, allowing the user to change the value * interactively. * */ public abstract class Configurer { // FIXME: maybe parameterize this so that value can have the right type // in subclasses? public static final String NAME_PROPERTY = "Configurer.name"; // public static final String VALUE_PROPERTY = "value"; /** A String the uniquely identifies this property */ protected String key; /** A String that provides a short description of the property to the user */ protected String name; /** The value */ protected Object value; protected java.beans.PropertyChangeSupport changeSupport; /** When noUpdate is true, setting the value programmatically will not * result in an update of the GUI Component */ protected boolean noUpdate = false; /** When frozen is true, setting the value programmatically will not * result in a PropertyChangeEvent being fired */ protected boolean frozen = false; public Configurer(String key, String name) { this(key, name, null); } public Configurer(String key, String name, Object val) { this.key = key; this.name = name; changeSupport = new java.beans.PropertyChangeSupport(this); setValue(val); } /** * Unique identifier */ public String getKey() { return key; } /** * Plain English description of the Object */ public String getName() { return name; } public void setName(String s) { String oldName = name; name = s; if (!frozen) { changeSupport.firePropertyChange(NAME_PROPERTY, oldName, name); } } /** * The Object value * May be null if the Object has not been initialized */ public Object getValue() { return value; } /** * @return a String representation of the Object value */ public abstract String getValueString(); /** * Set the Object value */ public void setValue(Object o) { Object oldValue = getValue(); value = o; if (!frozen) { changeSupport.firePropertyChange(key, oldValue, value); } } /** * If true, then don't fire PropertyChangeEvents when the value is reset */ public void setFrozen(boolean val) { frozen = val; } public boolean isFrozen() { return frozen; } /** * Fire a PropertyChangeEvent as if the value had been set from null */ public void fireUpdate() { changeSupport.firePropertyChange(key, null, value); } /** * Set the Object value from a String */ public abstract void setValue(String s); /** * GUI interface for setting the option in an editing window */ public abstract java.awt.Component getControls(); /** * Add a listener to be notified when the Object state changes */ public void addPropertyChangeListener(java.beans.PropertyChangeListener l) { changeSupport.addPropertyChangeListener(l); } public void removePropertyChangeListener(PropertyChangeListener l) { changeSupport.removePropertyChangeListener(l); } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.javajosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.0000644000175000017500000000351411444175072031720 0ustar basbas/* * $Id: DoubleConfigurer.java 5 2003-10-02 15:11:38 +0000 (Thu, 02 Oct 2003) rodneykinney $ * * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License (LGPL) as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, copies are available * at http://www.opensource.org. */ package org.openstreetmap.josm.plugins.lakewalker; /** * A Configurer for Double values */ public class DoubleConfigurer extends StringConfigurer { public DoubleConfigurer() { super(); } public DoubleConfigurer(String key, String name) { this(key, name, new Double(0)); } public DoubleConfigurer(String key, String name, Double val) { super(key, name, val == null ? null : val.toString()); } @Override public void setValue(String s) { Double d = null; try { d = Double.valueOf(s); } catch (NumberFormatException e) { d = null; } if (d != null) setValue(d); } @Override public void setValue(Object o) { if (!noUpdate && nameField != null && o != null) { nameField.setText(o.toString()); } super.setValue(o); } @Override public String getValueString() { if (value == null || value.equals("")) { return null; } return value.toString(); } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer.javajosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/BooleanConfigurer0000644000175000017500000000501511444175072032005 0ustar basbas/* * $Id: BooleanConfigurer.java 705 2005-09-15 13:24:50 +0000 (Thu, 15 Sep 2005) rodneykinney $ * * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License (LGPL) as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, copies are available * at http://www.opensource.org. */ package org.openstreetmap.josm.plugins.lakewalker; /** * Configurer for Boolean values */ public class BooleanConfigurer extends Configurer { private javax.swing.JCheckBox box; public BooleanConfigurer() { this(false); } public BooleanConfigurer(boolean val) { this(null, "", val); } public BooleanConfigurer(String key, String name, Boolean val) { super(key, name, val); } public BooleanConfigurer(String key, String name, boolean val) { super(key, name, val ? Boolean.TRUE : Boolean.FALSE); } public BooleanConfigurer(String key, String name) { this(key, name, Boolean.FALSE); } @Override public String getValueString() { return booleanValue().toString(); } @Override public void setValue(Object o) { super.setValue(o); if (box != null && !o.equals(box.isSelected())) { box.setSelected(booleanValue().booleanValue()); } } @Override public void setValue(String s) { setValue(Boolean.valueOf(s)); } @Override public void setName(String s) { super.setName(s); if (box != null) { box.setText(s); } } @Override public java.awt.Component getControls() { if (box == null) { box = new javax.swing.JCheckBox(getName()); box.setSelected(booleanValue().booleanValue()); box.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { setValue(box.isSelected()); } }); } return box; } public Boolean booleanValue() { return (Boolean) value; } } josm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/Lakewalker.java0000644000175000017500000003411012445051070031373 0ustar basbaspackage org.openstreetmap.josm.plugins.lakewalker; import static org.openstreetmap.josm.tools.I18n.tr; import java.util.ArrayList; import java.util.List; import org.openstreetmap.josm.gui.progress.ProgressMonitor; public class Lakewalker { protected boolean cancel; private int maxnode; private int threshold; private int resolution; private int tilesize; private String startdir; private String wmslayer; private int[] dirslat = new int[] {0,1,1,1,0,-1,-1,-1}; private int[] dirslon = new int[] {1,1,0,-1,-1,-1,0,1}; double start_radius_big = 0.001; double start_radius_small = 0.0002; public Lakewalker(int waylen, int maxnode, int threshold, double epsilon, int resolution, int tilesize, String startdir, String wmslayer){ this.maxnode = maxnode; this.threshold = threshold; this.resolution = resolution; this.tilesize = tilesize; this.startdir = startdir; this.wmslayer = wmslayer; } /** * east = 0 * northeast = 1 * north = 2 * northwest = 3 * west = 4 * southwest = 5 * south = 6 * southeast = 7 */ private int getDirectionIndex(String direction) throws ArrayIndexOutOfBoundsException{ int i=0; if(direction.equals("East") || direction.equals("east")){ i = 0; } else if(direction.equals("Northeast") || direction.equals("northeast")){ i = 1; } else if(direction.equals("North") || direction.equals("north")){ i = 2; } else if(direction.equals("Northwest") || direction.equals("northwest")){ i = 3; } else if(direction.equals("West") || direction.equals("west")){ i = 4; } else if(direction.equals("Southwest") || direction.equals("southwest")){ i = 5; } else if(direction.equals("South") || direction.equals("south")){ i = 6; } else if(direction.equals("Southeast") || direction.equals("southeast")){ i = 7; } else { throw new ArrayIndexOutOfBoundsException(tr("Direction index ''{0}'' not found",direction)); } return i; } /** * Do a trace * * @param lat * @param lon * @param tl_lon * @param br_lon * @param tl_lat * @param br_lat */ public ArrayList trace(double lat, double lon, double tl_lon, double br_lon, double tl_lat, double br_lat, ProgressMonitor progressMonitor) throws LakewalkerException { progressMonitor.beginTask(null); try { LakewalkerWMS wms = new LakewalkerWMS(this.resolution, this.tilesize, this.wmslayer); LakewalkerBBox bbox = new LakewalkerBBox(tl_lat,tl_lon,br_lat,br_lon); Boolean detect_loop = false; ArrayList nodelist = new ArrayList<>(); int[] xy = geo_to_xy(lat,lon,this.resolution); if(!bbox.contains(lat, lon)){ throw new LakewalkerException(tr("The starting location was not within the bbox")); } int v; progressMonitor.indeterminateSubTask(tr("Looking for shoreline...")); while(true){ double[] geo = xy_to_geo(xy[0],xy[1],this.resolution); if(bbox.contains(geo[0],geo[1])==false){ break; } v = wms.getPixel(xy[0], xy[1], progressMonitor.createSubTaskMonitor(0, false)); if(v > this.threshold){ break; } int delta_lat = this.dirslat[getDirectionIndex(this.startdir)]; int delta_lon = this.dirslon[getDirectionIndex(this.startdir)]; xy[0] = xy[0]+delta_lon; xy[1] = xy[1]+delta_lat; } int[] startxy = new int[] {xy[0], xy[1]}; double[] startgeo = xy_to_geo(xy[0],xy[1],this.resolution); //System.out.printf("Found shore at lat %.4f lon %.4f\n",lat,lon); int last_dir = this.getDirectionIndex(this.startdir); for(int i = 0; i < this.maxnode; i++){ // Print a counter if(i % 250 == 0){ progressMonitor.indeterminateSubTask(tr("{0} nodes so far...",i)); //System.out.println(i+" nodes so far..."); } // Some variables we need int d; int test_x=0; int test_y=0; int new_dir = 0; // Loop through all the directions we can go for(d = 1; d <= this.dirslat.length; d++){ // Decide which direction we want to look at from this pixel new_dir = (last_dir + d + 4) % 8; test_x = xy[0] + this.dirslon[new_dir]; test_y = xy[1] + this.dirslat[new_dir]; double[] geo = xy_to_geo(test_x,test_y,this.resolution); if(!bbox.contains(geo[0], geo[1])){ System.out.println("Outside bbox"); break; } v = wms.getPixel(test_x, test_y, progressMonitor.createSubTaskMonitor(0, false)); if(v > this.threshold){ break; } if(d == this.dirslat.length-1){ System.out.println("Got stuck"); break; } } // Remember this direction last_dir = new_dir; // Set the pixel we found as current xy[0] = test_x; xy[1] = test_y; // Break the loop if we managed to get back to our starting point if(xy[0] == startxy[0] && xy[1] == startxy[1]){ break; } // Store this node double[] geo = xy_to_geo(xy[0],xy[1],this.resolution); nodelist.add(geo); //System.out.println("Adding node at "+xy[0]+","+xy[1]+" ("+geo[1]+","+geo[0]+")"); // Check if we got stuck in a loop double start_proximity = Math.pow((geo[0] - startgeo[0]),2) + Math.pow((geo[1] - startgeo[1]),2); if(detect_loop){ if(start_proximity < Math.pow(start_radius_small,2)){ System.out.println("Detected loop"); break; } }else{ if(start_proximity > Math.pow(start_radius_big,2)){ detect_loop = true; } } } return nodelist; } finally { progressMonitor.finishTask(); } } /** * Remove duplicate nodes from the list * * @param nodes * @return */ public ArrayList duplicateNodeRemove(ArrayList nodes){ if(nodes.size() <= 1){ return nodes; } double lastnode[] = new double[] {nodes.get(0)[0], nodes.get(0)[1]}; for(int i = 1; i < nodes.size(); i++){ double[] thisnode = new double[] {nodes.get(i)[0], nodes.get(i)[1]}; if(thisnode[0] == lastnode[0] && thisnode[1] == lastnode[1]){ // Remove the node nodes.remove(i); // Shift back one index i = i - 1; } lastnode = thisnode; } return nodes; } /** * Reduce the number of vertices based on their proximity to each other * * @param nodes * @param proximity * @return */ public ArrayList vertexReduce(ArrayList nodes, double proximity){ // Check if node list is empty if(nodes.size()<=1){ return nodes; } double[] test_v = nodes.get(0); ArrayList reducednodes = new ArrayList<>(); double prox_sq = Math.pow(proximity, 2); for(int v = 0; v < nodes.size(); v++){ if(Math.pow(nodes.get(v)[0] - test_v[0],2) + Math.pow(nodes.get(v)[1] - test_v[1],2) > prox_sq){ reducednodes.add(nodes.get(v)); test_v = nodes.get(v); } } return reducednodes; } public double pointLineDistance(double[] p1, double[] p2, double[] p3){ double x0 = p1[0]; double y0 = p1[1]; double x1 = p2[0]; double y1 = p2[1]; double x2 = p3[0]; double y2 = p3[1]; if(x2 == x1 && y2 == y1){ return Math.sqrt(Math.pow(x1-x0,2) + Math.pow(y1-y0,2)); } else { return Math.abs((x2-x1)*(y1-y0) - (x1-x0)*(y2-y1)) / Math.sqrt(Math.pow(x2-x1,2) + Math.pow(y2-y1,2)); } } /* public ArrayList douglasPeuckerNR(ArrayList nodes, double epsilon){ command_stack = [(0, len(nodes) - 1)] Vector result_stack = new Vector(); while(command_stack.size() > 0){ cmd = command_stack.pop(); if(type(cmd) == tuple){ (start, end) = cmd (node, dist) = dp_findpoint(nodes, start, end) if(dist > epsilon){ command_stack.append("+") command_stack.append((start, node)) command_stack.append((node, end)) } else { result_stack.append((start, end)) } } elseif(cmd == "+"){ first = result_stack.pop() second = result_stack.pop() if(first[-1] == second[0]){ result_stack.append(first + second[1:]) //print "Added %s and %s; result is %s" % (first, second, result_stack[-1]) }else { error("ERROR: Cannot connect nodestrings!") #print first #print second return; } } else { error("ERROR: Can't understand command \"%s\"" % (cmd,)) return if(len(result_stack) == 1){ return [nodes[x] for x in result_stack[0]]; } else { error("ERROR: Command stack is empty but result stack has %d nodes!" % len(result_stack)); return; } farthest_node = None farthest_dist = 0 first = nodes[0] last = nodes[-1] for(i in xrange(1, len(nodes) - 1){ d = point_line_distance(nodes[i], first, last) if(d > farthest_dist){ farthest_dist = d farthest_node = i } } if(farthest_dist > epsilon){ seg_a = douglas_peucker(nodes[0:farthest_node+1], epsilon) seg_b = douglas_peucker(nodes[farthest_node:-1], epsilon) //print "Minimized %d nodes to %d + %d nodes" % (len(nodes), len(seg_a), len(seg_b)) nodes = seg_a[:-1] + seg_b } else { return [nodes[0], nodes[-1]]; } return nodes; } */ public ArrayList douglasPeucker(ArrayList nodes, double epsilon, int depth){ // Check if node list is empty if(nodes.size()<=1 || depth > 500){ return nodes; } int farthest_node = -1; double farthest_dist = 0; double[] first = nodes.get(0); double[] last = nodes.get(nodes.size()-1); ArrayList new_nodes = new ArrayList<>(); double d = 0; for(int i = 1; i < nodes.size(); i++){ d = pointLineDistance(nodes.get(i),first,last); if(d>farthest_dist){ farthest_dist = d; farthest_node = i; } } List seg_a; List seg_b; if(farthest_dist > epsilon){ seg_a = douglasPeucker(sublist(nodes,0,farthest_node+1),epsilon, depth+1); seg_b = douglasPeucker(sublist(nodes,farthest_node,nodes.size()-1),epsilon,depth+1); new_nodes.addAll(seg_a); new_nodes.addAll(seg_b); } else { new_nodes.add(nodes.get(0)); new_nodes.add(nodes.get(nodes.size()-1)); } return new_nodes; } private ArrayList sublist(ArrayList l, int i, int f) throws ArrayIndexOutOfBoundsException { ArrayList sub = new ArrayList<>(); if(f l.size()){ throw new ArrayIndexOutOfBoundsException(); } for(int j = i; j < f; j++){ sub.add(l.get(j)); } return sub; } public double[] xy_to_geo(int x, int y, double resolution){ double[] geo = new double[2]; geo[0] = y / resolution; geo[1] = x / resolution; return geo; } public int[] geo_to_xy(double lat, double lon, double resolution){ int[] xy = new int[2]; xy[0] = (int)Math.floor(lon * resolution + 0.5); xy[1] = (int)Math.floor(lat * resolution + 0.5); return xy; } /* * User has hit the cancel button */ public void cancel() { cancel = true; } /** * Class to do checking of whether the point is within our bbox * * @author Jason Reid */ private static class LakewalkerBBox { private double top = 90; private double left = -180; private double bottom = -90; private double right = 180; protected LakewalkerBBox(double top, double left, double bottom, double right){ this.left = left; this.right = right; this.top = top; this.bottom = bottom; } protected Boolean contains(double lat, double lon){ if(lat >= this.top || lat <= this.bottom){ return false; } if(lon >= this.right || lon <= this.left){ return false; } if((this.right - this.left) % 360 == 0){ return true; } return (lon - this.left) % 360 <= (this.right - this.left) % 360; } } } ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerException.javajosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerExcepti0000644000175000017500000000047411444175072032012 0ustar basbaspackage org.openstreetmap.josm.plugins.lakewalker; import static org.openstreetmap.josm.tools.I18n.tr; class LakewalkerException extends Exception { public LakewalkerException(){ super(tr("An unknown error has occurred")); } public LakewalkerException(String err){ super(err); } } ././@LongLink0000644000000000000000000000015600000000000011605 Lustar rootrootjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.javajosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPrefere0000644000175000017500000002470412205016044031770 0ustar basbaspackage org.openstreetmap.josm.plugins.lakewalker; import static org.openstreetmap.josm.tools.I18n.marktr; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.GridBagConstraints; import javax.swing.Box; import javax.swing.JLabel; import javax.swing.JPanel; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; import org.openstreetmap.josm.tools.GBC; import org.openstreetmap.josm.tools.I18n; public class LakewalkerPreferences extends DefaultTabPreferenceSetting { public static final String[] DIRECTIONS = new String[] {marktr("east"), marktr("northeast"), marktr("north"), marktr("northwest"), marktr("west"), marktr("southwest"), marktr("south"), marktr("southeast")}; public static final String[] WAYTYPES = new String[] {marktr("water"), marktr("coastline"), marktr("land"), marktr("none")}; public static final String[] WMSLAYERS = new String[] {"IR1", "IR2", "IR3"}; public static final String PREF_MAX_SEG = "lakewalker.max_segs_in_way"; public static final String PREF_MAX_NODES = "lakewalker.max_nodes"; public static final String PREF_THRESHOLD_VALUE = "lakewalker.thresholdvalue"; public static final String PREF_EPSILON = "lakewalker.epsilon"; public static final String PREF_LANDSAT_RES = "lakewalker.landsat_res"; public static final String PREF_LANDSAT_SIZE = "lakewalker.landsat_size"; public static final String PREF_EAST_OFFSET = "lakewalker.east_offset"; public static final String PREF_NORTH_OFFSET = "lakewalker.north_offset"; public static final String PREF_START_DIR = "lakewalker.startdir"; public static final String PREF_WAYTYPE = "lakewalker.waytype"; public static final String PREF_WMS = "lakewalker.wms"; public static final String PREF_SOURCE = "lakewalker.source"; public static final String PREF_MAXCACHESIZE = "lakewalker.maxcachesize"; public static final String PREF_MAXCACHEAGE = "lakewalker.maxcacheage"; protected IntConfigurer maxSegsConfig = new IntConfigurer(); protected JLabel maxSegsLabel = new JLabel(tr("Maximum number of segments per way")); protected IntConfigurer maxNodesConfig = new IntConfigurer(); protected JLabel maxNodesLabel = new JLabel(tr("Maximum number of nodes in initial trace")); protected IntConfigurer thresholdConfig = new IntConfigurer(); protected JLabel thresholdLabel = new JLabel(tr("Maximum gray value to count as water (0-255)")); protected DoubleConfigurer epsilonConfig = new DoubleConfigurer(); protected JLabel epsilonLabel = new JLabel(tr("Line simplification accuracy (degrees)")); protected IntConfigurer landsatResConfig = new IntConfigurer(); protected JLabel landsatResLabel = new JLabel(tr("Resolution of Landsat tiles (pixels per degree)")); protected IntConfigurer landsatSizeConfig = new IntConfigurer(); protected JLabel landsatSizeLabel = new JLabel(tr("Size of Landsat tiles (pixels)")); protected DoubleConfigurer eastOffsetConfig = new DoubleConfigurer(); protected JLabel eastOffsetLabel = new JLabel(tr("Shift all traces to east (degrees)")); protected DoubleConfigurer northOffsetConfig = new DoubleConfigurer(); protected JLabel northOffsetLabel = new JLabel(tr("Shift all traces to north (degrees)")); protected StringEnumConfigurer startDirConfig = new StringEnumConfigurer(DIRECTIONS); protected JLabel startDirLabel = new JLabel(tr("Direction to search for land")); protected StringEnumConfigurer lakeTypeConfig = new StringEnumConfigurer(WAYTYPES); protected JLabel lakeTypeLabel = new JLabel(tr("Tag ways as")); protected StringEnumConfigurer wmsConfig = new StringEnumConfigurer(WMSLAYERS); protected JLabel wmsLabel = new JLabel(tr("WMS Layer")); protected IntConfigurer maxCacheSizeConfig = new IntConfigurer(); protected JLabel maxCacheSizeLabel = new JLabel(tr("Maximum cache size (MB)")); protected IntConfigurer maxCacheAgeConfig = new IntConfigurer(); protected JLabel maxCacheAgeLabel = new JLabel(tr("Maximum cache age (days)")); protected StringConfigurer sourceConfig = new StringConfigurer(); protected JLabel sourceLabel = new JLabel(tr("Source text")); public LakewalkerPreferences() { super("lakewalker.png", I18n.tr("Lakewalker Plugin Preferences"), tr("A plugin to trace water bodies on Landsat imagery.")); } public void addGui(PreferenceTabbedPane gui) { maxSegsConfig.setToolTipText(tr("Maximum number of segments allowed in each generated way. Default 250.")); maxNodesConfig.setToolTipText(tr("Maximum number of nodes to generate before bailing out (before simplifying lines). Default 50000.")); thresholdConfig.setToolTipText(tr("Maximum gray value to accept as water (based on Landsat IR-1 data). Can be in the range 0-255. Default 90.")); epsilonConfig.setToolTipText(tr("Accuracy of Douglas-Peucker line simplification, measured in degrees.
Lower values give more nodes, and more accurate lines. Default 0.0003.")); landsatResConfig.setToolTipText(tr("Resolution of Landsat tiles, measured in pixels per degree. Default 4000.")); landsatSizeConfig.setToolTipText(tr("Size of one landsat tile, measured in pixels. Default 2000.")); eastOffsetConfig.setToolTipText(tr("Offset all points in East direction (degrees). Default 0.")); northOffsetConfig.setToolTipText(tr("Offset all points in North direction (degrees). Default 0.")); startDirConfig.setToolTipText(tr("Direction to search for land. Default east.")); lakeTypeConfig.setToolTipText(tr("Tag ways as water, coastline, land or nothing. Default is water.")); wmsConfig.setToolTipText(tr("Which WMS layer to use for tracing against. Default is IR1.")); maxCacheSizeConfig.setToolTipText(tr("Maximum size of each cache directory in bytes. Default is 300MB")); maxCacheAgeConfig.setToolTipText(tr("Maximum age of each cached file in days. Default is 100")); sourceConfig.setToolTipText(tr("Data source text. Default is Landsat.")); /*String description =*/ tr("A plugin to trace water bodies on Landsat imagery."); JPanel prefPanel = gui.createPreferenceTab(this); buildPreferences(prefPanel); maxSegsConfig.setValue(Main.pref.getInteger(PREF_MAX_SEG, 500)); maxNodesConfig.setValue(Main.pref.getInteger(PREF_MAX_NODES, 50000)); thresholdConfig.setValue(Main.pref.getInteger(PREF_THRESHOLD_VALUE, 90)); epsilonConfig.setValue(Main.pref.getDouble(PREF_EPSILON, 0.0003)); landsatResConfig.setValue(Main.pref.getInteger(PREF_LANDSAT_RES, 4000)); landsatSizeConfig.setValue(Main.pref.getInteger(PREF_LANDSAT_SIZE, 2000)); eastOffsetConfig.setValue(Main.pref.getDouble(PREF_EAST_OFFSET, 0.0)); northOffsetConfig.setValue(Main.pref.getDouble(PREF_NORTH_OFFSET, 0.0)); startDirConfig.setValue(Main.pref.get(PREF_START_DIR, "east")); lakeTypeConfig.setValue(Main.pref.get(PREF_WAYTYPE, "water")); wmsConfig.setValue(Main.pref.get(PREF_WMS, "IR1")); sourceConfig.setValue(Main.pref.get(PREF_SOURCE, "Landsat")); maxCacheSizeConfig.setValue(Main.pref.getInteger(PREF_MAXCACHESIZE, 300)); maxCacheAgeConfig.setValue(Main.pref.getInteger(PREF_MAXCACHEAGE, 100)); } public void buildPreferences(JPanel prefPanel) { GBC labelConstraints = GBC.std().insets(10,5,5,0); GBC dataConstraints = GBC.eol().insets(0,5,0,0).fill(GridBagConstraints.HORIZONTAL); prefPanel.add(maxSegsLabel, labelConstraints); prefPanel.add(maxSegsConfig.getControls(), dataConstraints); prefPanel.add(maxNodesLabel, labelConstraints); prefPanel.add(maxNodesConfig.getControls(), dataConstraints); prefPanel.add(thresholdLabel, labelConstraints); prefPanel.add(thresholdConfig.getControls(), dataConstraints); prefPanel.add(epsilonLabel, labelConstraints); prefPanel.add(epsilonConfig.getControls(), dataConstraints); prefPanel.add(landsatResLabel, labelConstraints); prefPanel.add(landsatResConfig.getControls(), dataConstraints); prefPanel.add(landsatSizeLabel, labelConstraints); prefPanel.add(landsatSizeConfig.getControls(), dataConstraints); prefPanel.add(eastOffsetLabel, labelConstraints); prefPanel.add(eastOffsetConfig.getControls(), dataConstraints); prefPanel.add(northOffsetLabel, labelConstraints); prefPanel.add(northOffsetConfig.getControls(), dataConstraints); prefPanel.add(startDirLabel, labelConstraints); prefPanel.add(startDirConfig.getControls(), dataConstraints); prefPanel.add(lakeTypeLabel, labelConstraints); prefPanel.add(lakeTypeConfig.getControls(), dataConstraints); prefPanel.add(wmsLabel, labelConstraints); prefPanel.add(wmsConfig.getControls(), dataConstraints); prefPanel.add(maxCacheSizeLabel, labelConstraints); prefPanel.add(maxCacheSizeConfig.getControls(), dataConstraints); prefPanel.add(maxCacheAgeLabel, labelConstraints); prefPanel.add(maxCacheAgeConfig.getControls(), dataConstraints); prefPanel.add(sourceLabel, labelConstraints); prefPanel.add(sourceConfig.getControls(), dataConstraints); prefPanel.add(Box.createVerticalGlue(), GBC.eol().fill(GridBagConstraints.VERTICAL)); } /* * Save entered preference values on OK button */ public boolean ok() { Main.pref.put(PREF_MAX_SEG, maxSegsConfig.getValueString()); Main.pref.put(PREF_MAX_NODES, maxNodesConfig.getValueString()); Main.pref.put(PREF_THRESHOLD_VALUE, thresholdConfig.getValueString()); Main.pref.put(PREF_EPSILON, epsilonConfig.getValueString()); Main.pref.put(PREF_LANDSAT_RES, landsatResConfig.getValueString()); Main.pref.put(PREF_LANDSAT_SIZE, landsatSizeConfig.getValueString()); Main.pref.put(PREF_EAST_OFFSET, eastOffsetConfig.getValueString()); Main.pref.put(PREF_NORTH_OFFSET, northOffsetConfig.getValueString()); Main.pref.put(PREF_START_DIR, startDirConfig.getValueString()); Main.pref.put(PREF_WAYTYPE, lakeTypeConfig.getValueString()); Main.pref.put(PREF_WMS, wmsConfig.getValueString()); Main.pref.put(PREF_MAXCACHESIZE, maxCacheSizeConfig.getValueString()); Main.pref.put(PREF_MAXCACHEAGE, maxCacheAgeConfig.getValueString()); Main.pref.put(PREF_SOURCE, sourceConfig.getValueString()); return false; } } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.javajosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.jav0000644000175000017500000000377511444175072031752 0ustar basbas/* * $Id: IntConfigurer.java 874 2006-03-15 14:20:56 +0000 (Wed, 15 Mar 2006) rodneykinney $ * * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License (LGPL) as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, copies are available * at http://www.opensource.org. */ package org.openstreetmap.josm.plugins.lakewalker; /** * A Configurer for Integer values */ public class IntConfigurer extends StringConfigurer { public IntConfigurer() { super(); } public IntConfigurer(String key, String name) { this(key, name, 0); } public IntConfigurer(String key, String name, Integer val) { super(key, name); if (val != null) { setValue(val); } } @Override public void setValue(String s) { Integer i = null; try { i = Integer.valueOf(s); } catch (NumberFormatException e) { i = null; } if (i != null) { setValue(i); } } public int getIntValue(int defaultValue) { if (getValue() instanceof Integer) { return ((Integer)getValue()).intValue(); } else { return defaultValue; } } @Override public void setValue(Object o) { if (!noUpdate && nameField != null && o != null) { nameField.setText(o.toString()); } super.setValue(o); } @Override public String getValueString() { return value == null ? null : value.toString(); } } ././@LongLink0000644000000000000000000000014600000000000011604 Lustar rootrootjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.javajosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerWMS.jav0000644000175000017500000001734312445051070031632 0ustar basbaspackage org.openstreetmap.josm.plugins.lakewalker; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.math.BigDecimal; import java.net.MalformedURLException; import java.net.URL; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Vector; import javax.imageio.ImageIO; import org.openstreetmap.josm.gui.progress.ProgressMonitor; public class LakewalkerWMS { private BufferedImage image; private int imagex; private int imagey; // Vector to cache images in memory private List images = new Vector<>(); // Hashmap to hold the mapping of cached images private Map imageindex = new HashMap<>(); private int resolution; private int tilesize; private String wmslayer; public LakewalkerWMS(int resolution, int tilesize, String wmslayer){ this.resolution = resolution; this.tilesize = tilesize; this.wmslayer = wmslayer; } public BufferedImage getTile(int x, int y, ProgressMonitor progressMonitor) throws LakewalkerException { progressMonitor.beginTask(tr("Downloading image tile...")); try { String layer = "global_mosaic_base"; int[] bottom_left_xy = new int[2]; bottom_left_xy[0] = floor(x,this.tilesize); bottom_left_xy[1] = floor(y,this.tilesize); int[] top_right_xy = new int[2]; top_right_xy[0] = bottom_left_xy[0] + this.tilesize; top_right_xy[1] = bottom_left_xy[1] + this.tilesize; double[] topright_geo = xy_to_geo(top_right_xy[0],top_right_xy[1],this.resolution); double[] bottomleft_geo = xy_to_geo(bottom_left_xy[0],bottom_left_xy[1],this.resolution); String filename = this.wmslayer+"/landsat_"+this.resolution+"_"+this.tilesize+ "_xy_"+bottom_left_xy[0]+"_"+bottom_left_xy[1]+".png"; // The WMS server only understands decimal points using periods, so we need // to convert to a locale that uses that to build the proper URL NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH); DecimalFormat df = (DecimalFormat)nf; df.applyLocalizedPattern("0.000000"); String urlloc = "http://onearth.jpl.nasa.gov/wms.cgi?request=GetMap&layers="+layer+ "&styles="+wmslayer+"&srs=EPSG:4326&format=image/png"+ "&bbox="+df.format(bottomleft_geo[1])+","+df.format(bottomleft_geo[0])+ ","+df.format(topright_geo[1])+","+df.format(topright_geo[0])+ "&width="+this.tilesize+"&height="+this.tilesize; File file = new File(LakewalkerPlugin.getLakewalkerCacheDir(), filename); // Calculate the hashmap key String hashkey = Integer.toString(bottom_left_xy[0])+":"+Integer.toString(bottom_left_xy[1]); // See if this image is already loaded if(this.image != null){ if(this.imagex != bottom_left_xy[0] || this.imagey != bottom_left_xy[1]){ // Check if this image exists in the hashmap if(this.imageindex.containsKey(hashkey)){ // Store which image we have this.imagex = bottom_left_xy[0]; this.imagey = bottom_left_xy[1]; // Retrieve from cache this.image = this.images.get(this.imageindex.get(hashkey)); return this.image; } else { this.image = null; } } else { return this.image; } } try { System.out.println("Looking for image in disk cache: "+filename); // Read from a file this.image = ImageIO.read(file); this.images.add(this.image); this.imageindex.put(hashkey,this.images.size()-1); } catch(FileNotFoundException e){ System.out.println("Could not find cached image, downloading."); } catch(IOException e){ System.out.println(e.getMessage()); } catch(Exception e){ System.out.println(e.getMessage()); } if(this.image == null){ /** * Try downloading the image */ try { System.out.println("Downloading from "+urlloc); // Read from a URL URL url = new URL(urlloc); this.image = ImageIO.read(url); // this can return null! } catch(MalformedURLException e){ System.out.println(e.getMessage()); } catch(IOException e){ System.out.println(e.getMessage()); } catch(Exception e){ System.out.println(e.getMessage()); } if (this.image != null) { this.images.add(this.image); this.imageindex.put(hashkey,this.images.size()-1); this.saveimage(file,this.image); } } this.imagex = bottom_left_xy[0]; this.imagey = bottom_left_xy[1]; if(this.image == null){ throw new LakewalkerException(tr("Could not acquire image")); } return this.image; } finally { progressMonitor.finishTask(); } } public void saveimage(File file, BufferedImage image){ /** * Save the image to the cache */ try { ImageIO.write(image, "png", file); System.out.println("Saved image to cache"); } catch(Exception e){ System.out.println(e.getMessage()); } } public int getPixel(int x, int y, ProgressMonitor progressMonitor) throws LakewalkerException{ // Get the previously shown text BufferedImage image = null; try { image = this.getTile(x,y, progressMonitor); } catch(LakewalkerException e){ System.out.println(e.getMessage()); throw e; } int tx = floor(x,this.tilesize); int ty = floor(y,this.tilesize); int pixel_x = (x-tx); int pixel_y = (this.tilesize-1)-(y-ty); //System.out.println("("+x+","+y+") maps to ("+pixel_x+","+pixel_y+") by ("+tx+", "+ty+")"); int rgb = image.getRGB(pixel_x,pixel_y); int pixel; int r = (rgb >> 16) & 0xff; int g = (rgb >> 8) & 0xff; int b = (rgb >> 0) & 0xff; pixel = (int)((0.30 * r) + (0.59 * b) + (0.11 * g)); return pixel; } public int floor(int num, int precision){ double dnum = num/(double)precision; BigDecimal val = new BigDecimal(dnum) ; val = val.setScale(0, BigDecimal.ROUND_FLOOR); return val.intValue()*precision; } public double floor(double num) { BigDecimal val = new BigDecimal(num) ; val = val.setScale(0, BigDecimal.ROUND_FLOOR); return val.doubleValue() ; } public double[] xy_to_geo(int x, int y, double resolution){ double[] geo = new double[2]; geo[0] = y / resolution; geo[1] = x / resolution; return geo; } public int[] geo_to_xy(double lat, double lon, double resolution){ int[] xy = new int[2]; xy[0] = (int)Math.floor(lon * resolution + 0.5); xy[1] = (int)Math.floor(lat * resolution + 0.5); return xy; } } ././@LongLink0000644000000000000000000000015500000000000011604 Lustar rootrootjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigurer.javajosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/StringEnumConfigu0000644000175000017500000000660212360636736032022 0ustar basbas/* * $Id: StringEnumConfigurer.java 2472 2007-10-01 04:10:19 +0000 (Mon, 01 Oct 2007) rodneykinney $ * * Copyright (c) 2000-2007 by Rodney Kinney, Brent Easton * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License (LGPL) as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, copies are available * at http://www.opensource.org. */ /* * Created by IntelliJ IDEA. * User: rkinney * Date: Jul 20, 2002 * Time: 3:52:36 AM * To change template for new class use * Code Style | Class Templates options (Tools | IDE Options). */ package org.openstreetmap.josm.plugins.lakewalker; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.Component; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Box; import javax.swing.JComboBox; import javax.swing.JLabel; /** * A Configurer that returns a String from among a list of possible values */ public class StringEnumConfigurer extends Configurer { protected String[] validValues; protected String[] transValues; protected JComboBox box; protected Box panel; protected String tooltipText = ""; public StringEnumConfigurer(String key, String name, String[] validValues) { super(key, name); this.validValues = validValues; transValues = new String[validValues.length]; for(int i = 0; i < validValues.length; ++i) transValues[i] = tr(validValues[i]); } public StringEnumConfigurer(String[] validValues) { this(null, "", validValues); } public void setToolTipText(String s) { tooltipText = s; } @Override public Component getControls() { if (panel == null) { panel = Box.createHorizontalBox(); panel.add(new JLabel(name)); box = new JComboBox<>(transValues); box.setToolTipText(tooltipText); box.setMaximumSize(new Dimension(box.getMaximumSize().width,box.getPreferredSize().height)); setValue(value); box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { noUpdate = true; setValue(box.getSelectedIndex()); noUpdate = false; } }); panel.add(box); } return panel; } @Override public void setValue(Object o) { if(o == null) o = 0; super.setValue(o); if(!noUpdate && box != null) box.setSelectedIndex((Integer)o); } @Override public void setValue(String s) { Integer n = 0; for (int i = 0; i < transValues.length; ++i) { if (transValues[i].equals(s) || validValues[i].equals(s)){ n = i; break; } } setValue(n); } @Override public String getValueString() { return validValues[(Integer)value]; } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.javajosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerAction.0000644000175000017500000002656212445051070031703 0ustar basbaspackage org.openstreetmap.josm.plugins.lakewalker; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.Cursor; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.LinkedList; import javax.swing.JOptionPane; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.actions.JosmAction; import org.openstreetmap.josm.command.AddCommand; import org.openstreetmap.josm.command.Command; import org.openstreetmap.josm.command.SequenceCommand; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.gui.PleaseWaitRunnable; import org.openstreetmap.josm.gui.progress.ProgressMonitor; import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.Shortcut; import org.xml.sax.SAXException; /** * Interface to Darryl Shpak's Lakewalker module * * @author Brent Easton */ class LakewalkerAction extends JosmAction implements MouseListener { private static final long serialVersionUID = 1L; protected String name; protected Cursor oldCursor; protected Thread executeThread; protected boolean cancel; protected boolean active = false; protected Collection commands = new LinkedList<>(); protected Collection ways = new ArrayList<>(); public LakewalkerAction(String name) { super(name, "lakewalker-sml", tr("Lake Walker."), Shortcut.registerShortcut("tools:lakewalker", tr("Tool: {0}", tr("Lake Walker")), KeyEvent.VK_L, Shortcut.ALT_CTRL_SHIFT), true); this.name = name; setEnabled(true); } public void actionPerformed(ActionEvent e) { if(Main.map == null || Main.map.mapView == null || active) return; active = true; oldCursor = Main.map.mapView.getCursor(); Main.map.mapView.setCursor(ImageProvider.getCursor("crosshair", "lakewalker-sml")); Main.map.mapView.addMouseListener(this); } /** * check for presence of cache folder and trim cache to specified size. * size/age limit is on a per folder basis. */ private void cleanupCache() { final long maxCacheAge = System.currentTimeMillis()-Main.pref.getInteger(LakewalkerPreferences.PREF_MAXCACHEAGE, 100)*24*60*60*1000L; final long maxCacheSize = Main.pref.getInteger(LakewalkerPreferences.PREF_MAXCACHESIZE, 300)*1024*1024L; for (String wmsFolder : LakewalkerPreferences.WMSLAYERS) { File wmsCacheDir = new File(LakewalkerPlugin.getLakewalkerCacheDir(), wmsFolder); if (wmsCacheDir.exists() && wmsCacheDir.isDirectory()) { File wmsCache[] = wmsCacheDir.listFiles(); // sort files by date (most recent first) Arrays.sort(wmsCache, new Comparator() { public int compare(File f1, File f2) { return (int)(f2.lastModified()-f1.lastModified()); } }); // delete aged or oversized, keep newest. Once size/age limit was reached delete all older files long folderSize = 0; boolean quickdelete = false; for (File cacheEntry : wmsCache) { if (!cacheEntry.isFile()) continue; if (!quickdelete) { folderSize += cacheEntry.length(); if (folderSize > maxCacheSize) { quickdelete = true; } else if (cacheEntry.lastModified() < maxCacheAge) { quickdelete = true; } } if (quickdelete) { cacheEntry.delete(); } } } else { // create cache directory if (!wmsCacheDir.mkdirs()) { JOptionPane.showMessageDialog(Main.parent, tr("Error creating cache directory: {0}", wmsCacheDir.getPath())); } } } } protected void lakewalk(Point clickPoint){ // Positional data final LatLon pos = Main.map.mapView.getLatLon(clickPoint.x, clickPoint.y); final LatLon topLeft = Main.map.mapView.getLatLon(0, 0); final LatLon botRight = Main.map.mapView.getLatLon(Main.map.mapView.getWidth(), Main.map.mapView.getHeight()); /* * Collect options */ final int waylen = Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_SEG, 500); final int maxnode = Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_NODES, 50000); final int threshold = Main.pref.getInteger(LakewalkerPreferences.PREF_THRESHOLD_VALUE, 90); final double epsilon = Main.pref.getDouble(LakewalkerPreferences.PREF_EPSILON, 0.0003); final int resolution = Main.pref.getInteger(LakewalkerPreferences.PREF_LANDSAT_RES, 4000); final int tilesize = Main.pref.getInteger(LakewalkerPreferences.PREF_LANDSAT_SIZE, 2000); final String startdir = Main.pref.get(LakewalkerPreferences.PREF_START_DIR, "east"); final String wmslayer = Main.pref.get(LakewalkerPreferences.PREF_WMS, "IR1"); try { PleaseWaitRunnable lakewalkerTask = new PleaseWaitRunnable(tr("Tracing")){ @Override protected void realRun() throws SAXException { progressMonitor.subTask(tr("checking cache...")); cleanupCache(); processnodelist(pos, topLeft, botRight, waylen, maxnode, threshold, epsilon,resolution,tilesize,startdir,wmslayer, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)); } @Override protected void finish() { } @Override protected void cancel() { LakewalkerAction.this.cancel(); } }; Thread executeThread = new Thread(lakewalkerTask); executeThread.start(); } catch (Exception ex) { System.out.println("Exception caught: " + ex.getMessage()); } } private void processnodelist(LatLon pos, LatLon topLeft, LatLon botRight, int waylen, int maxnode, int threshold, double epsilon, int resolution, int tilesize, String startdir, String wmslayer, ProgressMonitor progressMonitor){ progressMonitor.beginTask(null, 3); try { ArrayList nodelist = new ArrayList<>(); Lakewalker lw = new Lakewalker(waylen,maxnode,threshold,epsilon,resolution,tilesize,startdir,wmslayer); try { nodelist = lw.trace(pos.lat(),pos.lon(),topLeft.lon(),botRight.lon(),topLeft.lat(),botRight.lat(), progressMonitor.createSubTaskMonitor(1, false)); } catch(LakewalkerException e){ System.out.println(e.getMessage()); } System.out.println(nodelist.size()+" nodes generated"); /** * Run the nodelist through a vertex reduction algorithm */ progressMonitor.subTask(tr("Running vertex reduction...")); nodelist = lw.vertexReduce(nodelist, epsilon); //System.out.println("After vertex reduction "+nodelist.size()+" nodes remain."); /** * And then through douglas-peucker approximation */ progressMonitor.worked(1); progressMonitor.subTask(tr("Running Douglas-Peucker approximation...")); nodelist = lw.douglasPeucker(nodelist, epsilon, 0); //System.out.println("After Douglas-Peucker approximation "+nodelist.size()+" nodes remain."); /** * And then through a duplicate node remover */ progressMonitor.worked(1); progressMonitor.subTask(tr("Removing duplicate nodes...")); nodelist = lw.duplicateNodeRemove(nodelist); //System.out.println("After removing duplicate nodes, "+nodelist.size()+" nodes remain."); // if for some reason (image loading failed, ...) nodelist is empty, no more processing required. if (nodelist.size() == 0) { return; } /** * Turn the arraylist into osm nodes */ Way way = new Way(); Node n = null; Node fn = null; double eastOffset = Main.pref.getDouble(LakewalkerPreferences.PREF_EAST_OFFSET, 0.0); double northOffset = Main.pref.getDouble(LakewalkerPreferences.PREF_NORTH_OFFSET, 0.0); int nodesinway = 0; for(int i = 0; i< nodelist.size(); i++){ if (cancel) { return; } try { LatLon ll = new LatLon(nodelist.get(i)[0]+northOffset, nodelist.get(i)[1]+eastOffset); n = new Node(ll); if(fn==null){ fn = n; } commands.add(new AddCommand(n)); } catch (Exception ex) { ex.printStackTrace(); } way.addNode(n); if(nodesinway > Main.pref.getInteger(LakewalkerPreferences.PREF_MAX_SEG, 500)){ String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water"); if(!waytype.equals("none")){ way.put("natural",waytype); } way.put("source", Main.pref.get(LakewalkerPreferences.PREF_SOURCE, "Landsat")); commands.add(new AddCommand(way)); way = new Way(); way.addNode(n); nodesinway = 0; } nodesinway++; } String waytype = Main.pref.get(LakewalkerPreferences.PREF_WAYTYPE, "water"); if(!waytype.equals("none")){ way.put("natural",waytype); } way.put("source", Main.pref.get(LakewalkerPreferences.PREF_SOURCE, "Landsat")); way.addNode(fn); commands.add(new AddCommand(way)); if (!commands.isEmpty()) { Main.main.undoRedo.add(new SequenceCommand(tr("Lakewalker trace"), commands)); Main.main.getCurrentDataSet().setSelected(ways); } else { System.out.println("Failed"); } commands = new LinkedList<>(); ways = new ArrayList<>(); } finally { progressMonitor.finishTask(); } } public void cancel() { cancel = true; } public void mouseClicked(MouseEvent e) { if(active) { active = false; Main.map.mapView.removeMouseListener(this); Main.map.mapView.setCursor(oldCursor); lakewalk(e.getPoint()); } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } } ././@LongLink0000644000000000000000000000015100000000000011600 Lustar rootrootjosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.javajosm-plugins-0.0.svn31964/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPlugin.0000644000175000017500000000164712445051070031721 0ustar basbaspackage org.openstreetmap.josm.plugins.lakewalker; import static org.openstreetmap.josm.tools.I18n.tr; import java.io.File; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.gui.MainMenu; import org.openstreetmap.josm.gui.preferences.PreferenceSetting; import org.openstreetmap.josm.plugins.Plugin; import org.openstreetmap.josm.plugins.PluginInformation; /** * Interface to Darryl Shpak's Lakewalker python module * * @author Brent Easton */ public class LakewalkerPlugin extends Plugin { public LakewalkerPlugin(PluginInformation info) { super(info); MainMenu.add(Main.main.menu.moreToolsMenu, new LakewalkerAction(tr("Lake Walker"))); } @Override public PreferenceSetting getPreferenceSetting() { return new LakewalkerPreferences(); } public static File getLakewalkerCacheDir() { return new File(Main.pref.getCacheDirectory(), "lakewalkerwms"); } } josm-plugins-0.0.svn31964/lakewalker/nbproject/0000755000175000017500000000000012643536104017424 5ustar basbasjosm-plugins-0.0.svn31964/lakewalker/nbproject/project.xml0000644000175000017500000000525712326615515021627 0ustar basbas org.netbeans.modules.ant.freeform lakewalker lakewalker java src UTF-8 . UTF-8 compile clean runjosm clean compile src build.xml src ../../core/src 1.7 josm-plugins-0.0.svn31964/svn-info.xml0000644000175000017500000000075412643536105015604 0ustar basbas https://svn.openstreetmap.org/applications/editors/josm/plugins ^/applications/editors/josm/plugins https://svn.openstreetmap.org b9d5c4c9-76e1-0310-9c85-f3177eceb1e4 holgermappt 2016-01-07T18:34:38.218545Z josm-plugins-0.0.svn31964/measurement/0000755000175000017500000000000012643536104015641 5ustar basbasjosm-plugins-0.0.svn31964/measurement/resources/0000755000175000017500000000000012643536104017653 5ustar basbasjosm-plugins-0.0.svn31964/measurement/build.xml0000644000175000017500000000225112642235110017452 0ustar basbas josm-plugins-0.0.svn31964/measurement/images/0000755000175000017500000000000012643536104017106 5ustar basbasjosm-plugins-0.0.svn31964/measurement/images/dialogs/0000755000175000017500000000000012643536104020530 5ustar basbasjosm-plugins-0.0.svn31964/measurement/images/dialogs/measure.png0000644000175000017500000000136511057050175022701 0ustar basbasPNG  IHDRp nIDATHK[UU8Q"Tiv1"$ȡfc(J,!*"D^zh2"I Dv3/%DCe9om̜._8,,o+/<>xz /ϳu80v̬_|І'q6bGaY1ovp*`}6j f>* (<+:obt~T܏FGm Ocq%g`'+c/>u)a6c[we!TQ>b܅8\l6~qSC"qDuF>Ws$by=n"*6U{pTz<"(է_jL9O&9F g~ Ye> vktx.*w w&|[R0g|Wo|+xM3KZIR )y| CwVaye~8ЍxP (I*bdsүwuoI;np;) DY]Vq ɚ۱XSl|GӁxWj!'"IdQ1Y;Ʉ$ŲUZ̀h{%p\@nks_&)*)o9 E IENDB`josm-plugins-0.0.svn31964/measurement/images/measurement.png0000644000175000017500000000051511057050175022137 0ustar basbasPNG  IHDRhIDAT8Oҿ+QW2ȏ XՍםd0N$?b$פt LA)0v/99cBcX3Z*R19F/c/ٗtHx ?Rs$I:(W3!Iq*h0p-y2F_aY, 7IENDB`josm-plugins-0.0.svn31964/measurement/images/mapmode/0000755000175000017500000000000012643536104020530 5ustar basbasjosm-plugins-0.0.svn31964/measurement/images/mapmode/measurement.png0000644000175000017500000000123011057050175023554 0ustar basbasPNG  IHDRp n_IDATHKՕk`?oY,m/I((*ga zRЫl_`yQAgA)T(Te>wIdڋxIO :kD95ꢂw`dCS8iNAgw =@Yeў`ELخ#APa'9|7gV!Ua& 0|z?6{ ˷X2ot6Vp[g}D{zDULQG#^R𫓆XovFs$pxNM]hOG? ]`ʲaE~D{r& $="ĕGoCǔUc)qBNY @9f7خ)@,DO!ޗnǀ ;4V7NBNwP hOKhO䵃=-ţe#kخ#)TKA5,os<?qD̐BAF}Ә:mrEZvlT2:[?9P@xB( `*`;w T+~1 {^Ij*VI7aIENDB`josm-plugins-0.0.svn31964/measurement/.project0000644000175000017500000000056711215762346017323 0ustar basbas JOSM-Measurement org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature josm-plugins-0.0.svn31964/measurement/.settings/0000755000175000017500000000000012643536104017557 5ustar basbasjosm-plugins-0.0.svn31964/measurement/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000001552112420547421024542 0ustar basbaseclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 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.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 josm-plugins-0.0.svn31964/measurement/data/0000755000175000017500000000000012643536104016552 5ustar basbasjosm-plugins-0.0.svn31964/measurement/.classpath0000644000175000017500000000066112326615515017631 0ustar basbas josm-plugins-0.0.svn31964/measurement/LICENSE0000644000175000017500000000023111153256615016643 0ustar basbas Plugin measurement This plugins is copyrighted 2007-2008 by Raphael Mack . It is distributed under a GPL-3 license or later. josm-plugins-0.0.svn31964/measurement/src/0000755000175000017500000000000012643536104016430 5ustar basbasjosm-plugins-0.0.svn31964/measurement/src/org/0000755000175000017500000000000012643536104017217 5ustar basbasjosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/0000755000175000017500000000000012643536104022105 5ustar basbasjosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/0000755000175000017500000000000012643536104023055 5ustar basbasjosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/plugins/0000755000175000017500000000000012643536104024536 5ustar basbasjosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/plugins/measurement/0000755000175000017500000000000012643536104027063 5ustar basbas././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootjosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDialog.javajosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementDial0000644000175000017500000002534412611153737032077 0ustar basbas// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.measurement; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.text.DecimalFormat; import java.util.Arrays; import java.util.Collection; import javax.swing.AbstractAction; import javax.swing.JLabel; import javax.swing.JPanel; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.data.SelectionChangedListener; import org.openstreetmap.josm.data.SystemOfMeasurement; import org.openstreetmap.josm.data.SystemOfMeasurement.SoMChangeListener; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.OsmPrimitive; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent; import org.openstreetmap.josm.data.osm.event.DataChangedEvent; import org.openstreetmap.josm.data.osm.event.DataSetListener; import org.openstreetmap.josm.data.osm.event.NodeMovedEvent; import org.openstreetmap.josm.data.osm.event.PrimitivesAddedEvent; import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent; import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent; import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; import org.openstreetmap.josm.gui.SideButton; import org.openstreetmap.josm.gui.dialogs.ToggleDialog; import org.openstreetmap.josm.gui.help.HelpUtil; import org.openstreetmap.josm.gui.util.GuiHelper; import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.tools.Shortcut; import org.openstreetmap.josm.tools.SubclassFilteredCollection; /** * A small tool dialog for displaying the current measurement data. * * @author ramack */ public class MeasurementDialog extends ToggleDialog implements SelectionChangedListener, DataSetListener, SoMChangeListener { private static final long serialVersionUID = 4708541586297950021L; /** * The reset button */ private SideButton resetButton; /** * The measurement label for the path length */ protected JLabel pathLengthLabel; /** * The measurement label for the currently selected segments */ protected JLabel selectLengthLabel; /** * The measurement label for area of the currently selected loop */ protected JLabel selectAreaLabel; /** * The measurement label for radius if the currently selected loop is a circle. */ protected JLabel selectRadiusLabel; /** * The measurement label for the segment angle, actually updated, if 2 nodes are selected */ protected JLabel segAngleLabel; private DataSet ds; private Collection ways; private Collection nodes; /** * Constructor */ public MeasurementDialog() { super(tr("Measured values"), "measure", tr("Open the measurement window."), Shortcut.registerShortcut("subwindow:measurement", tr("Toggle: {0}", tr("Measured values")), KeyEvent.VK_U, Shortcut.CTRL_SHIFT), 150); resetButton = new SideButton(new AbstractAction() { { putValue(NAME, tr("Reset")); putValue(SMALL_ICON,ImageProvider.get("dialogs", "select")); putValue(SHORT_DESCRIPTION, tr("Reset current measurement results and delete measurement path.")); putValue("help", HelpUtil.ht("/Dialog/Measurement#Reset")); } @Override public void actionPerformed(ActionEvent e) { resetValues(); } }); JPanel valuePanel = new JPanel(new GridLayout(0,2)); valuePanel.add(new JLabel(tr("Path Length"))); pathLengthLabel = new JLabel(getDistText(0)); valuePanel.add(pathLengthLabel); valuePanel.add(new JLabel(tr("Selection Length"))); selectLengthLabel = new JLabel(getDistText(0)); valuePanel.add(selectLengthLabel); valuePanel.add(new JLabel(tr("Selection Area"))); selectAreaLabel = new JLabel(getAreaText(0)); valuePanel.add(selectAreaLabel); valuePanel.add(new JLabel(tr("Selection Radius"))); selectRadiusLabel = new JLabel(getRadiusText(0)); valuePanel.add(selectRadiusLabel); JLabel angle = new JLabel(tr("Angle")); angle.setToolTipText(tr("Angle between two selected Nodes")); valuePanel.add(angle); segAngleLabel = new JLabel("- \u00b0"); valuePanel.add(segAngleLabel); this.setPreferredSize(new Dimension(0, 92)); createLayout(valuePanel, false, Arrays.asList(new SideButton[] { resetButton })); DataSet.addSelectionListener(this); SystemOfMeasurement.addSoMChangeListener(this); } protected String getDistText(double v) { return SystemOfMeasurement.getSystemOfMeasurement().getDistText(v, new DecimalFormat("#0.000"), 1e-3); } protected String getAreaText(double v) { return SystemOfMeasurement.getSystemOfMeasurement().getAreaText(v, new DecimalFormat("#0.000"), 1e-3); } protected String getRadiusText(double v) { return SystemOfMeasurement.getSystemOfMeasurement().getDistText(v, new DecimalFormat("#0.000"), 1e-3); } protected String getAngleText(double v) { return new DecimalFormat("#0.0").format(v) + " \u00b0"; } /** * Cleans the active Measurement Layer */ public void resetValues(){ MeasurementPlugin.getCurrentLayer().reset(); } @Override public void selectionChanged(Collection newSelection) { double length = 0.0; double segAngle = 0.0; double area = 0.0; double radius = 0.0; Node lastNode = null; // Don't mix up way and nodes computation (fix #6872). Priority given to ways ways = new SubclassFilteredCollection<>(newSelection, OsmPrimitive.wayPredicate); if (ways.isEmpty()) { nodes = new SubclassFilteredCollection<>(newSelection, OsmPrimitive.nodePredicate); for (Node n : nodes) { if (n.getCoor() != null) { if (lastNode == null) { lastNode = n; } else { length += lastNode.getCoor().greatCircleDistance(n.getCoor()); segAngle = MeasurementLayer.angleBetween(lastNode.getCoor(), n.getCoor()); lastNode = n; } } } } else { nodes = null; for (Way w : ways) { Node lastN = null; double wayArea = 0.0; Double firstSegLength = null; boolean isCircle = true; for (Node n: w.getNodes()) { if (lastN != null && lastN.getCoor() != null && n.getCoor() != null) { final double segLength = lastN.getCoor().greatCircleDistance(n.getCoor()); if (firstSegLength == null) { firstSegLength = segLength; } if (isCircle && Math.abs(firstSegLength - segLength) > 0.000001) { isCircle = false; } length += segLength; //http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/ wayArea += (MeasurementLayer.calcX(n.getCoor()) * MeasurementLayer.calcY(lastN.getCoor())) - (MeasurementLayer.calcY(n.getCoor()) * MeasurementLayer.calcX(lastN.getCoor())); segAngle = MeasurementLayer.angleBetween(lastN.getCoor(), n.getCoor()); } lastN = n; } if (lastN != null && lastN == w.getNodes().iterator().next()) wayArea = Math.abs(wayArea / 2); else wayArea = 0; area += wayArea; } if (ways.size() == 1 && area > 0.0) { radius = length / (2 * Math.PI); } } final String lengthLabel = getDistText(length); final String angleLabel = getAngleText(segAngle); final String areaLabel = getAreaText(area); final String radiusLabel = getRadiusText(radius); GuiHelper.runInEDT(new Runnable() { @Override public void run() { selectLengthLabel.setText(lengthLabel); segAngleLabel.setText(angleLabel); selectAreaLabel.setText(areaLabel); selectRadiusLabel.setText(radiusLabel); } }); DataSet currentDs = Main.main.getCurrentDataSet(); if (ds != currentDs) { if (ds != null) { ds.removeDataSetListener(this); } if (currentDs != null) { currentDs.addDataSetListener(this); } ds = currentDs; } } @Override public void destroy() { super.destroy(); SystemOfMeasurement.removeSoMChangeListener(this); DataSet.removeSelectionListener(this); if (ds != null) { ds.removeDataSetListener(this); ds = null; } } private boolean waysContain(Node n) { if (ways != null) { for (Way w : ways) { if (w.containsNode(n)) { return true; } } } return false; } @Override public void nodeMoved(NodeMovedEvent event) { Node n = event.getNode(); // Refresh selection if a node belonging to a selected member has moved (example: scale action) if ((nodes != null && nodes.contains(n)) || waysContain(n)) { selectionChanged(Main.main.getCurrentDataSet().getSelected()); } } @Override public void primitivesAdded(PrimitivesAddedEvent event) {} @Override public void primitivesRemoved(PrimitivesRemovedEvent event) {} @Override public void tagsChanged(TagsChangedEvent event) {} @Override public void wayNodesChanged(WayNodesChangedEvent event) { } @Override public void relationMembersChanged(RelationMembersChangedEvent event) {} @Override public void otherDatasetChange(AbstractDatasetChangedEvent event) {} @Override public void dataChanged(DataChangedEvent event) {} @Override public void systemOfMeasurementChanged(String oldSoM, String newSoM) { // Refresh selection to take into account new system of measurement selectionChanged(Main.main.getCurrentDataSet().getSelected()); } } ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootjosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.javajosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLaye0000644000175000017500000002452412420553250032107 0ustar basbas// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.measurement; /// @author Raphael Mack import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.Color; import java.awt.Component; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Collection; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.Box; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.gpx.GpxTrack; import org.openstreetmap.josm.data.gpx.GpxTrackSegment; import org.openstreetmap.josm.data.gpx.WayPoint; import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; import org.openstreetmap.josm.gui.MapView; import org.openstreetmap.josm.gui.NavigatableComponent; import org.openstreetmap.josm.gui.dialogs.LayerListDialog; import org.openstreetmap.josm.gui.dialogs.LayerListPopup; import org.openstreetmap.josm.gui.layer.GpxLayer; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.tools.ImageProvider; /** * This is a layer that draws a grid */ public class MeasurementLayer extends Layer { public MeasurementLayer(String name) { super(name); } private static Icon icon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(MeasurementPlugin.class.getResource("/images/measurement.png"))); private Collection points = new ArrayList<>(32); @Override public Icon getIcon() { return icon; } @Override public String getToolTipText() { return tr("Layer to make measurements"); } @Override public boolean isMergable(Layer other) { //return other instanceof MeasurementLayer; return false; } @Override public void mergeFrom(Layer from) { // TODO: nyi - doubts about how this should be done are around. Ideas? } @Override public void paint(Graphics2D g, final MapView mv, Bounds bounds) { g.setColor(Color.green); Point l = null; for(WayPoint p:points){ Point pnt = mv.getPoint(p.getCoor()); if (l != null){ g.drawLine(l.x, l.y, pnt.x, pnt.y); } g.drawOval(pnt.x - 2, pnt.y - 2, 4, 4); l = pnt; } } @Override public void visitBoundingBox(BoundingXYVisitor v) { // nothing to do here } @Override public Object getInfoComponent() { return getToolTipText(); } @Override public Action[] getMenuEntries() { return new Action[]{ LayerListDialog.getInstance().createShowHideLayerAction(), // TODO: implement new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), SeparatorLayerAction.INSTANCE, new GPXLayerImportAction(this), SeparatorLayerAction.INSTANCE, new LayerListPopup.InfoAction(this)}; } public void removeLastPoint(){ WayPoint l = null; for(WayPoint p:points) l = p; if(l != null) points.remove(l); recalculate(); Main.map.repaint(); } public void mouseClicked(MouseEvent e){ if (e.getButton() != MouseEvent.BUTTON1) return; LatLon coor = Main.map.mapView.getLatLon(e.getX(), e.getY()); points.add(new WayPoint(coor)); Main.map.repaint(); recalculate(); } public void reset(){ points.clear(); recalculate(); Main.map.repaint(); } private void recalculate(){ double pathLength = 0.0, segLength = 0.0; // in meters WayPoint last = null; pathLength = 0.0; for(WayPoint p : points){ if(last != null){ segLength = calcDistance(last, p); pathLength += segLength; } last = p; } if (MeasurementPlugin.measurementDialog != null) { MeasurementPlugin.measurementDialog.pathLengthLabel.setText(NavigatableComponent.getDistText(pathLength)); } if (Main.map.mapMode instanceof MeasurementMode) { Main.map.statusLine.setDist(pathLength); } } /* * Use an equal area sinusoidal projection to improve accuracy and so we can still use normal polygon area calculation * https://stackoverflow.com/questions/4681737/how-to-calculate-the-area-of-a-polygon-on-the-earths-surface-using-python */ public static double calcX(LatLon p1){ return p1.lat() * Math.PI * 6367000 / 180; } public static double calcY(LatLon p1){ return p1.lon() * ( Math.PI * 6367000 / 180) * Math.cos(p1.lat() * Math.PI / 180); } public static double calcDistance(WayPoint p1, WayPoint p2){ return p1.getCoor().greatCircleDistance(p2.getCoor()); } public static double angleBetween(WayPoint p1, WayPoint p2){ return angleBetween(p1.getCoor(), p2.getCoor()); } public static double angleBetween(LatLon p1, LatLon p2){ double lat1, lon1, lat2, lon2; double dlon; lat1 = p1.lat() * Math.PI / 180.0; lon1 = p1.lon() * Math.PI / 180.0; lat2 = p2.lat() * Math.PI / 180.0; lon2 = p2.lon() * Math.PI / 180.0; dlon = lon2 - lon1; double coslat2 = Math.cos(lat2); return (180 * Math.atan2(coslat2 * Math.sin(dlon), (Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * coslat2 * Math.cos(dlon)))) / Math.PI; } public static double oldAngleBetween(LatLon p1, LatLon p2){ double lat1, lon1, lat2, lon2; double dlon, dlat; double heading; lat1 = p1.lat() * Math.PI / 180.0; lon1 = p1.lon() * Math.PI / 180.0; lat2 = p2.lat() * Math.PI / 180.0; lon2 = p2.lon() * Math.PI / 180.0; dlon = lon2 - lon1; dlat = lat2 - lat1; double a = (Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2)); double d = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); heading = Math.acos((Math.sin(lat2) - Math.sin(lat1) * Math.cos(d)) / (Math.sin(d) * Math.cos(lat1))); if (Math.sin(lon2 - lon1) < 0) { heading = 2 * Math.PI - heading; } return heading * 180 / Math.PI; } private class GPXLayerImportAction extends AbstractAction { /** * The data model for the list component. */ private DefaultListModel model = new DefaultListModel<>(); /** * @param layer the targeting measurement layer */ public GPXLayerImportAction(MeasurementLayer layer) { super(tr("Import path from GPX layer"), ImageProvider.get("dialogs", "edit")); // TODO: find better image } @Override public void actionPerformed(ActionEvent e) { Box panel = Box.createVerticalBox(); final JList layerList = new JList<>(model); Collection data = Main.map.mapView.getAllLayers(); Layer lastLayer = null; int layerCnt = 0; for (Layer l : data) { if (l instanceof GpxLayer) { model.addElement((GpxLayer) l); lastLayer = l; layerCnt++; } } if (layerCnt == 1) { layerList.setSelectedValue(lastLayer, true); } if (layerCnt > 0) { layerList.setCellRenderer(new DefaultListCellRenderer(){ @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Layer layer = (Layer)value; JLabel label = (JLabel)super.getListCellRendererComponent(list, layer.getName(), index, isSelected, cellHasFocus); Icon icon = layer.getIcon(); label.setIcon(icon); label.setToolTipText(layer.getToolTipText()); return label; } }); JCheckBox dropFirst = new JCheckBox(tr("Drop existing path")); panel.add(layerList); panel.add(dropFirst); final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION){ @Override public void selectInitialValue() { layerList.requestFocusInWindow(); } }; final JDialog dlg = optionPane.createDialog(Main.parent, tr("Import path from GPX layer")); dlg.setVisible(true); Object answer = optionPane.getValue(); if (answer == null || answer == JOptionPane.UNINITIALIZED_VALUE || (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION)) { return; } GpxLayer gpx = layerList.getSelectedValue(); if (dropFirst.isSelected()) { points = new ArrayList<>(32); } for (GpxTrack trk : gpx.data.tracks) { for (GpxTrackSegment trkseg : trk.getSegments()) { for(WayPoint p: trkseg.getWayPoints()){ points.add(p); } } } recalculate(); Main.parent.repaint(); } else{ // TODO: register a listener and show menu entry only if gps layers are available // no gps layer JOptionPane.showMessageDialog(Main.parent,tr("No GPX data layer found.")); } } } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootjosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementMode.javajosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementMode0000644000175000017500000000351512405435162032102 0ustar basbas// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.measurement; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.Cursor; import java.awt.event.MouseEvent; import javax.swing.JOptionPane; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.actions.mapmode.MapMode; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.gui.MapFrame; public class MeasurementMode extends MapMode { private static final long serialVersionUID = 3853830673475744263L; public MeasurementMode(MapFrame mapFrame, String name, String desc) { super(name, "measurement.png", desc, mapFrame, Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); } @Override public void enterMode() { super.enterMode(); Main.map.mapView.addMouseListener(this); } @Override public void exitMode() { super.exitMode(); Main.map.mapView.removeMouseListener(this); } /** * If user clicked with the left button, add a node at the current mouse * position. * * If in nodesegment mode, add the node to the line segment by splitting the * segment. The new created segment will be inserted in every way the segment * was part of. */ @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3){ MeasurementPlugin.getCurrentLayer().removeLastPoint(); } else if (e.getButton() == MouseEvent.BUTTON1){ LatLon coor = Main.map.mapView.getLatLon(e.getX(), e.getY()); if (coor.isOutSideWorld()) { JOptionPane.showMessageDialog(Main.parent,tr("Can not draw outside of the world.")); return; } MeasurementPlugin.getCurrentLayer().mouseClicked(e); } } } ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootjosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlugin.javajosm-plugins-0.0.svn31964/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementPlug0000644000175000017500000000442712405435162032130 0ustar basbas// License: GPL. For details, see LICENSE file. package org.openstreetmap.josm.plugins.measurement; /// @author Raphael Mack import static org.openstreetmap.josm.tools.I18n.tr; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.gui.IconToggleButton; import org.openstreetmap.josm.gui.MapFrame; import org.openstreetmap.josm.gui.MapView; import org.openstreetmap.josm.gui.MapView.LayerChangeListener; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.plugins.Plugin; import org.openstreetmap.josm.plugins.PluginInformation; public class MeasurementPlugin extends Plugin { private IconToggleButton btn; private MeasurementMode mode; protected static MeasurementDialog measurementDialog; protected static MeasurementLayer currentLayer; public MeasurementPlugin(PluginInformation info) { super(info); } @Override public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { if (newFrame != null) { newFrame.addToggleDialog(measurementDialog = new MeasurementDialog()); mode = new MeasurementMode(newFrame, "measurement", tr("measurement mode")); btn = new IconToggleButton(mode); btn.setVisible(true); newFrame.addMapMode(btn); } else { btn = null; mode = null; measurementDialog = null; } } public static MeasurementLayer getCurrentLayer() { if (currentLayer == null) { currentLayer = new MeasurementLayer(tr("Measurements")); Main.main.addLayer(currentLayer); MapView.addLayerChangeListener(new LayerChangeListener(){ public void activeLayerChange(final Layer oldLayer, final Layer newLayer) { if(newLayer instanceof MeasurementLayer) MeasurementPlugin.currentLayer = (MeasurementLayer)newLayer; } public void layerAdded(final Layer newLayer) { } public void layerRemoved(final Layer oldLayer) { if (oldLayer != null && oldLayer == currentLayer) MapView.removeLayerChangeListener(this); } }); } return currentLayer; } } josm-plugins-0.0.svn31964/routing/0000755000175000017500000000000012643536105015004 5ustar basbasjosm-plugins-0.0.svn31964/routing/resources/0000755000175000017500000000000012643536105017016 5ustar basbasjosm-plugins-0.0.svn31964/routing/resources/log4j.xml0000644000175000017500000000124711163156043020556 0ustar basbas josm-plugins-0.0.svn31964/routing/build.xml0000644000175000017500000000672612642235110016627 0ustar basbas josm-plugins-0.0.svn31964/routing/lib/0000755000175000017500000000000012643536105015552 5ustar basbasjosm-plugins-0.0.svn31964/routing/images/0000755000175000017500000000000012643536105016251 5ustar basbasjosm-plugins-0.0.svn31964/routing/images/dialogs/0000755000175000017500000000000012643536105017673 5ustar basbasjosm-plugins-0.0.svn31964/routing/images/dialogs/routing.png0000644000175000017500000000212511163156563022072 0ustar basbasPNG  IHDRw=sRGBbKGD pHYsgRtIME V}IDATHǝ[L\U}\(0@)0rTF1ThSkx >㓉TjS MʹL%3眙9{Jo C aToBfƵ(/hce~$ϰyswl~Xr|m΀뻸>?.Kb36>\z¬QCQZ'PP҃½nؓ53J9 Un9ܞݞo&3Ws\Ԕ(myj<2퐆mTzF!:o1i. Po?uG0S4H`[L L !j+\|c٭eZIhBHjgA`c +m̫J e%QIe !bo*?  G9hm6>P J+0`.8j+V!7vIᗫi`v)QVҧ-PY ^<b% 6G1ʅ[ Mp8U _,ǫ\&13eɳ)~Q]\J16)u*Ho [Yj*Sm`ÏF"!$1#568555T~_IENDB`josm-plugins-0.0.svn31964/routing/images/routing/0000755000175000017500000000000012643536105017740 5ustar basbasjosm-plugins-0.0.svn31964/routing/images/routing/endflag.png0000644000175000017500000000107011163156563022046 0ustar basbasPNG  IHDR szzsRGBbKGD pHYs  tIME23ustEXtCommentCreated with The GIMPd%nIDATX=N@ s"*nKp. ХKT  7Zm8)#d;oޛUcfZshWZ*pS; Ue]"je[ge|+NC1jg8={ y^MS6,M` %IENDB`josm-plugins-0.0.svn31964/routing/images/routing/startflag.png0000644000175000017500000000071411163156563022441 0ustar basbasPNG  IHDR szzsRGBbKGD pHYs  tIME51tEXtCommentCreated with The GIMPd%n#IDATX=N@E )5)I(|j7i#;:0%+( C:?z)d͛7# ā#DDĀIffu]{g攏}ŶPUL1oJnm n/eY4M\G=TD tK$@UUU~/@@+6]"A!|5ς06&_D#/bF r`f` 06U}gC9[ks/tlx2:\&;2Gv~sY7sIENDB`josm-plugins-0.0.svn31964/routing/images/routing/middleflag.png0000644000175000017500000000100211163156563022531 0ustar basbasPNG  IHDR szzsRGBbKGD pHYs  tIME5bwtEXtCommentCreated with The GIMPd%nYIDATX헱N`K">/E­bƑ7pcc]4 z]%@ҐpMϹ{ ~ T&VUMĉu^v_J잇ݱ>s~<xk6e̓O @Ez=}wN)UKF`eϓ:"3oaJ;niܒR0E<_Xk[1R'F2Ʉ.]DZqִ5 DQT"r90zE!۱4 VA (^Щ"CX"l w7[r0 I8J1 2Ud0IENDB`josm-plugins-0.0.svn31964/routing/images/preferences/0000755000175000017500000000000012643536105020552 5ustar basbasjosm-plugins-0.0.svn31964/routing/images/preferences/routing.png0000644000175000017500000000212511163156563022751 0ustar basbasPNG  IHDRw=sRGBbKGD pHYsgRtIME V}IDATHǝ[L\U}\(0@)0rTF1ThSkx >㓉TjS MʹL%3眙9{Jo C aToBfƵ(/hce~$ϰyswl~Xr|m΀뻸>?.Kb36>\z¬QCQZ'PP҃½nؓ53J9 Un9ܞݞo&3Ws\Ԕ(myj<2퐆mTzF!:o1i. Po?uG0S4H`[L L !j+\|c٭eZIhBHjgA`c +m̫J e%QIe !bo*?  G9hm6>P J+0`.8j+V!7vIᗫi`v)QVҧ-PY ^<b% 6G1ʅ[ Mp8U _,ǫ\&13eɳ)~Q]\J16)u*Ho [Yj*Sm`ÏF"!$1#568555T~_IENDB`josm-plugins-0.0.svn31964/routing/images/layer/0000755000175000017500000000000012643536105017365 5ustar basbasjosm-plugins-0.0.svn31964/routing/images/layer/routing_small.png0000644000175000017500000000146211163156563022757 0ustar basbasPNG  IHDRasRGBbKGD pHYsgRtIME$zӈWIDAT8}KkQsdfrk4)5ڦŢ H[**.nD7*\(Bō/Qklq:͜}<|'a~#s\0֛d =]ǎu4#>GZJ _EH$]]NgHm DKy'9iX|&3*169'.bM;Lь% @f=)P핲#k0ML,˪ lT @]TXшXVQ/2n/7~]Ce;'S |@UUY6 RPl.!`0.N%ww":_c5#Yx_h \/AP e$U !bY,VnP[e5-DE|#n_\\J(?X?\Hug¾R!# @ L0O?RA8#-oЋ*15+w`srH)N Gc'ٮ!GjcfD%0I)Bԅ v-^ Bpɚvb5qK-Ppu_dPZ;O<9oen.-h\0ofߵNIENDB`josm-plugins-0.0.svn31964/routing/images/mapmode/0000755000175000017500000000000012643536105017673 5ustar basbasjosm-plugins-0.0.svn31964/routing/images/mapmode/add.png0000644000175000017500000000200611163156563021131 0ustar basbasPNG  IHDRw=sRGBbKGD pHYsgRtIMEOA=IDATHǭ[hUgfw4MҚd67E&OEE4$bxC ?w{E`iT>eHBNMְ<@?nv>["/G^}lG沢J!$qPva;*) |̩\l+Q]VS$] Жv6Z5B=vY__:1˱'otN–/v,y?(FЈB9Ѻ] Wo籅O0g~b!r,#d:z49۟%68-~zvxZλooHppej{RdLdFk=(dLe@X1'ZhO.tc.al9| R|[6 !2H|37( 혋 tȬHm%dr &"l p7_Lˤ6Drn@Zgo& > rZJ 3BXF><0|Û{[c4laNh3e|O9 ~H4N7_9ȟ-ZϦͱTp7%%RJc]Tu- -eGA_^7?? HJ/lƳϡIENDB`josm-plugins-0.0.svn31964/routing/images/mapmode/remove.png0000644000175000017500000000202311163156563021675 0ustar basbasPNG  IHDRw=sRGBbKGD pHYsgRtIME:^0BlIDATHǭ[LefgrXtم ʍ1'cƫV!HbF)"Q. ƘiL Ii^TĀC+ V3^.R7ccBH$8d- d/|vu閖 &&ХAx(lXl=ZCG..b7TJ0ԀHL'm P/oDP}iϛOF+UIipR'` -y~zf`ws (aGb EN~1jNkg3 \8gq_EǾ ^+gqfƙڊ+ $NBݔa9w= uuuYs:̀pxхIs7PX yuyٳm@;vzhp0=Z~UK+|3yC͎6Ԋ+R}/uuI mxb- N\dnhC[neKRXSSSG'y5{_w{XK"Tµ(R _?@8"Rjѓi r@pKg.# bHmDkB Fҩ7ρSokǓWN^a_-_,\{[^>|r'">9=᫝mOGCf:~b]konE"Hd2͟0>\ Lw%Lj@ rbFKͬq9 wc1h wiM~(" 5l6K4ޠA bHH$Ҟ "E{RLdxhv\>#>{RƵ{9100 ""o&noM`0A,*ayT6//=yoN6"Ow@fJʾ-oݘqb5kmF+Z6ezک! 8?+ ׫6?}~Z f["IENDB`josm-plugins-0.0.svn31964/routing/images/mapmode/routing.png0000644000175000017500000000212511163156563022072 0ustar basbasPNG  IHDRw=sRGBbKGD pHYsgRtIME V}IDATHǝ[L\U}\(0@)0rTF1ThSkx >㓉TjS MʹL%3眙9{Jo C aToBfƵ(/hce~$ϰyswl~Xr|m΀뻸>?.Kb36>\z¬QCQZ'PP҃½nؓ53J9 Un9ܞݞo&3Ws\Ԕ(myj<2퐆mTzF!:o1i. Po?uG0S4H`[L L !j+\|c٭eZIhBHjgA`c +m̫J e%QIe !bo*?  G9hm6>P J+0`.8j+V!7vIᗫi`v)QVҧ-PY ^<b% 6G1ʅ[ Mp8U _,ǫ\&13eɳ)~Q]\J16)u*Ho [Yj*Sm`ÏF"!$1#568555T~_IENDB`josm-plugins-0.0.svn31964/routing/.project0000644000175000017500000000056311273510002016441 0ustar basbas JOSM-routing org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature josm-plugins-0.0.svn31964/routing/.settings/0000755000175000017500000000000012643536105016722 5ustar basbasjosm-plugins-0.0.svn31964/routing/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000001552112420547421023704 0ustar basbaseclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 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.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 josm-plugins-0.0.svn31964/routing/data/0000755000175000017500000000000012643536105015715 5ustar basbasjosm-plugins-0.0.svn31964/routing/.classpath0000644000175000017500000000100012326615515016757 0ustar basbas josm-plugins-0.0.svn31964/routing/src/0000755000175000017500000000000012643536105015573 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/0000755000175000017500000000000012643536105016351 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/innovant/0000755000175000017500000000000012643536105020205 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/0000755000175000017500000000000012643536105021155 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/0000755000175000017500000000000012643536105021754 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/osm/0000755000175000017500000000000012643536105022552 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/osm/OsmEdge.java0000644000175000017500000000455711444174765024763 0ustar basbas/* * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.jrt.osm; import org.jgrapht.graph.DefaultWeightedEdge; import org.openstreetmap.josm.data.coor.EastNorth; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Way; /** * Class that represents an edge of the graph. * @author jose */ public class OsmEdge extends DefaultWeightedEdge { /** * Serial */ private static final long serialVersionUID = 1L; /** * Way associated */ private Way way; /** * Nodes in the edge */ private Node from, to; /** * Length edge */ private double length; /** * Speed edge. */ private double speed; /** * Constructor * @param way * @param length */ public OsmEdge(Way way, Node from, Node to) { super(); this.way = way; this.from = from; this.to = to; this.length = from.getCoor().greatCircleDistance(to.getCoor()); } /** * @return the way */ public Way getWay() { return this.way; } public EastNorth fromEastNorth() { return this.from.getEastNorth(); } public EastNorth toEastNorth() { return this.to.getEastNorth(); } /** * Returns length of segment in meters * @return length of segment in meters. */ public double getLength() { return length; } public void setLength(double length) { this.length = length; } public double getSpeed() { return speed; } public void setSpeed(double speed) { this.speed = speed; } } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/osm/OsmWayTypes.java0000644000175000017500000000412511212550273025654 0ustar basbas/* * * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.jrt.osm; /** * @author jvidal * */ public enum OsmWayTypes { MOTORWAY ("motorway",120), MOTORWAY_LINK ("motorway_link",120), TRUNK ("trunk",120), TRUNK_LINK ("trunk_link",120), PRIMARY ("primary",100), PRIMARY_LINK ("primary_link",100), SECONDARY ("secondary",90), TERTIARY ("tertiary",90), UNCLASSIFIED ("unclassified",50), ROAD ("road",100), RESIDENTIAL ("residential",50), LIVING_STREET ("living_street",30), SERVICE ("service",30), TRACK ("track",50), PEDESTRIAN ("pedestrian",30), BUS_GUIDEWAY ("bus_guideway",50), PATH ("path",40), CYCLEWAY ("cycleway",40), FOOTWAY ("footway",20), BRIDLEWAY ("bridleway",40), BYWAY ("byway",50), STEPS ("steps",10); /** * Default Constructor * @param tag */ OsmWayTypes(String tag,int speed) { this.tag = tag; this.speed = speed; } /** * Tag */ private final String tag; private final int speed; /** * @return */ public String getTag() {return tag;}; public int getSpeed() {return speed;}; } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/core/0000755000175000017500000000000012643536105022704 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/core/RoutingGraphDelegator.java0000644000175000017500000000241511444174765030021 0ustar basbas/** * */ package com.innovant.josm.jrt.core; import org.apache.log4j.Logger; import org.jgrapht.Graph; import org.jgrapht.graph.GraphDelegator; import org.openstreetmap.josm.data.osm.Node; import com.innovant.josm.jrt.core.RoutingGraphDelegator; import com.innovant.josm.jrt.core.RoutingGraph.RouteType; import com.innovant.josm.jrt.osm.OsmEdge; /** * @author jose * */ public class RoutingGraphDelegator extends GraphDelegator { /** * Logger. */ static Logger logger = Logger.getLogger(RoutingGraphDelegator.class); /** * */ private RouteType routeType; public RoutingGraphDelegator(Graph arg0) { super(arg0); } public RouteType getRouteType() { return routeType; } public void setRouteType(RouteType routeType) { this.routeType = routeType; } /** * */ private static final long serialVersionUID = 1L; @Override public double getEdgeWeight(OsmEdge edge) { double weight=Double.MAX_VALUE; if (routeType==RouteType.SHORTEST) weight=edge.getLength(); if (routeType==RouteType.FASTEST) weight=edge.getLength() / edge.getSpeed(); // Return the time spent to traverse the way return weight; } } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/core/RoutingEdge.java0000644000175000017500000000074311444174765025777 0ustar basbaspackage com.innovant.josm.jrt.core; import org.openstreetmap.josm.data.coor.LatLon; public interface RoutingEdge { public LatLon fromLatLon(); public LatLon toLatLon(); public Object fromV(); public Object toV(); public double getLength(); public void setLength(double length); public double getSpeed(); public void setSpeed(double speed); public boolean isOneway(); public void setOneway(boolean isOneway); } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/core/EdgeIterator.java0000644000175000017500000000020711444174765026134 0ustar basbaspackage com.innovant.josm.jrt.core; public interface EdgeIterator { public boolean hasNext(); public RoutingEdge next(); } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/core/RoutingGraph.java0000644000175000017500000003346712420553250026166 0ustar basbas/* * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.jrt.core; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import org.jgrapht.Graph; import org.jgrapht.alg.BellmanFordShortestPath; import org.jgrapht.alg.DijkstraShortestPath; import org.jgrapht.graph.DirectedWeightedMultigraph; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.data.coor.LatLon; import org.openstreetmap.josm.data.osm.DataSet; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Way; import com.innovant.josm.jrt.osm.OsmEdge; import com.innovant.josm.plugin.routing.RoutingLayer; import com.innovant.josm.plugin.routing.RoutingModel; /** * Class utility to work with graph routers. * * @author Juangui * @author Jose Vidal * @author Hassan S */ public class RoutingGraph { /** * Routing Profile */ private final RoutingProfile routingProfile; /** * Diferent algorithms to apply to the graph. */ public enum Algorithm { ROUTING_ALG_DIJKSTRA, ROUTING_ALG_BELLMANFORD }; /** * Search criteria for the route. */ public enum RouteType {FASTEST,SHORTEST}; /** * */ private RouteType routeType; /** * Associated Osm DataSet */ private final DataSet data; /** * Logger. */ static Logger logger = Logger.getLogger(RoutingGraph.class); private static Collection excludedHighwayValues = Arrays.asList(new String[]{ "bus_stop", "traffic_signals", "street_lamp", "stop", "construction", "platform", "give_way", "proposed", "milestone", "speed_camera", "abandoned" }); /** * Graph state * true Graph in memory. * false Graph not created. */ // public boolean graphState; /** * OSM Graph. */ // private DirectedWeightedMultigraph graph; // private WeightedMultigraph graph; private Graph graph; private RoutingGraphDelegator rgDelegator=null; /** * Graph getter */ public Graph getGraph(){ return graph; } private void addEdgeBidirectional( Way way, Node from, Node to){ addEdge(way,from,to); addEdge(way,to,from); } private void addEdgeReverseOneway( Way way, Node from, Node to){ addEdge(way,to,from); } private void addEdgeNormalOneway( Way way, Node from, Node to){ addEdge(way,from,to); } /** * Speeds */ private Map waySpeeds; /** * Default Constructor. */ public RoutingGraph(DataSet data) { // this.graphState = false; this.graph = null; this.data = data; routeType=RouteType.SHORTEST; routingProfile=new RoutingProfile("default"); routingProfile.setOnewayUse(true); // Don't ignore oneways by default this.setWaySpeeds(routingProfile.getWaySpeeds()); logger.debug("Created RoutingGraph"); } /** * Create OSM graph for routing * * @return */ public void createGraph() { logger.debug("Creating Graph..."); graph = new DirectedWeightedMultigraph<>(OsmEdge.class); rgDelegator=new RoutingGraphDelegator(graph); rgDelegator.setRouteType(this.routeType); // iterate all ways and segments for all nodes: for (Way way : data.getWays()) { // skip way if not suitable for routing. if (way == null || way.isDeleted() || !this.isvalidWay(way) || way.getNodes().size() < 1) continue; // INIT Node from = null; Node to = null; List nodes = way.getNodes(); int nodes_count = nodes.size(); /* * Assume node is A B C D E. The procedure should be * * case 1 - bidirectional ways: * 1) Add vertex A B C D E * 2) Link A<->B, B<->C, C<->D, D<->E as Edges * * case 2 - oneway reverse: * 1) Add vertex A B C D E * 2) Link B->A,C->B,D->C,E->D as Edges. result: A<-B<-C<-D<-E * * case 3 - oneway normal: * 1) Add vertex A B C D E * 2) Link A->B, B->C, C->D, D->E as Edges. result: A->B->C->D->E * * */ String oneway_val = way.get("oneway"); /* get (oneway=?) tag for this way. */ String junction_val = way.get("junction"); /* get (junction=?) tag for this way. */ from = nodes.get(0); /* 1st node A */ graph.addVertex(from); /* add vertex A */ for (int i = 1; i < nodes_count; i++) { /* loop from B until E */ to = nodes.get(i); /* 2nd node B */ if (to != null && !to.isDeleted()) { graph.addVertex(to); /* add vertex B */ //this is where we link the vertices if (!routingProfile.isOnewayUsed()) { //"Ignore oneways" is selected addEdgeBidirectional(way, from, to); } else if (oneway_val == null && junction_val == "roundabout") { //Case (roundabout): oneway=implicit yes addEdgeNormalOneway(way, from, to); } else if (oneway_val == null || oneway_val == "false" || oneway_val == "no" || oneway_val == "0") { //Case (bi-way): oneway=false OR oneway=unset OR oneway=0 OR oneway=no addEdgeBidirectional(way, from, to); } else if (oneway_val == "-1") { //Case (oneway reverse): oneway=-1 addEdgeReverseOneway(way, from, to); } else if (oneway_val == "1" || oneway_val == "yes" || oneway_val == "true") { //Case (oneway normal): oneway=yes OR 1 OR true addEdgeNormalOneway(way, from, to); } from = to; /* we did A<->B, next loop we will do B<->C, so from=B,to=C for next loop. */ } } // end of looping thru nodes } // end of looping thru ways logger.debug("End Create Graph"); logger.debug("Vertex: "+graph.vertexSet().size()); logger.debug("Edges: "+graph.edgeSet().size()); } /** * Compute weight and add edge to the graph * @param way * @param from * @param to */ private void addEdge(Way way,Node from, Node to) { LatLon fromLL = from.getCoor(); LatLon toLL = from.getCoor(); if (fromLL == null || toLL == null) { return; } double length = fromLL.greatCircleDistance(toLL); OsmEdge edge = new OsmEdge(way, from, to); edge.setSpeed(12.1); graph.addEdge(from, to, edge); // weight = getWeight(way); double weight = getWeight(way, length); setWeight(edge, length); logger.debug("edge for way " + way.getId() + "(from node " + from.getId() + " to node " + to.getId() + ") has weight: " + weight); ((DirectedWeightedMultigraph)graph).setEdgeWeight(edge, weight); } /** * Set the weight for the given segment depending on the highway type * and the length of the segment. The higher the value, the less it is used * in routing. * * @param way * the way. * @return */ private void setWeight(OsmEdge osmedge, double length) { osmedge.setLength(length); if (this.waySpeeds.containsKey(osmedge.getWay().get("highway"))) osmedge.setSpeed(this.waySpeeds.get(osmedge.getWay().get("highway"))); } /** * Returns the weight for the given segment depending on the highway type * and the length of the segment. The higher the value, the less it is used * in routing. * * @param way * the way. * @return */ private double getWeight(Way way, double length) { // Default speed if no setting is found double speed = 1; switch (routeType) { case SHORTEST: // Same speed for all types of ways if (this.waySpeeds.containsKey("residential")) speed=this.waySpeeds.get("residential"); break; case FASTEST: // Each type of way may have a different speed if (this.waySpeeds.containsKey(way.get("highway"))) speed=this.waySpeeds.get(way.get("highway")); logger.debug("Speed="+speed); break; default: break; } // Return the time spent to traverse the way return length / speed; } /** * Check if a Way is correct. * * @param way * The way. * @return true is valid. false is not valid. */ public boolean isvalidWay(Way way) { //if (!way.isTagged()) <---not needed me thinks // return false; String highway = way.get("highway"); return (highway != null && !excludedHighwayValues.contains(highway)) || way.get("junction") != null || way.get("service") != null; } /** * Apply selected routing algorithm to the graph. * * @param nodes * Nodes used to calculate path. * @param algorithm * Algorithm used to compute the path, * RoutingGraph.Algorithm.ROUTING_ALG_DIJKSTRA or * RoutingGraph.Algorithm.ROUTING_ALG_BELLMANFORD * @return new path. */ public List applyAlgorithm(List nodes, Algorithm algorithm) { List path = new ArrayList<>(); Graph g; double totalWeight = 0; RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); RoutingModel routingModel = layer.getRoutingModel(); if (graph == null || routingModel.getOnewayChanged()) this.createGraph(); logger.debug("apply algorithm between nodes "); for (Node node : nodes) { logger.debug(node.getId()); } logger.debug("-----------------------------------"); // Assign the graph to g g = graph; switch (algorithm) { case ROUTING_ALG_DIJKSTRA: logger.debug("Using Dijkstra algorithm"); DijkstraShortestPath routingk = null; for (int index = 1; index < nodes.size(); ++index) { routingk = new DijkstraShortestPath<>(g, nodes .get(index - 1), nodes.get(index)); if (routingk.getPathEdgeList() == null) { logger.debug("no path found!"); break; } path.addAll(routingk.getPathEdgeList()); totalWeight += routingk.getPathLength(); } break; case ROUTING_ALG_BELLMANFORD: logger.debug("Using Bellman Ford algorithm"); for (int index = 1; index < nodes.size(); ++index) { path = BellmanFordShortestPath.findPathBetween(rgDelegator, nodes .get(index - 1), nodes.get(index)); if (path == null) { logger.debug("no path found!"); return null; } } break; default: logger.debug("Wrong algorithm"); break; } logger.debug("shortest path found: " + path + "\nweight: " + totalWeight); return path; } /** * Return the number of vertices. * @return the number of vertices. */ public int getVertexCount(){ int value=0; if (graph!=null) value=graph.vertexSet().size(); return value; } /** * Return the number of edges. * @return the number of edges. */ public int getEdgeCount(){ int value=0; if (graph!=null) value=graph.edgeSet().size(); return value; } /** * @param routeType the routeType to set */ public void setTypeRoute(RouteType routetype) { this.routeType = routetype; this.rgDelegator.setRouteType(routetype); } /** * @return the routeType */ public RouteType getTypeRoute() { return routeType; } public Map getWaySpeeds() { return waySpeeds; } public void setWaySpeeds(Map waySpeeds) { this.waySpeeds = waySpeeds; } public void resetGraph() { graph=null; } public RoutingProfile getRoutingProfile() { return routingProfile; } } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/core/RoutingProfile.java0000644000175000017500000001143712420553250026516 0ustar basbaspackage com.innovant.josm.jrt.core; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Logger; import org.openstreetmap.josm.Main; /** * This class holds information about a routing profile. * * A routing profile specifies the type of vehicle that will go through the route * and the conditions with respect to the traversal of different types of edges * * For instance, a pedestrian can traverse streets in both directions, walk through * pedestrian ways and almost all types of ways except motorways, climb steps, and * can ignore turn restrictions, while a handicapped person would have the same profile * except for climbing steps. A car can drive at the maximum allowed speed of the way, * and can not use cycleways nor pedestrian ways, while a bicycle can, but its maximum * speed for any type of way would be around 50km/h. * * When combined with public transit data, information of which types of transport modes * are allowed for the vehicle can be stored in the profile. For instance, bicycles are * usually allowed to travel on board of trains, trams and subways. * * @author juangui * */ public class RoutingProfile { /** * logger */ static Logger logger = Logger.getLogger(RoutingProfile.class); /** * True if oneway is used for routing (i.e. for cars). */ private boolean useOneway; /** * True if turn restrictions are used for routing (i.e. for cars). */ private boolean useRestrictions; /** * True if maximum allowed speed of ways is considered for routing (i.e. for cars). */ private boolean useMaxAllowedSpeed; /** * Name of the routing profile, for identification issues (i.e. "pedestrian"). */ private String name; /** * Holds traverse speed for each type of way, using the type as key. * A speed of zero means that this type of way cannot be traversed. */ private Map waySpeeds; /** * Holds permission of use for each type of transport mode, using the mode as key. */ private Map allowedModes; /** * Constructor * @param name The name for the routing profile. Please use a name that is * self descriptive, i.e., something that an application user would * understand (like "pedestrian", "motorbike", "bicycle", etc.) */ public RoutingProfile(String name) { logger.debug("Init RoutingProfile with name: "+name); this.name = name; waySpeeds=new HashMap<>(); Map prefs=Main.pref.getAllPrefix("routing.profile."+name+".speed"); for(String key:prefs.keySet()){ waySpeeds.put((key.split("\\.")[4]), Double.valueOf(prefs.get(key))); } for (String key:waySpeeds.keySet()) logger.debug(key+ "-- speed: "+waySpeeds.get(key)); logger.debug("End init RoutingProfile with name: "+name); } public void setName(String name) { this.name = name; } public String getName() { return name; } public void setOnewayUse(boolean useOneway) { this.useOneway = useOneway; } public boolean isOnewayUsed() { return useOneway; } public void setRestrictionsUse(boolean useRestrictions) { this.useRestrictions = useRestrictions; } public boolean isRestrictionsUsed() { return useRestrictions; } public void setMaxAllowedSpeedUse(boolean useMaxAllowedSpeed) { this.useMaxAllowedSpeed = useMaxAllowedSpeed; } public boolean isMaxAllowedSpeedUsed() { return useMaxAllowedSpeed; } public void setWayTypeSpeed(String type, double speed) { waySpeeds.put(type, speed); } public void setTransportModePermission(String mode, boolean permission) { allowedModes.put(mode, permission); } /** * Return whether the driving profile specifies that a particular type of way * can be traversed * @param type Key for the way type * @return True if the way type can be traversed */ public boolean isWayTypeAllowed(String type) { if (waySpeeds.get(type) != 0.0) return true; return false; } /** * Return whether the driving profile specifies that a particular type of transport * mode can be used * @param mode Key for the way type * @return True if the way type can be traversed */ public boolean isTransportModeAllowed(String mode) { return allowedModes.get(mode); } public double getSpeed(String key){ if(!waySpeeds.containsKey(key)) return 0.0; return waySpeeds.get(key); } public Map getWaySpeeds() { return waySpeeds; } public void setWaySpeeds(Map waySpeeds) { this.waySpeeds = waySpeeds; } } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/gtfs/0000755000175000017500000000000012643536105022717 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/jrt/gtfs/GTFSTransportModes.java0000644000175000017500000000305111212550273027222 0ustar basbaspackage com.innovant.josm.jrt.gtfs; /** * Constants for parsing GTFS and to use in Routing Profiles * @author juangui * TODO Using integers is suitable to parse gtfs feeds but * Routing Profile keys should be Strings */ public class GTFSTransportModes { /** * 0 - Tram, Streetcar, Light rail. Any light rail or street level system within * a metropolitan area. */ public static final int TRAM = 0; public static final int STREETCAR = 0; public static final int LIGHT_RAIL = 0; /** * 1 - Subway, Metro. Any underground rail system within a metropolitan area. */ public static final int SUBWAY = 1; public static final int METRO = 1; /** * 2 - Rail. Used for intercity or long-distance travel. */ public static final int RAIL = 2; /** * 3 - Bus. Used for short- and long-distance bus routes. */ public static final int BUS = 3; /** * 4 - Ferry. Used for short- and long-distance boat service. */ public static final int FERRY = 4; /** * 5 - Cable car. Used for street-level cable cars where the cable runs beneath the car. */ public static final int CABLE_CAR = 5; /** * 6 - Gondola, Suspended cable car. Typically used for aerial cable cars where * the car is suspended from the cable. */ public static final int GONDOLA = 6; public static final int SUSPENDED_CABLE_CAR = 6; /** * 7 - Funicular. Any rail system designed for steep inclines. */ public static final int FUNICULAR = 7; } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/0000755000175000017500000000000012643536105022453 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/0000755000175000017500000000000012643536105024142 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/actions/0000755000175000017500000000000012643536105025602 5ustar basbas././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.javajosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction0000644000175000017500000001003412143734466031750 0ustar basbas/* * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.plugin.routing.actions; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.event.MouseEvent; import java.util.List; import org.apache.log4j.Logger; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.actions.mapmode.MapMode; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.gui.MapFrame; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.tools.ImageProvider; import com.innovant.josm.plugin.routing.RoutingLayer; import com.innovant.josm.plugin.routing.RoutingModel; import com.innovant.josm.plugin.routing.RoutingPlugin; /** * Accounts for the selection or unselection of the remove route nodes tool in the tool bar, * and the mouse events when this tool is selected * @author Juangui * @author Jose Vidal * */ public class RemoveRouteNodeAction extends MapMode { /** * Square of the distance radius where route nodes can be removed */ private static final int REMOVE_SQR_RADIUS = 100; /** * Logger. */ static Logger logger = Logger.getLogger(RoutingLayer.class); public RemoveRouteNodeAction(MapFrame mapFrame) { // TODO Use constructor with shortcut super(tr("Routing"), "remove", tr("Click to remove destination"), mapFrame, ImageProvider.getCursor("normal", "delete")); } @Override public void enterMode() { super.enterMode(); Main.map.mapView.addMouseListener(this); } @Override public void exitMode() { super.exitMode(); Main.map.mapView.removeMouseListener(this); } @Override public void mouseClicked(MouseEvent e) { // If left button is clicked if (e.getButton() == MouseEvent.BUTTON1) { if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); RoutingModel routingModel = layer.getRoutingModel(); // Search for the nearest node in the list List nl = routingModel.getSelectedNodes(); int index = -1; double dmax = REMOVE_SQR_RADIUS; // maximum distance, in pixels for (int i=0;i= 0) { // Remove node logger.debug("Removing node " + nl.get(index)); routingModel.removeNode(index); RoutingPlugin.getInstance().getRoutingDialog().removeNode(index); Main.map.repaint(); } else { logger.debug("Can't find a node to remove."); } } } } @Override public boolean layerIsSupported(Layer l) { return l instanceof RoutingLayer; } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.javajosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.j0000644000175000017500000001214212144521552031642 0ustar basbas/* * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.plugin.routing.actions; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.Point; import java.awt.event.MouseEvent; import java.util.List; import org.apache.log4j.Logger; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.actions.mapmode.MapMode; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.gui.MapFrame; import org.openstreetmap.josm.tools.ImageProvider; import org.openstreetmap.josm.gui.layer.Layer; import com.innovant.josm.plugin.routing.RoutingLayer; import com.innovant.josm.plugin.routing.RoutingModel; import com.innovant.josm.plugin.routing.RoutingPlugin; import com.innovant.josm.plugin.routing.gui.RoutingDialog; /** * Accounts for the selection or unselection of the routing tool in the tool bar, * and the mouse events when this tool is selected * @author Juangui * @author Jose Vidal * */ public class MoveRouteNodeAction extends MapMode { /** * Square of the distance radius where route nodes can be selected for dragging */ private static final int DRAG_SQR_RADIUS = 100; /** * Logger. */ static Logger logger = Logger.getLogger(RoutingLayer.class); /** * Index of dragged node */ private int index; /** * Constructor * @param mapFrame */ public MoveRouteNodeAction(MapFrame mapFrame) { // TODO Use constructor with shortcut super(tr("Routing"), "move", tr("Click and drag to move destination"), mapFrame, ImageProvider.getCursor("normal", "move")); } @Override public void enterMode() { super.enterMode(); Main.map.mapView.addMouseListener(this); } @Override public void exitMode() { super.exitMode(); Main.map.mapView.removeMouseListener(this); } @Override public void mousePressed(MouseEvent e) { // If left button is pressed if (e.getButton() == MouseEvent.BUTTON1) { if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { requestFocusInMapView(); RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); RoutingModel routingModel = layer.getRoutingModel(); // Search for the nearest node in the list List nl = routingModel.getSelectedNodes(); index = -1; double dmax = DRAG_SQR_RADIUS; // maximum distance, in pixels for (int i=0;i=0) logger.debug("Moved from node " + nl.get(index)); } } } @Override public void mouseReleased(MouseEvent e) { // If left button is released and a route node is being dragged if ((e.getButton() == MouseEvent.BUTTON1) && (index>=0)) { searchAndReplaceNode(e.getPoint()); } } @Override public void mouseDragged(MouseEvent e) { } private void searchAndReplaceNode(Point point) { if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); RoutingModel routingModel = layer.getRoutingModel(); RoutingDialog routingDialog = RoutingPlugin.getInstance().getRoutingDialog(); // Search for nearest highway node Node node = null; node = layer.getNearestHighwayNode(point); if (node == null) { logger.debug("Didn't found a close node to move to."); return; } logger.debug("Moved to node " + node); routingModel.removeNode(index); routingDialog.removeNode(index); routingModel.insertNode(index, node); routingDialog.insertNode(index, node); Main.map.repaint(); } } @Override public boolean layerIsSupported(Layer l) { return l instanceof RoutingLayer; } } ././@LongLink0000644000000000000000000000014700000000000011605 Lustar rootrootjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/actions/AddRouteNodeAction.javajosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/actions/AddRouteNodeAction.ja0000644000175000017500000000635712143734466031611 0ustar basbas/* * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.plugin.routing.actions; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.event.MouseEvent; import org.apache.log4j.Logger; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.actions.mapmode.MapMode; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.gui.MapFrame; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.tools.ImageProvider; import com.innovant.josm.plugin.routing.RoutingLayer; import com.innovant.josm.plugin.routing.RoutingPlugin; /** * Accounts for the selection or unselection of the routing tool in the tool bar, * and the mouse events when this tool is selected * @author Juangui * @author Jose Vidal * */ public class AddRouteNodeAction extends MapMode { /** * Logger. */ static Logger logger = Logger.getLogger(AddRouteNodeAction.class); /** * Constructor * @param mapFrame */ public AddRouteNodeAction(MapFrame mapFrame) { // TODO Use constructor with shortcut super(tr("Routing"), "add", tr("Click to add destination."), mapFrame, ImageProvider.getCursor("crosshair", null)); } @Override public void enterMode() { super.enterMode(); Main.map.mapView.addMouseListener(this); } @Override public void exitMode() { super.exitMode(); Main.map.mapView.removeMouseListener(this); } @Override public void mouseClicked(MouseEvent e) { // If left button is clicked if (e.getButton() == MouseEvent.BUTTON1) { // Search for nearest highway node Node node = null; if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); node = layer.getNearestHighwayNode(e.getPoint()); if(node == null) { logger.debug("no selected node"); return; } logger.debug("selected node " + node); layer.getRoutingModel().addNode(node); RoutingPlugin.getInstance().getRoutingDialog().addNode(node); } } Main.map.repaint(); } @Override public boolean layerIsSupported(Layer l) { return l instanceof RoutingLayer; } } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/package.html0000644000175000017500000000025511163156043026420 0ustar basbas Package Main classes of Plugin. josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/RoutingPlugin.java0000644000175000017500000002367612420553250027622 0ustar basbas/* * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.plugin.routing; import static org.openstreetmap.josm.tools.I18n.tr; import java.io.File; import java.util.ArrayList; import org.apache.log4j.Logger; import org.apache.log4j.xml.DOMConfigurator; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent; import org.openstreetmap.josm.data.osm.event.DataSetListenerAdapter; import org.openstreetmap.josm.data.osm.event.DatasetEventManager; import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode; import org.openstreetmap.josm.gui.IconToggleButton; import org.openstreetmap.josm.gui.MapFrame; import org.openstreetmap.josm.gui.MapView; import org.openstreetmap.josm.gui.MapView.LayerChangeListener; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.gui.preferences.PreferenceSetting; import org.openstreetmap.josm.plugins.Plugin; import org.openstreetmap.josm.plugins.PluginInformation; import com.innovant.josm.plugin.routing.actions.AddRouteNodeAction; import com.innovant.josm.plugin.routing.actions.MoveRouteNodeAction; import com.innovant.josm.plugin.routing.actions.RemoveRouteNodeAction; import com.innovant.josm.plugin.routing.gui.RoutingDialog; import com.innovant.josm.plugin.routing.gui.RoutingMenu; import com.innovant.josm.plugin.routing.gui.RoutingPreferenceDialog; /** * The main class of the routing plugin * @author juangui * @author Jose Vidal * @author cdaller * * @version 0.3 */ public class RoutingPlugin extends Plugin implements LayerChangeListener,DataSetListenerAdapter.Listener { /** * Logger */ static Logger logger = Logger.getLogger(RoutingPlugin.class); /** * The list of routing layers */ private final ArrayList layers; /** * The side dialog where nodes are listed */ private RoutingDialog routingDialog; /** * Preferences Settings Dialog. */ private final PreferenceSetting preferenceSettings; /** * MapMode for adding route nodes. * We use this field to enable or disable the mode automatically. */ private AddRouteNodeAction addRouteNodeAction; /** * MapMode for removing route nodes. * We use this field to enable or disable the mode automatically. */ private RemoveRouteNodeAction removeRouteNodeAction; /** * MapMode for moving route nodes. * We use this field to enable or disable the mode automatically. */ private MoveRouteNodeAction moveRouteNodeAction; /** * IconToggleButton for adding route nodes, we use this field to show or hide the button. */ private IconToggleButton addRouteNodeButton; /** * IconToggleButton for removing route nodes, we use this field to show or hide the button. */ private IconToggleButton removeRouteNodeButton; /** * IconToggleButton for moving route nodes, we use this field to show or hide the button. */ private IconToggleButton moveRouteNodeButton; /** * IconToggleButton for moving route nodes, we use this field to show or hide the button. */ private final RoutingMenu menu; /** * Reference for the plugin class (as if it were a singleton) */ private static RoutingPlugin plugin; private final DataSetListenerAdapter datasetAdapter; /** * Default Constructor */ public RoutingPlugin(PluginInformation info) { super(info); datasetAdapter = new DataSetListenerAdapter(this); plugin = this; // Assign reference to the plugin class File log4jConfigFile = new java.io.File("log4j.xml"); if (log4jConfigFile.exists()) { DOMConfigurator.configure(log4jConfigFile.getPath()); } else { System.err.println("Routing plugin warning: log4j configuration not found"); } logger.debug("Loading routing plugin..."); preferenceSettings=new RoutingPreferenceDialog(); // Initialize layers list layers = new ArrayList<>(); // Add menu menu = new RoutingMenu(); // Register this class as LayerChangeListener MapView.addLayerChangeListener(this); DatasetEventManager.getInstance().addDatasetListener(datasetAdapter, FireMode.IN_EDT_CONSOLIDATED); logger.debug("Finished loading plugin"); } /** * Provides static access to the plugin instance, to enable access to the plugin methods * @return the instance of the plugin */ public static RoutingPlugin getInstance() { return plugin; } /** * Get the routing side dialog * @return The instance of the routing side dialog */ public RoutingDialog getRoutingDialog() { return routingDialog; } public void addLayer() { OsmDataLayer osmLayer = Main.main.getEditLayer(); if (osmLayer != null) { RoutingLayer layer = new RoutingLayer(tr("Routing") + " [" + osmLayer.getName() + "]", osmLayer); layers.add(layer); Main.main.addLayer(layer); } } @Override public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { if (newFrame != null) { // Create plugin map modes addRouteNodeAction = new AddRouteNodeAction(newFrame); removeRouteNodeAction = new RemoveRouteNodeAction(newFrame); moveRouteNodeAction = new MoveRouteNodeAction(newFrame); // Create plugin buttons and add them to the toolbar addRouteNodeButton = new IconToggleButton(addRouteNodeAction); removeRouteNodeButton = new IconToggleButton(removeRouteNodeAction); moveRouteNodeButton = new IconToggleButton(moveRouteNodeAction); addRouteNodeButton.setAutoHideDisabledButton(true); removeRouteNodeButton.setAutoHideDisabledButton(true); moveRouteNodeButton.setAutoHideDisabledButton(true); newFrame.addMapMode(addRouteNodeButton); newFrame.addMapMode(removeRouteNodeButton); newFrame.addMapMode(moveRouteNodeButton); // Enable menu menu.enableStartItem(); newFrame.addToggleDialog(routingDialog = new RoutingDialog()); } else { addRouteNodeAction = null; removeRouteNodeAction = null; moveRouteNodeAction = null; addRouteNodeButton = null; removeRouteNodeButton = null; moveRouteNodeButton = null; routingDialog = null; } } public void activeLayerChange(Layer oldLayer, Layer newLayer) { if (newLayer instanceof RoutingLayer) { /* show Routing toolbar and dialog window */ menu.enableRestOfItems(); if (routingDialog != null) { routingDialog.showDialog(); routingDialog.refresh(); } }else{ /* hide Routing toolbar and dialog window */ menu.disableRestOfItems(); if (routingDialog != null) { routingDialog.hideDialog(); } } } public void layerAdded(Layer newLayer) { // Add button(s) to the tool bar when the routing layer is added if (newLayer instanceof RoutingLayer) { menu.enableRestOfItems(); // Set layer on top and select layer, also refresh toggleDialog to reflect selection Main.map.mapView.moveLayer(newLayer, 0); logger.debug("Added routing layer."); } } public void layerRemoved(Layer oldLayer) { if ((oldLayer instanceof RoutingLayer) & (layers.size()==1)) { // Remove button(s) from the tool bar when the last routing layer is removed addRouteNodeButton.setVisible(false); removeRouteNodeButton.setVisible(false); moveRouteNodeButton.setVisible(false); menu.disableRestOfItems(); layers.remove(oldLayer); logger.debug("Removed routing layer."); } else if (oldLayer instanceof OsmDataLayer) { // Remove all associated routing layers // Convert to Array to prevent ConcurrentModificationException when removing layers from ArrayList // FIXME: can't remove associated routing layers without triggering exceptions in some cases RoutingLayer[] layersArray = layers.toArray(new RoutingLayer[0]); for (int i=0;i nodes=null; private List path=null; /** * Flag to advise about changes in the selected nodes. */ private boolean changeNodes=false; /** * Flag to advise about changes in ways. */ private boolean changeOneway=false; /** * Default Constructor. */ public RoutingModel(DataSet data) { nodes = new ArrayList<>(); System.out.println("gr " + data); routingGraph = new RoutingGraph(data); } /** * Method that returns the selected nodes to calculate route. * @return the selectedNodes */ public List getSelectedNodes() { return nodes; } /** * Adds a node to the route node list. * @param node the node to add. */ public void addNode(Node node) { nodes.add(node); this.changeNodes=true; } /** * Removes a node from the route node list. * @param index the index of the node to remove. */ public void removeNode(int index) { if (nodes.size()>index) { nodes.remove(index); this.changeNodes=true; } } /** * Inserts a node in the route node list. * @param index the index where the node will be inserted * @param node the node to be inserted */ public void insertNode(int index, Node node) { if (nodes.size()>=index) { nodes.add(index, node); this.changeNodes=true; } } /** * Reverse list of nodes */ public void reverseNodes() { List aux = new ArrayList<>(); for (Node n : nodes) { aux.add(0,n); } nodes = aux; this.changeNodes=true; } /** * Get the edges of the route. * @return A list of edges forming the shortest path */ public List getRouteEdges() { if (this.changeNodes || path==null) { path=this.routingGraph.applyAlgorithm(nodes, Algorithm.ROUTING_ALG_DIJKSTRA); this.changeNodes=false; this.changeOneway=false; } return path; } /** * Marks that some node or the node order has changed so the path should be computed again */ public void setNodesChanged() { this.changeNodes = true; } /** * Marks that "Ignore oneway" option has changed so the path should be computed again */ public void setOnewayChanged() { this.changeOneway = true; } /** * Marks that "Ignore oneway" option has changed so the path should be computed again */ public boolean getOnewayChanged() { return this.changeOneway; } /** * Resets all data. */ public void reset() { nodes.clear(); this.changeNodes=true; } } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/gui/0000755000175000017500000000000012643536105024726 5ustar basbasjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java0000644000175000017500000001744112611151766030055 0ustar basbas/* * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.plugin.routing.gui; import static org.openstreetmap.josm.gui.help.HelpUtil.ht; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.KeyEvent; import javax.swing.ButtonGroup; import javax.swing.JCheckBoxMenuItem; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JRadioButtonMenuItem; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.gui.MainMenu; import com.innovant.josm.jrt.core.RoutingGraph.RouteType; import com.innovant.josm.plugin.routing.RoutingLayer; import com.innovant.josm.plugin.routing.RoutingModel; import com.innovant.josm.plugin.routing.RoutingPlugin; /** * The menu bar from this plugin * @author jvidal * */ public class RoutingMenu extends JMenu { /** * Default serial version UID */ private static final long serialVersionUID = 3559922048225708480L; private final JMenuItem startMI; private final JMenuItem reverseMI; private final JMenuItem clearMI; private final JMenuItem regraphMI; private final JMenu criteriaM; private final JMenu menu; /** */ public RoutingMenu() { MainMenu mm = Main.main.menu; menu = mm.addMenu("Routing", tr("Routing"), KeyEvent.VK_O, mm.getDefaultMenuPos(), ht("/Plugin/Routing")); startMI = new JMenuItem(tr("Add routing layer")); startMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RoutingPlugin.getInstance().addLayer(); } }); menu.add(startMI); menu.addSeparator(); ButtonGroup group = new ButtonGroup(); criteriaM = new JMenu(tr("Criteria")); JRadioButtonMenuItem rshorter = new JRadioButtonMenuItem(tr("Shortest")); rshorter.setSelected(true); rshorter.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); RoutingModel routingModel = layer.getRoutingModel(); if (e.getStateChange()==ItemEvent.SELECTED) { routingModel.routingGraph.setTypeRoute(RouteType.SHORTEST); } else { routingModel.routingGraph.setTypeRoute(RouteType.FASTEST); } // routingModel.routingGraph.resetGraph(); // routingModel.routingGraph.createGraph(); //TODO: Change this way //FIXME: do not change node but recalculate routing. routingModel.setNodesChanged(); Main.map.repaint(); } } }); JRadioButtonMenuItem rfaster = new JRadioButtonMenuItem(tr("Fastest")); group.add(rshorter); group.add(rfaster); criteriaM.add(rshorter); criteriaM.add(rfaster); criteriaM.addSeparator(); JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(tr("Ignore oneways")); cbmi.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); RoutingModel routingModel = layer.getRoutingModel(); if (e.getStateChange()==ItemEvent.SELECTED) routingModel.routingGraph.getRoutingProfile().setOnewayUse(false); else routingModel.routingGraph.getRoutingProfile().setOnewayUse(true); routingModel.setNodesChanged(); routingModel.setOnewayChanged(); Main.map.repaint(); } } }); criteriaM.add(cbmi); menu.add(criteriaM); menu.addSeparator(); reverseMI = new JMenuItem(tr("Reverse route")); reverseMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); RoutingModel routingModel = layer.getRoutingModel(); routingModel.reverseNodes(); Main.map.repaint(); } } }); menu.add(reverseMI); clearMI = new JMenuItem(tr("Clear route")); clearMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); RoutingModel routingModel = layer.getRoutingModel(); // Reset routing nodes and paths routingModel.reset(); RoutingPlugin.getInstance().getRoutingDialog().clearNodes(); Main.map.repaint(); } } }); menu.add(clearMI); regraphMI = new JMenuItem(tr("Reconstruct Graph")); regraphMI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); RoutingModel routingModel = layer.getRoutingModel(); routingModel.routingGraph.resetGraph(); routingModel.routingGraph.createGraph(); } } }); menu.add(regraphMI); // Initially disabled disableAllItems(); } public void disableAllItems() { startMI.setEnabled(false); reverseMI.setEnabled(false); clearMI.setEnabled(false); criteriaM.setEnabled(false); regraphMI.setEnabled(false); } public void enableStartItem() { startMI.setEnabled(true); } public void enableRestOfItems() { reverseMI.setEnabled(true); clearMI.setEnabled(true); criteriaM.setEnabled(true); regraphMI.setEnabled(true); } public void disableRestOfItems() { reverseMI.setEnabled(false); clearMI.setEnabled(false); criteriaM.setEnabled(false); regraphMI.setEnabled(false); } } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/gui/RoutingDialog.java0000644000175000017500000001000012360636736030336 0ustar basbas/* * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.plugin.routing.gui; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.ComponentOrientation; import java.awt.event.KeyEvent; import javax.swing.DefaultListModel; import javax.swing.JList; import javax.swing.JScrollPane; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.gui.dialogs.ToggleDialog; import org.openstreetmap.josm.tools.Shortcut; import com.innovant.josm.plugin.routing.RoutingLayer; import com.innovant.josm.plugin.routing.RoutingModel; /** * @author jose * */ public class RoutingDialog extends ToggleDialog { private final DefaultListModel model; private JList jList = null; private JScrollPane jScrollPane = null; /** * Serial UID */ private static final long serialVersionUID = 8625615652900341987L; public RoutingDialog() { super(tr("Routing"), "routing", tr("Open a list of routing nodes"), Shortcut.registerShortcut("subwindow:routing", tr("Toggle: {0}", tr("Routing")), KeyEvent.VK_R, Shortcut.ALT_CTRL_SHIFT), 150); model = new DefaultListModel<>(); createLayout(getJScrollPane(), false, null); } /** * This method initializes jScrollPane * * @return javax.swing.JScrollPane */ private JScrollPane getJScrollPane() { if (jScrollPane == null) { jScrollPane = new JScrollPane(); jScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); jScrollPane.setViewportView(getJList()); } return jScrollPane; } /** * This method initializes jList * * @return javax.swing.JList */ private JList getJList() { if (jList == null) { jList = new JList<>(); jList.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); jList.setModel(model); } return jList; } /** * Remove item from the list of nodes * @param index */ public void removeNode(int index) { model.remove(index); } /** * Add item to the list of nodes * @param obj */ public void addNode(Node n) { model.addElement(n.getId()+" ["+n.getCoor().toDisplayString()+"]"); } /** * Insert item to the list of nodes * @param index * @param obj */ public void insertNode(int index, Node n) { model.insertElementAt(n.getId()+" ["+n.getCoor().toDisplayString()+"]", index); } /** * Clear list of nodes */ public void clearNodes() { model.clear(); } public void refresh() { clearNodes(); if (Main.map.mapView.getActiveLayer() instanceof RoutingLayer) { RoutingLayer routingLayer = (RoutingLayer)Main.map.mapView.getActiveLayer(); RoutingModel routingModel = routingLayer.getRoutingModel(); for (Node n : routingModel.getSelectedNodes()) { addNode(n); } } } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootjosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/gui/RoutingPreferenceDialog.javajosm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/gui/RoutingPreferenceDialog.j0000644000175000017500000002037012360636736031660 0ustar basbas/* * * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.plugin.routing.gui; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.ComponentOrientation; import java.awt.Dimension; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Map; import java.util.Map.Entry; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.table.DefaultTableModel; import org.apache.log4j.Logger; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; import org.openstreetmap.josm.tools.GBC; import com.innovant.josm.jrt.osm.OsmWayTypes; public class RoutingPreferenceDialog extends DefaultTabPreferenceSetting { /** * Logger */ static Logger logger = Logger.getLogger(RoutingPreferenceDialog.class); private Map orig; private DefaultTableModel model; /** * Constructor */ public RoutingPreferenceDialog() { super("routing", tr("Routing Plugin Preferences"), tr("Configure routing preferences.")); readPreferences(); } public void addGui(final PreferenceTabbedPane gui) { JPanel principal = gui.createPreferenceTab(this); JPanel p = new JPanel(); p.setLayout(new GridBagLayout()); model = new DefaultTableModel(new String[] { tr("Highway type"), tr("Speed (Km/h)") }, 0) { private static final long serialVersionUID = 4253339034781567453L; @Override public boolean isCellEditable(int row, int column) { return column != 0; } }; final JTable list = new JTable(model); loadSpeeds(model); JScrollPane scroll = new JScrollPane(list); p.add(scroll, GBC.eol().fill(GBC.BOTH)); scroll.setPreferredSize(new Dimension(200, 200)); JButton add = new JButton(tr("Add")); p.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); p.add(add, GBC.std().insets(0, 5, 0, 0)); add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JPanel p = new JPanel(new GridBagLayout()); p.add(new JLabel(tr("Weight")), GBC.std().insets(0, 0, 5, 0)); JComboBox key = new JComboBox<>(); for (OsmWayTypes pk : OsmWayTypes.values()) key.addItem(pk.getTag()); JTextField value = new JTextField(10); p.add(key, GBC.eop().insets(5, 0, 0, 0).fill(GBC.HORIZONTAL)); p.add(new JLabel(tr("Value")), GBC.std().insets(0, 0, 5, 0)); p.add(value, GBC.eol().insets(5, 0, 0, 0).fill(GBC.HORIZONTAL)); int answer = JOptionPane.showConfirmDialog(gui, p, tr("Enter weight values"), JOptionPane.OK_CANCEL_OPTION); if (answer == JOptionPane.OK_OPTION) { model .addRow(new String[] { key.getSelectedItem().toString(), value.getText() }); } } }); JButton delete = new JButton(tr("Delete")); p.add(delete, GBC.std().insets(0, 5, 0, 0)); delete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (list.getSelectedRow() == -1) JOptionPane.showMessageDialog(gui, tr("Please select the row to delete.")); else { Integer i; while ((i = list.getSelectedRow()) != -1) model.removeRow(i); } } }); JButton edit = new JButton(tr("Edit")); p.add(edit, GBC.std().insets(5, 5, 5, 0)); edit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { edit(gui, list); } }); JTabbedPane Opciones = new JTabbedPane(); Opciones.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); Opciones.addTab("Profile", null, p, null); // Opciones.addTab("Preferences", new JPanel()); list.addMouseListener(new MouseAdapter(){ @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) edit(gui, list); } }); principal.add(Opciones, GBC.eol().fill(GBC.BOTH)); } public boolean ok() { for (int i = 0; i < model.getRowCount(); ++i) { String value = model.getValueAt(i, 1).toString(); if (value.length() != 0) { String key = model.getValueAt(i, 0).toString(); String origValue = orig.get(key); if (origValue == null || !origValue.equals(value)) Main.pref.put(key, value); orig.remove(key); // processed. } } for (Entry e : orig.entrySet()) Main.pref.put(e.getKey(), null); return false; } private void edit(final PreferenceTabbedPane gui, final JTable list) { if (list.getSelectedRowCount() != 1) { JOptionPane.showMessageDialog(gui, tr("Please select the row to edit.")); return; } String v = JOptionPane.showInputDialog(tr("New value for {0}", model .getValueAt(list.getSelectedRow(), 0)), model.getValueAt(list .getSelectedRow(), 1)); if (v != null) model.setValueAt(v, list.getSelectedRow(), 1); } private void loadSpeeds(DefaultTableModel model) { // Read dialog values from preferences readPreferences(); // Put these values in the model for (String tag : orig.keySet()) { model.addRow(new String[] { tag, orig.get(tag) }); } } private void readPreferences() { orig = Main.pref.getAllPrefix("routing.profile.default.speed"); if (orig.size() == 0) { // defaults logger.debug("Loading Default Preferences."); for (OsmWayTypes owt : OsmWayTypes.values()) { Main.pref.putInteger("routing.profile.default.speed." + owt.getTag(), owt.getSpeed()); } orig = Main.pref.getAllPrefix("routing.profile.default.speed"); } else logger.debug("Default preferences already exist."); } /* private String getKeyTag(String tag) { return tag.split(".", 5)[4]; } private String getTypeTag(String tag) { return tag.split(".", 5)[3]; } private String getNameTag(String tag) { return tag.split(".", 5)[2]; } */ } josm-plugins-0.0.svn31964/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java0000644000175000017500000002770712420553250027437 0ustar basbas/* * Copyright (C) 2008 Innovant * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. * * For more information, please contact: * * Innovant * juangui@gmail.com * vidalfree@gmail.com * * http://public.grupoinnovant.com/blog * */ package com.innovant.josm.plugin.routing; import static org.openstreetmap.josm.tools.I18n.marktr; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.RenderingHints; import java.awt.Stroke; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; import javax.swing.Action; import javax.swing.Icon; import org.apache.log4j.Logger; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.actions.RenameLayerAction; import org.openstreetmap.josm.data.Bounds; import org.openstreetmap.josm.data.osm.Node; import org.openstreetmap.josm.data.osm.Way; import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; import org.openstreetmap.josm.gui.MapView; import org.openstreetmap.josm.gui.NavigatableComponent; import org.openstreetmap.josm.gui.dialogs.LayerListDialog; import org.openstreetmap.josm.gui.dialogs.LayerListPopup; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.gui.layer.OsmDataLayer; import org.openstreetmap.josm.tools.ColorHelper; import org.openstreetmap.josm.tools.ImageProvider; import com.innovant.josm.jrt.osm.OsmEdge; /** * A JOSM layer that encapsulates the representation of the shortest path. * @author juangui * @author Jose Vidal */ public class RoutingLayer extends Layer { public enum PreferencesKeys { KEY_ACTIVE_ROUTE_COLOR (marktr("routing active route")), KEY_INACTIVE_ROUTE_COLOR (marktr("routing inactive route")), KEY_ROUTE_WIDTH ("routing.route.width"), KEY_ROUTE_SELECT ("routing.route.select"); public final String key; PreferencesKeys (String key) { this.key=key; } public String getKey() {return key;}; } /** * Logger */ static Logger logger = Logger.getLogger(RoutingLayer.class); /** * Constant */ private static final double ARROW_PHI = Math.toRadians(20); /** * Routing Model */ private RoutingModel routingModel; /** * Start, Middle and End icons */ private Icon startIcon,middleIcon,endIcon; /** * Associated OSM layer */ private OsmDataLayer dataLayer; /** * Default constructor * @param name Layer name. */ public RoutingLayer(String name, OsmDataLayer dataLayer) { super(name); logger.debug("Creating Routing Layer..."); if(startIcon == null) startIcon = ImageProvider.get("routing", "startflag"); if(middleIcon == null) middleIcon = ImageProvider.get("routing", "middleflag"); if(endIcon == null) endIcon = ImageProvider.get("routing", "endflag"); this.dataLayer = dataLayer; this.routingModel = new RoutingModel(dataLayer.data); logger.debug("Routing Layer created."); this.routingModel.routingGraph.createGraph(); /* construct the graph right after we we create the layer */ Main.map.repaint(); /* update MapView */ } /** * Getter Routing Model. * @return the routingModel */ public RoutingModel getRoutingModel() { return this.routingModel; } /** * Gets associated data layer * @return OsmDataLayer associated to the RoutingLayer */ public OsmDataLayer getDataLayer() { return dataLayer; } /** * Gets nearest node belonging to a highway tagged way * @param p Point on the screen * @return The nearest highway node, in the range of the snap distance */ public final Node getNearestHighwayNode(Point p) { Node nearest = null; int snapDistance = NavigatableComponent.PROP_SNAP_DISTANCE.get(); double minDist = 0; for (Way w : dataLayer.data.getWays()) { if (w.isDeleted() || w.isIncomplete() || w.get("highway")==null) continue; for (Node n : w.getNodes()) { if (n.isDeleted() || n.isIncomplete()) continue; Point P = Main.map.mapView.getPoint(n); double dist = p.distance(P); if (dist < snapDistance) { if ((nearest == null) || (dist < minDist)) { nearest = n; minDist = dist; } } } } return nearest; } @Override public Icon getIcon() { Icon icon = ImageProvider.get("layer", "routing_small"); return icon; } @Override public Object getInfoComponent() { String info = "" + "" +"Graph Vertex: "+this.routingModel.routingGraph.getVertexCount()+"
" +"Graph Edges: "+this.routingModel.routingGraph.getEdgeCount()+"
" + "" + ""; return info; } @Override public Action[] getMenuEntries() { Collection components = new ArrayList<>(); components.add(LayerListDialog.getInstance().createShowHideLayerAction()); // components.add(new JMenuItem(new LayerListDialog.ShowHideMarkerText(this))); components.add(LayerListDialog.getInstance().createDeleteLayerAction()); components.add(SeparatorLayerAction.INSTANCE); components.add(new RenameLayerAction(getAssociatedFile(), this)); components.add(SeparatorLayerAction.INSTANCE); components.add(new LayerListPopup.InfoAction(this)); return components.toArray(new Action[0]); } @Override public String getToolTipText() { String tooltip = this.routingModel.routingGraph.getVertexCount() + " vertices, " + this.routingModel.routingGraph.getEdgeCount() + " edges"; return tooltip; } @Override public boolean isMergable(Layer other) { return false; } @Override public void mergeFrom(Layer from) { // This layer is not mergable, so do nothing } @Override public void paint(Graphics2D g, MapView mv, Bounds bounds) { boolean isActiveLayer = (mv.getActiveLayer().equals(this)); // Get routing nodes (start, middle, end) List nodes = routingModel.getSelectedNodes(); // Get path stroke color from preferences // Color is different for active and inactive layers Color color; if (isActiveLayer) { color = Main.pref.getColor(PreferencesKeys.KEY_ACTIVE_ROUTE_COLOR.key, Color.RED); } else { color = Main.pref.getColor(PreferencesKeys.KEY_INACTIVE_ROUTE_COLOR.key, Color.decode("#dd2222")); } // Get path stroke width from preferences String widthString = Main.pref.get(PreferencesKeys.KEY_ROUTE_WIDTH.key); if (widthString.length() == 0) { widthString = "2"; /* I think 2 is better */ // FIXME add after good width is found: Main.pref.put(KEY_ROUTE_WIDTH, widthString); } int width = Integer.parseInt(widthString); // draw our graph if (isActiveLayer) { if(routingModel != null) { if(routingModel.routingGraph != null && routingModel.routingGraph.getGraph() != null) { Set graphEdges = routingModel.routingGraph.getGraph().edgeSet(); if (!graphEdges.isEmpty()) { Color color2 = ColorHelper.html2color("#00ff00"); /* just green for now */ OsmEdge firstedge = (OsmEdge) graphEdges.toArray()[0]; Point from = mv.getPoint(firstedge.fromEastNorth()); g.drawRect(from.x-4, from.y+4, from.x+4, from.y-4); for(OsmEdge edge : graphEdges) { drawGraph(g, mv, edge, color2, width); } } } } } if(nodes == null || nodes.size() == 0) return; // Paint routing path List routeEdges = routingModel.getRouteEdges(); if(routeEdges != null) { for(OsmEdge edge : routeEdges) { drawEdge(g, mv, edge, color, width, true); } } // paint start icon Node node = nodes.get(0); Point screen = mv.getPoint(node); startIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2, screen.y - startIcon.getIconHeight()); // paint middle icons for(int index = 1; index < nodes.size() - 1; ++index) { node = nodes.get(index); screen = mv.getPoint(node); middleIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2, screen.y - middleIcon.getIconHeight()); } // paint end icon if(nodes.size() > 1) { node = nodes.get(nodes.size() - 1); screen = mv.getPoint(node); endIcon.paintIcon(mv, g, screen.x - startIcon.getIconWidth()/2, screen.y - endIcon.getIconHeight()); } } @Override public void visitBoundingBox(BoundingXYVisitor v) { for (Node node : routingModel.getSelectedNodes()) { v.visit(node); } } @Override public void destroy() { routingModel.reset(); // layerAdded = false; } /** * Draw a line with the given color. */ private void drawEdge(Graphics g, MapView mv, OsmEdge edge, Color col, int width, boolean showDirection) { g.setColor(col); Point from; Point to; from = mv.getPoint(edge.fromEastNorth()); to = mv.getPoint(edge.toEastNorth()); Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Anti-alias! Stroke oldStroke = g2d.getStroke(); g2d.setStroke(new BasicStroke(width)); // thickness g2d.drawLine(from.x, from.y, to.x, to.y); if (showDirection) { double t = Math.atan2(to.y-from.y, to.x-from.x) + Math.PI; g.drawLine(to.x,to.y, (int)(to.x + 10*Math.cos(t-ARROW_PHI)), (int)(to.y + 10*Math.sin(t-ARROW_PHI))); g.drawLine(to.x,to.y, (int)(to.x + 10*Math.cos(t+ARROW_PHI)), (int)(to.y + 10*Math.sin(t+ARROW_PHI))); } g2d.setStroke(oldStroke); } private void drawGraph(Graphics g, MapView mv, OsmEdge edge, Color col, int width) { g.setColor(col); Point from; Point to; from = mv.getPoint(edge.fromEastNorth()); to = mv.getPoint(edge.toEastNorth()); Graphics2D g2d = (Graphics2D)g; Stroke oldStroke = g2d.getStroke(); g2d.setStroke(new BasicStroke(width)); // thickness g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); // Anti-alias! g2d.drawLine(from.x, from.y, to.x, to.y); g2d.drawRect(to.x- 4, to.y+4, 4, 4); g2d.setStroke(oldStroke); } } josm-plugins-0.0.svn31964/DirectUpload/0000755000175000017500000000000012643536103015672 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/test/0000755000175000017500000000000012643536103016651 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/resources/0000755000175000017500000000000012643536103017704 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/build.xml0000644000175000017500000000260712642735214017523 0ustar basbas josm-plugins-0.0.svn31964/DirectUpload/images/0000755000175000017500000000000012643536103017137 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/images/UploadAction.png0000644000175000017500000000340112413601475022225 0ustar basbasPNG  IHDRVbKGDIDATHǝyTWIX$hi,ک#0nL Tl BNuAP@DJ!A @J@%HX $H9:)S{y +"\؉oVRϛR:F,&P*\߾]*CUKtj&/uJ~tbɬXzEqS߶% $!٘FAJD,&chp'DhBCe/nlKs}''7ߝoIЗ;C; gbk)"A{^|\q*BYUryUܷeVXBο(^ 5Ci|GEhejYYBי{b+H;x}V<P] fMk|K7!kM9F8& ~اDyzy.7W/&~0IR/8_^ ҈iZD Rcގn'-.__؅B Úg*aBhLV!0yh(HZ=& >"vVԿҡKmhH!IGĻX%4m%JhׂQ71d>6O<ڶ2 E* !m\+sjTQ&lSQx31Zxoe"S!`]0kuǘ;BXvjǍǓrGO&mg.ң@> ROihHЊ=Q ]Wcl'_:EE"=ǯR -Z7ݖ[e6 \,;;{[iӁ=ٜWG Ug-Mهlbo#|%#PLح!M(juSl8 |s'66xlj&׷֪V2P1U%| { ZE"lW70@ MkBP9|8S_~|< &93. ;SaF{u-6ڋ &?p_~.t j0 IKkA M -^K h'pņ8B%NZ.pa@6jRݑXGj@BX8QyA6[:Ո‡6WaYwFFuZM8F0ĺ[j_.7j,HXfg(gF0'P'I¿v\ +G}#&-.r&(_{go%Aa%dN,*BէIDuDH >'Aq52^]8اIܡ۷vʹ7Hi$C|z,VPrrD]M lSu=1/KUФ!C!_̃G]O4cPd>Y^J"qVR GGK4)[_Su$eOkʶIm*H+Ѓn$d 鄄 .vmw?&r겶GoܥaBķu~{~IENDB`josm-plugins-0.0.svn31964/DirectUpload/images/uploadtrace.png0000644000175000017500000000040311331365563022150 0ustar basbasPNG  IHDRY -PLTE<<===ҁˁEEFF҂HHHA6=tRNS@fbKGDH pHYs  tIME :CX OIDATc` 6 9#qZ< ....p)B7 `D l&A0PsTCA QKād0fpmkIENDB`josm-plugins-0.0.svn31964/DirectUpload/.project0000644000175000017500000000057011230645255017343 0ustar basbas JOSM-DirectUpload org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature josm-plugins-0.0.svn31964/DirectUpload/.settings/0000755000175000017500000000000012643536103017610 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000001514712420547421024600 0ustar basbaseclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 josm-plugins-0.0.svn31964/DirectUpload/data/0000755000175000017500000000000012643536103016603 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/.classpath0000644000175000017500000000056412326615515017665 0ustar basbas josm-plugins-0.0.svn31964/DirectUpload/README0000644000175000017500000000030211360310264016536 0ustar basbasDirectly uploads GPX from active layer in JOSM to OpenStreetMap Server. More Details and FAQ's at : http://wiki.openstreetmap.org/index.php/User:Subhodip/GSoC_Doc#DirectUpload_Plugin_in_JOSM_: josm-plugins-0.0.svn31964/DirectUpload/LICENSE0000644000175000017500000004316611127201641016701 0ustar basbas GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. josm-plugins-0.0.svn31964/DirectUpload/src/0000755000175000017500000000000012643536103016461 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/src/org/0000755000175000017500000000000012643536103017250 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/0000755000175000017500000000000012643536103022136 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/0000755000175000017500000000000012643536103023106 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/plugins/0000755000175000017500000000000012643536103024567 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/0000755000175000017500000000000012643536103027146 5ustar basbas././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootjosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.javajosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui0000644000175000017500000000366312205672607031570 0ustar basbas/* * Copyright by Subhodip Biswas * This program is free software and licensed under GPL. * */ package org.openstreetmap.josm.plugins.DirectUpload; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.actions.JosmAction; import org.openstreetmap.josm.gui.MainMenu; import org.openstreetmap.josm.plugins.Plugin; import org.openstreetmap.josm.plugins.PluginInformation; import org.openstreetmap.josm.tools.Shortcut; /** * * @author subhodip, ax */ public class UploadDataGuiPlugin extends Plugin { UploadAction openaction; public UploadDataGuiPlugin(PluginInformation info) { super(info); openaction = new UploadAction(); MainMenu.add(Main.main.menu.gpsMenu, openaction); } class UploadAction extends JosmAction { public UploadAction(){ super(tr("Upload Traces"), "UploadAction", tr("Uploads traces to openstreetmap.org"), Shortcut.registerShortcut("tools:uploadtraces", tr("Tool: {0}", tr("Upload Traces")), KeyEvent.VK_G, Shortcut.CTRL), false); } public void actionPerformed(ActionEvent e) { UploadDataGui go = new UploadDataGui(); go.setVisible(true); } // because LayerListDialog doesn't provide a way to hook into "layer selection changed" // but the layer selection (*not* activation) is how we determine the layer to be uploaded // we have to let the upload trace menu always be enabled // @Override // protected void updateEnabledState() { // // enable button if ... @see autoSelectTrace() // if (UploadOsmConnection.getInstance().autoSelectTrace() == null) { // setEnabled(false); // } else { // setEnabled(true); // } // } } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootjosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.javajosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui0000644000175000017500000004720412642735214031566 0ustar basbas/* * UploadDataGui.java * * Created on August 17, 2008, 6:56 PM * Copyright by Subhodip Biswas * This program is free software and licensed under GPL. */ package org.openstreetmap.josm.plugins.DirectUpload; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.URL; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Collections; import java.util.Date; import java.util.LinkedList; import java.util.List; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.data.gpx.GpxConstants; import org.openstreetmap.josm.data.gpx.GpxData; import org.openstreetmap.josm.data.gpx.GpxTrack; import org.openstreetmap.josm.gui.ExtendedDialog; import org.openstreetmap.josm.gui.PleaseWaitRunnable; import org.openstreetmap.josm.gui.progress.ProgressMonitor; import org.openstreetmap.josm.gui.util.GuiHelper; import org.openstreetmap.josm.gui.widgets.HistoryComboBox; import org.openstreetmap.josm.gui.widgets.JMultilineLabel; import org.openstreetmap.josm.gui.widgets.UrlLabel; import org.openstreetmap.josm.io.GpxWriter; import org.openstreetmap.josm.io.OsmApi; import org.openstreetmap.josm.tools.GBC; import org.openstreetmap.josm.tools.HttpClient; import org.openstreetmap.josm.tools.HttpClient.Response; /** * * @author subhodip, xeen, ax */ public class UploadDataGui extends ExtendedDialog { /** * This enum contains the possible values for the visibility field and their * explanation. Provides some methods for easier handling. */ private enum visibility { PRIVATE (tr("Private (only shared as anonymous, unordered points)")), PUBLIC (tr("Public (shown in trace list and as anonymous, unordered points)")), TRACKABLE (tr("Trackable (only shared as anonymous, ordered points with timestamps)")), IDENTIFIABLE (tr("Identifiable (shown in trace list and as identifiable, ordered points with timestamps)")); public final String description; visibility(String description) { this.description = description; } /** * "Converts" a given description into the actual enum. Returns null if no matching description * is found. * @param desc The description to look for * @return visibility or null */ public static visibility desc2visi(Object desc) { for (visibility v : visibility.values()) { if(desc.equals(v.description)) return v; } return null; } @Override public String toString() { return this.name().toLowerCase(); } } // Fields are declared here for easy access // Do not remove the space in JMultilineLabel. Otherwise the label will be empty // as we don't know its contents yet and therefore have a height of 0. This will // lead to unnecessary scrollbars. private JMultilineLabel outputDisplay = new JMultilineLabel(" "); private HistoryComboBox descriptionField; private HistoryComboBox tagsField; private JComboBox visibilityCombo; // Constants used when generating upload request private static final String BOUNDARY = "----------------------------d10f7aa230e8"; private static final String LINE_END = "\r\n"; private static final String uploadTraceText = tr("Upload Trace"); private boolean canceled = false; public UploadDataGui() { // Initalizes ExtendedDialog super(Main.parent, tr("Upload Traces"), new String[] {uploadTraceText, tr("Cancel")}, true ); JPanel content = initComponents(); GpxData gpxData = UploadOsmConnection.getInstance().autoSelectTrace(); initTitleAndDescriptionFromGpxData(gpxData); // this is changing some dialog elements, so it (probably) must be before the following setContent(content); setButtonIcons(new String[] { "uploadtrace.png", "cancel.png" }); setupDialog(); buttons.get(0).setEnabled(gpxData != null); } /** * Sets up the dialog window elements * @return JPanel with components */ private JPanel initComponents() { // visibilty JLabel visibilityLabel = new JLabel(tr("Visibility")); visibilityLabel.setToolTipText(tr("Defines the visibility of your trace for other OSM users.")); visibilityCombo = new JComboBox<>(); visibilityCombo.setEditable(false); for(visibility v : visibility.values()) { visibilityCombo.addItem(v.description); } visibilityCombo.setSelectedItem(visibility.valueOf(Main.pref.get("directupload.visibility.last-used", visibility.PRIVATE.name())).description); UrlLabel visiUrl = new UrlLabel(tr("http://wiki.openstreetmap.org/wiki/Visibility_of_GPS_traces"), tr("(What does that mean?)"), 2); // description JLabel descriptionLabel = new JLabel(tr("Description")); descriptionField = new HistoryComboBox(); descriptionField.setToolTipText(tr("Please enter Description about your trace.")); List descHistory = new LinkedList<>(Main.pref.getCollection("directupload.description.history", new LinkedList())); // we have to reverse the history, because ComboBoxHistory will reverse it again in addElement() // XXX this should be handled in HistoryComboBox Collections.reverse(descHistory); descriptionField.setPossibleItems(descHistory); // tags JLabel tagsLabel = new JLabel(tr("Tags (comma delimited)")); tagsField = new HistoryComboBox(); tagsField.setToolTipText(tr("Please enter tags about your trace.")); List tagsHistory = new LinkedList<>(Main.pref.getCollection("directupload.tags.history", new LinkedList())); // we have to reverse the history, because ComboBoxHistory will reverse it againin addElement() // XXX this should be handled in HistoryComboBox Collections.reverse(tagsHistory); tagsField.setPossibleItems(tagsHistory); JPanel p = new JPanel(new GridBagLayout()); outputDisplay.setMaxWidth(findMaxDialogSize().width-10); p.add(outputDisplay, GBC.eol()); p.add(tagsLabel, GBC.eol().insets(0,10,0,0)); p.add(tagsField, GBC.eol().fill(GBC.HORIZONTAL)); p.add(descriptionLabel, GBC.eol().insets(0,10,0,0)); p.add(descriptionField, GBC.eol().fill(GBC.HORIZONTAL)); p.add(visibilityLabel, GBC.std().insets(0,10,0,0)); p.add(visiUrl, GBC.eol().insets(5,10,0,0)); p.add(visibilityCombo, GBC.eol()); return p; } private void initTitleAndDescriptionFromGpxData(GpxData gpxData) { String description = "", title = "", tags = ""; if (gpxData != null) { GpxTrack firstTrack = gpxData.tracks.iterator().next(); Object meta_desc = gpxData.attr.get(GpxConstants.META_DESC); if (meta_desc != null) { description = meta_desc.toString(); } else if (firstTrack != null && gpxData.tracks.size() == 1 && firstTrack.get("desc") != null) { description = firstTrack.getString("desc"); } else if (gpxData.storageFile != null) { description = gpxData.storageFile.getName().replaceAll("[&?/\\\\]"," ").replaceAll("(\\.[^.]*)$",""); } if (gpxData.storageFile != null) { title = tr("Selected track: {0}", gpxData.storageFile.getName()); } Object meta_tags = gpxData.attr.get(GpxConstants.META_KEYWORDS); if (meta_tags != null) { tags = meta_tags.toString(); } } else { description = new SimpleDateFormat("yyMMddHHmmss").format(new Date()); title = tr("No GPX layer selected. Cannot upload a trace."); } outputDisplay.setText(title); descriptionField.setText(description); tagsField.setText(tags); } /** * This is the actual workhorse that manages the upload. * @param String Description of the GPX track being uploaded * @param String Tags associated with the GPX track being uploaded * @param boolean Shall the GPX track be public * @param GpxData The GPX Data to upload */ private void upload(String description, String tags, String visi, GpxData gpxData, ProgressMonitor progressMonitor) throws IOException { progressMonitor.beginTask(tr("Uploading trace ...")); try { if (checkForErrors(description, gpxData)) { return; } // Clean description/tags from disallowed chars description = description.replaceAll("[&?/\\\\]", " "); tags = tags.replaceAll("[&?/\\\\.;]", " "); // Generate data for upload ByteArrayOutputStream baos = new ByteArrayOutputStream(); writeGpxFile(baos, "file", gpxData); writeField(baos, "description", description); writeField(baos, "tags", (tags != null && tags.length() > 0) ? tags : ""); writeField(baos, "visibility", visi); writeString(baos, "--" + BOUNDARY + "--" + LINE_END); HttpClient conn = setupConnection(baos.size()); // FIXME previous method allowed to see real % progress (each 10 Kb of data) //flushToServer(bais, conn.getOutputStream(), progressMonitor); Response response = conn.setRequestBody(baos.toByteArray()).connect(progressMonitor.createSubTaskMonitor(1, false)); if (canceled) { response.disconnect(); GuiHelper.runInEDT(new Runnable() { @Override public void run() { outputDisplay.setText(tr("Upload canceled")); buttons.get(0).setEnabled(true); } }); canceled = false; } else { final boolean success = finishUpConnection(response); GuiHelper.runInEDT(new Runnable() { @Override public void run() { buttons.get(0).setEnabled(!success); if (success) { buttons.get(1).setText(tr("Close")); } } }); } } catch (Exception e) { GuiHelper.runInEDT(new Runnable() { @Override public void run() { outputDisplay.setText(tr("Error while uploading")); } }); e.printStackTrace(); } finally { progressMonitor.finishTask(); } } /** * This function sets up the upload URL and logs in using the username and password given * in the preferences. * @param int The length of the content to be sent to the server * @return HttpURLConnection The set up conenction */ private HttpClient setupConnection(int contentLength) throws Exception { // Upload URL URL url = new URL(OsmApi.getOsmApi().getBaseUrl() + "gpx/create"); // Set up connection and log in HttpClient c = HttpClient.create(url, "POST").setConnectTimeout(15000); // unfortunately, addAuth() is protected, so we need to subclass OsmConnection // XXX make addAuth public. UploadOsmConnection.getInstance().addAuthHack(c); c.setHeader("Content-Type", "multipart/form-data; boundary=" + BOUNDARY); c.setHeader("Connection", "close"); // counterpart of keep-alive c.setHeader("Expect", ""); return c; } /** * This function checks if the given connection finished up fine, closes it and returns the result. * It also posts the result (or errors) to OutputDisplay. * @param HttpURLConnection The connection to check/finish up */ private boolean finishUpConnection(Response c) throws Exception { String returnMsg = c.getResponseMessage(); final boolean success = returnMsg.equals("OK"); if (c.getResponseCode() != 200) { if (c.getHeaderField("Error") != null) returnMsg += "\n" + c.getHeaderField("Error"); } final String returnMsgEDT = returnMsg; GuiHelper.runInEDT(new Runnable() { @Override public void run() { outputDisplay.setText(success ? tr("GPX upload was successful") : tr("Upload failed. Server returned the following message: ") + returnMsgEDT); } }); c.disconnect(); return success; } /** * Uploads a given InputStream to a given OutputStream and sets progress * @param InputSteam * @param OutputStream */ /* private void flushToServer(InputStream in, OutputStream out, ProgressMonitor progressMonitor) throws Exception { // Upload in 10 kB chunks byte[] buffer = new byte[10000]; int nread; int cur = 0; synchronized (in) { while ((nread = in.read(buffer, 0, buffer.length)) >= 0) { out.write(buffer, 0, nread); cur += nread; out.flush(); progressMonitor.worked(nread); progressMonitor.subTask(getProgressText(cur, progressMonitor)); if(canceled) break; } } if(!canceled) out.flush(); progressMonitor.subTask("Waiting for server reply..."); buffer = null; } */ /** * Generates the output string displayed in the PleaseWaitDialog. * @param int Bytes already uploaded * @return String Message */ private String getProgressText(int cur, ProgressMonitor progressMonitor) { int max = progressMonitor.getTicksCount(); int percent = Math.round(cur * 100 / max); // FIXME method kept because of translated string return tr("Uploading GPX track: {0}% ({1} of {2})", percent, formatBytes(cur), formatBytes(max)); } /** * Nicely calculates given bytes into MB, kB and B (with units) * @param int Bytes * @return String */ private String formatBytes(int bytes) { return (bytes > 1000 * 1000 // Rounds to 2 decimal places ? new DecimalFormat("0.00") .format((double)Math.round(bytes/(1000*10))/100) + " MB" : (bytes > 1000 ? Math.round(bytes/1000) + " kB" : bytes + " B")); } /** * Checks for common errors and displays them in OutputDisplay if it finds any. * Returns whether errors have been found or not. * @param String GPX track description * @param GpxData the GPX data to upload * @return boolean true if errors have been found */ private boolean checkForErrors(String description, GpxData gpxData) { String errors=""; if(description == null || description.length() == 0) errors += tr("No description provided. Please provide some description."); if(gpxData == null) errors += tr("No GPX layer selected. Cannot upload a trace."); final String errorsEDT = errors; GuiHelper.runInEDT(new Runnable() { @Override public void run() { outputDisplay.setText(errorsEDT); } }); return errors.length() > 0; } /** * This creates the uploadTask that does the actual work and hands it to the main.worker to be executed. */ private void setupUpload() { final GpxData gpxData = UploadOsmConnection.getInstance().autoSelectTrace(); if (gpxData == null) { return; } // Disable Upload button so users can't just upload that track again buttons.get(0).setEnabled(false); // save history Main.pref.put("directupload.visibility.last-used", visibility.desc2visi(visibilityCombo.getSelectedItem().toString()).name()); descriptionField.addCurrentItemToHistory(); Main.pref.putCollection("directupload.description.history", descriptionField.getHistory()); tagsField.addCurrentItemToHistory(); Main.pref.putCollection("directupload.tags.history", tagsField.getHistory()); PleaseWaitRunnable uploadTask = new PleaseWaitRunnable(tr("Uploading GPX Track")){ @Override protected void realRun() throws IOException { upload(descriptionField.getText(), tagsField.getText(), visibility.desc2visi(visibilityCombo.getSelectedItem()).toString(), gpxData, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false) ); } @Override protected void finish() {} @Override protected void cancel() { canceled = true; } }; Main.worker.execute(uploadTask); } /** * Writes textfields (like in webbrowser) to the given ByteArrayOutputStream * @param ByteArrayOutputStream * @param String The name of the "textbox" * @param String The value to write */ private void writeField(ByteArrayOutputStream baos, String name, String value) throws IOException { writeBoundary(baos); writeString(baos, "Content-Disposition: form-data; name=\"" + name + "\""); writeLineEnd(baos); writeLineEnd(baos); baos.write(value.getBytes("UTF-8")); writeLineEnd(baos); } /** * Writes gpxData (= file field in webbrowser) to the given ByteArrayOutputStream * @param ByteArrayOutputStream * @param String The name of the "upload field" * @param GpxData The GPX data to upload */ private void writeGpxFile(ByteArrayOutputStream baos, String name, GpxData gpxData) throws IOException { String filename; writeBoundary(baos); writeString(baos, "Content-Disposition: form-data; name=\"" + name + "\"; "); if (gpxData.storageFile != null) filename = gpxData.storageFile.getName(); else filename = "not saved"; writeString(baos, "filename=\"" + filename + "\""); writeLineEnd(baos); writeString(baos, "Content-Type: application/octet-stream"); writeLineEnd(baos); writeLineEnd(baos); new GpxWriter(baos).write(gpxData); writeLineEnd(baos); } /** * Writes a String to the given ByteArrayOutputStream * @param ByteArrayOutputStream * @param String */ private void writeString(ByteArrayOutputStream baos, String s) { try { baos.write(s.getBytes()); } catch(Exception e) {} } /** * Writes a newline to the given ByteArrayOutputStream * @param ByteArrayOutputStream */ private void writeLineEnd(ByteArrayOutputStream baos) { writeString(baos, LINE_END); } /** * Writes a boundary line to the given ByteArrayOutputStream * @param ByteArrayOutputStream */ private void writeBoundary(ByteArrayOutputStream baos) { writeString(baos, "--" + BOUNDARY); writeLineEnd(baos); } /** * Overrides the default actions. Will not close the window when upload trace is clicked */ @Override protected void buttonAction(int buttonIndex, ActionEvent evt) { String a = evt.getActionCommand(); if(uploadTraceText.equals(a)) setupUpload(); else setVisible(false); } } ././@LongLink0000644000000000000000000000016000000000000011600 Lustar rootrootjosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadOsmConnection.javajosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadOsmConn0000644000175000017500000000572212640000706031610 0ustar basbas// ... package org.openstreetmap.josm.plugins.DirectUpload; import java.util.List; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.data.gpx.GpxData; import org.openstreetmap.josm.gui.MapView; import org.openstreetmap.josm.gui.dialogs.LayerListDialog; import org.openstreetmap.josm.gui.layer.GpxLayer; import org.openstreetmap.josm.gui.layer.Layer; import org.openstreetmap.josm.io.OsmConnection; import org.openstreetmap.josm.io.OsmTransferException; import org.openstreetmap.josm.tools.HttpClient; /** * Work-around and utility class for DirectUpload. * * @author ax */ public class UploadOsmConnection extends OsmConnection { // singleton, see https://en.wikipedia.org/wiki/Singleton_pattern#Traditional_simple_way private static final UploadOsmConnection INSTANCE = new UploadOsmConnection(); // Private constructor prevents instantiation from other classes private UploadOsmConnection() { } public static UploadOsmConnection getInstance() { return UploadOsmConnection.INSTANCE; } // make protected OsmConnection::addAuth() available to others public void addAuthHack(HttpClient connection) throws OsmTransferException { addAuth(connection); } /** * find which gpx layer holds the trace to upload. layers are tried in this order: * * 1. selected (*not* active - think "zoom to layer"), from first to last * 2. not selectd - if there is only one * 3. active * * @return data of the selected gpx layer, or null if there is none */ GpxData autoSelectTrace() { if (Main.map != null && Main.map.mapView != null) { MapView mv = Main.map.mapView; // List allLayers = new ArrayList(mv.getAllLayersAsList()); // modifiable List selectedLayers = LayerListDialog.getInstance().getModel().getSelectedLayers(); List gpxLayersRemaining = mv.getLayersOfType(GpxLayer.class); gpxLayersRemaining.removeAll(selectedLayers); GpxLayer traceLayer = null; // find the first gpx layer inside selected layers for (Layer l : LayerListDialog.getInstance().getModel().getSelectedLayers()) { if (l instanceof GpxLayer) { traceLayer = (GpxLayer) l; break; } } if (traceLayer == null) { // if there is none, try the none selected gpx layers. if there is only one, use it. if (gpxLayersRemaining.size() == 1) { traceLayer = gpxLayersRemaining.get(0); } // active layer else if (mv.getActiveLayer() instanceof GpxLayer) { traceLayer = (GpxLayer) mv.getActiveLayer(); } } if (traceLayer != null) { GpxData data = traceLayer.data; return data; } } return null; } } ././@LongLink0000644000000000000000000000015200000000000011601 Lustar rootrootjosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.formjosm-plugins-0.0.svn31964/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui0000644000175000017500000002077311110156516031557 0ustar basbas
josm-plugins-0.0.svn31964/DirectUpload/nbproject/0000755000175000017500000000000012643536103017660 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/nbproject/genfiles.properties0000644000175000017500000000067711110156516023576 0ustar basbasbuild.xml.data.CRC32=700b934e build.xml.script.CRC32=eedbed8a build.xml.stylesheet.CRC32=be360661 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=700b934e nbproject/build-impl.xml.script.CRC32=d2fe92a8 nbproject/build-impl.xml.stylesheet.CRC32=487672f9 josm-plugins-0.0.svn31964/DirectUpload/nbproject/private/0000755000175000017500000000000012643536103021332 5ustar basbasjosm-plugins-0.0.svn31964/DirectUpload/nbproject/project.xml0000644000175000017500000000106611110156516022045 0ustar basbas org.netbeans.modules.java.j2seproject DirectUpload 1.6.5 josm-plugins-0.0.svn31964/DirectUpload/nbproject/build-impl.xml0000644000175000017500000007752312622466256022466 0ustar basbas Must set src.dir Must set test.src.dir Must set build.dir Must set dist.dir Must set build.classes.dir Must set dist.javadoc.dir Must set build.test.classes.dir Must set build.test.results.dir Must set build.classes.excludes Must set dist.jar Must set javac.includes Must select some files in the IDE or set javac.includes To run this application from the command line without Ant, try: java -cp "${run.classpath.with.dist.jar}" ${main.class} To run this application from the command line without Ant, try: java -jar "${dist.jar.resolved}" Must select one file in the IDE or set run.class Must select one file in the IDE or set debug.class Must set fix.includes Must select some files in the IDE or set javac.includes Some tests failed; see details above. Must select some files in the IDE or set test.includes Some tests failed; see details above. Must select one file in the IDE or set test.class Must select one file in the IDE or set applet.url Must select one file in the IDE or set applet.url josm-plugins-0.0.svn31964/DirectUpload/nbproject/project.properties0000644000175000017500000000357612174301462023454 0ustar basbasbuild.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: build.dir=build build.generated.dir=${build.dir}/generated build.generated.sources.dir=${build.dir}/generated-sources # Only compile against the classpath explicitly listed here: build.sysclasspath=ignore build.test.classes.dir=${build.dir}/test/classes build.test.results.dir=${build.dir}/test/results debug.classpath=\ ${run.classpath} debug.test.classpath=\ ${run.test.classpath} # This directory is removed when the project is cleaned: dist.dir=dist dist.jar=${dist.dir}/DirectUpload.jar dist.javadoc.dir=${dist.dir}/javadoc excludes= includes=** jar.compress=false javac.classpath= # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false javac.source=1.5 javac.target=1.5 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir}:\ ${libs.junit.classpath}:\ ${libs.junit_4.classpath} javadoc.additionalparam= javadoc.author=false javadoc.encoding=${source.encoding} javadoc.noindex=false javadoc.nonavbar=false javadoc.notree=false javadoc.private=false javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= main.class=org.openstreetmap.josm.plugins.DirectUpload.UploadDataGui manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF platform.active=default_platform run.classpath=\ ${javac.classpath}:\ ${build.classes.dir} # Space-separated list of JVM arguments used when running the project # (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value # or test-sys-prop.name=value to set system properties for unit tests): run.jvmargs= run.test.classpath=\ ${javac.test.classpath}:\ ${build.test.classes.dir} source.encoding=UTF-8 src.dir=src test.src.dir=test josm-plugins-0.0.svn31964/build-common.xml0000644000175000017500000005477212643273466016453 0ustar basbas ${current.time}]]> Building against core revision ${coreversion.info.entry.revision}. Plugin-Mainversion is set to ${plugin.main.version}. Commiting the plugin source with message '${commit.message}' ... Updating plugin source ... Updating ${plugin.jar} ... ***** Properties of published ${plugin.jar} ***** Commit message : '${commit.message}' Plugin-Mainversion: ${plugin.main.version} JOSM build version: ${coreversion.info.entry.revision} Plugin-Version : ${version.entry.commit.revision} ***** / Properties of published ${plugin.jar} ***** Now commiting ${plugin.jar} ... You can use following targets: * dist This default target builds the plugin jar file * clean Cleanup automatical created files * test Run unit tests (if any) * publish Checkin source code, build jar and checkin plugin jar (requires proper entry for SVN commit message!) * install Install the plugin in current system * runjosm Install plugin and start josm * profilejosm Install plugin and start josm in profiling mode There are other targets, which usually should not be called manually. josm-plugins-0.0.svn31964/colorscheme/0000755000175000017500000000000012643536103015616 5ustar basbasjosm-plugins-0.0.svn31964/colorscheme/resources/0000755000175000017500000000000012643536102017627 5ustar basbasjosm-plugins-0.0.svn31964/colorscheme/build.xml0000644000175000017500000000167612326615515017454 0ustar basbas josm-plugins-0.0.svn31964/colorscheme/images/0000755000175000017500000000000012643536102017062 5ustar basbasjosm-plugins-0.0.svn31964/colorscheme/.project0000644000175000017500000000056711273507120017270 0ustar basbas JOSM-colorscheme org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature josm-plugins-0.0.svn31964/colorscheme/.settings/0000755000175000017500000000000012643536103017534 5ustar basbasjosm-plugins-0.0.svn31964/colorscheme/.settings/org.eclipse.jdt.core.prefs0000644000175000017500000001515012420547421024516 0ustar basbaseclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 josm-plugins-0.0.svn31964/colorscheme/data/0000755000175000017500000000000012643536103016527 5ustar basbasjosm-plugins-0.0.svn31964/colorscheme/GPL-v3.0.txt0000644000175000017500000010451312116201065017460 0ustar basbas GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . josm-plugins-0.0.svn31964/colorscheme/.classpath0000644000175000017500000000056612326615515017613 0ustar basbas josm-plugins-0.0.svn31964/colorscheme/GPL-v2.0.txt0000644000175000017500000004310312116201065017454 0ustar basbas GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. josm-plugins-0.0.svn31964/colorscheme/LICENSE0000644000175000017500000000031212116201065016606 0ustar basbasPlugin colorscheme This plugin is copyrighted 2008-2009 by Christof Dallermassl . It is distributed under GPL-v3 or later license (see file gpl-3.0.txt in this directory). josm-plugins-0.0.svn31964/colorscheme/src/0000755000175000017500000000000012643536102016404 5ustar basbasjosm-plugins-0.0.svn31964/colorscheme/src/at/0000755000175000017500000000000012643536102017010 5ustar basbasjosm-plugins-0.0.svn31964/colorscheme/src/at/dallermassl/0000755000175000017500000000000012643536102021313 5ustar basbasjosm-plugins-0.0.svn31964/colorscheme/src/at/dallermassl/josm/0000755000175000017500000000000012643536102022263 5ustar basbasjosm-plugins-0.0.svn31964/colorscheme/src/at/dallermassl/josm/plugin/0000755000175000017500000000000012643536102023561 5ustar basbasjosm-plugins-0.0.svn31964/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/0000755000175000017500000000000012643536103026065 5ustar basbas././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootjosm-plugins-0.0.svn31964/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePreference.javajosm-plugins-0.0.svn31964/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePreferen0000644000175000017500000002057512420553250031706 0ustar basbas/** * Copyright by Christof Dallermassl * This program is free software and licensed under GPL. */ package at.dallermassl.josm.plugin.colorscheme; import static org.openstreetmap.josm.tools.I18n.tr; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import org.openstreetmap.josm.Main; import org.openstreetmap.josm.gui.preferences.PreferenceSetting; import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; import org.openstreetmap.josm.gui.preferences.display.ColorPreference; import org.openstreetmap.josm.tools.GBC; public class ColorSchemePreference implements SubPreferenceSetting { private static final String PREF_KEY_SCHEMES_PREFIX = "colorschemes."; private static final String PREF_KEY_SCHEMES_NAMES = PREF_KEY_SCHEMES_PREFIX + "names"; public static final String PREF_KEY_COLOR_PREFIX = "color."; private JList schemesList; private DefaultListModel listModel; private ListcolorKeys; private ColorPreference colorPreference; /** * Default Constructor */ public ColorSchemePreference() { } @Override public void addGui(final PreferenceTabbedPane gui) { JPanel panel = new JPanel(new GridBagLayout()); panel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); Map colorMap = Main.pref.getAllPrefix(PREF_KEY_COLOR_PREFIX); colorKeys = new ArrayList<>(colorMap.keySet()); Collections.sort(colorKeys); listModel = new DefaultListModel<>(); schemesList = new JList<>(listModel); String schemes = Main.pref.get(PREF_KEY_SCHEMES_NAMES); StringTokenizer st = new StringTokenizer(schemes, ";"); String schemeName; while (st.hasMoreTokens()) { schemeName = st.nextToken(); listModel.addElement(schemeName); } JButton useScheme = new JButton(tr("Use")); useScheme.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { if (schemesList.getSelectedIndex() == -1) JOptionPane.showMessageDialog(Main.parent, tr("Please select a scheme to use.")); else { String schemeName = (String) listModel.get(schemesList.getSelectedIndex()); getColorPreference(gui).setColorModel(getColorMap(schemeName)); } } }); JButton addScheme = new JButton(tr("Add")); addScheme.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String schemeName = JOptionPane.showInputDialog(Main.parent, tr("Color Scheme")); if (schemeName == null) return; schemeName = schemeName.replaceAll("\\.", "_"); setColorScheme(schemeName, getColorPreference(gui).getColorModel()); listModel.addElement(schemeName); saveSchemeNamesToPref(); } }); JButton deleteScheme = new JButton(tr("Delete")); deleteScheme.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { if (schemesList.getSelectedIndex() == -1) JOptionPane.showMessageDialog(Main.parent, tr("Please select the scheme to delete.")); else { String schemeName = (String) listModel.get(schemesList.getSelectedIndex()); removeColorSchemeFromPreferences(schemeName); listModel.remove(schemesList.getSelectedIndex()); saveSchemeNamesToPref(); } } }); schemesList.setVisibleRowCount(3); //schemesList.setToolTipText(tr("The sources (url or filename) of annotation preset definition files. See http://josm.eigenheimstrasse.de/wiki/AnnotationPresets for help.")); useScheme.setToolTipText(tr("Use the selected scheme from the list.")); addScheme.setToolTipText(tr("Use the current colors as a new color scheme.")); deleteScheme.setToolTipText(tr("Delete the selected scheme from the list.")); panel.add(new JLabel(tr("Color Schemes")), GBC.eol().insets(0,5,0,0)); panel.add(new JScrollPane(schemesList), GBC.eol().fill(GBC.BOTH)); JPanel buttonPanel = new JPanel(new GridBagLayout()); panel.add(buttonPanel, GBC.eol().fill(GBC.HORIZONTAL)); buttonPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); buttonPanel.add(useScheme, GBC.std().insets(0,5,5,0)); buttonPanel.add(addScheme, GBC.std().insets(0,5,5,0)); buttonPanel.add(deleteScheme, GBC.std().insets(0,5,5,0)); JScrollPane scrollpane = new JScrollPane(panel); scrollpane.setBorder(BorderFactory.createEmptyBorder( 0, 0, 0, 0 )); gui.getDisplayPreference().getTabPane().addTab(tr("Color Schemes"), scrollpane); } @Override public TabPreferenceSetting getTabPreferenceSetting(final PreferenceTabbedPane gui) { return gui.getDisplayPreference(); } /** * Saves the names of the schemes to the preferences. */ public void saveSchemeNamesToPref() { if (schemesList.getModel().getSize() > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < schemesList.getModel().getSize(); ++i) sb.append(";"+schemesList.getModel().getElementAt(i)); Main.pref.put(PREF_KEY_SCHEMES_NAMES, sb.toString().substring(1)); } else Main.pref.put(PREF_KEY_SCHEMES_NAMES, null); } @Override public boolean ok() { return false;// nothing to do } @Override public boolean isExpert() { return false; } /** * Remove all color entries for the given scheme from the preferences. * @param schemeName the name of the scheme. */ public void removeColorSchemeFromPreferences(String schemeName) { // delete color entries for scheme in preferences: Map colors = Main.pref.getAllPrefix(PREF_KEY_SCHEMES_PREFIX + schemeName + "."); for(String key : colors.keySet()) { Main.pref.put(key, null); } } /** * Copy all color entries from the given map to entries in preferences with the scheme name. * @param schemeName the name of the scheme. * @param the map containing the color key (without prefix) and the html color values. */ public void setColorScheme(String schemeName, Map colorMap) { String key; for(String colorKey : colorMap.keySet()) { key = PREF_KEY_SCHEMES_PREFIX + schemeName + "." + PREF_KEY_COLOR_PREFIX + colorKey; Main.pref.put(key, colorMap.get(colorKey)); } } /** * Reads all colors for a scheme and returns them in a map (key = color key without prefix, * value = html color code). * @param schemeName the name of the scheme. */ public Map getColorMap(String schemeName) { String colorKey; String prefix = PREF_KEY_SCHEMES_PREFIX + schemeName + "." + PREF_KEY_COLOR_PREFIX; MapcolorMap = new HashMap<>(); for(String schemeColorKey : Main.pref.getAllPrefix(prefix).keySet()) { colorKey = schemeColorKey.substring(prefix.length()); colorMap.put(colorKey, Main.pref.get(schemeColorKey)); } return colorMap; } public ColorPreference getColorPreference(PreferenceTabbedPane gui) { if(colorPreference == null) { for(PreferenceSetting setting : gui.getSettings()) { if(setting instanceof ColorPreference) { colorPreference = (ColorPreference) setting; break; } } } return colorPreference; } } ././@LongLink0000644000000000000000000000015000000000000011577 Lustar rootrootjosm-plugins-0.0.svn31964/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePlugin.javajosm-plugins-0.0.svn31964/colorscheme/src/at/dallermassl/josm/plugin/colorscheme/ColorSchemePlugin.j0000644000175000017500000000125011444175611031621 0ustar basbas/** * Copyright by Christof Dallermassl * This program is free software and licensed under GPL. */ package at.dallermassl.josm.plugin.colorscheme; import org.openstreetmap.josm.gui.preferences.PreferenceSetting; import org.openstreetmap.josm.plugins.Plugin; import org.openstreetmap.josm.plugins.PluginInformation; /** * ColorScheme Plugin for JOSM. * @author cdaller * */ public class ColorSchemePlugin extends Plugin { /** * Default Constructor */ public ColorSchemePlugin(PluginInformation info) { super(info); } @Override public PreferenceSetting getPreferenceSetting() { return new ColorSchemePreference(); } }