增加自研地图模块
1
.idea/gradle.xml
generated
@@ -18,6 +18,7 @@
|
||||
<option value="$PROJECT_DIR$/libraries" />
|
||||
<option value="$PROJECT_DIR$/libraries/map-amap" />
|
||||
<option value="$PROJECT_DIR$/libraries/map-autonavi" />
|
||||
<option value="$PROJECT_DIR$/libraries/map-custom" />
|
||||
<option value="$PROJECT_DIR$/libraries/mogo-map" />
|
||||
<option value="$PROJECT_DIR$/libraries/mogo-map-api" />
|
||||
<option value="$PROJECT_DIR$/main-extensions" />
|
||||
|
||||
36
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,36 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="TOP_LEVEL_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="INNER_CLASS_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="METHOD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="FIELD_OPTIONS">
|
||||
<value>
|
||||
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
|
||||
<option name="REQUIRED_TAGS" value="" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="IGNORE_DEPRECATED" value="false" />
|
||||
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
|
||||
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
|
||||
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
|
||||
<option name="myAdditionalJavadocTags" value="date" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
11
.idea/misc.xml
generated
@@ -1,6 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="FindBugsConfigurable">
|
||||
<option name="make" value="true" />
|
||||
<option name="effort" value="default" />
|
||||
<option name="priority" value="Medium" />
|
||||
<option name="excludeFilter" value="" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="SuppressionsComponent">
|
||||
<option name="suppComments" value="[]" />
|
||||
</component>
|
||||
</project>
|
||||
465
.idea/qaplug_profiles.xml
generated
Normal file
@@ -0,0 +1,465 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AnalysisProjectProfileManager">
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
|
||||
<scopes />
|
||||
<profiles>
|
||||
<profile profile_name="Project Default" version="1.0" is_locked="false">
|
||||
<coding_rule class="AM_CREATES_EMPTY_JAR_FILE_ENTRY" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="AM_CREATES_EMPTY_ZIP_FILE_ENTRY" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="BAC_BAD_APPLET_CONSTRUCTOR" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BC_BAD_CAST_TO_ABSTRACT_COLLECTION" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BC_BAD_CAST_TO_CONCRETE_COLLECTION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BC_IMPOSSIBLE_CAST" level="BLOCKER" enabled="true" />
|
||||
<coding_rule class="BC_IMPOSSIBLE_DOWNCAST" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BC_IMPOSSIBLE_INSTANCEOF" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BC_UNCONFIRMED_CAST" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="BC_VACUOUS_INSTANCEOF" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BIT_ADD_OF_SIGNED_BYTE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BIT_AND" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BIT_AND_ZZ" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BIT_IOR" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BIT_IOR_OF_SIGNED_BYTE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BIT_SIGNED_CHECK" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BIT_SIGNED_CHECK_HIGH_BIT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BOA_BADLY_OVERRIDDEN_ADAPTER" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="BSHIFT_WRONG_ADD_PRIORITY" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="BX_BOXING_IMMEDIATELY_UNBOXED" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BX_BOXING_IMMEDIATELY_UNBOXED_TO_PERFORM_COERCION" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BX_UNBOXED_AND_COERCED_FOR_TERNARY_OPERATOR" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="BX_UNBOXING_IMMEDIATELY_REBOXED" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="CAA_COVARIANT_ARRAY_ELEMENT_STORE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CAA_COVARIANT_ARRAY_FIELD" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CAA_COVARIANT_ARRAY_LOCAL" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CAA_COVARIANT_ARRAY_RETURN" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CD_CIRCULAR_DEPENDENCY" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CI_CONFUSED_INHERITANCE" level="MINOR" enabled="true" />
|
||||
<coding_rule class="CNT_ROUGH_CONSTANT_VALUE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CN_IDIOM" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="CN_IDIOM_NO_SUPER_CALL" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="CO_ABSTRACT_SELF" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="CO_COMPARETO_INCORRECT_FLOATING" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="CO_COMPARETO_RESULTS_MIN_VALUE" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="CO_SELF_NO_OBJECT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DB_DUPLICATE_BRANCHES" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DB_DUPLICATE_SWITCH_CLAUSES" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DC_DOUBLECHECK" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DC_PARTIALLY_CONSTRUCTED" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DE_MIGHT_DROP" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DE_MIGHT_IGNORE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DLS_DEAD_LOCAL_INCREMENT_IN_RETURN" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DLS_DEAD_LOCAL_STORE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DLS_DEAD_LOCAL_STORE_IN_RETURN" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DLS_DEAD_LOCAL_STORE_OF_NULL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="DLS_DEAD_STORE_OF_CLASS_LITERAL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DLS_OVERWRITTEN_INCREMENT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DL_SYNCHRONIZATION_ON_BOOLEAN" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DL_SYNCHRONIZATION_ON_SHARED_CONSTANT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DL_SYNCHRONIZATION_ON_UNSHARED_BOXED_PRIMITIVE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_ANNOTATION_IS_NOT_VISIBLE_TO_REFLECTION" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DMI_ARGUMENTS_WRONG_ORDER" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="DMI_BAD_MONTH" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="DMI_BLOCKING_METHODS_ON_URL" level="BLOCKER" enabled="true" />
|
||||
<coding_rule class="DMI_CALLING_NEXT_FROM_HASNEXT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_COLLECTIONS_SHOULD_NOT_CONTAIN_THEMSELVES" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_COLLECTION_OF_URLS" level="BLOCKER" enabled="true" />
|
||||
<coding_rule class="DMI_CONSTANT_DB_PASSWORD" level="BLOCKER" enabled="true" />
|
||||
<coding_rule class="DMI_DOH" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="DMI_EMPTY_DB_PASSWORD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="DMI_FUTILE_ATTEMPT_TO_CHANGE_MAXPOOL_SIZE_OF_SCHEDULED_THREAD_POOL_EXECUTOR" level="MINOR" enabled="true" />
|
||||
<coding_rule class="DMI_HARDCODED_ABSOLUTE_FILENAME" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_INVOKING_HASHCODE_ON_ARRAY" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_INVOKING_TOSTRING_ON_ARRAY" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_LONG_BITS_TO_DOUBLE_INVOKED_ON_INT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_NONSERIALIZABLE_OBJECT_WRITTEN" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_RANDOM_USED_ONLY_ONCE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_SCHEDULED_THREAD_POOL_EXECUTOR_WITH_ZERO_CORE_THREADS" level="MINOR" enabled="true" />
|
||||
<coding_rule class="DMI_THREAD_PASSED_WHERE_RUNNABLE_EXPECTED" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DMI_UNSUPPORTED_METHOD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DMI_USELESS_SUBSTRING" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_USING_REMOVEALL_TO_CLEAR_COLLECTION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DMI_VACUOUS_CALL_TO_EASYMOCK_METHOD" level="MINOR" enabled="true" />
|
||||
<coding_rule class="DMI_VACUOUS_SELF_COLLECTION_CALL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DM_BOOLEAN_CTOR" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_BOXED_PRIMITIVE_FOR_COMPARE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DM_BOXED_PRIMITIVE_FOR_PARSING" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DM_BOXED_PRIMITIVE_TOSTRING" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_CONVERT_CASE" level="INFO" enabled="true" />
|
||||
<coding_rule class="DM_DEFAULT_ENCODING" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="DM_EXIT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_FP_NUMBER_CTOR" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_GC" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_INVALID_MIN_MAX" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="DM_MONITOR_WAIT_ON_CONDITION" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_NEW_FOR_GETCLASS" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_NEXTINT_VIA_NEXTDOUBLE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_NUMBER_CTOR" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="DM_RUN_FINALIZERS_ON_EXIT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_STRING_CTOR" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_STRING_TOSTRING" level="INFO" enabled="true" />
|
||||
<coding_rule class="DM_STRING_VOID_CTOR" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DM_USELESS_THREAD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="DP_DO_INSIDE_DO_PRIVILEGED" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EC_ARRAY_AND_NONARRAY" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EC_BAD_ARRAY_COMPARE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EC_INCOMPATIBLE_ARRAY_COMPARE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="EC_NULL_ARG" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EC_UNRELATED_CLASS_AND_INTERFACE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EC_UNRELATED_INTERFACES" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EC_UNRELATED_TYPES" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EC_UNRELATED_TYPES_USING_POINTER_EQUALITY" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EI_EXPOSE_REP" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EI_EXPOSE_REP2" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EI_EXPOSE_STATIC_REP2" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EQ_ABSTRACT_SELF" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EQ_ALWAYS_FALSE" level="BLOCKER" enabled="true" />
|
||||
<coding_rule class="EQ_ALWAYS_TRUE" level="BLOCKER" enabled="true" />
|
||||
<coding_rule class="EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EQ_COMPARETO_USE_OBJECT_EQUALS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EQ_COMPARING_CLASS_NAMES" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EQ_DOESNT_OVERRIDE_EQUALS" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="EQ_DONT_DEFINE_EQUALS_FOR_ENUM" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EQ_GETCLASS_AND_CLASS_CONSTANT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="EQ_OTHER_NO_OBJECT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EQ_OTHER_USE_OBJECT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EQ_SELF_NO_OBJECT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EQ_SELF_USE_OBJECT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="EQ_UNUSUAL" level="MINOR" enabled="true" />
|
||||
<coding_rule class="ES_COMPARING_PARAMETER_STRING_WITH_EQ" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="ES_COMPARING_STRINGS_WITH_EQ" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="ESync_EMPTY_SYNC" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FB_MISSING_EXPECTED_WARNING" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="FB_UNEXPECTED_WARNING" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="FE_FLOATING_POINT_EQUALITY" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="FI_EMPTY" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FI_EXPLICIT_INVOCATION" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FI_FINALIZER_NULLS_FIELDS" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FI_FINALIZER_ONLY_NULLS_FIELDS" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FI_MISSING_SUPER_CALL" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FI_NULLIFY_SUPER" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="FI_PUBLIC_SHOULD_BE_PROTECTED" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="FI_USELESS" level="MINOR" enabled="true" />
|
||||
<coding_rule class="FL_MATH_USING_FLOAT_PRECISION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="GC_UNCHECKED_TYPE_IN_GENERIC_CALL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="GC_UNRELATED_TYPES" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="HE_EQUALS_NO_HASHCODE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="HE_EQUALS_USE_HASHCODE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="HE_HASHCODE_NO_EQUALS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="HE_HASHCODE_USE_OBJECT_EQUALS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="HE_INHERITS_EQUALS_USE_HASHCODE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="HE_SIGNATURE_DECLARES_HASHING_OF_UNHASHABLE_CLASS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="HE_USE_OF_UNHASHABLE_CLASS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="HRS_REQUEST_PARAMETER_TO_COOKIE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="HRS_REQUEST_PARAMETER_TO_HTTP_HEADER" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="HSC_HUGE_SHARED_STRING_CONSTANT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTER_METHOD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="ICAST_BAD_SHIFT_AMOUNT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="ICAST_IDIV_CAST_TO_DOUBLE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="ICAST_INTEGER_MULTIPLY_CAST_TO_LONG" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="ICAST_INT_2_LONG_AS_INSTANT" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="ICAST_INT_CAST_TO_FLOAT_PASSED_TO_ROUND" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="ICAST_QUESTIONABLE_UNSIGNED_RIGHT_SHIFT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IC_INIT_CIRCULARITY" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IC_SUPERCLASS_USES_SUBCLASS_DURING_INITIALIZATION" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="IIL_ELEMENTS_GET_LENGTH_IN_LOOP" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="IIL_PATTERN_COMPILE_IN_LOOP" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="IIL_PATTERN_COMPILE_IN_LOOP_INDIRECT" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="IIL_PREPARE_STATEMENT_IN_LOOP" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="IIO_INEFFICIENT_INDEX_OF" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="IIO_INEFFICIENT_LAST_INDEX_OF" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="IJU_ASSERT_METHOD_INVOKED_FROM_RUN_METHOD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IJU_BAD_SUITE_METHOD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IJU_NO_TESTS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IJU_SETUP_NO_SUPER" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IJU_SUITE_NOT_STATIC" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IJU_TEARDOWN_NO_SUPER" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IL_CONTAINER_ADDED_TO_ITSELF" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IL_INFINITE_LOOP" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IL_INFINITE_RECURSIVE_LOOP" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IMA_INEFFICIENT_MEMBER_ACCESS" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="IMSE_DONT_CATCH_IMSE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="IM_AVERAGE_COMPUTATION_COULD_OVERFLOW" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IM_BAD_CHECK_FOR_ODD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IM_MULTIPLYING_RESULT_OF_IREM" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="INT_BAD_COMPARISON_WITH_INT_VALUE" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="INT_BAD_COMPARISON_WITH_NONNEGATIVE_VALUE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="INT_BAD_COMPARISON_WITH_SIGNED_BYTE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="INT_BAD_REM_BY_1" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="INT_VACUOUS_BIT_OPERATION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="INT_VACUOUS_COMPARISON" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IO_APPENDING_TO_OBJECT_OUTPUT_STREAM" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IP_PARAMETER_IS_DEAD_BUT_OVERWRITTEN" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IS2_INCONSISTENT_SYNC" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="ISC_INSTANTIATE_STATIC_CLASS" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="IS_FIELD_NOT_GUARDED" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="ITA_INEFFICIENT_TO_ARRAY" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="IT_NO_SUCH_ELEMENT" level="MINOR" enabled="true" />
|
||||
<coding_rule class="J2EE_STORE_OF_NON_SERIALIZABLE_OBJECT_INTO_SESSION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="JCIP_FIELD_ISNT_FINAL_IN_IMMUTABLE_CLASS" level="MINOR" enabled="true" />
|
||||
<coding_rule class="JLM_JSR166_LOCK_MONITORENTER" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="JLM_JSR166_UTILCONCURRENT_MONITORENTER" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="JML_JSR166_CALLING_WAIT_RATHER_THAN_AWAIT" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="LI_LAZY_INIT_STATIC" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="LI_LAZY_INIT_UPDATE_STATIC" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="ME_ENUM_FIELD_SETTER" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="ME_MUTABLE_ENUM_FIELD" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="MF_CLASS_MASKS_FIELD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MF_METHOD_MASKS_FIELD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="ML_SYNC_ON_FIELD_TO_GUARD_CHANGING_THAT_FIELD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="ML_SYNC_ON_UPDATED_FIELD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MSF_MUTABLE_SERVLET_FIELD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MS_CANNOT_BE_FINAL" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MS_EXPOSE_REP" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="MS_FINAL_PKGPROTECT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MS_MUTABLE_ARRAY" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MS_MUTABLE_COLLECTION" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="MS_MUTABLE_COLLECTION_PKGPROTECT" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="MS_MUTABLE_HASHTABLE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MS_OOI_PKGPROTECT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MS_PKGPROTECT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MS_SHOULD_BE_FINAL" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="MS_SHOULD_BE_REFACTORED_TO_BE_FINAL" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="MTIA_SUSPECT_SERVLET_INSTANCE_FIELD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="MTIA_SUSPECT_STRUTS_INSTANCE_FIELD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="MWN_MISMATCHED_NOTIFY" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="MWN_MISMATCHED_WAIT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NM_BAD_EQUAL" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NM_CLASS_NAMING_CONVENTION" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NM_CLASS_NOT_EXCEPTION" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NM_CONFUSING" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NM_FIELD_NAMING_CONVENTION" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NM_FUTURE_KEYWORD_USED_AS_IDENTIFIER" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NM_FUTURE_KEYWORD_USED_AS_MEMBER_IDENTIFIER" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NM_LCASE_HASHCODE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NM_LCASE_TOSTRING" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NM_METHOD_CONSTRUCTOR_CONFUSION" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NM_METHOD_NAMING_CONVENTION" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NM_SAME_SIMPLE_NAME_AS_INTERFACE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NM_VERY_CONFUSING" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NM_VERY_CONFUSING_INTENTIONAL" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NM_WRONG_PACKAGE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NM_WRONG_PACKAGE_INTENTIONAL" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NN_NAKED_NOTIFY" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NOISE_FIELD_REFERENCE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NOISE_METHOD_CALL" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NOISE_NULL_DEREFERENCE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NOISE_OPERATION" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NO_NOTIFY_NOT_NOTIFYALL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_ALWAYS_NULL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_ALWAYS_NULL_EXCEPTION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_ARGUMENT_MIGHT_BE_NULL" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NP_BOOLEAN_RETURN_NULL" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NP_CLONE_COULD_RETURN_NULL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_CLOSING_NULL" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NP_DEREFERENCE_OF_READLINE_VALUE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_EQUALS_SHOULD_HANDLE_NULL_ARGUMENT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_GUARANTEED_DEREF" level="BLOCKER" enabled="true" />
|
||||
<coding_rule class="NP_GUARANTEED_DEREF_ON_EXCEPTION_PATH" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_IMMEDIATE_DEREFERENCE_OF_READLINE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_LOAD_OF_KNOWN_NULL_VALUE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_METHOD_PARAMETER_TIGHTENS_ANNOTATION" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NP_METHOD_RETURN_RELAXING_ANNOTATION" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="NP_NONNULL_PARAM_VIOLATION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_NONNULL_RETURN_VIOLATION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_NULL_INSTANCEOF" level="BLOCKER" enabled="true" />
|
||||
<coding_rule class="NP_NULL_ON_SOME_PATH" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_NULL_ON_SOME_PATH_EXCEPTION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_NULL_ON_SOME_PATH_MIGHT_BE_INFEASIBLE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_NULL_PARAM_DEREF" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_NULL_PARAM_DEREF_NONVIRTUAL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_OPTIONAL_RETURN_NULL" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_STORE_INTO_NONNULL_FIELD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_SYNC_AND_NULL_CHECK_FIELD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="NP_TOSTRING_COULD_RETURN_NULL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NP_UNWRITTEN_FIELD" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="NS_DANGEROUS_NON_SHORT_CIRCUIT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="NS_NON_SHORT_CIRCUIT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="OBL_UNSATISFIED_OBLIGATION" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="ODR_OPEN_DATABASE_RESOURCE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="ODR_OPEN_DATABASE_RESOURCE_EXCEPTION_PATH" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="OS_OPEN_STREAM" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="OS_OPEN_STREAM_EXCEPTION_PATH" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="PS_PUBLIC_SEMAPHORES" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="PT_ABSOLUTE_PATH_TRAVERSAL" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="PT_RELATIVE_PATH_TRAVERSAL" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="PZLA_PREFER_ZERO_LENGTH_ARRAYS" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="PZ_DONT_REUSE_ENTRY_OBJECTS_IN_ITERATORS" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="QBA_QUESTIONABLE_BOOLEAN_ASSIGNMENT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="QF_QUESTIONABLE_FOR_LOOP" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RANGE_ARRAY_INDEX" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="RANGE_ARRAY_LENGTH" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="RANGE_ARRAY_OFFSET" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="RANGE_STRING_INDEX" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="RCN_REDUNDANT_COMPARISON_OF_NULL_AND_NONNULL_VALUE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RCN_REDUNDANT_COMPARISON_TWO_NULL_VALUES" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RC_REF_COMPARISON" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RC_REF_COMPARISON_BAD_PRACTICE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="REC_CATCH_EXCEPTION" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="RE_BAD_SYNTAX_FOR_REGULAR_EXPRESSION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RE_CANT_USE_FILE_SEPARATOR_AS_REGULAR_EXPRESSION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RE_POSSIBLE_UNINTENDED_PATTERN" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RI_REDUNDANT_INTERFACES" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="RR_NOT_CHECKED" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="RS_READOBJECT_SYNC" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RU_INVOKE_RUN" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="RV_01_TO_INT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="RV_ABSOLUTE_VALUE_OF_HASHCODE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RV_ABSOLUTE_VALUE_OF_RANDOM_INT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RV_CHECK_COMPARETO_FOR_SPECIFIC_RETURN_VALUE" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="RV_CHECK_FOR_POSITIVE_INDEXOF" level="MINOR" enabled="true" />
|
||||
<coding_rule class="RV_DONT_JUST_NULL_CHECK_READLINE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="RV_EXCEPTION_NOT_THROWN" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RV_NEGATING_RESULT_OF_COMPARETO" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="RV_REM_OF_HASHCODE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RV_REM_OF_RANDOM_INT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="RV_RETURN_VALUE_IGNORED" level="MINOR" enabled="true" />
|
||||
<coding_rule class="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="RV_RETURN_VALUE_IGNORED_INFERRED" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="RpC_REPEATED_CONDITIONAL_TEST" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SA_FIELD_DOUBLE_ASSIGNMENT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SA_FIELD_SELF_ASSIGNMENT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SA_FIELD_SELF_COMPARISON" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SA_FIELD_SELF_COMPUTATION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SA_LOCAL_DOUBLE_ASSIGNMENT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SA_LOCAL_SELF_ASSIGNMENT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SA_LOCAL_SELF_ASSIGNMENT_INSTEAD_OF_FIELD" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="SA_LOCAL_SELF_COMPARISON" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SA_LOCAL_SELF_COMPUTATION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SBSC_USE_STRINGBUFFER_CONCATENATION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SC_START_IN_CTOR" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SE_BAD_FIELD" level="MINOR" enabled="false" />
|
||||
<coding_rule class="SE_BAD_FIELD_INNER_CLASS" level="MINOR" enabled="true" />
|
||||
<coding_rule class="SE_BAD_FIELD_STORE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_INNER_CLASS" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_METHOD_MUST_BE_PRIVATE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_NONFINAL_SERIALVERSIONID" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SE_NONLONG_SERIALVERSIONID" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_NONSTATIC_SERIALVERSIONID" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_NO_SERIALVERSIONID" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_NO_SUITABLE_CONSTRUCTOR" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_NO_SUITABLE_CONSTRUCTOR_FOR_EXTERNALIZATION" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_PRIVATE_READ_RESOLVE_NOT_INHERITED" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_READ_RESOLVE_IS_STATIC" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_READ_RESOLVE_MUST_RETURN_OBJECT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_TRANSIENT_FIELD_NOT_RESTORED" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SE_TRANSIENT_FIELD_OF_NONSERIALIZABLE_CLASS" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="SF_DEAD_STORE_DUE_TO_SWITCH_FALLTHROUGH_TO_THROW" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="SF_SWITCH_FALLTHROUGH" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="SF_SWITCH_NO_DEFAULT" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="SIC_INNER_SHOULD_BE_STATIC" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SIC_INNER_SHOULD_BE_STATIC_ANON" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SIC_THREADLOCAL_DEADLY_EMBRACE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="SIO_SUPERFLUOUS_INSTANCEOF" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SI_INSTANCE_BEFORE_FINALS_ASSIGNED" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SP_SPIN_ON_FIELD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SQL_BAD_PREPARED_STATEMENT_ACCESS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SQL_BAD_RESULTSET_ACCESS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SR_NOT_CHECKED" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="SS_SHOULD_BE_STATIC" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="STCAL_INVOKE_ON_STATIC_CALENDAR_INSTANCE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="STCAL_INVOKE_ON_STATIC_DATE_FORMAT_INSTANCE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="STCAL_STATIC_CALENDAR_INSTANCE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="STCAL_STATIC_SIMPLE_DATE_FORMAT_INSTANCE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="STI_INTERRUPTED_ON_CURRENTTHREAD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="STI_INTERRUPTED_ON_UNKNOWNTHREAD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SWL_SLEEP_WITH_LOCK_HELD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="SW_SWING_METHODS_INVOKED_IN_SWING_THREAD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="TLW_TWO_LOCK_WAIT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="TQ_ALWAYS_VALUE_USED_WHERE_NEVER_REQUIRED" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="TQ_COMPARING_VALUES_WITH_INCOMPATIBLE_TYPE_QUALIFIERS" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_ALWAYS_SINK" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_NEVER_SINK" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="TQ_MAYBE_SOURCE_VALUE_REACHES_ALWAYS_SINK" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="TQ_MAYBE_SOURCE_VALUE_REACHES_NEVER_SINK" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="TQ_NEVER_VALUE_USED_WHERE_ALWAYS_REQUIRED" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="TQ_UNKNOWN_VALUE_USED_WHERE_ALWAYS_STRICTLY_REQUIRED" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="UCF_USELESS_CONTROL_FLOW" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="UCF_USELESS_CONTROL_FLOW_NEXT_LINE" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="UC_USELESS_CONDITION" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="UC_USELESS_CONDITION_TYPE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="UC_USELESS_OBJECT" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="UC_USELESS_OBJECT_STACK" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="UC_USELESS_VOID_METHOD" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="UG_SYNC_SET_UNSYNC_GET" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="UI_INHERITANCE_UNSAFE_GETRESOURCE" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="UL_UNRELEASED_LOCK" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="UL_UNRELEASED_LOCK_EXCEPTION_PATH" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="UMAC_UNCALLABLE_METHOD_OF_ANONYMOUS_CLASS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="UM_UNNECESSARY_MATH" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="UPM_UNCALLED_PRIVATE_METHOD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="URF_UNREAD_FIELD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="UR_UNINIT_READ" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="UR_UNINIT_READ_CALLED_FROM_SUPER_CONSTRUCTOR" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="USM_USELESS_ABSTRACT_METHOD" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="USM_USELESS_SUBCLASS_METHOD" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="UUF_UNUSED_FIELD" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="UWF_NULL_FIELD" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="UWF_UNWRITTEN_FIELD" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="UW_UNCOND_WAIT" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="VA_FORMAT_STRING_BAD_ARGUMENT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="VA_FORMAT_STRING_BAD_CONVERSION" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="VA_FORMAT_STRING_BAD_CONVERSION_FROM_ARRAY" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEAN" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="VA_FORMAT_STRING_EXPECTED_MESSAGE_FORMAT_SUPPLIED" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="VA_FORMAT_STRING_EXTRA_ARGUMENTS_PASSED" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="VA_FORMAT_STRING_ILLEGAL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="VA_FORMAT_STRING_MISSING_ARGUMENT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="VA_FORMAT_STRING_NO_PREVIOUS_ARGUMENT" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="VA_FORMAT_STRING_USES_NEWLINE" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_VARARG" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="VO_VOLATILE_INCREMENT" level="CRITICAL" enabled="false" />
|
||||
<coding_rule class="VO_VOLATILE_REFERENCE_TO_ARRAY" level="MAJOR" enabled="true" />
|
||||
<coding_rule class="VR_UNRESOLVABLE_REFERENCE" level="MAJOR" enabled="false" />
|
||||
<coding_rule class="WA_AWAIT_NOT_IN_LOOP" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="WA_NOT_IN_LOOP" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="WMI_WRONG_MAP_ITERATOR" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="WS_WRITEOBJECT_SYNC" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="XFB_XML_FACTORY_BYPASS" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="XSS_REQUEST_PARAMETER_TO_JSP_WRITER" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="XSS_REQUEST_PARAMETER_TO_SEND_ERROR" level="CRITICAL" enabled="true" />
|
||||
<coding_rule class="XSS_REQUEST_PARAMETER_TO_SERVLET_WRITER" level="CRITICAL" enabled="true" />
|
||||
</profile>
|
||||
</profiles>
|
||||
<list size="0" />
|
||||
</component>
|
||||
</project>
|
||||
1
libraries/map-custom/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
59
libraries/map-custom/build.gradle
Normal file
@@ -0,0 +1,59 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility 1.8
|
||||
targetCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
|
||||
// api rootProject.ext.dependencies.amapnavi3dmap
|
||||
// api rootProject.ext.dependencies.amapsearch
|
||||
// api rootProject.ext.dependencies.amaplocation
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
} else {
|
||||
implementation project(':foudations:mogo-utils')
|
||||
implementation project(':libraries:mogo-map-api')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':services:mogo-service-api')
|
||||
|
||||
}
|
||||
|
||||
api 'com.zhidaoauto.machine:map:1.0.0-SNAPSHOT-54'
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
0
libraries/map-custom/consumer-rules.pro
Normal file
3
libraries/map-custom/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.map
|
||||
POM_ARTIFACT_ID=map-amap
|
||||
VERSION_CODE=1
|
||||
21
libraries/map-custom/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
7
libraries/map-custom/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.map.impl.amap">
|
||||
|
||||
<application>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MogoBaseMapView;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.MapParams;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-25
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AMapBaseMapView extends MogoBaseMapView {
|
||||
|
||||
private static final String TAG = "AMapBaseMapView";
|
||||
|
||||
public AMapBaseMapView( Context context ) {
|
||||
super( context );
|
||||
}
|
||||
|
||||
public AMapBaseMapView( Context context, @Nullable AttributeSet attrs ) {
|
||||
super( context, attrs );
|
||||
}
|
||||
|
||||
public AMapBaseMapView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
|
||||
private MapAutoView mapAutoView;
|
||||
@Override
|
||||
protected IMogoMapView createMapView( Context context ) {
|
||||
Log.i(TAG, "autoop--createMapView: ");
|
||||
if(mapAutoView == null){
|
||||
Log.i(TAG, "autoop--createMapView: mapAutoView is null create");
|
||||
MapAutoApi.INSTANCE.init(MapParams.Companion.init().setDebugMode(false)
|
||||
.setCoordinateType(MapParams.COORDINATETYPE_GCJ02)
|
||||
.setPerspectiveMode(MapParams.MAP_PERSPECTIVE_2D)
|
||||
.setStyleMode(MapParams.MAP_STYLE_NIGHT));
|
||||
mapAutoView = new MapAutoView( context );
|
||||
}
|
||||
return new AMapViewWrapper(mapAutoView);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* marker 点击事件处理
|
||||
*/
|
||||
public class AMapMarkerClickHandler {
|
||||
|
||||
public boolean handleMarkerClicked( Marker marker ) {
|
||||
if ( marker == null ) {
|
||||
return false;
|
||||
}
|
||||
if ( marker.getMObject() instanceof IMogoMarker ) {
|
||||
IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getMObject() );
|
||||
final IMogoMarkerClickListener listener = mogoMarker.getOnMarkerClickListener();
|
||||
Logger.d( "AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker );
|
||||
if ( listener != null ) {
|
||||
listener.onMarkerClicked( mogoMarker );
|
||||
}
|
||||
return MogoMarkersHandler.getInstance().onMarkerClicked( mogoMarker );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,886 @@
|
||||
//package com.mogo.map.impl.custom;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.graphics.BitmapFactory;
|
||||
//import android.graphics.Color;
|
||||
//import android.graphics.Point;
|
||||
//import android.graphics.Rect;
|
||||
//import android.location.Location;
|
||||
//import android.os.Bundle;
|
||||
//import android.os.SystemClock;
|
||||
//import android.os.Trace;
|
||||
//import android.util.Log;
|
||||
//import android.view.MotionEvent;
|
||||
//import android.view.View;
|
||||
//import android.view.animation.Interpolator;
|
||||
//
|
||||
//import com.mogo.commons.debug.DebugConfig;
|
||||
//import com.mogo.map.IMogoMap;
|
||||
//import com.mogo.map.IMogoMapView;
|
||||
//import com.mogo.map.MogoLatLng;
|
||||
//import com.mogo.map.impl.custom.hook.BnHooker;
|
||||
//import com.mogo.map.impl.custom.marker.AMapMarkerWrapper;
|
||||
//import com.mogo.map.impl.custom.message.AMapMessageListener;
|
||||
//import com.mogo.map.impl.custom.message.AMapMessageManager;
|
||||
//import com.mogo.map.impl.custom.navi.NaviClient;
|
||||
//import com.mogo.map.impl.custom.utils.MogoMapUtils;
|
||||
//import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
//import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
//import com.mogo.map.marker.IMogoMarker;
|
||||
//import com.mogo.map.uicontroller.CarCursorOption;
|
||||
//import com.mogo.map.uicontroller.EnumMapUI;
|
||||
//import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
//import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
//import com.mogo.map.uicontroller.MapControlResult;
|
||||
//import com.mogo.utils.WindowUtils;
|
||||
//import com.mogo.utils.logger.Logger;
|
||||
//import com.zhidaoauto.map.sdk.open.MapParams;
|
||||
//import com.zhidaoauto.map.sdk.open.camera.CameraUpdate;
|
||||
//import com.zhidaoauto.map.sdk.open.location.LocationListener;
|
||||
//import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
|
||||
//import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||
//import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
//import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||
//
|
||||
//import org.jetbrains.annotations.NotNull;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2019-12-18
|
||||
// * <p>
|
||||
// * 代理高德导航地图
|
||||
// */
|
||||
//public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
// IMogoMapUIController,
|
||||
// OnMarkClickListener,
|
||||
//// AMap.OnMapLoadedListener,
|
||||
//// AMap.OnMapTouchListener,
|
||||
//// AMap.OnPOIClickListener,
|
||||
//// AMap.OnMapClickListener,
|
||||
//// AMap.OnPolylineClickListener,
|
||||
//// AMapNaviViewListener,
|
||||
//// AMapMessageListener,
|
||||
//// AMap.OnCameraChangeListener,
|
||||
// LocationListener {
|
||||
//
|
||||
// private static final String TAG = "AMapNaviViewWrapper";
|
||||
//
|
||||
// private final MapAutoView mMapView;
|
||||
// private IMogoMap mIMap;
|
||||
//
|
||||
// private AMapMarkerClickHandler mMarkerClickHandler;
|
||||
// private EnumMapUI mCurrentUIMode;
|
||||
//
|
||||
// private boolean mIsCarLocked = false;
|
||||
//
|
||||
// private float mDefaultZoomLevel = 16.0f;
|
||||
// private final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
|
||||
// .carCursorRes( R.drawable.map_api_ic_current_location2 )
|
||||
// .naviCursorRes( R.drawable.ic_amap_navi_cursor )
|
||||
// .build();
|
||||
// private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
//
|
||||
// public AMapNaviViewWrapper( MapAutoView mapView ) {
|
||||
// this.mMapView = mapView;
|
||||
// this.mIMap = new AMapWrapper( mMapView.getMapAutoViewHelper(), mMapView, this );
|
||||
// try {
|
||||
// new BnHooker( mMapView.getMapAutoViewHelper(), mapView.getContext() );
|
||||
// } catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void initMapView() {
|
||||
// if ( mMapView == null ) {
|
||||
// return;
|
||||
// }
|
||||
// MapAutoViewHelper options = mMapView.getMapAutoViewHelper();
|
||||
// if ( options != null ) {
|
||||
// // 设置是否开启自动黑夜模式切换,默认为false,不自动切换
|
||||
//// options.setAutoNaviViewNightMode( false );
|
||||
// // 设置6秒后是否自动锁车
|
||||
//// options.setAutoLockCar( false );
|
||||
// // 设置路线上的摄像头气泡是否显示
|
||||
//// options.setCameraBubbleShow( true );
|
||||
// // 设置路线相关的配置属性,如:路线的路况颜色,路线上是否显示摄像头气泡等。
|
||||
// // options.setRouteOverlayOptions( MapStyleUtils.getRouteOverlayOptions() );
|
||||
// // 设置自车的图片对象
|
||||
//// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), DEFAULT_OPTION.getNaviCursorRes() ) );
|
||||
// // 设置指南针图标否在导航界面显示,默认显示。true,显示;false,隐藏。
|
||||
// options.hiddenDirection();
|
||||
// // 黑夜模式
|
||||
// options.setMapStyle(MapParams.MAP_STYLE_NIGHT);
|
||||
// //设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
|
||||
//// options.setTrafficBarEnabled( false );
|
||||
// // 设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
//// options.setTrafficLayerEnabled( false );
|
||||
// // 设置导航界面是否显示路线全览按钮。
|
||||
//// options.setRouteListButtonShow( false );
|
||||
// // 设置导航状态下屏幕是否一直开启。
|
||||
//// options.setScreenAlwaysBright( true );
|
||||
// // 设置交通播报是否打开(只适用于驾车导航,需要联网)。
|
||||
//// options.setTrafficInfoUpdateEnabled( true );
|
||||
// // 设置摄像头播报是否打开(只适用于驾车导航)。
|
||||
//// options.setCameraInfoUpdateEnabled( true );
|
||||
// // 设置菜单按钮是否在导航界面显示。
|
||||
//// options.setSettingMenuEnabled( false );
|
||||
// // 设置是否绘制显示交通路况的线路(彩虹线),拥堵-红色,畅通-绿色,缓慢-黄色,未知-蓝色。默认不绘制彩虹线。
|
||||
//// options.setTrafficLine( true );
|
||||
// // 设置是否绘制牵引线(当前位置到目的地的指引线)。默认不绘制牵引线。
|
||||
//// options.setLeaderLineEnabled( -1 );
|
||||
// // 设置导航界面UI是否显示。
|
||||
//// options.setLayoutVisible( false );
|
||||
// // 设置是否自动画路
|
||||
//// options.setAutoDrawRoute( false );
|
||||
// // 设置是否显示路口放大图(实景图)
|
||||
//// options.setRealCrossDisplayShow( false );
|
||||
// // 设置是否显示路口放大图(路口模型图)
|
||||
//// options.setModeCrossDisplayShow( false );
|
||||
// // 设置是否显示道路信息view
|
||||
//// options.setLaneInfoShow( false );
|
||||
// // 设置是否自动改变缩放等级
|
||||
//// options.setAutoChangeZoom( false );
|
||||
// // 设置是否自动全览模式,即在算路成功后自动进入全览模式
|
||||
//// options.setAutoDisplayOverview( false );
|
||||
// // 设置路线转向箭头隐藏和显示
|
||||
//// options.setNaviArrowVisible( false );
|
||||
// // 通过路线是否自动置灰,仅支持驾车导航
|
||||
//// options.setAfterRouteAutoGray( true );
|
||||
// options.setZoom( ( ( int ) mDefaultZoomLevel ) );
|
||||
// options.setPointToCenter( 0.5D, 0.5D );
|
||||
// // 2D模式
|
||||
// options.setTilt( 0 );
|
||||
// mMapView.setViewOptions( options );
|
||||
// }
|
||||
// mMapView.setRouteOverlayVisible( false );
|
||||
// mMapView.setCarOverlayVisible( false );
|
||||
// setUIMode( EnumMapUI.CarUp_2D, null );
|
||||
// }
|
||||
//
|
||||
// private void initListeners() {
|
||||
//
|
||||
// mMapView.setOnMarkerClickListener( this );
|
||||
// mMarkerClickHandler = new AMapMarkerClickHandler();
|
||||
// mMapView.setOnMapLoadedListener( this );
|
||||
// mMapView.setOnMapTouchListener( this );
|
||||
// mMapView.setOnPolylineClickListener( this );
|
||||
// mMapView.setAMapNaviViewListener( this );
|
||||
// mMapView.setOnCameraChangeListener( this );
|
||||
//
|
||||
// final AMap aMap = mMapView.getMap();
|
||||
// if ( aMap != null ) {
|
||||
// aMap.setOnPOIClickListener( this );
|
||||
// aMap.setOnMapClickListener( this );
|
||||
// aMap.setOnCameraChangeListener( this );
|
||||
// aMap.setOnMyLocationChangeListener( this );
|
||||
// }
|
||||
// AMapMessageManager.getInstance().registerAMapMessageListener( this );
|
||||
// }
|
||||
//
|
||||
// private Context getContext() {
|
||||
// return mMapView.getContext();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public View getMapView() {
|
||||
// return mMapView;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IMogoMap getMap() {
|
||||
// return mIMap;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCreate( Bundle bundle ) {
|
||||
// if ( mMapView != null ) {
|
||||
// mMapView.onCreate( bundle );
|
||||
// Logger.d( TAG, "map onCreate" );
|
||||
// initMapView();
|
||||
// initListeners();
|
||||
// initMyLocation();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onResume() {
|
||||
// if ( mMapView != null ) {
|
||||
// mMapView.onResume();
|
||||
// Logger.d( TAG, "map onResume" );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPause() {
|
||||
// if ( mMapView != null ) {
|
||||
// mMapView.onPause();
|
||||
// Logger.d( TAG, "map onPause" );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onDestroy() {
|
||||
// if ( mMapView != null ) {
|
||||
// mMapView.onDestroy();
|
||||
// Logger.d( TAG, "map onDestroy" );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSaveInstanceState( Bundle outState ) {
|
||||
// if ( mMapView != null ) {
|
||||
// mMapView.onSaveInstanceState( outState );
|
||||
// Logger.d( TAG, "map onSaveInstanceState" );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLowMemory() {
|
||||
// Logger.d( TAG, "map onLowMemory" );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 地图marker点击
|
||||
// */
|
||||
// @Override
|
||||
// public boolean onMarkerClick( Marker marker ) {
|
||||
// return mMarkerClickHandler.handleMarkerClicked( marker );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 地图加载完毕
|
||||
// */
|
||||
// @Override
|
||||
// public void onMapLoaded() {
|
||||
// MogoMapListenerHandler.getInstance().onMapLoaded();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 地图点击回调
|
||||
// */
|
||||
// @Override
|
||||
// public void onTouch( MotionEvent motionEvent ) {
|
||||
// MogoMapListenerHandler.getInstance().onTouch( motionEvent );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * POI 点击
|
||||
// */
|
||||
// @Override
|
||||
// public void onPOIClick( Poi poi ) {
|
||||
// if ( InterceptorHandler.getInstance().ignorePoiClicked( getContext() ) ) {
|
||||
// return;
|
||||
// }
|
||||
// MogoMapListenerHandler.getInstance().onPOIClick( ObjectUtils.fromAMap( poi ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMapClick( LatLng latLng ) {
|
||||
// if ( InterceptorHandler.getInstance().ignoreMapClicked( getContext() ) ) {
|
||||
// return;
|
||||
// }
|
||||
// MogoMapListenerHandler.getInstance().onMapClick( ObjectUtils.fromAMap( latLng ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPolylineClick( Polyline polyline ) {
|
||||
// if ( !NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
// NaviClient.getInstance( getContext() ).handleClickedPolyline( polyline );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviSetting() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviCancel() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onNaviBackClick() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param mode 0:车头朝上状态;1:正北朝上模式
|
||||
// */
|
||||
// @Override
|
||||
// public void onNaviMapMode( int mode ) {
|
||||
// Logger.i( TAG, "mode=" + mode );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviTurnClick() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNextRoadClick() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onScanViewButtonClick() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLockMap( boolean isLock ) {
|
||||
// Logger.d( TAG, "lock status = %s", isLock );
|
||||
// mIsCarLocked = isLock;
|
||||
// Trace.beginSection( "timer.onCameraChangeFinish" );
|
||||
// MogoMapListenerHandler.getInstance().onLockMap( isLock );
|
||||
// Trace.endSection();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviViewLoaded() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMapTypeChanged( int type ) {
|
||||
// if ( type == 4 ) {
|
||||
// MogoMapListenerHandler.getInstance().onMapModeChanged( EnumMapUI.Type_Light );
|
||||
// } else if ( type == 3 ) {
|
||||
// MogoMapListenerHandler.getInstance().onMapModeChanged( EnumMapUI.Type_Night );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviViewShowMode( int i ) {
|
||||
//
|
||||
// long delay = mMapView.getViewOptions().getLockMapDelayed();
|
||||
// switch ( i ) {
|
||||
// case AMapNaviViewShowMode.SHOW_MODE_DEFAULT:
|
||||
// Logger.d( TAG, "普通模式" );
|
||||
// break;
|
||||
// case AMapNaviViewShowMode.SHOW_MODE_DISPLAY_OVERVIEW:
|
||||
// Logger.d( TAG, "全览模式" );
|
||||
// break;
|
||||
// case AMapNaviViewShowMode.SHOW_MODE_LOCK_CAR:
|
||||
// Logger.d( TAG, "锁车模式: %s", delay );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setTrafficEnabled( boolean visible ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.setTrafficLine( visible );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MapControlResult changeZoom( boolean zoom ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// mDefaultZoomLevel = ( int ) ( getMap().getZoomLevel() + 0.5f );
|
||||
//
|
||||
// if ( zoom ) {
|
||||
// if ( mDefaultZoomLevel >= 20 ) {
|
||||
// return MapControlResult.TARGET;
|
||||
// }
|
||||
// } else {
|
||||
// if ( mDefaultZoomLevel <= 3 ) {
|
||||
// return MapControlResult.TARGET;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if ( zoom ) {
|
||||
// mDefaultZoomLevel += 2f;
|
||||
// if ( mDefaultZoomLevel > 20 ) {
|
||||
// mDefaultZoomLevel = 20;
|
||||
// }
|
||||
// } else {
|
||||
// mDefaultZoomLevel -= 2f;
|
||||
// if ( mDefaultZoomLevel < 1 ) {
|
||||
// mDefaultZoomLevel = 1;
|
||||
// }
|
||||
// }
|
||||
// changeZoom( ( int ) mDefaultZoomLevel );
|
||||
// }
|
||||
// return MapControlResult.SUCCESS;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MapControlResult changeZoom( float zoom ) {
|
||||
// Logger.d( TAG, "changeZoom %s", zoom );
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// getMap().changeZoom( zoom );
|
||||
// return MapControlResult.SUCCESS;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void changeMapMode( EnumMapUI ui ) {
|
||||
// if ( ui == null ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( checkAMapView() ) {
|
||||
// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
// if ( options == null ) {
|
||||
// options = new AMapNaviViewOptions();
|
||||
// }
|
||||
// switch ( ui ) {
|
||||
// case CarUp_2D:
|
||||
// case CarUp_3D:
|
||||
// case NorthUP_2D:
|
||||
// setUIMode( ui, options );
|
||||
// return;
|
||||
// case Type_Light:
|
||||
// options.setNaviNight( false );
|
||||
// break;
|
||||
// case Type_Night:
|
||||
// options.setNaviNight( true );
|
||||
// break;
|
||||
// case Type_AUTO_LIGHT_Night:
|
||||
// options.setNaviNight( false );
|
||||
// options.setAutoNaviViewNightMode( true );
|
||||
// break;
|
||||
// }
|
||||
// mMapView.setViewOptions( options );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void setUIMode( EnumMapUI ui, AMapNaviViewOptions options ) {
|
||||
// this.mCurrentUIMode = ui;
|
||||
// switch ( ui ) {
|
||||
// case CarUp_2D:
|
||||
// case CarUp_3D:
|
||||
// mMapView.setNaviMode( AMapNaviView.CAR_UP_MODE );
|
||||
// break;
|
||||
// case NorthUP_2D:
|
||||
// mMapView.setNaviMode( AMapNaviView.NORTH_UP_MODE );
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// Logger.d( TAG, "mCurrentUIMode--->" + mCurrentUIMode.name() );
|
||||
// if ( options == null ) {
|
||||
// return;
|
||||
// }
|
||||
// switch ( ui ) {
|
||||
// case CarUp_2D:
|
||||
// case NorthUP_2D:
|
||||
// options.setTilt( 0 );
|
||||
// break;
|
||||
// case CarUp_3D:
|
||||
// options.setTilt( 60 );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private boolean checkAMapView() {
|
||||
// if ( mMapView == null ) {
|
||||
// Logger.e( TAG, "高德mapView实例为空,请检查" );
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void moveToCenter( MogoLatLng latLng, boolean animate ) {
|
||||
// Logger.d( TAG, "move to center %s", latLng );
|
||||
// if ( latLng == null || latLng.lat == 0.0d || latLng.lng == 0.0d ) {
|
||||
// Logger.e( TAG, "latlng = null or is illegal" );
|
||||
// return;
|
||||
// }
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// loseLockMode();
|
||||
// if ( animate ) {
|
||||
// mMapView.getMap().animateCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
// } else {
|
||||
// mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showMyLocation( boolean visible ) {
|
||||
// Logger.d( TAG, "showMyLocation1 %s", visible );
|
||||
// if ( visible && NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// if ( checkAMapView() ) {
|
||||
// MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
// style.showMyLocation( visible );
|
||||
// if ( visible ) {
|
||||
// // 强制刷新一遍车标
|
||||
// style.myLocationIcon( BitmapDescriptorFactory.fromResource( mCarCursorOption.getCarCursorRes() ) );
|
||||
// }
|
||||
// mMapView.getMap().setMyLocationStyle( style );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showMyLocation( View view ) {
|
||||
// if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// if ( checkAMapView() ) {
|
||||
// MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
// style.showMyLocation( true );
|
||||
// style.myLocationIcon( BitmapDescriptorFactory.fromView( view ) );
|
||||
// mMapView.getMap().setMyLocationStyle( style );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void initMyLocation() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.getMap().setMyLocationEnabled( true );
|
||||
// MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
// style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
|
||||
// style.interval( 1000 );
|
||||
// style.anchor( 0.5F, 0.5F );
|
||||
// style.strokeColor( Color.TRANSPARENT );
|
||||
// style.strokeWidth( 0 );
|
||||
// style.radiusFillColor( Color.TRANSPARENT );
|
||||
// mMapView.getMap().setMyLocationStyle( style );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void recoverLockMode() {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "锁车" );
|
||||
// mMapView.recoverLockMode();
|
||||
// mIsCarLocked = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loseLockMode() {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "解锁锁车" );
|
||||
// mockTouchEvent();
|
||||
// mIsCarLocked = false;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 模拟点击事件,达到锁车->普通事件
|
||||
// */
|
||||
// private void mockTouchEvent() {
|
||||
// long downTime = SystemClock.uptimeMillis();
|
||||
// long eventTime = downTime + 1;
|
||||
// int metaState = 0;
|
||||
// MotionEvent motionEvent = MotionEvent.obtain( downTime, eventTime, MotionEvent.ACTION_DOWN, 0, 0, metaState );
|
||||
// mMapView.dispatchTouchEvent( motionEvent );
|
||||
// MotionEvent upEvent = MotionEvent.obtain( downTime + 1, eventTime + 2, MotionEvent.ACTION_UP, 0, 0, metaState );
|
||||
// mMapView.dispatchTouchEvent( upEvent );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setLockZoom( int var1 ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "Zoom锁定锁车比例尺 %s", var1 );
|
||||
// mMapView.setLockZoom( var1 );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void displayOverview( Rect bounds ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
// loseLockMode();
|
||||
// NaviClient.getInstance( getContext() ).displayOverview( bounds );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float getScalePerPixel() {
|
||||
// return getMap().getScalePerPixel();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float getZoomLevel() {
|
||||
// return getMap().getZoomLevel();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviStarted() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.setCarOverlayVisible( true );
|
||||
// showMyLocation( false );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviStopped() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.setCarOverlayVisible( false );
|
||||
// showMyLocation( true );
|
||||
// NaviClient.getInstance( getContext() ).startAimlessMode();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviInfoUpdat( NaviInfo naviInfo ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCalculateSuccess() {
|
||||
// loseLockMode();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCameraChange( CameraPosition cameraPosition ) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCameraChangeFinish( CameraPosition cameraPosition ) {
|
||||
// if ( cameraPosition != null ) {
|
||||
// Trace.beginSection( "timer.onCameraChangeFinish" );
|
||||
// MogoMapListenerHandler.getInstance().onMapChanged( ObjectUtils.fromAMap( cameraPosition.target ),
|
||||
// cameraPosition.zoom,
|
||||
// cameraPosition.tilt,
|
||||
// cameraPosition.bearing );
|
||||
// Trace.endSection();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MogoLatLng getCameraNorthEastPosition() {
|
||||
// try {
|
||||
// return ObjectUtils.fromAMap( mMapView.getMap().getProjection().getVisibleRegion().latLngBounds.northeast );
|
||||
// } catch ( Exception e ) {
|
||||
//
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MogoLatLng getCameraSouthWestPosition() {
|
||||
// try {
|
||||
// return ObjectUtils.fromAMap( mMapView.getMap().getProjection().getVisibleRegion().latLngBounds.southwest );
|
||||
// } catch ( Exception e ) {
|
||||
//
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MogoLatLng getWindowCenterLocation() {
|
||||
// try {
|
||||
// return ObjectUtils.fromAMap( mMapView.getMap().getCameraPosition().target );
|
||||
// } catch ( Exception e ) {
|
||||
//
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setPointToCenter( double mapCenterX, double mapCenterY ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY );
|
||||
//// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
//// options.setPointToCenter( mapCenterX, mapCenterY );
|
||||
//// mMapView.setViewOptions( options );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Point getLocationPointInScreen( MogoLatLng latLng ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// try {
|
||||
// return MapTools.INSTANCE.toScreenLocation( ObjectUtils.fromMogo( latLng ) );
|
||||
// } catch ( Exception e ) {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MogoLatLng getLocationMogoLatLngInScreen( Point point ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// try {
|
||||
// return ObjectUtils.fromAMap(
|
||||
// MapTools.INSTANCE.fromScreenLocation( point ) );
|
||||
// } catch ( Exception e ) {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator,
|
||||
// long duration ) {
|
||||
// if ( marker == null || high <= 0.0f || interpolator == null || duration < 0 ) {
|
||||
// return;
|
||||
// }
|
||||
// try {
|
||||
//// final LatLng latLng = ObjectUtils.fromMogo2( marker.getPosition() );
|
||||
//// Point point = mMapView.getMap().getProjection().toScreenLocation( latLng );
|
||||
//// point.y -= WindowUtils.dip2px( getContext(), high );
|
||||
//// LatLng target = mMapView.getMap().getProjection().fromScreenLocation( point );
|
||||
//// //使用TranslateAnimation,填写一个需要移动的目标点
|
||||
//// Animation animation = new TranslateAnimation( target );
|
||||
//// animation.setInterpolator( interpolator );
|
||||
//// //整个移动所需要的时间
|
||||
//// animation.setDuration( duration );
|
||||
//// //设置动画
|
||||
//// if ( marker instanceof AMapMarkerWrapper ) {
|
||||
//// ( ( AMapMarkerWrapper ) marker ).getMarker().setAnimation( animation );
|
||||
//// ( ( AMapMarkerWrapper ) marker ).getMarker().startAnimation();
|
||||
//// }
|
||||
// } catch ( Exception e ) {
|
||||
// Logger.e( TAG, e, "error." );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setRenderFps( int fps ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( mMapView.getMapAutoViewHelper() != null ) {
|
||||
//// mMapView.getMapAutoViewHelper().setRenderFps( fps );
|
||||
// Logger.d( TAG, "设置刷新帧率 fps = %s", fps );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
|
||||
// if ( !checkAMapView() ) {
|
||||
// return;
|
||||
// }
|
||||
// try {
|
||||
//// if ( DebugConfig.isDebug() ) {
|
||||
//// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
//// }
|
||||
//// LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds( carPosition, lonLats, lockCarPosition );
|
||||
//// if ( !lockCarPosition ) {
|
||||
//// loseLockMode();
|
||||
//// }
|
||||
//// mMapView.getMapAutoViewHelper().moveCamera( new CameraUpdate(new MapCameraMessage( latLngBounds, bound.left, bound.right, bound.top, bound.bottom ) ));
|
||||
// } catch ( Exception e ) {
|
||||
// Logger.e( TAG, e, "%s error.", tag );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void forceRender() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.getMapAutoViewHelper().runOnDrawFrame();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception {
|
||||
// if ( p1 == null || p2 == null ) {
|
||||
// throw new Exception( "计算距离的点不能为 null" );
|
||||
// }
|
||||
// return AMapUtils.calculateLineDistance( ObjectUtils.fromMogo2( p1 ), ObjectUtils.fromMogo2( p2 ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMyLocationChange( Location location ) {
|
||||
// NaviClient.getInstance( getContext() ).syncCarLocation( location );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EnumMapUI getCurrentUiMode() {
|
||||
// return mCurrentUIMode;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void changeMyLocation( Location location ) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public synchronized boolean isCarLocked() {
|
||||
// return mIsCarLocked;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setCarCursorOption( CarCursorOption option ) {
|
||||
// if ( mCarCursorOption != null && mCarCursorOption != DEFAULT_OPTION ) {
|
||||
// mCarCursorOption.destroy();
|
||||
// }
|
||||
// if ( option != null ) {
|
||||
// try {
|
||||
// mCarCursorOption = option.clone();
|
||||
// } catch ( Exception e ) {
|
||||
// mCarCursorOption = DEFAULT_OPTION;
|
||||
// }
|
||||
// } else {
|
||||
// mCarCursorOption = DEFAULT_OPTION;
|
||||
// }
|
||||
// if ( !checkAMapView() ) {
|
||||
// return;
|
||||
// }
|
||||
//// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
//// if ( options != null && mCarCursorOption.getNaviCursorRes() != 0 ) {
|
||||
//// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), mCarCursorOption.getNaviCursorRes() ) );
|
||||
//// } else {
|
||||
//// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), DEFAULT_OPTION.getNaviCursorRes() ) );
|
||||
//// }
|
||||
//// mMapView.setViewOptions( options );
|
||||
//
|
||||
// if ( mMapView.getMapAutoViewHelper() == null ) {
|
||||
// return;
|
||||
// }
|
||||
// MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
|
||||
// if ( mCarCursorOption.getCarCursorBmp() != null && !mCarCursorOption.getCarCursorBmp().isRecycled() ) {
|
||||
//// style.myLocationIcon( BitmapDescriptorFactory.fromBitmap( mCarCursorOption.getCarCursorBmp() ) );
|
||||
// } else {
|
||||
// if ( mCarCursorOption.getCarCursorRes() != 0 ) {
|
||||
// style.myLocationIcon( mCarCursorOption.getCarCursorRes());
|
||||
// } else {
|
||||
// style.myLocationIcon( mCarCursorOption.getCarCursorRes());
|
||||
// }
|
||||
// }
|
||||
// mMapView.getMapAutoViewHelper().setMyLocationStyle( style );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MapCameraPosition getMapCameraPosition() {
|
||||
// if ( checkAMapView() ) {
|
||||
//// CameraPosition cameraPosition = mMapView.getMap().getCameraPosition();
|
||||
//// return ObjectUtils.fromAMap( cameraPosition );
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void changeBearing( float bearing ) {
|
||||
// if ( checkAMapView() ) {
|
||||
//// mMapView.getMap().moveCamera( CameraUpdateFactory.changeBearing( bearing ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.Location location) {
|
||||
// Location sysLocation = new Location(location.getProvider());
|
||||
// sysLocation.setAltitude(location.getAltitude());
|
||||
// sysLocation.setLatitude(location.getLat());
|
||||
// sysLocation.setLongitude(location.getLon());
|
||||
// sysLocation.setSpeed(location.getSpeed());
|
||||
// NaviClient.getInstance( getContext() ).syncCarLocation(sysLocation);
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 代理高德地图UiSettings
|
||||
*/
|
||||
public class AMapUiSettingsWrapper implements IMogoUiSettings {
|
||||
|
||||
private MapAutoViewHelper mUiSettings;
|
||||
|
||||
public AMapUiSettingsWrapper( MapAutoViewHelper mUiSettings ) {
|
||||
this.mUiSettings = mUiSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScaleControlsEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZoomControlsEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
mUiSettings.setZoomGesturesEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompassEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
if(enabled){
|
||||
mUiSettings.showDirection();
|
||||
}else{
|
||||
mUiSettings.hiddenDirection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMyLocationButtonEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
if(enabled){
|
||||
mUiSettings.showLocation();
|
||||
}else{
|
||||
mUiSettings.hiddenLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScrollGesturesEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
mUiSettings.setScrollGesturesEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZoomGesturesEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
mUiSettings.setZoomGesturesEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTiltGesturesEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
mUiSettings.setTiltGesturesEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotateGesturesEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
mUiSettings.setRotateGesturesEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllGesturesEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
mUiSettings.setAllGesturesEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIndoorSwitchEnabled( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
|
||||
// mUiSettings.setIndoorSwitchEnabled( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogoEnable( boolean enabled ) {
|
||||
if ( mUiSettings != null ) {
|
||||
try {
|
||||
Method method = mUiSettings.getClass().getMethod( "setLogoEnable", boolean.class );
|
||||
method.setAccessible( true );
|
||||
method.invoke( mUiSettings, enabled );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,734 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.custom.navi.NaviClient;
|
||||
import com.mogo.map.impl.custom.utils.MogoMapUtils;
|
||||
import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.inner.common.MapHelper;
|
||||
import com.zhidaoauto.map.sdk.open.MapParams;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapTouchListener;
|
||||
import com.zhidaoauto.map.sdk.open.location.LocationListener;
|
||||
import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerInfo;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, LocationListener, OnMapLoadedListener,
|
||||
OnMapClickListener, OnMapTouchListener, Marker.OnMarkClickListener {
|
||||
|
||||
private static final String TAG = "AMapViewWrapper";
|
||||
private final MapAutoView mMapView;
|
||||
private IMogoMap mIMap;
|
||||
|
||||
private AMapMarkerClickHandler mMarkerClickHandler;
|
||||
private EnumMapUI mCurrentUIMode;
|
||||
|
||||
private boolean mIsCarLocked = false;
|
||||
|
||||
private float mDefaultZoomLevel = 7.0f;
|
||||
private final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
|
||||
.carCursorRes(R.drawable.map_api_ic_current_location2)
|
||||
.naviCursorRes(R.drawable.ic_amap_navi_cursor)
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
|
||||
public AMapViewWrapper(MapAutoView mMapView) {
|
||||
Log.i(TAG, "autoop--AMapViewWrapper: init");
|
||||
this.mMapView = mMapView;
|
||||
this.mIMap = new AMapWrapper(this.mMapView.getMapAutoViewHelper(), this.mMapView, this);
|
||||
}
|
||||
|
||||
private void initMapView() {
|
||||
if (mMapView == null) {
|
||||
return;
|
||||
}
|
||||
MapAutoViewHelper options = mMapView.getMapAutoViewHelper();
|
||||
if (options != null) {
|
||||
// 设置是否开启自动黑夜模式切换,默认为false,不自动切换
|
||||
options.setAutoSwitchStyle(false);
|
||||
// 设置6秒后是否自动锁车
|
||||
// options.setAutoLockCar( false );
|
||||
// 设置路线上的摄像头气泡是否显示
|
||||
// options.setCameraBubbleShow( true );
|
||||
// 设置路线相关的配置属性,如:路线的路况颜色,路线上是否显示摄像头气泡等。
|
||||
// options.setRouteOverlayOptions( MapStyleUtils.getRouteOverlayOptions() );
|
||||
// 设置自车的图片对象
|
||||
// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), DEFAULT_OPTION.getNaviCursorRes() ) );
|
||||
// 设置指南针图标否在导航界面显示,默认显示。true,显示;false,隐藏。
|
||||
options.hiddenDirection();
|
||||
// 黑夜模式
|
||||
options.setMapStyle(MapParams.MAP_STYLE_NIGHT);
|
||||
//设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
|
||||
// options.setTrafficBarEnabled( false );
|
||||
// 设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
// options.setTrafficLayerEnabled( false );
|
||||
// 设置导航界面是否显示路线全览按钮。
|
||||
// options.setRouteListButtonShow( false );
|
||||
// 设置导航状态下屏幕是否一直开启。
|
||||
// options.setScreenAlwaysBright( true );
|
||||
// 设置交通播报是否打开(只适用于驾车导航,需要联网)。
|
||||
// options.setTrafficInfoUpdateEnabled( true );
|
||||
// 设置摄像头播报是否打开(只适用于驾车导航)。
|
||||
// options.setCameraInfoUpdateEnabled( true );
|
||||
// 设置菜单按钮是否在导航界面显示。
|
||||
// options.setSettingMenuEnabled( false );
|
||||
// 设置是否绘制显示交通路况的线路(彩虹线),拥堵-红色,畅通-绿色,缓慢-黄色,未知-蓝色。默认不绘制彩虹线。
|
||||
// options.setTrafficLine( true );
|
||||
// 设置是否绘制牵引线(当前位置到目的地的指引线)。默认不绘制牵引线。
|
||||
// options.setLeaderLineEnabled( -1 );
|
||||
// 设置导航界面UI是否显示。
|
||||
// options.setLayoutVisible( false );
|
||||
// 设置是否自动画路
|
||||
// options.setAutoDrawRoute( false );
|
||||
// 设置是否显示路口放大图(实景图)
|
||||
// options.setRealCrossDisplayShow( false );
|
||||
// 设置是否显示路口放大图(路口模型图)
|
||||
// options.setModeCrossDisplayShow( false );
|
||||
// 设置是否显示道路信息view
|
||||
// options.setLaneInfoShow( false );
|
||||
// 设置是否自动改变缩放等级
|
||||
// options.setAutoChangeZoom( false );
|
||||
// 设置是否自动全览模式,即在算路成功后自动进入全览模式
|
||||
// options.setAutoDisplayOverview( false );
|
||||
// 设置路线转向箭头隐藏和显示
|
||||
// options.setNaviArrowVisible( false );
|
||||
// 通过路线是否自动置灰,仅支持驾车导航
|
||||
// options.setAfterRouteAutoGray( true );
|
||||
options.setZoom(((int) mDefaultZoomLevel));
|
||||
// options.setPointToCenter( 0.5D, 0.5D );
|
||||
// 2D模式
|
||||
options.setMapViewPerspective(MapParams.MAP_PERSPECTIVE_2D);
|
||||
// mMapView.setViewOptions( options );
|
||||
}
|
||||
// mMapView.setRouteOverlayVisible( false );
|
||||
// mMapView.setCarOverlayVisible( false );
|
||||
setUIMode(EnumMapUI.CarUp_2D);
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
|
||||
mMapView.setOnMarkClickListener(this);
|
||||
mMarkerClickHandler = new AMapMarkerClickHandler();
|
||||
mMapView.setOnMapLoadedListener(this);
|
||||
mMapView.setOnMapTouchListener(this);
|
||||
mMapView.setOnMapClickListener(this);
|
||||
mMapView.getLocationClient().registerListener(this);
|
||||
|
||||
// mMapView.setOnPolylineClickListener( this );
|
||||
// mMapView.setAMapNaviViewListener( this );
|
||||
// mMapView.setOnCameraChangeListener( this );
|
||||
//
|
||||
// final AMap aMap = mMapView.getMap();
|
||||
// if ( aMap != null ) {
|
||||
// aMap.setOnPOIClickListener( this );
|
||||
// aMap.setOnMapClickListener( this );
|
||||
// aMap.setOnCameraChangeListener( this );
|
||||
// aMap.setOnMyLocationChangeListener( this );
|
||||
// }
|
||||
// AMapMessageManager.getInstance().registerAMapMessageListener( this );
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
return mMapView.getContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getMapView() {
|
||||
return mMapView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMap getMap() {
|
||||
return mIMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
if (mMapView != null) {
|
||||
mMapView.onCreate(bundle);
|
||||
Logger.d(TAG, "map onCreate");
|
||||
// initMapView();
|
||||
initListeners();
|
||||
// initMyLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
if (mMapView != null) {
|
||||
mMapView.onResume();
|
||||
Logger.d(TAG, "map onResume");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (mMapView != null) {
|
||||
mMapView.onPause();
|
||||
Logger.d(TAG, "map onPause");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (mMapView != null) {
|
||||
mMapView.onDestroy();
|
||||
Logger.d(TAG, "map onDestroy");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
if (mMapView != null) {
|
||||
mMapView.onSaveInstanceState(outState);
|
||||
Logger.d(TAG, "map onSaveInstanceState");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 地图marker点击
|
||||
*/
|
||||
// @Override
|
||||
// public boolean onMarkerClick( Marker marker ) {
|
||||
// return mMarkerClickHandler.handleMarkerClicked( marker );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * POI 点击
|
||||
// */
|
||||
// @Override
|
||||
// public void onPOIClick( Poi poi ) {
|
||||
// if ( InterceptorHandler.getInstance().ignorePoiClicked( getContext() ) ) {
|
||||
// return;
|
||||
// }
|
||||
// MogoMapListenerHandler.getInstance().onPOIClick( ObjectUtils.fromAMap( poi ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMapClick( LatLng latLng ) {
|
||||
// if ( InterceptorHandler.getInstance().ignoreMapClicked( getContext() ) ) {
|
||||
// return;
|
||||
// }
|
||||
// MogoMapListenerHandler.getInstance().onMapClick( ObjectUtils.fromAMap( latLng ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPolylineClick( Polyline polyline ) {
|
||||
// if ( !NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
// NaviClient.getInstance( getContext() ).handleClickedPolyline( polyline );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
@Override
|
||||
public void setTrafficEnabled(boolean visible) {
|
||||
if (checkAMapView()) {
|
||||
// mMapView.setTrafficLine( visible );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom(boolean zoom) {
|
||||
if (checkAMapView()) {
|
||||
mDefaultZoomLevel = (int) (getMap().getZoomLevel() + 0.5f);
|
||||
|
||||
if (zoom) {
|
||||
if (mDefaultZoomLevel >= 7) {
|
||||
return MapControlResult.TARGET;
|
||||
}
|
||||
} else {
|
||||
if (mDefaultZoomLevel <= 0) {
|
||||
return MapControlResult.TARGET;
|
||||
}
|
||||
}
|
||||
|
||||
if (zoom) {
|
||||
mDefaultZoomLevel += 1f;
|
||||
if (mDefaultZoomLevel > 7) {
|
||||
mDefaultZoomLevel = 7;
|
||||
}
|
||||
} else {
|
||||
mDefaultZoomLevel -= 1f;
|
||||
if (mDefaultZoomLevel < 0) {
|
||||
mDefaultZoomLevel = 0;
|
||||
}
|
||||
}
|
||||
changeZoom((int) mDefaultZoomLevel);
|
||||
}
|
||||
return MapControlResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom(float zoom) {
|
||||
Logger.d(TAG, "changeZoom %s", zoom);
|
||||
if (DebugConfig.isDebug()) {
|
||||
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
|
||||
}
|
||||
|
||||
getMap().changeZoom(zoom);
|
||||
return MapControlResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapMode(EnumMapUI ui) {
|
||||
if (ui == null) {
|
||||
return;
|
||||
}
|
||||
if ( checkAMapView() ) {
|
||||
switch ( ui ) {
|
||||
case CarUp_2D:
|
||||
case CarUp_3D:
|
||||
case NorthUP_2D:
|
||||
//setUIMode( ui, options );
|
||||
return;
|
||||
case Type_Light:
|
||||
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
|
||||
mMapView.getMapAutoViewHelper().setMapStyle(MapHelper.INSTANCE.getMMapParams().MAP_STYLE_DAY);
|
||||
break;
|
||||
case Type_Night:
|
||||
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
|
||||
mMapView.getMapAutoViewHelper().setMapStyle(MapHelper.INSTANCE.getMMapParams().MAP_STYLE_NIGHT);
|
||||
break;
|
||||
case Type_AUTO_LIGHT_Night:
|
||||
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( true );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng) {
|
||||
|
||||
}
|
||||
|
||||
private void setUIMode(EnumMapUI ui) {
|
||||
this.mCurrentUIMode = ui;
|
||||
switch (ui) {
|
||||
case CarUp_2D:
|
||||
mMapView.getMapAutoViewHelper().setMapViewPerspective(MapParams.MAP_PERSPECTIVE_2D);
|
||||
break;
|
||||
case CarUp_3D:
|
||||
mMapView.getMapAutoViewHelper().setMapViewPerspective(MapParams.MAP_PERSPECTIVE_3D);
|
||||
break;
|
||||
case NorthUP_2D:
|
||||
mMapView.getMapAutoViewHelper().setRotateGesturesEnabled(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkAMapView() {
|
||||
if (mMapView == null || mMapView.getMapAutoViewHelper() == null) {
|
||||
Logger.e(TAG, "高德mapView实例为空,请检查");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
Logger.d(TAG, "move to center %s", latLng);
|
||||
if (latLng == null || latLng.lat == 0.0d || latLng.lng == 0.0d) {
|
||||
Logger.e(TAG, "latlng = null or is illegal");
|
||||
return;
|
||||
}
|
||||
if (DebugConfig.isDebug()) {
|
||||
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
|
||||
}
|
||||
loseLockMode();
|
||||
mMapView.getMapAutoViewHelper().animateCamera(new LonLatPoint(latLng.lon, latLng.lat));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation(boolean visible) {
|
||||
Logger.d(TAG, "showMyLocation1 %s", visible);
|
||||
if (visible && NaviClient.getInstance(getContext()).isNaviing()) {
|
||||
return;
|
||||
}
|
||||
// if (DebugConfig.isDebug()) {
|
||||
// Logger.d(TAG, Log.getStackTraceString(new Throwable()));
|
||||
// }
|
||||
if (checkAMapView()) {
|
||||
MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
|
||||
if (visible) {
|
||||
// 强制刷新一遍车标
|
||||
style.myLocationIcon(mCarCursorOption.getCarCursorRes());
|
||||
}
|
||||
mMapView.getMapAutoViewHelper().setMyLocationStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation(View view) {
|
||||
if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
return;
|
||||
}
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
if ( checkAMapView() ) {
|
||||
MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
|
||||
// style.myLocationIcon( BitmapDescriptorFactory.fromView( view ) );
|
||||
mMapView.getMapAutoViewHelper().setMyLocationStyle( style );
|
||||
}
|
||||
}
|
||||
|
||||
public void initMyLocation() {
|
||||
if (checkAMapView()) {
|
||||
mMapView.getMapAutoViewHelper().setMyLocationEnabled(true);
|
||||
MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
|
||||
style.setLocationType(MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER);
|
||||
style.interval(1000);
|
||||
// style.anchor( 0.5F, 0.5F );
|
||||
// style.strokeColor( Color.TRANSPARENT );
|
||||
// style.strokeWidth( 0 );
|
||||
// style.radiusFillColor( Color.TRANSPARENT );
|
||||
mMapView.getMapAutoViewHelper().setMyLocationStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recoverLockMode() {
|
||||
if (checkAMapView()) {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
Logger.d(TAG, "锁车");
|
||||
// mMapView.recoverLockMode();
|
||||
mIsCarLocked = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loseLockMode() {
|
||||
if (DebugConfig.isDebug()) {
|
||||
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
|
||||
}
|
||||
Logger.d(TAG, "解锁锁车");
|
||||
mockTouchEvent();
|
||||
mIsCarLocked = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockZoom(int var1) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview(Rect bounds) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟点击事件,达到锁车->普通事件
|
||||
*/
|
||||
private void mockTouchEvent() {
|
||||
long downTime = SystemClock.uptimeMillis();
|
||||
long eventTime = downTime + 1;
|
||||
int metaState = 0;
|
||||
MotionEvent motionEvent = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, 0, 0, metaState);
|
||||
mMapView.dispatchTouchEvent(motionEvent);
|
||||
MotionEvent upEvent = MotionEvent.obtain(downTime + 1, eventTime + 2, MotionEvent.ACTION_UP, 0, 0, metaState);
|
||||
mMapView.dispatchTouchEvent(upEvent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getScalePerPixel() {
|
||||
return getMap().getScalePerPixel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getZoomLevel() {
|
||||
return getMap().getZoomLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraSouthWestPosition() {
|
||||
// try {
|
||||
// return ObjectUtils.fromAMap( mMapView.getMapAutoViewHelper().getProjection().getVisibleRegion().latLngBounds.southwest );
|
||||
// } catch ( Exception e ) {
|
||||
//
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getWindowCenterLocation() {
|
||||
try {
|
||||
return ObjectUtils.fromAMap(mMapView.getMapAutoViewHelper().getCenter());
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPointToCenter(double mapCenterX, double mapCenterY) {
|
||||
if (checkAMapView()) {
|
||||
// if (DebugConfig.isDebug()) {
|
||||
// Logger.d(TAG, Log.getStackTraceString(new Throwable()));
|
||||
// }
|
||||
Logger.d(TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY);
|
||||
mMapView.getMapAutoViewHelper().setPointToCenter((float) mapCenterX, (float) mapCenterY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getLocationPointInScreen(MogoLatLng latLng) {
|
||||
if (checkAMapView()) {
|
||||
try {
|
||||
return MapTools.INSTANCE.toScreenLocation(ObjectUtils.fromMogo(latLng));
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
|
||||
if (checkAMapView()) {
|
||||
try {
|
||||
return ObjectUtils.fromAMap(
|
||||
MapTools.INSTANCE.fromScreenLocation(point));
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
|
||||
long duration) {
|
||||
if (marker == null || high <= 0.0f || interpolator == null || duration < 0) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// final LatLng latLng = ObjectUtils.fromMogo2( marker.getPosition() );
|
||||
// Point point = mMapView.getMap().getProjection().toScreenLocation( latLng );
|
||||
// point.y -= WindowUtils.dip2px( getContext(), high );
|
||||
// LatLng target = mMapView.getMap().getProjection().fromScreenLocation( point );
|
||||
// //使用TranslateAnimation,填写一个需要移动的目标点
|
||||
// Animation animation = new TranslateAnimation( target );
|
||||
// animation.setInterpolator( interpolator );
|
||||
// //整个移动所需要的时间
|
||||
// animation.setDuration( duration );
|
||||
// //设置动画
|
||||
// if ( marker instanceof AMapMarkerWrapper ) {
|
||||
// ( ( AMapMarkerWrapper ) marker ).getMarker().setAnimation( animation );
|
||||
// ( ( AMapMarkerWrapper ) marker ).getMarker().startAnimation();
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "error.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderFps(int fps) {
|
||||
if (checkAMapView()) {
|
||||
if (mMapView.getMapAutoViewHelper() != null) {
|
||||
// mMapView.getMapAutoViewHelper().setRenderFps( fps );
|
||||
Logger.d(TAG, "设置刷新帧率 fps = %s", fps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBounds(String tag, MogoLatLng carPosition, List<MogoLatLng> lonLats, Rect bound, boolean lockCarPosition) {
|
||||
if (!checkAMapView()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds( carPosition, lonLats, lockCarPosition );
|
||||
// if ( !lockCarPosition ) {
|
||||
// loseLockMode();
|
||||
// }
|
||||
// mMapView.getMapAutoViewHelper().moveCamera( new CameraUpdate(new MapCameraMessage( latLngBounds, bound.left, bound.right, bound.top, bound.bottom ) ));
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "%s error.", tag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceRender() {
|
||||
if (checkAMapView()) {
|
||||
mMapView.getMapAutoViewHelper().runOnDrawFrame();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateLineDistance(MogoLatLng p1, MogoLatLng p2) throws Exception {
|
||||
if (p1 == null || p2 == null) {
|
||||
throw new Exception("计算距离的点不能为 null");
|
||||
}
|
||||
return MogoMapUtils.calculateLineDistance(ObjectUtils.fromMogo(p1), ObjectUtils.fromMogo(p2));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
return mCurrentUIMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation(Location location) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isCarLocked() {
|
||||
return mIsCarLocked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCarCursorOption(CarCursorOption option) {
|
||||
if (mCarCursorOption != null && mCarCursorOption != DEFAULT_OPTION) {
|
||||
mCarCursorOption.destroy();
|
||||
}
|
||||
if (option != null) {
|
||||
try {
|
||||
mCarCursorOption = option.clone();
|
||||
} catch (Exception e) {
|
||||
mCarCursorOption = DEFAULT_OPTION;
|
||||
}
|
||||
} else {
|
||||
mCarCursorOption = DEFAULT_OPTION;
|
||||
}
|
||||
if (!checkAMapView()) {
|
||||
return;
|
||||
}
|
||||
// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
// if ( options != null && mCarCursorOption.getNaviCursorRes() != 0 ) {
|
||||
// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), mCarCursorOption.getNaviCursorRes() ) );
|
||||
// } else {
|
||||
// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), DEFAULT_OPTION.getNaviCursorRes() ) );
|
||||
// }
|
||||
// mMapView.setViewOptions( options );
|
||||
|
||||
if (mMapView.getMapAutoViewHelper() == null) {
|
||||
return;
|
||||
}
|
||||
MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
|
||||
if (mCarCursorOption.getCarCursorBmp() != null && !mCarCursorOption.getCarCursorBmp().isRecycled()) {
|
||||
// style.myLocationIcon( BitmapDescriptorFactory.fromBitmap( mCarCursorOption.getCarCursorBmp() ) );
|
||||
} else {
|
||||
if (mCarCursorOption.getCarCursorRes() != 0) {
|
||||
style.myLocationIcon(mCarCursorOption.getCarCursorRes());
|
||||
} else {
|
||||
style.myLocationIcon(mCarCursorOption.getCarCursorRes());
|
||||
}
|
||||
}
|
||||
mMapView.getMapAutoViewHelper().setMyLocationStyle(style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCameraPosition getMapCameraPosition() {
|
||||
if (checkAMapView()) {
|
||||
// CameraPosition cameraPosition = mMapView.getMap().getCameraPosition();
|
||||
// return ObjectUtils.fromAMap( cameraPosition );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeBearing(float bearing) {
|
||||
if (checkAMapView()) {
|
||||
// mMapView.getMap().moveCamera( CameraUpdateFactory.changeBearing( bearing ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.Location location) {
|
||||
Location sysLocation = new Location(location.getProvider());
|
||||
sysLocation.setAltitude(location.getAltitude());
|
||||
sysLocation.setLatitude(location.getLat());
|
||||
sysLocation.setLongitude(location.getLon());
|
||||
sysLocation.setSpeed(location.getSpeed());
|
||||
NaviClient.getInstance(getContext()).syncCarLocation(sysLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick(@Nullable LonLatPoint lonLatPoint) {
|
||||
if (InterceptorHandler.getInstance().ignoreMapClicked(getContext())) {
|
||||
return;
|
||||
}
|
||||
MogoMapListenerHandler.getInstance().onMapClick(ObjectUtils.fromAMap(lonLatPoint));
|
||||
}
|
||||
|
||||
private boolean isLoaded = false;
|
||||
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
Log.i(TAG, "autoop--onMapLoaded: " + isLoaded);
|
||||
if (!isLoaded) {
|
||||
isLoaded = true;
|
||||
MogoMapListenerHandler.getInstance().onMapLoaded();
|
||||
}
|
||||
MapAutoViewHelper mapAutoViewHelper = mMapView.getMapAutoViewHelper();
|
||||
MogoMapListenerHandler.getInstance().onMapChanged(ObjectUtils.fromAMap(mapAutoViewHelper.getCenter()), mapAutoViewHelper.getZoom(), 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouch(@Nullable MotionEvent motionEvent) {
|
||||
MogoMapListenerHandler.getInstance().onTouch(motionEvent);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMarkClick(@NotNull MarkerInfo markerInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRoadLoaded(@Nullable String s) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
import com.mogo.map.impl.custom.marker.AMapInfoWindowAdapter;
|
||||
import com.mogo.map.impl.custom.marker.AMapMarkerWrapper;
|
||||
import com.mogo.map.impl.custom.overlay.AMapPolylineWrapper;
|
||||
import com.mogo.map.impl.custom.uicontroller.AMapUIController;
|
||||
import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MultiPointOverlayOptions;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.Polyline;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 代理高德AMap
|
||||
*/
|
||||
public class AMapWrapper implements IMogoMap {
|
||||
|
||||
private static final String TAG = "AMapWrapper";
|
||||
|
||||
private static MapAutoViewHelper sAMap;
|
||||
private IMogoMapUIController mUIcontroller;
|
||||
private MapAutoViewHelper mAMap;
|
||||
private MapAutoView mMapView;
|
||||
private IMogoUiSettings mUiSettings;
|
||||
|
||||
public AMapWrapper(MapAutoViewHelper map, MapAutoView mapView, IMogoMapUIController controller) {
|
||||
Log.i(TAG, "autoop--AMapWrapper: init"+this);
|
||||
this.mAMap = map;
|
||||
sAMap = map;
|
||||
this.mMapView = mapView;
|
||||
mUIcontroller = controller;
|
||||
// 设置实现自定义 info window
|
||||
MapAutoApi.INSTANCE.setInfoWindowAdapter( new AMapInfoWindowAdapter() );
|
||||
AMapUIController.getInstance().initClient(mUIcontroller);
|
||||
}
|
||||
|
||||
public static MapAutoViewHelper getAMap() {
|
||||
return sAMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoUiSettings getUiSettings() {
|
||||
if (!checkAMap()) {
|
||||
return null;
|
||||
}
|
||||
if (mUiSettings == null) {
|
||||
mUiSettings = new AMapUiSettingsWrapper(mAMap);
|
||||
}
|
||||
return mUiSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getUIController() {
|
||||
return mUIcontroller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarker addMarker(String tag, MogoMarkerOptions options) {
|
||||
Log.i(TAG, "autoop-addMarker: " + tag + ",options:" + options + ",AMap:" + (mAMap != null)+",this:"+this);
|
||||
if (!checkAMap()) {
|
||||
return null;
|
||||
}
|
||||
Log.i(TAG, "autoop-addMarker: AMap is not null");
|
||||
MarkerOptions markerOptions = ObjectUtils.fromMogo(options);
|
||||
if (markerOptions == null) {
|
||||
Logger.e(TAG, "marker参数为空");
|
||||
return null;
|
||||
}
|
||||
final IMogoMarker mogoMarker = new AMapMarkerWrapper(mAMap.addMarker(markerOptions), options);
|
||||
if (options.isAutoManager()) {
|
||||
MogoMarkersHandler.getInstance().add(tag, mogoMarker);
|
||||
}
|
||||
return mogoMarker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<IMogoMarker> addMarkers(String tag, ArrayList<MogoMarkerOptions> options, boolean moveToCenter) {
|
||||
if (!checkAMap()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (options == null || options.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 地图导航时,忽略参数
|
||||
if (InterceptorHandler.getInstance().ignoreAddMarkersMoveToCenterParameters(getContext())) {
|
||||
moveToCenter = false;
|
||||
}
|
||||
|
||||
ArrayList<Marker> markers = new ArrayList<>();
|
||||
ArrayList<MarkerOptions> markerOptions = new ArrayList<>();
|
||||
ArrayList<IMogoMarker> mogoMarkers = new ArrayList<>();
|
||||
for (MogoMarkerOptions option : options) {
|
||||
if (option == null) {
|
||||
continue;
|
||||
}
|
||||
MarkerOptions mo = ObjectUtils.fromMogo(option);
|
||||
if (mo == null) {
|
||||
continue;
|
||||
}
|
||||
markerOptions.add(mo);
|
||||
}
|
||||
if (markerOptions.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
MultiPointOverlayOptions multiPointOverlayOptions = new MultiPointOverlayOptions();
|
||||
multiPointOverlayOptions.setData(markerOptions);
|
||||
multiPointOverlayOptions.setIcon(R.drawable.marker_blue);
|
||||
List<MarkerOptions> data = mAMap.addMarkers(multiPointOverlayOptions).getOptions().getData();
|
||||
for (int i = 0 ;i< data.size();i++){
|
||||
markers.add(new Marker(data.get(i)));
|
||||
}
|
||||
if (markers == null || markers.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < markers.size(); i++) {
|
||||
Marker marker = markers.get(i);
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
mogoMarkers.add(new AMapMarkerWrapper(marker, options.get(i)));
|
||||
}
|
||||
MogoMarkersHandler.getInstance().add(tag, mogoMarkers);
|
||||
return mogoMarkers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (checkAMap()) {
|
||||
mAMap.clearPanel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(boolean isKeepMyLocationOverlay) {
|
||||
if (checkAMap()) {
|
||||
mAMap.clearPanel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPointToCenter(int x, int y) {
|
||||
if (checkAMap()) {
|
||||
// mAMap.setPointToCenter(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTouchPoiEnable(boolean touchPoiEnable) {
|
||||
if (checkAMap()) {
|
||||
// TODO: 2020/5/27 jia 设置
|
||||
// mAMap.setTouchPoiEnable( touchPoiEnable );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrafficEnable(boolean enable) {
|
||||
if (checkAMap()) {
|
||||
mAMap.setTrafficEnabled( enable );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBuildings(boolean enabled) {
|
||||
if (checkAMap()) {
|
||||
mAMap.showBuildings( enabled );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showIndoorMap(boolean enable) {
|
||||
if (checkAMap()) {
|
||||
// TODO: 2020/5/27 显示室内地图
|
||||
// mAMap.showIndoorMap( enable );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMapText(boolean enable) {
|
||||
if (checkAMap()) {
|
||||
mAMap.showMapText( enable );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAnimation() {
|
||||
if (checkAMap()) {
|
||||
// TODO: 2020/5/27 停止当前执行的改变地图状态的动画。
|
||||
// mAMap.stopAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getScalePerPixel() {
|
||||
if ( checkAMap() ) {
|
||||
return mAMap.getScalePerPixel();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom(float zoom) {
|
||||
if (checkAMap()) {
|
||||
mAMap.setZoom((int) zoom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getZoomLevel() {
|
||||
if (checkAMap()) {
|
||||
try {
|
||||
return mAMap.getZoom();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoPolyline addPolyline(MogoPolylineOptions options) {
|
||||
if ( checkAMap() ) {
|
||||
PolylineOptions polylineOptions = ObjectUtils.fromMogo( options );
|
||||
if ( polylineOptions == null ) {
|
||||
return null;
|
||||
}
|
||||
Polyline polyline = mAMap.drawLine( polylineOptions );
|
||||
return new AMapPolylineWrapper( polyline, options );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean checkAMap() {
|
||||
mAMap = mMapView.getMapAutoViewHelper();
|
||||
sAMap = mAMap;
|
||||
if (mAMap == null) {
|
||||
Logger.e(TAG, "高德map实例为空,请检查");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
return mMapView.getContext();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-27
|
||||
* <p>
|
||||
* 操作拦截器
|
||||
*/
|
||||
public interface IInterceptor {
|
||||
|
||||
/**
|
||||
* 是否忽略添加多个marker时聚拢参数
|
||||
* <p>
|
||||
* 导航时:不需要聚拢
|
||||
*
|
||||
* @return true - 忽略 false - 不忽略
|
||||
*/
|
||||
boolean ignoreAddMarkersMoveToCenterParameters( Context context );
|
||||
|
||||
/**
|
||||
* 导航时,是否响应 poi 点击
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
boolean ignorePoiClicked( Context context );
|
||||
|
||||
/**
|
||||
* 导航时,是否响应地图点击
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
boolean ignoreMapClicked( Context context );
|
||||
|
||||
/**
|
||||
* 请求绘制路线
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
boolean ignoreDrawRouteOverlay( Context context );
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-27
|
||||
* <p>
|
||||
* 操作拦截器
|
||||
*/
|
||||
public class InterceptorHandler implements IInterceptor {
|
||||
|
||||
private static volatile InterceptorHandler sInstance;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private InterceptorHandler() {
|
||||
}
|
||||
|
||||
public static InterceptorHandler getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( InterceptorHandler.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new InterceptorHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public void init( Context context ) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreAddMarkersMoveToCenterParameters( Context context ) {
|
||||
return false;//NaviClient.getInstance( context ).isNaviing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignorePoiClicked( Context context ) {
|
||||
return false;//NaviClient.getInstance( context ).isNaviing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreMapClicked( Context context ) {
|
||||
return false;//NaviClient.getInstance( context ).isNaviing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreDrawRouteOverlay( Context context ) {
|
||||
return false;//NaviClient.getInstance( context ).isNaviing();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.mogo.map.impl.custom.hook;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-12
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class BnHooker implements InvocationHandler {
|
||||
|
||||
private static final String TAG = "BnHooker";
|
||||
private final Context mContext;
|
||||
|
||||
private Object host;
|
||||
|
||||
public BnHooker(MapAutoViewHelper map, Context context ) throws Exception {
|
||||
|
||||
mContext = context;
|
||||
|
||||
if ( map == null ) {
|
||||
return;
|
||||
}
|
||||
// Field field = AMap.class.getDeclaredField( "a" );
|
||||
// field.setAccessible( true );
|
||||
// host = field.get( map );
|
||||
// Object object = Proxy.newProxyInstance(
|
||||
// BnHooker.class.getClassLoader(),
|
||||
// new Class[]{
|
||||
// com.amap.api.col.n3.ft.a.class,
|
||||
// IAMapDelegate.class,
|
||||
// IAMapListener.class,
|
||||
// IAMap.class
|
||||
// },
|
||||
// this
|
||||
// );
|
||||
// field.set( map, object );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable {
|
||||
// if ( method.getName().equals( "setRenderFps" ) ) {
|
||||
// Logger.d( TAG, "setRenderFps" );
|
||||
// if ( !NaviClient.getInstance( mContext ).isNaviing() ) {
|
||||
// }
|
||||
// return method.invoke( host, 10 );
|
||||
// }
|
||||
// if ( method.getName().equals( "drawFrame" ) ) {
|
||||
// Logger.d( TAG, "drawFrame" );
|
||||
// }
|
||||
// return method.invoke( host, args );
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.mogo.map.impl.custom.location;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Trace;
|
||||
|
||||
import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.location.Location;
|
||||
import com.zhidaoauto.map.sdk.open.location.LocationClient;
|
||||
import com.zhidaoauto.map.sdk.open.location.LocationListener;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-19
|
||||
* <p>
|
||||
* 高德定位
|
||||
*/
|
||||
public class ALocationClient implements IMogoLocationClient {
|
||||
|
||||
private static final String TAG = "LocationClient";
|
||||
|
||||
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
private MogoLocation mLastLocation;
|
||||
private LocationListener mListener = new InternalLocationListener();
|
||||
|
||||
private boolean mIsDestroyed = false;
|
||||
|
||||
public ALocationClient( Context context ) {
|
||||
mClient = new LocationClient( context );
|
||||
mClient.registerListener( mListener );
|
||||
mLastLocation = ObjectUtils.fromLocation( mClient.getLastKnownLocation() );
|
||||
if ( mLastLocation == null ) {
|
||||
mLastLocation = new MogoLocation();
|
||||
}
|
||||
}
|
||||
|
||||
private LocationClient mClient;
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
start( 2_000L );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start( long interval ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( mClient != null ) {
|
||||
// AMapLocationClientOption option = new AMapLocationClientOption();
|
||||
// option.setLocationMode( AMapLocationClientOption.AMapLocationMode.Hight_Accuracy );
|
||||
// option.setNeedAddress( true );
|
||||
// option.setGpsFirst( true );
|
||||
// option.setInterval( interval );
|
||||
// mClient.setLocationOption( option );
|
||||
mClient.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( mClient != null && mClient.isStarted() ) {
|
||||
mClient.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.add( listener );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.remove( listener );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLocation getLastKnowLocation() {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return null;
|
||||
}
|
||||
return mLastLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void destroy() {
|
||||
mIsDestroyed = true;
|
||||
if ( sListeners != null ) {
|
||||
sListeners.clear();
|
||||
}
|
||||
sListeners = null;
|
||||
if ( mClient != null ) {
|
||||
mClient.unRegisterListener( mListener );
|
||||
mClient.stop();
|
||||
}
|
||||
mClient = null;
|
||||
mLastLocation = null;
|
||||
}
|
||||
|
||||
private class InternalLocationListener implements LocationListener {
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@NotNull Location location) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( location == null ||
|
||||
location.getLat() == 0.0D ||
|
||||
location.getLon() == 0.0D ) {
|
||||
return;
|
||||
}
|
||||
Trace.beginSection("timer.onLocationChanged");
|
||||
mLastLocation = ObjectUtils.fromLocation( location );
|
||||
synchronized ( sListeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = sListeners.iterator();
|
||||
while ( listenerIterator.hasNext() ) {
|
||||
listenerIterator.next().onLocationChanged( mLastLocation.clone() );
|
||||
}
|
||||
}
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
private void destroyWarming() {
|
||||
Logger.w( TAG, "location client has destroyed." );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.map.impl.custom.marker;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.map.marker.IMogoInfoWindowAdapter;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 自定义infowindow
|
||||
*/
|
||||
public final class AMapInfoWindowAdapter implements InfoWindowAdapter {
|
||||
|
||||
public View getInfoWindow( Marker marker ) {
|
||||
if ( marker.getMObject() instanceof IMogoMarker ) {
|
||||
IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getMObject() );
|
||||
IMogoInfoWindowAdapter delegate = mogoMarker.getInfoWindowAdapter();
|
||||
if ( delegate != null ) {
|
||||
return delegate.getInfoWindow( mogoMarker );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View getInfoContents(@Nullable Marker marker) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,469 @@
|
||||
package com.mogo.map.impl.custom.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.marker.IMogoInfoWindowAdapter;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerIconViewCreator;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerInfo;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 高德marker
|
||||
*/
|
||||
public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
|
||||
private final String TAG = AMapMarkerWrapper.class.getName();
|
||||
|
||||
private Marker mMarker;
|
||||
private Object mObject;
|
||||
private IMogoMarkerClickListener mMogoMarkerClickListener;
|
||||
private IMogoInfoWindowAdapter mMogoInfoWindowAdapter;
|
||||
|
||||
private boolean mIsDestroy = false;
|
||||
|
||||
private MogoMarkerOptions mMogoMarkerOptions;
|
||||
private String mOwner;
|
||||
|
||||
|
||||
public AMapMarkerWrapper(Marker marker, MogoMarkerOptions mogoMarkerOptions) {
|
||||
this.mMarker = marker;
|
||||
if (marker != null) {
|
||||
// 设置高德 marker 的object对象为 IMogoMarker 实例。!!!!
|
||||
marker.setMObject(this);
|
||||
}
|
||||
setObject(mogoMarkerOptions.getObject());
|
||||
this.mMogoMarkerOptions = mogoMarkerOptions;
|
||||
mMogoMarkerOptions.addObserver(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
if (isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
setMarkerOptions(mMogoMarkerOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (mMogoMarkerOptions != null) {
|
||||
mMogoMarkerOptions.deleteObservers();
|
||||
mMogoMarkerOptions = null;
|
||||
}
|
||||
if (mMarker != null) {
|
||||
mMarker.remove();
|
||||
mMarker.setMObject(null);
|
||||
mMarker = null;
|
||||
}
|
||||
mMogoInfoWindowAdapter = null;
|
||||
mMogoMarkerClickListener = null;
|
||||
mObject = null;
|
||||
mIsDestroy = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideInfoWindow() {
|
||||
if (mMarker != null) {
|
||||
mMarker.hideInfoWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(float alpha) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setAlpha(alpha);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchor(float anchorU, float anchorV) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setAnchor(anchorU, anchorV);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDraggable(boolean paramBoolean) {
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setDraggable( paramBoolean );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcon(Bitmap icon) {
|
||||
if (icon == null || icon.isRecycled()) {
|
||||
return;
|
||||
}
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon(icon);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcons(ArrayList<Bitmap> icons) {
|
||||
if (icons == null || icons.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
|
||||
// for ( Bitmap icon : icons ) {
|
||||
// if ( icon == null || icon.isRecycled() ) {
|
||||
// continue;
|
||||
// }
|
||||
// descriptors.add( BitmapDescriptorFactory.fromBitmap( icon ) );
|
||||
// }
|
||||
// if ( descriptors.isEmpty() ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( mMarker != null ) {
|
||||
// mMarker.setIcons( descriptors );
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInfoWindowEnable(boolean enabled) {
|
||||
if (mMarker != null) {
|
||||
if (enabled) {
|
||||
mMarker.showInfoWindow();
|
||||
} else {
|
||||
mMarker.hideInfoWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkerOptions(MogoMarkerOptions opt) {
|
||||
|
||||
final MarkerOptions options = ObjectUtils.fromMogo(opt);
|
||||
if (options == null) {
|
||||
return;
|
||||
}
|
||||
if (mMarker != null) {
|
||||
mMarker.setMarkerOptions(options);
|
||||
setObject(opt.getObject());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObject(Object object) {
|
||||
mObject = object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
return mObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeriod(int period) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setPeriod(period);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPosition(double lat, double lng) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setPosition(new LonLatPoint(lng,lat));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getPosition() {
|
||||
if (mMarker != null) {
|
||||
final LonLatPoint latLng = mMarker.getPosition();
|
||||
return ObjectUtils.fromAMap(latLng);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotateAngle(float rotate) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setRotateAngle(rotate);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSnippet(String snippet) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setSnippet(snippet);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle(String title) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToTop() {
|
||||
if (mMarker != null) {
|
||||
mMarker.setToTop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZIndex(int zIndex) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setZIndex(zIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showInfoWindow() {
|
||||
if (mMarker != null) {
|
||||
mMarker.showInfoWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMarkerClickListener(IMogoMarkerClickListener listener) {
|
||||
mMogoMarkerClickListener = listener;
|
||||
if(mMarker != null){
|
||||
mMarker.setOnMarkClickListener(new Marker.OnMarkClickListener() {
|
||||
@Override
|
||||
public void onMarkClick(@NotNull MarkerInfo markerInfo) {
|
||||
mMogoMarkerClickListener.onMarkerClicked(AMapMarkerWrapper.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerClickListener getOnMarkerClickListener() {
|
||||
return mMogoMarkerClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInfoWindowAdapter(IMogoInfoWindowAdapter adapter) {
|
||||
mMogoInfoWindowAdapter = adapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoInfoWindowAdapter getInfoWindowAdapter() {
|
||||
return mMogoInfoWindowAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkerIconView(IMogoMarkerIconViewCreator creator) {
|
||||
if (creator != null) {
|
||||
View iconView = creator.createView(this);
|
||||
if (iconView != null) {
|
||||
mMarker.setIcon(iconView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDestroyed() {
|
||||
return mIsDestroy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(String mOwner) {
|
||||
this.mOwner = mOwner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwner() {
|
||||
if (mOwner != null) {
|
||||
return mOwner;
|
||||
}
|
||||
if (mMogoMarkerOptions != null) {
|
||||
return mMogoMarkerOptions.getOwner();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPositionByPixels(Point position) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setPosition(MapTools.INSTANCE.fromScreenLocation(position));
|
||||
}
|
||||
}
|
||||
|
||||
public Marker getMarker() {
|
||||
return mMarker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoMarkerOptions getMogoMarkerOptions() {
|
||||
return mMogoMarkerOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator) {
|
||||
if (isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// ScaleAnimation animationScale = new ScaleAnimation(fromX, toX, fromY, toY);
|
||||
// animationScale.setDuration(duration);
|
||||
// animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
|
||||
// animationScale.setInterpolator(interpolator);
|
||||
//
|
||||
// mMarker.setAnimation(animationScale);
|
||||
// mMarker.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, OnMarkerAnimationListener listener) {
|
||||
if (isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// ScaleAnimation animationScale = new ScaleAnimation(fromX, toX, fromY, toY);
|
||||
// animationScale.setDuration(duration);
|
||||
// animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
|
||||
// animationScale.setInterpolator(interpolator);
|
||||
// animationScale.setAnimationListener(new Animation.AnimationListener() {
|
||||
// @Override
|
||||
// public void onAnimationStart() {
|
||||
// if (isDestroyed()) {
|
||||
// return;
|
||||
// }
|
||||
// if (listener != null) {
|
||||
// listener.onAnimStart();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationEnd() {
|
||||
// if (isDestroyed()) {
|
||||
// return;
|
||||
// }
|
||||
// if (listener != null) {
|
||||
// listener.onAnimEnd();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// mMarker.setAnimation(animationScale);
|
||||
// mMarker.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startJumpAnimation(float high, long duration, Interpolator interpolator, OnMarkerAnimationListener listener) {
|
||||
if (isDestroyed() || high <= 0.0f || interpolator == null || duration < 0) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// final LatLng latLng = ObjectUtils.fromMogo2(getPosition());
|
||||
// Point point = AMapWrapper.getAMap().getProjection().toScreenLocation(latLng);
|
||||
// point.y -= WindowUtils.dip2px(AbsMogoApplication.getApp(), high);
|
||||
// LatLng target = AMapWrapper.getAMap().getProjection().fromScreenLocation(point);
|
||||
// //使用TranslateAnimation,填写一个需要移动的目标点
|
||||
// Animation animation = new TranslateAnimation(target);
|
||||
// animation.setInterpolator(interpolator);
|
||||
// animation.setAnimationListener(new Animation.AnimationListener() {
|
||||
// @Override
|
||||
// public void onAnimationStart() {
|
||||
// if (isDestroyed()) {
|
||||
// return;
|
||||
// }
|
||||
// if (listener != null) {
|
||||
// listener.onAnimStart();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationEnd() {
|
||||
// if (isDestroyed()) {
|
||||
// return;
|
||||
// }
|
||||
// if (listener != null) {
|
||||
// listener.onAnimEnd();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// //整个移动所需要的时间
|
||||
// animation.setDuration(duration);
|
||||
// //设置动画
|
||||
// mMarker.setAnimation(animation);
|
||||
// mMarker.startAnimation();
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "error.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClickable(boolean clickable) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setClickable(clickable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSmooth(List<MogoLatLng> points, int duration) {
|
||||
if (isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mMarker == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (points == null || points.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<LonLatPoint> newPoints = new ArrayList<>();
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
LonLatPoint point = ObjectUtils.fromMogo(points.get(i));
|
||||
if (point == null) {
|
||||
continue;
|
||||
}
|
||||
newPoints.add(point);
|
||||
}
|
||||
if (newPoints.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// mMarker.startSmooth(newPoints,duration);
|
||||
// if (mMovingPointOverlay == null) {
|
||||
// mMovingPointOverlay = new MovingPointOverlay(AMapWrapper.getAMap(), mMarker);
|
||||
// }
|
||||
mMarker.startSmooth(newPoints,duration);
|
||||
// mMovingPointOverlay.setPoints(newPoints);
|
||||
// mMovingPointOverlay.setTotalDuration(duration);
|
||||
// mMovingPointOverlay.startSmoothMove();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.map.impl.custom.message;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-28
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AMapMessageConsts {
|
||||
|
||||
/**
|
||||
* 导航开始
|
||||
*/
|
||||
public static final int MSG_NAVI_START = 1000;
|
||||
/**
|
||||
* 取消导航
|
||||
*/
|
||||
public static final int MSG_NAVI_STOP = 1001;
|
||||
/**
|
||||
* 规划路线成功
|
||||
*/
|
||||
public static final int MSG_CALCULATE_SUCCESS = 1002;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.mogo.map.impl.custom.message;
|
||||
|
||||
|
||||
import com.autonavi.nge.guidance.NaviInfo;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-28
|
||||
* <p>
|
||||
* 消息回调
|
||||
*/
|
||||
public interface AMapMessageListener {
|
||||
|
||||
void onNaviStarted();
|
||||
|
||||
void onNaviStopped();
|
||||
|
||||
void onNaviInfoUpdat( NaviInfo naviInfo );
|
||||
|
||||
void onCalculateSuccess();
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.mogo.map.impl.custom.message;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-28
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AMapMessageManager {
|
||||
|
||||
private static volatile AMapMessageManager sInstance;
|
||||
|
||||
private List< AMapMessageListener > mListeners = new ArrayList<>();
|
||||
|
||||
private AMapMessageManager() {
|
||||
}
|
||||
|
||||
public static AMapMessageManager getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( AMapMessageManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new AMapMessageManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public synchronized void registerAMapMessageListener( AMapMessageListener listener ) {
|
||||
if ( !mListeners.contains( listener ) ) {
|
||||
mListeners.add( listener );
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void unregisterAMapMessageListener( AMapMessageListener listener ) {
|
||||
mListeners.remove( listener );
|
||||
}
|
||||
|
||||
private Handler mHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( @NonNull Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
AMapMessageManager.this.handleMessage( msg );
|
||||
}
|
||||
};
|
||||
|
||||
public void sendMessage( Message msg ) {
|
||||
if ( msg != null ) {
|
||||
mHandler.sendMessage( msg );
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessage( int what ) {
|
||||
sendMessage( what, null );
|
||||
}
|
||||
|
||||
public void sendMessage( int what, Object obj ) {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = what;
|
||||
msg.obj = obj;
|
||||
sendMessage( msg );
|
||||
}
|
||||
|
||||
public void postNaviStarted() {
|
||||
sendMessage( AMapMessageConsts.MSG_NAVI_START );
|
||||
}
|
||||
|
||||
public void postNaviStopped() {
|
||||
sendMessage( AMapMessageConsts.MSG_NAVI_STOP );
|
||||
}
|
||||
|
||||
public void postCalculateSuccess() {
|
||||
sendMessage( AMapMessageConsts.MSG_CALCULATE_SUCCESS );
|
||||
}
|
||||
|
||||
private synchronized void handleMessage( Message msg ) {
|
||||
if ( msg == null ) {
|
||||
return;
|
||||
}
|
||||
switch ( msg.what ) {
|
||||
case AMapMessageConsts.MSG_NAVI_START:
|
||||
handleNaviStartedMsg();
|
||||
break;
|
||||
case AMapMessageConsts.MSG_NAVI_STOP:
|
||||
handleNaviStoppedMsg();
|
||||
break;
|
||||
case AMapMessageConsts.MSG_CALCULATE_SUCCESS:
|
||||
handleCalculateSuccessMsg();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleNaviStartedMsg() {
|
||||
if ( mListeners == null ) {
|
||||
return;
|
||||
}
|
||||
for ( AMapMessageListener listener : mListeners ) {
|
||||
listener.onNaviStarted();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleNaviStoppedMsg() {
|
||||
if ( mListeners == null ) {
|
||||
return;
|
||||
}
|
||||
for ( AMapMessageListener listener : mListeners ) {
|
||||
listener.onNaviStopped();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleCalculateSuccessMsg() {
|
||||
if ( mListeners == null ) {
|
||||
return;
|
||||
}
|
||||
for ( AMapMessageListener listener : mListeners ) {
|
||||
listener.onCalculateSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
//package com.mogo.map.impl.custom.navi;
|
||||
//
|
||||
//import com.amap.api.navi.AMapNaviListener;
|
||||
//import com.amap.api.navi.model.AMapCalcRouteResult;
|
||||
//import com.amap.api.navi.model.AMapLaneInfo;
|
||||
//import com.amap.api.navi.model.AMapModelCross;
|
||||
//import com.amap.api.navi.model.AMapNaviCameraInfo;
|
||||
//import com.amap.api.navi.model.AMapNaviCross;
|
||||
//import com.amap.api.navi.model.AMapNaviInfo;
|
||||
//import com.amap.api.navi.model.AMapNaviLocation;
|
||||
//import com.amap.api.navi.model.AMapNaviRouteNotifyData;
|
||||
//import com.amap.api.navi.model.AMapNaviTrafficFacilityInfo;
|
||||
//import com.amap.api.navi.model.AMapServiceAreaInfo;
|
||||
//import com.amap.api.navi.model.AimLessModeCongestionInfo;
|
||||
//import com.amap.api.navi.model.AimLessModeStat;
|
||||
//import com.amap.api.navi.model.NaviInfo;
|
||||
//import com.autonavi.tbt.TrafficFacilityInfo;
|
||||
//import com.mogo.utils.logger.Logger;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2019-12-25
|
||||
// * <p>
|
||||
// * 高德导航事件:导航事件
|
||||
// */
|
||||
//public abstract class AMapNaviListenerAdapter implements AMapNaviListener {
|
||||
//
|
||||
// private static final String TAG = "AMapNaviListenerAdapter";
|
||||
// protected String mLastSpeakWord;
|
||||
//
|
||||
// @Override
|
||||
// public void onInitNaviFailure() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onInitNaviSuccess() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onStartNavi( int i ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onTrafficStatusUpdate() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLocationChange( AMapNaviLocation aMapNaviLocation ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onGetNavigationText( int i, String s ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onGetNavigationText( String s ) {
|
||||
// mLastSpeakWord = s;
|
||||
// Logger.d( TAG, s );
|
||||
// TTSSpeaker.getInstance().speakTTS( s );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onEndEmulatorNavi() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onArriveDestination() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCalculateRouteFailure( int i ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onReCalculateRouteForYaw() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onReCalculateRouteForTrafficJam() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onArrivedWayPoint( int i ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onGpsOpenStatus( boolean b ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviInfoUpdate( NaviInfo naviInfo ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviInfoUpdated( AMapNaviInfo aMapNaviInfo ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void updateCameraInfo( AMapNaviCameraInfo[] aMapNaviCameraInfos ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void updateIntervalCameraInfo( AMapNaviCameraInfo aMapNaviCameraInfo, AMapNaviCameraInfo aMapNaviCameraInfo1, int i ) {
|
||||
// if ( aMapNaviCameraInfo != null ) {
|
||||
// Logger.i( TAG, "current camera speed: %d, status = %d", aMapNaviCameraInfo.getCameraSpeed(), i );
|
||||
// }
|
||||
// if ( aMapNaviCameraInfo1 != null ) {
|
||||
// Logger.i( TAG, "current camera speed: %d, status = %d", aMapNaviCameraInfo1.getCameraSpeed(), i );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public void onServiceAreaUpdate( AMapServiceAreaInfo[] aMapServiceAreaInfos ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showCross( AMapNaviCross aMapNaviCross ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void hideCross() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showModeCross( AMapModelCross aMapModelCross ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void hideModeCross() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showLaneInfo( AMapLaneInfo[] aMapLaneInfos, byte[] bytes, byte[] bytes1 ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showLaneInfo( AMapLaneInfo aMapLaneInfo ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void hideLaneInfo() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCalculateRouteSuccess( int[] ints ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void notifyParallelRoad( int i ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void OnUpdateTrafficFacility( AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void OnUpdateTrafficFacility( AMapNaviTrafficFacilityInfo aMapNaviTrafficFacilityInfo ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void OnUpdateTrafficFacility( TrafficFacilityInfo trafficFacilityInfo ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 巡航回调
|
||||
// * 连续5个点速度大于15km/h后触发 updateAimlessModeStatistics 回调,通过 AimLessModeStat 对象可获取巡航的连续行驶距离和连续启用时间
|
||||
// *
|
||||
// * @param aimLessModeStat
|
||||
// */
|
||||
// @Override
|
||||
// public void updateAimlessModeStatistics( AimLessModeStat aimLessModeStat ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 巡航回调
|
||||
// * 出现拥堵长度大于500米且拥堵时间大于5分钟时,会进到 updateAimlessModeCongestionInfo 回调中,通过 AimLessModeCongestionInfo 对象,可获取到道路拥堵信息(如:导致拥堵的事件类型、拥堵的状态等)
|
||||
// *
|
||||
// * @param aimLessModeCongestionInfo
|
||||
// */
|
||||
// @Override
|
||||
// public void updateAimlessModeCongestionInfo( AimLessModeCongestionInfo aimLessModeCongestionInfo ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPlayRing( int i ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCalculateRouteSuccess( AMapCalcRouteResult aMapCalcRouteResult ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCalculateRouteFailure( AMapCalcRouteResult aMapCalcRouteResult ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviRouteNotify( AMapNaviRouteNotifyData aMapNaviRouteNotifyData ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,48 @@
|
||||
//package com.mogo.map.impl.custom.navi;
|
||||
//
|
||||
//import com.amap.api.navi.AimlessModeListener;
|
||||
//import com.amap.api.navi.model.AMapNaviTrafficFacilityInfo;
|
||||
//import com.amap.api.navi.model.AimLessModeCongestionInfo;
|
||||
//import com.amap.api.navi.model.AimLessModeStat;
|
||||
//import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
//import com.mogo.map.navi.MogoCongestionInfo;
|
||||
//import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
//import com.mogo.map.navi.MogoTraffic;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2020-01-16
|
||||
// * <p>
|
||||
// * 巡航监听
|
||||
// */
|
||||
//public class AimlessModeListenerAdapter implements AimlessModeListener {
|
||||
//
|
||||
// @Override
|
||||
// public void onUpdateTrafficFacility( AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos ) {
|
||||
// MogoTraffic traffic = ObjectUtils.fromAMap( aMapNaviTrafficFacilityInfos );
|
||||
// if ( traffic != null ) {
|
||||
// MogoNaviListenerHandler.getInstance().onUpdateTraffic2( traffic );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onUpdateAimlessModeElecCameraInfo( AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos ) {
|
||||
// MogoTraffic traffic = ObjectUtils.fromAMap( aMapNaviTrafficFacilityInfos );
|
||||
// if ( traffic != null ) {
|
||||
// MogoNaviListenerHandler.getInstance().onUpdateTraffic2( traffic );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void updateAimlessModeStatistics( AimLessModeStat aimLessModeStat ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void updateAimlessModeCongestionInfo( AimLessModeCongestionInfo aimLessModeCongestionInfo ) {
|
||||
// MogoCongestionInfo congestionInfo = ObjectUtils.fromAMap( aimLessModeCongestionInfo );
|
||||
// if ( congestionInfo != null ) {
|
||||
// MogoNaviListenerHandler.getInstance().onUpdateCongestion( congestionInfo );
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,181 @@
|
||||
//package com.mogo.map.impl.custom.navi;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.text.TextUtils;
|
||||
//
|
||||
//import com.amap.api.maps.AMap;
|
||||
//import com.amap.api.navi.model.AMapNaviPath;
|
||||
//import com.amap.api.navi.model.AMapNaviStep;
|
||||
//import com.amap.api.navi.model.NaviLatLng;
|
||||
//import com.mogo.map.MogoLatLng;
|
||||
//import com.mogo.map.impl.custom.overlay.RouteOverLayWrapper;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2019-12-04
|
||||
// * <p>
|
||||
// * 导航路径代理类
|
||||
// */
|
||||
//public class CalculatePathItem {
|
||||
//
|
||||
// private Context mContext;
|
||||
// private AMap mAMap;
|
||||
// private int mId;
|
||||
// private AMapNaviPath mPath;
|
||||
//
|
||||
// private RouteOverLayWrapper mOverLazWrapper;
|
||||
// private ArrayList< MogoLatLng > mPoints;
|
||||
//
|
||||
// public int getId() {
|
||||
// return mId;
|
||||
// }
|
||||
//
|
||||
// public AMapNaviPath getPath() {
|
||||
// return mPath;
|
||||
// }
|
||||
//
|
||||
// public RouteOverLayWrapper getOverLazWrapper( boolean createIfNull ) {
|
||||
// if ( mOverLazWrapper == null && createIfNull ) {
|
||||
// mOverLazWrapper = new RouteOverLayWrapper( mContext, mAMap, mPath );
|
||||
// }
|
||||
// return mOverLazWrapper;
|
||||
// }
|
||||
//
|
||||
// public CalculatePathItem(Context context, AMap amap, int id, AMapNaviPath path ) {
|
||||
// mContext = context;
|
||||
// mAMap = amap;
|
||||
// this.mId = id;
|
||||
// this.mPath = path;
|
||||
// }
|
||||
//
|
||||
// public String getStrategyName() {
|
||||
// return mPath.getLabels();
|
||||
// }
|
||||
//
|
||||
// public String getFormattedTime() {
|
||||
// if ( mTimeBuilder == null ) {
|
||||
// final int time = mPath.getAllTime();
|
||||
// mTimeBuilder = new StringBuilder();
|
||||
// fillFormatTime( time, mTimeBuilder );
|
||||
// }
|
||||
// return mTimeBuilder.toString();
|
||||
// }
|
||||
//
|
||||
// public int getTime(){
|
||||
// return mPath.getAllTime();
|
||||
// }
|
||||
//
|
||||
// public int getDistance(){
|
||||
// return mPath.getAllLength();
|
||||
// }
|
||||
//
|
||||
// private StringBuilder mTimeBuilder;
|
||||
//
|
||||
// private void fillFormatTime( int seconds, StringBuilder builder ) {
|
||||
// // int days = seconds / ( 24 * 60 * 60 );
|
||||
// // if ( days > 0 ) {
|
||||
// // builder.append( days ).append( "天" );
|
||||
// // }
|
||||
// // seconds -= days * 24 * 60 * 60;
|
||||
// int hours = seconds / ( 60 * 60 );
|
||||
// if ( hours > 0 ) {
|
||||
// builder.append( hours ).append( "小时" );
|
||||
// }
|
||||
// seconds -= hours * 60 * 60;
|
||||
// int min = seconds / 60;
|
||||
// builder.append( min > 1 ? min : 1 ).append( "分钟" );
|
||||
// }
|
||||
//
|
||||
// private String mDistanceCacheStr = "";
|
||||
//
|
||||
// public String getFormattedDistance() {
|
||||
// if ( TextUtils.isEmpty( mDistanceCacheStr ) ) {
|
||||
// int distance = mPath.getAllLength();
|
||||
// if ( distance == -1 ) {
|
||||
// mDistanceCacheStr = "路程总程未获取";
|
||||
// }
|
||||
// if ( distance >= 1000 ) {
|
||||
// mDistanceCacheStr = String.format( "%.1f公里", ( float ) distance / 1000 );
|
||||
// } else {
|
||||
// mDistanceCacheStr = distance + "米";
|
||||
// }
|
||||
// }
|
||||
// return mDistanceCacheStr;
|
||||
// }
|
||||
//
|
||||
// private StringBuilder mDescBuilder = null;
|
||||
//
|
||||
// public String getDesc() {
|
||||
// if ( mDescBuilder == null ) {
|
||||
// mDescBuilder = new StringBuilder();
|
||||
// int lightsSize = getTrafficNumber();
|
||||
// if ( lightsSize > 0 ) {
|
||||
// mDescBuilder.append( "红绿灯" ).append( lightsSize ).append( "个" );
|
||||
// }
|
||||
// mDescBuilder.append( " " );
|
||||
// mDescBuilder.append( "收费" ).append( mPath.getTollCost() ).append( "元" );
|
||||
// }
|
||||
//
|
||||
// return mDescBuilder.toString();
|
||||
// }
|
||||
//
|
||||
// public int getTrafficNumber() {
|
||||
// int trafficLightNumber = 0;
|
||||
// if ( mPath == null ) {
|
||||
// return trafficLightNumber;
|
||||
// }
|
||||
// List<AMapNaviStep> steps = mPath.getSteps();
|
||||
// for ( AMapNaviStep step : steps ) {
|
||||
// trafficLightNumber += step.getTrafficLightNumber();
|
||||
// }
|
||||
// return trafficLightNumber;
|
||||
// }
|
||||
//
|
||||
// public void release() {
|
||||
// mContext = null;
|
||||
// mAMap = null;
|
||||
// mPath = null;
|
||||
// if ( mOverLazWrapper != null ) {
|
||||
// mOverLazWrapper.destroy();
|
||||
// }
|
||||
// mOverLazWrapper = null;
|
||||
// if ( mPoints != null ) {
|
||||
// mPoints.clear();
|
||||
// }
|
||||
// mPoints = null;
|
||||
// }
|
||||
//
|
||||
// public List< MogoLatLng > getCoordList() {
|
||||
// if ( mPoints == null ) {
|
||||
// mPoints = new ArrayList<>();
|
||||
// for ( NaviLatLng latlng : mPath.getCoordList() ) {
|
||||
// MogoLatLng mogoLatLng = new MogoLatLng( latlng.getLatitude(), latlng.getLongitude() );
|
||||
// mPoints.add( mogoLatLng );
|
||||
// }
|
||||
// }
|
||||
// return mPoints;
|
||||
// }
|
||||
//
|
||||
// public MogoLatLng getDriveStartPoint() {
|
||||
// if ( mPath != null && mPath.getCoordList() != null && mPath.getCoordList().size() > 0 ) {
|
||||
// NaviLatLng startPoint = mPath.getCoordList().get( 0 );
|
||||
// if ( startPoint != null ) {
|
||||
// return new MogoLatLng( startPoint.getLatitude(), startPoint.getLongitude() );
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public MogoLatLng getDriveEndPoint() {
|
||||
// if ( mPath != null && mPath.getCoordList() != null && mPath.getCoordList().size() > 0 ) {
|
||||
// NaviLatLng endPoint = mPath.getCoordList().get( mPath.getCoordList().size() - 1 );
|
||||
// if ( endPoint != null ) {
|
||||
// return new MogoLatLng( endPoint.getLatitude(), endPoint.getLongitude() );
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,366 @@
|
||||
package com.mogo.map.impl.custom.navi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
|
||||
//import com.amap.api.maps.LocationSource;
|
||||
//import com.amap.api.maps.model.Polyline;
|
||||
//import com.amap.api.navi.AMapNavi;
|
||||
//import com.amap.api.navi.enums.AimLessMode;
|
||||
//import com.amap.api.navi.enums.NaviType;
|
||||
//import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.custom.AMapWrapper;
|
||||
import com.mogo.map.impl.custom.message.AMapMessageManager;
|
||||
import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.Polyline;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-25
|
||||
* <p>
|
||||
* 高德导航
|
||||
*/
|
||||
public class NaviClient implements IMogoNavi {
|
||||
|
||||
/**
|
||||
* 巡航状态控制
|
||||
*/
|
||||
public static final String KEY_AIMLESS_STATUS = "KEY_AIMLESS_STATUS";
|
||||
|
||||
private static final String TAG = "NaviClient";
|
||||
private final Context mContext;
|
||||
|
||||
private MapAutoViewHelper mAMapNavi;
|
||||
// private final NaviListenerAdapter mAMapNaviListener;
|
||||
|
||||
|
||||
// private final AimlessModeListenerAdapter mAimlessModeListener;
|
||||
|
||||
/**
|
||||
* 导航策略配置
|
||||
*/
|
||||
|
||||
private MogoNaviConfig mMogoNaviConfig = new MogoNaviConfig();
|
||||
|
||||
private static volatile NaviClient sInstance;
|
||||
private boolean mIsRealNavi;
|
||||
|
||||
private Location mCarLocation = new Location("GPS");
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener;
|
||||
/**
|
||||
* 巡航模式配置状态
|
||||
*/
|
||||
private boolean mAimlessModeStatus;
|
||||
|
||||
/**
|
||||
* 巡航状态
|
||||
*/
|
||||
private boolean mAimlessStatus;
|
||||
|
||||
private NaviClient( Context context ) {
|
||||
mCarLocation.setLongitude(116.97000);
|
||||
mCarLocation.setLatitude(39.97000);
|
||||
mContext = context;
|
||||
mAMapNavi = AMapWrapper.getAMap();
|
||||
// mAMapNavi.setEmulatorNaviSpeed( 120 );
|
||||
// mAMapNavi.setUseInnerVoice( false, true );
|
||||
// mAMapNaviListener = new NaviListenerAdapter( context, mAMapNavi, this );
|
||||
// mAimlessModeListener = new AimlessModeListenerAdapter() {
|
||||
// };
|
||||
// mAMapNavi.addAMapNaviListener( mAMapNaviListener );
|
||||
// mAMapNavi.addAimlessModeListener( mAimlessModeListener );
|
||||
// mAimlessModeStatus = SharedPrefsMgr.getInstance( mContext ).getBoolean( KEY_AIMLESS_STATUS, false );
|
||||
}
|
||||
|
||||
public static NaviClient getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( NaviClient.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new NaviClient( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint ) {
|
||||
naviTo( endPoint, mMogoNaviConfig );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, MogoNaviConfig config ) {
|
||||
naviTo( endPoint, null, config );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints ) {
|
||||
naviTo( endPoint, wayPoints, mMogoNaviConfig );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints, MogoNaviConfig config ) {
|
||||
if ( !checkAMapNavi() ) {
|
||||
return;
|
||||
}
|
||||
Logger.i( TAG, "开始规划路径" );
|
||||
mMogoNaviConfig = config;
|
||||
if ( mMogoNaviConfig == null ) {
|
||||
mMogoNaviConfig = new MogoNaviConfig();
|
||||
}
|
||||
// int strategy = mAMapNavi.strategyConvert( mMogoNaviConfig.isCongestion(), mMogoNaviConfig.isAvoidSpeed(), mMogoNaviConfig.isCost(), mMogoNaviConfig.isHighSpeed(), config.isMultipleRoute() );
|
||||
// List< NaviLatLng > naviWayPoints = null;
|
||||
// if ( wayPoints != null && !wayPoints.isEmpty() ) {
|
||||
// naviWayPoints = new ArrayList<>( wayPoints.size() );
|
||||
// for ( MogoLatLng wayPoint : wayPoints ) {
|
||||
// naviWayPoints.add( ObjectUtils.fromMogoAsNavi( wayPoint ) );
|
||||
// }
|
||||
// } else {
|
||||
// naviWayPoints = new ArrayList<>();
|
||||
// }
|
||||
// mAMapNavi.calculateDriveRoute(
|
||||
// new ArrayList( Arrays.asList( ObjectUtils.fromMogoAsNavi( endPoint ) ) ),
|
||||
// naviWayPoints,
|
||||
// strategy
|
||||
// );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reCalculateRoute( MogoNaviConfig config ) {
|
||||
if ( !checkAMapNavi() ) {
|
||||
return;
|
||||
}
|
||||
mMogoNaviConfig = config;
|
||||
if ( mMogoNaviConfig == null ) {
|
||||
mMogoNaviConfig = new MogoNaviConfig();
|
||||
}
|
||||
// int strategy = mAMapNavi.strategyConvert( mMogoNaviConfig.isCongestion(), mMogoNaviConfig.isAvoidSpeed(), mMogoNaviConfig.isCost(), mMogoNaviConfig.isHighSpeed(), config.isMultipleRoute() );
|
||||
// mAMapNavi.reCalculateRoute( strategy );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopNavi() {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// mAMapNaviListener.stopNavi();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void startNavi( boolean isRealNavi ) {
|
||||
// if ( mAMapNaviListener.isStopped() ) {
|
||||
// return;
|
||||
// }
|
||||
// mIsRealNavi = isRealNavi;
|
||||
// stopAimlessMode();
|
||||
// boolean isNaving = isNaviing();
|
||||
// boolean result = mAMapNavi.startNavi( isRealNavi ? NaviType.GPS : NaviType.EMULATOR );
|
||||
// if ( isNaving && !result ) {
|
||||
// // 如果正在导航,又重新规划路线,startNavi 不会成功,不会重新回调 #onStartNavi
|
||||
// MogoNaviListenerHandler.getInstance().onStartNavi();
|
||||
// AMapMessageManager.getInstance().postNaviStarted();
|
||||
// }
|
||||
// Logger.d( TAG, "start navi status: %s", result );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNaviing() {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// return mAMapNaviListener.isNaviing();
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoCalculatePath > getCalculatedStrategies() {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// return mAMapNaviListener.getCalculateStrategies();
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getCalculatedPathPos() {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// return mAMapNaviListener.getCalculatedPathPos();
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// return mAMapNaviListener.getItemClickInteraction();
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// mAMapNaviListener.setLineClickInteraction( lineClickInteraction );
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCalculatePaths() {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// mAMapNaviListener.clearCalculatePaths();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// mAMapNaviListener.setCalculatePathDisplayBounds( bounds );
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoNaviConfig getNaviConfig() {
|
||||
return mMogoNaviConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBroadcastMode( int mode ) {
|
||||
return false;//mAMapNavi.setBroadcastMode( mode );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getNaviPathCoordinates() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCarLocation() {
|
||||
if ( mCarLocation != null ) {
|
||||
synchronized ( mCarLocation ) {
|
||||
return new MogoLatLng( mCarLocation.getLatitude(), mCarLocation.getLongitude() );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getCarLocation2() {
|
||||
return mCarLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
mCarLocationChangedListener = listener;
|
||||
}
|
||||
|
||||
// -- end
|
||||
|
||||
public void syncCarLocation( Location location ) {
|
||||
mCarLocation = location;
|
||||
if ( mCarLocationChangedListener != null ) {
|
||||
mCarLocationChangedListener.onCarLocationChanged2( mCarLocation );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkAMapNavi() {
|
||||
mAMapNavi = AMapWrapper.getAMap();
|
||||
if ( mAMapNavi == null ) {
|
||||
Logger.e( TAG, "高德导航实例为空!!!" );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isRealNavi() {
|
||||
return mIsRealNavi;
|
||||
}
|
||||
|
||||
public void handleClickedPolyline( Polyline polyline ) {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// mAMapNaviListener.handleClickedPolyline( polyline );
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAimlessMode() {
|
||||
// if ( mAimlessModeStatus && !isNaviing() ) {
|
||||
// mAMapNavi.startAimlessMode( AimLessMode.CAMERA_AND_SPECIALROAD_DETECTED );
|
||||
// mAimlessStatus = true;
|
||||
// Logger.d( TAG, "开启巡航成功" );
|
||||
// } else {
|
||||
// mAimlessStatus = false;
|
||||
// Logger.d( TAG, "开启巡航失败" );
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAimlessMode() {
|
||||
// mAMapNavi.stopAimlessMode();
|
||||
// mAimlessStatus = false;
|
||||
// Logger.d( TAG, "关闭巡航成功" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAimlessModeStatus( boolean open ) {
|
||||
this.mAimlessModeStatus = open;
|
||||
SharedPrefsMgr.getInstance( mContext ).putBoolean( KEY_AIMLESS_STATUS, open );
|
||||
if ( open ) {
|
||||
if ( !mAimlessStatus ) {
|
||||
startAimlessMode();
|
||||
}
|
||||
} else {
|
||||
if ( mAimlessStatus ) {
|
||||
stopAimlessMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview( Rect bounds ) {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// mAMapNaviListener.displayOverview( bounds );
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseExtraGPSData( boolean use ) {
|
||||
Logger.d( TAG, "设置外部gps源状态 %s", use );
|
||||
mAMapNavi.setIsUseExtraGPSData( use );
|
||||
AMapWrapper.getAMap().setMyLocationEnabled( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtraGPSData( double lon, double lat, float speed, float accuracy, float bearing, long timestamp ) {
|
||||
if ( !mAMapNavi.getIsUseExtraGPSData() ) {
|
||||
Logger.d( TAG, "拒绝外部GPS数据" );
|
||||
return;
|
||||
}
|
||||
Location location = new Location( "外部GPS源" );
|
||||
location.setLongitude( lon );
|
||||
location.setLatitude( lat );
|
||||
location.setSpeed( speed );
|
||||
location.setAccuracy( accuracy );
|
||||
location.setBearing( bearing );
|
||||
location.setTime( timestamp );
|
||||
//type字段传1时代表WGS84坐标
|
||||
mAMapNavi.setExtraGPSData( 2, location );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
//package com.mogo.map.impl.custom.navi;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.graphics.Rect;
|
||||
//import android.os.Trace;
|
||||
//import android.text.TextUtils;
|
||||
//
|
||||
//import com.amap.api.maps.model.Polyline;
|
||||
//import com.amap.api.navi.AMapNavi;
|
||||
//import com.amap.api.navi.enums.CameraType;
|
||||
//import com.amap.api.navi.enums.NaviType;
|
||||
//import com.amap.api.navi.model.AMapCalcRouteResult;
|
||||
//import com.amap.api.navi.model.AMapNaviCameraInfo;
|
||||
//import com.amap.api.navi.model.AMapNaviLocation;
|
||||
//import com.amap.api.navi.model.NaviInfo;
|
||||
//import com.mogo.commons.voice.AIAssist;
|
||||
//import com.mogo.map.MogoLatLng;
|
||||
//import com.mogo.map.impl.custom.message.AMapMessageManager;
|
||||
//import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
//import com.mogo.map.navi.MogoCalculatePath;
|
||||
//import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
//import com.mogo.map.navi.MogoTraffic;
|
||||
//import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
//import com.mogo.utils.UiThreadHandler;
|
||||
//import com.mogo.utils.logger.Logger;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2019-12-25
|
||||
// * <p>
|
||||
// * 高德导航回调
|
||||
// */
|
||||
//public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
//
|
||||
// private static final String TAG = "NaviListenerAdapter";
|
||||
//
|
||||
// private Context mContext;
|
||||
// private AMapNavi mAMapNavi;
|
||||
// private NaviClient mClient;
|
||||
// /**
|
||||
// * 导航状态:true - 导航 onStartNavi(int) 被调用, false - 到达目的地、手动挺固执
|
||||
// */
|
||||
// private boolean mIsNaviing = false;
|
||||
//
|
||||
// /**
|
||||
// * 导航是否被停止:true - 手动停止或到达目的地、false - 规划路径成功、开启导航
|
||||
// */
|
||||
// private boolean mIsStopped = true;
|
||||
//
|
||||
// /**
|
||||
// * 路线规划
|
||||
// */
|
||||
// private NaviOverlayHelper mNaviOverlayHelper;
|
||||
//
|
||||
// public NaviListenerAdapter( Context mContext, AMapNavi mAMapNavi, NaviClient client ) {
|
||||
// this.mContext = mContext;
|
||||
// this.mAMapNavi = mAMapNavi;
|
||||
// this.mClient = client;
|
||||
//// mNaviOverlayHelper = new NaviOverlayHelper( mAMapNavi, AMapWrapper.getAMap(), mContext );
|
||||
// }
|
||||
//
|
||||
// public void setNaviing( boolean mIsNaviing ) {
|
||||
// this.mIsNaviing = mIsNaviing;
|
||||
// }
|
||||
//
|
||||
// public boolean isNaviing() {
|
||||
// return mIsNaviing;
|
||||
// }
|
||||
//
|
||||
// public void setStopped( boolean isStopped ) {
|
||||
// this.mIsStopped = isStopped;
|
||||
// }
|
||||
//
|
||||
// public boolean isStopped() {
|
||||
// return mIsStopped;
|
||||
// }
|
||||
//
|
||||
// public Context getContext() {
|
||||
// return mContext;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onInitNaviFailure() {
|
||||
// MogoNaviListenerHandler.getInstance().onInitNaviFailure();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onInitNaviSuccess() {
|
||||
// MogoNaviListenerHandler.getInstance().onInitNaviSuccess();
|
||||
// NaviClient.getInstance( mContext ).startAimlessMode();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void updateCameraInfo( AMapNaviCameraInfo[] aMapNaviCameraInfos ) {
|
||||
// super.updateCameraInfo( aMapNaviCameraInfos );
|
||||
// if ( aMapNaviCameraInfos == null || aMapNaviCameraInfos.length == 0 ) {
|
||||
// return;
|
||||
// }
|
||||
// int limitSpeed = 0;
|
||||
// for ( AMapNaviCameraInfo aMapNaviCameraInfo : aMapNaviCameraInfos ) {
|
||||
// if ( aMapNaviCameraInfo == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// limitSpeed = aMapNaviCameraInfo.getCameraSpeed();
|
||||
// if ( limitSpeed > 0 && aMapNaviCameraInfo.getCameraType() == CameraType.SPEED ) {
|
||||
// MogoTraffic traffic = new MogoTraffic( MogoTraffic.TYPE_NAVI );
|
||||
// traffic.setDistance( aMapNaviCameraInfo.getCameraDistance() );
|
||||
// traffic.setSpeedLimit( aMapNaviCameraInfo.getCameraSpeed() );
|
||||
// MogoNaviListenerHandler.getInstance().onUpdateTraffic2( traffic );
|
||||
// }
|
||||
//
|
||||
//// switch ( aMapNaviCameraInfo.getCameraType() ) {
|
||||
//// case CameraType.SPEED:
|
||||
////
|
||||
//// break;
|
||||
//// case CameraType.SURVEILLANCE:
|
||||
//// traffic.setDesc( "监控摄像" );
|
||||
//// break;
|
||||
//// case CameraType.TRAFFICLIGHT:
|
||||
//// traffic.setDesc( "闯红灯拍照" );
|
||||
//// break;
|
||||
//// case CameraType.BREAKRULE:
|
||||
//// traffic.setDesc( "违章拍照" );
|
||||
//// break;
|
||||
//// case CameraType.BUSWAY:
|
||||
//// traffic.setDesc( "公交专用道摄像头" );
|
||||
//// break;
|
||||
//// case CameraType.EMERGENCY:
|
||||
//// traffic.setDesc( "应急车道拍照" );
|
||||
//// break;
|
||||
//// case CameraType.BICYCLE:
|
||||
//// traffic.setDesc( "非机动车道" );
|
||||
//// break;
|
||||
//// case CameraType.INTERVALVELOCITYSTART:
|
||||
//// traffic.setDesc( "区间测速起始" );
|
||||
//// break;
|
||||
//// case CameraType.INTERVALVELOCITYEND:
|
||||
//// traffic.setDesc( "区间测速解除" );
|
||||
//// break;
|
||||
//// }
|
||||
// }
|
||||
// if ( limitSpeed <= 0 ) {
|
||||
// MogoTraffic traffic = new MogoTraffic( MogoTraffic.TYPE_NAVI );
|
||||
// traffic.setDistance( 0 );
|
||||
// traffic.setSpeedLimit( 0 );
|
||||
// MogoNaviListenerHandler.getInstance().onUpdateTraffic2( traffic );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onStartNavi( int type ) {
|
||||
//
|
||||
// Logger.d( TAG, "onStartNavi type = %s", type );
|
||||
// // 巡航
|
||||
// if ( type != NaviType.CRUISE ) {
|
||||
// setStopped( false );
|
||||
// setNaviing( true );
|
||||
// MogoNaviListenerHandler.getInstance().onStartNavi();
|
||||
// AMapMessageManager.getInstance().postNaviStarted();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onEndEmulatorNavi() {
|
||||
// stopNaviDelay( () -> {
|
||||
// MogoNaviListenerHandler.getInstance().onEndEmulatorNavi();
|
||||
// } );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onArriveDestination() {
|
||||
// stopNaviDelay( () -> {
|
||||
// MogoNaviListenerHandler.getInstance().onArriveDestination();
|
||||
// } );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 避免导航结束语音播报被立刻打断的情况
|
||||
// *
|
||||
// * @param after 停止后的行为
|
||||
// */
|
||||
// private void stopNaviDelay( Runnable after ) {
|
||||
// UiThreadHandler.postDelayed( () -> {
|
||||
// if ( TextUtils.isEmpty( mLastSpeakWord ) || !mLastSpeakWord.contains( "结束" ) ) {
|
||||
// AIAssist.getInstance( mContext ).speakTTSVoice( "到达目的地附近,本次导航结束" );
|
||||
// }
|
||||
// mLastSpeakWord = "";
|
||||
// stopNavi();
|
||||
// if ( after != null ) {
|
||||
// after.run();
|
||||
// }
|
||||
// }, 5_000L );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviInfoUpdate( NaviInfo naviInfo ) {
|
||||
// Trace.beginSection( "NaviListenerAdapter.onNaviInfoUpdate" );
|
||||
// MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( ObjectUtils.fromAMap( mContext, naviInfo ) );
|
||||
// mNaviOverlayHelper.handleNaviInfoUpdate( naviInfo );
|
||||
// Trace.endSection();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCalculateRouteFailure( AMapCalcRouteResult aMapCalcRouteResult ) {
|
||||
// if ( aMapCalcRouteResult != null ) {
|
||||
// Logger.i( TAG, PathPlanningErrorCodeConstants.getErrorMsg( aMapCalcRouteResult.getErrorCode() ) );
|
||||
// }
|
||||
// MogoNaviListenerHandler.getInstance().onoCalculateFailed();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCalculateRouteSuccess( AMapCalcRouteResult aMapCalcRouteResult ) {
|
||||
// super.onCalculateRouteSuccess( aMapCalcRouteResult );
|
||||
// Logger.i( TAG, "导航规划成功" );
|
||||
// setStopped( false );
|
||||
// mNaviOverlayHelper.showCalculatedPaths( () -> {
|
||||
// AMapMessageManager.getInstance().postCalculateSuccess();
|
||||
// MogoNaviListenerHandler.getInstance().onCalculateSuccess();
|
||||
// } );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLocationChange( AMapNaviLocation aMapNaviLocation ) {
|
||||
// Trace.beginSection( "NaviListenerAdapter.onLocationChange" );
|
||||
// super.onLocationChange( aMapNaviLocation );
|
||||
//// mNaviOverlayHelper.handlePassedLocation( aMapNaviLocation );
|
||||
// Trace.endSection();
|
||||
// }
|
||||
//
|
||||
// public void stopNavi() {
|
||||
// TTSSpeaker.getInstance().shutUp();
|
||||
// mNaviOverlayHelper.clearCalculatedOverlay();
|
||||
// setStopped( true );
|
||||
// setNaviing( false );
|
||||
// mAMapNavi.stopNavi();
|
||||
// MogoNaviListenerHandler.getInstance().onStopNavi();
|
||||
// AMapMessageManager.getInstance().postNaviStopped();
|
||||
// }
|
||||
//
|
||||
// public void handleClickedPolyline( Polyline polyline ) {
|
||||
// if ( mNaviOverlayHelper != null ) {
|
||||
//
|
||||
// mNaviOverlayHelper.handleClickedPolyline( polyline, isNaviing() );
|
||||
// mAMapNavi.selectRouteId( mNaviOverlayHelper.getSelectedPathId() );
|
||||
// mNaviOverlayHelper.showBoundsWithSettingBounds();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public List< MogoCalculatePath > getCalculateStrategies() {
|
||||
// if ( mNaviOverlayHelper != null ) {
|
||||
// return mNaviOverlayHelper.getCalculateStrategies();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public List< MogoLatLng > getCalculatedPathPos() {
|
||||
// if ( mNaviOverlayHelper != null ) {
|
||||
// return mNaviOverlayHelper.getCalculatedPathPos();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
// if ( mNaviOverlayHelper != null ) {
|
||||
// return mNaviOverlayHelper.getItemClickInteraction();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
// if ( mNaviOverlayHelper != null ) {
|
||||
// mNaviOverlayHelper.setLineClickInteraction( lineClickInteraction );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void clearCalculatePaths() {
|
||||
// if ( mNaviOverlayHelper != null ) {
|
||||
// mNaviOverlayHelper.clearCalculatedOverlay();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
// if ( mNaviOverlayHelper != null ) {
|
||||
// mNaviOverlayHelper.setCalculatePathDisplayBounds( bounds );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void displayOverview( Rect bounds ) {
|
||||
// if ( mNaviOverlayHelper != null ) {
|
||||
// mNaviOverlayHelper.displayOverview( bounds );
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,461 @@
|
||||
//package com.mogo.map.impl.custom.navi;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.graphics.Bitmap;
|
||||
//import android.graphics.BitmapFactory;
|
||||
//import android.graphics.Rect;
|
||||
//import android.text.TextUtils;
|
||||
//
|
||||
//import com.amap.api.maps.AMap;
|
||||
//import com.amap.api.maps.CameraUpdateFactory;
|
||||
//import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
//import com.amap.api.maps.model.LatLng;
|
||||
//import com.amap.api.maps.model.LatLngBounds;
|
||||
//import com.amap.api.maps.model.Marker;
|
||||
//import com.amap.api.maps.model.MarkerOptions;
|
||||
//import com.amap.api.maps.model.Polyline;
|
||||
//import com.amap.api.navi.AMapNavi;
|
||||
//import com.amap.api.navi.model.AMapNaviLocation;
|
||||
//import com.amap.api.navi.model.AMapNaviPath;
|
||||
//import com.amap.api.navi.model.NaviInfo;
|
||||
//import com.amap.api.navi.model.NaviLatLng;
|
||||
//import com.mogo.map.MogoLatLng;
|
||||
//import com.mogo.map.impl.custom.R;
|
||||
//import com.mogo.map.impl.custom.overlay.RouteOverLayWrapper;
|
||||
//import com.mogo.map.marker.MogoMarkersHandler;
|
||||
//import com.mogo.map.navi.MogoCalculatePath;
|
||||
//import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
//import com.mogo.utils.WindowUtils;
|
||||
//import com.mogo.utils.logger.Logger;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Comparator;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.TreeMap;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2019-12-27
|
||||
// * <p>
|
||||
// * 导航路径管理
|
||||
// */
|
||||
//public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
//
|
||||
// private static final String TAG = "NaviOverlayHelper";
|
||||
//
|
||||
// /**
|
||||
// * 选中的路径透明度
|
||||
// */
|
||||
// public static final float AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED = 1f;
|
||||
//
|
||||
// /**
|
||||
// * 未选中的路径透明度
|
||||
// */
|
||||
// public static final float AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED = 0.3f;
|
||||
//
|
||||
// private AMapNavi mAMapNavi;
|
||||
// private AMap mAMap;
|
||||
// private Context mContext;
|
||||
// // 规划的路线显示边距
|
||||
// private Rect mBoundRect = null;
|
||||
//
|
||||
// private List< CalculatePathItem > mCalculatePathItems;
|
||||
// private List< MogoCalculatePath > mPaths = new ArrayList<>();
|
||||
//
|
||||
// private int mSelectedPathId;
|
||||
// private CalculatePathItem mSelectedCalculatePathItem;
|
||||
// private OnCalculatePathItemClickInteraction mLineClickInteraction;
|
||||
//
|
||||
// /**
|
||||
// * 起点终点marker
|
||||
// */
|
||||
// private List< Marker > mMarkers = new ArrayList<>();
|
||||
//
|
||||
// public NaviOverlayHelper( AMapNavi mAMapNavi, AMap mAMap, Context mContext ) {
|
||||
// this.mAMapNavi = mAMapNavi;
|
||||
// this.mAMap = mAMap;
|
||||
// this.mContext = mContext;
|
||||
// calculateBoundArea();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 显示规划的路径
|
||||
// */
|
||||
// public void showCalculatedPaths( Runnable after ) {
|
||||
// clearCalculatedOverlay();
|
||||
// mCalculatePathItems = getSortedPaths();
|
||||
// if ( mCalculatePathItems == null || mCalculatePathItems.isEmpty() ) {
|
||||
// return;
|
||||
// }
|
||||
// showPathsBound( getBounds(), () -> {
|
||||
// addEndPoints();
|
||||
// renderPathOverlay( mCalculatePathItems );
|
||||
// if ( after != null ) {
|
||||
// after.run();
|
||||
// }
|
||||
// }, mBoundRect );
|
||||
// }
|
||||
//
|
||||
// private LatLngBounds getBounds() {
|
||||
// if ( mCalculatePathItems == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// LatLngBounds.Builder builder = new LatLngBounds.Builder();
|
||||
// for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
|
||||
// if ( calculatePathItem == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// try {
|
||||
// LatLngBounds bounds = calculatePathItem.getPath().getBoundsForPath();
|
||||
// builder.include( bounds.northeast );
|
||||
// builder.include( bounds.southwest );
|
||||
// } catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// return builder.build();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 按pathId升序排序
|
||||
// *
|
||||
// * @return 排序好的路径规划列表
|
||||
// */
|
||||
// private List< CalculatePathItem > getSortedPaths() {
|
||||
// checkAMapInstance();
|
||||
// final Map< Integer, AMapNaviPath > pathMap = mAMapNavi.getNaviPaths();
|
||||
// if ( pathMap == null || pathMap.isEmpty() ) {
|
||||
// return null;
|
||||
// }
|
||||
// TreeMap< Integer, AMapNaviPath > sortedMap =
|
||||
// new TreeMap< Integer, AMapNaviPath >( new Comparator< Integer >() {
|
||||
// @Override
|
||||
// public int compare( Integer obj1, Integer obj2 ) {
|
||||
// if ( obj1 != null ) {
|
||||
// return obj1.compareTo( obj2 );
|
||||
// }
|
||||
// if ( obj2 != null ) {
|
||||
// return obj2.compareTo( obj1 );
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
// } );
|
||||
// sortedMap.putAll( pathMap );
|
||||
//
|
||||
// final List< CalculatePathItem > items = new ArrayList<>();
|
||||
// for ( Map.Entry< Integer, AMapNaviPath > entry : sortedMap.entrySet() ) {
|
||||
// if ( entry == null || entry.getKey() == null || entry.getValue() == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// items.add( new CalculatePathItem( mContext, mAMap, entry.getKey(), entry.getValue() ) );
|
||||
// }
|
||||
// return items;
|
||||
// }
|
||||
//
|
||||
// private void calculateBoundArea() {
|
||||
// if ( mBoundRect == null ) {
|
||||
// mBoundRect = new Rect();
|
||||
// final int padding = WindowUtils.dip2px( mContext, 80 );
|
||||
// mBoundRect.left = padding;
|
||||
// mBoundRect.right = padding;
|
||||
// mBoundRect.top = padding;
|
||||
// mBoundRect.bottom = padding;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void showBoundsWithSettingBounds() {
|
||||
// showBounds( mBoundRect );
|
||||
// }
|
||||
//
|
||||
// public void showBounds( Rect bounds ) {
|
||||
// Logger.d( TAG, "showBounds" );
|
||||
// showPathsBound( getBounds(), null, bounds );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 将规划好的路径显示在视野内
|
||||
// */
|
||||
// private void showPathsBound( LatLngBounds bounds, Runnable after, Rect rect ) {
|
||||
// if ( bounds == null ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( rect == null ) {
|
||||
// rect = new Rect();
|
||||
// }
|
||||
// checkAMapInstance();
|
||||
// mAMap.moveCamera( CameraUpdateFactory.newLatLngBoundsRect(
|
||||
// bounds,
|
||||
// rect.left,
|
||||
// rect.right,
|
||||
// rect.top,
|
||||
// rect.bottom ) );
|
||||
// if ( after != null ) {
|
||||
// after.run();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void checkAMapInstance() {
|
||||
// if ( mAMap == null ) {
|
||||
//// mAMap = AMapWrapper.getAMap();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void renderPathOverlay( List< CalculatePathItem > paths ) {
|
||||
// if ( paths == null || paths.size() == 0 ) {
|
||||
// return;
|
||||
// }
|
||||
// for ( int i = 0; i < paths.size(); i++ ) {
|
||||
// final CalculatePathItem item = paths.get( i );
|
||||
// if ( item == null || item.getPath() == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// RouteOverLayWrapper wrapper = item.getOverLazWrapper( true );
|
||||
// wrapper.setTrafficLightsVisible( false );
|
||||
// // 默认选中第一个
|
||||
// if ( i == 0 ) {
|
||||
// mSelectedPathId = item.getId();
|
||||
// mSelectedCalculatePathItem = item;
|
||||
// //wrapper.setStartBitmap( R.drawable.ic_navi_start )
|
||||
// // .setEndBitmap( R.drawable.ic_navi_target );
|
||||
// mAMapNavi.selectRouteId( item.getId() );
|
||||
// Logger.d( TAG, "renderPathOverlay set default path" );
|
||||
// }
|
||||
// wrapper.addToMap();
|
||||
// wrapper.setTransparency( i == 0 ? AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED : AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void addEndPoints() {
|
||||
// if ( mCalculatePathItems == null || mCalculatePathItems.isEmpty() ) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Bitmap bitmap = BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_endpoint );
|
||||
// Bitmap startBitmap = BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_navi_start );
|
||||
// Bitmap endBitmap = BitmapFactory.decodeResource( mContext.getResources(), R.drawable.ic_navi_target );
|
||||
// MarkerOptions options = new MarkerOptions().icon( BitmapDescriptorFactory.fromBitmap( bitmap ) ).zIndex( 0 ).anchor( 0.5f, 0.5f );
|
||||
// MarkerOptions startOptions = new MarkerOptions().icon( BitmapDescriptorFactory.fromBitmap( startBitmap ) ).zIndex( 0 ).anchor( 0.5f, 1 );
|
||||
// MarkerOptions endOptions = new MarkerOptions().icon( BitmapDescriptorFactory.fromBitmap( endBitmap ) ).zIndex( 0 ).anchor( 0.5f, 1 );
|
||||
// for ( CalculatePathItem path : mCalculatePathItems ) {
|
||||
// List< MogoLatLng > points = path.getCoordList();
|
||||
// if ( points == null || points.isEmpty() ) {
|
||||
// continue;
|
||||
// }
|
||||
// MogoLatLng startPoint = path.getDriveStartPoint();
|
||||
// MogoLatLng endPoint = path.getDriveEndPoint();
|
||||
// if ( startPoint == null || endPoint == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// mMarkers.add( mAMap.addMarker( options.position( new LatLng( startPoint.lat, startPoint.lng ) ) ) );
|
||||
// mMarkers.add( mAMap.addMarker( options.position( new LatLng( endPoint.lat, endPoint.lng ) ) ) );
|
||||
// mMarkers.add( mAMap.addMarker( startOptions.position( new LatLng( startPoint.lat, startPoint.lng ) ) ) );
|
||||
// mMarkers.add( mAMap.addMarker( endOptions.position( new LatLng( endPoint.lat, endPoint.lng ) ) ) );
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void clearCalculatedOverlay() {
|
||||
// if ( mCalculatePathItems != null && !mCalculatePathItems.isEmpty() ) {
|
||||
// for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
|
||||
// if ( calculatePathItem == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper( false );
|
||||
// if ( wrapper != null ) {
|
||||
// wrapper.destroy();
|
||||
// }
|
||||
// calculatePathItem.release();
|
||||
// }
|
||||
// mCalculatePathItems.clear();
|
||||
// }
|
||||
// if ( mPaths != null ) {
|
||||
// mPaths.clear();
|
||||
// }
|
||||
// if ( !mMarkers.isEmpty() ) {
|
||||
// for ( Marker mMarker : mMarkers ) {
|
||||
// if ( mMarker == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// try {
|
||||
// mMarker.remove();
|
||||
// mMarker.destroy();
|
||||
// } catch ( Exception e ) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// MogoMarkersHandler.getInstance().remove( TAG );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 是否切换成功
|
||||
// *
|
||||
// * @param polyline 选中的线
|
||||
// */
|
||||
// public boolean handleClickedPolyline( Polyline polyline, boolean isNaviing ) {
|
||||
// if ( polyline == null ) {
|
||||
// return false;
|
||||
// }
|
||||
// if ( mPaths != null && !mPaths.isEmpty() ) {
|
||||
// for ( MogoCalculatePath path : mPaths ) {
|
||||
// if ( TextUtils.equals( path.getTagId(), polyline.getId() ) ) {
|
||||
// if ( mLineClickInteraction != null ) {
|
||||
// mLineClickInteraction.onItemClicked( path.getTagId() );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return handleClickedPolyline( polyline.getId() );
|
||||
// }
|
||||
//
|
||||
// private boolean handleClickedPolyline( String id ) {
|
||||
// if ( id == null ) {
|
||||
// return false;
|
||||
// }
|
||||
// Logger.i( TAG, "polyline id = " + id );
|
||||
// mSelectedCalculatePathItem = isCalculatePolyline( id );
|
||||
// if ( mSelectedCalculatePathItem == null ) {
|
||||
// return false;
|
||||
// }
|
||||
// mSelectedPathId = mSelectedCalculatePathItem.getId();
|
||||
// if ( mCalculatePathItems != null ) {
|
||||
// for ( CalculatePathItem item : mCalculatePathItems ) {
|
||||
// final RouteOverLayWrapper wrapper = item.getOverLazWrapper( false );
|
||||
// if ( wrapper == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// wrapper.setTransparency(
|
||||
// item == mSelectedCalculatePathItem
|
||||
// ? AMAP_ROUTE_OVERLAY_TRANSPARENCY_SELECTED
|
||||
// : AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// private CalculatePathItem isCalculatePolyline( String id ) {
|
||||
// CalculatePathItem result = null;
|
||||
// if ( mCalculatePathItems == null || mCalculatePathItems.isEmpty() ) {
|
||||
// return result;
|
||||
// }
|
||||
// for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
|
||||
// if ( calculatePathItem == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// final RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper( false );
|
||||
// if ( wrapper == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// if ( wrapper.getTrafficColorfulPolyline() == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// if ( TextUtils.equals( wrapper.getTrafficColorfulPolyline().getId(), id ) ) {
|
||||
// result = calculatePathItem;
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// public int getSelectedPathId() {
|
||||
// return mSelectedPathId;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 车辆拐弯时绘制转向箭头
|
||||
// */
|
||||
// public void handleNaviInfoUpdate( NaviInfo naviInfo ) {
|
||||
// if ( mSelectedCalculatePathItem != null ) {
|
||||
// RouteOverLayWrapper wrapper = mSelectedCalculatePathItem.getOverLazWrapper( false );
|
||||
// if ( wrapper != null ) {
|
||||
// wrapper.drawArrow( naviInfo );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void handlePassedLocation( AMapNaviLocation location ) {
|
||||
// if ( mSelectedCalculatePathItem != null ) {
|
||||
// RouteOverLayWrapper wrapper = mSelectedCalculatePathItem.getOverLazWrapper( false );
|
||||
// if ( wrapper != null ) {
|
||||
// wrapper.updatePolyline( location );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public List< MogoCalculatePath > getCalculateStrategies() {
|
||||
// if ( mCalculatePathItems != null && !mCalculatePathItems.isEmpty() ) {
|
||||
// for ( CalculatePathItem calculatePathItem : mCalculatePathItems ) {
|
||||
// MogoCalculatePath path = new MogoCalculatePath();
|
||||
// path.setFormattedDistance( calculatePathItem.getFormattedDistance() );
|
||||
// path.setPathId( calculatePathItem.getId() );
|
||||
// path.setStrategyName( calculatePathItem.getStrategyName() );
|
||||
// path.setFormattedTime( calculatePathItem.getFormattedTime() );
|
||||
// path.setTime( calculatePathItem.getTime() );
|
||||
// path.setDistance( calculatePathItem.getDistance() );
|
||||
// List< NaviLatLng > coordList = calculatePathItem.getPath().getCoordList();
|
||||
// ArrayList< MogoLatLng > mogoLatLngs = new ArrayList<>();
|
||||
// for ( NaviLatLng latlng : coordList
|
||||
// ) {
|
||||
// MogoLatLng mogoLatLng =
|
||||
// new MogoLatLng( latlng.getLatitude(), latlng.getLongitude() );
|
||||
// mogoLatLngs.add( mogoLatLng );
|
||||
// }
|
||||
// path.setCoordList( mogoLatLngs );
|
||||
// path.setTrafficLights( calculatePathItem.getTrafficNumber() );
|
||||
// mPaths.add( path );
|
||||
// final RouteOverLayWrapper wrapper = calculatePathItem.getOverLazWrapper( true );
|
||||
// if ( wrapper == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// if ( wrapper.getTrafficColorfulPolyline() == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// path.setTagId( wrapper.getTrafficColorfulPolyline().getId() );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return mPaths;
|
||||
// }
|
||||
//
|
||||
// public List< MogoLatLng > getCalculatedPathPos() {
|
||||
//
|
||||
// if ( mSelectedCalculatePathItem != null ) {
|
||||
// return mSelectedCalculatePathItem.getCoordList();
|
||||
// }
|
||||
// //if (mPaths != null && !mPaths.isEmpty()) {
|
||||
// // return mPaths.get(0).getCoordList();
|
||||
// //}
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onItemClicked( String tagId ) {
|
||||
// handleClickedPolyline( tagId );
|
||||
// mAMapNavi.selectRouteId( getSelectedPathId() );
|
||||
// showBounds( mBoundRect );
|
||||
// }
|
||||
//
|
||||
// public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
// mLineClickInteraction = lineClickInteraction;
|
||||
// }
|
||||
//
|
||||
// public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
// if ( bounds != null ) {
|
||||
// mBoundRect = bounds;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 展示全程
|
||||
// */
|
||||
// public void displayOverview( Rect bounds ) {
|
||||
// showBounds( bounds );
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,92 @@
|
||||
//package com.mogo.map.impl.custom.navi;
|
||||
//
|
||||
//import com.amap.api.navi.enums.PathPlanningErrCode;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2019-10-18
|
||||
// * <p>
|
||||
// * 描述
|
||||
// */
|
||||
//public enum PathPlanningErrorCodeConstants {
|
||||
//
|
||||
// NONE( -1, "路线规划错误,请重试" ),
|
||||
//
|
||||
// ACCESS_TOO_FREQUENT( PathPlanningErrCode.ACCESS_TOO_FREQUENT, "访问过于频繁,请稍后再试" ),
|
||||
//
|
||||
// DISABLE_RESTRICT( PathPlanningErrCode.DISABLE_RESTRICT, "无法躲避限行区域,请重新规划" ),
|
||||
//
|
||||
// ERROR_BUF( PathPlanningErrCode.ERROR_BUF, "Buf数据格式错误" ),
|
||||
//
|
||||
// ERROR_CONNECTION( PathPlanningErrCode.ERROR_CONNECTION, "网络超时或网络失败。" ),
|
||||
//
|
||||
// ERROR_DISTANCE( PathPlanningErrCode.ERROR_DISTANCE, "起点/终点/途经点的距离太长(步行距离>100km,骑行距离>1200km)" ),
|
||||
//
|
||||
// ERROR_ENCODER( PathPlanningErrCode.ERROR_ENCODER, "算路服务端编码失败" ),
|
||||
//
|
||||
// ERROR_ENDPOINT( PathPlanningErrCode.ERROR_ENDPOINT, "终点错误" ),
|
||||
//
|
||||
// ERROR_NAVI_PARAMS( PathPlanningErrCode.ERROR_NAVI_PARAMS, "调用直接导航 没有算路 参数错误,缺失有效的导航路径,无法开始导航" ),
|
||||
//
|
||||
// ERROR_NOROADFORENDPOINT( PathPlanningErrCode.ERROR_NOROADFORENDPOINT, "终点没有找到道路" ),
|
||||
//
|
||||
// ERROR_NOROADFORSTARTPOINT( PathPlanningErrCode.ERROR_NOROADFORSTARTPOINT, "起点没有找到道路。" ),
|
||||
//
|
||||
// ERROR_NOROADFORWAYPOINT( PathPlanningErrCode.ERROR_NOROADFORWAYPOINT, "途径点没有找到道路" ),
|
||||
//
|
||||
// ERROR_PREVIEW( PathPlanningErrCode.ERROR_PREVIEW, "路径数据缺乏预览数据" ),
|
||||
//
|
||||
// ERROR_PROTOCOL( PathPlanningErrCode.ERROR_PROTOCOL, "请求协议非法。" ),
|
||||
//
|
||||
// ERROR_STARTPOINT( PathPlanningErrCode.ERROR_STARTPOINT, "起点错误" ),
|
||||
//
|
||||
// ERROR_WAYPOINT( PathPlanningErrCode.ERROR_WAYPOINT, "途经点错误" ),
|
||||
//
|
||||
// INSUFFICIENT_PRIVILEGES( PathPlanningErrCode.INSUFFICIENT_PRIVILEGES, "无权限访问此服务。" ),
|
||||
//
|
||||
// INVALID_PARAMS( PathPlanningErrCode.INVALID_PARAMS, "请求参数非法。" ),
|
||||
//
|
||||
// INVALID_USER_KEY( PathPlanningErrCode.INVALID_USER_KEY, "用户key非法或过期(请检查key是否正确)" ),
|
||||
//
|
||||
// INVALID_USER_SCODE( PathPlanningErrCode.INVALID_USER_SCODE, "MD5安全码未通过验证,需要开发者判定key绑定的SHA1,package是否与sdk包里的一致." ),
|
||||
//
|
||||
// OUT_OF_SERVICE( PathPlanningErrCode.OUT_OF_SERVICE, "使用路径规划服务接口时可能出现该问题,规划点(包括起点、终点、途经点)不在中国陆地范围内" ),
|
||||
//
|
||||
// OVER_DIRECTION_RANGE( PathPlanningErrCode.OVER_DIRECTION_RANGE, "使用路径规划服务接口时可能出现该问题,路线计算失败,通常是由于道路起点和终点距离过长导致" ),
|
||||
//
|
||||
// OVER_QUOTA( PathPlanningErrCode.OVER_QUOTA, "请求超出配额。" ),
|
||||
//
|
||||
// SERVICE_NOT_EXIST( PathPlanningErrCode.SERVICE_NOT_EXIST, "请求服务不存在。" ),
|
||||
//
|
||||
// SERVICE_RESPONSE_ERROR( PathPlanningErrCode.SERVICE_RESPONSE_ERROR, "请求服务响应错误。" ),
|
||||
//
|
||||
// UNKNOWN_ERROR( PathPlanningErrCode.UNKNOWN_ERROR, "未知错误(可能是由于连接的网络无法访问外网)" ),
|
||||
//
|
||||
// USERKEY_PLAT_NOMATCH( PathPlanningErrCode.USERKEY_PLAT_NOMATCH, "请求中使用的key与绑定平台不符,例如:开发者申请的是js api的key,却用来调web服务接口" );
|
||||
//
|
||||
// private int code;
|
||||
// private String errorMsg;
|
||||
//
|
||||
// PathPlanningErrorCodeConstants( int code, String errorMsg ) {
|
||||
// this.code = code;
|
||||
// this.errorMsg = errorMsg;
|
||||
// }
|
||||
//
|
||||
// public int getCode() {
|
||||
// return code;
|
||||
// }
|
||||
//
|
||||
// public String getErrorMsg() {
|
||||
// return errorMsg;
|
||||
// }
|
||||
//
|
||||
// public static String getErrorMsg( int code ) {
|
||||
// for ( PathPlanningErrorCodeConstants value : PathPlanningErrorCodeConstants.values() ) {
|
||||
// if ( value.getCode() == code ) {
|
||||
// return value.getErrorMsg();
|
||||
// }
|
||||
// }
|
||||
// return NONE.getErrorMsg();
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,120 @@
|
||||
//package com.mogo.map.impl.custom.navi;
|
||||
//
|
||||
//import android.text.TextUtils;
|
||||
//
|
||||
//import com.mogo.commons.AbsMogoApplication;
|
||||
//import com.mogo.commons.voice.AIAssist;
|
||||
//import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
//
|
||||
//import java.util.LinkedList;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2020-04-21
|
||||
// * <p>
|
||||
// * 播报导航TTS
|
||||
// * <p>
|
||||
// * 策略:队列缓存预播报的 tts,然后上一句播完后
|
||||
// */
|
||||
//public class TTSSpeaker implements IMogoVoiceCmdCallBack {
|
||||
//
|
||||
// private static volatile TTSSpeaker sInstance;
|
||||
//
|
||||
// private TTSSpeaker() {
|
||||
// }
|
||||
//
|
||||
// public static TTSSpeaker getInstance() {
|
||||
// if ( sInstance == null ) {
|
||||
// synchronized ( TTSSpeaker.class ) {
|
||||
// if ( sInstance == null ) {
|
||||
// sInstance = new TTSSpeaker();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return sInstance;
|
||||
// }
|
||||
//
|
||||
// public synchronized void release() {
|
||||
// sInstance = null;
|
||||
// }
|
||||
//
|
||||
// private LinkedList< String > mWaiting = new LinkedList<>();
|
||||
//
|
||||
// private String mLastTts = null;
|
||||
// private String mLastTtsId = null;
|
||||
//
|
||||
// public synchronized void speakTTS( String tts ) {
|
||||
// if ( TextUtils.isEmpty( tts ) ) {
|
||||
// return;
|
||||
// }
|
||||
// mWaiting.add( tts );
|
||||
// peekAndSpeak();
|
||||
// }
|
||||
//
|
||||
// public synchronized void shutUp() {
|
||||
// if ( mLastTtsId != null ) {
|
||||
// AIAssist.getInstance( AbsMogoApplication.getApp() ).shutUp( mLastTtsId, mLastTts );
|
||||
// mWaiting.clear();
|
||||
// mLastTtsId = null;
|
||||
// mLastTts = null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCmdSelected( String cmd ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCmdAction( String speakText ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCmdCancel( String speakText ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSpeakEnd( String speakText ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSpeakSelectTimeOut( String speakText ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onTTSStart( String ttsId, String tts ) {
|
||||
// if ( TextUtils.equals( mLastTts, tts ) ) {
|
||||
// mLastTtsId = ttsId;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onTTSEnd( String ttsId, String tts ) {
|
||||
// mLastTtsId = null;
|
||||
// peekAndSpeak();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onTTSError( String ttsId, String tts ) {
|
||||
// mLastTtsId = null;
|
||||
// peekAndSpeak();
|
||||
// }
|
||||
//
|
||||
// private synchronized void peekAndSpeak() {
|
||||
// if ( mWaiting.isEmpty() ) {
|
||||
// mLastTts = null;
|
||||
// mLastTtsId = null;
|
||||
// return;
|
||||
// }
|
||||
// if ( mLastTtsId != null ) {
|
||||
// // 上一句还没有播完
|
||||
// return;
|
||||
// }
|
||||
// mLastTts = mWaiting.pop();
|
||||
// AIAssist.getInstance( AbsMogoApplication.getApp() ).speakTTSAndDuck( mLastTts, this );
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.mogo.map.impl.custom.overlay;
|
||||
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.Polyline;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AMapPolylineWrapper implements IMogoPolyline {
|
||||
|
||||
private Polyline mPolyline;
|
||||
private MogoPolylineOptions mOptions;
|
||||
private boolean mIsDestroyed = false;
|
||||
|
||||
public AMapPolylineWrapper( Polyline mPolyline,
|
||||
MogoPolylineOptions mOptions ) {
|
||||
this.mPolyline = mPolyline;
|
||||
this.mOptions = mOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
mIsDestroyed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoints( List< MogoLatLng > lonLats ) {
|
||||
if ( lonLats == null || lonLats.isEmpty() ) {
|
||||
mPolyline.setPoints( new ArrayList<LonLatPoint>() );
|
||||
return;
|
||||
}
|
||||
ArrayList< LonLatPoint > points = new ArrayList<>();
|
||||
for ( MogoLatLng lonLat : lonLats ) {
|
||||
LonLatPoint latLng = ObjectUtils.fromMogo( lonLat );
|
||||
if ( latLng == null ) {
|
||||
continue;
|
||||
}
|
||||
points.add( latLng );
|
||||
}
|
||||
mPolyline.setPoints( points );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getPoints() {
|
||||
if ( mPolyline == null ) {
|
||||
return null;
|
||||
}
|
||||
ArrayList< MogoLatLng > lonLats = new ArrayList<>();
|
||||
List< LonLatPoint > points = mPolyline.getPoints();
|
||||
if ( points != null ) {
|
||||
for ( LonLatPoint latLng : points ) {
|
||||
MogoLatLng lonLat = ObjectUtils.fromAMap( latLng );
|
||||
if ( lonLat == null ) {
|
||||
continue;
|
||||
}
|
||||
lonLats.add( lonLat );
|
||||
}
|
||||
}
|
||||
return lonLats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGeodesic( boolean draw ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setGeodesic( draw );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGeodesic() {
|
||||
return mPolyline == null ? false : mPolyline.isGeodesic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDottedLine( boolean dottedLine ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setDottedLine( dottedLine );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDottedLine() {
|
||||
return mPolyline == null ? false : mPolyline.isDottedLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWidth( float width ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setWidth( width );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWidth() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getWidth();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor( int color ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setColor( color );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getColor();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZIndex( float zIndex ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setZIndex( zIndex );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getZIndex() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getZIndex();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible( boolean visible ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setVisible( visible );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.isVisible();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTransparency( float transparency ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setTransparency( transparency );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOption( MogoPolylineOptions option ) {
|
||||
PolylineOptions target = ObjectUtils.fromMogo( option );
|
||||
if ( target == null ) {
|
||||
return;
|
||||
}
|
||||
mOptions = option;
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setOption( target );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDestroyed() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package com.mogo.map.impl.custom.overlay;
|
||||
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.widget.EditText;
|
||||
|
||||
|
||||
import com.mogo.map.impl.custom.R;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class AMapUtil {
|
||||
/**
|
||||
* 判断edittext是否null
|
||||
*/
|
||||
public static String checkEditText(EditText editText) {
|
||||
if (editText != null && editText.getText() != null
|
||||
&& !(editText.getText().toString().trim().equals(""))) {
|
||||
return editText.getText().toString().trim();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static Spanned stringToSpan(String src) {
|
||||
return src == null ? null : Html.fromHtml(src.replace("\n", "<br />"));
|
||||
}
|
||||
|
||||
public static String colorFont(String src, String color) {
|
||||
StringBuffer strBuf = new StringBuffer();
|
||||
|
||||
strBuf.append("<font color=").append(color).append(">").append(src)
|
||||
.append("</font>");
|
||||
return strBuf.toString();
|
||||
}
|
||||
|
||||
public static String makeHtmlNewLine() {
|
||||
return "<br />";
|
||||
}
|
||||
|
||||
public static String makeHtmlSpace(int number) {
|
||||
final String space = " ";
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < number; i++) {
|
||||
result.append(space);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String getFriendlyLength(int lenMeter) {
|
||||
if (lenMeter > 10000) // 10 km
|
||||
{
|
||||
int dis = lenMeter / 1000;
|
||||
return dis + ChString.Kilometer;
|
||||
}
|
||||
|
||||
if (lenMeter > 1000) {
|
||||
float dis = (float) lenMeter / 1000;
|
||||
DecimalFormat fnum = new DecimalFormat("##0.0");
|
||||
String dstr = fnum.format(dis);
|
||||
return dstr + ChString.Kilometer;
|
||||
}
|
||||
|
||||
if (lenMeter > 100) {
|
||||
int dis = lenMeter / 50 * 50;
|
||||
return dis + ChString.Meter;
|
||||
}
|
||||
|
||||
int dis = lenMeter / 10 * 10;
|
||||
if (dis == 0) {
|
||||
dis = 10;
|
||||
}
|
||||
|
||||
return dis + ChString.Meter;
|
||||
}
|
||||
|
||||
public static boolean IsEmptyOrNullString(String s) {
|
||||
return (s == null) || (s.trim().length() == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 把LatLng对象转化为LatLonPoint对象
|
||||
*/
|
||||
// public static LonLatPoint convertToLatLonPoint(LatLng latlon) {
|
||||
// return new LonLatPoint(latlon.latitude, latlon.longitude);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 把LatLonPoint对象转化为LatLon对象
|
||||
*/
|
||||
// public static LatLng convertToLatLng(LatLonPoint latLonPoint) {
|
||||
// return new LatLng(latLonPoint.getLatitude(), latLonPoint.getLongitude());
|
||||
// }
|
||||
|
||||
/**
|
||||
* 把集合体的LatLonPoint转化为集合体的LatLng
|
||||
*/
|
||||
// public static ArrayList<LatLng> convertArrList(List<LatLonPoint> shapes) {
|
||||
// ArrayList<LatLng> lineShapes = new ArrayList<LatLng>();
|
||||
// for (LatLonPoint point : shapes) {
|
||||
// LatLng latLngTemp = AMapUtil.convertToLatLng(point);
|
||||
// lineShapes.add(latLngTemp);
|
||||
// }
|
||||
// return lineShapes;
|
||||
// }
|
||||
|
||||
/**
|
||||
* long类型时间格式化
|
||||
*/
|
||||
public static String convertToTime(long time) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = new Date(time);
|
||||
return df.format(date);
|
||||
}
|
||||
|
||||
public static final String HtmlBlack = "#000000";
|
||||
public static final String HtmlGray = "#808080";
|
||||
|
||||
public static String getFriendlyTime(int second) {
|
||||
if (second > 3600) {
|
||||
int hour = second / 3600;
|
||||
int miniate = (second % 3600) / 60;
|
||||
return hour + "小时" + miniate + "分钟";
|
||||
}
|
||||
if (second >= 60) {
|
||||
int miniate = second / 60;
|
||||
return miniate + "分钟";
|
||||
}
|
||||
return second + "秒";
|
||||
}
|
||||
|
||||
//路径规划方向指示和图片对应
|
||||
public static int getDriveActionID(String actionName) {
|
||||
if (actionName == null || actionName.equals("")) {
|
||||
return R.drawable.dir3;
|
||||
}
|
||||
if ("左转".equals(actionName)) {
|
||||
return R.drawable.dir2;
|
||||
}
|
||||
if ("右转".equals(actionName)) {
|
||||
return R.drawable.dir1;
|
||||
}
|
||||
if ("向左前方行驶".equals(actionName) || "靠左".equals(actionName)) {
|
||||
return R.drawable.dir6;
|
||||
}
|
||||
if ("向右前方行驶".equals(actionName) || "靠右".equals(actionName)) {
|
||||
return R.drawable.dir5;
|
||||
}
|
||||
if ("向左后方行驶".equals(actionName) || "左转调头".equals(actionName)) {
|
||||
return R.drawable.dir7;
|
||||
}
|
||||
if ("向右后方行驶".equals(actionName)) {
|
||||
return R.drawable.dir8;
|
||||
}
|
||||
if ("直行".equals(actionName)) {
|
||||
return R.drawable.dir3;
|
||||
}
|
||||
if ("减速行驶".equals(actionName)) {
|
||||
return R.drawable.dir4;
|
||||
}
|
||||
return R.drawable.dir3;
|
||||
}
|
||||
|
||||
public static int getWalkActionID(String actionName) {
|
||||
if (actionName == null || actionName.equals("")) {
|
||||
return R.drawable.dir13;
|
||||
}
|
||||
if ("左转".equals(actionName)) {
|
||||
return R.drawable.dir2;
|
||||
}
|
||||
if ("右转".equals(actionName)) {
|
||||
return R.drawable.dir1;
|
||||
}
|
||||
if ("向左前方".equals(actionName) || "靠左".equals(actionName) || actionName.contains("向左前方")) {
|
||||
return R.drawable.dir6;
|
||||
}
|
||||
if ("向右前方".equals(actionName) || "靠右".equals(actionName) || actionName.contains("向右前方")) {
|
||||
return R.drawable.dir5;
|
||||
}
|
||||
if ("向左后方".equals(actionName) || actionName.contains("向左后方")) {
|
||||
return R.drawable.dir7;
|
||||
}
|
||||
if ("向右后方".equals(actionName) || actionName.contains("向右后方")) {
|
||||
return R.drawable.dir8;
|
||||
}
|
||||
if ("直行".equals(actionName)) {
|
||||
return R.drawable.dir3;
|
||||
}
|
||||
if ("通过人行横道".equals(actionName)) {
|
||||
return R.drawable.dir9;
|
||||
}
|
||||
if ("通过过街天桥".equals(actionName)) {
|
||||
return R.drawable.dir11;
|
||||
}
|
||||
if ("通过地下通道".equals(actionName)) {
|
||||
return R.drawable.dir10;
|
||||
}
|
||||
|
||||
return R.drawable.dir13;
|
||||
}
|
||||
|
||||
// public static String getBusPathTitle(BusPath busPath) {
|
||||
// if (busPath == null) {
|
||||
// return String.valueOf("");
|
||||
// }
|
||||
// List<BusStep> busSetps = busPath.getSteps();
|
||||
// if (busSetps == null) {
|
||||
// return String.valueOf("");
|
||||
// }
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// for (BusStep busStep : busSetps) {
|
||||
// StringBuffer title = new StringBuffer();
|
||||
// if (busStep.getBusLines().size() > 0) {
|
||||
// for (RouteBusLineItem busline : busStep.getBusLines()) {
|
||||
// if (busline == null) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// String buslineName = getSimpleBusLineName(busline.getBusLineName());
|
||||
// title.append(buslineName);
|
||||
// title.append(" / ");
|
||||
// }
|
||||
//// RouteBusLineItem busline = busStep.getBusLines().get(0);
|
||||
//
|
||||
// sb.append(title.substring(0, title.length() - 3));
|
||||
// sb.append(" > ");
|
||||
// }
|
||||
// if (busStep.getRailway() != null) {
|
||||
// RouteRailwayItem railway = busStep.getRailway();
|
||||
// sb.append(railway.getTrip() + "(" + railway.getDeparturestop().getName()
|
||||
// + " - " + railway.getArrivalstop().getName() + ")");
|
||||
// sb.append(" > ");
|
||||
// }
|
||||
// }
|
||||
// return sb.substring(0, sb.length() - 3);
|
||||
// }
|
||||
|
||||
// public static String getBusPathDes(BusPath busPath) {
|
||||
// if (busPath == null) {
|
||||
// return String.valueOf("");
|
||||
// }
|
||||
// long second = busPath.getDuration();
|
||||
// String time = getFriendlyTime((int) second);
|
||||
// float subDistance = busPath.getDistance();
|
||||
// String subDis = getFriendlyLength((int) subDistance);
|
||||
// float walkDistance = busPath.getWalkDistance();
|
||||
// String walkDis = getFriendlyLength((int) walkDistance);
|
||||
// return String.valueOf(time + " | " + subDis + " | 步行" + walkDis);
|
||||
// }
|
||||
|
||||
public static String getSimpleBusLineName(String busLineName) {
|
||||
if (busLineName == null) {
|
||||
return String.valueOf("");
|
||||
}
|
||||
return busLineName.replaceAll("\\(.*?\\)", "");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.map.impl.custom.overlay;
|
||||
|
||||
public class ChString {
|
||||
public static final String Kilometer = "\u516c\u91cc";// "公里";
|
||||
public static final String Meter = "\u7c73";// "米";
|
||||
public static final String ByFoot = "\u6b65\u884c";// "步行";
|
||||
public static final String To = "\u53bb\u5f80";// "去往";
|
||||
public static final String Station = "\u8f66\u7ad9";// "车站";
|
||||
public static final String TargetPlace = "\u76ee\u7684\u5730";// "目的地";
|
||||
public static final String StartPlace = "\u51fa\u53d1\u5730";// "出发地";
|
||||
public static final String About = "\u5927\u7ea6";// "大约";
|
||||
public static final String Direction = "\u65b9\u5411";// "方向";
|
||||
|
||||
public static final String GetOn = "\u4e0a\u8f66";// "上车";
|
||||
public static final String GetOff = "\u4e0b\u8f66";// "下车";
|
||||
public static final String Zhan = "\u7ad9";// "站";
|
||||
|
||||
public static final String cross = "\u4ea4\u53c9\u8def\u53e3"; // 交叉路口
|
||||
public static final String type = "\u7c7b\u522b"; // 类别
|
||||
public static final String address = "\u5730\u5740"; // 地址
|
||||
public static final String PrevStep = "\u4e0a\u4e00\u6b65";
|
||||
public static final String NextStep = "\u4e0b\u4e00\u6b65";
|
||||
public static final String Gong = "\u516c\u4ea4";
|
||||
public static final String ByBus = "\u4e58\u8f66";
|
||||
public static final String Arrive = "\u5230\u8FBE";// 到达
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
//package com.mogo.map.impl.custom.overlay;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.graphics.Color;
|
||||
//
|
||||
//import com.mogo.map.impl.custom.R;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * 导航路线图层类
|
||||
// */
|
||||
//public class DrivingRouteOverlay extends RouteOverlay {
|
||||
// private DrivePath drivePath;
|
||||
// private List<LatLonPoint> throughPointList;
|
||||
// private List<Marker> throughPointMarkerList = new ArrayList<Marker>();
|
||||
// private boolean throughPointMarkerVisible = true;
|
||||
// private List<TMC> tmcs;
|
||||
// private PolylineOptions mPolylineOptions;
|
||||
// private PolylineOptions mPolylineOptionscolor;
|
||||
// private Context mContext;
|
||||
// private boolean isColorfulline = true;
|
||||
// private float mWidth = 4;
|
||||
// private List<LatLng> mLatLngsOfPath;
|
||||
//
|
||||
// public void setIsColorfulline(boolean iscolorfulline) {
|
||||
// this.isColorfulline = iscolorfulline;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据给定的参数,构造一个导航路线图层类对象。
|
||||
// *
|
||||
// * @param amap 地图对象。
|
||||
// * @param path 导航路线规划方案。
|
||||
// * @param context 当前的activity对象。
|
||||
// */
|
||||
// public DrivingRouteOverlay(Context context,
|
||||
// AMap amap,
|
||||
// DrivePath path,
|
||||
// LatLonPoint start,
|
||||
// LatLonPoint end,
|
||||
// List<LatLonPoint> throughPointList) {
|
||||
// super(context);
|
||||
// mContext = context;
|
||||
// mAMap = amap;
|
||||
// this.drivePath = path;
|
||||
// startPoint = AMapUtil.convertToLatLng(start);
|
||||
// endPoint = AMapUtil.convertToLatLng(end);
|
||||
// this.throughPointList = throughPointList;
|
||||
//
|
||||
// initBitmapDescriptor();
|
||||
// }
|
||||
//
|
||||
// public float getRouteWidth() {
|
||||
// return mWidth;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 设置路线宽度
|
||||
// *
|
||||
// * @param mWidth 路线宽度,取值范围:大于0
|
||||
// */
|
||||
// public void setRouteWidth(float mWidth) {
|
||||
// this.mWidth = mWidth;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 添加驾车路线添加到地图上显示。
|
||||
// */
|
||||
// public void addToMap() {
|
||||
// initPolylineOptions();
|
||||
// try {
|
||||
// if (mAMap == null) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (mWidth == 0 || drivePath == null) {
|
||||
// return;
|
||||
// }
|
||||
// mLatLngsOfPath = new ArrayList<LatLng>();
|
||||
// tmcs = new ArrayList<TMC>();
|
||||
// List<DriveStep> drivePaths = drivePath.getSteps();
|
||||
// mPolylineOptions.add(startPoint);
|
||||
// for (int i = 0; i < drivePaths.size(); i++) {
|
||||
// DriveStep step = drivePaths.get(i);
|
||||
// List<LatLonPoint> latlonPoints = step.getPolyline();
|
||||
// List<TMC> tmclist = step.getTMCs();
|
||||
// tmcs.addAll(tmclist);
|
||||
// addDrivingStationMarkers(step, convertToLatLng(latlonPoints.get(0)));
|
||||
// for (LatLonPoint latlonpoint : latlonPoints) {
|
||||
// mPolylineOptions.add(convertToLatLng(latlonpoint));
|
||||
// mLatLngsOfPath.add(convertToLatLng(latlonpoint));
|
||||
// }
|
||||
// }
|
||||
// mPolylineOptions.add(endPoint);
|
||||
// if (startMarker != null) {
|
||||
// startMarker.remove();
|
||||
// startMarker = null;
|
||||
// }
|
||||
//
|
||||
// if (endMarker != null) {
|
||||
// endMarker.remove();
|
||||
// endMarker = null;
|
||||
// }
|
||||
//// addStartAndEndMarker();
|
||||
//// addThroughPointMarker();
|
||||
// if (isColorfulline && tmcs.size() > 0) {
|
||||
// colorWayUpdate(tmcs);
|
||||
// showcolorPolyline();
|
||||
// } else {
|
||||
// showPolyline();
|
||||
// }
|
||||
//
|
||||
// } catch (Throwable e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 初始化线段属性
|
||||
// */
|
||||
// private void initPolylineOptions() {
|
||||
// mPolylineOptions = null;
|
||||
// mPolylineOptions = new PolylineOptions();
|
||||
// mPolylineOptions.color(getDriveColor()).width(getRouteWidth());
|
||||
// }
|
||||
//
|
||||
// private void showPolyline() {
|
||||
// addPolyLine(mPolylineOptions);
|
||||
// }
|
||||
//
|
||||
// private void showcolorPolyline() {
|
||||
// addPolyLine(mPolylineOptionscolor);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据不同的路段拥堵情况展示不同的颜色
|
||||
// *
|
||||
// * @param tmcSection
|
||||
// */
|
||||
// private void colorWayUpdate(List<TMC> tmcSection) {
|
||||
// if (mAMap == null) {
|
||||
// return;
|
||||
// }
|
||||
// if (tmcSection == null || tmcSection.size() <= 0) {
|
||||
// return;
|
||||
// }
|
||||
// TMC segmentTrafficStatus;
|
||||
// mPolylineOptionscolor = null;
|
||||
// mPolylineOptionscolor = new PolylineOptions();
|
||||
// mPolylineOptionscolor.width(getRouteWidth());
|
||||
// List<Integer> colorList = new ArrayList<Integer>();
|
||||
// List<BitmapDescriptor> bitmapDescriptors = new ArrayList<BitmapDescriptor>();
|
||||
// List<LatLng> points = new ArrayList<>();
|
||||
// List<Integer> texIndexList = new ArrayList<Integer>();
|
||||
//// mPolylineOptionscolor.add(startPoint);
|
||||
//// mPolylineOptionscolor.add(AMapUtil.convertToLatLng(tmcSection.get(0).getPolyline().get(0)));
|
||||
//
|
||||
// points.add(startPoint);
|
||||
// points.add(AMapUtil.convertToLatLng(tmcSection.get(0).getPolyline().get(0)));
|
||||
// colorList.add(getDriveColor());
|
||||
// bitmapDescriptors.add(defaultRoute);
|
||||
//
|
||||
// BitmapDescriptor bitmapDescriptor = null;
|
||||
// int textIndex = 0;
|
||||
// texIndexList.add(textIndex);
|
||||
// texIndexList.add(++textIndex);
|
||||
// for (int i = 0; i < tmcSection.size(); i++) {
|
||||
// segmentTrafficStatus = tmcSection.get(i);
|
||||
// int color = getcolor(segmentTrafficStatus.getStatus());
|
||||
// bitmapDescriptor = getTrafficBitmapDescriptor(segmentTrafficStatus.getStatus());
|
||||
// List<LatLonPoint> mployline = segmentTrafficStatus.getPolyline();
|
||||
// for (int j = 0; j < mployline.size(); j++) {
|
||||
//// mPolylineOptionscolor.add(AMapUtil.convertToLatLng(mployline.get(j)));
|
||||
// points.add(AMapUtil.convertToLatLng(mployline.get(j)));
|
||||
// colorList.add(color);
|
||||
//
|
||||
// texIndexList.add(++textIndex);
|
||||
// bitmapDescriptors.add(bitmapDescriptor);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// points.add(endPoint);
|
||||
// colorList.add(getDriveColor());
|
||||
// bitmapDescriptors.add(defaultRoute);
|
||||
// texIndexList.add(++textIndex);
|
||||
// mPolylineOptionscolor.addAll(points);
|
||||
// mPolylineOptionscolor.colorValues(colorList);
|
||||
//
|
||||
//// mPolylineOptionscolor.setCustomTextureIndex(texIndexList);
|
||||
//// mPolylineOptionscolor.setCustomTextureList(bitmapDescriptors);
|
||||
// }
|
||||
//
|
||||
// private BitmapDescriptor defaultRoute = null;
|
||||
// private BitmapDescriptor unknownTraffic = null;
|
||||
// private BitmapDescriptor smoothTraffic = null;
|
||||
// private BitmapDescriptor slowTraffic = null;
|
||||
// private BitmapDescriptor jamTraffic = null;
|
||||
// private BitmapDescriptor veryJamTraffic = null;
|
||||
//
|
||||
// private void initBitmapDescriptor() {
|
||||
// defaultRoute = BitmapDescriptorFactory.fromResource( R.drawable.amap_route_color_texture_6_arrow);
|
||||
// smoothTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_4_arrow);
|
||||
// unknownTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_0_arrow);
|
||||
// slowTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_3_arrow);
|
||||
// jamTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_2_arrow);
|
||||
// veryJamTraffic = BitmapDescriptorFactory.fromResource(R.drawable.amap_route_color_texture_9_arrow);
|
||||
// }
|
||||
//
|
||||
// private BitmapDescriptor getTrafficBitmapDescriptor(String status) {
|
||||
// if (status.equals("畅通")) {
|
||||
// return smoothTraffic;
|
||||
// } else if (status.equals("缓行")) {
|
||||
// return slowTraffic;
|
||||
// } else if (status.equals("拥堵")) {
|
||||
// return jamTraffic;
|
||||
// } else if (status.equals("严重拥堵")) {
|
||||
// return veryJamTraffic;
|
||||
// } else {
|
||||
// return defaultRoute;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private int getcolor(String status) {
|
||||
// if (status.equals("畅通")) {
|
||||
// return Color.GREEN;
|
||||
// } else if (status.equals("缓行")) {
|
||||
// return Color.YELLOW;
|
||||
// } else if (status.equals("拥堵")) {
|
||||
// return Color.RED;
|
||||
// } else if (status.equals("严重拥堵")) {
|
||||
// return Color.parseColor("#990033");
|
||||
// } else {
|
||||
// return Color.GREEN;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public LatLng convertToLatLng(LatLonPoint point) {
|
||||
// return new LatLng(point.getLatitude(), point.getLongitude());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param driveStep
|
||||
// * @param latLng
|
||||
// */
|
||||
// private void addDrivingStationMarkers(DriveStep driveStep, LatLng latLng) {
|
||||
// addStationMarker(new MarkerOptions()
|
||||
// .position(latLng)
|
||||
// .title("\u65B9\u5411:" + driveStep.getAction()
|
||||
// + "\n\u9053\u8DEF:" + driveStep.getRoad())
|
||||
// .snippet(driveStep.getInstruction()).visible(nodeIconVisible)
|
||||
// .anchor(0.5f, 0.5f).icon(getDriveBitmapDescriptor()));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected LatLngBounds getLatLngBounds() {
|
||||
// LatLngBounds.Builder b = LatLngBounds.builder();
|
||||
// b.include(new LatLng(startPoint.latitude, startPoint.longitude));
|
||||
// b.include(new LatLng(endPoint.latitude, endPoint.longitude));
|
||||
// if (this.throughPointList != null && this.throughPointList.size() > 0) {
|
||||
// for (int i = 0; i < this.throughPointList.size(); i++) {
|
||||
// b.include(new LatLng(
|
||||
// this.throughPointList.get(i).getLatitude(),
|
||||
// this.throughPointList.get(i).getLongitude()));
|
||||
// }
|
||||
// }
|
||||
// return b.build();
|
||||
// }
|
||||
//
|
||||
// public void setThroughPointIconVisibility(boolean visible) {
|
||||
// try {
|
||||
// throughPointMarkerVisible = visible;
|
||||
// if (this.throughPointMarkerList != null
|
||||
// && this.throughPointMarkerList.size() > 0) {
|
||||
// for (int i = 0; i < this.throughPointMarkerList.size(); i++) {
|
||||
// this.throughPointMarkerList.get(i).setVisible(visible);
|
||||
// }
|
||||
// }
|
||||
// } catch (Throwable e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void addThroughPointMarker() {
|
||||
// if (this.throughPointList != null && this.throughPointList.size() > 0) {
|
||||
// LatLonPoint latLonPoint = null;
|
||||
// for (int i = 0; i < this.throughPointList.size(); i++) {
|
||||
// latLonPoint = this.throughPointList.get(i);
|
||||
// if (latLonPoint != null) {
|
||||
// throughPointMarkerList.add(mAMap
|
||||
// .addMarker((new MarkerOptions())
|
||||
// .position(
|
||||
// new LatLng(latLonPoint
|
||||
// .getLatitude(), latLonPoint
|
||||
// .getLongitude()))
|
||||
// .visible(throughPointMarkerVisible)
|
||||
// .icon(getThroughPointBitDes())
|
||||
// .title("\u9014\u7ECF\u70B9")));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private BitmapDescriptor getThroughPointBitDes() {
|
||||
// return BitmapDescriptorFactory.fromResource(R.drawable.amap_through);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取两点间距离
|
||||
// *
|
||||
// * @param start
|
||||
// * @param end
|
||||
// * @return
|
||||
// */
|
||||
// public static int calculateDistance(LatLng start, LatLng end) {
|
||||
// double x1 = start.longitude;
|
||||
// double y1 = start.latitude;
|
||||
// double x2 = end.longitude;
|
||||
// double y2 = end.latitude;
|
||||
// return calculateDistance(x1, y1, x2, y2);
|
||||
// }
|
||||
//
|
||||
// public static int calculateDistance(double x1, double y1, double x2, double y2) {
|
||||
// final double NF_pi = 0.01745329251994329; // 弧度 PI/180
|
||||
// x1 *= NF_pi;
|
||||
// y1 *= NF_pi;
|
||||
// x2 *= NF_pi;
|
||||
// y2 *= NF_pi;
|
||||
// double sinx1 = Math.sin(x1);
|
||||
// double siny1 = Math.sin(y1);
|
||||
// double cosx1 = Math.cos(x1);
|
||||
// double cosy1 = Math.cos(y1);
|
||||
// double sinx2 = Math.sin(x2);
|
||||
// double siny2 = Math.sin(y2);
|
||||
// double cosx2 = Math.cos(x2);
|
||||
// double cosy2 = Math.cos(y2);
|
||||
// double[] v1 = new double[3];
|
||||
// v1[0] = cosy1 * cosx1 - cosy2 * cosx2;
|
||||
// v1[1] = cosy1 * sinx1 - cosy2 * sinx2;
|
||||
// v1[2] = siny1 - siny2;
|
||||
// double dist = Math.sqrt(v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2]);
|
||||
//
|
||||
// return (int) (Math.asin(dist / 2) * 12742001.5798544);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //获取指定两点之间固定距离点
|
||||
// public static LatLng getPointForDis(LatLng sPt, LatLng ePt, double dis) {
|
||||
// double lSegLength = calculateDistance(sPt, ePt);
|
||||
// double preResult = dis / lSegLength;
|
||||
// return new LatLng((ePt.latitude - sPt.latitude) * preResult + sPt.latitude, (ePt.longitude - sPt.longitude) * preResult + sPt.longitude);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 去掉DriveLineOverlay上的线段和标记。
|
||||
// */
|
||||
// @Override
|
||||
// public void removeFromMap() {
|
||||
// try {
|
||||
// super.removeFromMap();
|
||||
// if (this.throughPointMarkerList != null
|
||||
// && this.throughPointMarkerList.size() > 0) {
|
||||
// for (int i = 0; i < this.throughPointMarkerList.size(); i++) {
|
||||
// this.throughPointMarkerList.get(i).remove();
|
||||
// }
|
||||
// this.throughPointMarkerList.clear();
|
||||
// }
|
||||
// } catch (Throwable e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,36 @@
|
||||
//package com.mogo.map.impl.custom.overlay;
|
||||
//
|
||||
//import com.amap.api.services.route.BusRouteResult;
|
||||
//import com.amap.api.services.route.DriveRouteResult;
|
||||
//import com.amap.api.services.route.RideRouteResult;
|
||||
//import com.amap.api.services.route.RouteSearch;
|
||||
//import com.amap.api.services.route.WalkRouteResult;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2020-01-08
|
||||
// * <p>
|
||||
// * 描述
|
||||
// */
|
||||
//public abstract class OnRouteSearchListenerAdapter implements RouteSearch.OnRouteSearchListener {
|
||||
//
|
||||
// @Override
|
||||
// public void onBusRouteSearched( BusRouteResult busRouteResult, int i ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onDriveRouteSearched( DriveRouteResult driveRouteResult, int i ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onWalkRouteSearched( WalkRouteResult walkRouteResult, int i ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onRideRouteSearched( RideRouteResult rideRouteResult, int i ) {
|
||||
//
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,210 @@
|
||||
//package com.mogo.map.impl.custom.overlay;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.graphics.BitmapFactory;
|
||||
//import android.util.Log;
|
||||
//
|
||||
//import com.amap.api.maps.AMap;
|
||||
//import com.amap.api.maps.model.NavigateArrowOptions;
|
||||
//import com.amap.api.maps.model.Polyline;
|
||||
//import com.amap.api.navi.model.AMapNaviLocation;
|
||||
//import com.amap.api.navi.model.AMapNaviPath;
|
||||
//import com.amap.api.navi.model.NaviInfo;
|
||||
//import com.amap.api.navi.model.RouteOverlayOptions;
|
||||
//import com.amap.api.navi.view.RouteOverLay;
|
||||
//import com.mogo.map.impl.custom.utils.MapStyleUtils;
|
||||
//import com.mogo.utils.logger.Logger;
|
||||
//
|
||||
//import java.lang.ref.WeakReference;
|
||||
//import java.lang.reflect.Field;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2019-10-04
|
||||
// * <p>
|
||||
// * 路径覆盖物
|
||||
// */
|
||||
//public class RouteOverLayWrapper {
|
||||
//
|
||||
// private static final String TAG = "RouteOverLayWrapper";
|
||||
//
|
||||
// private final WeakReference< Context > mContextRef;
|
||||
// private final AMap mAMap;
|
||||
// private final AMapNaviPath mPath;
|
||||
//
|
||||
// private RouteOverLay mRouteOverLay;
|
||||
// private boolean mIsRemoved = true;
|
||||
//
|
||||
// private boolean mIsTrafficLightsVisible = true;
|
||||
// private int mStartBitmapResId = 0;
|
||||
// private int mEndBitmapResId = 0;
|
||||
// private int mZIndex = 0;
|
||||
//
|
||||
// private static RouteOverlayOptions sOptions;
|
||||
//
|
||||
// public RouteOverLayWrapper( Context context,
|
||||
// AMap mAMap,
|
||||
// AMapNaviPath mPath ) {
|
||||
// this.mContextRef = new WeakReference<>( context );
|
||||
// this.mAMap = mAMap;
|
||||
// this.mPath = mPath;
|
||||
// }
|
||||
//
|
||||
// public void addToMap() {
|
||||
// if ( mContextRef == null || mContextRef.get() == null ) {
|
||||
// return;
|
||||
// }
|
||||
// mRouteOverLay = new RouteOverLay( mAMap, mPath, mContextRef.get() );
|
||||
// if ( sOptions == null ) {
|
||||
// sOptions = MapStyleUtils.getRouteOverlayOptions();
|
||||
// }
|
||||
// mRouteOverLay.setRouteOverlayOptions( sOptions );
|
||||
// mRouteOverLay.setTrafficLine( true );
|
||||
// mRouteOverLay.setRouteOverlayVisible( true );
|
||||
// mRouteOverLay.setTrafficLightsVisible( true );
|
||||
// mRouteOverLay.setArrowOnRoute( true );
|
||||
// mRouteOverLay.setZindex( mZIndex );
|
||||
// mRouteOverLay.setNaviArrowVisible( true );
|
||||
// mRouteOverLay.setLightsVisible( true );
|
||||
// mRouteOverLay.setTrafficLightsVisible( mIsTrafficLightsVisible );
|
||||
// hookRouteArrow();
|
||||
//
|
||||
// if ( mStartBitmapResId != 0 ) {
|
||||
// try {
|
||||
// mRouteOverLay.setStartPointBitmap( BitmapFactory.decodeResource( mContextRef.get().getResources(), mStartBitmapResId ) );
|
||||
// } catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// } else {
|
||||
// mRouteOverLay.setStartPointBitmap( null );
|
||||
// }
|
||||
//
|
||||
// if ( mEndBitmapResId != 0 ) {
|
||||
// try {
|
||||
// mRouteOverLay.setEndPointBitmap( BitmapFactory.decodeResource( mContextRef.get().getResources(), mEndBitmapResId ) );
|
||||
// } catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// } else {
|
||||
// mRouteOverLay.setEndPointBitmap( null );
|
||||
// }
|
||||
//
|
||||
// mRouteOverLay.addToMap();
|
||||
// mIsRemoved = false;
|
||||
// }
|
||||
//
|
||||
// public void remove() {
|
||||
// Log.d( TAG, "remove" );
|
||||
// if ( mRouteOverLay != null ) {
|
||||
// try {
|
||||
// mRouteOverLay.removeFromMap();
|
||||
// mIsRemoved = true;
|
||||
// } catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 设置透明度
|
||||
// *
|
||||
// * @param alpha
|
||||
// */
|
||||
// public void setTransparency( float alpha ) {
|
||||
// if ( mRouteOverLay != null ) {
|
||||
// mRouteOverLay.setTransparency( alpha );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public RouteOverLayWrapper setTrafficLightsVisible( boolean visible ) {
|
||||
// mIsTrafficLightsVisible = visible;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public RouteOverLayWrapper setStartBitmap( int startBitmapResId ) {
|
||||
// mStartBitmapResId = startBitmapResId;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public RouteOverLayWrapper setEndBitmap( int endBitmapResId ) {
|
||||
// mEndBitmapResId = endBitmapResId;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public RouteOverLayWrapper setZIndex( int zIndex ) {
|
||||
// mZIndex = zIndex;
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public int getZIndex() {
|
||||
// return mZIndex;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void finalize() throws Throwable {
|
||||
// super.finalize();
|
||||
// mIsRemoved = true;
|
||||
// }
|
||||
//
|
||||
// public synchronized boolean isRemoved() {
|
||||
// return mIsRemoved;
|
||||
// }
|
||||
//
|
||||
// public void updatePolyline( AMapNaviLocation aMapNaviLocation ) {
|
||||
// if ( mIsRemoved ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( mRouteOverLay != null ) {
|
||||
// mRouteOverLay.updatePolyline( aMapNaviLocation );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void drawArrow( NaviInfo naviInfo ) {
|
||||
// Log.d( TAG, "drawArrow" );
|
||||
// if ( mIsRemoved ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( naviInfo == null ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( mRouteOverLay != null ) {
|
||||
// try {
|
||||
// mRouteOverLay.drawArrow( mRouteOverLay.getArrowPoints( naviInfo.getCurStep() ) );
|
||||
// } catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void hookRouteArrow() {
|
||||
// if ( mRouteOverLay != null && sOptions != null ) {
|
||||
// try {
|
||||
// Field field = mRouteOverLay.getClass().getDeclaredField( "naviArrow" );
|
||||
// field.setAccessible( true );
|
||||
// field.set( mRouteOverLay, mAMap.addNavigateArrow( new NavigateArrowOptions().topColor( sOptions.getArrowColor() ).width( sOptions.getLineWidth() ).sideColor( sOptions.getArrowSideColor() ) ) );
|
||||
// Logger.d( TAG, "hook 成功。" );
|
||||
// } catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public Polyline getTrafficColorfulPolyline() {
|
||||
// if ( mRouteOverLay != null ) {
|
||||
// return mRouteOverLay.mTrafficColorfulPolyline;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public void destroy() {
|
||||
// Log.d( TAG, "destroy" );
|
||||
// if ( mRouteOverLay != null ) {
|
||||
// try {
|
||||
// mRouteOverLay.destroy();
|
||||
// mIsRemoved = true;
|
||||
// } catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,236 @@
|
||||
//package com.mogo.map.impl.custom.overlay;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.graphics.Bitmap;
|
||||
//import android.graphics.Color;
|
||||
//
|
||||
//import com.amap.api.maps.AMap;
|
||||
//import com.amap.api.maps.CameraUpdateFactory;
|
||||
//import com.amap.api.maps.model.BitmapDescriptor;
|
||||
//import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
//import com.amap.api.maps.model.LatLng;
|
||||
//import com.amap.api.maps.model.LatLngBounds;
|
||||
//import com.amap.api.maps.model.Marker;
|
||||
//import com.amap.api.maps.model.MarkerOptions;
|
||||
//import com.amap.api.maps.model.Polyline;
|
||||
//import com.amap.api.maps.model.PolylineOptions;
|
||||
//import com.mogo.map.impl.custom.R;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//
|
||||
//public class RouteOverlay {
|
||||
// protected List<Marker> stationMarkers = new ArrayList<Marker>();
|
||||
// protected List<Polyline> allPolyLines = new ArrayList<Polyline>();
|
||||
// protected Marker startMarker;
|
||||
// protected Marker endMarker;
|
||||
// protected LatLng startPoint;
|
||||
// protected LatLng endPoint;
|
||||
// protected AMap mAMap;
|
||||
// private Context mContext;
|
||||
// private Bitmap startBit, endBit, busBit, walkBit, driveBit;
|
||||
// protected boolean nodeIconVisible = true;
|
||||
//
|
||||
// public RouteOverlay(Context context) {
|
||||
// mContext = context;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 去掉BusRouteOverlay上所有的Marker。
|
||||
// *
|
||||
// * @since V2.1.0
|
||||
// */
|
||||
// public void removeFromMap() {
|
||||
// if (startMarker != null) {
|
||||
// startMarker.remove();
|
||||
//
|
||||
// }
|
||||
// if (endMarker != null) {
|
||||
// endMarker.remove();
|
||||
// }
|
||||
// for (Marker marker : stationMarkers) {
|
||||
// marker.remove();
|
||||
// }
|
||||
// for (Polyline line : allPolyLines) {
|
||||
// line.remove();
|
||||
// }
|
||||
// destroyBit();
|
||||
// }
|
||||
//
|
||||
// private void destroyBit() {
|
||||
// if (startBit != null) {
|
||||
// startBit.recycle();
|
||||
// startBit = null;
|
||||
// }
|
||||
// if (endBit != null) {
|
||||
// endBit.recycle();
|
||||
// endBit = null;
|
||||
// }
|
||||
// if (busBit != null) {
|
||||
// busBit.recycle();
|
||||
// busBit = null;
|
||||
// }
|
||||
// if (walkBit != null) {
|
||||
// walkBit.recycle();
|
||||
// walkBit = null;
|
||||
// }
|
||||
// if (driveBit != null) {
|
||||
// driveBit.recycle();
|
||||
// driveBit = null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 给起点Marker设置图标,并返回更换图标的图片。如不用默认图片,需要重写此方法。
|
||||
// *
|
||||
// * @return 更换的Marker图片。
|
||||
// * @since V2.1.0
|
||||
// */
|
||||
// protected BitmapDescriptor getStartBitmapDescriptor() {
|
||||
// return BitmapDescriptorFactory.fromResource( R.drawable.amap_start);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 给终点Marker设置图标,并返回更换图标的图片。如不用默认图片,需要重写此方法。
|
||||
// *
|
||||
// * @return 更换的Marker图片。
|
||||
// * @since V2.1.0
|
||||
// */
|
||||
// protected BitmapDescriptor getEndBitmapDescriptor() {
|
||||
// return BitmapDescriptorFactory.fromResource(R.drawable.amap_end);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 给公交Marker设置图标,并返回更换图标的图片。如不用默认图片,需要重写此方法。
|
||||
// *
|
||||
// * @return 更换的Marker图片。
|
||||
// * @since V2.1.0
|
||||
// */
|
||||
// protected BitmapDescriptor getBusBitmapDescriptor() {
|
||||
// return BitmapDescriptorFactory.fromResource(R.drawable.amap_bus);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 给步行Marker设置图标,并返回更换图标的图片。如不用默认图片,需要重写此方法。
|
||||
// *
|
||||
// * @return 更换的Marker图片。
|
||||
// * @since V2.1.0
|
||||
// */
|
||||
// protected BitmapDescriptor getWalkBitmapDescriptor() {
|
||||
// return BitmapDescriptorFactory.fromResource(R.drawable.amap_man);
|
||||
// }
|
||||
//
|
||||
// protected BitmapDescriptor getDriveBitmapDescriptor() {
|
||||
// return BitmapDescriptorFactory.fromResource(R.drawable.amap_car);
|
||||
// }
|
||||
//
|
||||
// protected void addStartAndEndMarker() {
|
||||
// startMarker = mAMap.addMarker((new MarkerOptions())
|
||||
// .position(startPoint).icon(getStartBitmapDescriptor())
|
||||
// .title("\u8D77\u70B9"));
|
||||
// // startMarker.showInfoWindow();
|
||||
//
|
||||
// endMarker = mAMap.addMarker((new MarkerOptions()).position(endPoint)
|
||||
// .icon(getEndBitmapDescriptor()).title("\u7EC8\u70B9"));
|
||||
// // mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(startPoint,
|
||||
// // getShowRouteZoom()));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 移动镜头到当前的视角。
|
||||
// *
|
||||
// * @since V2.1.0
|
||||
// */
|
||||
// public void zoomToSpan() {
|
||||
// if (startPoint != null) {
|
||||
// if (mAMap == null)
|
||||
// return;
|
||||
// try {
|
||||
// LatLngBounds bounds = getLatLngBounds();
|
||||
// mAMap.animateCamera(CameraUpdateFactory
|
||||
// .newLatLngBounds(bounds, 50));
|
||||
// } catch (Throwable e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// protected LatLngBounds getLatLngBounds() {
|
||||
// LatLngBounds.Builder b = LatLngBounds.builder();
|
||||
// b.include(new LatLng(startPoint.latitude, startPoint.longitude));
|
||||
// b.include(new LatLng(endPoint.latitude, endPoint.longitude));
|
||||
// for (Polyline polyline : allPolyLines) {
|
||||
// for (LatLng point : polyline.getPoints()) {
|
||||
// b.include(point);
|
||||
// }
|
||||
// }
|
||||
// return b.build();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 路段节点图标控制显示接口。
|
||||
// *
|
||||
// * @param visible true为显示节点图标,false为不显示。
|
||||
// * @since V2.3.1
|
||||
// */
|
||||
// public void setNodeIconVisibility(boolean visible) {
|
||||
// try {
|
||||
// nodeIconVisible = visible;
|
||||
// if (this.stationMarkers != null && this.stationMarkers.size() > 0) {
|
||||
// for (int i = 0; i < this.stationMarkers.size(); i++) {
|
||||
// this.stationMarkers.get(i).setVisible(visible);
|
||||
// }
|
||||
// }
|
||||
// } catch (Throwable e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// protected void addStationMarker(MarkerOptions options) {
|
||||
// if (options == null) {
|
||||
// return;
|
||||
// }
|
||||
// Marker marker = mAMap.addMarker(options);
|
||||
// if (marker != null) {
|
||||
// stationMarkers.add(marker);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// protected void addPolyLine(PolylineOptions options) {
|
||||
// if (options == null) {
|
||||
// return;
|
||||
// }
|
||||
// Polyline polyline = mAMap.addPolyline(options);
|
||||
// if (polyline != null) {
|
||||
// allPolyLines.add(polyline);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// protected float getRouteWidth() {
|
||||
// return 18f;
|
||||
// }
|
||||
//
|
||||
// protected int getWalkColor() {
|
||||
// return Color.parseColor("#6db74d");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 自定义路线颜色。
|
||||
// * return 自定义路线颜色。
|
||||
// *
|
||||
// * @since V2.2.1
|
||||
// */
|
||||
// protected int getBusColor() {
|
||||
// return Color.parseColor("#537edc");
|
||||
// }
|
||||
//
|
||||
// protected int getDriveColor() {
|
||||
// return Color.parseColor("#537edc");
|
||||
// }
|
||||
//
|
||||
// // protected int getShowRouteZoom() {
|
||||
// // return 15;
|
||||
// // }
|
||||
//}
|
||||
@@ -0,0 +1,97 @@
|
||||
//package com.mogo.map.impl.custom.overlay;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//
|
||||
//import com.amap.api.services.core.LatLonPoint;
|
||||
//import com.amap.api.services.route.DriveRouteResult;
|
||||
//import com.amap.api.services.route.RouteSearch;
|
||||
//import com.mogo.map.MogoLatLng;
|
||||
//import com.mogo.map.impl.custom.AMapWrapper;
|
||||
//import com.mogo.map.impl.custom.InterceptorHandler;
|
||||
//import com.mogo.utils.logger.Logger;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2020-01-08
|
||||
// * <p>
|
||||
// * 给定起点、途经点,规划路径
|
||||
// */
|
||||
//public class RouteOverlayHelper {
|
||||
//
|
||||
// private static final String TAG = "RouteOverlayHelper";
|
||||
//
|
||||
// private static volatile RouteOverlayHelper sInstance;
|
||||
//
|
||||
// private DrivingRouteOverlay mDrivingRouteOverlay;
|
||||
//
|
||||
// private RouteOverlayHelper() {
|
||||
// }
|
||||
//
|
||||
// public static RouteOverlayHelper getInstance() {
|
||||
// if ( sInstance == null ) {
|
||||
// synchronized ( RouteOverlayHelper.class ) {
|
||||
// if ( sInstance == null ) {
|
||||
// sInstance = new RouteOverlayHelper();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return sInstance;
|
||||
// }
|
||||
//
|
||||
// public synchronized void release() {
|
||||
// sInstance = null;
|
||||
// }
|
||||
//
|
||||
// public void addRouteWay( final Context context, MogoLatLng start, MogoLatLng end, List< MogoLatLng > wayPoints ) {
|
||||
// if ( wayPoints == null || wayPoints.isEmpty() ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( InterceptorHandler.getInstance().ignoreDrawRouteOverlay( context ) ) {
|
||||
// Logger.w( TAG, "naviing." );
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if ( mDrivingRouteOverlay != null ) {
|
||||
// mDrivingRouteOverlay.removeFromMap();
|
||||
// }
|
||||
//
|
||||
// RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo( new LatLonPoint( start.lat, start.lng ),
|
||||
// new LatLonPoint( end.lat, end.lng ) );
|
||||
// final List< LatLonPoint > ways = new ArrayList<>();
|
||||
// for ( MogoLatLng wayPoint : wayPoints ) {
|
||||
// ways.add( new LatLonPoint( wayPoint.lat, wayPoint.lng ) );
|
||||
// }
|
||||
// RouteSearch.DriveRouteQuery query = new RouteSearch.DriveRouteQuery( fromAndTo, 0, ways, null, "" );
|
||||
// RouteSearch routeSearch = new RouteSearch( context );
|
||||
// routeSearch.calculateDriveRouteAsyn( query );
|
||||
// routeSearch.setRouteSearchListener( new OnRouteSearchListenerAdapter() {
|
||||
// @Override
|
||||
// public void onDriveRouteSearched( DriveRouteResult driveRouteResult, int i ) {
|
||||
// super.onDriveRouteSearched( driveRouteResult, i );
|
||||
// if ( i != 1000 ) {
|
||||
// Logger.e( TAG, "算路失败. code = %d", i );
|
||||
// return;
|
||||
// }
|
||||
// mDrivingRouteOverlay = new DrivingRouteOverlay( context, AMapWrapper.getAMap(),
|
||||
// driveRouteResult.getPaths().get( 0 ),
|
||||
// driveRouteResult.getStartPos(),
|
||||
// driveRouteResult.getTargetPos(),
|
||||
// null );
|
||||
// mDrivingRouteOverlay.setNodeIconVisibility( false );
|
||||
// mDrivingRouteOverlay.setIsColorfulline( false );
|
||||
// mDrivingRouteOverlay.addToMap();
|
||||
// mDrivingRouteOverlay.zoomToSpan();
|
||||
// }
|
||||
// } );
|
||||
// }
|
||||
//
|
||||
// public void removeAll() {
|
||||
// if ( mDrivingRouteOverlay != null ) {
|
||||
// mDrivingRouteOverlay.removeFromMap();
|
||||
// }
|
||||
// mDrivingRouteOverlay = null;
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.mogo.map.impl.custom.search;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearchListener;
|
||||
import com.mogo.map.search.geo.MogoGeocodeAddress;
|
||||
import com.mogo.map.search.geo.MogoRegeocodeAddress;
|
||||
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||
import com.zhidaoauto.map.sdk.open.exception.MapException;
|
||||
import com.zhidaoauto.map.sdk.open.query.GeocodeAddress;
|
||||
import com.zhidaoauto.map.sdk.open.query.GeocodeResult;
|
||||
import com.zhidaoauto.map.sdk.open.query.GeocodeSearch;
|
||||
import com.zhidaoauto.map.sdk.open.query.OnGeocodeSearchListener;
|
||||
import com.zhidaoauto.map.sdk.open.query.RegeocodeAddress;
|
||||
import com.zhidaoauto.map.sdk.open.query.RegeocodeResult;
|
||||
import com.zhidaoauto.map.sdk.open.query.RegeocodeQuery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-19
|
||||
* <p>
|
||||
* 地理编码/逆地理编码高德实现
|
||||
*/
|
||||
public class GeocodeSearchClient implements IMogoGeoSearch, OnGeocodeSearchListener {
|
||||
|
||||
private GeocodeSearch mClient;
|
||||
private IMogoGeoSearchListener mListener;
|
||||
|
||||
public GeocodeSearchClient( Context context ) {
|
||||
mClient = new GeocodeSearch( context );
|
||||
mClient.setOnGeocodeSearchListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGeoSearchListener( IMogoGeoSearchListener listener ) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoRegeocodeAddress getFromLocation( MogoRegeocodeQuery query ) throws MogoMapException {
|
||||
try {
|
||||
RegeocodeQuery regeocodeQuery = ObjectUtils.fromMogo(query);
|
||||
RegeocodeAddress regeocodeAddress = mClient.getFromLocation(regeocodeQuery);
|
||||
return ObjectUtils.fromAMap( regeocodeAddress );
|
||||
} catch ( Exception e ) {
|
||||
throw new MogoMapException( e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoGeocodeAddress > getFromLocationName( MogoGeocodeQuery query ) throws MogoMapException {
|
||||
try {
|
||||
List<GeocodeAddress> geocodeAddress = mClient.getFromLocationName( ObjectUtils.fromMogo( query ) );
|
||||
if ( geocodeAddress != null ) {
|
||||
List< MogoGeocodeAddress > mogoGeocodeAddresses = new ArrayList<>();
|
||||
for ( GeocodeAddress address : geocodeAddress ) {
|
||||
MogoGeocodeAddress mogoGeocodeAddress = ObjectUtils.fromAMap( address );
|
||||
if ( mogoGeocodeAddress != null ) {
|
||||
mogoGeocodeAddresses.add( mogoGeocodeAddress );
|
||||
}
|
||||
}
|
||||
return mogoGeocodeAddresses;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
} catch ( Exception e ) {
|
||||
throw new MogoMapException( e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFromLocationAsyn( MogoRegeocodeQuery query ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.getFromLocationAsyn( ObjectUtils.fromMogo( query ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFromLocationNameAsyn( MogoGeocodeQuery query ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.getFromLocationNameAsyn( ObjectUtils.fromMogo( query ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i ) {
|
||||
if ( mListener != null ) {
|
||||
mListener.onRegeocodeSearched( ObjectUtils.fromAMap( regeocodeResult ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGeocodeSearched(GeocodeResult geocodeResult, int i ) {
|
||||
if ( mListener != null ) {
|
||||
mListener.onGeocodeSearched( ObjectUtils.fromAMap( geocodeResult ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
mClient = null;
|
||||
mListener = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.mogo.map.impl.custom.search;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsListener;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.MogoTip;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.query.Inputtips;
|
||||
import com.zhidaoauto.map.sdk.open.query.InputtipsListener;
|
||||
import com.zhidaoauto.map.sdk.open.query.InputtipsQuery;
|
||||
import com.zhidaoauto.map.sdk.open.query.Tip;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-20
|
||||
* <p>
|
||||
* 高德地图 inputtips搜索实现
|
||||
*/
|
||||
public class InputtipsSearch implements IMogoInputtipsSearch, InputtipsListener {
|
||||
|
||||
private static final String TAG = "InputtipsSearch";
|
||||
|
||||
private Inputtips mClient;
|
||||
private InputtipsQuery mQuery;
|
||||
private IMogoInputtipsListener mListener;
|
||||
|
||||
public InputtipsSearch(Context context, MogoInputtipsQuery query) {
|
||||
mQuery = ObjectUtils.fromMogo(query);
|
||||
mClient = new Inputtips(context, mQuery);
|
||||
mClient.setInputtipsListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQuery(MogoInputtipsQuery query) {
|
||||
this.mQuery = ObjectUtils.fromMogo(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputtipsListener(IMogoInputtipsListener listener) {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestInputtipsAsyn() {
|
||||
if (mClient != null) {
|
||||
mClient.requestInputtipsAsyn();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetInputtips(List list, int i) {
|
||||
if (i == 0) {
|
||||
if (mListener != null) {
|
||||
mListener.onGetInputtips(getResult(list));
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "errorcode = " + i);
|
||||
}
|
||||
}
|
||||
|
||||
private List<MogoTip> getResult(List<Tip> tips) {
|
||||
List<MogoTip> mogoTips = new ArrayList<>();
|
||||
if (tips != null) {
|
||||
//只添加有坐标的结果
|
||||
for (Tip tip : tips) {
|
||||
MogoTip mogoTip = ObjectUtils.fromAMap(tip);
|
||||
if (mogoTip != null && mogoTip.getPoint() != null) {
|
||||
mogoTips.add(mogoTip);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mogoTips;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
mClient = null;
|
||||
mListener = null;
|
||||
mQuery = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.mogo.map.impl.custom.search;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.MogoSearchBound;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.query.OnPoiSearchListener;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiItem;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiSearch;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiSearchResult;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiCategory;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* poi搜索高德实现
|
||||
* <p>
|
||||
* 错误码对照表:https://lbs.amap.com/api/android-sdk/guide/map-tools/error-code
|
||||
*/
|
||||
public class PoiSearchClient implements IMogoPoiSearch, OnPoiSearchListener {
|
||||
|
||||
private static final String TAG = "PoiSearchClient";
|
||||
|
||||
private MogoPoiSearchQuery mQuery;
|
||||
private PoiSearch mClient;
|
||||
private IMogoPoiSearchListener mListener;
|
||||
private MogoSearchBound mBound;
|
||||
|
||||
public PoiSearchClient( Context context, MogoPoiSearchQuery query ) {
|
||||
mQuery = query;
|
||||
mClient = new PoiSearch( context, ObjectUtils.fromMogo( mQuery ) );
|
||||
mClient.setOnPoiSearchListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoiSearchListener( IMogoPoiSearchListener listener ) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchPOIAsyn() {
|
||||
if ( mClient != null ) {
|
||||
mClient.searchPOIAsyn();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoPoiResult searchPOI() throws MogoMapException {
|
||||
if ( mClient != null ) {
|
||||
try {
|
||||
PoiSearchResult search = mClient.searchPOI();
|
||||
return ObjectUtils.fromAMap( search );
|
||||
} catch ( Exception e ) {
|
||||
throw new MogoMapException( e );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQuery( MogoPoiSearchQuery query ) {
|
||||
mQuery = query;
|
||||
if ( mClient != null ) {
|
||||
mClient.setQuery( ObjectUtils.fromMogo( mQuery ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoPoiItem searchPOIId( String poiId ) throws MogoMapException {
|
||||
if ( mClient != null ) {
|
||||
try {
|
||||
PoiItem poiItem = mClient.searchPOIId( poiId );
|
||||
return ObjectUtils.fromAMap( poiItem );
|
||||
} catch ( Exception e ) {
|
||||
throw new MogoMapException( e );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchPOIIdAsyn( String poiId ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.searchPOIIdAsyn( poiId );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBound( MogoSearchBound bound ) {
|
||||
mBound = bound;
|
||||
if ( mClient != null ) {
|
||||
mClient.setBound( ObjectUtils.fromMogo( mBound ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPoiSearched( PoiSearchResult poiResult, int errorCode ) {
|
||||
if ( errorCode != 0 ) {
|
||||
Logger.e( TAG, "errorcode is %d", errorCode );
|
||||
}
|
||||
if ( mListener != null ) {
|
||||
mListener.onPoiSearched( ObjectUtils.fromAMap( poiResult ), errorCode );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPoiItemSearched( PoiItem poiItem, int errorCode ) {
|
||||
if ( errorCode != 0 ) {
|
||||
Logger.e( TAG, "errorcode is %d", errorCode );
|
||||
}
|
||||
if ( mListener != null ) {
|
||||
mListener.onPoiItemSearched( ObjectUtils.fromAMap( poiItem ), errorCode );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
mQuery = null;
|
||||
mClient = null;
|
||||
mListener = null;
|
||||
mBound = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPoiCategorySearched(@Nullable List<PoiCategory> list, int errorCode) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
package com.mogo.map.impl.custom.uicontroller;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.MogoMap;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-26
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AMapUIController implements IMogoMapUIController {
|
||||
|
||||
private static final String TAG = "AMapUIController";
|
||||
|
||||
private static volatile AMapUIController sInstance;
|
||||
|
||||
private IMogoMapUIController mClient;
|
||||
|
||||
private AMapUIController() {
|
||||
}
|
||||
|
||||
public static AMapUIController getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (AMapUIController.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AMapUIController();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void initClient(IMogoMapUIController client) {
|
||||
this.mClient = client;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrafficEnabled(boolean visible) {
|
||||
if (mClient != null) {
|
||||
mClient.setTrafficEnabled(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom( boolean zoom) {
|
||||
if (mClient != null) {
|
||||
return mClient.changeZoom(zoom);
|
||||
}
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom(float zoom) {
|
||||
if (mClient != null) {
|
||||
return mClient.changeZoom(zoom);
|
||||
}
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapMode(EnumMapUI mode) {
|
||||
if (mClient != null) {
|
||||
mClient.changeMapMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
if (mClient != null) {
|
||||
mClient.moveToCenter(latLng, animate);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation(boolean visible) {
|
||||
if (mClient != null) {
|
||||
mClient.showMyLocation(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation( View view ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.showMyLocation( view );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recoverLockMode() {
|
||||
if (mClient != null) {
|
||||
mClient.recoverLockMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loseLockMode() {
|
||||
if ( mClient != null ) {
|
||||
mClient.loseLockMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockZoom(int var1) {
|
||||
if (mClient != null) {
|
||||
mClient.setLockZoom(var1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview( Rect bounds ) {
|
||||
if (mClient != null) {
|
||||
mClient.displayOverview(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getScalePerPixel() {
|
||||
if (mClient != null) {
|
||||
return mClient.getScalePerPixel();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getZoomLevel() {
|
||||
if (mClient != null) {
|
||||
return mClient.getZoomLevel();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
if (mClient != null) {
|
||||
return mClient.getCameraNorthEastPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraSouthWestPosition() {
|
||||
if (mClient != null) {
|
||||
return mClient.getCameraSouthWestPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public MogoLatLng getWindowCenterLocation() {
|
||||
if (mClient != null) {
|
||||
return mClient.getWindowCenterLocation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPointToCenter(double mapCenterX, double mapCenterY) {
|
||||
if (mClient != null) {
|
||||
// mClient.setPointToCenter(mapCenterX, mapCenterY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getLocationPointInScreen(MogoLatLng latLng) {
|
||||
if (mClient != null) {
|
||||
return mClient.getLocationPointInScreen(latLng);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
|
||||
if (mClient != null) {
|
||||
return mClient.getLocationMogoLatLngInScreen(point);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
|
||||
long duration) {
|
||||
if (mClient != null) {
|
||||
mClient.startJumpAnimation(marker, high, interpolator, duration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderFps(int fps) {
|
||||
if (mClient != null) {
|
||||
mClient.setRenderFps(fps);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.showBounds( tag, carPosition, lonLats, bound, lockCarPosition );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceRender() {
|
||||
if (mClient != null) {
|
||||
mClient.forceRender();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception {
|
||||
if ( mClient != null ) {
|
||||
return mClient.calculateLineDistance( p1, p2 );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
if ( mClient != null ) {
|
||||
return mClient.getCurrentUiMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation( Location location ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.changeMyLocation( location );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCarLocked() {
|
||||
if ( mClient != null ) {
|
||||
return mClient.isCarLocked();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCarCursorOption( CarCursorOption option ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setCarCursorOption( option );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCameraPosition getMapCameraPosition() {
|
||||
if ( mClient != null ) {
|
||||
return mClient.getMapCameraPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeBearing( float bearing ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.changeBearing( bearing );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.mogo.map.impl.custom.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.SparseArray;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-09-29
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class IconTypeUtils {
|
||||
|
||||
private static SparseArray< String > sIconName = new SparseArray<>();
|
||||
|
||||
static {
|
||||
// sIconName.put( IconType.ARRIVED_DESTINATION, "到达目的地" );
|
||||
// sIconName.put( IconType.ARRIVED_SERVICE_AREA, "到达服务区" );
|
||||
// sIconName.put( IconType.ARRIVED_TOLLGATE, "到达收费站" );
|
||||
// sIconName.put( IconType.ARRIVED_TUNNEL, "到达隧道" );
|
||||
// sIconName.put( IconType.ARRIVED_WAYPOINT, "到达途经点" );
|
||||
// sIconName.put( IconType.BRIDGE, "通过桥" );
|
||||
// sIconName.put( IconType.BY_ELEVATOR, "电梯换层" );
|
||||
// sIconName.put( IconType.BY_ESCALATOR, "扶梯换层" );
|
||||
// sIconName.put( IconType.BY_STAIR, "楼梯换层" );
|
||||
// sIconName.put( IconType.CABLEWAY, "通过索道" );
|
||||
// sIconName.put( IconType.CHANNEL, "通过通道" );
|
||||
// sIconName.put( IconType.CROSSWALK, "通过人行横道" );
|
||||
// sIconName.put( IconType.CRUISE_ROUTE, "通过游船路线" );
|
||||
// sIconName.put( IconType.DEFAULT, "自车" );
|
||||
// sIconName.put( IconType.ENTER_BUILDING, "进入建筑物" );
|
||||
// sIconName.put( IconType.ENTER_ROUNDABOUT, "进入环岛" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING, "进入环岛" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING_CONTINUE, "绕环岛直行" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING_LEFT, "绕环岛左转" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING_RIGHT, "绕环岛右转" );
|
||||
// sIconName.put( IconType.ENTRY_LEFTRINGU_TURN, "绕环岛调头" );
|
||||
// sIconName.put( IconType.ENTRY_RING_CONTINUE, "绕环岛直行" );
|
||||
// sIconName.put( IconType.ENTRY_RING_LEFT, "绕环岛左转" );
|
||||
// sIconName.put( IconType.ENTRY_RING_RIGHT, "绕环岛右转" );
|
||||
// sIconName.put( IconType.ENTRY_RING_UTURN, "绕环岛调头" );
|
||||
// sIconName.put( IconType.FERRY, "通过轮渡" );
|
||||
// sIconName.put( IconType.LADDER, "通过阶梯" );
|
||||
// sIconName.put( IconType.LEAVE_BUILDING, "离开建筑物" );
|
||||
// sIconName.put( IconType.LEAVE_LEFT_RING, "驶出环岛" );
|
||||
// sIconName.put( IconType.LEFT, "左转" );
|
||||
// sIconName.put( IconType.LEFT_BACK, "左后" );
|
||||
// sIconName.put( IconType.LEFT_FRONT, "左前方" );
|
||||
// sIconName.put( IconType.LEFT_TURN_AROUND, "左转掉头" );
|
||||
// sIconName.put( IconType.LIFT, "通过直梯" );
|
||||
// sIconName.put( IconType.LOW_CROSS, "通过普通路口" );
|
||||
// sIconName.put( IconType.LOW_TRAFFIC_CROSS, "红绿灯路口" );
|
||||
// sIconName.put( IconType.NONE, "无定义" );
|
||||
// sIconName.put( IconType.OUT_ROUNDABOUT, "驶出环岛" );
|
||||
// sIconName.put( IconType.OVERPASS, "通过过街天桥" );
|
||||
// sIconName.put( IconType.PARK, "通过公园" );
|
||||
// sIconName.put( IconType.RIGHT, "右转" );
|
||||
// sIconName.put( IconType.RIGHT_BACK, "右后方" );
|
||||
// sIconName.put( IconType.RIGHT_FRONT, "右前方" );
|
||||
// sIconName.put( IconType.SIGHTSEEING_BUSLINE, "通过观光车路线" );
|
||||
// sIconName.put( IconType.SKY_CHANNEL, "通过空中通道" );
|
||||
// sIconName.put( IconType.SLIDEWAY, "通过滑道" );
|
||||
// sIconName.put( IconType.SLOPE, "通过斜坡" );
|
||||
// sIconName.put( IconType.SPECIAL_CONTINUE, "顺行" );
|
||||
// sIconName.put( IconType.SQUARE, "通过广场" );
|
||||
// sIconName.put( IconType.STAIRCASE, "通过扶梯" );
|
||||
// sIconName.put( IconType.STRAIGHT, "直行" );
|
||||
// sIconName.put( IconType.SUBWAY, "通过地铁通道" );
|
||||
// sIconName.put( IconType.U_TURN_RIGHT, "右转掉头" );
|
||||
// sIconName.put( IconType.UNDERPASS, "通过地下通道" );
|
||||
// sIconName.put( IconType.WALK_ROAD, "通过行人道路" );
|
||||
}
|
||||
|
||||
private static int lastIconType = 0;
|
||||
private static int lastIconResId = 0;
|
||||
|
||||
public static String getNameByIconType( int iconType ) {
|
||||
return sIconName.get( iconType );
|
||||
}
|
||||
|
||||
public static int getResIdByIconType( Context context, int iconType ) {
|
||||
try {
|
||||
if ( iconType == lastIconType ) {
|
||||
return lastIconResId;
|
||||
}
|
||||
int target = context.getResources().getIdentifier( "ic_" + iconType, "drawable", context.getPackageName() );
|
||||
lastIconType = iconType;
|
||||
lastIconResId = target;
|
||||
return target;
|
||||
} catch ( Exception e ) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//package com.mogo.map.impl.custom.utils;
|
||||
//
|
||||
//import android.graphics.Bitmap;
|
||||
//import android.graphics.Color;
|
||||
//
|
||||
//import com.amap.api.navi.model.RouteOverlayOptions;
|
||||
//import com.mogo.commons.AbsMogoApplication;
|
||||
//import com.mogo.map.impl.custom.R;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2019-10-04
|
||||
// * <p>
|
||||
// * 描述
|
||||
// */
|
||||
//public class MapStyleUtils {
|
||||
//
|
||||
// enum ColorEnum {
|
||||
// route_overlay_line_normal( Color.parseColor( "#00C96D" ) ),
|
||||
// route_overlay_line_unknown( Color.parseColor( "#3CD26E" ) ),
|
||||
// route_overlay_line_slow( Color.parseColor( "#ECC71F" ) ),
|
||||
// route_overlay_line_very_traffic( Color.parseColor( "#E16262" ) ),
|
||||
// route_overlay_line_traffic( Color.parseColor( "#E88181" ) ),
|
||||
// transparent( Color.parseColor( "#00000000" ) ),
|
||||
// light_gray( Color.parseColor( "#334BD089" ) );
|
||||
//
|
||||
// private int color;
|
||||
//
|
||||
// ColorEnum( int color ) {
|
||||
// this.color = color;
|
||||
// }
|
||||
//
|
||||
// public int getColor() {
|
||||
// return color;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static RouteOverlayOptions getRouteOverlayOptions() {
|
||||
// RouteOverlayOptions options = new RouteOverlayOptions();
|
||||
// // 设置导航线路的宽度
|
||||
// options.setLineWidth( AbsMogoApplication.getApp().getResources().getDimension(R.dimen.path_width) );
|
||||
//// // 设置交通状况情况良好下的纹理位图
|
||||
//// options.setSmoothTraffic( colorToBitmap( ColorEnum.route_overlay_line_normal.getColor() ) );
|
||||
//// // 设置路线的图标
|
||||
//// options.setNormalRoute( colorToBitmap( ColorEnum.route_overlay_line_normal.getColor() ) );
|
||||
//// // 设置交通状况未知下的纹理位图
|
||||
//// options.setUnknownTraffic( colorToBitmap( ColorEnum.route_overlay_line_unknown.getColor() ) );
|
||||
//// // 设置交通状况迟缓下的纹理位图
|
||||
//// options.setSlowTraffic( colorToBitmap( ColorEnum.route_overlay_line_slow.getColor() ) );
|
||||
//// // 设置交通状况非常拥堵下的纹理位图
|
||||
//// options.setVeryJamTraffic( colorToBitmap( ColorEnum.route_overlay_line_very_traffic.getColor() ) );
|
||||
//// // 设置交通状况拥堵下的纹理位图
|
||||
//// options.setJamTraffic( colorToBitmap( ColorEnum.route_overlay_line_traffic.getColor() ) );
|
||||
//// // 设置浮于道路上的『小箭头』图标的纹理位图
|
||||
//// options.setArrowOnTrafficRoute( colorToBitmap( ColorEnum.transparent.getColor() ) );
|
||||
// // 自定义走过路线纹理,默认走过路线置灰功能为关,需要在AMapNaviViewOptions.setAfterRouteAutoGray(boolean)打开,该方法才生效
|
||||
// options.setPassRoute( colorToBitmap( ColorEnum.light_gray.getColor() ) );
|
||||
//// // 设置路线虚线纹理
|
||||
//// options.setFairWayRes( colorToBitmap( ColorEnum.route_overlay_line_normal.getColor() ) );
|
||||
// options.setArrowColor( Color.parseColor( "#92C9FF" ) ); // 高德地图内部配置颜色
|
||||
// options.setArrowSideColor( Color.parseColor( "#4F9BF2" ) ); // 高德地图内部配置颜色
|
||||
// return options;
|
||||
// }
|
||||
//
|
||||
// public static Bitmap colorToBitmap( int color ) {
|
||||
// Bitmap.Config config = Bitmap.Config.ARGB_8888;
|
||||
// Bitmap bitmap = Bitmap.createBitmap( 1, 1, config );
|
||||
// bitmap.eraseColor( color );
|
||||
// return bitmap;
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.mogo.map.impl.custom.utils;
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-04
|
||||
* <p>
|
||||
* 地图工具类
|
||||
*/
|
||||
public class MogoMapUtils {
|
||||
|
||||
private static final String TAG = "MogoMapUtils";
|
||||
|
||||
// public static LatLngBounds getLatLngBounds( MogoLatLng carPosition, List< MogoLatLng > lonLats, boolean lockCarPosition ) throws Exception {
|
||||
//
|
||||
// if ( lonLats == null || lonLats.isEmpty() ) {
|
||||
// throw new MogoMapException( "经纬度不能为null或空集合" );
|
||||
// }
|
||||
// LatLngBounds.Builder builder = new LatLngBounds.Builder();
|
||||
// for ( MogoLatLng lonLat : lonLats ) {
|
||||
// builder.include( ObjectUtils.fromMogo2( lonLat ) );
|
||||
// }
|
||||
// if ( carPosition != null && !lockCarPosition ) {
|
||||
// builder.include( ObjectUtils.fromMogo2( carPosition ) );
|
||||
// }
|
||||
// LatLngBounds latLngBounds = builder.build();
|
||||
// if ( !lockCarPosition ) {
|
||||
// return latLngBounds;
|
||||
// }
|
||||
//
|
||||
// if ( carPosition == null ) {
|
||||
// throw new MogoMapException( "自车位置经纬度信息不能为空" );
|
||||
// }
|
||||
//
|
||||
// if ( latLngBounds.northeast == null && latLngBounds.southwest == null ) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// double south = 0.0;
|
||||
// double west = 0.0;
|
||||
//
|
||||
// double east = 0.0;
|
||||
// double north = 0.0;
|
||||
//
|
||||
// double dLat = 0.0;
|
||||
// double dLon = 0.0;
|
||||
//
|
||||
// if ( latLngBounds.northeast == null ) {
|
||||
// dLat = Math.abs( carPosition.lat - latLngBounds.southwest.latitude );
|
||||
// dLon = Math.abs( carPosition.lng - latLngBounds.southwest.longitude );
|
||||
// } else if ( latLngBounds.southwest == null ) {
|
||||
// dLat = Math.abs( carPosition.lat - latLngBounds.northeast.latitude );
|
||||
// dLon = Math.abs( carPosition.lng - latLngBounds.northeast.longitude );
|
||||
// } else {
|
||||
// final double dLat1 = Math.abs( carPosition.lat - latLngBounds.southwest.latitude );
|
||||
// final double dLon1 = Math.abs( carPosition.lng - latLngBounds.southwest.longitude );
|
||||
// final double dLat2 = Math.abs( carPosition.lat - latLngBounds.northeast.latitude );
|
||||
// final double dLon2 = Math.abs( carPosition.lng - latLngBounds.northeast.longitude );
|
||||
// dLat = dLat1 > dLat2 ? dLat1 : dLat2;
|
||||
// dLon = dLon1 > dLon2 ? dLon1 : dLon2;
|
||||
// }
|
||||
//
|
||||
// west = carPosition.lat - dLat;
|
||||
// south = carPosition.lng + dLon;
|
||||
//
|
||||
// east = carPosition.lat + dLat;
|
||||
// north = carPosition.lng - dLon;
|
||||
//
|
||||
// if ( south == 0.0 || west == 0.0 || east == 0.0 || north == 0.0 ) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// if ( east < west ) {
|
||||
// double tmp = east;
|
||||
// east = west;
|
||||
// west = tmp;
|
||||
// }
|
||||
//
|
||||
// if( north < south ){
|
||||
// double tmp = north;
|
||||
// north = south;
|
||||
// south = tmp;
|
||||
// }
|
||||
//
|
||||
// Logger.d( TAG, "west = %s, east = %s, north = %s, south = %s", west, east, north, south );
|
||||
//
|
||||
// return new LatLngBounds.Builder().include( new LatLng( east, north ) ).include( new LatLng( west, south ) ).build();
|
||||
// }
|
||||
|
||||
public static float calculateLineDistance(LonLatPoint var0, LonLatPoint var1) {
|
||||
if (var0 != null && var1 != null) {
|
||||
try {
|
||||
double var2 = var0.getLongitude();
|
||||
double var4 = var0.getLatitude();
|
||||
double var6 = var1.getLongitude();
|
||||
double var8 = var1.getLatitude();
|
||||
var2 *= 0.01745329251994329D;
|
||||
var4 *= 0.01745329251994329D;
|
||||
var6 *= 0.01745329251994329D;
|
||||
var8 *= 0.01745329251994329D;
|
||||
double var10 = Math.sin(var2);
|
||||
double var12 = Math.sin(var4);
|
||||
double var14 = Math.cos(var2);
|
||||
double var16 = Math.cos(var4);
|
||||
double var18 = Math.sin(var6);
|
||||
double var20 = Math.sin(var8);
|
||||
double var22 = Math.cos(var6);
|
||||
double var24 = Math.cos(var8);
|
||||
double[] var28 = new double[3];
|
||||
double[] var29 = new double[3];
|
||||
var28[0] = var16 * var14;
|
||||
var28[1] = var16 * var10;
|
||||
var28[2] = var12;
|
||||
var29[0] = var24 * var22;
|
||||
var29[1] = var24 * var18;
|
||||
var29[2] = var20;
|
||||
return (float)(Math.asin(Math.sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0D) * 1.27420015798544E7D);
|
||||
} catch (Throwable var26) {
|
||||
var26.printStackTrace();
|
||||
return 0.0F;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
throw new Exception("非法坐标值");
|
||||
} catch (Exception var27) {
|
||||
var27.printStackTrace();
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,749 @@
|
||||
package com.mogo.map.impl.custom.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
|
||||
import com.autonavi.nge.guidance.NaviInfo;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoCongestionLink;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.search.geo.MogoGeocodeAddress;
|
||||
import com.mogo.map.search.geo.MogoGeocodeResult;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.geo.MogoRegeocodeAddress;
|
||||
import com.mogo.map.search.geo.MogoRegeocodeResult;
|
||||
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||
import com.mogo.map.search.inputtips.MogoTip;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.MogoSearchBound;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.location.Location;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor;
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
|
||||
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
|
||||
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
|
||||
import com.zhidaoauto.map.sdk.open.query.GeocodeAddress;
|
||||
import com.zhidaoauto.map.sdk.open.query.GeocodeQuery;
|
||||
import com.zhidaoauto.map.sdk.open.query.GeocodeResult;
|
||||
import com.zhidaoauto.map.sdk.open.query.InputtipsQuery;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiItem;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiSearchItem;
|
||||
import com.zhidaoauto.map.sdk.open.query.PoiSearchResult;
|
||||
import com.zhidaoauto.map.sdk.open.query.Query;
|
||||
import com.zhidaoauto.map.sdk.open.query.RegeocodeAddress;
|
||||
import com.zhidaoauto.map.sdk.open.query.RegeocodeQuery;
|
||||
import com.zhidaoauto.map.sdk.open.query.RegeocodeResult;
|
||||
import com.zhidaoauto.map.sdk.open.query.SearchBound;
|
||||
import com.zhidaoauto.map.sdk.open.query.Tip;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 业务对象和实际对象转换
|
||||
*/
|
||||
public class ObjectUtils {
|
||||
|
||||
public static MarkerOptions fromMogo(MogoMarkerOptions opt ) {
|
||||
|
||||
if ( opt == null ) {
|
||||
return null;
|
||||
}
|
||||
ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
|
||||
final ArrayList< Bitmap > icons = opt.getIcons();
|
||||
if ( icons != null && !icons.isEmpty() ) {
|
||||
for ( Bitmap icon : icons ) {
|
||||
if ( icon == null || icon.isRecycled() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
descriptors.add( new BitmapDescriptor(icon) );
|
||||
}
|
||||
}
|
||||
// BitmapDescriptor descriptor = getBitmapDescriptorFromMogo( opt );
|
||||
|
||||
return new MarkerOptions()
|
||||
.position( new LonLatPoint(opt.getLongitude(), opt.getLatitude() ) )
|
||||
// .title( opt.getTitle() )
|
||||
// .snippet( opt.getSnippet() )
|
||||
.markerIcon( opt.getIcon() )
|
||||
.anchor( opt.getU(), opt.getV() )
|
||||
// .icons( descriptors )
|
||||
// .period( opt.getPeriod() )
|
||||
.rotateAngle( opt.getRotate() )
|
||||
// .setFlat( opt.isFlat() )
|
||||
.visible( opt.isVisible() )
|
||||
.infoWindowEnable( opt.isInifoWindowEnable() )
|
||||
.alpha( opt.getAlpha() );
|
||||
// .setGps( opt.isGps() )
|
||||
// .draggable( opt.isDraggable() )
|
||||
// .setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() )
|
||||
// .zIndex( opt.getzIndex() );
|
||||
}
|
||||
|
||||
private static BitmapDescriptor getBitmapDescriptorFromMogo( MogoMarkerOptions options ) {
|
||||
if ( options == null ) {
|
||||
return null;
|
||||
}
|
||||
Bitmap icon = options.getIcon();
|
||||
if ( icon != null ) {
|
||||
return BitmapDescriptorFactory.INSTANCE.fromBitmap( icon );
|
||||
}
|
||||
View view = options.getIconView();
|
||||
if ( view != null ) {
|
||||
return BitmapDescriptorFactory.INSTANCE.fromView( view );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static MogoLocation fromLocation( Location aLocation ) {
|
||||
if ( aLocation == null ) {
|
||||
return null;
|
||||
}
|
||||
MogoLocation location = new MogoLocation();
|
||||
// location.setLocType( aLocation.getLocationType() );
|
||||
location.setSpeed( aLocation.getSpeed() );
|
||||
location.setLatitude( aLocation.getLat() );
|
||||
location.setLongitude( aLocation.getLon() );
|
||||
location.setAltitude( aLocation.getAltitude() );
|
||||
// location.setTime( aLocation.getTime() );
|
||||
// location.setBearing( aLocation.getBearing() );
|
||||
// location.setAccuracy( aLocation.getAccuracy() );
|
||||
// location.setCityCode( aLocation.getCityCode() );
|
||||
// location.setCityName( aLocation.getCity() );
|
||||
location.setProvider( aLocation.getProvider() );
|
||||
// location.setAddress( aLocation.getAddress() );
|
||||
// location.setDistrict( aLocation.getDistrict() );
|
||||
// location.setProvince( aLocation.getProvince() );
|
||||
// location.setAdCode( aLocation.getAdCode() );
|
||||
// location.setLocationDetail( aLocation.getLocationDetail() );
|
||||
// location.setPoiName( aLocation.getPoiName() );
|
||||
// location.setAoiName( aLocation.getAoiName() );
|
||||
// location.setErrCode( aLocation.getErrorCode() );
|
||||
// location.setErrInfo( aLocation.getErrorInfo() );
|
||||
// location.setStreetNum( aLocation.getStreetNum() );
|
||||
// location.setDescription( aLocation.getDescription() );
|
||||
// location.setBuildingId( aLocation.getBuildingId() );
|
||||
// location.setFloor( aLocation.getFloor() );
|
||||
// location.setGpsAccuracyStatus( aLocation.getGpsAccuracyStatus() );
|
||||
// location.setSatellite( aLocation.getSatellites() );
|
||||
return location;
|
||||
}
|
||||
|
||||
public static LonLatPoint fromMogo( MogoLatLng latLng ) {
|
||||
if ( latLng == null ) {
|
||||
return null;
|
||||
}
|
||||
return new LonLatPoint( latLng.lon,latLng.lat);
|
||||
}
|
||||
|
||||
// public static NaviLatLng fromMogoAsNavi( MogoLatLng latLng ) {
|
||||
// if ( latLng == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// return new NaviLatLng( latLng.lat, latLng.lng );
|
||||
// }
|
||||
|
||||
// public static LatLng fromMogo2( MogoLatLng latLng ) {
|
||||
// if ( latLng == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// return new LatLng( latLng.lat, latLng.lng );
|
||||
// }
|
||||
|
||||
public static MogoLatLng fromAMap( LonLatPoint point ) {
|
||||
if ( point == null ) {
|
||||
return null;
|
||||
}
|
||||
return new MogoLatLng( point.getLatitude(), point.getLongitude() );
|
||||
}
|
||||
|
||||
// public static MogoLatLng CameraPositionfromAMap( LatLng point ) {
|
||||
// if ( point == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// return new MogoLatLng( point.latitude, point.longitude );
|
||||
// }
|
||||
|
||||
public static GeocodeQuery fromMogo( MogoGeocodeQuery query ) {
|
||||
if ( query == null ) {
|
||||
return null;
|
||||
}
|
||||
GeocodeQuery q = new GeocodeQuery( query.getLocationName(), query.getCity() );
|
||||
return q;
|
||||
}
|
||||
|
||||
public static RegeocodeQuery fromMogo(MogoRegeocodeQuery query ) {
|
||||
if ( query == null ) {
|
||||
return null;
|
||||
}
|
||||
RegeocodeQuery q = new RegeocodeQuery( fromMogo( query.getPoint() ), 1000 );
|
||||
return q;
|
||||
}
|
||||
|
||||
// public static MogoAoiItem fromAMap( AoiItem amapItem ) {
|
||||
// if ( amapItem == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoAoiItem mogoAoiItem = new MogoAoiItem();
|
||||
// mogoAoiItem.setAdCode( amapItem.getAdCode() );
|
||||
// mogoAoiItem.setAoiArea( amapItem.getAoiArea() );
|
||||
// mogoAoiItem.setAoiCenterPoint( fromAMap( amapItem.getAoiCenterPoint() ) );
|
||||
// mogoAoiItem.setAoiId( amapItem.getAoiId() );
|
||||
// mogoAoiItem.setAoiName( amapItem.getAoiName() );
|
||||
// return mogoAoiItem;
|
||||
// }
|
||||
//
|
||||
// public static MogoBusinessArea fromAMap( BusinessArea amapItem ) {
|
||||
// if ( amapItem == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoBusinessArea mogoBusinessArea = new MogoBusinessArea();
|
||||
// mogoBusinessArea.setCenterPoint( fromAMap( amapItem.getCenterPoint() ) );
|
||||
// mogoBusinessArea.setName( amapItem.getName() );
|
||||
// return mogoBusinessArea;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static MogoCrossroad fromAMap( Crossroad amapItem ) {
|
||||
// if ( amapItem == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoCrossroad mogoCrossroad = new MogoCrossroad();
|
||||
// mogoCrossroad.setDirection( amapItem.getDirection() );
|
||||
// mogoCrossroad.setDistance( amapItem.getDistance() );
|
||||
// mogoCrossroad.setFirstRoadId( amapItem.getFirstRoadId() );
|
||||
// mogoCrossroad.setFirstRoadName( amapItem.getFirstRoadName() );
|
||||
// mogoCrossroad.setSecondRoadId( amapItem.getSecondRoadId() );
|
||||
// mogoCrossroad.setSecondRoadName( amapItem.getSecondRoadName() );
|
||||
// return mogoCrossroad;
|
||||
// }
|
||||
|
||||
public static MogoGeocodeAddress fromAMap( GeocodeAddress address ) {
|
||||
if ( address == null ) {
|
||||
return null;
|
||||
}
|
||||
MogoGeocodeAddress mogoGeocodeAddress = new MogoGeocodeAddress();
|
||||
mogoGeocodeAddress.setAdcode( address.getAdcode() );
|
||||
mogoGeocodeAddress.setBuilding( address.getBuilding() );
|
||||
mogoGeocodeAddress.setCity( address.getCity() );
|
||||
mogoGeocodeAddress.setDistrict( address.getDistrict() );
|
||||
mogoGeocodeAddress.setFormatAddress( address.getFormatAddress() );
|
||||
mogoGeocodeAddress.setLatlng( fromAMap( address.getLonlat() ) );
|
||||
mogoGeocodeAddress.setLevel( address.getLevel() );
|
||||
mogoGeocodeAddress.setNeighborhood( address.getNeighborhood() );
|
||||
mogoGeocodeAddress.setProvince( address.getProvince() );
|
||||
mogoGeocodeAddress.setTownship( address.getTownship() );
|
||||
return mogoGeocodeAddress;
|
||||
}
|
||||
|
||||
public static MogoGeocodeResult fromAMap( GeocodeResult result ) {
|
||||
if ( result == null || result.getGeocodeAddressList() == null ) {
|
||||
return null;
|
||||
}
|
||||
MogoGeocodeResult mogoGeocodeResult = new MogoGeocodeResult();
|
||||
final List< MogoGeocodeAddress > addresses = new ArrayList<>();
|
||||
List< GeocodeAddress > list = result.getGeocodeAddressList();
|
||||
for ( GeocodeAddress geocodeAddress : list ) {
|
||||
final MogoGeocodeAddress mogoGeocodeAddress = fromAMap( geocodeAddress );
|
||||
if ( mogoGeocodeAddress != null ) {
|
||||
addresses.add( mogoGeocodeAddress );
|
||||
}
|
||||
}
|
||||
|
||||
mogoGeocodeResult.setAddresses( addresses );
|
||||
return mogoGeocodeResult;
|
||||
}
|
||||
|
||||
// public static MogoIndoorData fromAMap( IndoorData data ) {
|
||||
// if ( data == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoIndoorData mogoIndoorData = new MogoIndoorData();
|
||||
// mogoIndoorData.setFloor( data.getFloor() );
|
||||
// mogoIndoorData.setFloorName( data.getFloorName() );
|
||||
// mogoIndoorData.setPoiId( data.getPoiId() );
|
||||
// return mogoIndoorData;
|
||||
// }
|
||||
//
|
||||
// public static MogoPhoto fromAMap( Photo photo ) {
|
||||
// if ( photo == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoPhoto mogoPhoto = new MogoPhoto();
|
||||
// mogoPhoto.setTitle( photo.getTitle() );
|
||||
// mogoPhoto.setUrl( photo.getUrl() );
|
||||
// return mogoPhoto;
|
||||
// }
|
||||
//
|
||||
// public static MogoPoiItemExtension fromAMap( PoiItemExtension poiItemExtension ) {
|
||||
// if ( poiItemExtension == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoPoiItemExtension mogoPoiItemExtension = new MogoPoiItemExtension();
|
||||
// mogoPoiItemExtension.setOpentime( poiItemExtension.getOpentime() );
|
||||
// mogoPoiItemExtension.setRating( poiItemExtension.getmRating() );
|
||||
// return mogoPoiItemExtension;
|
||||
// }
|
||||
//
|
||||
// public static MogoRegeocodeRoad fromAMap( RegeocodeRoad regeocodeRoad ) {
|
||||
// if ( regeocodeRoad == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoRegeocodeRoad mogoRegeocodeRoad = new MogoRegeocodeRoad();
|
||||
// mogoRegeocodeRoad.setDirection( regeocodeRoad.getDirection() );
|
||||
// mogoRegeocodeRoad.setDistance( regeocodeRoad.getDistance() );
|
||||
// mogoRegeocodeRoad.setId( regeocodeRoad.getId() );
|
||||
// mogoRegeocodeRoad.setName( regeocodeRoad.getName() );
|
||||
// mogoRegeocodeRoad.setPoint( fromAMap( regeocodeRoad.getLatLngPoint() ) );
|
||||
// return mogoRegeocodeRoad;
|
||||
// }
|
||||
//
|
||||
// public static MogoStreetNumber fromAMap( StreetNumber streetNumber ) {
|
||||
// if ( streetNumber == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoStreetNumber mogoStreetNumber = new MogoStreetNumber();
|
||||
// mogoStreetNumber.setDirection( streetNumber.getDirection() );
|
||||
// mogoStreetNumber.setDistance( streetNumber.getDistance() );
|
||||
// mogoStreetNumber.setLatLonPoint( fromAMap( streetNumber.getLatLonPoint() ) );
|
||||
// mogoStreetNumber.setNumber( streetNumber.getNumber() );
|
||||
// mogoStreetNumber.setStreet( streetNumber.getStreet() );
|
||||
// return mogoStreetNumber;
|
||||
// }
|
||||
|
||||
// public static MogoSubPoiItem fromAMap( SubPoiItem subPoiItem ) {
|
||||
// if ( subPoiItem == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoSubPoiItem mogoSubPoiItem = new MogoSubPoiItem();
|
||||
// mogoSubPoiItem.setDistance( subPoiItem.getDistance() );
|
||||
// mogoSubPoiItem.setPoiId( subPoiItem.getPoiId() );
|
||||
// mogoSubPoiItem.setPoint( fromAMap( subPoiItem.getLatLonPoint() ) );
|
||||
// mogoSubPoiItem.setSnippet( subPoiItem.getSnippet() );
|
||||
// mogoSubPoiItem.setSubName( mogoSubPoiItem.getSubName() );
|
||||
// mogoSubPoiItem.setSubTypeDes( mogoSubPoiItem.getSubTypeDes() );
|
||||
// mogoSubPoiItem.setTitle( mogoSubPoiItem.getTitle() );
|
||||
// return mogoSubPoiItem;
|
||||
// }
|
||||
|
||||
public static MogoPoiItem fromAMap( PoiItem poiItem) {
|
||||
if ( poiItem == null ) {
|
||||
return null;
|
||||
}
|
||||
MogoPoiItem mogoPoiItem = new MogoPoiItem();
|
||||
mogoPoiItem.setAdCode( poiItem.getAdCode() );
|
||||
mogoPoiItem.setAdName( poiItem.getAdName() );
|
||||
mogoPoiItem.setBusinessArea( poiItem.getBusinessArea() );
|
||||
mogoPoiItem.setCityCode( poiItem.getCityCode() );
|
||||
mogoPoiItem.setCityName( poiItem.getCityName() );
|
||||
mogoPoiItem.setDirection( poiItem.getDirection() );
|
||||
mogoPoiItem.setDistance( poiItem.getDistance() );
|
||||
mogoPoiItem.setEmail( poiItem.getEmail() );
|
||||
mogoPoiItem.setEnter( fromAMap( poiItem.getEnter() ) );
|
||||
mogoPoiItem.setExit( fromAMap( poiItem.getExit() ) );
|
||||
// mogoPoiItem.setIndoorData( fromAMap( poiItem.getIndoorData() ) );
|
||||
mogoPoiItem.setParkingType( poiItem.getParkingType() );
|
||||
// mogoPoiItem.setIndoorMap( poiItem.isIndoorMap() );
|
||||
// if ( poiItem.getPhotos() != null ) {
|
||||
// List< MogoPhoto > mogoPhotos = new ArrayList<>();
|
||||
// for ( Photo photo : poiItem.getPhotos() ) {
|
||||
// MogoPhoto mogoPhoto = fromAMap( photo );
|
||||
// if ( mogoPhoto != null ) {
|
||||
// mogoPhotos.add( mogoPhoto );
|
||||
// }
|
||||
// }
|
||||
// mogoPoiItem.setPhotos( mogoPhotos );
|
||||
// }
|
||||
// mogoPoiItem.setPoiExtension( fromAMap( poiItem.getPoiExtension() ) );
|
||||
mogoPoiItem.setPoiId( poiItem.getPoiId() );
|
||||
mogoPoiItem.setPoint( fromAMap( poiItem.getLonLatPoint() ) );
|
||||
mogoPoiItem.setPostcode( poiItem.getPostcode() );
|
||||
mogoPoiItem.setProvinceCode( poiItem.getProvinceCode() );
|
||||
mogoPoiItem.setProvinceName( poiItem.getProvinceName() );
|
||||
mogoPoiItem.setShopID( poiItem.getShopID() );
|
||||
mogoPoiItem.setSnippet( poiItem.getSnippet() );
|
||||
// if ( poiItem.getSubPois() != null ) {
|
||||
// List< MogoSubPoiItem > mogoSubPoiItems = new ArrayList<>();
|
||||
// for ( SubPoiItem subPois : poiItem.getSubPois() ) {
|
||||
// MogoSubPoiItem mogoSubPoiItem = fromAMap( subPois );
|
||||
// if ( mogoPoiItem != null ) {
|
||||
// mogoSubPoiItems.add( mogoSubPoiItem );
|
||||
// }
|
||||
// }
|
||||
// mogoPoiItem.setSubPois( mogoSubPoiItems );
|
||||
// }
|
||||
mogoPoiItem.setTel( poiItem.getTel() );
|
||||
mogoPoiItem.setTypeCode( poiItem.getTypeCode() );
|
||||
mogoPoiItem.setTitle( poiItem.getTitle() );
|
||||
mogoPoiItem.setTypeDes( poiItem.getTypeDes() );
|
||||
mogoPoiItem.setWebsite( poiItem.getWebsite() );
|
||||
return mogoPoiItem;
|
||||
}
|
||||
|
||||
public static MogoRegeocodeAddress fromAMap( RegeocodeAddress regeocodeAddress ) {
|
||||
if ( regeocodeAddress == null ) {
|
||||
return null;
|
||||
}
|
||||
MogoRegeocodeAddress mogoRegeocodeAddress = new MogoRegeocodeAddress();
|
||||
mogoRegeocodeAddress.setAdCode( regeocodeAddress.getAdCode() );
|
||||
// if ( regeocodeAddress.getAois() != null ) {
|
||||
// List< MogoAoiItem > items = new ArrayList<>();
|
||||
// for ( AoiItem aois : regeocodeAddress.getAois() ) {
|
||||
// final MogoAoiItem mogoAoiItem = fromAMap( aois );
|
||||
// if ( mogoAoiItem != null ) {
|
||||
// items.add( mogoAoiItem );
|
||||
// }
|
||||
// }
|
||||
// mogoRegeocodeAddress.setAois( items );
|
||||
// }
|
||||
|
||||
mogoRegeocodeAddress.setBuilding( regeocodeAddress.getBuilding() );
|
||||
// if ( regeocodeAddress.getBusinessAreas() != null ) {
|
||||
// List< MogoBusinessArea > mogoBusinessAreas = new ArrayList<>();
|
||||
// for ( BusinessArea businessArea : regeocodeAddress.getBusinessAreas() ) {
|
||||
// MogoBusinessArea mogoBusinessArea = fromAMap( businessArea );
|
||||
// if ( mogoBusinessArea != null ) {
|
||||
// mogoBusinessAreas.add( mogoBusinessArea );
|
||||
// }
|
||||
// }
|
||||
// mogoRegeocodeAddress.setBusinessAreas( mogoBusinessAreas );
|
||||
// }
|
||||
|
||||
mogoRegeocodeAddress.setCity( regeocodeAddress.getCity() );
|
||||
mogoRegeocodeAddress.setCityCode( regeocodeAddress.getCityCode() );
|
||||
mogoRegeocodeAddress.setCountry( regeocodeAddress.getCountry() );
|
||||
// if ( regeocodeAddress.getCrossroads() != null ) {
|
||||
// List< MogoCrossroad > mogoCrossroads = new ArrayList<>();
|
||||
// for ( Crossroad crossroad : regeocodeAddress.getCrossroads() ) {
|
||||
//
|
||||
// MogoCrossroad mogoCrossroad = fromAMap( crossroad );
|
||||
// if ( mogoCrossroad != null ) {
|
||||
// mogoCrossroads.add( mogoCrossroad );
|
||||
// }
|
||||
// }
|
||||
// mogoRegeocodeAddress.setCrossroads( mogoCrossroads );
|
||||
// }
|
||||
mogoRegeocodeAddress.setDistrict( regeocodeAddress.getDistrict() );
|
||||
mogoRegeocodeAddress.setFormatAddress( regeocodeAddress.getFormatAddress() );
|
||||
mogoRegeocodeAddress.setNeighborhood( regeocodeAddress.getNeighborhood() );
|
||||
if ( regeocodeAddress.getPoiList() != null ) {
|
||||
List< MogoPoiItem > mogoPoiItems = new ArrayList<>();
|
||||
List<PoiItem> list = regeocodeAddress.getPoiList();
|
||||
for ( PoiItem pois : list ) {
|
||||
MogoPoiItem mogoPoiItem = fromAMap( pois );
|
||||
mogoPoiItems.add( mogoPoiItem );
|
||||
}
|
||||
mogoRegeocodeAddress.setPois( mogoPoiItems );
|
||||
}
|
||||
mogoRegeocodeAddress.setProvince( regeocodeAddress.getProvince() );
|
||||
// if ( regeocodeAddress.getRoads() != null ) {
|
||||
// List< MogoRegeocodeRoad > mogoRegeocodeRoads = new ArrayList<>();
|
||||
// for ( RegeocodeRoad road : regeocodeAddress.getRoads() ) {
|
||||
// MogoRegeocodeRoad mogoRegeocodeRoad = fromAMap( road );
|
||||
// if ( mogoRegeocodeRoad != null ) {
|
||||
// mogoRegeocodeRoads.add( mogoRegeocodeRoad );
|
||||
// }
|
||||
// }
|
||||
// mogoRegeocodeAddress.setRoads( mogoRegeocodeRoads );
|
||||
// }
|
||||
// mogoRegeocodeAddress.setStreetNumber( fromAMap( regeocodeAddress.getStreetNumber() ) );
|
||||
mogoRegeocodeAddress.setTowncode( regeocodeAddress.getTowncode() );
|
||||
mogoRegeocodeAddress.setTownship( regeocodeAddress.getTownship() );
|
||||
return mogoRegeocodeAddress;
|
||||
}
|
||||
|
||||
public static MogoRegeocodeResult fromAMap( RegeocodeResult regeocodeResult ) {
|
||||
if ( regeocodeResult == null ) {
|
||||
return null;
|
||||
}
|
||||
MogoRegeocodeResult mogoRegeocodeResult = new MogoRegeocodeResult();
|
||||
mogoRegeocodeResult.setRegeocodeAddress( fromAMap( regeocodeResult.getRegeocodeAddress() ) );
|
||||
return mogoRegeocodeResult;
|
||||
}
|
||||
|
||||
public static InputtipsQuery fromMogo(MogoInputtipsQuery query ) {
|
||||
if ( query == null ) {
|
||||
return null;
|
||||
}
|
||||
InputtipsQuery inputtipsQuery = new InputtipsQuery( query.getKeyword(), query.getCity() );
|
||||
inputtipsQuery.setCityLimit( query.isCityLimit() );
|
||||
inputtipsQuery.setLocation( fromMogo( query.getLocation() ) );
|
||||
inputtipsQuery.setType( query.getType() );
|
||||
return inputtipsQuery;
|
||||
}
|
||||
|
||||
public static MogoTip fromAMap( Tip tip ) {
|
||||
if ( tip == null ) {
|
||||
return null;
|
||||
}
|
||||
MogoTip mogoTip = new MogoTip();
|
||||
mogoTip.setAdCode( tip.getAdcode() );
|
||||
mogoTip.setAddress( tip.getAddress() );
|
||||
mogoTip.setDistrict( tip.getDistrict() );
|
||||
mogoTip.setName( tip.getName() );
|
||||
mogoTip.setPoiID( tip.getPoiID() );
|
||||
mogoTip.setPoint( fromAMap( tip.getLatPoint() ) );
|
||||
mogoTip.setTypeCode( tip.getTypeCode() );
|
||||
return mogoTip;
|
||||
}
|
||||
|
||||
// public static MogoPoi fromAMap( Poi poi ) {
|
||||
// if ( poi == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoPoi mogoPoi = new MogoPoi();
|
||||
// mogoPoi.setCoordinate( fromAMap( poi.getCoordinate() ) );
|
||||
// mogoPoi.setName( poi.getName() );
|
||||
// mogoPoi.setPoiId( poi.getPoiId() );
|
||||
// return mogoPoi;
|
||||
// }
|
||||
|
||||
public static MogoPoiSearchQuery fromAMap( Query query ) {
|
||||
if ( query == null ) {
|
||||
return null;
|
||||
}
|
||||
MogoPoiSearchQuery mogoPoiSearchQuery = new MogoPoiSearchQuery( query.getKeyword(), query.getCategory(), query.getCity() );
|
||||
// mogoPoiSearchQuery.setBuilding( query.getBuilding() );
|
||||
mogoPoiSearchQuery.setCityLimit( query.getCityLimit() );
|
||||
mogoPoiSearchQuery.setDistanceSort( query.getDistanceSort() );
|
||||
mogoPoiSearchQuery.setLocation( fromAMap( query.getLocation() ) );
|
||||
mogoPoiSearchQuery.setPageNum( query.getPageNum() );
|
||||
mogoPoiSearchQuery.setPageSize( query.getPageSize() );
|
||||
return mogoPoiSearchQuery;
|
||||
}
|
||||
|
||||
public static Query fromMogo(MogoPoiSearchQuery query ) {
|
||||
if ( query == null ) {
|
||||
return null;
|
||||
}
|
||||
Query psq = new Query(query.getQuery(), "", "");
|
||||
String category = getCategory(query.getQuery());
|
||||
if(!category.equals(""))
|
||||
psq = new Query( "", "", getCategory(query.getQuery()));
|
||||
// psq.setBuilding( query.getBuilding() );
|
||||
psq.setCityLimit( query.isCityLimit() );
|
||||
psq.setDistanceSort( query.isDistanceSort() );
|
||||
psq.setLocation( fromMogo( query.getLocation() ) );
|
||||
psq.setPageNum( query.getPageNum() );
|
||||
psq.setPageSize( query.getPageSize() );
|
||||
return psq;
|
||||
}
|
||||
|
||||
public static MogoSearchBound fromAMap( SearchBound bound ) {
|
||||
if ( bound == null ) {
|
||||
return null;
|
||||
}
|
||||
if ( bound.getShape() == SearchBound.BOUND_SHAPE ) {
|
||||
return new MogoSearchBound( fromAMap( bound.getCenter() ), bound.getRange(), bound.isDistanceSort() );
|
||||
} else if ( bound.getShape() == SearchBound.POLYGON_SHAPE ) {
|
||||
return new MogoSearchBound( fromAMap( bound.getPolyGonList() ) );
|
||||
} else if ( bound.getShape() == SearchBound.RECTANGLE_SHAPE ) {
|
||||
return new MogoSearchBound( fromAMap( bound.getLowerLeft() ), fromAMap( bound.getUpperRight() ) );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List< MogoLatLng > fromAMap( List< LonLatPoint > latLngs ) {
|
||||
if ( latLngs == null ) {
|
||||
return null;
|
||||
}
|
||||
List< MogoLatLng > result = new ArrayList<>( latLngs.size() );
|
||||
for ( LonLatPoint latLng : latLngs ) {
|
||||
result.add( fromAMap( latLng ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List< LonLatPoint > fromMogo( List< MogoLatLng > latLngs ) {
|
||||
if ( latLngs == null ) {
|
||||
return null;
|
||||
}
|
||||
List< LonLatPoint > result = new ArrayList<>( latLngs.size() );
|
||||
for ( MogoLatLng latLng : latLngs ) {
|
||||
result.add( fromMogo( latLng ) );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public static SearchBound fromMogo( MogoSearchBound bound ) {
|
||||
if ( bound == null ) {
|
||||
return null;
|
||||
}
|
||||
if ( bound.getShape() == MogoSearchBound.SHAPE_BOUND ) {
|
||||
return new SearchBound( fromMogo( bound.getCenterPoint() ), bound.getRadiusInMeters(), bound.isDistanceSort() );
|
||||
} else if ( bound.getShape() == MogoSearchBound.SHAPE_POLYGON ) {
|
||||
return new SearchBound( fromMogo( bound.getPolyGonList() ) );
|
||||
} else if ( bound.getShape() == MogoSearchBound.SHAPE_RECTANGLE ) {
|
||||
return new SearchBound( fromMogo( bound.getLowerLeft() ), fromMogo( bound.getUpperRight() ) );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MogoPoiResult fromAMap( PoiSearchResult result ) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
MogoPoiResult mogoPoiResult = new MogoPoiResult();
|
||||
if ( result.getItems() != null ) {
|
||||
final List<PoiSearchItem> poiItems = result.getItems();
|
||||
final ArrayList< MogoPoiItem > mogoPoiItems = new ArrayList<>( poiItems.size() );
|
||||
for ( PoiSearchItem poiItem : poiItems ) {
|
||||
mogoPoiItems.add( fromAMap( poiItem.getPoi() ) );
|
||||
}
|
||||
mogoPoiResult.setPois( mogoPoiItems );
|
||||
}
|
||||
return mogoPoiResult;
|
||||
}
|
||||
|
||||
// public static MogoNaviInfo fromAMap(Context context, NaviInfo naviInfo ) {
|
||||
// if ( naviInfo == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoNaviInfo mogoNaviInfo = new MogoNaviInfo();
|
||||
// mogoNaviInfo.setCurrentRoadName( naviInfo.getCurrentRoadName() );
|
||||
// mogoNaviInfo.setCurrentSpeed( naviInfo.getCurrentSpeed() );
|
||||
// mogoNaviInfo.setCurStepRetainDistance( naviInfo.getCurStepRetainDistance() );
|
||||
// mogoNaviInfo.setCurStepRetainTime( naviInfo.getCurStepRetainTime() );
|
||||
// mogoNaviInfo.setIconResId( IconTypeUtils.getResIdByIconType( context, naviInfo.getIconType() ) );
|
||||
// mogoNaviInfo.setNextRoadName( naviInfo.getNextRoadName() );
|
||||
// mogoNaviInfo.setPathRetainDistance( naviInfo.getPathRetainDistance() );
|
||||
// mogoNaviInfo.setPathRetainTime( naviInfo.getPathRetainTime() );
|
||||
// mogoNaviInfo.setCurrentSpeed( naviInfo.getLimitSpeed() );
|
||||
// return mogoNaviInfo;
|
||||
// }
|
||||
//
|
||||
// public static MogoCongestionInfo fromAMap( AimLessModeCongestionInfo aimLessModeCongestionInfo ) {
|
||||
// if ( aimLessModeCongestionInfo == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// MogoCongestionInfo congestionInfo = new MogoCongestionInfo();
|
||||
// congestionInfo.setCongestionStatus( aimLessModeCongestionInfo.getCongestionStatus() );
|
||||
// congestionInfo.setEventLat( aimLessModeCongestionInfo.getEventLat() );
|
||||
// congestionInfo.setEventLon( aimLessModeCongestionInfo.getEventLon() );
|
||||
// congestionInfo.setEventType( aimLessModeCongestionInfo.getEventType() );
|
||||
// congestionInfo.setCongestionLinks( new ArrayList<MogoCongestionLink>() );
|
||||
// congestionInfo.setLength( aimLessModeCongestionInfo.getLength() );
|
||||
// congestionInfo.setRoadName( aimLessModeCongestionInfo.getRoadName() );
|
||||
// congestionInfo.setTime( aimLessModeCongestionInfo.getTime() );
|
||||
// if ( aimLessModeCongestionInfo.getAmapCongestionLinks() != null
|
||||
// && aimLessModeCongestionInfo.getAmapCongestionLinks().length != 0 ) {
|
||||
// for ( AMapCongestionLink amapCongestionLink : aimLessModeCongestionInfo.getAmapCongestionLinks() ) {
|
||||
// if ( amapCongestionLink == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// MogoCongestionLink link = new MogoCongestionLink();
|
||||
// link.setCongestionStatus( amapCongestionLink.getCongestionStatus() );
|
||||
// if ( amapCongestionLink.getCoords() != null ) {
|
||||
// link.setCoords( new ArrayList< MogoLatLng >() );
|
||||
// Iterator<NaviLatLng> iterator = amapCongestionLink.getCoords().iterator();
|
||||
// while ( iterator.hasNext() ) {
|
||||
// NaviLatLng naviLatLng = iterator.next();
|
||||
// if ( naviLatLng == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// link.getCoords().add( new MogoLatLng( naviLatLng.getLatitude(), naviLatLng.getLongitude() ) );
|
||||
// }
|
||||
// }
|
||||
// congestionInfo.getCongestionLinks().add( link );
|
||||
// }
|
||||
// }
|
||||
// return congestionInfo;
|
||||
// }
|
||||
//
|
||||
// public static MogoTraffic fromAMap(AMapNaviTrafficFacilityInfo[] aMapNaviTrafficFacilityInfos ) {
|
||||
// if ( aMapNaviTrafficFacilityInfos == null || aMapNaviTrafficFacilityInfos.length == 0 ) {
|
||||
// return null;
|
||||
// }
|
||||
// for ( AMapNaviTrafficFacilityInfo aMapNaviTrafficFacilityInfo : aMapNaviTrafficFacilityInfos ) {
|
||||
// if ( aMapNaviTrafficFacilityInfo == null ) {
|
||||
// continue;
|
||||
// }
|
||||
// MogoTraffic traffic = new MogoTraffic( MogoTraffic.TYPE_AIM );
|
||||
// traffic.setDistance( aMapNaviTrafficFacilityInfo.getDistance() );
|
||||
// traffic.setSpeedLimit( aMapNaviTrafficFacilityInfo.getLimitSpeed() );
|
||||
// traffic.setTrafficType( aMapNaviTrafficFacilityInfo.getBroadcastType() );
|
||||
// traffic.setLat( aMapNaviTrafficFacilityInfo.latitude );
|
||||
// traffic.setLon( aMapNaviTrafficFacilityInfo.longitude );
|
||||
// return traffic;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public static PolylineOptions fromMogo(MogoPolylineOptions options ) {
|
||||
if ( options == null ) {
|
||||
return null;
|
||||
}
|
||||
PolylineOptions target = new PolylineOptions();
|
||||
if ( options.getPoints() != null ) {
|
||||
List< LonLatPoint > points = new ArrayList<>();
|
||||
for ( MogoLatLng point : options.getPoints() ) {
|
||||
points.add( fromMogo( point ) );
|
||||
}
|
||||
target.setLonLatPoints( points );
|
||||
}
|
||||
target.setLineWidth( (int)options.getWidth() );
|
||||
target.setColor( options.getColor() );
|
||||
// target.zIndex( options.getWidth() );
|
||||
// target.visible( options.isVisible() );
|
||||
//// target.geodesic( options.isGeodesic() );
|
||||
// target.setDottedLine( options.isDottedLine() );
|
||||
// target.useGradient( options.isGradient() );
|
||||
// if ( options.getColorValues() != null ) {
|
||||
// target.colorValues( options.getColorValues() );
|
||||
// }
|
||||
// target.transparency( options.getTransparency() );
|
||||
// target.aboveMaskLayer( options.isAboveMaskLayer() );
|
||||
// target.lineCapType( PolylineOptions.LineCapType.LineCapRound );
|
||||
// target.lineJoinType( PolylineOptions.LineJoinType.LineJoinRound );
|
||||
// target.setDottedLineType( PolylineOptions.DOTTEDLINE_TYPE_CIRCLE );
|
||||
return target;
|
||||
}
|
||||
|
||||
// public static MogoLatLng fromAMap( LatLng latLng ) {
|
||||
// if ( latLng == null ) {
|
||||
// return null;
|
||||
// }
|
||||
// return new MogoLatLng( latLng.latitude, latLng.longitude );
|
||||
// }
|
||||
|
||||
public static MapCameraPosition fromAMap( CameraPosition position ) {
|
||||
if ( position == null ) {
|
||||
return null;
|
||||
}
|
||||
return new MapCameraPosition( fromAMap( position.getTarget() ), position.getBearing(), position.getTilt(), position.getZoom() );
|
||||
}
|
||||
|
||||
private static String getCategory(String key){
|
||||
String category = "";
|
||||
if(key.equals("加油站")){
|
||||
category= "6";
|
||||
}else if(key.equals("停车场")){
|
||||
category= "12";
|
||||
}else if(key.equals("餐馆")){
|
||||
category= "22";
|
||||
}else if(key.equals("洗车")){
|
||||
category= "8";
|
||||
}else if(key.equals("厕所")){
|
||||
|
||||
}
|
||||
return category;
|
||||
}
|
||||
}
|
||||
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_1.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_10.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_11.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_12.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_13.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_14.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_15.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_16.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_17.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_18.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_19.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_2.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_20.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_21.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_22.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_23.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_24.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_25.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_26.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_27.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_28.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_4.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_5.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_50.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_51.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_52.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_53.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_54.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_55.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_56.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_57.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_58.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_59.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_6.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_60.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_61.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_62.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_63.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_64.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_65.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_66.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_67.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_68.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_69.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_7.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_8.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_9.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/ic_endpoint.png
Normal file
|
After Width: | Height: | Size: 516 B |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/tc_10.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/tc_11.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
libraries/map-custom/src/main/res/drawable-ldpi/tc_12.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |